akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

vector<vector<Int> > G;
Int calc(){
  Int N = G.size();
  vector<vector<Int> > D(N, vector<Int>(N, INF));
  for(Int i=0;i<N;i++) D[i][i] = 0;
  for(Int i=0;i<N;i++)
    for(Int to:G[i]) D[i][to] = 1;

  for(Int k=0;k<N;k++)
    for(Int i=0;i<N;i++)
      for(Int j=0;j<N;j++) Min(D[i][j], D[i][k] + D[k][j]);

  Int res = 0;
  for(Int i=0;i<N;i++)
    for(Int j=0;j<N;j++) Max(res, D[i][j]);
  return res;
}

vector<Int> used;
Int dfs(Int pos, Int pre, Int col){
  if(used[pos] != -1) return col == used[pos];
  used[pos] = col;

  for(Int to:G[pos])
    if(to != pre && dfs(to, pos, !col) == false) return false;
  return true;
}


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N;
  cin>>N;

  G.resize(N);
  used.resize(N, -1);

  for(Int i=0;i<N;i++){
    string s;
    cin>>s;
    for(Int j=0;j<N;j++) if(s[j] == '1') G[i].push_back(j);
  }

  if(dfs(0, -1, 0) == false) cout<<-1<<endl;
  else cout<<calc()+1<<endl;
  return 0;
}


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

int main() {
  int a;
  cin >> a;
  int c = 0;
  vector<int> vec(a);
  for(int i = 0;i < a;i++) {
    cin >> vec.at(i);
  }
  while(true) {
    bool flg = false;
  	for(int i = 0;i < a;i++) {
      if(vec.at(i) % 2 != 0) {
        flg = true;
      }
    }
    if(flg) {
      break;
    }
    for(int i = 0;i < a;i++) {
      vec.at(i) = vec.at(i) / 2;
    }
    c = c + 1;
  }
  cout << c << endl;
}

Measured memory_bytes: 3616
n = int(input())
blue = []
for i in range(n):
    blue.append(input())
m = int(input())
red = []
for i in range(m):
    red.append(input())
ans = ""
mon = 0
for i in range(n):
    if blue.count(blue[i]) - red.count(blue[i]) > mon:
        mon = blue.count(blue[i]) - red.count(blue[i])
print(mon)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<map>
typedef long long lint;
using namespace std;

int main()
{
	lint N,P;
	map<lint,lint> m;
	lint ans=1;
	lint num=0;
	
	cin >> N >> P;
	
	if(P==1)
	{
		cout << 1 << endl;
		return 0;
	}
	if(N==1)
	{
		cout << P << endl;
		return 0;
	}

	lint x=P;
	for(lint i=2;i*i<=P;i++)
	{
		while(x%i==0)
		{
			m[i]++;
			x/=i;
		}
	}
	
	for(auto it=m.rbegin();it!=m.rend();++it)
	{
		//cout << it->first << " " << it->second << endl;
		if(it->second>=N)
		{
			lint tmp=it->second/N;
			for(lint i=0;i<tmp;i++)ans*=it->first;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
#define int long long int
#define endl "\n"
#define PI 3.14159265
const int mod=1e9+7;
//const int mod=1e9+7;
const int INF =LONG_LONG_MAX;
inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int pow(int a,int n,int mod){if(n==0)return 1;int p=pow(a,n/2,mod);p=(p%mod*p%mod)%mod;if(n%2) return (p%mod*a%mod)%mod;else return p;}
const int N = (int)2e5 + 10;
int tree[4 * N];
int dp[N];
int h[N], val[N];
int n;
void build(int node,int start,int end,int tree[],int a[])
{
    if(start==end)
     { tree[node]=a[start]; return;}
    int mid=(start+end)/2;
    build(2*node,start,mid,tree,a);
    build(2*node+1,mid+1,end,tree,a);
    tree[node]=min(tree[2*node],tree[2*node+1]);
}

void update(int node,int start,int end,int idx,int val)
{
    if(start==end)
   {
       //a[idx]=val;
       tree[node]=val;
    }
   else
 {
    int mid=(start+end)/2;
   if(idx>=start&&idx<=mid)
     update(2*node+1,start,mid,idx,val);
   else
      update(2*node+2,mid+1,end,idx,val);
    tree[node]=max(tree[2*node+1],tree[2*node+2]);
   }
}

int query(int node,int start,int end,int l,int r)
{
    if(l>end||start>r)
      return -1;
   if(l<=start&&r>=end)
      return tree[node];
   int p1,p2;
    int mid=(start+end)/2;

   p1=query(2*node+1,start,mid,l,r);
   p2=query(2*node+2,mid+1,end,l,r);
    return max(p1,p2);
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=0;i<=4*n;i++)tree[i]=0;
    for(int i=1;i<=n;i++)
        cin>>h[i];
    for(int i=1;i<=n;i++)
        {cin>>val[i];}
    for(int i=1;i<=n;i++)dp[h[i]]=val[i];
    dp[0]=0;

    for(int i=1;i<=n;i++)
    {
        int d=query(0,1,n,1,h[i]-1);
        dp[h[i]]=max(dp[h[i]],d+val[i]);
        update(0,1,n,h[i],dp[h[i]]);
    }
    int max1=-1;
    for(int i=1;i<=n;i++)
        max1=max(max1,dp[i]);
    cout<<max1<<endl;

    return 0;
}


Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
#include <queue>
#include <bitset>
#include <sstream>
using namespace std;
typedef long long ll;

int main(){
        ll N, K;
        cin >> N >> K;
        vector<ll> h(N);
        for(ll i=0; i<N; i++){
                cin >> h[i];
        }
        sort(h.begin(), h.end());
        ll Count = 1e9 + 10;
        for(ll i=0; i<N-K+1; i++){
                if(Count > h[i+K-1]-h[i]) Count = h[i+K-1] - h[i];
        }
        cout << Count;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
const int MOD=1e9+7;

int main() {
    int h,n;
    cin >> h >> n;
    int ain;
    rep(i,n) {
        cin >> ain;
        h-=ain;
    }
    if (h<=0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "<<"\n"
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "<<"\n"
#define F           first
#define S           second
#define debug_set(s) for(auto p:s) cout<<p<<" "
#define debug_map(m) for(auto p:m) cout<<p.F<<" "<<p.S<<"\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
//#pragma GCC optimize("Ofast")  // works very well
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll kjk;
    for(kjk=0;kjk<b;kjk++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353   ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// to generate random number , use rng() ... eg cout<<rng();
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    string s;
    cin>>s;
    ll n=s.size();
    string ss=s;
    reverse(all(ss));
    if(ss!=s)
    {
        cout<<"No";
        return 0;
    }
    string s1=s.substr(0,(n-1)/2);
    string s2=s.substr(((n+1)/2),(n-1)/2);
    string s11=s1;
    reverse(all(s11));
    string s22=s2;
    reverse(all(s22));
    if(s1==s11 && s2==s22)
    {
        cout<<"Yes";
    }
    else
        cout<<"No";
    return 0;
}


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

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

    int n, m, r;
    cin >> n >> m >> r;
    vector<int> R(r);
    for(int i = 0; i < r; i++){
        cin >> R[i];
        R[i]--;
    }

    int D[n][n];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i == j) D[i][j] = 0;
            else D[i][j] = 1e9;
        }
    }

    for(int i = 0; i < m; i++){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        D[a][b] = c;
        D[b][a] = c;
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            for(int k = 0; k < n; k++){
                D[j][k] = min(D[j][k], D[j][i] + D[i][k]);
            }
        }
    }

    vector<int> J(r);
    for(int i = 0; i < r; i++){
        J[i] = i;
    }

    int ans = 1e9;
    do{
        int bef, cost = 0;
        for(int i = 0; i < r; i++){
            if(i > 0){
                cost += D[bef][R[J[i]]];
            }
            bef = R[J[i]];
        }
        ans = min(ans, cost);
    }while(next_permutation(J.begin(), J.end()));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
// C++11
#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <cmath>
#include <iostream>
#include <numeric>
#include <random>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>

using namespace std;

#define LOCAL 1

#if LOCAL
#define pv(val) cerr << #val << '=' << (val) << endl
#define pvn(name, val) cerr << name << '=' << (val) << endl
#define pl cerr << '@' << __LINE__ << endl
#else
#define pv(val)
#define pvn(name, val)
#define pl
#endif

template <class T>
ostream& operator<<(ostream& os, vector<T> const& vec) {
  if (vec.empty()) {
    os << "{}";
  } else {
    os << '{';
    for (size_t i = 0; i < vec.size() - 1; i++) os << vec[i] << ", ";
    os << vec.back() << '}';
  }
  return os;
}

template <class T, size_t S>
ostream& operator<<(ostream& os, array<T, S> const& arr) {
  if (arr.empty()) {
    os << "{}";
  } else {
    os << '{';
    for (size_t i = 0; i < arr.size() - 1; i++) os << arr[i] << ", ";
    os << arr.back() << '}';
  }
  return os;
}


int main(void)
{
  int N;
cin >> N;
  vector<pair<int, int>> X(N);
  for(int i = 0; i < N; i++) {
    int temp;
    cin >> temp;
    X[i] = {temp, i};
  }
  sort(X.begin(), X.end());
  vector<int> ans(N);

  for(int i = 0; i < N/2; i++) ans[X[i].second] = X[N/2].first;
  for(int i = N/2; i < N; i++) ans[X[i].second] = X[N/2-1].first;
  for(int a : ans) cout << a << endl;

  return 0;
}

Measured memory_bytes: 4480
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String ans = "";
		while(N != 0) {
			//Nを2で割ったあまりも求める
			int r = N % 2;
			//Nがマイナスだとｒもマイナスになることがあるので２を足す
			if (r < 0) r += 2;

			//Nからあまりを取り除いて-2で割る
			N = (N - r) / (-2);

			ans = (char)('0' + r) + ans;
		}

		if (ans == "") ans = "0";


		System.out.println(ans);
	}
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
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; }
using namespace std;

int N;
double p[3010];
double dp[3010][3010]; // dp[i][j] := i枚投げて裏がj枚出る確率

int main() {
    cin >> N;
    rep(i, N) cin >> p[i];

    dp[0][0] = 1 - p[0];
    dp[0][1] = p[0];
    for (int i = 1; i < N; i++) {
        dp[i][0] = dp[i-1][0] * (1 - p[i]);
        for (int j = 1; j <= (N+1)/2; j++) {
            dp[i][j] = p[i] * dp[i-1][j-1] + (1 - p[i]) * dp[i-1][j];
        }
    }

    double rem = 0;
    for (int j = 0; j < (N+1)/2; j++) {
        rem += dp[N-1][j];
    }
    cout << setprecision(16) << 1 - rem << endl;
}


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

int main() {
	// your code goes here
	string s; cin>>s; 
	int n = s.size();
	int freq[26] = {0}; 
	for(int i=0;i<n;i++){
		freq[s[i]-'a']++;
	}
	bool valid = true;
	for(int i=0;i<26 and valid; i++){
		if(freq[i]&1) valid = false;
	}
	printf("%s\n", valid ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
n =int(input())
input_line=input().split(" ")
#print(input_line,type(input_line))
#print(b)
#print(c)
flag="ture"
count=0
while flag=="ture":
    for i in range(n):
        if int(input_line[i]) % 2 != 0:
            flag="false"
        else:
            input_line[i]=int(input_line[i])/2
    if flag=="false":
        break
    count +=1
print(count)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std;
const int N = 2e5 + 10;
const  int M = 1e6 + 1;
string str[N];
int tr[M][26], num[M][26], up[26], fa[M];
int cmp(string a, string b)
{
	return a.size() < b.size();
}
int main()
{
	int n, cnt = 0;
	long long ans = 0;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		cin>>str[i];
	sort(str + 1, str + n + 1, cmp);
	//for(int i = 1; i <= n; i++)
	//	cout<<str[i]<<endl; 
	for(int i = n; i > 0; i--)
	{
		//int l = str[i].size();
		int now = 0;
		//printf("%d\n",cnt);
		for(int j = str[i].size() - 1; j > 0; j --)
		{
			//cout << str[i][j]<<endl;
			if(! tr[now][str[i][j] - 'a'])
				tr[now][str[i][j] - 'a'] = ++cnt, fa[cnt] = now;
			now = tr[now][str[i][j] - 'a'];
		}
		int x = str[i][0] - 'a';
		ans += num[now][x];
		//cout<<str[i][0]<<endl;
		if(!tr[now][x])
			tr[now][x] = ++cnt, fa[cnt] = now;
		now = tr[now][x];
		//printf("%d\n",ans);
		memset(up,0,sizeof(up));
		for(int j = 0; j < str[i].size() ; j++)
		{
			//cout<< str[i][j]<<endl;
			now = fa[now];
			//printf("<%d>\n",now);
			up[str[i][j] - 'a'] = 1;
			for(int k = 0; k < 26; k++)
				if(up[k])
					num[now][k]++;
		}
		/*for(int ii = 0; ii <= cnt; ii++)
		{
		printf("%d: ",ii);
		for(int j = 0; j < 26; j++)	
			printf("%d ",num[ii][j]);
		printf("\n");
		}*/
	}
	
	/*for(int i = 0; i <= cnt; i++)
	{
		printf("%d: ",i);
		for(int j = 0; j < 26; j++)
			printf("%d ",tr[i][j]);
		printf("\n");
	}*/
	printf("%lld", ans);
	return 0;
}

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

using namespace std;

const string buff = "ATGC";
const int mod = 1e9 + 7;

vector< pair< int, int > > toto[50];
vector< int > order;

int dp2[52][52][52];
int dp3[52][52][52];

void dfs(int idx)
{
  for(auto &to : toto[idx]) {
    if(to.first) dfs(to.second);
    else order.push_back(to.second);
  }
}

int main()
{
  int Na, Nt, Ng, Nc, M;
  string s[50];

  cin >> Na >> Nt >> Ng >> Nc;
  int sum = Na + Nt + Ng + Nc;
  cin >> M;
  cin.ignore();
  for(int i = 0; i < M; i++) getline(cin, s[i]);

  map< string, int > convert;
  for(int i = M - 1; i >= 0; i--) {
    convert[s[i].substr(0, s[i].find(':'))] = i;
  }

  int dp[50] = {};
  for(int i = M - 1; i >= 0; i--) {
    string ss = s[i].substr(s[i].find(':') + 2);
    vector< string > splits;
    string curr;
    for(int j = 0; j <= ss.size(); j++) {
      if(j == ss.size() || ss[j] == ' ') splits.push_back(curr), curr = "";
      else curr += ss[j];
    }
    for(auto &t : splits) {
      if(t[0] == '[') {
        int mask = 0;
        for(int j = 0; j < buff.size(); j++) {
          if(t.find(buff[j]) != string::npos) {
            mask |= 1 << j;
          }
        }
        toto[i].emplace_back(0, mask);
        dp[i] = min(sum + 1, dp[i] + 1);
      } else {
        toto[i].emplace_back(1, convert[t]);
        dp[i] = min(sum + 1, dp[i] + dp[convert[t]]);
      }
    }
  }

  if(dp[0] != sum) {
    cout << 0 << endl;
  } else {
    dfs(0);

    dp2[0][0][0] = 1;
    int sz = 0;
    for(int bit : order) {
      memset(dp3, 0, sizeof(dp3));
      for(int i = 0; i <= min(sz, 50); i++) {
        for(int j = 0; j <= min(sz - i, 50); j++) {
          for(int k = 0; k <= min(sz - i - j, 50); k++) {
            if((bit >> 0) & 1) (dp3[i + 1][j][k] += dp2[i][j][k]) %= mod;
            if((bit >> 1) & 1) (dp3[i][j + 1][k] += dp2[i][j][k]) %= mod;
            if((bit >> 2) & 1) (dp3[i][j][k + 1] += dp2[i][j][k]) %= mod;
            if((bit >> 3) & 1) (dp3[i][j][k] += dp2[i][j][k]) %= mod;
          }
        }
      }
      ++sz;
      swap(dp2, dp3);
    }
    cout << dp2[Na][Nt][Ng] << endl;
  }

}

Measured memory_bytes: 4336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() cin.tie(0), ios::sync_with_stdio(false)

ll N, ans;

int main()
{
    cin >> N;
    vector<ll> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }

    ll mi = 0;

    for (int i = 0; i < N; i++)
    {
        ll p = (a[i] - 1) / (mi + 1);
        ans += p;
        a[i] -= p * (mi + 1);

        if (p > 0)
        {
            a[i] = 1;
        }

        if (a[i] < mi + 2)
        {
            mi = max(mi, a[i]);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  long long k, a, b;
  cin >> k >> a >> b;

  long long ans = 1;
  for (long long i = 0; i < k; i++) {
    if (b - a >= 2 && ans >= a && i + 1 < k) {
      ans -= a;
      ans += b;
      i++;
    } else {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;
const int N = 2000006;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n;
	set<int> s;
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		s.insert(x);
	}
	if((int)s.size() == n){
		cout<<"YES";
	}
	else{
		cout<<"NO";
	}
	
	return 0;
}


Measured memory_bytes: 13004
#include <iostream>
#include <set>


using namespace std;


using ll = long long;
using ull = unsigned long long;

int main()
{
    ll N;
    cin >> N;

    set<ull> nums;
    for (ll i = 0; i < N; i++) {
        ull tmp;
        cin >> tmp;

        if (nums.find(tmp) == nums.end()) {
            nums.insert(tmp);
        } else {
            nums.erase(tmp);
        }
    }

    cout << nums.size() << endl;
}


Measured memory_bytes: 4864
use std::io::*;

fn main() {
  let stdin = stdin();
  let mut lines = stdin.lock().lines().map(|l| l.unwrap());

  let n: usize = lines.next().unwrap().parse().unwrap();
  let mut nums = lines.take(n).map(|s| s.parse::<i32>().unwrap());

  let mut max_sub = i32::min_value();
  let mut min_a = nums.next().unwrap();

  for b in nums {
    if b - min_a > max_sub {
      max_sub = b - min_a;
    }
    if b < min_a {
      min_a = b;
    }
  }

  println!("{}", max_sub);
}



Measured memory_bytes: 5048
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std; 
#define MAXA 100000000
#define MAXB 100000000
#define MAXC 100000000
#define MAXD 100000000
#define MAXN 50
#define MAXM 50
bool isover(long long i)
  {
    return (i>100000);
  }
int main(int argc,char const* argv[])
{
  int n;
  cin >> n;
  vector < long long> a(n,0);
  int ans=0;
  vector <int> buckets(100000,0);
  for(int i=0;i<n;i++)
    {
      cin >> a[i];
      if(a[i]<=100000) buckets[a[i]]++;
    }
  for(int i=1;i<=100000;i++)
    {
      if((buckets[i]-i)>0) ans+=(buckets[i]-i);
      else if((buckets[i]-i!=0)) ans+=buckets[i];
    }
  ans+=count_if(a.begin(),a.end(),isover);
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;

int N,M;
int main(){
    cin>>N>>M;
    if(N==1&&M==1){
        cout<<'1';
        return 0;   
    }
    else if(M==1){
        cout<<N-2<<endl;
        return 0;
    }else if(N==1){
        cout<<M-2<<endl;
        return 0;
    }
    cout<<LL(N-2)*LL(M-2)<<endl;

    return 0;
}

Measured memory_bytes: 256
// ABC162A - Lucky 7

#include <bits/stdc++.h>
using namespace std;

int main() {
	string S;
	cin >> S;

	if ((S[0] == '7')||(S[1] == '7')||(S[2] == '7')) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3628
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    REP(i,n){
        cin >> a[i];
    }
    sort(ALL(a));
    vector<int> rui(n + 1, 0);
    for (int i = 1; i <=n; i++)
    {
        rui[i] = rui[i - 1] + a[i - 1];
    }
    show(rui);
    int r = 1e6,l=0;
    int ans = 0;
    while (l + 1 < r)
    {
        int mid = (l + r) / 2;
        bool ok;
        int cnt = 0;
        int c = 0;
        for (int i = 0; i < n; i++)
        {
            int ll = -1, rr = n;
            while(abs(rr-ll)>1){
                int cc = (ll + rr) / 2;
                if(a[i]+a[cc]>=mid){
                    rr = cc;
                }
                else{
                    ll = cc;
                }
               // cerr << ll << " "<<rr<<endl;
            }
          //  cerr << ++ll << endl;
            int x = rr;
            cnt += a[i] * (n - x) + (rui[n] - rui[x]);
            c += n - x;
            
        }
       // cerr << l << " " << r << endl;
      //  cerr << c << " " << cnt <<" "<<mid<< endl;
        ok = (c >= m ? 1 : 0);
      
        if (ok)
        {
            l = mid;
            ans =cnt - (c - m) * mid;
        }
        else{
            r = mid;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> h(N);
    rep(i, N) cin >> h[i];
    int MAX = 1e9+7;
    vector<int> dp(N, MAX);
    dp[0] = 0;
    rep(i, N)
    {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
    }

    std::cout << dp[N - 1] << endl;
 //   std::system("pause");
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i =0;i<n;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int n,m,x;
queue <int> q;
vector<vector<int>> a;
vector <int> c;
void dfs(int sum,int curr,vector <int> z){
  bool flag=true;
  //cout << "\n" << sum << " ";
  //rep(j,m)cout << z[j] << " ";
  rep(j,m)if(z[j]<x){
    flag = false;
    break;
  }
  if(flag==true){
    rep(curr,n){
      q.push(sum);
    }
  }
  if(flag==false){
    for(int i=curr+1;i<n;i++){
      int nsum = sum+c[i];
      vector <int> z2 =z;
      rep(j,m)z2[j]=z[j]+a[i][j];
      dfs(nsum,i,z2);
    }
  }
}
int main(){
  cin >> n >> m >> x;
  c= vector<int>(n);
  a= vector<vector<int>>(n,vector <int>(m));
  rep(i,n){
    cin >> c[i];
    rep(j,m){
      cin >> a[i][j];
    }
  }
  rep(i,n)dfs(c[i],i,a[i]);
  if(q.empty())q.push(-1);
  int ans=INT_MAX;
  while(!q.empty()){
    ans=min(ans,q.front());
    q.pop();
  }
  cout << ans << endl;
}


Measured memory_bytes: 3640
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		new Main().start();
	}

	class Log implements Comparable<Log>{
		long t;
		int from;
		int to;

		Log(long t,int from,int to){
			this.t = t;
			this.from = from;
			this.to = to;
		}

		public int compareTo(Log o) {
			return (int) (this.t - o.t);
		}
	}

	private void start() {
		Scanner sc = new Scanner(System.in);

		while(true){
		int n = sc.nextInt();
		int m = sc.nextInt();
		if((n|m) == 0) break;

		boolean infected[] = new boolean[n];
		infected[0] = true;

		Log logs[] = new Log[m];

		for(int i=0; i<m; i++){
			long t = sc.nextLong();
			int from = sc.nextInt() -1;
			int to = sc.nextInt() -1;
			logs[i] = new Log(t,from,to);
		}

		Arrays.sort(logs);


		for(int i=0; i<m; i++)
			if(infected[logs[i].from])
				infected[logs[i].to] = true;

		int count = 0;
		for(int i=0; i<n; i++)
			if(infected[i])
				count++;

		System.out.println(count);
		}
	}

}

Measured memory_bytes: 0
n,m=[int(i) for i in input().split()]
left,right=map(int,input().split())
for i in range(m-1):
    l,r=map(int,input().split())
    if left<l:
        left=l
    if r<right:
        right=r
print(right-left+1 if right-left>=0 else 0)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>
//#include <atcoder/all>
 
using namespace std;
//using namespace atcoder;
 
/* template */
 
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
 
#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};
 
struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};
 
using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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;
}
 
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
 
constexpr ll LNF = 1LL<<50;
 
constexpr int INF = 1e9+7;
 
const long double PI=acos(-1);

vector<int> dx = {1,0,-1,0};
vector<int> dy = {0,1,0,-1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,Q; cin >> n >> Q;
    vector<ll> a(n,n),b(n,n);
    ll h = n, w = n;
    ll ans = (n-2)*(n-2);
    rep(i,0,Q){
        ll flag,x; cin >> flag >> x;
        if(flag==1){
            if(x<w){
                rep(i,x,w){
                    b[i] = h;
                }
                w = x;
            }
            ans -= b[x]-2;
        }
        else{
            if(x<h){
                rep(i,x,h){
                    a[i] = w;
                }
                h = x;
            }
            ans -= a[x]-2;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6344
#include<stdio.h>
  
#define AMAX 20
#define MMAX 200
 
int A[AMAX+1];
int n, q;

int solve_loop( int p, int t, int res )
{
	return  res || ( n < p ) ? res: solve_loop( p+1, t-A[p], res==t ) || solve_loop( p+1, t, res==t );
}
int solve( int p, int t )
{
	return  solve_loop( p, t, 0 );
}
 
int main( void ) 
{
    int i;
    int num;
     
    scanf( "%d", &n );  
    for( i=0; i<n; i++ ) {
        scanf( "%d", &A[i] );
    }   
    scanf( "%d", &q );
    for( i=0; i<q; i++ ) {
        scanf( "%d", &num );
        if( solve( 0, num ) ) {
            printf( "yes\n" );      
        } else {
            printf( "no\n" );
        }
    }
    return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include<algorithm>
#include <stdio.h>
#include <map>
#include <random>
#include <string>

using namespace std;
int main() {
	long int n,tmp;
	vector<long int> v;
	map<int, int>a;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		a[tmp]++;
		if (a[tmp] > 1) {
			cout << "NO";
			return 0;
		}
		/*if (count(v.begin(), v.end(), tmp) ==1) {
			cout << "NO";
			return 0;
		}
		v.push_back(tmp);
		*/
		
	}
	cout << "YES";

	return 0;
}



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

using namespace std;

int main() {
  int alp[26] = {};
  for (int i = 0; i < 4; ++i) {
    char c;
    cin >> c;
    alp[c - 'A']++;
  }
  int cnt = 0;
  for (int i = 0; i < 26; ++i) if (alp[i] == 2) cnt++;
  cout << (cnt == 2 ? "Yes" : "No") << endl;
}

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

int minCoins(int coins[], int m, int V)
{
	int table[V+1];
	table[0] = 0;
	for (int i=1; i<=V; i++)
		table[i] = 1000000;
	for (int i=1; i<=V; i++)
	{
		for (int j=0; j<m; j++)
		if (coins[j] <= i)
		{
			int sub_res = table[i-coins[j]];
			if (sub_res != 1000000 && sub_res + 1 < table[i])
				table[i] = sub_res + 1;
		}
	}
	return table[V];
}

int main()
{
	int coins[] = {1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};
	int N;
	cin >>N;
	int ans=minCoins(coins, 12, N);
	cout <<ans;
	return 0;
}


Measured memory_bytes: 640
//define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define chmin(x,y) x = min(x, y)
#define chmax(x,y) x = max(x, y)
#define V vector
V<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

V<V<V<ll>>> dp(3030, V<V<ll>> (3030, V<ll> (4, 0)));

int main () {
    int r, c, k; cin >> r >> c >> k;
    int v[r][c];
    memset(v, -1, sizeof(v));
    rep(i, k) {
        int R, C; cin >> R >> C; R--; C--;
        cin >> v[R][C];
    }
    if (v[0][0] != -1) dp[0][0][2] = v[0][0];
    rep(i, r) {
        rep(j, c) {
            rep(p, 4) {
                //拾わない
                if (i!=0) chmax(dp[i][j][3], dp[i-1][j][p]);//上から
                if (j!=0) chmax(dp[i][j][p], dp[i][j-1][p]);//左から
                if (v[i][j] == -1) continue;

                //拾う
                if (i!=0) chmax(dp[i][j][2], dp[i-1][j][p] + v[i][j]);//上から
                if (j!=0 && p!=0) chmax(dp[i][j][p-1], dp[i][j-1][p] + v[i][j]);//左から
            }
        }
    }
    ll ans = 0;
    rep(p, 4) chmax(ans, dp[r-1][c-1][p]);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 684100
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
#include <math.h>
#include <typeinfo>
#include <numeric>
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;

int main()
{
	int c[3][3];
	
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> c[i][j];
		}
	}

	// i = a1
	string ans = "No";
	for (int i = 0; i <= 100; i++)
	{
		int b1 = (c[0][0] - i);
		int a2 = (c[1][0] - b1);
		int a3 = (c[2][0] - b1);
		int b2 = (c[1][1] - a2);
		int b3 = (c[1][2] - a2);

		if (a3 + b2 == c[2][1] 
			&& a3 + b3 == c[2][2] 
			&& i + b2 == c[0][1] 
			&& i + b3 == c[0][2])
		{
			ans = "Yes";
			break;
		}
	}

	cout << ans << endl;

	return 0;
 
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define INF 100000000
#define MAX_H 200
#define MAX_W 200
i64 G[MAX_H][MAX_W];
i64 C[MAX_H + 1][MAX_W + 1];

using P = pair<i64, i64>;

int main() {
    i64 N;
    cin >> N;
    vector<P> R(N);
    vector<P> B(N);
    REP(i, N) cin >> R[i].first >> R[i].second;
    REP(i, N) cin >> B[i].first >> B[i].second;
    sort(R.rbegin(), R.rend());

    i64 cnt = 0;
    vector<bool> used(N, false);
    REP(i, N) {
        P p1 = R[i];
        i64 miny = INF;
        i64 pi;
        REP(j, N) {
            P p2 = B[j];
            if (used[j]) continue;
            if (p1.first >= p2.first || p1.second >= p2.second) continue;
            if (chmin(miny, p2.second)) {
                pi = j;
            }
        }
        if (miny != INF) {
            cnt++;
            used[pi] = true;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main() {
	string s;
	cin >> s;
	int k = 0;
	for(int i = 0;i < 6;i++)
	{
		if(s.at(i) == '1')
		{
			k++;
		}
	}
	cout << k << endl;
	return 0;
}


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

int main(){
	int ans;
	rep(i,5){
		int a; cin>>a;
		if(a==0) ans=i+1;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3604
def etrc(n1,n2,rs):
    for r in range(n1):
        rc[n2].append(rs+r)
        rc[n2+r+1].append(rs+r)

n=int(input())
#n=6
x=int(((1+8*n)**0.5-1)/2)

rc=[[] for i in range(x+2)]

if n!=x*(x+1)//2:
    print("No")
else:
    print("Yes")
    print(x+1)

    rs=1
    for i in range(x):
        n1=x-i
        n2=i
        etrc(n1,n2,rs)
        rs=rs+n1

    for i in range(x+1):
        print(x, end=" ")
        for j in range(x):
            print(rc[i][j], end=" ")
        print()
 

Measured memory_bytes: 12556
N, K = map(int,input().split())
T = 10 ** 9 + 7

def generating_combination(n):
	C = [[0 for i in range(n+1)] for j in range(n+1)]
	C[0][0] = 1
	C[1][0] = 1
	C[1][1] = 1
	for i in range(2,n+1):
		C[i][0] = 1
		C[i][i] = 1
		for j in range(1,i):
			C[i][j] = (C[i-1][j-1] + C[i-1][j])%T
	return(C)

D = generating_combination(N)
for i in range(1,K+1):
	print((D[K-1][i-1]*D[N-K+1][i])%T)


Measured memory_bytes: 99336
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	private	static	BufferedReader	br   = null;

	static {
		br   = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int	nMax = parseMax();

		for (int nCnt = 0; nCnt < nMax; nCnt++) {
			calc();
		}
	}

	private static String parseStdin() {
		String	strNum = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}

	private static int parseMax() {
		String	strMax = parseStdin();
		return (strMax == null) ? 0 : Integer.parseInt(strMax);
	}

	private static long[] parseNum(String strNum) {
		long[]	alNum  = new long[5];
		String	strTmp = null;
		int		nDiv   = strNum.length() / 16;
		int		nMod   = strNum.length() % 16;
		int		nArrI  = 5 - nDiv;
		int		nStrI  = 0;

		if (nMod != 0) {
			strTmp = strNum.substring(0, nMod);
			alNum[nArrI - 1] = Long.parseLong(strTmp);
			nStrI += nMod;
		}

		for (;nArrI < 5; nStrI += 16, nArrI++) {
			strTmp = strNum.substring(nStrI, nStrI + 16);
			alNum[nArrI] = Long.parseLong(strTmp);
		}

		return alNum;
	}

	private static void calc() {
		String	strNum1 = parseStdin();
		String	strNum2 = parseStdin();

		if (strNum1.length() > 80 || strNum2.length() > 80) {
			System.out.println("overflow");
		}
		else {
			long[]	alNum1 = parseNum(strNum1);
			long[]	alNum2 = parseNum(strNum2);

			for(int nArrI = 4; nArrI >= 0; nArrI--) {
				alNum1[nArrI] += alNum2[nArrI];
				if (nArrI > 0 && alNum1[nArrI] >= (long)1e+16) {
					alNum1[nArrI]     %= (long)1e+16;
					alNum1[nArrI - 1] += (long)1;
				}
			}

			if (alNum1[0] >= (long)1e+16) {
				System.out.println("overflow");
			}
			else {
				boolean	bZero = true;

				for(int nArrI = 0; nArrI < 5; nArrI++) {
					if (bZero) {
						if (alNum1[nArrI] > 0L && bZero) {
							System.out.printf("%d", alNum1[nArrI]);
							bZero = false;
						}
					} else {
						System.out.printf("%016d", alNum1[nArrI]);
					}
				}

				if (bZero) {
					System.out.println("0");
				}
				else {
					System.out.println("");
				}
			}
		}
	}
}

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

int n;
int l[2010];

int search(int j, int max)
{
    int num = upper_bound(l + j + 1, l + n, max - 1) - (l + j + 1);
    return num;
}

int main()
{
    cin >> n;
    rep(i, n)
    {
        cin >> l[i];
    }

    sort(l, l + n);

    ll ans = 0;
    for (int i = 0; i < n - 2; i++)
    {
        for (int j = i + 1; j < n - 1; j++)
        {
            int max = l[j] + l[i];
            ll res = search(j, l[j] + l[i]);
            ans += res;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    IOS;
    int n;
    cin >> n;
    vector<int> vec;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        vec.push_back(a);
    }
    sort(vec.begin(),vec.end());
    int ans = vec[n/2]-vec[(n/2)-1];
    cout <<ans <<endl;
}

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

int main()
{
  int a, b;
  cin >>  a >> b;
  
  int res = -1;
  
  for (int i=0; i<=1000; i++) {
    if (i*8/100 == a && i/10 == b) {
      res = i;
      break;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define md(a, b)		((a) % b + b) % b
#define mod(a)			md(a, MOD)
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define forn(i, n)			for(int i = 0; i < n; i++)
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
//int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef long double ld;	
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//find_by_order kth largest  order_of_key <
const int tam = 100010;
const int MOD = 1000000007;
const int MOD1 = 998244353;
const double EPS = 1e-9;
const double PI = acos(-1); 
pair<pair<ll, ll>, ll> ar[20];
	ll res[100];
	ll cho[2][100010][100];
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("qwe.txt", "w", stdout)
	int n;
	cin>>n;
	fore(i, 1, n + 2)
	res[i] = MOD * 1ll * MOD;
	fore(i, 0, n)
	{
		cin>>ar[i].f.f>>ar[i].f.s>>ar[i].s;
		res[0] += min(abs(ar[i].f.s), abs(ar[i].f.f)) * ar[i].s;
	}
	int nu = 1 << n;
	vector<int> poses;
	int na;
	vector<int> ori, ver;
	ll par, cha;
	vector<int>:: iterator it, itt;
	int k;
	int tua, tue;
	fore(i, 0, nu)
	{
		fore(j, 0, n)
		{
			cho[0][i][j] = min(abs(ar[j].f.s), abs(ar[j].f.f)) * ar[j].s;
			fore(k, 0, n)
			{
				if((1 << k) & i)
					cho[0][i][j] = min(cho[0][i][j], abs(ar[k].f.s - ar[j].f.s) * ar[j].s);
			}
			cho[1][i][j] = min(abs(ar[j].f.s), abs(ar[j].f.f)) * ar[j].s;
			fore(k, 0, n)
			{
				if((1 << k) & i)
					cho[1][i][j] = min(cho[1][i][j], abs(ar[k].f.f - ar[j].f.f) * ar[j].s);
			}
		}
	}
	fore(i, 1, nu)
	{
		poses.clear();
		fore(j, 0, n)
		{
			if((1 << j) & i)
				poses.pb(j);
		}
		int siz = poses.size();
		na = 1 << siz;
		fore(j, 0, na)
		{
			par = 0;
			tua = 0;
			tue = 0;
			fore(i, 0, siz)
			{
				if((1<<i) & j)
					tua |= 1<<poses[i];
				else
					tue |= 1<<poses[i];
			}
			fore(i, 0, n)
			{
				par += min(cho[0][tua][i], cho[1][tue][i]);
			}
			res[siz] = min(res[siz], par);
		}
	}
	fore(i, 0, n + 1)
	{
		cout<<res[i]<<'\n';
	}
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2		

Measured memory_bytes: 54844
#include <bits/stdc++.h>
#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];

    int res = -1;
    rep(i, N-1) {
        for(int j=i+1; j<N; j++) {
            res = max(res, abs(A[i]-A[j]));
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n,m;
    std::cin >> n >>m;
    int a[50];
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    sort(a,a+n);
    int sum=0;
    for (int i = 0; i < m; i++) {
        sum+=a[n-1-i];
    }
    std::cout << sum << std::endl;
}


Measured memory_bytes: 256