akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

char a[351][351];
int dp[351][351];
int cost[351][351];
int h, w; 

void calcdp(int x)
{
	for(int i = 0; i <= h; i++)
	{
		cost[i][h]=cost[h][i]=0;
		dp[i][h]=dp[h][i]=0;
	}
	for(int i = 2*h - 2; i >= 0; i--)
	{
		for(int j = 0; j < h; j++)
		{
			int k = i - j;
			if(k>=0&&k<h)
			{
				cost[k][j] = cost[k+1][j+1] + (a[h-1-k][x]==a[h-1-j][x+1]);
			}
		}
	}
	for(int i = 2*h - 2; i >= 0; i--)
	{
		for(int j = 0; j < h; j++)
		{
			int k = i - j;
			if(k>=0&&k<h)
			{
				dp[k][j] = min(dp[k+1][j], dp[k][j+1]) + cost[k][j];
			}
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>h>>w;

	for(int i = 0; i < h; i++)
	{
		for(int j = 0; j < w; j++)
		{
			cin >> a[i][j];
		}
	}
	
	int ans=0;
	for(int i=0;i+1<w;i++)
	{
		calcdp(i);
		ans+=dp[0][0];
	}
	
	cout<<ans<<'\n';
}


Measured memory_bytes: 1152
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????统一类型        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    ll h,n;cin>>h>>n;
    vector<ll>a(n+1),b(n+1);
    ll amax=0;
    for(ll i=1;i<=n;i++){
        cin>>a[i]>>b[i];
        chmax(amax,a[i]);
    }
    ll dp[1001][10001];
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=h;j++){
            dp[i][j]=INF;
        }
    }
    dp[0][0]=0;
    ll ans=INF;
    for(ll i=1;i<=n;i++){
        for(ll j=0;j<=h;j++){
            chmin(dp[i][j],dp[i-1][j]);
            if(j>=a[i]){
                chmin(dp[i][j],dp[i][j-a[i]]+b[i]);
            }
           
            
        }
        for(ll j=h;j-a[i]<=h;j++){
                       chmin(ans,dp[i][j-a[i]]+b[i]);
                   }
    }
    
  
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------









Measured memory_bytes: 78464
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222

ll dp[26000000];
ll a[3], b[3], c[3];



int main(void) {
  ios::sync_with_stdio(false); cin.tie(0);


  cin >> n;
  m = 26000000;
  rep(i, 2) cin >> a[i] >> b[i] >> c[i];
  ans = n;
  ma = n;
  rep(i, m) {
    if (i + a[0] < m) dp[i + a[0]] = max(dp[i + a[0]], dp[i] + a[1]);
    if (i + b[0] < m) dp[i + b[0]] = max(dp[i + b[0]], dp[i] + b[1]);
    if (i + c[0] < m) dp[i + c[0]] = max(dp[i + c[0]], dp[i] + c[1]);
  }
  rep(i, n + 1) {
    ma = max(ma, dp[i] + n - i);
  }

  rep(i, m) dp[i] = 0;
  rep(i, m) {
    if (i + a[1] < m) dp[i + a[1]] = max(dp[i + a[1]], dp[i] + a[0]);
    if (i + b[1] < m) dp[i + b[1]] = max(dp[i + b[1]], dp[i] + b[0]);
    if (i + c[1] < m) dp[i + c[1]] = max(dp[i + c[1]], dp[i] + c[0]);
  }

  rep(i, ma + 1) {
    ans = max(ans, dp[i] + ma - i);
  }
  cout << ans << endl;
  

  return 0;
}

Measured memory_bytes: 203392
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  int N, M; cin >> N >> M;

  map<int,int> ac; // ACになったら1
  map<int,int> wa; // 間違えた回数

  int wa_num = 0;
  int ac_num = 0;

  for(int i = 0; i < M; i++){
    int num; string S;
    cin >> num >> S;
    if(S == "AC"){
      if(ac.count(num) == 0){
        wa_num += wa[num];
        ac[num] = 1;
        ac_num++;
      } else {

      }
    } else {
      if(ac.count(num) == 0){
        wa[num]++;
      } else {

      }
    }
  }

  cout << ac_num << " " << wa_num << endl;

}


Measured memory_bytes: 12928
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <iostream>
#include <string>

#include <algorithm>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define PB push_back
#define MP make_pair

#define FOR(i, b, e) for(int i=(b);i<(e);i++)
#define REP(i, n) FOR(i,0,n)

#define ALL(v) (v).begin(),(v).end()

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VPII;

const int MOD = 1000000007;
const int INF = 1e9;

const double EPS = 1e-9;
const double PI = acos(-1.0);

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }

int N;
string s[200001];

map<string, int> m;

int main() {
    cin >> N;
    int max = 1;
    REP (i, N) {
        cin >> s[i];
        if (m.find(s[i]) != m.end()) {
            int tmp = ++m[s[i]];
            if (tmp > max) {
                max = tmp;
            }
        }
        else {
            m.insert(MP(s[i], 1));
        }
    }
    VS d;
    for (auto i = m.begin(); i != m.end(); i++) {
        if (i->second == max) {
            d.PB(i->first);
        }
    }
    sort(ALL(d));
    REP(i, d.size()) {
        cout << d[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 28404
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
    int a, b;

    cin >> a >> b;

    if(a == b) {
        cout << 2 * a << endl;
    } else if(a > b) {
        cout << 2 * a - 1 << endl;
    } else {
        cout << 2 * b - 1 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N;
  cin >> N;
  bool seven = false;
  while(N > 0){
    if(N % 10 == 7){
      seven = true;
      break;
    }
    N /= 10;
  }
  
  if(seven){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
    
using namespace std;
typedef long long ll;
    
int main()
{
    int N, M;
    cin >> N >> M;

    int suc = 0, pen = 0;
    unordered_map<int, bool> mon;
    unordered_map<int, int> tmppen;
    for (int i = 0; i < M; i++) {
        int in_p;
        string in_s;
        cin >> in_p >> in_s;

        auto itr = mon.find(in_p);
        if (itr != mon.end()) {
            continue;
        }
        if (in_s == "AC") {
            suc++;
            mon[in_p] = true;
            pen += tmppen[in_p];
            // cout << in_p << " " << tmppen[in_p] << " pen:" << pen << "\n";
        } else {
            auto itr2 = tmppen.find(in_p);
            if (itr2 == tmppen.end()) {
                tmppen[in_p] = 1;
            } else {
                tmppen[in_p]++;
            }
        }
    }
    cout << suc << " " << pen;

    return 0;
}

Measured memory_bytes: 8520
m, f, r = map(int, input().split())

while m != -1 or f != -1 or r != -1:
    if m == -1 or f == -1:
        print("F")
    elif 80 <= m+f:
        print("A")
    elif 65 <= m+f < 80:
        print("B")
    elif 50 <= m+f < 65:
        print("C")
    elif 30 <= m+f < 50:
        print("C" if 50 <= r else "D")
    else:
        print("F")

    m, f, r = map(int, input().split())


Measured memory_bytes: 5596
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-10; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}
//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	long long h,w,limit,nw=0,nh=0,ans=0,n,m;
	llint anw, anh, ans2=0;
	char c;
	bool check=false,acheck=false;
	string s, rs,ss,rss,sss,rsss;
	cin >> s;
	n = s.size();
	rs = s;
	reverse(rs.begin(), rs.end());
	ss = s.substr(0, (s.size()-1) / 2);
	rss = ss;
	reverse(rss.begin(), rss.end());
	sss = s.substr((s.size() + 2) / 2);
	rsss = sss;
	reverse(rsss.begin(), rsss.end());
	if (s == rs && ss == rss && sss == rsss)cout << "Yes" << endl;
	else cout << "No" << endl;
	please AC;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const string YES = "Yes";
const string NO = "No";

void solve(long long N){
    string s = to_string(N);
    if(count(s.begin(), s.end(), '7')){
        cout<<YES<<endl;
    }else{
        cout<<NO<<endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int dp[3100][3100];
pair<int, int> prevC[3100][3100];
int main(){

	string s, t;
	cin >> s >> t;
	fx(s.size()) {
		fy(t.size()) {
			prevC[x][y] = make_pair(-1, -1);
		}
	}
	fx(s.size()) {
		fy(t.size()) {
			if (s[x]==t[y]) {
				dp[x + 1][y + 1] = dp[x][y] + 1;
				prevC[x + 1][y + 1] = make_pair(x, y);
			}
			else {
				dp[x + 1][y + 1] = max({ dp[x][y], dp[x][y + 1],dp[x + 1][y] });
				if (dp[x + 1][y + 1]== dp[x][y]) {
					prevC[x + 1][y + 1] = prevC[x][y];
				}
				else if (dp[x + 1][y + 1] == dp[x][y+1]) {
					prevC[x + 1][y + 1] = prevC[x][y+1];
				}
				else {
					prevC[x + 1][y + 1] = prevC[x+1][y];
				}
			}
		}
	}
	vector<char> C;
	int x = s.size(), y = t.size();
	while (prevC[x][y].first>=0) {
		pb(C, s[prevC[x][y].first])
			auto z = prevC[x][y];
		x = z.first;
		y = z.second;
	}

	for (int i = C.size() - 1; i >= 0;i--) {
		cout << C[i];
	}
    return 0;
}



Measured memory_bytes: 111744
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
    double r = sc.nextDouble();
    double pi = Math.PI;
    double area = r*r*pi;
    double length = 2*r*pi;
    System.out.printf("%f %f",area,length);
}
}


Measured memory_bytes: 28428
#include<stdio.h>   

int main() 
{   
	int n, a, k, l, card[4][13];  
	char mark;    
	scanf("%d", &n);     
	
	for(k = 0; k < 4; k++)
	{     
		for(l = 0; l < 13; l++)
		{       
			card[k][l] = 0;    
		}  
	}    
	for(k = 0; k < n; k++)
	{    
		scanf(" %c%d", &mark, &a);     
		if(mark == 'S') card[0][a-1] = 1;     
		else if(mark == 'H') card[1][a-1] = 1;     
		else if(mark == 'C') card[2][a-1] = 1;     
		else card[3][a-1] = 1;  
	}     
	for(k = 0; k < 4; k++)
	{    
		for(l = 0; l < 13; l++)
		{       
			if(k == 0 && card[k][l] == 0) 
				printf("S %d\n", l+1);      
			else if(k == 1 && card[k][l] == 0)
				printf("H %d\n", l+1);       
			else if(k == 2 && card[k][l] == 0) 
				printf("C %d\n", l+1);       
			else if(k == 3 && card[k][l] == 0) 
				printf("D %d\n", l+1);     
		}   
	}   
	return 0;
}

Measured memory_bytes: 596
n = int(input())
A = list(map(int, input().split()))
f2 = 0
f4 = 0
f_another = 0
for a in A:
    #c = collections.Counter(prime_factorize(a))
    if a%4 == 0:
        f4 += 1
    elif a%2 == 0:
        f2 += 1
    else:
        f_another +=1
if n%2 == 0 and (n -f2//2 *2 -f4 *2 <= 0):
    print('Yes')
elif n%2 == 1 and (n -f2//2 *2 -f4 *2 <= 1):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
#include<iostream>
using namespace std;
int main(){
    long long H,W;
    cin>>H>>W;
    if(H==1LL||W==1LL){cout<<1<<endl;return 0;}
    cout<<H*(W/2LL)+W%2LL*(H+1LL)/2LL<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("02")
#define ll long long
#define _inline __inline__ __attribute__((always_inline))
using namespace std;
struct ios{
    inline char gc(){
        static const int IN_LEN=1<<18|1;
        static char buf[IN_LEN],*s,*t;
        return (s==t)&&(t=(s=buf)+fread(buf,1,IN_LEN,stdin)),s==t?-1:*s++;
    }
    template <typename _Tp> _inline ios & operator >> (_Tp &x){
        static char ch,sgn; ch=gc(),sgn=0;
        for(;!isdigit(ch);ch=gc()){if(ch==-1)return *this;sgn|=ch=='-';}
        for(x=0;isdigit(ch);ch=gc())x=x*10+(ch^'0');
        sgn&&(x=-x); return *this;
    }
}inc;
const int MAXN=1e5+5;
int n,m,fa[MAXN];

struct EDGE {
	int u,v;
}e[MAXN];

ll ans[MAXN],sz[MAXN];

int findset(int x) {
	if(x==fa[x]) return x;
	return fa[x]=findset(fa[x]);
}

int main() {
	inc>>n>>m;
	for(int i=1;i<=m;++i) {
		inc>>e[i].u>>e[i].v;
	}
	
	for(int i=1;i<=n;++i) 
	   fa[i]=i,sz[i]=1;
	
	ans[m]=(ll)n*(n-1)/2; 
	
	for(int i=m;i>=1;--i) {
		int u=findset(e[i].u),v=findset(e[i].v);
		if(u==v) 
		    ans[i-1]=ans[i];
		else {
			ans[i-1]=ans[i]-sz[v]*sz[u];
			sz[v]+=sz[u]; fa[u]=v;
		}
	}
	
	for(int i=1;i<=m;++i) 
	   cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>

using namespace std;

const int N = 3e5 + 5;

int a[N];

long long pre[N], suf[N];

int main() {
  memset(pre, -1, sizeof pre);
  memset(suf, -1, sizeof suf);
  int n;
  scanf("%d", &n);
  priority_queue< int > pq;
  long long cur = 0;
  for (int i = 0; i < 3 * n; i++) {
    scanf("%d", a+i);
    pq.push(-a[i]);
    cur += a[i];
    while (pq.size() > n) {
      int top = pq.top();
      cur += top;
      pq.pop();
    }
    if (pq.size() == n) {
      pre[i] = cur;
    }
  }
  while (!pq.empty()) pq.pop();
  cur = 0;
  for (int i = 3 * n-1; i >= 0; i--) {
    cur += a[i];
    pq.push(a[i]);
    while (pq.size() > n) {
      int top = pq.top();
      cur -= top;
      pq.pop();
    }
    if (pq.size() == n) {
      suf[i] = cur;
    }
  }
  long long ans = -1e18;
  for (int i = 0; i < 3 * n; i++) {
    if (pre[i] == -1 || suf[i+1] == -1) continue;
    if (ans < pre[i] - suf[i+1])
      ans = pre[i] - suf[i+1];
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 6648
import math

N = input().split(" ")
A = int(N[0])
B = int(N[1])
H = int(N[2])
M = int(N[3])

naga = (30 * H) + (M / 2)
mizi = 6 * M

if naga < mizi:
  deg = mizi - naga
elif naga >= mizi:
  deg = naga - mizi
if deg >= 180:
  deg = 360 - deg

s = (A ** 2) + (B ** 2) - (2 * A * B * math.cos(math.radians(deg)))

s = s**(1/2)
print('{:.20f}'.format(s))

Measured memory_bytes: 9560
#include "bits/stdc++.h"

#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			1'010'000'000'000'000'017LL
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )

using namespace std;

template<class T>
bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>
bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}


void Main()
{
	ll H, W, K;
	cin >> H >> W >> K;
	vs c(H);
	rep(i, 0, H) cin >> c[i];
	int ans = 0;

	rep(maskR, 0, (1 << H)) {
		rep(maskC, 0, (1 << W)) {
			int black = 0;
			rep(i, 0, H) {
				rep(j, 0, W) {
					if (((maskR >> i) & 1) == 0 && ((maskC >> j) & 1) == 0 && c[i][j] == '#') black++;
				}
			}
			if (black == K) ans++;
		}
	}

	cout << ans << endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	Main();
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>

using namespace std;

int main(){
    cin.tie(0);

    long long sx, sy; cin >> sx >> sy;
    long long tx, ty; cin >> tx >> ty;
    long long x = sx;
    long long y = sy;
    
    for (int i = sx; i < tx; i++){
        cout << 'R';
        x++;
    }
    for (int i = sy; i < ty; i++){
        cout << 'U';
        y++;
    }
    for (int i = sx; i < tx; i++){
        cout << 'L';
        x--;
    }
    for (int i = sy; i < ty; i++){
        cout << 'D';
        y--;
    }
    cout << 'D';
    y--;
    for (int i = sx; i < tx; i++){
        cout << 'R';
        x++;
    }
    cout << 'R';
    x++;
    cout << 'U';
    y++;
    for (int i = sy; i < ty; i++){
        cout << 'U';
        y++;
    }
    y++;
    cout << 'L';
    x--;
    cout << 'U';
    y++;
    for (int i = sx; i < tx; i++){
        cout << 'L';
        x--;
    }
    cout << 'L';
    x--;
    cout << 'D';
    y--;
    for (int i = sy; i < ty; i++){
        cout << 'D';
        y--;
    }
    cout << 'R';
    x++;
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, cnt = 0;
    cin >> n;

    vector<int> p(n);
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    
    for (int i = 1; i <= n - 2; i++)
    {
        if (p[i - 1] < p[i] && p[i] < p[i + 1])
        {
            cnt++;
        }
        else if (p[i + 1] < p[i] && p[i] < p[i - 1])
        {
            cnt++;
        }
        
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
//
#include<bits/stdc++.h>

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const ll MOD = 1000000007;

const int N = 1000005;

void set_file_io(string in, string out)
{
    freopen((in+".in").c_str(), "r", stdin);
    freopen((out+".out").c_str(), "w", stdout);
}


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //set_file_io("input", "output");
    ll d, t, s;
    cin >> d >> t >> s;
    if(t*s >= d)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll X; cin >> X;

    ll ans = (X/500)*1000 + ((X%500)/5)*5;

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
N = int(input().strip())
P = list(map(int, input().strip().split(' ')))
ans = 0
for i in range(1, N-1):
  if P[i-1] < P[i] < P[i+1] or P[i-1] > P[i] > P[i+1]:
    ans += 1
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
static const int INFH = (1<<30)-1;
static const int INFL = -INFH;

vector<pair<char, int>> runLength(string x)
{
	char now = x[0];
	int count = 1;
	vector<pair<char, int>> ret;
	for (int i = 1; i < x.size(); ++i)
	{
		if(x[i] != now)
		{
			ret.push_back(make_pair(now, count));
			now = x[i];
			count = 1;
		}
		else
		{
			++count;
		}
	}
	ret.push_back(make_pair(now, count));
	return ret;
}

long long int wa(long long int x)
{
	if (x%2==0)
	{
		return (long long int)((x/2)*(x+1));
	}
	else
	{
		return (long long int)(x*((x+1)/2));
	}
}

int main()
{
	string in;
	cin >> in;
	vector<pair<char, int>> r = runLength(in);
	long long int ans = 0;
	if(r.size() == 1)
	{
		cout << wa(r[0].second) << endl;
		return 0;
	}
	for (int i = 0; i < r.size(); ++i)
	{
		if(i == 0 && r[i].first == '>')
		{
			ans += wa(r[i].second);
		}
		else if (i == r.size() - 1 && r[i].first == '<')
		{
			ans += wa(r[i].second);
		}
		else
		{
			ans += wa(max(r[i].second, r[i + 1].second)) + wa(min(r[i].second, r[i + 1].second)-1);
			++i;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;

int main(){
  int A,count;
  cin>>A;
  count=0;
  vector<int> v(A);
  for(int i=0;i<A;i++)
    cin>>v.at(i);
  for(int i=0;i<A;i++){
    if(v.at(i)%2==0){
      count++;
      v.at(i)/=2;
      i--;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define INT(n) int n;assert(0<scanf("%d",&n))
#define VL(v,n) vector<ll> v(n);REP(i,n){assert(0<scanf("%lld",&v[i]));}

int main(){
  INT(x); INT(y); INT(z); INT(k);
  VL(xs, x); VL(ys, y); VL(zs, z);
  vector<ll> xys, xyzs;
  for(ll xi: xs){
    for(ll yj: ys){
      xys.PB(xi + yj);
    }
  }
  sort(xys.rbegin(), xys.rend());
  sort(zs.rbegin(), zs.rend());
  REP(i, x * y){
    if (k < i){break;}
    REP(j, z){
      xyzs.PB(xys[i] + zs[j]);
    }
  }
  sort(xyzs.rbegin(), xyzs.rend());
  REP(i, k){
    printf("%lld\n", xyzs[i]);
  }
  return 0;
}

Measured memory_bytes: 43368
#include <iostream>
using namespace std;
 
int main() {
    int n, x, t, a, b;
    cin >> n >> x >> t;
    a = n / x;
    if (0 != n % x) {
        a = a + 1;
    }
    b = a * t;
    cout << b;
 
    return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  if(a + b < 2 * c) {
    cout << x * a + y * b << endl;
  } else {
    if(x > y) {
      ll s = y * 2 * c;
      s += min(a, 2 * c) * (x - y);
      cout << s << endl;
    } else {
      ll s = x * 2 * c;
      s += min(b, 2 * c) * (y - x);
      cout << s << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n;
	cin >> n;
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		if(i%3==0 or i%5==0)
			;
		else
			ans+=i;
	}
	cout << ans << endl;




}

Measured memory_bytes: 3188
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
const int M=1e9+7;
int n,m;
ll ans=1,f[1000005]={1},g[1000005]={1};
ll ksm(ll x,ll y){
    ll s=1;
    while(y){
        if(y&1)s=(s*x)%M;
        x=(x*x)%M;
        y>>=1;
    }
    return s;
}
ll work(int x,int y){
    return f[x]%M*g[y]%M*g[x-y]%M;
}
int main(){
	in(n);in(m);
    for(int i=1;i<=n;i++){
        f[i]=f[i-1]*i%M;
        g[i]=ksm(f[i],M-2);
    }
    int k=min(n-1,m);
    for(int i=1;i<=k;i++){
        ll x=work(n,i);
        ll y=work(n-1,i);
        ans=(ans+x*y%M)%M;
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
using namespace std;

int main(){
  int N;
  int a[10];
  cin >> N;
  for(int i = 0; i < 4; i++){
    a[i] = N%10;
    N /= 10;
  }
  if(a[0] == a[1] && a[1] == a[2]){
    cout << "Yes\n";
  }
  else if(a[1] == a[2] && a[2] == a[3]){
    cout << "Yes\n";
  }
  else{
    cout << "No\n";
  }
  return 0;
}


Measured memory_bytes: 256
import java.lang.Math

val MOD: Int = 1000000000 + 7
val MODL: Long = MOD.toLong()

fun main(args: Array<String>)
{
    val (a, p) = read().split().toInt()
    println((3*a+p)/2)
}

fun read(): String = readLine()!!
fun CharSequence.split(): List<String> = this.split(" ")
fun Iterable<String>.toInt(): List<Int> = this.map{it.toInt()}


Measured memory_bytes: 36000
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from math import gcd

# グラフを作って周り見て一番高ければおk？
N, M = read_ints()
H = read_ints()
graph = defaultdict(lambda: [])
for _ in range(M):
    a, b = read_ints()
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
ans = 0
for i in range(N):
    for adj in graph[i]:
        if H[i] <= H[adj]:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 103328
L, R = map(int, input().split())

border = (R//2019 - L//2019)

if border >= 1 or ((R%2019)==0) or ((L%2019)==0):
  print(0)
else:
  L %= 2019
  R %= 2019
  ans = 2019
  for i in range(L, R):
    for j in range(i+1, R+1):
      ans = min(ans, (i*j)%2019)
  print(ans)






Measured memory_bytes: 3060
menus = 5.times.map{gets.to_i}
hitoketa = menus.map{|i| i.to_s[-1].to_i > 0 ? i.to_s[-1].to_i : 10}
idx = hitoketa.find_index(hitoketa.min)
last = menus[idx]
menus.delete_at(idx)

puts menus.map{|i| ((i/10.0).ceil*10).to_i}.inject(:+) + last





Measured memory_bytes: 1788
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        int a,b,c,t;
        scanf("%d %d %d",&a,&b,&c);
        for(;;){
                if(a<=b && b<=c){
                        break;
                }
                if(a>b){
                        t=a;
                        a=b;
                        b=t;
                }
                if(b>c){
                        t=b;
                        b=c;
                        c=t;
                }
        }
        printf("%d %d %d\n",a,b,c);
        return 0;
}

Measured memory_bytes: 1172
#include <iostream>
#include <string>

using namespace std;

int main(){

    string s; cin >> s;

    int price = 700;

    for( int i = 0; i < 3; i++){\
        if( s[i] != 'x'){
            price += 100;
        }
    }

    cout << price;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
K = int(input())
X_MAP = map(int, input().split())

def ans(num):
    print(num * 2)

def main():
    accumulation = 0
    for x in X_MAP:
        distance = min(x, K - x)
        accumulation += distance
    ans(accumulation)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // ABC148A - Round One

        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        int ans = 0;
        if (a == 1 && b == 2 || a == 2 && b == 1) {
            ans = 3;
        } else if (a == 1 && b == 3 || a == 3 && b == 1) {
            ans = 2;
        } else {
            ans = 1;
        }
        
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>

using namespace std;

int main() {

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	string s;
	cin >> s;
	bool flag = true;
	for (int i = 0; i < s.size(); i += 2) {
		if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D') {
			continue;
		}
		else {
			flag = false;
			break;
		}
	}
	if (!flag) {
		cout << "No\n";
		return 0;
	}
	for (int i = 1; i < s.size(); i += 2) {
		if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D') {
			continue;	
		}
		else {
			flag = false;
			break;
		}
	}
	if (flag) cout << "Yes";
	else cout << "No";
	cout << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <memory.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (i = a; i < (n); i++)
#define all(in) in.begin(), in.end()

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  cout << fixed;

  uint32_t n, k;
  cin >> n >> k;
  vector<int64_t> h(n);
  vector<int64_t> dp(n);

  dp[0] = 0;
  rep(i, n) {
    cin >> h[i];

    if (i > 0) {
      int64_t minDP = INT64_MAX;
      for (int j = 1; j <= k && i - j >= 0; j++) {
        minDP = min(minDP, dp[i - j] + abs(h[i - j] - h[i]));
      }
      dp[i] = minDP;
    }
  }

  cout << dp[n - 1];
}

Measured memory_bytes: 1792
#include <iostream>

#include <stdlib.h>

using namespace std;

int main(){

   int n, m;

   cin >> n >> m;

   int ans = 0;
   int h[n];
   int bad[n] = {0};

   for(int i = 0; i < n; i++){
      cin >> h[i];
   }

   for(int i = 0; i < m; i++){
      int a, b;
      cin >> a >> b;

      if(h[b-1] < h[a-1]){
         bad[b-1] = 1;
      }
      else if(h[a-1] < h[b-1]){
         bad[a-1] = 1;
      }
      else{
         bad[a-1] = bad[b-1] = 1;
      }
   }

   for(int i = 0; i < n; i++){
      if(bad[i] == 0){
         ans++;
      }
   }

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 4412
#include <bits/stdc++.h> 
 
#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007
 
using ll  = long long;
using ull = unsigned long long;
 
int main(int argc, char *argv[])
{
    int a, b, c;
    std::cin >> a >> b >> c;

    if (a == b && b == c && c == a) {
        std::cout << 1 << std::endl;
    } else if (a != b && b == c && c != a) {
        std::cout << 2 << std::endl;
    } else if (a == b && b != c && c != a) {
        std::cout << 2 << std::endl;
    } else if (a != b && b != c && c == a) {
        std::cout << 2 << std::endl;
    } else {
        std::cout << 3 << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main(){
    string str;
    cin >> str;
    for(int i=0;i<str.size();i++){
        if(str[i]=='9'){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
const ll nmax = 1e9 + 7;
const ll MOD = 998244353;
const double PI = 2 * asin(1);

int main(){
  int N, M; cin >> N >> M;
  string S = "No";
  if (N == M) S = "Yes";
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int main(){
    int a, b; cin >> a >> b;
    int ans = max(0,a-2*b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<vector>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const int N=1e5+5;
template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
int n;
set<int>s;
int main(){
	cin>>n;
	int x,flag=0;
	for(int i=1;i<=n;i++){
		read(x);
		if(s.count(x)!=0)flag=1;
		else s.insert(x);
	}
	if(flag)puts("NO");
	else puts("YES"); 
	return 0;
}


Measured memory_bytes: 9600
// https://atcoder.jp/contests/abc133/tasks/abc133_e
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

const MOD: i64 = 1e9 as i64 + 7;

fn dfs(graph: &Vec<Vec<usize>>, now: usize, par: usize, k: i64) -> i64 {
    let mut ways = 1;
    let mut colors = 0;
    if par == graph.len() {
        colors = k-1;
    } else {
        colors = k-2;
    }
    for &to in &graph[now] {
        if to == par {
            continue;
        }
        ways *= colors;
        ways %= MOD;
        ways *= dfs(graph, to, now, k);
        ways %= MOD;
        if colors == 0 {
            break;
        }
        colors -= 1;
    }
    ways
}

fn main() {
    input! {
        n: usize, k: i64,
        edges: [(usize1, usize1); n-1]
    };

    let mut graph = vec![vec![]; n];
    for e in edges {
        graph[e.0].push(e.1);
        graph[e.1].push(e.0);
    }

    println!("{}", k * dfs(&graph, 0, n, k) % MOD);
}


Measured memory_bytes: 20348
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#define maxn 400010
#define ll long long
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define pii pair<int, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define IL inline
#define ss system
using namespace std;

int a[maxn], f[maxn], n, m;
const int p = 1e9 + 7;
template <class T> void read(T &x) {
  char ch = x = 0;
  bool fl = false;
  while (!isdigit(ch))
    fl |= ch == '-', ch = getchar();
  while (isdigit(ch))
    x = x * 10 + ch - '0', ch = getchar();
  x = fl ? -x : x;
}
int main() {
  cin >> n >> m;
  for (int i = 1, x; i <= m; i++) {
    cin >> x, a[x] = 1;
  }
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    f[i] = (f[i - 1] + f[i - 2]) % p;
    if (a[i])
      f[i] = 0;
  }
  cout << f[n] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  int X;
  if (1 <= b && b <= 9) X = 10 * a + b;
  else if (10 <= b && b <= 99) X = 100 * a + b;
  else X = 1000 * a + b;
  int k = sqrt(X);
  if (k * k == X) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
def getscore(c):
  if c == "r":
    return P
  if c == "s":
    return R
  if c == "p":
    return S
  return 0
r = 0
for n in range(K):
  p = ""
  for i in range(n, N, K):
    c = T[i]
    if c == p:
      p = ""
    else:
      r += getscore(c)
      p = c
print(r)


Measured memory_bytes: 3316
import scala.io.StdIn.readInt

object Main {

  def main(args:Array[String]) = {
    def loop(i:Int, x:Int, y:Int):Int = if(i == 0) y else loop(i-1, y, x+y)
    val n = readInt
    println(loop(n,0,1))
  }
}


Measured memory_bytes: 43752
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  
  double sum = 0;
  rep(i, n) {
    cin >> vec[i];
    sum += vec[i];
  }
  // 平均を求める
  double avg = sum / n;
  
  int p1 = int(floor(avg));
  int p2 = int(ceil(avg));

  // 総和を計算する
  int ans1 = 0;
  int ans2 = 0;

  rep(i, n) {
    ans1 += (vec[i] - p1) * (vec[i] - p1);
    ans2 += (vec[i] - p2) * (vec[i] - p2);
  }

  int ans = min(ans1, ans2);

  cout << ans << endl;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
A = list(map(int, input().split()))

Amin = A.index(1)

left = len(A[:Amin])
right = len(A[Amin:])

ans = 0
if left <= right:
    ans += left // (k-1)
    right += left % (k-1)
    ans += ((right-1) + (k-2)) // (k-1)
else:
    ans += (right-1) // (k-1)
    left += right % (k-1)
    ans += (left + (k-2)) // (k-1)
print(ans)

Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int n;
    vector<int> b(100009, 0);
    int ans=0;
    int tmp=0;
    int ma=0;
    int mi=100009;
    
    cin >> n;
    
    vector<int> a(n, 0);
    
    for(int i=0; i<=n-1; i++){
        
        cin >> a.at(i);
        ma = max(ma, a.at(i));
        mi = min(mi, a.at(i));
        
    }
    
    sort(a.begin(), a.end());
    
    for(int i=0; i<=n-1; i++){
        
        tmp = a.at(i);
        b.at(tmp) = i + 1;
        
    }
    
    for(int i=1; i<=100003; i++){
        
        // cout << i << " >> " << b.at(i) << endl;
        
        if(b.at(i)==0){
            
            b.at(i) = b.at(i-1);
            
        }
        
        // cout << i << " >> " << b.at(i) << endl;
        
    }
    
    ans = max(ans, b.at(2));
    
    for(int i=0; i<=100003; i++){
        
        ans = max(ans, b.at(i+3)-b.at(i));
        
    }
    
    cout << ans << endl;
    
    return 0;
    
}

Measured memory_bytes: 1024
// Created by Sharat Sachin
#include <bits/stdc++.h>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(ll i=0;i<(n);++i)
#define repA(i,a,n) for(ll i=a;i<=(n);++i)
#define repD(i,a,n) for(ll i=a;i>=(n);--i)
using namespace std;
using ll = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n,k;
    cin>>n>>k;
    vector<ll>  v(n),sol(n);
    rep(i,n) cin>>v[i];
    rep(i,n){
        if(i==0) sol[0]=0;
        else if(i==1) sol[1]=abs(v[1]-v[0]);
        else {
        	sol[i]=numeric_limits<ll>::max();
        	for(ll j=i-1;j>=max(0ll,i-k);j--) sol[i]=min(sol[i],sol[j]+abs(v[i]-v[j]));
        }
    }
    cout<<sol[n-1];
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <algorithm>

#define rep(i, n) for (int i = 0; i < (int)n; i++)

using namespace std;

int main() {
	int N = 0, K = 0, mv = 1;
	cin >> N >> K;

	rep(i, N) {
		int a = mv * 2;
		int b = mv + K;
		mv = min(a, b);
	}

	cout << mv << endl;
}

Measured memory_bytes: 256