akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ANS(ans) cout << ans << endl


int main() {
    int n,k,q;
    cin >> n >> k >> q;
    vector<int> a(q);
    REP(i,q) cin >> a[i];
    vector<int> p(n);
    REP(i,n) p[i] = 0;
    REP(i,q) {
        p[a[i]-1] += 1;
    }
    REP(i,n) {
        if(p[i] > q-k) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 1408
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")

#include <iostream>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>
#include <vector>
#include <bitset>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <random>
#include <cassert>

using namespace std;

const int N = 100;

int n, m;
char f[N][N];

int dp[N][N];

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> f[i][j];
			f[i][j] = (f[i][j] == '.');
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			dp[i][j] = 1e9;
			if (!i && !j) {
				dp[i][j] = 1;
			}
			if (i) {
				dp[i][j] = min(dp[i][j], dp[i - 1][j] + (f[i][j] != f[i - 1][j]));
			}
			if (j) {
				dp[i][j] = min(dp[i][j], dp[i][j - 1] + (f[i][j] != f[i][j - 1]));
			}
		}
	}
	cout << (dp[n - 1][m - 1] + !f[0][0]) / 2 << '\n';
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
n, vs = gets.to_i, gets.chomp.split.map(&:to_i)
os, es = vs.partition.with_index {|_, i| i.odd? }
# 奇数番目の頻度表
ohi = os.group_by{|i| i }.map{|k, v| [k, v.length] }
# 偶数番目の頻度表
ehi = es.group_by{|i| i }.map{|k, v| [k, v.length]  }
# 奇数準拠のとき -> 偶数列は opop 以外で一番頻度が高いものがepop
opop = ohi.max_by {|pr| pr[1] }
# p opop
ehi_excluded_opop = ehi.select{|pr| pr[0] != opop[0] }
epop = ehi_excluded_opop.empty? ? [nil, 0] : ehi_excluded_opop.max_by{|pr| pr[1] }
# p epop
ans_based_odd = os.length - opop[1] + es.length - epop[1]
# p ans_based_odd
# 偶数準拠
epop = ehi.max_by {|pr| pr[1] }
# p epop
ohi_excluded_epop = ohi.select{|pr| pr[0] != epop[0] }
opop = ohi_excluded_epop.empty? ? [nil, 0] : ohi_excluded_epop.max_by{|pr| pr[1] }
# p opop
ans_based_even = os.length - opop[1] + es.length - epop[1]
# p ans_based_even

p [ans_based_odd, ans_based_even].min


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

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	int g = 0;
	for (int i = 0;i < n;i++) cin >> a[i],g = __gcd(g,a[i]);
	if (g != 1) cout << "not coprime";
	else {
		const int N = 1e6;
		vector<int> cnt(N + 1);
		for (auto&x : a) ++cnt[x];
		for (int i = 1;i <= N;i++) {
			for (int j = i + i;j <= N;j += i) cnt[i] += cnt[j];
		}
		bool flag = false;
		for (int i = 2;i <= N;i++) if (cnt[i] > 1) {
			flag = true;
			break;
		}
		if (flag) cout << "setwise coprime";
		else cout <<"pairwise coprime";
	}
} 

Measured memory_bytes: 11052
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInt();
            var s = Read();
            var ans = s.Count();
            for (int i = 0; i < n-1; i++)
            {
                if (s[i] == s[i + 1]) ans--;
            }
            WriteLine(ans);
        }


        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }


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

        //最大公約数
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
        public static void debuglist(List<int> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debuglist(List<string> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(int[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(string[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
    }
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> cards;
    vector<vector<int>> trans;

    for (int i = 0; i < n; i++)
    {
        int num;
        scanf("%d", &num);
        cards.push_back(num);
    }

    sort(cards.begin(), cards.end());

    for (int i = 0; i < m; i++)
    {
        int amo, num;
        scanf("%d %d", &amo, &num);
        trans.push_back(vector<int>{amo, num});
    }

    sort(&trans[0], &trans[m], [](auto &x, auto &y) { return x[1] < y[1]; });

    int counter = 0;
    int cardIndex = n - 1;
    int transIndex = trans.size() - 1;
    long long res = 0;

    while (counter < n)
    {
        if (cardIndex < 0)
        {
            res += trans.at(transIndex).at(1);
            if (trans.at(transIndex).at(0) == 1)
            {
                transIndex--;
            }
            else
            {
                trans.at(transIndex).at(0) = trans.at(transIndex).at(0) - 1;
            }
        }else if (transIndex < 0)
        {
            res += cards.at(cardIndex);
            cardIndex--;
        }else if (cards.at(cardIndex) < trans.at(transIndex).at(1))
        {
            res += trans.at(transIndex).at(1);
            if (trans.at(transIndex).at(0) == 1)
            {
                transIndex--;
            }
            else
            {
                trans.at(transIndex).at(0) = trans.at(transIndex).at(0) - 1;
            }
        }else
        {
            res += cards.at(cardIndex);
            cardIndex--;
        }
        
        counter ++;
        
    }

   cout << res << endl;
}

Measured memory_bytes: 7024
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main() {
  ll n;
  cin >> n;
  vector<ll> v;
  REP(i, n) {
    ll a;
    cin >> a;
    v.pb(a);
  }
  sort(v.begin(), v.end());
  ll ans = -1111111111111111;
  REP(i, n) {
    if (abs((double)v.back() / 2.0 - (double)ans) > abs((double)v.back() / 2.0 - (double)v[i]))
      ans = v[i];
  }
  cout << v.back() << " " << ans << endl;
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())

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

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

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


void Main()
{
    int n;
    cin>>n;
    vector<int> a(n+1);
    REP(i, n+1) cin >> a[i];
    vector<int> b(n);
    REP(i, n) cin >> b[i];

    LL sum = 0;
    REP(i,n){

        sum += min(a[i], b[i]);
        b[i] = max(0, b[i]-a[i]);

        sum += min(a[i+1], b[i]);
        a[i+1] = max(0, a[i+1]-b[i]);

    }

    cout << sum << endl;

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

    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  map<int, int> mp;
  FOR(i,1,10){
    mp[i] = i % 3 == 0 ? 3 : i % 3;
  }
  string s;
  while(cin>>s&&s[0]!='#'){
    int n = s.length();
    int dp[n+1][2]; // i個目まで見てて0:左1右足を踏んだ時の最小値
    FOR(i,0,n+1)dp[i][0]=dp[i][1]=1e9;
    dp[0][0]=dp[0][1]=0;
    FOR(i,0,n){
      int now = mp[s[i]-'0'];
      int pre = i ? mp[s[i-1]-'0'] : now;
      // 同じ列の場合どっちの足でもOK
      if(now == pre) {
        // 同じ足
        dp[i+1][0] = min(dp[i+1][0], dp[i][0]+1);
        dp[i+1][1] = min(dp[i+1][1], dp[i][1]+1);
        // 違う足
        dp[i+1][0] = min(dp[i+1][0], dp[i][1]);
        dp[i+1][1] = min(dp[i+1][1], dp[i][0]);
      }
      // 前の足より左を踏む時は左足で踏む
      else if (now < pre){
        dp[i+1][0] = min(dp[i+1][0], dp[i][0]+1);
        dp[i+1][0] = min(dp[i+1][0], dp[i][1]);
      }
      // 前の足より右を踏む時は右足で踏む
      else {
        dp[i+1][1] = min(dp[i+1][1], dp[i][1]+1);
        dp[i+1][1] = min(dp[i+1][1], dp[i][0]);
      }
    }
    cout<<min(dp[n][0],dp[n][1])<<endl;
  }
}


Measured memory_bytes: 3944
#include <bits/stdc++.h>
#define pb push_back
#define pob pop_back()
#define sz size()
#define mp make_pair
#define f first
#define s second
#define BALE ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef vector <int> vi;

const int inf = 1e9, mod = 1e9 + 7, N = 3e5 + 111;
const ll linf = 1e18;

int n, ans, a[N];
pair <int, int>  b[N];

int main(){
	cin >> n;

	for(int i = 1; i <= n; ++i)
		cin >> b[i].f, b[i].s = i;

	sort(b + 1, b + n + 1);

	for(int i = 1; i <= n; ++i)
		a[b[i].s] = i;

	for(int i = 1; i <= n; ++i){
		cin >> a[i];
		if(i % 2 == 1 && a[i] % 2 == 0)
			ans++;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
int ar[200002] ;
vector<int>ps,ne,tup ;
bool cmp(int a , int b) {return a>b ; }
int32_t main()
{
    int n,k ; cin>>n>>k ;
    int an=1 ;
    for(int i = 0 ; i < n ; i++) {cin>>ar[i] ; if(ar[i]>=0) an=0 ;}
    if(k==n)
    {
        int ans=1 ;
        for(int i = 0 ; i < n ; i++)
        {
            int x=ar[i] ;
            x=(x+mod)%mod ;
            ans=(ans*x)%mod ;
        }
        cout<<ans<<endl ;
    }
    else
    {
        if(an)
        {
           // cout<<"jkl "<<k<<endl ;
            if(k&1ll) sort(ar,ar+n,cmp) ;
            else sort(ar,ar+n) ;
            int ans=1 ;
            for(int i = 0 ; i < k ; i++)
            {
                int x=ar[i] ;
                x=(x+mod)%mod ;
                ans=(ans*x)%mod ;
            }
            cout<<ans<<endl ;
        }
        else
        {
           // cout<<"oo"<<endl ;
            int ans=1 ;
            for(int i = 0 ; i < n ; i++)
            {
                if(ar[i]>=0) ps.push_back(ar[i]) ;
                else ne.push_back(ar[i]) ;
            }
            sort(ps.begin(),ps.end()) ;
            sort(ne.rbegin(),ne.rend()) ;
          //  for(int i = 0 ; i < ps.size() ; i++) cout<<ps[i]<<" " ; cout<<endl ;
          //  for(int i = 0 ; i < ne.size() ; i++) cout<<ne[i]<<" " ; cout<<endl ;
            if(k&1)
            {
                int x=ps.back() ; ps.pop_back() ;
                ans=(ans*x*1ll)%mod ;
            }
            while((int)ps.size()>1)
            {
                int x=ps.back() ; ps.pop_back() ;
                int y=ps.back() ; ps.pop_back() ;
                int h=(x*y) ;
                tup.push_back(h) ;
            }
            while((int)ne.size()>1)
            {
                int x=ne.back() ; ne.pop_back() ;
                int y=ne.back() ; ne.pop_back() ;
                int h=(x*y) ;
                tup.push_back(h) ;
            }
            sort(tup.rbegin(),tup.rend()) ;
            //for(int i = 0 ; i < (int)tup.size() ; i++) cout<<tup[i]<<" " ; cout<<endl ;
            for(int i = 0 ; i < k/2 ; i++)
            {
                ans%=mod ; tup[i]%=mod ;
                ans=(ans*tup[i])%mod ;
            }
            cout<<ans%mod<<endl ;

        }
    }

}
// -1000000000 -1 -1000000000 -1000000000 -1000000000


Measured memory_bytes: 8180
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
struct point{int x;int y;};
int i,j,k,count1=0,count2=0;

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    int x;
    vector<int> vec(3,0);
    rep(i,n){
        cin>>x;
        if(x<=a)vec[0]++;
        if(x>a&&x<=b)vec[1]++;
        if(x>b)vec[2]++;
    }
    sort(vec.begin(),vec.end());
    cout<<vec[0]<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#include <time.h>
typedef std::pair<int,int> pii;
using namespace std;
using ll = long long;
#define PI 3.14159265358979323846264338327950L
const int mod = 1000000007;



string alphabet(ll n){
    if (n==0) return "";
    n--;
    return alphabet(n/26) + (char)('a' + n%26);
}
void solve(){
    ll n;
    cin >> n;
    cout << alphabet(n);
}



int main(){
    solve();
}




Measured memory_bytes: 3608
#include <cstdio>
#include <random>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <chrono>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define int long long


using namespace std;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const long long INF = 1e18;
const int M = 1e9 + 7;





signed main()
{
#ifndef ONLINE_JUDGE
	// freopen("out.txt", "w", stdout);
#endif
	int a, b, n, x;
	cin >> a >> b >> n;
	if(n >= b) {
		x = b - 1;
	} else {
		x = n;
	}
	cout << a * x / b - x / b * a << endl;




    
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,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;
typedef double 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,string> tp;
//typedef vector<tp> vt;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	cin>>n>>m;
	vvi in(n,vi(3));
	rep(i,n)rep(j,3)cin>>in[i][j];
	double out=0;
	rep(i,1<<n){
		double sum=0;
		int co=0;
		rep(j,n)if(i&1<<j)co++;
		if(co!=m)continue;
		rep(j,n)loop(k,j+1,n)if(i&1<<j&&i&1<<k){
			sum+=(in[j][0]-in[k][0])*(in[j][0]-in[k][0])+
				(in[j][1]-in[k][1])*(in[j][1]-in[k][1])+
				(in[j][2]-in[k][2])*(in[j][2]-in[k][2]);
		}
		out=max(out,sum);
	}
	cout<<shosu(9)<<out<<endl;
}

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

int main() {
  int a, b;
  string op;
  cin >> a >> op >> b;
  
  if (op == "+") {
    cout << a + b << endl;
  }
  else {
    cout << a - b << endl;
  }
  return 0;
}
    

Measured memory_bytes: 256
#include <stdio.h>


int ispower(int y)
{
	int result=0;
	for(int i=2;i<y;i++)
	{
		int count=1;
		while(1)
			{
			if (count==y)
			{
				return 1;
			}
			if (count>y)
				break;
			count*=i ;
			}
		
	}
	return 0;				
}		
	
	

int main()
{
	int x;
	int max=0;	
	scanf("%d",&x);
	if (x==1)
		printf("%d",1);
	else	
	{for(int i=2;i<=x;i++)
	{
		if(ispower(i))
			max=i;
	}
	printf("%d\n",max);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=1000005;
#define M 1000000007
#define double long double
#define BINF 1000000000000001
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
const int LG = 22;


#undef int 
int main() { 
#define int long long int 
 
ios_base::sync_with_stdio(false); 
cin.tie(0); 
cout.tie(0); 

	int n,m;
	cin >> n >> m;
	int l = 0, r = BINF;
	for(int i = 0; i < m; i++){
		int x,y;
		cin >> x >> y;
		l = max(l,x);
		r = min(r,y);
	}
	int ans = r - l + 1;
	if(ans < 0) ans = 0;
	cout << ans;


return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int seats[] = new int[n];
        int nums[] = new int[n];
        for(int i=0;i<n;i++)
            seats[i]=s.nextInt();
        for(int i=0;i<n;i++)
            nums[seats[i]-1]=i+1;
        for(int i:nums)
            System.out.print(i+" ");
    }
}

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

using namespace std;

#define FOR(i,a,b) for(int i=a;i<=b;i++)

const int maxn=2e5+10;

int main() {
	// your code goes here
	int n,m,a[maxn];
	cin >> n;
	FOR(i,1,n) cin >> a[i];
	int lmin=a[1],dem=1;
	FOR(i,2,n) {
		if (a[i]<=lmin) dem++;
		lmin=min(lmin,a[i]);
	}
	cout << dem;
	return 0;
}

Measured memory_bytes: 1152
// In His Name

#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define gcd __gcd
#define int long long
#define ull unsigned long long

using namespace std;

typedef pair<int, int> pii;

const int MAX = 3e2 + 10;
int n, cnt[3];
double dp[MAX][MAX][MAX];

main (){
	cin >> n;
	for (int i = 0 ; i < n ; i++){
		int x;
		cin >> x;
		cnt[--x]++;
	}
	dp[0][0][0] = 0.0;
	for (int k = 0 ; k <= n ; k++){
		for (int j = 0 ; j <= n ; j++){
			for (int i = 0 ; i <= n ; i++){
				if (!(i + j + k))	continue;
				if (i)		dp[i][j][k] += (i + 0.0) * (dp[i - 1][j][k]);
				if (j)		dp[i][j][k] += (j + 0.0) * (dp[i + 1][j - 1][k]);
				if (k)		dp[i][j][k] += (k + 0.0) * (dp[i][j + 1][k - 1]);
				dp[i][j][k] += n;
				dp[i][j][k] /= (i + j + k);
			}
		}
	}
	cout << setprecision (20) << dp[cnt[0]][cnt[1]][cnt[2]];
}

Measured memory_bytes: 227584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long N, vector<long long> A){
	ll c = 0;
	rep(i, N) if (A[i]%2 == 1) c++;
	if (c%2 == 1) cout << "NO" << endl; else cout << "YES" << endl;
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> A(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&A[i]);
	}
	solve(N, A);
	return 0;
}



Measured memory_bytes: 1792
def main():
    N = int(input())
    A = list(map(int, input().split()))
    negatives = 0
    zeros = 0
    min_abs = 10**9 + 1
    for a in A:
        if a < 0:
            negatives += 1
        if a == 0:
            zeros += 1
        min_abs = min(min_abs, abs(a))
    ans = sum(map(abs, A))
    if negatives % 2 == 0 or zeros != 0:
        print(ans)
        return

    ans -= 2*min_abs
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14224
#!/usr/bin/env python3

def main():
    S = input()
    T = input()

    N = len(S)
    f = False
    for i in range(N):
        if S[N - i:] + S[:N - i] == T:
            f = True
            break

    print('Yes' if f else 'No')


if __name__ == '__main__':
    main()



Measured memory_bytes: 2940
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int num;
	scanf("%d",&num);
	int s=0,r=0;
	for(int i=1;;i++)
	{
		s+=i;
		if(s>=num)
		{
			r=i;
			break;
		}
	}
	for(int i=r;i>=1;i--)
	{
		if(num<=i)
		{
			printf("%d\n",num);
			return 0;
		}
		printf("%d\n",i);
		num-=i;
	}
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn =new Scanner(System.in);
		int aaa[] =new int[5];
		for(int i=0;i<5;i++){
			aaa[i]=scn.nextInt();
		}
		int k=scn.nextInt();
		if(aaa[1]-aaa[0]<=k&&aaa[2]-aaa[0]<=k&&aaa[3]-aaa[0]<=k&&aaa[4]-aaa[0]<=k&&aaa[2]-aaa[1]<=k&&aaa[3]-aaa[1]<=k&&aaa[4]-aaa[1]<=k&&aaa[3]-aaa[2]<=k&&aaa[4]-aaa[2]<=k&&aaa[4]-aaa[3]<=k){
			System.out.println("Yay!");
		}else{
			System.out.println(":(");
		}
	}

}


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


int isPrime(int a) {

    int s = round(sqrt(a));
    for (int i = 2; i <= s; i++) {
        if (a % i == 0) {
            return 0;
        }
    }

    return 1;
}

int main(int argc, char const *argv[]) {
    int N, count = 0;
    cin >> N;

    int a[N];
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        count += isPrime(a[i]);
    }

    cout << count << endl;
    return 0;
}



Measured memory_bytes: 3200
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


ll n, W, w[102], v[102], dp[N];

void solve()
{
    cin >> n >> W;
    for (int i=1; i<=n; i++) cin >> w[i] >> v[i];

    for (int i=1; i<=n; i++) {
        for (int j=W; j>=w[i]; j--) {
            dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
        }
    }
    nout(dp[W]);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4336
SA = input()
SB = input()
SC = input()
turn = SA[0]
while True:
    if turn == "a":
        turn = SA[0]
        SA = SA[1:]
    elif turn == "b":
        turn = SB[0]
        SB = SB[1:]
    elif turn == "c":
        turn = SC[0]
        SC = SC[1:]
    if turn == "a" and not SA:
        print("A")
        exit()
    elif turn == "b" and not SB:
        print("B")
        exit()
    elif turn == "c" and not SC:
        print("C")
        exit()

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
#define mod 1000000007
//#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;

ll mpow(ll a,ll b){
    if(b == 0) return 1;
    if(b == 1) return a%mod;
    if(b%2 == 0) return mpow((a*a)%mod,b/2)%mod;
    else return (a%mod)*mpow((a*a)%mod,(b-1)/2)%mod;
}

//necessary mpow
#define N 2000000
ll fact[N+1],ifact[N+1];
void init_comb(){
    fact[0] = 1;
    ifact[0] = 1;
    rep1(i,N+1){
        fact[i] = (fact[i-1]*i)%mod;
    }
    ifact[N] = mpow(fact[N],mod-2);
    for(ll i=N;i>0;--i) ifact[i-1] = (ifact[i]*i)%mod;
}
ll mcomb(ll a,ll b){
    if(a<b) return 0;
    if(a==b) return 1;
    return (((fact[a]*ifact[b])%mod)*ifact[a-b])%mod;
}


int main(){
    ll n;
    cin>>n;
    init_comb();
    ll ans = 0;
    rep1(i,n+1){
        ans = (ans+(mcomb(n,i)*(mpow(9,n-i)-mpow(8,n-i)+mod)%mod)%mod)%mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 34816
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<cmath>
#include<map> 
#include<string>
#include<queue>
#include<stack> 
#include<bitset>
#include<list>
#include<set>
#include<utility>
#include<iomanip>
#define IO ios::sync_with_stdio(false)
#define eps 1e-7
#define int long long
using namespace std;
const int mod=1e9+7;
int n,a[200005],sum[200005],ans;
signed main()
{
	IO;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
	}
	for(int i=1;i<=n;i++)
	{
		ans=(ans%mod+(sum[i-1]%mod*a[i]%mod)%mod)%mod;
	}
	cout<<ans;
}

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


auto solve(long long A, long long B){
    auto sum = A + B;
    stringstream ss;
    if(10 <= sum){
        ss << "error";
    }
    else{
        ss << sum;
    }

    return ss.str();
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    auto result = solve(A, B);
    cout << result << endl;
    return 0;
}


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

int main()
{
    int H, W;
    cin >> H >> W;

    int N;
    cin >> N;

    vector<vector<int>> matrix(H, vector<int>(W));
    int a;
    int idx = 0;
    for (int i = 1; i <= N; i++)
    {
        cin >> a;
        while (a)
        {
            matrix[idx / W][idx % W] = i;
            a--;
            idx++;
        }
    }

    for (int i = 0; i < H; i++)
    {
        if (i % 2 == 0)
        {
            reverse(matrix[i].begin(), matrix[i].end());
        }
        for (int j = 0; j < W; j++)
        {
            cout << matrix[i][j] << " ";
        }
        cout << endl;
    }
}


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

int main(){
    int r, g, b, n;
    cin >> r >> g >> b >> n;

    int count = 0;

    for(int z = 0; z <= 3000; z++){
        for(int y = 0; y <= 3000; y++){
            int x = n - r*y - g*z;
            if(x >= 0 and x <= 3000 and x % b == 0){
                count++;
            }
        }
    }

    printf("%d\n", count);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>

using namespace std;

#define MAX 2000
#define int long long

int N;
vector<pair<pair<int,int>, pair<int,int>>> x;
int imos[MAX*3][MAX*3], dx[MAX*3],dy[MAX*3];
int xmax, ymax;

long long solve(){
	long long ans = 0;
	sort(x.begin(), x.end());
	
	for(int i = 0, count = 0, b = -1; i < N*4; i++){
		if(x[i].first.first != b){
			dy[count++] = x[i].first.first;
			b = x[i].first.first;
			// cout<<i<<" D "<<dy[count-1]<<endl;
		}
		// cout<<i<<" "<<x[i].first.first<<endl;
		ymax = x[i].first.first = count-1;
		// cout<<i<<" "<<x[i].first.first<<endl;
		swap(x[i].first,x[i].second);
		
	}
	 sort(x.begin(), x.end());
	 
	for(int i = 0, count = 0, b = -1; i < N*4; i++){
		if(x[i].first.first != b){
			dx[count++] = x[i].first.first;
			b = x[i].first.first;
			// cout<<i<<" E "<<dx[count-1]<<endl;
		}
		// cout<<i<<" "<<x[i].first.first<<endl;
		xmax = x[i].first.first = count-1;
		// cout<<i<<" "<<x[i].first.first<<endl;
		imos[x[i].second.first][count-1] += x[i].second.second;
		// cout<<i<<" "<<x[i].second.first<<" "<<x[i].second.second<<endl;
	}
	for(int i = 0; i <= ymax; i++){
		for(int j = 0; j <= xmax; j++){
			imos[i][j+1] += imos[i][j];
		}
	}
	for(int i = 0; i <= xmax; i++){
		for(int j = 0; j <= ymax; j++){
			imos[j+1][i] += imos[j][i];
		}
	}
	for(int i = 0; i < ymax; i++){
		// if(!i){ cout<<"    ";for(int j = 0; j <= xmax; j++)printf("%4d",dx[j]%100);cout<<endl;}
		for(int j = 0; j < xmax; j++){
			// if(!j)printf("%4d",dy[i]%100);
			// printf("%4d",imos[i][j]);
			if(imos[i][j]) ans += (dx[j+1]-dx[j])*(dy[i+1]-dy[i]);
		}
		// if(i==ymax-1){
			// printf("%4d",imos[i][xmax]);
			// cout<<endl;
			// i++;
			// for(int j = 0; j < xmax; j++){
				// if(!j)printf("%4d",dy[i]%100);
				// printf("%4d",imos[i][j]);
			// }
		// }
		// printf("%4d",imos[i][xmax]);
		// cout<<endl;
	}
	return ans;
}

signed main(){
	int x1, y1, x2, y2;
	
	cin>>N;
	
	for(int i = 0; i < N; i++){
		cin>>x1>>y1>>x2>>y2;
		x1 += (int)(1e9),x2 += (int)(1e9),y1 += (int)(1e9),y2 += (int)(1e9);
		x.push_back(make_pair(make_pair(y1,1),make_pair(x1,0)));
		x.push_back(make_pair(make_pair(y2,-1),make_pair(x1,0)));
		x.push_back(make_pair(make_pair(y1,-1),make_pair(x2,1)));
		x.push_back(make_pair(make_pair(y2,1),make_pair(x2,1)));
	}
	
	cout<<solve()<<endl;
	return 0;
}


Measured memory_bytes: 144340
import sys
from bisect import bisect_left

read=sys.stdin.buffer.readline

N=int(read())
L=list(map(int,read().split()))

L.sort()

ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        ans+=bisect_left(L,L[i]+L[j])-(j+1)

print(ans)

Measured memory_bytes: 3188
from fractions import gcd
def lcm(a,b):
    return a*b/gcd(a,b)
def ge(a,m):
    for aa,mm in zip(a, m): 
        i, b = 1, aa%mm
        while b!=1:
            b = (aa*b)%mm
            i += 1
        yield i
while True:
    tmp = map(int, raw_input().split(" "))
    if all(t==0 for t in tmp):
        break
    print reduce(lcm,ge(tmp[::2],tmp[1::2]))

Measured memory_bytes: 5900
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int s=a-c,t=b-d;
    cout<<c+t<<" "<<d-s<<" "<<a+t<<" "<<b-s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define E endl
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 1e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
 // 	freopen("input.txt","r",stdin);
 // 	freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n;
		map <pair < int,int > , int > mp;	
		auto get = [&](int x){
			int f , l = x%10;
			while(x){
				f = x%10;
				x/=10;
			}
			return make_pair(f,l);
		};
		for(int i =1;i<=n;i++){
			pair <int,int> p= get(i);
			// trace(i,p.fi,p.se);
			mp[{p.fi,p.se}]++;
		}	
		int ans =0 ;
		for(int i =1;i<=n;i++){
			pair < int,int> p = get(i);
			ans+=mp[{p.se,p.fi}];
		}
		cout << ans <<E;
	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

int main(){
	ll n;
	cin>>n;
	vector<string> s(n);
	rep(i,n)cin>>s[i];
	//全てに重複し存在する文字を発見する.
	vector<map<char,ll>> cnt(n);
	rep(i,n){
		rep(j,s[i].size()){
			cnt[i][s[i][j]]++;
		}
	}
	//始めの配列を用いて検索する.
	map<char,ll> ans;
	foreach(itr,cnt[0]){
		ll temp=itr->se;
		rep(i,n){
			temp=min(cnt[i][itr->fi],temp);
		}
		ans[itr->fi]=temp;
	}

	if(ans.size()){
		foreach(itr,ans){
			rep(i,itr->se){
				cout<<itr->fi;
			}
		}
		cout<<endl;
	}else{
		string a="";
		cout<<a<<endl;
	}






    return 0;
}

Measured memory_bytes: 384
import sys
N, = map(int, input().split())
X = list(map(int, input().split()))
S = X[0]+X[1]
T = 0
for i in range(2, N):
    T ^= X[i]
D = (S-T)//2
if S<T or (S-T)%2 or T&D:
    print(-1)
    sys.exit()
for i in range(T.bit_length()+1, -1, -1):
    if T&(1<<i)|D <= X[0]:
        D |= T&(1<<i)
if 0<D<=X[0]:
    print(X[0]-D)
else:
    print(-1)


Measured memory_bytes: 61888
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <string>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <iomanip>
#include <cassert>
#include <string.h>
#include <cstdio>
#include <complex>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

typedef double LD;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<ll , ll> PLL;
typedef vector<int> VI;
typedef vector<PII> VPII;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
#define MP make_pair
#define pb push_back
#define X first
#define Y second
#define next fake_next

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i, 0, t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))

const LD PI = acos(-1.0);
const LD EPS = 1e-9;
const ll INF = 1e9;
const ll LINF = 1e18;
const ll mod = 1e9 + 7;
const ll MAX = 1 << 17;
vector<pair<ll , ll> > v;
ll pw10[16];
ll s(ll x)
{
	int ans = 0;
	while(x)
	{
		ans += x % 10;
		x /= 10;
	}
	return ans;
}
bool cmp(pair<ll , ll> p1 , pair<ll , ll> p2)
{
	if(p1.first * p2.second != p2.first * p1.second)
	{
		return (ll)p1.first * p2.second < p2.first * p1.second;
	}
	else
		return p1.first < p2.first;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//memset(dpT , -1 , sizeof dpT);
        int k;
	cin >> k;
	int x = 0;
	pw10[0] = 1;

	for(int i = 1; i <= 15; i++)
		pw10[i] = 10 * pw10[i - 1];
	ll khvist = 0;
	for(int cnt9 = 0; cnt9 <= 13; cnt9++)
	{

		for(int j = 0; j < 1000; j++)
		{
			ll x = j * pw10[cnt9] + khvist;
			v.pb({x , s(x)});
		}
		khvist *= 10;
		khvist += 9;
	}
	sort(v.begin() , v.end() ,cmp);
	ll mx = 0;
	int cnt = 0;
	for(int i = 0; cnt < k; i++)
	{
		if(v[i].first > mx)
		{
			//assert(v[i].first <= pw10[15]);
			cout << v[i].first << endl;
			cnt++;
			mx = v[i].first;
		}
	}
	return 0;
}



Measured memory_bytes: 640
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
const double pi=acos(-1);
const int N=2e5+5;
int sx,sy,tx,ty,n,i,t,q[N];
struct arr{int x,y;}a[N];
bool operator < (arr A,arr B){return A.x<B.x;}
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
int find(int k){
	int l=1,r=t+1,m;
	while (l<r){m=l+r>>1;
		if (k<q[m]) r=m; else l=m+1; 
	}
	return l;
}
void add(int k){int x=find(k);q[x]=k;if (x>t) t++;}
int main(){
	sx=read();sy=read();tx=read();ty=read();
	if (sx>tx) swap(sx,tx),swap(sy,ty);
	for (int num=read();num--;){
		int x=read(),y=read();
		if (x>=sx&&x<=tx) a[++n]=(arr){x,y};
	}
	sort(a+1,a+n+1);
	if (sy<ty){
		for (i=1;i<=n;i++)
			if (a[i].y>=sy) add(a[i].y); 
	}
	else{
		for (swap(sy,ty),i=n;i;i--)
			if (a[i].y>=sy) add(a[i].y);
	}
	int k=find(ty)-1,v=k>=min(tx-sx,ty-sy)+1;
	printf("%.15lf",(tx+ty-sx-sy)*100ll+k*(5*pi-20)+v*(5*pi));
}

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b && b != c) cout << c << endl;
  else if(a != b && b == c) cout << a << endl;
  else if(a == c && a != b) cout << b << endl;
  return 0;
}


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

using namespace std;

#define LL long long
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int maxn = 1e5 + 7;

char s[maxn];
deque<char>dq;

int main() {
    LL n,a,b;
    while(cin >> n >> a >> b) {
        cout << a * (n / (a + b)) + min(n % (a + b) , a) << endl;
    }
    return 0;
}


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

int gcd(int a, int b){
    if(b==0){
        return a;
    }
    return gcd(b, a%b);
}

int main()
{   int a, b;
    int temp;
    while(true){
        if(!(cin >> a >> b))exit(0);
       
        if(a<b){
            temp = b;
            b = a;
            a = temp;
        }
        temp = gcd(a, b);
        cout << temp << " " << a/temp*b << endl;
    
    }    
    return 0;
}


Measured memory_bytes: 3080
#include<stdio.h>
#include<string.h>
int main()
{
    char ara[10];
    int i,flag=0;
    scanf("%s",ara);
    for(i=0;i<strlen(ara);i++)
    {
        if(ara[i]==ara[i+1])
            flag=1;
    }
    if(flag==1)
        printf("Bad\n");
    else
        printf("Good\n");
    return 0;
}

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

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int a, b;
	cin >> a >> b;
	if (a > 9 || b > 9) return cout << -1, 0;
	cout << a * b;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000001;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


int main(){
  int n; cin>>n;
  cout<<n*800-n/15*200<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

int comparisonCount = 0;

void merge(vector<int>& A, int left, int mid, int right) {
  vector<int> L(A.begin() + left, A.begin() + mid);
  vector<int> R(A.begin() + mid, A.begin() + right);
  int i = 0;
  int j = 0;
  L.push_back(INT_MAX);
  R.push_back(INT_MAX);
  for (int k = left; k < right; ++k) {
    if (L[i] <= R[j]) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
    ++comparisonCount;
  }
}

void mergeSort(vector<int>& A, int left, int right) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

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

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

  mergeSort(S, 0, S.size());

  for (int i = 0; i < n; ++i) {
    if (i != 0) {
      cout << " ";
    }
    cout << S[i];
  }
  cout << endl;
  cout << comparisonCount << endl;
}



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

int main(){
  long long int n;
  long long int d;
  cin >> n >> d;
  long long int ans=0;
  long long int x;
  long long int y;
  for(int i=0; i<n; i++){
    cin >> x >> y;
    if(d*d >= x*x+y*y)ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3616
n, x = gets.chomp.split.map(&:to_i)
l = gets.chomp.split.map(&:to_i)
l.unshift(0)
(1..n).each do |i|
  l[i] += l[i - 1]
end
puts l.bsearch_index {|i| i > x } || n + 1

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;while(t--)
#define pb push_back
#define nl cout<<endl
#define MOD 1000000007
#define loop(i,start,end) for(int i=start;i<end;i++)
#define N 100001
#define all(v) v.begin(),v.end()
#define oa(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";nl
#define ov(a) for(int i=0;i<a.size();i++)cout<<a[i]<<" ";nl
#define vinn(n,v) int n;cin>>n;vector<int>v(n);loop(i,0,n)cin>>v[i];
#define vinm(n,m,v) int n,m;cin>>n>>m;vector<int>v(n);loop(i,0,n)cin>>v[i];
#define debug(x) cerr<<#x<<" : "<<x<<endl;
int expo(int base,int x)
{
    int res = 1;    
    base = base % MOD; 
    while (x > 0)
    {
        if (x & 1)
            res = (res*base) % MOD;
        x= x>>1;
        base = (base*base) % MOD;  
    }
    return res;
}
int fact(int a,int n)
{
    int po= 1,div = 1;
    for(int i=n;i>(n-a);i--)
        po*=i,po%=MOD;
    for(int i =1;i<=a;i++)
        div*=i,div%=MOD;
    div = expo(div,MOD-2);
    return (po*div)%MOD;
}

signed main() 
{
    fastio();


    int n,a,b;
    cin>>n>>a>>b;
    cout<<((expo(2,n)-1-fact(a,n)-fact(b,n))%MOD+MOD)%MOD;



    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String s = br.readLine();
	    String p = br.readLine();

	    String targetStr = s + s;
	    StringBuilder sb = new StringBuilder();
        Pattern ptn = Pattern.compile(p);
        Matcher matcher = ptn.matcher(targetStr);
        if(matcher.find()){
            sb.append("Yes");
        }else{
            sb.append("No");
        }
        System.out.println(sb.toString());
	}
}

Measured memory_bytes: 24520
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,found=0,r;
  cin>>n;
  while(n){
     r=n%10;
     if(r==7){
       cout<<"Yes";
       found=1;
       break;
     }
     n=n/10;
  }
  if(found==0){
    cout<<"No";
  }

}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits>
#include <numeric>
#include <cmath>

using namespace std;

template<class T>
class Input {
public:
    auto operator()() const {
        T v;
        cin >> v;
        return v;
    }
};

template<class L, class R>
class Input<pair<L, R>> {
public:
    auto operator()() const {
        L l;
        R r;
        cin >> l >> r;
        return make_pair(l, r);
    }
};

template<class U>
class Input<vector<U>> {
public:
    auto operator()() const {
        Input<size_t> in{};
        auto n = in();
        return (*this)(n);
    }
    auto operator()(size_t n) const {
        vector<U> v;
        v.reserve(n);
        Input<U> in{};
        for (size_t i = 0; i < n; ++i) {
            auto u = in();
            v.emplace_back(move(u));
        }
        return v;
    }
};

template<class U>
class Input<vector<vector<U>>> {
public:
    auto operator()() const {
        Input<size_t> in{};
        auto n = in();
        auto m = in();
        return (*this)(n, m);
    }
    auto operator()(size_t n, size_t m) const {
        vector<vector<U>> v;
        v.reserve(n);
        Input<vector<U>> in{};
        for (size_t i = 0; i < n; ++i) {
            auto u = in(m);
            v.emplace_back(move(u));
        }
        return v;
    }
};

class InputType
{
public:
    template<class T>
    operator T() const {
        Input<T> i{};
        return i();
    }
};

class InputType2
{
public:
    InputType2(size_t n)
        : n_(n)
    {}
    template<class T>
    operator T() const {
        Input<T> i{};
        return i(n_);
    }
private:
    size_t n_;
};

auto input() {
    return InputType();
}

template<class... Args>
auto input(Args&&... args) {
    return InputType2(std::forward<Args>(args)...);
}

size_t bitcount(size_t n) {
    size_t c = 0;
    while (n) {
        if (n & 1ull)
            ++c;
        n >>= 1;
    }
    return c;
}

auto make_order(size_t n) {
    vector<size_t> a(n, 0);
    iota(begin(a), end(a), 0);
    return a;
}

template<class T>
auto next_permutation(T&& x) {
    using std::begin;
    using std::end;
    return next_permutation(begin(x), end(x));
}

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

auto gcd(size_t l, size_t r) {
    if (r == 0)
        return l;
    return gcd(r, l % r);
}

auto gcd(size_t a, size_t b, size_t c) {
    return gcd(a, gcd(b, c));
}

int main() {
    size_t n = input();
    vector<size_t> a{};
    a.reserve(n);
    a.emplace_back(0);
    for (size_t i = 1; i < n; ++i) {
        size_t b = input();
        a.emplace_back(b - 1);
    }
    vector<size_t> b(n, 0);
    for (size_t i = 0; i < n; ++i) {
        auto j = a[i];
        if (j != i)
            ++b[j];
    }
    for (auto e : b)
        cout << e << endl;
    return 0;
}


Measured memory_bytes: 6376
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//ABC115B
int main(void) {
  int max=0, n, k, i, cou=0, tmp;
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf(" %d", &tmp);
    max=tmp>max ? tmp : max;
    cou+=tmp;
  }
  printf("%d", cou-max/2);
}

Measured memory_bytes: 128