akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v){stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modpow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES\n":"NO\n");}
void Yn(bool z){cout<<(z?"Yes\n":"No\n");}
void yn(bool z){cout<<(z?"yes\n":"no\n");}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 1e5;
ll n, a[N], b[N], idx[N*2];
vpll v;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n){
    cin >> a[i] >> b[i];
    v.pb(mp(a[i], i*2  ));
    v.pb(mp(b[i], i*2+1));
  }
  sort(rng(v));
  FOR(i, 0, n*2) idx[v[i].se] = i;
  ll ans = linf;
  FOR(i, 0, n){
    if(idx[i*2] <  n && idx[i*2+1] <  n) mins(ans, 0ll);
    if(idx[i*2] >= n && idx[i*2+1] <  n) mins(ans, a[i]-v[idx[i*2+1] < n-1 ? n-1 : n-2].fi);
    if(idx[i*2] <  n && idx[i*2+1] >= n) mins(ans, b[i]-v[idx[i*2  ] < n-1 ? n-1 : n-2].fi);
    if(idx[i*2] >= n && idx[i*2+1] >= n) mins(ans, a[i]+b[i]-v[n-1].fi-v[n-2].fi);
  }
  FOR(i, 0, n) ans += v[i].fi;
  ll s;
  s = 0; FOR(i, 0, n) s += a[i]; mins(ans, s);
  s = 0; FOR(i, 0, n) s += b[i]; mins(ans, s);
  cout << ans << endl;
  return 0;
}

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

char c[20][20];
int h, w;
int ig, jg;

int bfs(int i0, int j0) {
    queue<int> iq, jq;
    bool visited[20][20] = {};
    int d[20][20] = {};
    int res = 0;
    int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
    iq.push(i0), jq.push(j0);
    visited[i0][j0] = true;
    d[i0][j0] = 0;
    auto contain = [&](int i, int j) { return 0 <= i && i < h && 0 <= j && j < w; };
    while (iq.size()) {
        int i = iq.front(), j = jq.front();
        iq.pop(), jq.pop();
        ig = i;
        jg = j;
        for (int k = 0; k < 4; k++) {
            int i1 = i + dir[k][0], j1 = j + dir[k][1];
            if (contain(i1, j1) && c[i1][j1] == '.' && !visited[i1][j1]) {
                iq.push(i1), jq.push(j1);
                visited[i1][j1] = true;
                d[i1][j1] = d[i][j] + 1;
                res = max(res, d[i1][j1]);
            }
        }
    }
    return d[ig][jg];
}

int diameter() {
    int d = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (c[i][j] == '.') d = max(d, bfs(i, j));
        }
    }
    return d;
}

int main() {
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> c[i][j];
        }
    }
    cout << diameter() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=103974182;
using namespace std;
int n,m;
int a[100005];
pii b[100005];
int f[100005];

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

int find(int x)
{
	return (f[x]==x?x:f[x]=find(f[x]));
}

void add(int x,int y)
{
//	cout<<x<<' '<<y<<endl;
	x=find(x);
	y=find(y);
	if(rand()) f[x]=y;else f[y]=x;
}

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		scanf("%d",a+i);
		a[i]--;
	}
	init();
	for(int i=0;i<m;i++)
	{
		scanf("%d%d",&b[i].first,&b[i].second);
		b[i].first--;
		b[i].second--;
//		cout<<b[i].first<<' '<<b[i].second<<endl;
		add(b[i].first,b[i].second);
	}
//	for(int i=0;i<n;i++)
//	{
//		cout<<f[i]<<' ';
//	}
	int res=0;
	for(int i=0;i<n;i++)
	{
		if(find(i)==find(a[i])) res++;
	}
	cout<<res<<endl;
	return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	int cnt , ans = 0;
	for(int i = 0 ; i < s.length() ; i++) {
		cnt = 0;
		if(s[i] == 'R') {
			cnt++;
			if(i - 1 >= 0 && s[i - 1] == 'R')cnt++;
			if(i + 1 < 3 && s[i + 1] == 'R')cnt++;
			ans = max(cnt , ans);
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3620
#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 ll          long long
#define fio         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define vi          vector<ll>
#define pp          push_pop
#define pll         pair<ll,ll>
#define in          insert
#define ini(a,n)    memset(a,n,sizeof(a))
#define ff          first
#define ss          second
#define inf         10000000000000000
#define all(p)      p.begin(), p.end()
#define que_max     priority_queue <int>
#define que_min     priority_queue <int, vi, greater<int>>
#define print(a)    for(auto i:a){cout<<i<<" ";}
#define print1(a)   for(auto i:a){cout<<i.ff<<" "<<i.ss<<endl;}

typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> Set;
unordered_map<ll,vi> g;
unordered_map<ll,ll> vis;

const ll mod = 1e9+7;

ll power(ll x,ll y,ll p){ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;}
const ll N = 2e5+10;
ll dx[4]={-1, +1, 0, 0};
ll dy[4]={0, 0, +1, -1};
bool imp = false;
bool isPowerOfTwo (ll x)
{
    return x && (!(x&(x-1)));
}

void printString(ll n)
{
    char str[50]; // To store result (Excel column name)
    ll i = 0; // To store current index in str which is result

    while (n > 0) {
        // Find remainder
        ll rem = n % 26;

        // If remainder is 0, then a 'Z' must be there in output
        if (rem == 0) {
            str[i++] = 'z';
            n = (n / 26) - 1;
        }
        else // If remainder is non-zero
        {
            str[i++] = (rem - 1) + 'a';
            n = n / 26;
        }
    }
    str[i] = '\0';

    reverse(str, str + strlen(str));

    cout << str << endl;

    return;
}

void solve() {

    ll n;cin>>n;


    printString(n);


}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif

    fio
    int t=1;
    if(imp) cin>>t;

    while(t--)
    {
        // cout<<"Case #"<<tc<<": ";
        g.clear();
        vis.clear();
        solve();
        // tc++;
    }

}


Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    ll a,b,ans=0;
    cin >> a >> b;
    for (int i=1;i<a+1;++i){
        if(i<a || i<=b){
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let x = read::<String>();

  println!("{}", if x.contains('9') { "Yes" } else { "No" });
}



Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> v(N);
    for(int i=0; i<N; i++) cin >> v[i];

    sort(v.begin(), v.end(), greater<int>());
    int res = 0;
    for(int i=0; i<K; i++) res += v[i];
    cout << res << endl;
}


Measured memory_bytes: 888
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>

using namespace std;

struct Node{
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

Node *find(Node *u, int k){
	while(u != NIL && k != u->key){
		if(k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k){
	
	Node *y = NIL;
	Node *x = root;
	Node *z;
	
	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;
	
	while(x != NIL){
		y = x;
		if(z->key < x->key){
			x = x->left;
		} else {
			x = x->right;
		}
	}
	
	z->parent = y;
	
	if(y == NIL){
		root = z;
	} else {
		if(z->key < y->key){
			y->left = z;
		} else {
			y->right = z;
		}
	}

}

void inorder(Node *u){

	if(u == NIL) return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);

}

void preorder(Node *u){

	if(u == NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);

}

int main(){

	int n, i, x;
	string com;
	
	scanf("%d",&n);
	
	for(i = 0; i < n; i++){
		cin >> com;
		if(com == "find"){
			scanf("%d", &x);
			Node *t = find(root, x);
			if(t != NIL) printf("yes\n");
			else printf("no\n");
		} else if(com == "insert"){
			scanf("%d",&x);
			insert(x);
		} else if(com == "print") {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}
	
	return 0;

}



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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << max({a,b,c})*9+a+b+c << endl;
    return 0;
}


Measured memory_bytes: 256
#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 all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.sync_with_stdio(false); cin.tie(0);
	cin.exceptions(cin.failbit);

	ll l, r; cin >> l >> r;
	ll minv = 2019;
	for (ll i = l; i < l + 2019 && i <= r; i++)
		for (ll j = i + 1; j < i + 2019 && j <= r; j++)
			minv = min(minv, i * j % 2019);
	cout << minv << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define int long long
using namespace std;
static const int inf =1ll<<60;
typedef pair<int,int> pii;

int N;
int a[110];
int ans=inf;

signed main(){
    cin>>N;
    for(int i=0;i<N;++i)cin>>a[i];
    for(int i=-100;i<=100;++i){
        int temp=0;
        for(int j=0;j<N;++j){
            if(i==a[j])continue;
            temp+=pow(a[j]-i,2);
        }
        ans=min(ans,temp);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
N = int(input())
C = {}

for i in range(N):
  a, b = map(int,input().split())
  if b in C.keys():
    C[b] += a
  else:
    C[b] = a
    
time = 0
D = sorted(C.items())

for i in range(len(D)):
  time += D[i][1]
  if time > D[i][0]:
    print('No')
    break
else:
  print('Yes')




Measured memory_bytes: 45416
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int dp[310][310][310];
int main(){
	int n,m,MOD=1000000007;
	cin>>n>>m;
	vvp in(n+1);
	rep(i,m){
		int a,b,c;cin>>a>>b>>c;
		in[b].pb({a,c});
	}
	
	dp[0][0][0]=1;
	rep(i,n+1)rep(j,n+1)rep(k,n+1)if(dp[i][j][k]){
		int t=max(i,max(j,k));
		rep(l,in[t].size()){
			int co=0;
			if(in[t][l].first<=i)co++;
			if(in[t][l].first<=j)co++;
			if(in[t][l].first<=k)co++;
			if(co!=in[t][l].second)dp[i][j][k]=0;
		}
		(dp[t+1][j][k]+=dp[i][j][k])%=MOD;
		(dp[i][t+1][k]+=dp[i][j][k])%=MOD;
		(dp[i][j][t+1]+=dp[i][j][k])%=MOD;
	}
	int out=0;
	rep(i,310)rep(j,310)rep(k,310)if(max(i,max(j,k))==n)
		(out+=dp[i][j][k])%=MOD;
	cout<<out<<endl;
}










Measured memory_bytes: 114944
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        boolean c = true;

        for(int i = 0; i < n ;i++){
            int k = scan.nextInt();
            if(k % 2 == 0 && !(k % 3 == 0 || k % 5 == 0)) c = false;
        }
        scan.close();

        if(c) System.out.println("APPROVED");
        else System.out.println("DENIED");
    }
}

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

int main() {
  int N, K;
  string S;
  cin >> N >> K >> S;
  if(S[K - 1] == 'A'){
      S[K - 1] = 'a';
  }
  else if(S[K - 1] == 'B'){
      S[K - 1] = 'b';
  }
  else if(S[K - 1] == 'C'){
      S[K - 1] = 'c';
  }
  cout << S << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define mod 1000000007
#define INF 2147483647
#define fi first
#define se second
int abs(int a,int b){ 
  int c=max(a,b)-min(a,b);
  return c;
}
int gcd(int a,int b){
  int c=a%b;
  while(true){
    if(c==0) break;
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}
bool IsPrime(int num){
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  double sqrtNum = sqrt(num);
  for(int i=3;i<=sqrtNum;i+=2){
    if(num%i==0){
      return false;
    }
  }
  return true;
}
int q[100000000];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b[1000],d=0;
  cin>>a;
  for(int i=0;i<a;i++){
      cin>>b[i];
  }
  for(int i=0;i<a;i++){
      for(int j=i+1;j<a;j++){
	  // cout<<b[i]<<" "<<b[j]<<"\n";
	  
	  d+=b[i]*b[j];
      }
  }
  cout<<d<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize(3 , "Ofast" , "inline")
using namespace std ;
typedef long long ll ;
typedef pair<int , int> PII ;
const int N = 1e5 + 10 , INF = 0x3f3f3f3f , mod = 1e9 + 7;
unordered_map<string , int> mp ;
int main()
{
  int n ;
  cin >> n ;
  for(int i = 1; i <= n ;i ++)
   {
     string s ;
     cin >> s ;
     if(!mp[s]) mp[s] = 1 ;
   }
   cout << mp.size() << endl ;
  return 0 ;
}


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

int main(){
  int a,b;
  cin >> a >> b;
  
  int hight = 0;
  for(int i=1; i<=abs(a-b); i++){
    hight += i;
  }
  
  cout << hight-b << endl;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int n; cin >> n;
    V<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    V<int> b = a;
    sort(ALL(b));

    for(int i = 0; i < n; i++){
        if(a[i] == b[n - 1]){
            cout << b[n - 2] << endl;
        }else{
            cout << b[n - 1] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 4756
N = int(input())
s = []
for _ in range(N):
    s.append(int(input()))
    
if sum(s)%10 != 0:
    print(sum(s))
else:
    s = sorted(s)
    for si in s:
        if si % 10 != 0:
            print(sum(s) - si)
            break
    else:
        print(0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
	for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
	os << "]";
	return os;
}

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int n,m,x,c[15],a[15][15];
	cin >> n >> m >> x;
	int ans = INF;
	for(int i = 0;i < n;i++){
		cin >> c[i];
		for(int j = 0;j < m;j++) cin >> a[i][j];
	}
	for(int i = 0;i < (1 << n);i++){
		int sum[15] = {},csum = 0;
		for(int j = 0;j < n;j++){
			if(!(i >> j & 1)) continue;
			csum += c[j];
			for(int k = 0;k < m;k++) sum[k] += a[j][k];
		}
		bool isOK = true;
		for(int i = 0;i < m;i++){
			if(sum[i] < x) isOK = false;
		}
		if(isOK) chmin(ans,csum);
	}
	cout << (ans == INF ? -1 : ans) << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
const long long mod=1e9+7;
int a[205];
int vis[100005];
int prime[100005];
int f[20];
long long xq[205],n;
int did[105];
long long ans,tmp2,tmp1,tmp,tmp3,kkk;
void add(int x,int love){
	for(int i=1;i<=11;i++){
		while(x%prime[i]==0){
			f[i]+=love;x/=prime[i];
		} 
	}
	if(x!=1){
		ans*=x;
		ans%=mod;
	}
}
void C(int x,int y){
	for(int i=1;i<=y;i++){
		add(x-i+1,1);
		add(i,-1);
	}
}
int main(){
	for(int i=2;i<=100005;i++){
		if(vis[i]==0){
			prime[++tmp2]=i;
			for(int j=1;j<=100005/i;j++){
				vis[j*i]=1;
			}
		}
	}
	long long tmp=0,m;
	ans=1;
	cin>>n>>m;
	for(int i=1;i<=tmp2;i++){
		if(m%prime[i]==0){
			tmp++;
			while(m%prime[i]==0){
				 m/=prime[i];
				 a[tmp]++;
			}
	    }
	}
	if(m!=1)a[++tmp]=1;
	for(int i=1;i<=tmp;i++)C(a[i]+n-1,a[i]);
	for(int i=1;i<=11;i++){
		for(int j=1;j<=f[i];j++){
			ans*=prime[i];
			ans%=mod;
		}
	}
	printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
#include <string.h>
#define pai 3.1415926535

int main(void) {
	
	int N;
	int x[8], y[8];
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d%d", &x[i], &y[i]);
	}
	double avg=0;
	int sum1 = 1;
	int sum2 = 1;
	for (int i = N; i > 1; i--) {
		sum1 *= i;
	}
	for (int i = N - 1; i > 1; i--) {
		sum2 *= i;
	}
	
	for (int i = 0; i < N; i++) {
		for (int j =i+1; j < N; j++) {
			avg += (sqrt((double)(x[j] - x[i])*(x[j] - x[i])+(y[j] - y[i])*(y[j] - y[i])))*2*sum2;
		}
	} 
	printf("%f", avg/sum1);

	return 0;
}


Measured memory_bytes: 128
from collections import defaultdict

S = input()
T = input()

ds = defaultdict(set)
for k, c in enumerate(S):
    ds[c] |= {k}
dt = defaultdict(set)
for k, c in enumerate(T):
    dt[c] |= {k}

dss = set(tuple(x) for x in ds.values())
dts = set(tuple(x) for x in dt.values())

print('Yes' if dss ^ dts == set() else 'No')

Measured memory_bytes: 37996
#coding:utf-8
N  = int(input())
A = list(map(int,input().split()))
def c(A,B):
    for a,b in zip(A,B):
        if a != b:
            return False
    return True
while True:
    A.sort()
    prev = A[:]
    
    s = A[0]
    for i in range(N):
        if A[i] % s == 0:
            A[i] = s
        else:
            A[i] = A[i] % s
    A.sort()
    #print("A  :",A)
    #print("pre:",prev)
    if prev == A: break
#print("A  :",A)
#print("pre:",prev)
print(A[0])


Measured memory_bytes: 14224
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <cmath>
#include <bitset>
#include <queue>
#include <set>
#include <numeric>
#include <unordered_set>
#include <iomanip>
#include <string>

using namespace std;

typedef long long ll;
typedef long double ld;

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

	ll n, d, a;
	cin >> n >> d >> a;
	vector<pair<ll, ll>> v(n);
	for (auto &x : v)
	{
		cin >> x.first >> x.second;
		x.second = (x.second + a - 1) / a;
	}
	sort(v.begin(), v.end());

	ll runsum=0;
	vector<ll> change(n+1);

	ll tot = 0;
	for (ll i = 0; i < n; ++i)
	{
		runsum += change[i];
		ll h = v[i].second - runsum;
		if (h <= 0)
			continue;
		ll lo = 0, hi = n - 1, ans = -1;
		while (lo <= hi)
		{
			ll mid = lo + (hi - lo) / 2;
			if (v[mid].first <= v[i].first + 2 * d)
			{
				ans = mid;
				lo = mid + 1;
			}
			else
			{
				hi = mid - 1;
			}
		}
		runsum += h;
		change[ans + 1] -= h;
		tot += h;
	}
	cout << tot;
}

Measured memory_bytes: 4992
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin>>s;
    
    int n=s.size();
    if(s[0]==s.back()) n++;
    
    if(n%2){
        cout1("First")
    }else{
        cout1("Second")
    }
}

Measured memory_bytes: 512
#include<map>
#include<ctime>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mp make_pair
using namespace std;

map<pair<int,int>,int> m;

struct dsu
{
	int fa[200010],rank[200010];
	
	void init(int n)
	{
		for(int i=1;i<=n;i++)
		{
			fa[i]=i;
		}
	}
	
	int find(int x)
	{
		if(fa[x]==x)
		{
			return x;
		}
		return fa[x]=find(fa[x]);
	}
	
	void union_(int x,int y)
	{
		int fx=find(x);
		int fy=find(y);
		if(fx==fy)
		{
			return ;
		}
		if(rank[fx]<rank[fy])
		{
			fa[fx]=fy;
		}
		else
		{
			fa[fy]=fx;
			if(rank[fx]==rank[fy])
			{
				rank[x]++;
			}
		}
	}
	
	int same(int x,int y)
	{
		return find(x)==find(y);
	}
}a,b;

int main()
{
	int n,x,y;
	scanf("%d%d%d",&n,&x,&y);
	a.init(n);
	b.init(n);
	int from,to;
	for(int i=1;i<=x;i++)
	{
		scanf("%d%d",&from,&to);
		a.union_(from,to);
	}
	for(int i=1;i<=y;i++)
	{
		scanf("%d%d",&from,&to);
		b.union_(from,to);
	}
	for(int i=1;i<=n;i++)
	{
		m[mp(a.find(i),b.find(i))]++;
	}
	for(int i=1;i<=n;i++)
	{
		printf("%d ",m[mp(a.find(i),b.find(i))]);
	}
}

Measured memory_bytes: 13696
if __name__ == '__main__':
    # ??????????????\???
    # T = 'abc'
    # P = 'xyz'
    T = input()
    P = input()

    # ???????????????
    results = []

    for i in range(len(T) - len(P) + 1):
        temp = T[i:i+len(P)]
        if temp == P:
            results.append(i)

    # ???????????¨???
    for r in results:
        print(r)

Measured memory_bytes: 7460
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl;
#define pno cout << "no" << endl;
#define pYe cout << "Yes" << endl;
#define pNo cout << "No" << endl;
#define pYE cout << "YES" << endl;
#define pNO cout << "NO" << endl;
#define prin(num) cout << num << endl;
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MOD 1000000007LL
#define MAX 100005
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef priority_queue<P> PQ;

vector<ll> d;
ll n, k;

bool judge(ll t) {
    while(t>0) {
        if(binary_search(d.begin(), d.end(), t%10)) {
            return 0;
        }
        t/=10;
    }
    
    return 1;
}

int main(void) {
    ll i;
    cin >> n >> k;
    for(i=0; i<k; i++) {
        ll tmp;
        cin >> tmp;
        d.push_back(tmp);
    }
    
    for(i=n; i<=100000; i++) {
        if(!judge(i)) continue;
        prin(i)
        return 0;
    }
    
    
}


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

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    cout << (x-z)/(y+z) << endl;
    return 0;
}

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

const string TBL = "a()[]+*";
map<pair<int, int>, int> trans;

void solve() {
    int n, m, s, t; cin >> n >> m >> s >> t;
    if (n == 0) exit(0);
    s--; t--;

    vector<vector<vector<bool>>> dp(n, vector<vector<bool>>(n, vector<bool>(9)));
    struct X { int i, j, c; };
    queue<X> q;
    while (m--) {
        int i, j; cin >> i >> j;
        i--; j--;
        char c_; cin >> c_;
        int c = TBL.find(c_);
        if (c == 6) c--;
        if (!dp[i][j][c]) dp[i][j][c] = true, q.push({i, j, c});
    }

    while (!q.empty()) {
        X x = q.front(); q.pop();
        for (int c = 0; c < 9; c++) {
            // (x.i, x.j), (x.j, k) -> (x.i, k)
            if (trans.count({x.c, c})) {
                int c2 = trans[{x.c, c}];
                for (int k = 0; k < n; k++) {
                    if (dp[x.j][k][c] && !dp[x.i][k][c2]) {
                        dp[x.i][k][c2] = true;
                        q.push({x.i, k, c2});
                    }
                }
            }
            // (k, x.i), (x.i, x.j) -> (k, x.j)
            if (trans.count({c, x.c})) {
                int c2 = trans[{c, x.c}];
                for (int k = 0; k < n; k++) {
                    if (dp[k][x.i][c] && !dp[k][x.j][c2]) {
                        dp[k][x.j][c2] = true;
                        q.push({k, x.j, c2});
                    }
                }
            }
        }
    }
    cout << (dp[s][t][0] ? "Yes" : "No") << endl;
}

signed main() {
    trans[{0, 5}] = 6;
    trans[{1, 0}] = 7;
    trans[{3, 0}] = 8;
    trans[{6, 0}] = 0;
    trans[{7, 2}] = 0;
    trans[{8, 4}] = 0;
    while (1) solve();
}


Measured memory_bytes: 10844
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

//DFS
vector<vector<pair<int, int>>> g;
const int N = 1e5;
int used[N];
int col[N];

int maxans=0;

void dfs(int i, int c) {
  if(used[i]) return;
  used[i] = 1;
  //col[i] = c;
  maxans=max((int)(g[i].size()),maxans);
  for(auto to : g[i]) {
    dfs(to.first, to.second);
  }
}


void dfs2(int i, int c) {
  if(used[i]) return;
  used[i] = 1;
  int ind=1;
  for(auto to : g[i]) {
    if (used[to.first]) continue;
    if (ind==c)ind++;
    col[to.second] = ind;
    //cout<<(i+1)<<" "<<(to.first+1)<<" "<<ind<<endl;
    dfs2(to.first, ind);
    ind++;
  }
}




int main() {
  cin>>n;
  g.resize(n);
  for(int i = 0; i < n-1; i++) {
    int a, b;
    cin >> a >> b ;
    a--; b--;
    g[a].emplace_back(b, i);
    g[b].emplace_back(a, i);
  }
  dfs(0, 0);

  REP(i,N){
    used[i]=0;
  }
  dfs2(0, 0);


  cout<<maxans<<endl;
  REP(i,n-1){
    cout<<col[i]<<endl;
  }
  return 0;
}




Measured memory_bytes: 7296
import fractions

A, B = map(int, input().split())

g = fractions.gcd(A, B)

def prime_decompose(x):
    decomposed = []
    for i in range(2,int(pow(x,0.5))+1):
        while x % i == 0:
            x //= i
            decomposed.append(i)
    if x > 1:
        decomposed.append(x)
    return decomposed

g_dec = set(prime_decompose(g))
print(len(g_dec)+1)

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

int main() {

	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];
	sort(a.begin(), a.end());
	string ans = "No";
	if ((a[0] == a[1] && a[1] != a[2]) || (a[2] == a[1] && a[1] != a[0])) ans = "Yes";
	cout << ans << endl;
    return 0;
}

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

int main() {
  int N,M,A,B,C,ans,d;
  cin >>N>>M;
  ans=0;
  int a[N];
  for(int i=0;i<N;i++){
    a[i]=0;
  }
  for(int i=0;i<M;i++){
    cin>>d;
    for(int j=0;j<d;j++){
      cin>>A;
      a[A-1]++;
    }
  }
   for(int i=0;i<N;i++){
     if(a[i]==0){
       ans++;
     }
   }
  cout<<ans<<endl;
}


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

int main() {
    int N, K;
    cin >> N >> K;
    vector<bool> n(N, false);
    for (int i = 0; i < K; ++i) {
        int number;
        cin >> number;
        for (int l = 0; l < number; ++l) {
            int buf;
            cin >> buf;
            n[buf - 1] = true;
        }
    }
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if (n[i] == false) {
            ans++;
        }
    }
    cout << ans << endl;
}

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, rev;
    long double cap;
	Edge(ll _to, long double _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, long double cap, bool revFlag, long double revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


void solve(){
    ll n;
    cin>>n;
    vec<ll> c(n+1,0);//ai=jとなるiの数
    REP(i,n){
        ll a;
        cin>>a;
        c[a]++;
    }
    vec<ll> d(n+1,0);//ci=jとなるiの数
    REP(i,n+1) d[c[i]]++;

    vec<ll> sumkd(n+2,0),sumd(n+2,0);
    REP(i,n+1) sumkd[i+1] = sumkd[i]+i*d[i];
    rep(i,1,n+1) sumd[i+1] = sumd[i]+d[i];

    vec<ll> f(n+1,0);
    f[0]=n;
    rep(x,1,n+1) f[x] = (sumkd[x+1]-sumkd[0] + x*(sumd[n+1]-sumd[x+1]))/x;//min(k,x)なので、x以下の場合だけkかける
    
    int ans=n;
    rep(k,1,n+1){
        while(f[ans]<k) ans--;
        cout<<ans<<en;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 12672
#include<bits/stdc++.h>
using namespace std;
#define hackcyborg shresth_walia
#define ll  long long
#define int long long
#define ld  long double
#define pb push_back
#define mod 998244353
#define M_PI 3.141592653589
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll binpow(ll a,ll b,ll m=mod) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%m ;
        a = (a * a)%m ;
        b >>= 1;
    }
    return res;
}
main()
{   IO
    ll f;
    cin>>f;
    ll n;
    cin>>n;
    ll p[n];
    set<ll> ar;
    for(int x=0;x<n;x++)
        {cin>>p[x];
        ar.insert(p[x]);}
        ll mi=1e14;
        ll ans=0;
    for(int x=0;x<=101;x++)
    {
        if(!ar.count(x))
        {
            if(abs(x-f)<mi)
            {
                mi=abs(x-f);
                ans=x;
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3664
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <limits.h>
#include <map>
#include <numeric>

namespace test {
  std::string to_string(char val) {
    return std::string(1, val);
    // return std::string{val};
  }
}

using namespace std;

int main(void) {
  int a, b , c;
  cin >> a >> b >>c;

  int result;

  result = b / a;

  cout << (result > c ? c : result) << endl;

  return 0;
}

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

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, A, B;
	vector<pair<int,int>> x;
	set<pair<int,int>> s;
	
	cin>>N>>A>>B;
	
	for(int i = 1; ; i++){
		if(s.count({A,B})){
			break;
		}
		
		x.push_back({A,B});
		s.insert({A,B});
		
		if(i%2) A = A - B;
		else B = A + B;
	}
	
	int n = N%x.size();
	
	cout<<x[n].first<<" "<<x[n].second<<endl;
	
	
	return 0;
}


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

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A,mat &B){
  mat C(A.size(),vec(B[0].size()));
  for(int i=0;i<A.size();i++){
    for(int k=0;k<B.size();k++){
      for(int j=0;j<B[0].size();j++){
        C[i][j]=(C[i][j]+A[i][k]*B[k][j]%MOD)%MOD;
      }
    }
  }
  return C;
}

mat pow(mat A, ll n){
  mat B(A.size(),vec(A.size()));
  for(int i=0;i<A.size();i++) B[i][i]=1;
  while(n>0){
    if(n&1) B=mul(B,A);
    A=mul(A,A);
    n>>=1;
  }
  return B;
}


int main(){
  int N; cin>>N;
  ll K; cin>>K;
  mat A(N);
  rep(i,N) rep(j,N){
    ll a; cin>>a;
    A[i].push_back(a);
  }
  mat dp=pow(A,K);
  ll ans=0;
  rep(i,N) rep(j,N) (ans+=dp[i][j])%=MOD;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
# temp
A = str(input())

ACcheck=0;

if(A[0]=="A"):
    A=A.replace("A", "a");
    if(A.count('C')==1):
        if(A[1]!="C" and A[-1]!="C"):
            A=A.replace("C", "c");
            if(A.lower()==A):
                ACcheck=1;

if(ACcheck==0):
    print("WA");
else:
    print("AC");


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main () {
  int A, B, C;
  cin >> A >> B >> C;
  int ans = 0;
  if (A + B + 1 >= C) ans = B + C;
  if (A + B + 1 < C) ans = A + 2 * B + 1;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    string S; cin >> S;
    if(S[0]=='S') cout << "Cloudy" << endl;
    else if(S[0]=='C') cout << "Rainy" << endl;
    else cout << "Sunny" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int iNum1 = 1;
	int iNum2 = 1;
	int iCount1;
	int iMaxCount1 = 0;
	int** piNum;
	piNum = (int**)malloc(sizeof(int*) * 3000);
	for (iCount1 = 0; iCount1 < 3000; iCount1++)
	{
		piNum[iCount1] = (int*)malloc(sizeof(int) * 2);
	}
	do
	{
		scanf("%d%d", &iNum1,&iNum2);
		piNum[iMaxCount1][0] = iNum1;
		piNum[iMaxCount1][1] = iNum2;
		iMaxCount1++;
	} while (iNum1 != 0 || iNum2 != 0);
	for (iCount1 = 0; iCount1 < iMaxCount1 - 1; iCount1++)
	{
		if (piNum[iCount1][0] > piNum[iCount1][1])
		{
			printf("%d %d\n", piNum[iCount1][1], piNum[iCount1][0]);
		}
		else
		{
			printf("%d %d\n", piNum[iCount1][0], piNum[iCount1][1]);
		}
	}
	for (iCount1 = 0; iCount1 < 50; iCount1++)
	{
		free(piNum[iCount1]);
	}
	free(piNum);
	return 0;
}


Measured memory_bytes: 2032
s1=input()
s2=input()
n=len(s1)
ans=''
for i in range(min(len(s1),len(s2))):
    ans+=s1[i]+s2[i]
#print(i)
if i!=len(s1)-1:
    ans+=s1[i+1]
if i!=len(s2)-1:
    ans+=s2[i+1]
print(ans)

Measured memory_bytes: 38384
#include <stdio.h>
int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int x=a;
	if (x<=b)
	{
		x=b;
	}
	if (x<=c)
	{
		x=c;
	}
	printf("%d\n",(a+b+c-x)+(x*10));
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define JN ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define mod 1000000007

#define pb push_back
#define mp make_pair

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




int main()
{

	ll n, k;
	cin >> n >> k;
	ll frog[n+2], cost[n+2];

	for(int i=1; i<=n; i++)
		cin >> cost[i];

	frog[1] =0;
	frog[2] = abs(cost[2]-cost[1]);
	for(ll i=3; i<=n; i++)
	{
		frog[i] = 1e14;
		for(ll j=1; j<=min(k, i-1); j++)
			frog[i] = min(frog[i], frog[i-j]+abs(cost[i]-cost[i-j]));
	}
	cout << frog[n] << endl;
	return 0;
}

Measured memory_bytes: 1792
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]

ans = [0 for i in range(n)]
for i in range(n):
    distance = 1e16
    tmp_ans = 1
    for j in range(m):
        tmp_dis = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if distance > tmp_dis:
            distance = tmp_dis
            tmp_ans = j + 1
    print(tmp_ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n, goal;
    cin >> n >> goal;
    goal /= 100;
    vector<int> p(n), c(n);
    for(int i = 0; i < n; ++i){
        cin >> p[i] >> c[i];
        c[i] /= 100;
    }
    
    int ans = INF;
    for(int bit = 0; bit < (1 << n); ++bit){
        int sum = 0;
        int cnt = 0;
        for(int i = 0; i < n; ++i){
            if((bit >> i) & 1){
                cnt += p[i];
                sum += (i + 1) * p[i] + c[i];
            }
        }
        if(sum >= goal){
            chmin(ans, cnt);
            continue;
        }
        int rest = goal - sum;
        for(int i = n - 1; i >= 0; --i){
            if((bit >> i) & 1)  continue;
            bool ok = false;
            for(int j = 0; j < p[i]; ++j){
                rest -= i + 1;
                ++cnt;
                if(rest <= 0){
                    chmin(ans, cnt);
                    ok = true;
                    break;
                }
            }
            if(ok)  break;
            rest -= c[i];
            if(rest <= 0){
                chmin(ans, cnt);
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[4],c,i,b;
    c=0;b=0;
    for(i=0;i<4;i++)
    {
        cin>>a[i];
        if(a[i]==1||a[i]==4||a[i]==7||a[i]==9)
        {
            c++;
        }
        b=b+a[i];
    }
    if(c==4 && b==21)
        cout<<"YES\n";
    else
        cout<<"NO\n";
    return 0;

}


Measured memory_bytes: 256
#include <iostream>

int main()
{
  int w, h, x, y, r;
  int t, b, l, ri;

  std::cin >> w >> h >> x >> y >> r;

  t = y + r;
  b = y - r;
  l = x - r;
  ri = x + r;

  if (t > h || b < 0 || l < 0 || ri > w)
  {
    std::cout << "No" << '\n';
  }
  else
  {
    std::cout << "Yes" << '\n';
  }
}



Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B;
	cin >> A >> B;
	cout << max({ A + B,A - B,A * B }) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cstring>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

#define SIZE(x) (int((x).size()))
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
#define repd(i,r,l) for (int i=(r); i>=(l); i--)
#define rept(i,c) for (typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)

#ifndef ONLINE_JUDGE
#define debug(x) { cerr<<#x<<" = "<<(x)<<endl; }
#else
#define debug(x) {}
#endif

#define MD 1000000007
#define INV2 500000004

#define maxn 500010

int fact[maxn], a[maxn], v[maxn], t[maxn], ta[maxn];

void serere(int x, int y)
{
	while (x<maxn) ta[x]+=y, x+=x&-x;
}

int query(int x)
{
	int ret=0;
	while (x) ret+=ta[x], x-=x&-x;
	return ret;
}

void lemon()
{
	int n; scanf("%d",&n);
	fact[0]=1; rep(i,1,n) fact[i]=LL(fact[i-1])*i%MD;
	rep(i,1,n) scanf("%d",&a[i]);
	
	rep(i,1,n) v[i]=1;
	rep(i,1,n) if (a[i]) v[a[i]]=0; 
	repd(i,n,1) v[i]=v[i+1]+v[i];
	
	int m=0;
	rep(i,1,n) if (!a[i]) m++;
	
	repd(i,n,1)
		if (!a[i])
			t[i]=t[i+1];
		else
			t[i]=(t[i+1]+v[a[i]])%MD;
		
	int ans=fact[m];
	int cnt=0;
	repd(i,n,1)
		if (!a[i])
		{
			ans+=LL(LL(LL(fact[n-i])*fact[m]%MD)*INV2%MD)*cnt%MD;
			ans%=MD;
			cnt++;
		}
	
	rep(i,1,n)
		if (!a[i])
		{
			ans+=LL(LL(t[i])*fact[n-i]%MD)*fact[m-1]%MD;
			ans%=MD;
		}
		
	rep(i,1,n) v[i]=1;
	rep(i,1,n) if (a[i]) v[a[i]]=0; 
	rep(i,1,n) v[i]=v[i-1]+v[i];
	
	cnt=0;
	repd(i,n,1)
		if (!a[i])
			cnt++;
		else
		{
			ans+=LL(LL(LL(fact[n-i])*v[a[i]]%MD)*cnt%MD)*fact[m-1]%MD;
			ans%=MD;
		}
		
	repd(i,n,1)
	{
		if (!a[i]) continue;
		int x=query(a[i]);
		ans+=LL(LL(fact[n-i])*x%MD)*fact[m]%MD;
		ans%=MD;
		serere(a[i],1);
	}
	cout<<ans<<endl;
	
	
}

int main()
{
	ios::sync_with_stdio(true);
	#ifndef ONLINE_JUDGE
		//freopen("E.in","r",stdin);
	#endif
	lemon();
	return 0;
}



Measured memory_bytes: 9984
import std.algorithm;
import std.stdio;
void main ()
{
	int rows, cols, h, w;
	while (readf (" %s %s %s %s", &rows, &cols, &h, &w) > 0)
	{
		if (rows % h == 0 && cols % w == 0)
		{
			writeln ("No");
		}
		else
		{
			writeln ("Yes");
			auto m = new int [] [] (rows, cols);
			foreach (row; 0..rows)
			{
				foreach (col; 0..cols)
				{
					m[row][col] =
					    (row % h == 0 &&
					    col % w == 0) ?
					    +999999 :
					    (row % h == h - 1 &&
					    col % w == w - 1) ?
					    -1000000 :
					    0;
				}
			}
			writefln ("%(%(%s %)\n%)", m);
		}
	}
}


Measured memory_bytes: 3836
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

def solve():
    N = INT()
    a = []
    b = []
    for i in range(N):
        A, B = MAP()
        a.append(A)
        b.append(B)
    a.sort()
    b.sort()

    if N % 2 == 1:
        am = a[(N+1)//2-1]
        bm = b[(N+1)//2-1]
        ans = bm - am + 1
    else:
        am = ( a[N//2-1]+a[N//2] ) / 2
        bm = ( b[N//2-1]+b[N//2] ) / 2
        ans = int( ( bm - am ) * 2 + 1 )
    print(ans)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 26628