akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,y;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	std::cout<<std::fixed<<std::setprecision(30);
	cin>>n>>y;
	y /= 1000;
	ll as=-1,ans=-1,ans2=-1;
	rep(i,y/10+1){
		ll tmp = 10*i;
		ll nok = n-i;
		if(tmp + nok*5 < y)continue;
		if(tmp + nok > y){
			continue;
		}
		rep(j,nok+1){
			if(tmp+5*j+(nok-j)==y){
				as = nok-j;
				ans = j;
				ans2 = i;
				break;
			}
		}
	}
	cout<<ans2<<" "<<ans<<" "<<as<<endl;
	return 0;
}

Measured memory_bytes: 256
x, k, d = list(map(int, input().rstrip().split(" ")))
x = abs(x)
x1 = x%d
k1 = x//d
x2 = d - x1
if k < k1:
  print(x-k*d)
else:
  if (k - k1)%2 == 0:
    print(x1)
  else:
    print(x2)

Measured memory_bytes: 9164
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    S = SS()
    T = SS()

    ans = len([(i, j) for i, j in zip(S, T) if i == j])
    print(ans)

if __name__ == '__main__':
    resolve()


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

#define infi            2e9
#define infl            5e18
#define MX              100005
#define pi              2*acos(0.0)
#define ll              long long int
#define rr              read()
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define ms(a,b)         memset(a, b, sizeof(a))
#define loop(i,n)       for(register int i=0;i<n;i++)
#define pool(i,n)       for(register int i=n-1;i>=0;i--)
#define loop1(i,n)      for(register int i=1;i<=n;i++)
#define pool1(i,n)      for(register int i=n;i>0;i--)

using namespace std;

inline ll read(){char c=getchar();ll num,sign=1;for(;c<'0'||c>'9';c=getchar())if(c=='-')sign=-1;for(num=0;c>='0'&&c<='9';){c-='0';num=num*10+c;c=getchar();}return num*sign;}
// inline ll pw(ll b, ll p){ll ans=1;while(p>0){if(p&1)ans*=b;p>>=1;b*=b;}return ans;}
// inline bool isPrime(ll n){if(n==1)return false;if(n==2)return true;if(!(n%2))return false;for(ll i=3;i<=sqrt(n);i+=2)if(!(n%i))return false;return true;}
// inline ll gcd(ll a, ll b){if(a==0)return b;return gcd(b%a,a);}

// //*************************************  Bitmask Opereations  **********************************//
// int Set(int N,int pos){return N=N | (1<<pos);}
// int reset(int N,int pos){return N= N & ~(1<<pos);}
// bool check(int N,int pos){return (bool)(N & (1<<pos));}
// //********************************************************************************************//


int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    //#ifdef rid.dle
    //freopen("in.txt", "r", stdin);
    //#endif
    
    ll n=rr;

    ll ans=n*n;

    cout << ans*3LL << endl;

    return 0;
}

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


int main()
{
   int n ;
   string s ;
   cin >> n ;
   cin >> s;
   for(int i=0;i<s.length();++i)
   {
       if(s.at(i)+n<=90) s.at(i)+=n;
       else s.at(i)=s.at(i)+n+65-91;
   }
    cout << s ;
    return 0;
}


Measured memory_bytes: 256
//If you are reading this then you are at wrong place.
#include<bits/stdc++.h>
#define mod 1000000007
#define lli long long int
using namespace std;
bool prime [1000001];
void debug(lli a){cout<<a<<endl;}
lli sieve(lli a){memset(prime,true,sizeof(prime));lli p,i;for(p=2;p*p<=a;p++){if(prime[p]==true){for(i=p*2;i<=a;i+=p)prime[i]=false;}}return 0;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
int main()
{
	//ifstream cin("testcase.txt");
	//ofstream cout("output.txt");	
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);	
	cout.precision(20);
	lli t,i,j;
	//cin>>t;
	//memset(dp, -1, sizeof dp);
	t=1;
	lli counter1=0;
	while(t--)
	{
		counter1++;
		int a,b,c;
		cin>>a>>b>>c;
		if(c>=a && c<=b)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
		cout<<"No"<<endl;
		//cout<<"Case #"<<counter1<<" ";
		//cout<<endl;	
	}	
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int w;
    int a,b;
    int t;
    int c[2];
    scanf("%d%d%d",&w,&a,&b);
    if(a>b)
    {
        t=a;
        a=b;
        b=t;
    }
    c[0]=b-(a+w);
    c[1]=(b+w)-a;
    if(c[0]<c[1])
    {
        if(c[0]<0)
            printf("0\n");
        else
            printf("%d\n",c[0]);
    }
    else
    {
        if(c[1]<0)
            printf("0\n");
        else
            printf("%d\n",c[1]);
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,m,n,l;
    vector<char>v1;
    vector<char>v2;
    string s;
    cin>>s;
    l=s.size();
    m=(l-1)/2;
    for(i=0,j=m-1; i<m; i++, j--)
    {
        if(s[i]!=s[j])
        {
            cout<<"No"<<endl;
            return 0;
        }
        v1.push_back(s[i]);
    }
    m=(l+3)/2;
    for(i=m-1,j=l-1; i<l; i++,j--)
    {
        if(s[i]!=s[j])
        {
            cout<<"No"<<endl;
            return 0;
        }
        v2.push_back(s[i]);
    }
    if(v1==v2)
    cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 256
//インクルード
#include <cstdlib>
#include <iostream>
#include <string>

//メイン関数
int main() {
	//入力の取得
	int A;
	int B;
	int C;
	int D;
	int answer;

	std::cin >> A >> B >> C >> D;

	int square1 = A * B;
	int square2 = C * D;

	if(square1 > square2) {
		answer = square1;
	} else {
		answer = square2;
	}

	//答えの出力
	std::cout << answer << std::endl;

	//正常終了
	return EXIT_SUCCESS;
}


Measured memory_bytes: 256
s = list(str(input()))

def main():
    if s[0] == "R":
        if s[1] == "R":
            if s[2] == "R":
                print("3")
                return
        if s[1] == "S":
            if s[2] == "R":
                print("1")
                return
        if s[1] == "R":
            if s[2] == "S":
                print("2")
                return
        if s[1] == "S":
            if s[2] == "S":
                print("1")
                return
                
    if s[0] == "S":
        if s[1] == "R":
            if s[2] == "R":
                print("2")
                return
        if s[1] == "S":
            if s[2] == "S":
                print("0")
                return
        if s[1] == "R":
            if s[2] == "S":
                print("1")
                return
        if s[1] == "S":
            if s[2] == "R":
                print("1")
                return
        
main()

Measured memory_bytes: 9104
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		long a = in.nextLong();
		int b = 0;
		for(int i = 0;i < s.length();i ++) {
			if(s.charAt(i) == '1')b ++;
			else break;
		}
		if(b >= a)System.out.println(1);
		else System.out.println(s.charAt(b));
	}
}


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

// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
//clock_t tStart = clock();
//printf("Time taken: %.9fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define maxn 200007

#define ll long long int

ll mod=1e9+7;



int main(){
	int n;
	cin>>n;
	int ans=0;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		if(i%2==0){
			ans+=a%2;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3632
#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
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

struct DSU
{
	int S;
	
	struct node
	{
		int p; ll sum; int e=0;
	};
	vector<node> dsu;
	
	DSU(int n)
	{
		S = n;
		for(int i = 0; i < n; i++)
		{
			node tmp;
			tmp.p = i; tmp.sum = 0; tmp.e=0;
			dsu.pb(tmp);
		}
	}
	
	void reset(int n)
	{
		dsu.clear();
		S = n;
		for(int i = 0; i < n; i++)
		{
			node tmp;
			tmp.p = i; tmp.sum = 0; tmp.e=0;
			dsu.pb(tmp);
		}
	}
	
	int rt(int u)
	{
		if(dsu[u].p == u) return u;
		dsu[u].p = rt(dsu[u].p);
		return dsu[u].p;
	}
	
	bool merge(int u, int v)
	{
		u = rt(u); v = rt(v);
		if(u == v) 
		{
			if(dsu[u].e==0) 
			{
				dsu[u].e=1; return true;
			}
			return false;
		}
		if(dsu[u].e&&dsu[v].e) return false;
		if(rand()&1) swap(u, v);
		dsu[u].e+=dsu[v].e;
		dsu[v].p = u;
		dsu[u].sum += dsu[v].sum;
		return true;
	}
	
	bool sameset(int u, int v)
	{
		if(rt(u) == rt(v)) return true;
		return false;
	}
	
	ll getstat(int u)
	{
		return dsu[rt(u)].sum;
	}
};

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,h,w; cin>>n>>h>>w;
	DSU dsu(h+w);
	vector<pair<ll,ii> > edges;
	for(int i=0;i<n;i++)
	{
		int x,y,a; cin>>x>>y>>a; x--; y--;
		edges.pb({a,{x,y+h}});
	}
	sort(edges.rbegin(),edges.rend());
	ll ans=0;
	for(int i=0;i<edges.size();i++)
	{
		if(dsu.merge(edges[i].se.fi,edges[i].se.se))
		{
			ans+=edges[i].fi;
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 9964
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<deque>
#include <iomanip>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
llfor;ll mod=1000000007;
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll ans=1;rep(i,0,n){ans*=x;ans%=mod;}return ans;}
/*階乗*/ll fact(ll x){ll ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){ll ans=1;rrp(i,n-r+1,n+1){ans*=i;ans%=mod;}return ans/=fact(r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=1,tmp=n;while(tmp/10>0){tmp/=10;d++;}return d;}
ll ans=0;
////////////////////////////////////////////////////////////
int main(){
 ll k;
 cin>>k;
 vector<ll>lnln; 
 ll ps,bef;
 ll st=0;
 rep(i,1,10)push(lnln,i);
 ll cnt=0,o;
 
 while(distance(all(lnln))<k){
  cnt=0;
  for(j=st;j<distance(all(lnln));j++){
   rep(o,-1,2){
    bef=lnln[j]%10;
    ps=bef+o;
    if(ps>=0&&ps<=9)lnln.push_back(10*lnln[j]+ps);
    cnt++;
   }
   if(distance(all(lnln))>=k)break;
  //cout<<i<<" "<<j<<" "<<distance(all(lnln))<<endl;
  }
 // if(distance(all(lnln))>=99990) cout<<distance(all(lnln))<<" ";
  st+=cnt;
 }
// pnn;
 //rep(i,5000,distance(all(lnln)))cout<<lnln[i]<<" ";pnn;
 ans=lnln[k-1];
 cout<<setprecision(18)<<ans<<endl; 
return 0;}


Measured memory_bytes: 4236
n=int(input())
a=[int(input()) for i in range(n)]

b=a[0]
cnt=1
if b==2:
  print(cnt)
else:
  
  while cnt<=n+2:
    b=a[b-1]
    cnt+=1
    if b==2:
      print(cnt)
      exit()
      
  print(-1)






Measured memory_bytes: 7084
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <bitset>
#include <sstream>
#include <queue>

#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define sz(a) ((int) (a).size())
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

typedef long long int64;
typedef long double ldb;

const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);

template <class T> T sqr (T x) {return x * x;}
template <class T> T abs (T x) {return x < 0 ? -x : x;}

int main () {
    ios_base::sync_with_stdio(0);
//	freopen("input.txt", "rt", stdin);
//	freopen("output.txt", "wt", stdout);
	
	int n;
	cin >> n;
	
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}

	vector<vector<int>> d(n, vector<int>(2));
	d[0][0] = d[0][1] = 1;
	for (int i = 1; i < n; ++i) {
		d[i][0] = min(d[i - 1][0], d[i - 1][1]) + 1;
		d[i][1] = min(d[i - 1][0], d[i - 1][1]) + 1;
		
		if (a[i] <= a[i - 1]) {
			d[i][0] = min(d[i][0], d[i - 1][0]);
		}

		if (a[i] >= a[i - 1]) {
			d[i][1] = min(d[i][1], d[i - 1][1]);
		}
	}

	cout << min(d[n - 1][0], d[n - 1][1]) << endl;


	return 0;
}


Measured memory_bytes: 6144
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int dx[] = {-1, 0, 1, 0};
        int dy[] = {0, 1, 0, -1};
        char map[][] = new char[n][m];
        for(int i=0; i<n; i++){
            map[i] = sc.next().toCharArray();
        }
        for(int i=0; i<n; i++){
            for(int j=0; j<m; j++){
                if(map[i][j]=='#'){
                    for(int k=0; k<4; k++){
                        boolean ans = false;
                        if(j+dx[k]>=0 && j+dx[k]<m && i+dy[k]>=0 && i+dy[k]<n){
                            if(map[i+dy[k]][j+dx[k]]=='#'){
                                ans = true;
                            }
                            if(ans){
                                break;
                            }
                            if(k==3){
                                System.out.println("No");
                                return;
                            }
                        }
                    }
                }
            }
        }
        System.out.println("Yes");
        
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c - '0';}


// TODO: write
int main() { 
  string s;cin>>s;
  int k;cin>>k;
  vector<string> str;
  rep(i,s.size()+1){
    for(int j = 1;j < s.size()+1-i && j <= k;++j){
      str.pb(s.substr(i,j));
    }
  }
  sort(all(str));
  UNIQUE(str);
  print(str[k-1]);
  return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#include <algorithm>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

inline int min(int x, int y) {return x < y ? x : y;}
inline long min(long x, long y) {return x < y ? x : y;}
inline int max(int x, int y) {return x > y ? x : y;}
inline long max(long x, long y) {return x > y ? x : y;}

inline void swap(int &a, int &b) {
    int tmp = a;
    a = b;
    b = tmp;
}

inline int euclid(int a, int b) {
    if (a > b) swap(a, b);
    int r = a % b;
    while (r > 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

using namespace std;
class UnionFindWithSize {
    public:
        UnionFindWithSize(int N) : parent(N, -1) {}

        void unite(int x, int y) {
            x = find(x);
            y = find(y);
            if (x == y) return;
            if (parent[x] > parent[y]) swap(x, y);
            parent[x] += parent[y];
            parent[y] = x;
        }

        int find(int x) {
            if (parent[x] < 0) return x;
            return parent[x] = find(parent[x]);
        }

        int size(int x) {
            return -parent[find(x)];
        }
    private:
        vector<int> parent;
};

// ( ´･ω･)( ´･ω)ぐる( ´･)( ´)ぐる( )(` )ぐる(･` )(ω･` )ぐる(･ω

signed main() {
    long long N, M;
    cin >> N >> M;
    vector<int> a(M);
    vector<int> b(M);
    for (int i = 0; i < M; i++) {
        int ai, bi;
        cin >> ai >> bi;
        a[i] = ai - 1;
        b[i] = bi - 1;
    }

    UnionFindWithSize suf(N);
    vector<long long> incon(M + 1);
    incon[M] = N * (N - 1) / 2;
    for (int i = M - 1; i >= 0; --i) {
        if (suf.find(a[i]) != suf.find(b[i])) {
            long long asize = suf.size(a[i]), bsize = suf.size(b[i]);
            incon[i] = incon[i + 1] - asize * bsize;
            suf.unite(a[i], b[i]);
        } else {
            incon[i] = incon[i + 1];
        }
    }

    for (int i = 1; i <= M; i++) {
        cout << incon[i] << endl;
    }
}


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

const int MAXN = 1e5;

int N;
vector<int> fri[MAXN+5];
vector<int> blo[MAXN+5];
bool vis[MAXN+5];
int sz[MAXN+5];
int par[MAXN+5];

void dfs(int v, int g){
	vis[v] = true;
	par[v] = g;
	for(auto i : fri[v]){
		if(!vis[i]) dfs(i,g);
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin >> N;
	int M,K;
	cin >> M >> K;
	while(M--){
		int a,b;
		cin >> a >> b;
		fri[a].push_back(b);
		fri[b].push_back(a);
	}
	while(K--){
		int c,d;
		cin >> c >> d;
		blo[c].push_back(d);
		blo[d].push_back(c);
	}

	int group = 1;
	for(int i=1; i<=N; i++){
		if(!vis[i]){
			dfs(i, group);
			group++;
		}
	}

	for(int i=1; i<=N; i++){
		sz[par[i]]++;
	}

	for(int i=1; i<=N; i++){
		int ans = sz[par[i]]-1;
		for(auto j : fri[i]){
			if(par[i]==par[j]) ans--;
		}
		for(auto j : blo[i]){
			if(par[i]==par[j]) ans--;
		}
		cout << ans << " ";
	}

	cout << "\n";

}


Measured memory_bytes: 12416
fun main(args: Array<String>) {
    val list = readLine()!!.split(" ").map(String::toInt)
    val a = list[0]
    val b = list[1]
    val c = list[2]
    if(a != b && a !=c && b != c) {
        println("No")
    } else if(a == b && a == c && b ==c) {
        println("No")
    } else {
        println("Yes")
    }
}

Measured memory_bytes: 38004
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N;
    pii A[100000];
    cin >> N;
    REP(i, N) {
        int a;
        cin >> a;
        A[i] = {a, i};
    }
    sort(A, A + N);
    REP(i, N) cout << A[i].second + 1 << " "; cout << endl;
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  string S; cin >> S;
  if(S == "AAA" || S == "BBB") cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(int X = 0; X < N; X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair

using namespace std;

class otoshidama{
public:

    int b10000;
    int b5000;
    int b1000;

    otoshidama(){
        b10000 = 0;
        b5000 = 0;
        b1000 = 0;
    }

    otoshidama(int a, int b, int c){
        b10000 = a;
        b5000 = b;
        b1000 = c;
    }

    int count(){
        return b1000 + b5000 + b10000;
    }

};

int main(){

    int n,y;
    cin >> n >> y;

    int bi10000, bi5000, bi1000;
    bi10000 = y / 10000;
    y = y - bi10000 * 10000;
    bi5000 = y / 5000;
    y = y - bi5000 * 5000;
    bi1000 = y / 1000;

    queue<otoshidama> q;
    map<pair<int, pair<int, int>>, int> m;

    q.push(otoshidama(bi10000, bi5000, bi1000));
    
    int ansx = -1;
    int ansy = -1;
    int ansz = -1;

    while(!q.empty()){
        otoshidama tmp = q.front();

        
        if(m[mpair(tmp.b10000, mpair(tmp.b5000, tmp.b1000))] == 0){

            //cerr << tmp.b10000 << " " << tmp.b5000 << " " << tmp.b1000 << endl;

            if(tmp.count() == n){
                ansx = tmp.b10000;
                ansy = tmp.b5000;
                ansz = tmp.b1000;
                break;
            }else if(tmp.count() < n){

                if(tmp.b10000 > 0){
                    q.push(otoshidama(tmp.b10000 - 1, tmp.b5000 + 2, tmp.b1000));
                    q.push(otoshidama(tmp.b10000 - 1, tmp.b5000, tmp.b1000 + 10));
                }

                if(tmp.b5000 > 0){
                    q.push(otoshidama(tmp.b10000, tmp.b5000 - 1, tmp.b1000 + 5));
                }
            }
        }

        m[mpair(tmp.b10000, mpair(tmp.b5000, tmp.b1000))] = 1;

        q.pop();
    }

    cout << ansx << " " << ansy << " " << ansz << endl;

    return 0;
}

Measured memory_bytes: 2816
H,W = map(int,input().split())
N = int(input())
A = list(map(int,input().split()))

ans = [[None]*W for _ in range(H)]

x,y = 0,0
d = 1
for c,a in enumerate(A):
  c += 1

  for i in range(a):
    if x < 0 or x >= W:
      y += 1
      d = -d
      x += d
    ans[y][x] = c
    x += d

for a in ans:
  print(' '.join(map(str,a)))


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll mod=1000000007;
//head

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    vi cyc;
    int n; ll k;
    cin >> n >> k;
    vi a(n+1);
    vector<bool> vis(n+1,false);
    for(int i = 1; i <= n; i++) cin >> a[i];
    int s = 1;
    while(!vis[s]) {
        vis[s] = true;
        cyc.pb(s);
        s = a[s];
    }
    if(k < cyc.size()) {
        cout << cyc[k] << endl;
    } else {
        int startind = find(all(cyc),s) - cyc.begin();
        k -= startind;
        vi remaining;
        for(int i = startind; i < cyc.size(); i++) {
            remaining.pb(cyc[i]);
        }
        cout << remaining[k % remaining.size()] << endl;
    }
    return 0;
}


Measured memory_bytes: 5924
import java.util.Scanner;
import java.util.TreeSet;

class Main{

	public static void main(String[] args) {


		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		int x = scan.nextInt();
		TreeSet<String> list  = new TreeSet<String>();

		if(s.length() == 1){
			System.out.println(s);
			
		}else{
			for(int i =0; i < s.length();i++){
				for(int j = i+1;j <= s.length();j++){
					if(j -i > 6){
						break;	
					}	
					list.add(s.substring(i, j));
				}
			}
			int c = 0;
			for(String a:list){
				if(c == x -1){
					System.out.println(a);
					break;
				}
				c++;
			}
		}
	}
}






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

int main()
{
  int a,b,c,x,y;cin>>a>>b>>c>>x>>y;
  int n=a+b>c*2?min(x,y):0;
  cout<<c*2*n+min(a,c*2)*(x-n)+min(b,c*2)*(y-n)<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N, D;
  cin >> N >> D;
  vector<vector<ll>> x(N);
  ll a;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j++) {
      cin >> a;
      x[i].push_back(a);
    }
  }
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      long double sum = 0;
      for (int k = 0; k < D; k++) {
        sum += pow(x[i][k] - x[j][k], 2);
      }
      long double result = sqrtl(sum);
      if (floorl(result) == result) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3708
import math

def calcEnergy(goal, curr):
  return (curr - goal) * (curr - goal)

n = int(input())
x = list(map(int, input().split()))

xs = x.copy()
xl = x.copy()

av = (int(sum(x)/n))

for i in range(n):
  xs[i] = calcEnergy(av, xs[i])
  xl[i] = calcEnergy(av + 1, xl[i])

small = sum(xs)
large = sum(xl)
if(small < large):
  print(small)
else:
  print(large)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC131_b solver = new ABC131_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC131_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int L = in.nextInt();

            int small = 999;
            int small_noneabs = 0;
            int ttl = 0;
            for (int i = 0; i < N; i++) {
                if (small > Math.abs(L + i)) {
                    small = Math.abs(L + i);
                    small_noneabs = L + i;
                }
                ttl += L + i;
            }
            out.println(ttl - small_noneabs);

        }

    }
}



Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m;i>n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
   lli A,B,L,R,N,M,K,sum=0,num=0,flag=0;
   cin >> N >> K >> L;
   Vec(P,lli,N,0);
   Vec(Q,lli,L,0);
   rep(i,0,L)cin >> Q[i];
   rep(i,0,L)P[Q[i]-1]++;
   rep(i,0,N){
      if(-L+P[i]>-K)Out("Yes");
      else Out("No");
   }
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <stdlib.h>

int main(){
  int count=0,N,x[100],hand,i,j,min;

  scanf("%d",&N);
  if(N<1 || N>100){
    printf("Please type 1 to 100.\n");
    exit(1);
  }
  
  for(i=0;i<N;i++){
    scanf("%d",&x[i]);
    if(x[i]<0 || x[i]>100){
      printf("Please type 0 to 100.\n");
      exit(2);
    }
  }    
  for(j=0;j<N;j++){
    min = j; 
    for(i=j;i<N;i++){     
      if(x[min] > x[i]){
	min = i;
      }    
    }
    if(j != min){
      hand = x[min];
      x[min] = x[j];
      x[j] = hand;
      count++;
    }
  }

  for(j=0;j<N;j++){
    if(j==N-1)printf("%d",x[j]);
    else printf("%d ",x[j]);
  }printf("\n%d\n",count);

  return 0;
}



Measured memory_bytes: 2072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }


void solve(long long N, std::vector<long long> W){
	ll res = 1e18;
	REP(i, N) {
		ll Sa = 0, Sb = 0;
		REP(j, N) {
			if (j<i) Sa += W[j];
			else Sb += W[j];
		}
		chmin(res, abs(Sa-Sb));
	}
	cout << res << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> W(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&W[i]);
    }
    solve(N, std::move(W));
    return 0;
}


Measured memory_bytes: 256
S = input()
T = input()

found = []

#区間大事。 len(T)がの仕切りを何箇所入れれるか
for i in range(len(S) - len(T) + 1):
  for cs, ct in zip(S[i:], T):
    if cs != '?' and cs != ct:
      break
  else:
    found.append(i)

if not found:
  print("UNRESTORABLE")
  exit()

ans = 'z'  * 51

for i in found:
  tmp = S[:i] + T + S[i+len(T):]
  ans = min(ans, tmp.replace("?", "a"))
print(ans)


Measured memory_bytes: 3064
eval"N,K,*A="+`dd`.split*?,
S=->a{eval a*?+}
s=S[A]
1.upto(3e4){|j|s%j<1&&$*<<j<<s/j}
p$*.select{|h|a=A.map{|x|x%h}
S[a.min(N-S[a]/h)]<=K}.max

Measured memory_bytes: 5888
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1; i * i <= n; ++i) {
        if ((n - 1LL) / i < i) continue;
        ans += ((n - 1LL) / i - i) * 2LL + 1LL;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3580
x,y = map(int,input().split())
#2a+4b = y
#x = a+b
#x-a = b
#2a+4(x-a) = y
#y = 4x-2a

for i in range(x+1):
  if y == 4*x - 2*i:
    print('Yes')
    break
else:
  print('No')


Measured memory_bytes: 9024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (long long i = 0; i < N; i++)
using ll = long long;

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

void solve(std::string s, std::string t) {
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());
    if (s < t) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }
}

int main() {
    std::string s;
    std::cin >> s;
    std::string t;
    std::cin >> t;
    solve(s, t);
    return 0;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        
        int age = sc.nextInt();
        int fee = sc.nextInt();
        int ans =0;
        if(age <= 5){
            ans = 0;
        }else if(age > 5 && age <= 12){
            ans =  fee/2;
        }else{
            ans = fee;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 22612
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let [A;B] = reads int
    let a = A - 2 * B
    if a <= 0 then
        printfn "0"
    else
        printfn "%i" a
    0

Measured memory_bytes: 14044
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)


#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll N, M;
const int MAX_M = 100000;
ll X[MAX_M], Y[MAX_M], Z[MAX_M];

const int MAX_N = 100000;
int par[MAX_N];
int depth[MAX_N];

void init(int n) {
  for(int i = 0; i < n; i++) {
    par[i] = i;
    depth[i] = 0;
  }
}

int find(int x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = find(par[x]);
  }
}

void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if(x == y) return;

  if(depth[x] < depth[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if(depth[x] == depth[y]) depth[x]++;
  }
}

bool same(int x, int y) {
  return find(x) == find(y);
}

int main(){
  cin >> N >> M;
  REP(i, M) cin >> X[i] >> Y[i] >> Z[i];
  init(N);
  REP(i, M) {
    unite(X[i] - 1, Y[i] - 1);
  }
  set<int> s;
  REP(i, N) {
    s.insert(find(i));
  }

  cout << s.size() << endl;

  return 0;
}


Measured memory_bytes: 8064
// header {{{
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <utility>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <list>
#include <stack>
#include <tuple>
#include <cstdio>
#include <cmath>
using namespace std;

#define kita            cout << "kita\n"
#define print2(i, n)    cout << (i) << ": " << (n) << endl
#define print3(i, j, n)     cout << "(" << (i) << ", " << (j) << ") : " << (n) << endl
#define print4(i, j, n, m)  cout << "(" << (i) << ", " << (j) << ") : " << (n) << ", " << (m) << endl
#define print_mat(mat, h, w) for(int i=0;i<(h);i++){for(int j=0;j<(w);j++){cout << mat[i][j] << " ";}cout << endl;}

#define EPS (1e-10)
#define EQ(a, b) (abs((a)-(b)) < EPS)

typedef long long ll;
typedef unsigned long long ull;
// }}}

int main() {
    int n;
    cin >> n;
    int sum = 0;
    int mmin = 200;
    for(int i=0;i<n;i++){
        int s;cin >> s;
        sum += s;
        if(s%10 != 0){
            mmin = min(mmin, s);
        }
    }

    if(sum%10 != 0){
        cout << sum << endl;
    }else{
        if(mmin != 200){
            cout << sum - mmin << endl;
        }else{
            cout << 0 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let a: i64 = input();
    let b: i64 = input();
    let c: i64 = input();
    println!(
        "{}",
        if a == b {
            c
        } else if b == c {
            a
        } else {
            b
        }
    );
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    vector<ll> sum(n+1);
    sum[0] = 0;
    for(int i = 0; i < n; i++)
    {
        sum[i+1] = sum[i] + a[i];
    }

    int l = 0;
    int h = n;
    while(h - l > 1)
    {
        int m = (l+h) >> 1;
        ll w = sum[m];
        int num = m;
        while(num < n)
        {
            if(a[num] <= 2 * w)
            {
                w += a[num];
                num++;
            }
            else break;
        }
        if(num == n) h = m;
        else l = m;
    }
    cout << n - l << endl;
}


Measured memory_bytes: 1792
i = int(raw_input())
while i:
    a_point = 0
    b_point = 0
    for count in range(i):
        a, b = map(int, raw_input().split())
        if a > b:
            a_point += a + b
        elif a < b:
            b_point += a + b
        else:
            a_point += a
            b_point += b
    print a_point,
    print b_point
    i = int(raw_input())

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

#define int long long
#define ll long long
#define f1(i,a,b) for(int i=a;i<b;i++)
#define f2(i,a,b) for(int i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // #ifndef ONLINE_JUDGE
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/in.txt","r",stdin);
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/out.txt","w",stdout);
    // #endif

    int n;
    cin>>n;
    set<int> p;
    f1(i,0,n)
    {
    	cin>>temp;
    	p.insert(temp);
    }

    if(p.size()==n)
    	cout<<"YES"<<endl;
    else
    	cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 9600
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n){
        cin >> a[i];
        if(a[i] % 2 != 0) continue;
        if(a[i] % 3 != 0 && a[i] % 5 != 0){
            cout << "DENIED" << endl;
            return 0;
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}

Measured memory_bytes: 888
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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

    int N; cin >> N;
    vi A(N); REP(i, N) cin >> A[i];

    int ans = 0;
    REP(i,N) {
        while (A[i] % 2 == 0) {
            A[i] /= 2;
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var j = new string[] { "AC", "WA", "TLE", "RE" };
        var d = new Dictionary<string, int>();
        foreach (var x in j) d[x] = 0;
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine().Trim();
            d[s]++;
        }
        foreach (var x in j)
            Console.WriteLine("{0} x {1}", x, d[x]);
    }
}


Measured memory_bytes: 30892
import sys
sys.setrecursionlimit(10**5)
t = int(input())
l = [list(map(int,input().split())) for _ in range(t)]

def f(n):
    if n in memo:
        return memo[n]
    else:
        temp = min(
            d*n,
            d*(n-(n//2)*2)+a+f(n//2),
            d*(((n+1)//2)*2-n)+a+f((n+1)//2),
            d*(n-(n//3)*3)+b+f(n//3),
            d*(((n+2)//3)*3-n)+b+f((n+2)//3),
            d*(n-(n//5)*5)+c+f(n//5),
            d*(((n+4)//5)*5-n)+c+f((n+4)//5)
        )
        memo[n] = temp
        return temp

for i in range(t):
    n,a,b,c,d = l[i]
    memo = {}
    memo[1] = d
    memo[0] = 0
    print(f(n))

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

int main(){
	int n;
	cin >> n;
	
	while(n!=0){
		vector<int> train(86405);
		rep(i,n){
			string s1,s2;
			cin >> s1 >> s2;
			int time1 = 0;
			time1 += 3600*(10*(s1[0] - '0') + (s1[1] - '0'));
			time1 += 60*(10*(s1[3] - '0') + (s1[4] - '0'));
			time1 += 10*(s1[6] - '0') + (s1[7] - '0');
			train[time1]++;
			int time2 = 0;
			time2 += 3600*(10*(s2[0] - '0') + (s2[1] - '0'));
			time2 += 60*(10*(s2[3] - '0') + (s2[4] - '0'));
			time2 += 10*(s2[6] - '0') + (s2[7] - '0');
			train[time2]--;
		}
		
		rep(i,86401){
			if(i>0){
				train[i] += train[i-1];
			}
		}
		
		int ans = 0;
		
		rep(i,86401){
			ans = max(ans,train[i]);
		}
		
		cout << ans << endl;
		
		cin >> n;
		
	}
	
	
	
    return 0;
}




Measured memory_bytes: 3504
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <thread>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)

using namespace std;

struct Elem {
	int a;
	int b;
	int c;
};

void add(multimap<uint64_t, Elem, greater<uint64_t>>& queue, const Elem& elem,
	const vector<uint64_t>& as, 
	const vector<uint64_t>& bs,
	const vector<uint64_t>& cs,
	int x, int y, int z
)
{
	if (x <= elem.a) return;
	if (y <= elem.b) return;
	if (z <= elem.c) return;

	uint64_t val = as[elem.a] + bs[elem.b] + cs[elem.c];

	auto it = queue.find(val);
	while (it != queue.end() && it->first == val) {
		if (it->second.a == elem.a &&
			it->second.b == elem.b &&
			it->second.c == elem.c)
		{
			return;
		}
		it++;
	}

	queue.insert(make_pair(val, elem));
}


int main()
{
	int x, y, z, k; cin >> x >> y >> z >> k;

	vector<uint64_t> as(x);
	vector<uint64_t> bs(y);
	vector<uint64_t> cs(z);
	for (auto &a : as) {
		cin >> a;
	}
	for (auto &b : bs) {
		cin >> b;
	}
	for (auto &c : cs) {
		cin >> c;
	}

	sort(as.begin(), as.end(), greater<uint64_t>());
	sort(bs.begin(), bs.end(), greater<uint64_t>());
	sort(cs.begin(), cs.end(), greater<uint64_t>());

	multimap<uint64_t, Elem, greater<uint64_t>> queue;

	queue.insert(make_pair(as[0] + bs[0] + cs[0], Elem{ 0, 0, 0 }));

	int count = 0;
	while (!queue.empty()) {
		auto it = queue.begin();
		cout << it->first << endl;
		count++;
		if (count == k) {
			return 0;
		}

		auto elem = it->second;
		queue.erase(it);
		add(queue, { elem.a + 1, elem.b, elem.c }, as, bs, cs, x, y, z);
		add(queue, { elem.a, elem.b + 1, elem.c }, as, bs, cs, x, y, z);
		add(queue, { elem.a, elem.b, elem.c + 1 }, as, bs, cs, x, y, z);

	}

	return 0;
}


Measured memory_bytes: 512
k,n=map(int,input().split())
a=[int(x) for x in input().split()]
half=k//2
min_a,max_a=min(a),max(a)
ans=0
diff=[0]*n
for i in range(1,n):
	diff[i-1]=a[i]-a[i-1]
diff[n-1]=k-a[n-1]+a[0]
#start_id=a.index(max(diff))
#end_id=start_id+1
ans=k-max(diff)
print(ans)


Measured memory_bytes: 26444
def end_of_words?(cur)
  @txt[cur[0]].size == cur[1]
end

def last_line?(cur)
  cur[0] == @txt.size - 1
end

buf = ''
cur = [0, 0]
@txt = []
while l = gets.chomp
  break if l == 'END_OF_TEXT'
  @txt << l
end

loop do
  case gets.chomp
  when '-'
    break
  when 'a'
    cur[1] = 0
  when 'e'
    cur[1] = @txt[cur[0]].size
  when 'p'
    cur[0] == 0 ? cur[1] = 0 : cur = [cur[0] - 1, 0]
  when 'n'
    last_line?(cur) ? cur[1] = 0 : cur = [cur[0] + 1, 0]
  when 'f'
    unless end_of_words?(cur)
      cur[1] += 1
    else
      unless last_line?(cur)
        cur = [cur[0] + 1, 0]
      end
    end
  when 'b'
    if cur[1] != 0
      cur[1] -= 1
    else
      if cur[0] != 0
        cur = [cur[0] - 1, @txt[cur[0] - 1].size]
      end
    end
  when 'd'
    unless end_of_words?(cur)
      @txt[cur[0]].slice!(cur[1])
    else
      unless last_line?(cur)
        l = @txt.delete_at(cur[0] + 1)
        @txt[cur[0]] += l
      end
    end
  when 'k'
    unless end_of_words?(cur)
      buf = @txt[cur[0]].slice!(cur[1]..-1)
    else
      unless last_line?(cur)
        l = @txt.delete_at(cur[0] + 1)
        @txt[cur[0]] += l
        buf = '\\n'
      end
    end
  when 'y'
    if buf == '\\n'
      @txt.insert(cur[0] + 1, @txt[cur[0]].slice!(cur[1]..-1))
      cur = [cur[0] + 1, 0]
    elsif buf != ''
      @txt[cur[0]].insert(cur[1], buf)
      cur[1] += buf.size
    end
  end
end

puts @txt

Measured memory_bytes: 8772
#include <iostream>
#include <iomanip> //setprecision()
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
using ll = long long;
using namespace std;

double Mcos(double k){return cos(k*atan(1.0)*4/180);}

void monmo(){
    
}

int main() {
    ll n;
    string s;
    cin>>n;
    
    cout<<n+pow(n,2)+pow(n,3);
}


Measured memory_bytes: 4260