akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    [s] = [input_raw[0]]

    S_list = [["*" for i in range(N)] for i in range(4)]
    if s[0] == "o":
        S_list[0][-1] = "S"; S_list[0][0] = "W"; S_list[0][1] = "W"
        S_list[1][-1] = "W"; S_list[1][0] = "W"; S_list[1][1] = "S"
        S_list[2][-1] = "W"; S_list[2][0] = "S"; S_list[2][1] = "W"
        S_list[3][-1] = "S"; S_list[3][0] = "S"; S_list[3][1] = "S"

    else:
        S_list[0][-1] = "S"; S_list[0][0] = "W"; S_list[0][1] = "S"
        S_list[1][-1] = "W"; S_list[1][0] = "W"; S_list[1][1] = "W"
        S_list[2][-1] = "S"; S_list[2][0] = "S"; S_list[2][1] = "W"
        S_list[3][-1] = "W"; S_list[3][0] = "S"; S_list[3][1] = "S"

    rev = lambda x:"S" if x == "W" else "W"
    is_possible = False
    for S in S_list:
        for i in range(1, N - 1):
            R = i
            if s[R] == "o":
                if S[R] == "W":
                    SR = rev(S[R - 1])
                else:
                    SR= S[R - 1]
            else:
                if S[R] == "W":
                    SR = S[R - 1]
                else:
                    SR = rev(S[R - 1])
            if R + 1 < N - 1:
                S[R + 1] = SR
            else:
                if S[N - 1] == SR:
                    if (s[N - 1] == "o" and S[N - 1] == "S") or (s[N - 1] == "x" and S[N - 1] == "W"):
                        if S[N - 2] == S[0]:
                            is_possible = True
                            break;
                    if (s[N - 1] == "o" and S[N - 1] == "W") or (s[N - 1] == "x" and S[N - 1] == "S"):
                        if S[N - 2] != S[0]:
                            is_possible = True
                            break;

        if is_possible == True:
            print "".join(S)
            exit()

    print -1

if __name__ == '__main__':
    main()


Measured memory_bytes: 9500
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10;
ll n,a,sum,num[N],q,b;
int main(){
	cin>>n;
	for(int i=0;i<n;i++) cin>>a, sum+=a, num[a]++;
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>a>>b;
		sum+=(b-a)*num[a];
		num[b]+=num[a]; num[a]=0;
		cout<<sum<<endl;
	}
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  
  if (S == "Sunny"){
    cout << "Cloudy" << endl;
  }
  else if (S == "Cloudy"){
    cout << "Rainy" << endl;
  }
  else{
    cout << "Sunny" << endl;
  }
}


Measured memory_bytes: 3588
#include <iostream>

using namespace std;

int main()
{
    int x,i = 1;
    
    while(1)
    {
        cin >> x;
        if(x != 0)
        {
            cout << "Case " << i << ": " << x << endl;
            i++;
        }else{
            break;
        }
    }
    return 0;
}


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

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

for(int i=0;i<T.size();i++){

  T.push_back(T[0]);
  T.erase(0,1);
  if(S==T){
    cout << "Yes";
    return 0;
  }
}
cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

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

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

signed main()
{
  int N;
  cin >> N;
  vector<string> S(N);
  for (int i = 0; i < N; i++)
  {
    string s;
    cin >> s;
    s += s.substr(0, s.size() - 1);
    S.at(i) = s;
  }
  
  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    bool ok = true;
    for (int j = 0; j < N; j++)
    {
      for (int k = 0; k < N; k++)
      {
        if (S.at(j).at(k + i) != S.at(k).at(j + i))
        {
          ok = false;
          break;
        }
      }
      if (!ok) break;
    }
    if (ok) ans += N;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;

long long mypow(long long x, int n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res*x%mod;
        x = x*x%mod;
        n >>= 1;
    }
    return res;
}
long long inv(long long n){
    return mypow(n,mod-2);
}
long long binom(long long n, long long r){
    long long top=1, bot=1;
	r=min(r,n-r);
    for(long long i=0; i<r; ++i) top = top*(n-i)%mod;
    for(long long i=r; i>1; --i) bot = bot*i%mod;
    return top*inv(bot)%mod;
}
int main(){
	long long x, y;
	cin >> x >> y;

    long long ans=0;
    long long r=(x+y)/3;
    if((x+y)%3==0 && r<=min(x,y)){
        ans=binom(r,min(x,y)-r);
    }
	cout << ans << endl;
}

Measured memory_bytes: 256
n, x = map(int, input().split())
a = [1]
for i in range(n):
    a.append(a[i] *  2 + 3)
p = [1]
for i in range(n):
    p.append(p[i] * 2 + 1)
    
def f(n,x):
    if n >= 1:
        if x == 1:
            return 0
        elif 1 < x <= 1 + a[n - 1]:
            return f(n-1,x-1)
        elif x == a[n -1] + 2:
            return p[n-1] + 1
        elif a[n-1] + 2 < x <= a[n] - 1:
            return p[n-1] + 1 + f(n-1, x-a[n-1]-2)
        else:
            return p[n]
    if n == 0:
        if x > 0:
            return 1
        else:
            return 0
          
print(f(n,x))

Measured memory_bytes: 3064
function main(input){
  var input = input[0].split(' ');
  var a = input[0];
  var b = input[1];
  var x = input[2];
  a = parseInt(a);
  b = parseInt(b);
  x = parseInt(x);
  console.log(a <= x && (a + b) >= x ? 'YES' : 'NO');
}

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main(input);
});


Measured memory_bytes: 7500
#include<bits/stdc++.h>
//#include<unordered_map>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<sstream>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl
#define wa()  cout<<"No"<<endl
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
#define SZ(x) x.size()
#define epp empty()
#define all(x) x.begin(),x.end()
#define PA pair<int,int>
#define asd signed QP;scanf("%d",&QP);while(QP--)
typedef vector<int> VE;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;}
int lowbit(int x){return x&-x;}
const int dx[4]={0,0,1,-1};
const int dy[4]={1,-1,0,0};
//
const double eps=1e-6;
const int mod=1e9+7;
const int modd=mod-1;
//
const int maxm=3e6+5;
int a[maxm];
struct Node{
    int v,id;
}e[maxm];
bool cmp(Node a,Node b){
    return a.v>b.v;
}
void solve(){
    int n=re,k=re;
    n++;
    int ans=0;
    ff(i,n)a[i]=i;
    ff(i,n)a[i]+=a[i-1];
    const int mod=1e9+7;
    for(int i=k;i<=n;i++){
        int l=a[i];
        int r=a[n]-a[n-i];
        ans=(ans+r-l+1)%mod;
    }
    pr(ans);
}
signed main(){
//    while(1)
        solve();
    return 0;
}
/*

*/


Measured memory_bytes: 5160
#include "bits/stdc++.h"
using namespace std;
#ifdef _debug
#define out(i) cout << #i << ' ' << i << ' '
#else 
#define out(i) //
#endif
using ll = long long;
using ull = unsigned long long;
const int maxn = 600001;
string s, t;
int f[500001], cnt[4000001];
void build_kmp(const string &w){
	for(int i = 1, q = 0;i < w.size();++i){
		while(q and w[i] != w[q])q = f[q - 1];
		f[i] = q += w[i] == w[q];
	}
}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> s >> t;
	build_kmp(t);
	while(s.size() < t.size())s += s;
	int s3len = s.size() * 3;
	s += s += s;
	ull res = 0;
	for(int i = 0, q = 0;i < s.size();++i){
		while(q and s[i] != t[q])q = f[q - 1];
		q += (s[i] == t[q]);
		if(q == t.size())q = f[q - 1], cnt[i - (int)t.size() + 1] = 1;
	}
	for(int i = 0;i < s.size();++i){
		if(cnt[i]){
			if(i >= t.size())cnt[i] += cnt[i - t.size()];
			if(cnt[i] > res)res = (i >= s3len - t.size() - 1) ? -1ul : cnt[i];
		}
	}
	cout << (int)res << '\n';
}

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

int main(){
  int N; cin >> N;
  vector<int> B(N);
  
  for(int i=0; i<N-1; i++)
    cin >> B.at(i);
  
  int ans = B.at(N-2);
  
  for(int i=N-2; i>0; i--){
    
    ans += min( B.at(i), B.at(i-1) );
  
  }
  ans += B.at(0);
  
  cout << ans << endl;
}

Measured memory_bytes: 256
(defun final ()
  (let ((x (read))
        (y (read))
        (sum 0))
    (incf sum (cond ((= x 3) 100000)
                    ((= x 2) 200000)
                    ((= x 1) 300000)
                    (t 0)))
    (incf sum (cond ((= y 3) 100000)
                    ((= y 2) 200000)
                    ((= y 1) 300000)
                    (t 0)))
    (if (= 1 (* x y)) (incf sum 400000))
    (format t "~d" sum)))

(final)

Measured memory_bytes: 12388
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;



const int N = 2e5+33, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11 , T = 2000;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;        // #include <ext/pb_ds/assoc_container.hpp>
typedef pair <ll, ll> pll;         // #include <ext/pb_ds/tree_policy.hpp>
typedef vector <int> vi;          // #include <ext/rope>
                // #include <ext/rope>
                                 // #include <ext/rope>
bool prime(int n) {             // template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}
    
void solve() {
    string s;
    cin >> s;
    if(s == "ABC") {
        cout << "ARC";
    }
    else {
        cout << "ABC";
    }
}
/*

*/

main() {
    ios;
    int tt = 1;
//    cin >> tt;
    while(tt --) {
        solve();
//        brute();
    }
    return 0;
}
/*

*/


Measured memory_bytes: 3672
#include<stdio.h>
	int h,w,k,dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,1,0,-1,1,-1,1,-1},s[200][200];
	void func(int y,int x){
		int i;
		if(s[y][x]==1){
			s[y][x]=0;
			for(i=0;i<8;i++){
				if(dy[i]+y>=0&&dx[i]+x>=0&&dy[i]+y<h&&dx[i]+x<w)
					func(dy[i]+y,dx[i]+x);
			}
		}
	}
	int main(){
		int i,j;
		while(scanf("%d %d",&w,&h),w||h){
			k=0;
			for(j=0;j<h;j++){
				for(i=0;i<w-1;i++)
					scanf("%d ",&s[j][i]);
				scanf("%d",&s[j][i]);
			}
			for(i=0;i<h;i++)
				for(j=0;j<w;j++)
				if(s[i][j]==1){
					func(i,j);
					k++;
			}
			printf("%d\n",k);
			
			}
		return 0;
	}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int dp[100100];

int main()
{
    int n;cin >> n;
    string s; cin >> s;
    if(n >= 3200) cout << s;
    else cout << "red";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    long N,sum=0;
    cin >> N;
    for(int i=1;i<N+1;i++){
        if(i%15==0){
        }else if(i%3==0){
        }else if(i%5==0){
        }else{
            sum += i;
        }
    }
    cout << sum;
}

Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200005;
int n,a[N],p[N],f[N];
int main(){
	//freopen("aa.in","r",stdin);
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;++i)scanf("%d",a+i),p[a[i]]=i;
	int ans=0;
	for(i=1;i<=n;++i){
		if(p[a[i]-1]<i){
			f[a[i]]=f[a[i]-1]+1;
			ans=max(ans,f[a[i]]);
		}else f[a[i]]=1;
		//printf("%d %d\n",a[i],f[a[i]]);
	}
	printf("%d\n",n-ans);
	return 0;
} 

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
void solve()
{
   long long n,m;
   cin>>n>>m;
   int ans=(n*(n-1))/2;
   ans+=(m*(m-1))/2;
  cout<<ans<<"\n";
   
}
main()
{
int t;
t=1;
while(t--)
{
solve();

}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

#define ppi pair<int,pair<int,int>>
#define fi first
#define se second
// edge[from]={to,color}
vector<pair<int,int>> edge[100010];
// cost[goal][color]
map<int,map<int,int>> cost;

int main(){
    int n,m; cin>>n>>m;
    rep(i,m){
        int p,q,c; cin>>p>>q>>c;
        edge[p].push_back({q,c});
        edge[q].push_back({p,c});
    }
    // {cost,{from,color}}
    priority_queue<ppi,vector<ppi>,greater<ppi>> pq;
    pq.push({0,{1,-1}});
    while(pq.size()){
        auto pre=pq.top(); pq.pop();
        int pre_place=pre.se.fi,pre_color=pre.se.se,pre_dist=pre.fi;
        if(cost[pre_place][-1]==0||pre_dist<cost[pre_place][-1]){
            cost[pre_place][-1]=pre_dist;
            if(pre_place!=1) pq.push({cost[pre_place][-1],{pre_place,-1}});
        }
        if(pre_dist>=cost[pre_place][-1]+1) continue;
        // cout<<pre_place<<" "<<pre_color<<" "<<pre_dist<<endl;
        for(auto to:edge[pre_place]){
            int to_place=to.fi,to_color=to.se;
            if(pre_color==-1){
                if(cost[to_place][to_color]==0||pre_dist+1<cost[to_place][to_color]){
                    cost[to_place][to_color]=pre_dist+1;
                    pq.push({cost[to_place][to_color],{to_place,to_color}});
                }
            }else{
                if(pre_color==to_color){
                    if(cost[to_place][to_color]==0||pre_dist<cost[to_place][to_color]){
                        cost[to_place][to_color]=pre_dist;
                        pq.push({cost[to_place][to_color],{to_place,to_color}});
                    }
                }
            }
        }
    }
    cout<<(cost[n][-1]==0?-1:cost[n][-1])<<endl;
    return 0;
}


Measured memory_bytes: 43884
n = gets.to_i
s = gets.chomp.split("")

word = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")

result = s.map{ |sx|
	index = word.index(sx) + n
	if index >= word.size then
		index -= word.size
	end
	word[index]
}

puts result.join("")


Measured memory_bytes: 2300
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    int N;
    cin >> N;

    int ans = 0;

    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        while (a % 2 == 0) ans++, a /= 2;
    }

    cout << ans << endl;

}




























Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//typedef pair<ll,ll> A;
//vector<A> pc;
//int ABS(int a){return max(a,-a);}
int main() {
  int n;
  cin>>n;
  int h[n];
  for(int i=0;i<n;i++) cin>>h[i];
  int ans=1,m=h[0];
  for(int i=1;i<n;i++){
    if(h[i]>=m) ans++;
    m=max(m,h[i]);
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
def solve():
    N, M = map(int, input().split())
    S = map(int, input().split())
    *T, = map(int, input().split())
    dp = [1]*(M+1)
    for s in S:
        is_s = s.__eq__
        dp_ = dp[:]
        acc = 0
        for i, t in enumerate(T):
            if is_s(t):
                acc += dp_[i]
            dp[i+1] = dp_[i+1] + acc
    res = (dp[-1])%(10**9+7)
    return str(res)

if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 4972
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;
typedef long long LL;

int main()
{
    int n;
    cin >> n;

    vector<long long> a(n);

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

    sort(a.begin(), a.end());
    cout << abs(a[0] - a[n - 1]) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
int main(){
int m;
int n;
int c;
int f;
int g;
int h;
int i;
int j;
int k;
while(cin >>m){
if(m==0){break;}
int a[m];
int b[m];
c=0;
while(c<m){
cin >>a[c];
cin >>b[c];
c=c+1;}
cin >>n;
int d[n];
int e[n];
c=0;
while(c<n){
cin >>d[c];
cin >>e[c];
c=c+1;}
c=0;
while(c<n){
k=0;
f=d[c]-a[0];
g=e[c]-b[0];
h=1;
while(h<m){
j=0;
i=0;
while(i<n){
if(a[h]+f==d[i]&&b[h]+g==e[i]){j=1; break;}
i=i+1;}
if(j==0){k=1; break;}
h=h+1;}
if(k==0){cout <<f<<" "<<g<<endl; break;}
c=c+1;}
}}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define inf 1 << 30
#define maxW 1e5

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

    vector<int> dp(maxW + 1, inf);
    for(int i = 0; i < N; i++){
        if(!i)
            dp[0] = 0, dp[v[i]] = w[i];
        else
        {
            vector<int> dp_aux(maxW + 1, inf); dp_aux[0] = 0; dp_aux[v[i]] = w[i]; 
            for(int j = 0; j <= maxW; j++)
            {
                dp_aux[j] = min(dp_aux[j], dp[j]);  
                if(dp[j] + w[i] < inf)
                    dp_aux[j + v[i]] = min (dp_aux[j + v[i]], dp[j] + w[i]);
            }

            for(int j = 0; j <= maxW; j++)
                dp[j] = dp_aux[j];
        }
    }


    
    


    int ans = maxW; while(dp[ans] > W) ans --;
    cout << ans << "\n";

    
    
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
int main(){
    int n,r;
    cin>>n>>r;
    if(n>=10){
        cout<<r<<endl;
    }
    else{
        //r = 内部-100(10-n);
        cout<<r+100*(10-n)<<endl;
    }
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val b = Array(readLine()!!.toInt()) { readLine()!! }.groupBy { it }
    val r = Array(readLine()!!.toInt()) { readLine()!! }.groupBy { it }

    var max = 0
    for (i in b) {
        max = Math.max(i.value.size - r.getOrElse(i.key) { listOf() }.size, max)
    }
    println(max)
}



Measured memory_bytes: 33784
#include<stdio.h>
#include<string.h>

#define M 1000001/* your task*/
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  else return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return 1 + (key%(M-1)); }

int find(char str[]){
  int key, i, h;
  key = getKey(str);

  for(i=0;; i++){
    h = (h1(key) + i*h2(key)) % M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0) return 0;
  }
  return 0;
}

int insert(char str[]){
  int key, i, h;
  key = getKey(str);

  for(i=0;; i++){
    h = (h1(key) + i*h2(key)) % M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
		scanf("%s %s", com, str);

		if ( com[0] == 'i' ){
	    	insert(str);
		} else {
	    	if (find(str)){
				printf("yes\n");
	    	} else {
				printf("no\n");
	    	}
		}
   	}

    return 0;
}



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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    if(A + B == C + D) cout << "Balanced" << endl;
    else if (A + B < C + D) cout << "Right" << endl;
    else cout << "Left" << endl;
    

    return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val nkInput =  scala.io.StdIn.readLine()
  val nkArray = nkInput.split(" ").map(_.toInt).toSeq
  val n = nkArray(0).toDouble
  val k = nkArray(1).toDouble
  if(n <= 1) {
    println(1)
  } else {
    val log = Math.log(n) / Math.log(k)
    println(Math.ceil(log).toInt)
  }
}

Measured memory_bytes: 26816
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

struct N{
    int a, b;
    inline bool friend operator<(const N& a, const N& b) {
        return a.b < b.b;
    }
}a[100010];
int main() {
    int n;
    std::cin >> n;
    for (int i = 1; i <= n; ++i) {
        std::cin >> a[i].b;
        a[i].a = i;
    }
    std::sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; ++i) {
        std::cout << a[i].a << " ";
    }
    return 0;
}

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

int main(void){
    int n;
    string s;
    cin >> n >> s;
    int c=0;
    for(int i=0; i<n-2; i++){
        if(s[i]=='A' && s[i+1]== 'B' && s[i+2]=='C') c++;
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main()
{
    int big_a,big_b,a,b;
    
    scanf("%d %d", &big_a, &big_b);
    scanf("%d %d", &a, &b);

        
    cout << big_a*big_b-a*big_b-b*big_a+a*b << endl;
    
}


Measured memory_bytes: 256
def call_filter(x):
    if x % 3 == 0: return True

    while x > 0:
        if x % 10 == 3: return True
        x = int(x/10)

    return False

def call(n):
    for i in [x for x in range(1, n+1) if call_filter(x)]:
        print(' {}'.format(i), end='')
    print()

n = int(input())
call(n)



Measured memory_bytes: 6108
import Data.Maybe
main = do
    n <- readLn
    let table = zip ['A'..'Z'] (drop n ['A'..'Z'] ++ take n ['A'..'Z'])
    solve table <$> getLine >>= putStrLn

solve table (c:s) = (fromMaybe '_' $ lookup c table) : solve table s
solve _ _ = []

Measured memory_bytes: 1404
x = input()
a = int(x.split()[0])
b = int(x.split()[1])
c = int(x.split()[2])
d = int(x.split()[3])

# a<x<b, c<y<d
# bd, ac, ad, bc

bd = b*d
ac = a*c
ad = a*d
bc = b*c

max = bd

if max < ac:
 max = ac
if max < ad:
 max = ad
if max < bc:
 max = bc

print(max)

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

typedef long long ll;

int main()
{
    ll i,j;
    ll h,w,k;
    ll l;
    cin >> h >> w >> k;
    vector<string> choco(h);
    for(i = 0;i < h;++i){
        cin >> choco.at(i);
    }

    bool flag2 = false;

    ll bit = 0;
    int ans = 1e9;
    for(bit = 0;bit < (1 << h-1);++bit){
        vector<ll> yoko;
        for(i = 0;i < h-1;++i){
            if(bit & (1 << i)){
                yoko.push_back(i);
            }
        }
        ll tmp = yoko.size();
        vector<ll> tate(yoko.size()+1,0);
        for(i = 0;i < w;++i){
            vector<ll> tmp2(h,0);
            for(j = 0;j < h;++j){
                if(j == 0){
                    if(choco.at(j).at(i) == '1'){
                        ++tmp2.at(j);
                    }
                }else if(choco.at(j).at(i) == '1'){
                    tmp2.at(j) = tmp2.at(j-1)+1; 
                }else{
                    tmp2.at(j) = tmp2.at(j-1); 
                }
            }
            vector<ll> tate2(yoko.size() + 1);
            if(yoko.size() == 0){
                tate2.at(0) = tmp2.at(h-1);
            }else{
                tate2.at(0) = tmp2.at(yoko.at(0));
                for(j = 1;j < yoko.size();++j){
                    tate2.at(j) = tmp2.at(yoko.at(j)) - tmp2.at(yoko.at(j-1));
                }
                tate2.at(j) = tmp2.at(h-1) - tmp2.at(yoko.at(j-1));
            }

            for(j = 0;j <= yoko.size();++j){
                if(tate2.at(j) > k){
                    flag2 = true;
                    break;
                }
            }
            if(flag2){
                break;
            }
            vector<ll> tate3(yoko.size()+1);
            for(j = 0;j <= yoko.size();++j){
                tate3.at(j) = tate.at(j) + tate2.at(j);
            }
            bool flag = false;
            for(j = 0;j <= yoko.size();++j){
                if(tate3.at(j) > k){
                    flag = true;
                    break;
                }
            }
            if(flag){
                ++tmp;
                for(j = 0;j <= yoko.size();++j){
                    tate.at(j) = tate2.at(j);
                }
            }else{
                for(j = 0;j <= yoko.size();++j){
                    tate.at(j) = tate3.at(j);
                }
            }
        }
        if(flag2){
            flag2 = false;
            continue;
        }
        if(tmp < ans){
            ans = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long N, long long M){
    cout<<N*(N-1)/2+M*(M-1)/2<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


Measured memory_bytes: 256
// the biggest power of 2 that doesn't exceed X
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long b = 1;
  while(2 * b <= n) b *= 2;
  cout << 2 * b - 1 << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String[] vowel = {"a", "i", "u", "e", "o"};
    
    if (Arrays.asList(vowel).contains(str)) {
      System.out.println("vowel");
    } else {
      System.out.println("consonant");
    }
  }
}

Measured memory_bytes: 21076
#include<iostream>

using namespace std;

const int N(1e5 + 9);

int n, m, ans;
int a[N], b[N], c[N];
int f[N][3];

int main()
{
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	for (int i=1;i<=n;i++)
	{
		f[i][0] = max(f[i - 1][1], f[i - 1][2]) + a[i];
		f[i][1] = max(f[i - 1][0], f[i - 1][2]) + b[i];
		f[i][2] = max(f[i - 1][0], f[i - 1][1]) + c[i];
	}
	ans = max(f[n][0], max(f[n][1], f[n][2]));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int N = 1e4+5;
const int M = 1e6+5;
const int Mod = 998244353;
#define pi acos(-1)
#define INF 1e8
#define INM INT_MIN
#define pb(a)  push_back(a)
#define mk(a,b) make_pair(a,b)
#define dbg(x) cout << "now this num is " << x << endl;
#define met0(axx) memset(axx,0,sizeof(axx));
#define metf(axx) memset(axx,-1,sizeof(axx));
#define sd(ax) scanf("%d",&ax)
#define sld(ax) scanf("%lld",&ax)
#define sldd(ax,bx) scanf("%lld %lld",&ax,&bx)
#define sdd(ax,bx) scanf("%d %d",&ax,&bx)
#define sddd(ax,bx,cx) scanf("%d %d %d",&ax,&bx,&cx)
#define sfd(ax) scanf("%lf",&ax)
#define sfdd(ax,bx) scanf("%lf %lf",&ax,&bx)
#define pr(a) printf("%d\n",a)
#define plr(a) printf("%lld\n",a)
/*
dp[i][j]表示选前i个元素,值为j的集合个数

转移方程:dp[i][j] = dp[i-1][j]+dp[i-1][j-a[i]];//选第i个元素或者不选.

3 3
*/
LL dp[3005][3005],a[3005];
int main()
{
    int n,s;sdd(n,s);
    for(int i=1;i<=n;++i) sld(a[i]);
    dp[0][0] = 1;
    for(int i=1;i<=n;++i)
    {
        for(int j=0;j<=s;++j)
        {
            dp[i][j] = dp[i-1][j]*2%Mod;//对于前i-1个,已经有了凑成s的方案,贡献不断*2.
            if(j-a[i] >= 0 ) dp[i][j] = (dp[i][j]+dp[i-1][j-a[i]])%Mod;
        }
    }
    plr(dp[n][s]);
    //system("pause");
    return 0;
}

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

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll x = n / (a+b);
  ll y = min(n%(a+b), a);
  ll ans = a * x + y;
  cout << ans << endl;
  return 0;
}

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

int main() 
{
	int ans = 0;
	for (int i = 1;i <= 4;i++)
	{
		int a;
		scanf("%1d",&a);
		if (a == 2)
			ans++;
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
      author  : nishi5451
      created : 14.08.2020 14:23:07
*/

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


int main(){
    string s;
    cin >> s;
    string ans;
    ans.push_back(s.front());
    ans+=to_string(int(s.size()-2));
    ans.push_back(s.back());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3696
import sys

N,M = map(int,input().split())
member = dict()
for i in range(1,N+1,1):
    ilist = list(map(int,input().split()))
    ilist.pop(0)
    member[i]=set(ilist)

match_set=member[1]

for i in range(2,N+1,1):#memberに対し、1人ずつ検査していく
    match_set = match_set & member[i]

print(len(match_set))
        


Measured memory_bytes: 3060
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;

    int d, a;
    vector<int> c(n);

    for (int i = 0; i < k; i++) {
        cin >> d;
        for (int j = 0; j < d; j++) {
            cin >> a;
            c[a-1]++;
        }
    }

    int ans = 0;

    for (int i = 0; i < n; i++) {
        if (c[i] == 0) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef int keytype;

int gcd(int a, int b){ return (a % b) ? gcd(b, a % b) : b;}
int lcm(int a, int b){ return (a / gcd(a, b)) * b;}

/* a[0], ..., a[n-1] の数の最大公約数 */
int ngcd(int n, int a[])
{
    int i, d;

    d = a[0];
    for (i = 1; i < n && d != 1; i++)
        d = gcd(a[i], d);
    return d;
}

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

//#define N 5
//int p[N + 1];
int nextperm(int p[], int N)  /* 辞書式順序で次の順列 */
{
    int i, j, t;

    i = N - 1;
    p[0] = 0;  /* 番人 */
    while (p[i] >= p[i + 1]) i--;
    if (i == 0) return 0;  /* 完了 */
    j = N;
    while (p[i] >= p[j]) j--;
    t = p[i];  p[i] = p[j];  p[j] = t;
    i++;  j = N;
    while (i < j) {
        t = p[i];  p[i] = p[j];  p[j] = t;  i++;  j--;
    }
    return 1;  /* 未了 */
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

int min(int a, int b){
    if(a > b) return b;
    else return a;
}

const int inf = 1012345678;
int main(){
    int n;
    ll k, pos;
    int a[100001], b[100001];
    ll c[1000000];

    for(int i = 0; i < n; ++i){
        c[i] = 0;
    }

    scanf("%d %lld", &n, &k);
    for(int i = 0; i < n; ++i){
        scanf("%d %d", &a[i], &b[i]);
        c[a[i]] += b[i];
    }

    int ans = 1;
    for(int i = 0; k > 0; ++i){
        if(k <= c[i]){
            ans = i;
            break;
        }
        k -= c[i];
    }

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

    return 0;
}


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






int32_t main()
{
    ios_base::sync_with_stdio(0);
  int n; cin>>n;
  string s; cin>>s;
  int ans = 0;
  vector<int>v[3];
  for(int i=0;i<n;i++)
  {
      if(s[i] == 'R')v[0].push_back(i);
      else if(s[i]=='G')v[1].push_back(i);
      else v[2].push_back(i);
  }
  for(int i:v[0]){
    for(int j:v[1]){
        int x=i,y=j;
        if(x>y)swap(x,y);
        int h = upper_bound(v[2].begin(),v[2].end(),y)-v[2].begin();
        int l = lower_bound(v[2].begin(),v[2].end(),x)-v[2].begin();
        ans+=(h-l);
        if((i+j)%2==0){
            if(binary_search(v[2].begin(),v[2].end(),(i+j)/2))ans--;
        }
    }
  }
   for(int i:v[0]){
    for(int j:v[2]){
        int x=i,y=j;
        if(x>y)swap(x,y);
        int h = upper_bound(v[1].begin(),v[1].end(),y)-v[1].begin();
        int l = lower_bound(v[1].begin(),v[1].end(),x)-v[1].begin();
        ans+=(h-l);
        if((i+j)%2==0){
            if(binary_search(v[1].begin(),v[1].end(),(i+j)/2))ans--;
        }
    }
  }
   for(int i:v[2]){
    for(int j:v[1]){
        int x=i,y=j;
        if(x>y)swap(x,y);
        int h = upper_bound(v[0].begin(),v[0].end(),y)-v[0].begin();
        int l = lower_bound(v[0].begin(),v[0].end(),x)-v[0].begin();
        ans+=(h-l);
        if((i+j)%2==0){
            if(binary_search(v[0].begin(),v[0].end(),(i+j)/2))ans--;
        }
    }
  }
  cout<<ans;




}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i = (int)(n)-1; i>=0; --i)
#define For(i,a,b) for(auto i=(a);i<=(b);++i)
#define rFor(i,a,b) for(auto i=(b);i>=(a);--i)
#define call(var) cerr<<#var<<"="<<var<<"\n";
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const double pi = acos(-1);
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}
template<class T> istream& operator>>(istream& is, vector<T>& a){rep(i,a.size()) is >> a[i]; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& a){rep(i,a.size()) os << a[i] << " "; return os;}
template<class T, class U> istream& operator>>(istream& is, pair<T,U>& p){is >> p.first >> p.second; return is;}
template<class T, class U> ostream& operator<<(ostream& os, const pair<T,U>& p){os << "("<< p.first << "," << p.second << ")"; return os;}
template<class T, class U> ostream& operator<<(ostream& os, const map<T,U>& mp){for(auto& t : mp) os << t.first << " " << t.second << "\n"; return os;}

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

    while(k--){
        if(a >= b) b *= 2;
        else if(b >= c) c *= 2;
    }

    if(a < b && b < c) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a;
	if(a==2){
		cin>>b>>c;
		cout<<b+c;
	}else{
		cout<<"Hello World";
	}
	return 0;
}

Measured memory_bytes: 256
package main
 
import (
	"fmt"
)
 
func main() {
  var n,p,min,cnt int
  fmt.Scan(&n)
  min = n
  for i := 0; i < n; i++{
  	fmt.Scan(&p)
    if p <= min {
      cnt++
      min = p
    }
  }
  fmt.Printf("%d", cnt)
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  string s;
  cin >> N >> K >> s;
  
  if (s.at(K - 1) == 'A') {
  	s.at(K - 1) = 'a';
  }
  if (s.at(K - 1) == 'B') {
  	s.at(K - 1) = 'b';
  }
  if (s.at(K - 1) == 'C') {
  	s.at(K - 1) = 'c';
  }
  
  cout << s << endl;
}

Measured memory_bytes: 256
s = input()
n = len(s)

bef = s[0]
key = 0
ans = 1
for i in range(1, n):
  if key == i:
    continue
  if bef == s[i]:
    if i == n-1:
      continue
    bef = s[i:i+2]
    ans += 1
    key = i+1
  else:
    bef = s[i]
    ans += 1
print(ans)

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

struct UnionFind{
	vector<int> par;

	UnionFind(int N){
		par.resize(N,-1);
	}

	int root(int x){
		if(par[x] < 0) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y){
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return;
		if(par[rx] < par[ry]){
			par[rx] += par[ry];
			par[ry] = rx;
		} else {
			par[ry] += par[rx];
			par[rx] = ry;
		}
		
	}

	bool same(int x, int y){
		return par[x] == par[y];
	}

};

int main(){
	int N,M; cin >> N >> M;
	UnionFind uf(N);
	for(int i=0; i<M; i++){
		int a,b; cin >> a >> b;
		a--; b--;
		uf.unite(a,b);
	}
	set<int> s;
	for(int i=0; i<N; i++){
		s.insert(uf.root(i));
	}
	cout << s.size()-1 << endl;
	return 0;
}


Measured memory_bytes: 7660
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  vector<string> A(3);
  for(auto& s : A) cin >> s;

  auto res = true;
  res &= A[0].back() == A[1][0];
  res &= A[1].back() == A[2][0];

  cout << (res ? "YES" : "NO") << CRLF;

  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
def resolve():
    import math
    N, D = map(int, input().split())
    A = []
    count = 0
    for _ in range(N):
        A.append(list(map(int, input().split())))
    for i in range(N):
        for j in range(i+1, N):
            if j != i:
                ans=0
                for g in range(D):
                    ans += (A[i][g]-A[j][g])**2
                if math.sqrt(ans)%1 == 0:
                    count += 1
    print(count)
resolve()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	string s;
	cin>>s;
	if(s[0]=='S')
	{
		if(s[1]=='U')
			cout<<7;
		else
			cout<<1;
	}
	else if(s[0]=='F')
	{
		cout<<2;
	}
	else if(s[0]=='T')
	{
		if(s[1]=='H')
			cout<<3;
		else
			cout<<5;
	}
	else if(s[0]=='W')
	{
		cout<<4;
	}
	else
	{
		cout<<6;
	}
	return 0;
}



Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1<<20)

struct RAQ {
	int N;
	int a[N_SIZE];
	int seg[N_SIZE * 2];
	int lazy[N_SIZE * 2];
	int gt;
	void init(int n) {
		N = n;
		gt = 1;
		while (N > gt)gt *= 2;
		REP(i, n)a[i] = 0;
		REP(i, N_SIZE) {
			seg[i] = 0;
			lazy[i] = 0;
		}
		REP(i, n)seg[i + gt - 1] = a[i];
	}

	void lazy_evaluate(int k) {
		seg[k] += lazy[k];
		if (k < gt) {
			lazy[2 * k + 1] += lazy[k];
			lazy[2 * k + 2] += lazy[k];
		}
		lazy[k] = 0;
	}

	//[a,b)
	void update(int a, int b, int x) { update(a, b, 0, 0, gt, x); }
	void update(int a, int b, int k, int l, int r, int x) {
		if (r <= a || b <= l)return;
		if (a <= l&&r <= b)lazy[k] += x;
		else {
			update(a, b, 2 * k + 1, l, (l + r) / 2, x);
			update(a, b, 2 * k + 2, (l + r) / 2, r, x);
		}
	}

	ll query(int a, int b) { return query(a, b, 0, 0, gt); }
	ll query(int a, int b, int k, int l, int r) {
		lazy_evaluate(k);
		if (r <= a || b <= l)return 0;
		if (a <= l&&r <= b) {
			return seg[k];
		}
		else {
			return query(a, b, 2 * k + 1, l, (l + r) / 2) 
				+ query(a, b, 2 * k + 2, (l + r) / 2, r);
		}
	}

	void print() {
		REP(i, gt * 2)cout << "!" << i << " " << seg[i] << " " << lazy[i] << endl;
	}
};

int n, q;
RAQ raq;

int main() {
	cin >> n >> q;
	raq.init(n);
	REP(i, q) {
		bool f;
		int a, b, c;
		cin >> f;
		if (!f) {
			cin >> a >> b >> c;
			a--; b--;
			raq.update(a, b + 1, c);
		}
		else {
			cin >> a;
			a--;
			cout << raq.query(a, a + 1) << endl;
		}
		//raq.print();
	}
}

Measured memory_bytes: 11704
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	char cc;
	cin >> cc;
	cout << ++cc << endl;
	return 0;
}


Measured memory_bytes: 3532
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;
#define ll long long

int main(){

    ll L;

    cin >> L;
    double ans = (double)(L*L*L) / 27;
    printf("%.8lf\n", ans);

    return 0;
}


Measured memory_bytes: 256