akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int gcd(int a, int b){ //最大公約数
  if(a % b == 0) return b;
  return gcd(b, a % b);
}
int main(){
  int n;
  cin >> n;
  int len = 1000000 + 1;
  vi a(n), d(len);
  rep(i, n) cin >> a[i];
  for(int i = 2; i < len; i++){
    if(!d[i]){
      for(int j = i; j < len; j += i) d[j] = i;
    }
  }
  set<int> check;
  bool ok = true;
  rep(i, n){
    int num = a[i];
    set<int> cnt;
    while(num != 1){
      int temp = d[num];
      num /= temp;
      if(check.count(temp) && !cnt.count(temp)){
        ok = false;
        break;
      }else{
        check.insert(temp);
        cnt.insert(temp);
      }
    }
    if(!ok) break;
  }
  if(ok){
    cout << "pairwise coprime" << endl;
    return 0;
  }
  int g = a[0];
  rep(i, n - 1) g = gcd(g, a[i + 1]);
  if(g == 1) cout << "setwise coprime" << endl;
  else cout << "not coprime" << endl;
}

Measured memory_bytes: 11180
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main(void){
    double a,b,c,d,x,y,z;
    cin>>a>>b>>c>>d;
    x=c-a;
    y=d-b;
    z=x*x+y*y;
    printf ("%8f\n",pow(z, 0.5));
}



Measured memory_bytes: 3400
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)(2.19e15+1);
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
	string s;cin>>s;
	int i,j,n;cin>>n;
	while(n--){
		string me;cin>>me;
		int a,b;cin>>a>>b;
		if(me=="print"){
			for(i=a;i<=b;i++){cout<<s[i];}
			cout<<endl;
		}else{
			string r;
			if(me=="replace"){cin>>r;}
			else{
				r.res(b+1-a);
				for(i=b;i>=a;i--){r[b-i]=s[i];}
			}
			for(i=a;i<=b;i++){s[i]=r[i-a];}
		}
	}
	RE;
}


Measured memory_bytes: 3212
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define MAXN 200001
using namespace std;
LL n,m;
LL mod=998244353ll;
char s[MAXN];
LL t[MAXN];
LL Div[MAXN];
bool vis[MAXN];
int cnt;
int main()
{
    cin>>n;
    
    scanf("%s",s);
    LL ans=0;
    for(int i=0;i<n;i++)
    {
        ans<<=1;
        if(s[i]=='1')
        {
            ans++;
        }
        ans%=mod;
    }
    ans++;
    ans=ans*2*n%mod;
    for(LL i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            vis[i]=1;
            vis[n/i]=1;
        }
    }
    for(LL i=1;i<=n;i++)
    {
        if(vis[i])
        {
            Div[++cnt]=i;
            LL j=n/i;
            if(j&1)
            {
                bool vis=0,flag=0;
                LL tmp=0;
                for(int k=0;k<n;k++)
                {
                    if(k<i)
                    {
                        tmp*=2;
                        tmp+=(s[k]=='1');
                        tmp%=mod;
                    }
                    int u=k%i;
                    //cout<< ((s[u]-'0')^((k/i)&1)) <<"";
                    if(!flag&&(s[k]-'0')!=((s[u]-'0')^((k/i)&1)))
                    {
                        vis=(s[k]-'0')<((s[u]-'0')^((k/i)&1));
                        flag=1;
                    }
                }//cout<<endl<<i<<" "<<vis<<endl;
                tmp++;
                tmp-=vis;
                for(int k=1;k<=cnt;k++)if(i%Div[k]==0&&Div[k]<i)tmp-=t[Div[k]];
                t[i]=tmp;
                ans-=2*tmp*(n-i)%mod;
            }
        }
    }
    cout<<(ans%mod+mod)%mod<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)

int main(){
   ll N;
   cin>>N;
   vector<pair<ll,ll>> gg[17];

  
  ll tmp,tmp1,tmp2;
   for(ll i=0;i<N;i++){
     cin>>tmp;
     for(ll j=0;j<tmp;j++){
       cin>>tmp1>>tmp2;
       tmp1--;tmp2;
       gg[i].emplace_back(mkpr(tmp1,tmp2));
     }
   }

   

   ll xtmp=0;
   /*
   for(ll i=0;i<N;i++){
     xtmp<<1;
     xtmp+=1;
   }
   */
  xtmp=pow(2,N);

   //cout<<xtmp<<endl;
   ll mask = 1;
  
ll ans=0;
   for(ll i=0;i<xtmp;i++){
     vector<ll> sg(N,0);
     vector<ll> sgg(N,-1);
     ll tt=i;
     ll bbb=1;
     for(ll j=0;j<N;j++){
       if((mask&tt)!=0){
         sg[j]=1;
         sgg[j]=1;
       }
       tt=tt>>1;
     }
     //cout<<endl;
//cout<<sg[0]<<" "<<sg[1]<<" "<<sg[2]<<" "<<endl;
    

     for(ll j=0;j<N;j++){
       if(sgg[j]==1){
         for(ll k=0;k<gg[j].size();k++){
           if(sgg[gg[j][k].first]==-1||sgg[gg[j][k].first]==gg[j][k].second){
             sgg[gg[j][k].first]=gg[j][k].second;
           }
           else{
             bbb=-1;
           }
         }
       }
     }

      for(ll j=0;j<N;j++){
       if(sgg[j]==1){
         for(ll k=0;k<gg[j].size();k++){
           if(sgg[gg[j][k].first]==-1||sgg[gg[j][k].first]==gg[j][k].second){
             sgg[gg[j][k].first]=gg[j][k].second;
           }
           else{
             bbb=-1;
           }
         }
       }
     }

      for(ll j=0;j<N;j++){
       if(sgg[j]==1){
         for(ll k=0;k<gg[j].size();k++){
           if(sgg[gg[j][k].first]==-1||sgg[gg[j][k].first]==gg[j][k].second){
             sgg[gg[j][k].first]=gg[j][k].second;
           }
           else{
             bbb=-1;
           }
         }
       }
     }

      for(ll j=0;j<N;j++){
       if(sgg[j]==1){
         for(ll k=0;k<gg[j].size();k++){
           if(sgg[gg[j][k].first]==-1||sgg[gg[j][k].first]==gg[j][k].second){
             sgg[gg[j][k].first]=gg[j][k].second;
           }
           else{
             bbb=-1;
           }
         }
       }
     }

      for(ll j=0;j<N;j++){
       if(sgg[j]==1){
         for(ll k=0;k<gg[j].size();k++){
           if(sgg[gg[j][k].first]==-1||sgg[gg[j][k].first]==gg[j][k].second){
             sgg[gg[j][k].first]=gg[j][k].second;
           }
           else{
             bbb=-1;
           }
         }
       }
     }

     if(bbb==-1){
       continue;
     }
    
    ll ttans=0;
    for(ll j=0;j<N;j++){
      if(sgg[j]==1){
        ttans++;
      }
    }
    ans= max(ans,ttans);
    //cout<<i<<endl;
    //cout<<sgg[0]<<" "<<sgg[1]<<" "<<sgg[2]<<" "<<endl;
    //printf("%d\n",i);

   }

   
   
cout<<ans<<endl;
   

}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int N; cin >> N;
  string S; cin >> S;
  if (N % 2 == 1) {
    cout << "No" << endl;
    return 0;
  } else {
    for (int i = 0; i < N/2; ++i) {
      if (S[i] != S[i + N/2]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		String[] model="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
		String[] S=sc.next().split("");

		for(String s:S) {
			for(int i=0;i<model.length;i++) {
				if(s.equals(model[i])) {
					int index=N+i;
					System.out.print(model[index%26]);
				}
			}
		}
	}
}

Measured memory_bytes: 28612
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include <random>
#define ll long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const int INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const int MOD = 1000000007;
const int MAX = 510000;
const double pi = acos(-1);
const double eps = 1e-9;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll a[100];
    ll n;
    cin>>n;
    rep(i,30){
        a[i]=LLINF;
    }
    string s[100];
    rep(i,n) cin>>s[i];
    
    rep(i,n){
        map<ll,ll> mp;
        rep(j,s[i].size()){
            mp[s[i][j]-'a']++;
        }
        rep(k,26){
            a[k]=min(a[k],mp[k]);
        }
    }

    rep(i,26){
        if(a[i]==LLINF) continue;
        rep(j,a[i]){
            cout<<(char)('a'+i);
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  string S;
  cin >> S;
  set<string> s;
  int n = S.length();
  if (n == 1) {
    cout << "1\n";
    return 0;
  }
  if (n == 2) {
    if (S[0] == S[1]) {
      cout << "1\n";
    } else {
      cout << "2\n";
    }
    return 0;
  }

  int dp[n + 1][2]{};
  dp[0][0] = 1;
  dp[0][1] = 0;
  if (S[0] == S[1]) {
    dp[1][0] = 1;
    dp[1][1] = 1;
  } else {
    dp[1][0] = 2;
    dp[1][1] = 1;
  }

  for (int i = 2; i < n; i++) {
    if(S[i] != S[i - 1]) {
      dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]) + 1; 
      dp[i][1] = max(dp[i - 2][0] + 1, dp[i - 1][1]);
    } else {
      dp[i][0] = max(dp[i - 2][0], dp[i - 1][1] + 1);
      dp[i][1] = max(dp[i - 2][0] + 1, dp[i - 1][1]);
    }
  }
  cout << max(dp[n -1][0], dp[n - 1][1]) << "\n";
  return 0;
}

Measured memory_bytes: 2180
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    int a[n];
    for(int i = 0;i < n;i++) cin >> a[i];
    int count = 0;
    bool end = true;
    while(end){
        for(int j = 0;j < n; j++){
            if(a[j]%2 == 0){
                a[j] = a[j]/2;
                //cout << a[j] << " ";
            }else{
                end = false;
                break;
            }
        }
        //cout << endl;
        if(!end) break;
        count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
// https://beta.atcoder.jp/contests/abc070

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

void print_yes_no(bool cond, string yes = "Yes", string no = "No") { cout << (cond ? yes : no) << endl; }

int main() {
    string s;
    cin >> s;
    print_yes_no(s[0] == s[2]);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> grid;
    string s;
    int cnt = 0;
    for(int i = 0; i < h; i++) {
        cin >> s;
        grid.push_back(s);
        for(int j = 0; j < w; j++) {
            if (s[j] == '#')
                cnt += 1;
        }
    }
    if (cnt != h+w-1) {
        cout << "Impossible" << endl;
    } else {
        auto dfs = [&] (auto& self, int r, int c) -> void {
            if (r < 0 || r >= h || c < 0 || c >= w || grid[r][c] == '.')
                return;
            grid[r][c] = '.';
            self(self, r, c-1);
            self(self, r, c+1);
            self(self, r-1, c);
            self(self, r+1, c);
            
        };
        dfs(dfs, 0, 0);
        if (grid[h-1][w-1] == '.')
            cout << "Possible" << endl;
        else
            cout << "Impossible" << endl;
    }
    return 0;
}


Measured memory_bytes: 3612
import java.io.PrintWriter
import java.util.*
import java.math.*

val pw = PrintWriter(System.out)
val DIVIDE = (1e+9+7).toLong()

fun factorial(n: Long): Long =
    if(n == 1L) 1L else n * factorial(n-1) % DIVIDE

fun main(args: Array<String>) {
    val (n, m) = readListOfLong()
    
    var ans = 
        when(Math.abs(n-m).toLong()) {
            0L -> factorial(n) * factorial(m) * 2 % DIVIDE
            1L -> factorial(n) * factorial(m) % DIVIDE
            else -> 0L
        }

    println(ans)
    
    pw.flush()
}

fun inputList() = 
    readLine()!!.split(" ").map(String::toInt)

fun sum_digits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

/****** Decrared Functions ******/

// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }


fun println(value : Any) {
    pw.println(value)
}

fun gcd(a: Long, b: Long): Long = 
    if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
    if(b==0L) a else gcd(b, a % b)


Measured memory_bytes: 43128
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

n,a,b = mint()
if (n==1 and a!=b) or a>b:
    print(0)
else:
    print(b*(n-1)+a-(a*(n-1)+b)+1)

Measured memory_bytes: 65596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define ALL(x) (x).begin(),(x).end()
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main(){
	int n;
	cin >> n;
	long long a[100010][3];
	long long dp[100010][3];
	//i日目にjを選んだ時の最大値
	rep(i, n){
		rep(j, 3){
			cin >> a[i][j];
			dp[i][j] = 0;
		}
	}
	
	//dp[i + 1][a]...dp[i][b]とdp[i][c]のどちらから遷移する方が最大になるか
	
	for(int i = 0; i < n; i++){
		dp[i + 1][0] = max(dp[i][1], dp[i][2]) + a[i][0];
		dp[i + 1][1] = max(dp[i][2], dp[i][0]) + a[i][1];
		dp[i + 1][2] = max(dp[i][0], dp[i][1]) + a[i][2];
	}
	
	
	cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define pb push_back 
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n, a;
	cin >> n >> a;
	cout << (n + a - 1) / a << '\n';

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,count=0;
    while (cin>>a>>b) {
        if (a==0&&b==0) {
            break;
        } else {
            int flag=0;
            count++;
            if (count!=1) {
                cout<<endl;
            }
            for (int i=a;i<=b;i++) {
                if ( (i%4==0)&&(i%100!=0) ) {
                    cout<<i<<endl;
                    flag=1;
                } else if ( (i%100==0)&&(i%400==0) ) {
                    cout<<i<<endl;
                    flag=1;
                }
            }
            if (flag==0) {
                cout<<"NA"<<endl;
            }
        }
    }
}



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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int N, W; cin >> N >> W;
    P item[N];
    rep(i,N) cin >> item[i].first >> item[i].second;
    int dp[N+1][W+1];
    // 初期化する
    rep(i,W+1) dp[0][i] = 0;    // 選択する品物がないときは重さに関わらず、価値の総和は0
    rep(i,N+1) dp[i][0] = 0;    // 重さが0のときは品物を選ぶことはできない
    // 動的計画法を適用する
    rep(i,N){
        for(int w=1; w<=W; w++){
            int vi, wi;
            vi = item[i].first; wi = item[i].second;
            if(wi > w){
                dp[i+1][w] = dp[i][w];
            }else{
                dp[i+1][w] = max(dp[i][w], max(dp[i][w-wi]+vi, dp[i+1][w-wi]+vi));
            }
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
#define ll long long
    const int N = 3005 ;
    int dp [N][N];
int main () {

            string s , t ; cin >> s>> t;
            memset(dp,0,sizeof dp);
                for ( int i =0 ; i < s.length();i++){
                    for (int j =0 ; j< t.length();j++){
                        if (s[i]==t[j]){
                            dp[i+1][j+1]=dp[i][j]+1;
                        }
                        else {
                            dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
                        }
                    }
                }
                int s1 = s.size() , s2 = t.size();
                string ans ;
                while (s1>0 && s2>0){
                        if (s[s1-1]==t[s2-1]){
                            ans = s[s1-1]+ans;
                            s1-- , s2--;
                        }
                        else if (dp[s1][s2-1]>dp[s1-1][s2]){
                            s2--;
                        }
                        else {
                            s1--;
                        }
                }
                cout << ans << endl;

 return 0;
}




Measured memory_bytes: 35584
#include <iostream>

int main()
{
	int i;
	const char key[5] = "YAKI";
	char str[11];

	std::cin >> str;

	for (i = 0; i < 4 && key[i] == str[i]; ++i);

	std::cout << (i == 4 ? "Yes" : "No") << std::endl;

	return 0;
}

Measured memory_bytes: 384
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for _ in range(M):
    bc = list(map(int, input().split()))
    BC.append(bc)
BC = sorted(BC, key=lambda x:x[1], reverse=True)
cnt = 0
for b, c in BC:
    A += [c] * b
    cnt += b
    if cnt >= N:
        break
A.sort(reverse=True)
print(sum(A[:N]))

Measured memory_bytes: 90104
//00
#include<iostream>
#include<vector>

using namespace std;

int main(){
  bool cmp[1000001]={};
  vector<int> prm;
  for(int i=2;i<=1000000;i++){
    if(!cmp[i]){
      prm.push_back(i);
      for(int j=2;j*i<=1000000;j++){
	cmp[i*j]=true;
      }
    }
  }
  for(long long l;cin>>l,l;){
    int a=1;
    for(int i=0;l!=1&&i<prm.size();i++){
      int c=0;
      while(l%prm[i]==0){
	c++;
	l/=prm[i];
      }
      a*=c*2+1;
    }
    if(l!=1){
      a*=3;
    }
    cout<<(a+1)/2<<endl;
  }
  return 0;
}

Measured memory_bytes: 2572
def resolve():
    n, m = map(int,input().split())
    li =  [list(map(int,input().split())) for i in range(m)]
    dc = {}
    for l in li:
        if l[0] in dc and l[1] != dc[l[0]]:
            return -1
        dc[l[0]] = l[1]
    
    for i in range(1, n+1):
        if i == 1:
            if 1 in dc:
                if dc[1] == 0:
                    if n == 1:
                        return 0
                    return -1
                else:
                    ans = str(dc[1])
            else:
                if n == 1:
                    return 0
                else:
                    ans = '1'
            continue
        if i in dc:
            ans += str(dc[i])
        else:
            ans += '0'
    return int(ans)

print(resolve())     

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

int term(string&, int&);
int dfs(string&s, int&i) {
	int ret = term(s, i);
	while (s[i] == '+' || s[i] == '*') {
		if (s[i] == '+') {
			i++; int b = dfs(s, i);
			ret = max(ret, b);
		}
		else {
			i++; int b = dfs(s, i);
			ret = min(ret, b);
		}
	}
	return ret;
}
int term(string&s, int&i) {
	if (isdigit(s[i]))return s[i++] - '0';
	if (s[i] == '-') {
		i++; int a = term(s, i);
		if (a == 0)return 2;
		if (a == 2)return 0;
		return 1;
	}
	if (s[i] == '(') {
		i++; int a = dfs(s, i); i++;
		return a;
	}
}
int main() {
	string s;
	while (cin >> s, s != ".") {
		int cnt = 0;
		rep(i, 3)rep(j, 3)rep(k, 3) {
			string t = s;
			for (char&c : t) {
				if (c == 'P')c = '0' + i;
				if (c == 'Q')c = '0' + j;
				if (c == 'R')c = '0' + k;
			}
			int I = 0;
			if (dfs(t, I) == 2)cnt++;
		}
		cout << cnt << endl;
	}
}

Measured memory_bytes: 3076
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, s, ans = 0;
 
        for(;;){
            n = sc.nextInt();
            s = sc.nextInt();
            if(n == 0 && s == 0) break;
            for(int i = 1; i < n; i++){
                for(int x = i+1; x < n; x++){
                    for(int y = x+1; y <= n; y++){
                        if(i+x+y==s) ans+=1;
                    }
                }
            }
            System.out.println(ans);
            ans = 0;
        }
    }
}

Measured memory_bytes: 26472
/*
   学籍番号　：11970252
   名前　　　：丹羽　建太
   課題　　　：enshu1-1
   作成日　　：2020/05/24
*/
#include <stdio.h>
int main(void)
{
int R;
double shu;
scanf("%d",&R);
shu=2*R*3.141592;
printf("%2f",shu);
return 0;
}

Measured memory_bytes: 1752
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int a, b;
  cin >> a >> b;
  cout << max({a + b, a - b, a * b}) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
	
int main(){
	while(1){
		int N;
		int cnt=0;
		cin >>N;

		if(N==0000)
			break;

		if(N%1111==0){
			cout << "NA" <<endl;
			continue;
		}

		while(N!=6174){
			int n[4]={N/1000,N/100%10,N/10%10,N%10};
			sort(n,n+4);
			int L=n[3]*1000+n[2]*100+n[1]*10+n[0];
			int S=n[0]*1000+n[1]*100+n[2]*10+n[3];
	
			N=L-S;
			cnt++;
		}
	
		cout <<cnt<<endl;

	}
	return 0;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MAX 1000001
#define N 1000000007
ll n;
ll a[100001][3];
ll dp[100001][3];
bool prime[MAX];

ll func(ll i ,ll j){

  if(dp[i][j]!=-1)
  return dp[i][j];

  if(i==n-1)
  dp[i][j]=a[i][j];
  else{
    ll res=0;
    for(ll k=0;k<3;k++){
      if(k!=j){
        res=max(res,func(i+1,k));
      }
    }
    dp[i][j]=res+a[i][j];
  }
  return dp[i][j];
}
int main(){
  ll t=1;
  //cin>>t;
  while(t--){
    ll i,k,j,f,x,ans=0;
    cin>>n;
    for(i=0;i<n;i++){
      for(j=0;j<3;j++)
      cin>>a[i][j];
  }
    memset(dp,-1,sizeof(dp));

    for(j=0;j<3;j++)
      ans=max(ans,func(0,j));
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <limits.h>
 
using namespace std;

const int MAXN = 1e6 + 2;
const int INF = 1e9;
const long double PI = 3.141592653589793;

int lc(vector<int>& a) {
    int n = a.size();
    if (n == 0) {
        return 0;
    }
    vector<int> d(n + 1);
    d[0] = -INF;
    for (int i=1; i<=n; ++i) {
        d[i] = INF;
    }
     
    for (int i=0; i<n; i++) {
        int j = upper_bound(d.begin(), d.end(), a[i]) - d.begin();
        if (d[j-1] < a[i] && a[i] < d[j]) {
            d[j] = a[i];
        }
    }
    for (int i = n; i >= 0; --i) {
        if (d[i] != INF) {
            return i;
        }
    }
    return 0;
}
 
long double find_min(vector<pair<int, int>>& a, int x1, int y1, int x2, int y2) {
    int n = a.size();
    if (y2 < y1) {
        y1 *= -1;
        y2 *= -1;
        for (int i = 0; i < n; ++i) {
            a[i].second *= -1;
        }
    }
    std::vector<pair<int, int>> cur;
    for (int i = 0; i < n; ++i) {
        if (a[i].first <= x2 && a[i].first >= x1 && a[i].second <= y2 && a[i].second >= y1) {
            cur.push_back(a[i]);
        }
    }
    long double ans = 0;
    vector<int> k(cur.size());
    sort(cur.begin(), cur.end());
    for (int i = 0; i < (int)cur.size(); ++i) {
        k[i] = cur[i].second;
    }
    int lcs = lc(k);
    if (lcs == x2 - x1 + 1 || lcs == y2 - y1 + 1) {
        ans += 10 * PI - 20.0;
        ans += (20.0 - 5 * PI);
    }
    return 100.0*((long double)x2 - (long double)x1 + (long double)y2 - (long double)y1) + ans - (long double)lcs * (20.0 - 5 * PI);
}
 
int main(void) {
    int x1, y1, x2, y2;
    int n;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    if (x1 > x2) {
        std::swap(x1, x2);
        std::swap(y1, y2);
    }
    scanf("%d", &n);
    std::vector<pair<int, int>> a(n);
    for (int i = 0; i < n; ++i) {
        scanf("%d%d", &a[i].first, &a[i].second);
    }
    if (x1 == x2) {
        for (int i = 0; i < n; ++i) {
            if (a[i].first == x1 && a[i].second <= max(y2, y1) && a[i].second >= min(y1, y2)) {
                printf("%.15Lf\n", abs((long double)y2 - (long double)y1)*100.0 + 10.0 * PI - 20.0);
                return 0;
            }
        }
    } else if (y1 == y2) {
        for (int i = 0; i < n; ++i) {
            if (a[i].second == y1 && a[i].first <= max(x2, x1) && a[i].first >= min(x1, x2)) {
                printf("%.15Lf\n", abs((long double)x2 - (long double)x1)*100.0 + 10.0 * PI - 20.0);
                return 0;
            }
        }
    }
    printf("%.15Lf\n", find_min(a, x1, y1, x2, y2));
    return 0;
}


Measured memory_bytes: 4976
#include<stdio.h>
#include<string.h>
#define N 100000

typedef struct work{
	char name[12];
	int t;
}Work;

Work a[N+1];
int head;
int tail;
	

void dequeue(int n){

	head=(head+1)%(n+1);
	
	return;
}

void enqueue(Work x,int n){
	
	tail=(tail+1)%(n+1);
	a[tail]=x;
	
	return;
}

int main(){
	int n,q,i;
	int sum_t=0;
	int sum=0;
	char temp[12];
	
	scanf("%d %d",&n,&q);
	
	for(i=0;i<n;i++){
		scanf("%s %d",temp,&a[i].t);
		strcpy(a[i].name,temp);
		sum+=a[i].t;
	}
	
	head=0;	tail=n-1;
	
	while(sum_t<sum){
		
		if(a[head].t == q){
			sum_t+=q;
			a[head].t=0;
			printf("%s %d\n",a[head].name,sum_t);
			dequeue(n);
		}
		
		else if(a[head].t < q){
			sum_t+=a[head].t;
			a[head].t=0;
			printf("%s %d\n",a[head].name,sum_t);
			dequeue(n);
		}
		
		else {
			sum_t+=q;
			a[head].t-=q;
			enqueue(a[head],n);
			dequeue(n);
		}
		
	}
	
	return 0;
	
}


Measured memory_bytes: 2460
import java.math.*

fun main(args: Array<String>) {
    val (n, m) = readInputLine().split(" ").map{it.toLong()}
    
    val shopList = mutableListOf<Pair<Long, Long>>()
    
    for (i in LongRange(1L, n)) {
        val (a, b) = readInputLine().split(" ").map{it.toLong()}
        shopList.add(Pair(a, b))
    }
    
    shopList.sortBy{it.first}

    var ans = 0L
    var bought = 0L
    
    for (shop in shopList) {
        val (a, b) = shop
        
        val buyNum = Math.min(m - bought, b)
        
        ans += a * buyNum
        bought += buyNum
        if (bought == m) {
            break
        }
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 82132
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    const long double PI=3.141592653589793238462643;
    vector<pair<long double, pair<int,int> > > z(n);
    int i,j;
    for(i=0; i<n; i++) {
        int x,y;
        scanf("%d%d", &x, &y);
        long double t=0;
        if(x!=0 || y!=0) {
            t=atan2((long double)y,(long double)x);
        }
        z[i]=make_pair(t, make_pair(x,y));
    }
    sort(z.begin(), z.end());

    vector<long double> sx(n+1,0), sy(n+1,0);
    for(i=0; i<n; i++) {
        sx[i+1]=sx[i]+z[i].second.first;
        sy[i+1]=sy[i]+z[i].second.second;
    }
    
    long double ans=0;
    for(i=0; i<n; i++) {
        for(j=i; j<n; j++) {
            long double sumx=sx[j+1]-sx[i];
            long double sumy=sy[j+1]-sy[i];
            long double ans0=sumx*sumx+sumy*sumy;
            ans=MAX(ans,ans0);

            sumx=sx[n]-sumx;
            sumy=sy[n]-sumy;
            ans0=sumx*sumx+sumy*sumy;
            ans=MAX(ans,ans0);
        }
    }

    printf("%.16lf\n", (double)sqrt(ans));

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  int a,b,ans=1;
  cin >> a >> b;
  if(b==1) {
    cout << 0 << endl;
  }
  else if(a>=b) {
    cout << 1 << endl;
  }
  else {
    b-=a;
    while(b>0) {
      b-=(a-1);
      ans++;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
from copy import copy


def recursive_bober(k, s):
    global n
    global arr
    global perm
    
    if k == n:
        perm.append(list(map(int, s.split())))
        return
    
    recursive_bober(k + 1, s)
    s += str(arr[k]) + ' '
    recursive_bober(k + 1, s)


n, m, x = map(int, input().split())
c = [0] * n
a = [[0] * m] * n
jojo = []

for i in range(n):
    cur = list(map(int, input().split()))
    c[i] = cur[0]
    for j in range(1, m + 1):
        a[i][j - 1] = cur[j]
    
    jojo.append(a[i].copy())

arr = [0] * n
for i in range(n):
    arr[i] = i

perm = []
recursive_bober(0, '')

mn = 10 ** 10
for i in perm:
    bober = [0] * m
    sum = 0
    
    for j in i:
        sum += c[j]
        for k in range(m):
            bober[k] += jojo[j][k]
    
    bad = False
    for j in bober:
        if j < x:
            bad = True
            break
    
    if not bad:
        mn = min(mn, sum)

print(mn if mn != 10 ** 10 else -1)

Measured memory_bytes: 76004
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = ReadLine();
            string b = ReadLine();
            char[] ab = a.ToCharArray();
            char[] bc = b.ToCharArray();
            int count = 0;
            for (int i = 0; i < a.Length; i++)
            {
                if (ab[i] == bc[i])
                {
                    count++;
                }
            }
            WriteLine("{0}", a.Length-count);
            

        }
    }
}


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

int main(){
    int N;
    cin >> N;
    vector<vector<pair<int, int>>> edge(N+1);
    for (int i = 0; i < N-1; i++) {
        int a, b;
        cin >> a >> b;
        edge[a].push_back({b, i});
        edge[b].push_back({a, i});
    }
    int M;
    cin >> M;
    vector<ll> route(M);
    for (int i = 0; i < M; i++) {
        int u, v;
        cin >> u >> v;
        queue<pair<pair<int, int>, ll>> q;
        q.push({{u, -1}, 0});
        while (!q.empty()) {
            int now = q.front().first.first;
            int par = q.front().first.second;
            ll r = q.front().second;
            q.pop();
            if (now == v) {
                route[i] = r;
                break;
            }
            for (auto p : edge[now]) {
                if (p.first == par) continue;
                q.push({{p.first, now}, r+(1LL<<p.second)});
            }
        }
    }
    vector<ll> bit(1LL << M, 0);
    for (int i = 1; i < (1LL<<M); i++) {
        for (int j = 0; j < M; j++) {
            if ((i>>j)&1) {
                bit[i] = bit[i-(1LL<<j)] | route[j];
                break;
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < (1LL<<M); i++) {
        int t = 0, u = 0;
        t = __builtin_popcountll(bit[i]);
        u = __builtin_popcountll(i);
        if (u%2 == 0) ans += (1LL << (N-1-t));
        else ans -= (1LL << (N-1-t));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8448
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define MOD 1000000007
#define MAX 1000005
#define loop(i,a,b) for(long long int i=a;i<b;i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
typedef long long int ll;

using namespace std;
//using namespace boost::multiprecision;

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

ll n;
cin>>n;

ll a[n];
map<ll,ll> m;

loop(i,0,n-1)
{
	cin>>a[i];
	m[a[i]]++;
}

for(int i=1;i<=n;i++)
cout<<m[i]<<"\n";







return 0;
}


Measured memory_bytes: 17684
n = int(input())
ans = 0
if n==1 or n==2:
  print(0)
  exit()
elif n<6:
  print(n-1)
  exit()
for i in range(1, int(n**(1/2))+2):
  k = (n-i)//i
  if n%k == n//k:
    ans += k
print(ans)

Measured memory_bytes: 40256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		
		int s = scan.nextInt();
		
		int h = s / 3600;
		
		s %= 3600;
		
		int m = s / 60;
		
		s %= 60;
		
		System.out.println(h +":"+ m +":"+ s);

	}

}

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

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

int main() {
    int k;
    cin >> k;
    int ans = 0;
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= k; j++) {
            for (int f = 1; f <= k; f++) {
                ans += gcd(i, gcd(j, f));
            }
        }
    }
    cout << ans << endl;
}



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

// macros
#define int long long 
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define PB push_back
#define MP make_pair
#define bitcount __builtin_popcount
#define watch(x) cerr<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef long double ld;

// template functions
template < typename A, typename B >
ostream& operator << ( ostream& os, const pair< A, B > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "{";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}
template < typename A, typename B >
ostream &operator << ( ostream & os, const map< A, B > &v ) {
    os << "[";
    typename map< A, B >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " -> " << it -> second ;
    }
    return os << "]";
}
template <typename T>
inline void printV(vector<T>& a, int n) { for(int i=0; i<n; i++) { cerr<<a[i]<<" "; } cerr<<"\n"; }
template <typename T>
inline void printVV(vector<vector<T>>& a) { for(int i=0; i<sz(a); i++) { cerr<<a[i]<<"\n"; } cerr<<"\n"; }
template <typename T>
inline void clearVV(vector<vector<T>>& a) { for(auto &x : a) { x.clear(); } a.clear(); }
template <typename T>
inline void assignVV(vector<vector<T>> &a, T val) { for(int i=0; i<sz(a); i++) { a[i].assign(sz(a[i]), val); } }
template<typename T>
T gcd(T a, T b) { if(a==0 or b==0) return a+b; return gcd(b, a%b) ; }

// random number generation
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// constants
const long double eps = LDBL_EPSILON;
const int inf = 5e8;
const int modn = 1e9+7;
const int MAX = 1e5;


int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
	int n;
	cin>>n;
	vi a(n);
	for(int i=0; i<n; i++) {
		cin>>a[i];
	}
	sort(all(a));
	int ans  = 0;
	for(int k=0; k<=(int)1e5; k++) {
		int low = lower_bound(all(a), k) - a.begin();
		int high = n-low;
		if(low == high) ans++;
	}
	cout<<ans<<"\n";
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K, S;
  cin >> K >> S;
  int ans = 0;
  int M = min(K, S);
  for (int i = 0; i <= M; i++) {
    int j, t;
    if (S - i <= K) {
      j = S - i;
      t = 0;
    }
    else {
      j = K;
      t = S - i - j;
    }
    if (t <= K) {
      ans += (abs(j - t) + 1);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int A, B;

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

  int ans = A + B;

  if (ans % 2 == 0) {
    cout << ans / 2 << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a[10010],i,n,j;
	scanf("%d ",&n);
	long long int c=0;	
	for(i=1;i<=n;i++)
	scanf("%d ",&a[i]);
	for(i=1;i<=n-1;i++)
{
	for(j=i+1;j<=n;j++)
{
	c=c+a[i]*a[j];
}
}
   printf("%d ",c);
	return 0;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    string s; cin >> s;
    int ans=0;
    rep(i,0,3){
        if(s[i]=='1')ans++;
    }
    cout <<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);

    static void checkArray(int[] a){
        int i ;
        for( i = 0; i < a.length -1; i++){
                System.out.print(a[i] +" ");
        }
        System.out.print(a[i]);
        System.out.println();
    }

    static int[] makeArray(int num){
        int[] arr = new int[num];
        for( int i = 0; i < num; i++){
            arr[i] = sc.nextInt();
        }
        return arr;
    } 

    public static void main(String[] args) {
        int N = sc.nextInt();
        int[] arr = makeArray(N);
       
        int temp;
        int count=0;
        boolean flag = true;
        
        for(int j = 0; flag; j++ ){
            flag = false;
            for(int i = N-1; i >= j+1 ; i--) {
                temp = arr[i];
                if(arr[i] < arr[i-1]) {
                    arr[i] = arr[i-1];
                    arr[i-1] = temp;
                    count++;
                    flag = true;
                }
                
            }
        }
        checkArray(arr);
        System.out.println(count);
    }
    
}

Measured memory_bytes: 26324
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long int X, Y;
    cin >> X >> Y;
    int ans = 1;
    long int tmp = X;
    for (int i = X; i <= Y; i++)
    {
        if (tmp * 2 <= Y) 
        {
            ans++;
            tmp *= 2;
        }
        else break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e2 + 10;

class UnionFind
{
private:
	int p[N];
public:
	int size(int x)
	{
		int px = Find(x);
		return -p[px];
	}
	void init()
	{
		MEM(p, -1);
	}
	int Find(int x)
	{
		int root = x;
		while (p[root] >= 0) root = p[root];
		while (x != root)
		{
			int tmp = p[x];
			p[x] = root;
			x = tmp;
		}
		return root;
	}
	void Union(int x, int y)
	{
		int px = Find(x);
		int py = Find(y);
		if (size(px) > size(py)) swap(px, py);
		int total = size(px) + size(py);
		p[px] = py;
		p[py] = -total;
	}
} uf;

vector<pair<int, pair<int, int> > > vp;
int n, m;
int solve(int x)
{
	uf.init();
	int maxv = -INF;
	int minv = INF;
	int cnt = n;
	for (int i = x; i < m; i++)
	{
		int a = vp[i].second.first;
		int b = vp[i].second.second;
		if (uf.Find(a) != uf.Find(b))
		{
			uf.Union(a, b);
			if (minv == INF) minv = vp[i].first;
			maxv = vp[i].first;
			cnt--;
			if (cnt == 1) break;
		}
	}
	if (cnt == 1) return maxv - minv;
	else return -1;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	while(cin >> n >> m)
	{
		if (n == 0 && m == 0) break;
		vp.clear();
		for (int i = 0; i < m; i++)
		{
			int u, v, w;
			cin >> u >> v >> w;
			vp.push_back(make_pair(w, make_pair(u, v)));
		}
		sort(vp.begin(), vp.end());
		int ans = INF;
		for (int i = 0; i < m; i++)
		{
			int ret = solve(i);
			if (ret == -1) break;
			ans = min(ans, ret);
		}
		if (ans == INF) ans = -1;
		printf("%d\n", ans);
	}
	return 0;
}

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

int main() {
    long long N;
    cin >> N;
    string res = "";
    while (N) {
        --N;
        res += (char)('a' + (N % 26));
        N /= 26;
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
}


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

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  char c[n][10];
  for(i=0;i<n;i++){
    for(j=0;j<10;j++)cin>>c[i][j];
  }
  for(i=0;i<n;i++)sort(c[i],c[i]+10);
  string s[n];
  for(i=0;i<n;i++){
    s[i]="";
    for(j=0;j<10;j++){
      s[i]+=c[i][j];
    }
  }
  sort(s,s+n);
  ll a[n];
  for(i=0;i<n;i++)a[i]=1;
  for(i=1;i<n;i++){
    if(s[i-1]==s[i]){
      a[cnt]++;
    }else cnt++;
  }
  ll sum=0;
  for(i=0;i<=cnt;i++){
    sum+=a[i]*(a[i]-1)/2;
  }
  cout<<sum;
}

Measured memory_bytes: 9088
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int K=input.nextInt();
        int X=input.nextInt();
        if (500*K>=X){
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844