akhauriyash/Code-Regression huggingface dataset:
n = int(raw_input())
A = map(int,raw_input().split())
print " ".join(map(str,A))
for j in range(1,n):
    key = A[j] 
    i = j - 1  
    while i>=0 and A[i]>key:
        A[i+1] = A[i]
        i = i-1
    A[i+1] = key
    print " ".join(map(str,A))

Measured memory_bytes: 4220
#include   <bits/stdc++.h>
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int n, m, q;
vector<int> a, b, c, d;
int ans = 0;
void dfs(vector<int> A) {
  if (A.size() == n + 1) {
    int now = 0;
    rep(i, q) {
      if (A[b[i]] - A[a[i]] == c[i])
        now += d[i];
    }
    ans = max(ans, now);
    return;
  }
  A.push_back(A.back());
  while (A.back() <= m) {
    dfs(A);
    A.back()++;
  }
}
 
int main() 
{
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  rep(i, q)
cin >> a[i] >> b[i] >> c[i] >> d[i];
  dfs(vector<int>(1, 1));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

ll a[10001];
ll m[100][100] = {};
int main() {
	ll h, w; cin >> h >> w;
	ll n; cin >> n;
	rep(i, 0, n)cin >> a[i];

	bool r = true;

	ll H = 0;
	ll W = 0;
	rep(i, 0, n) {
		rep(j, 0, a[i]) {
			m[H][W] = i + 1;
			if (r) {
				W++;
			}
			else {
				W--;
			}

			if (W == w) {
				H++;
				W--;
				r = false;
				continue;
			}
			if (W == -1) {
				H++;
				W++;
				r = true;
				continue;
			}
		}
	}

	rep(i, 0, h) {
		rep(j, 0, w) {
			cout << m[i][j];
			if (j != w - 1) {
				cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    double a[n+1];
    for(int i=1;i<=n;i++)    cin>>a[i];
    double dp[n+1][n+1];
    memset(dp,0,sizeof dp);
    // for(int i=0;i<=n;i++)   dp[i][0]=1;
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        double sum=0;
        for(int j=1;j<=i;j++){
            dp[i][j] = dp[i-1][j]*(1-a[i]) +  dp[i-1][j-1]*a[i];
            sum+=dp[i][j];
        }
        dp[i][0]=1-sum;
    }
    double ans=0;
    for(int i=(n+1)/2;i<=n;i++){
        ans+=dp[n][i];
    }
    cout<<setprecision(13)<<ans<<endl;
}


Measured memory_bytes: 70656
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String inputA = sc.next();
		long A = Long.parseLong(inputA);
		double doubleA = Double.parseDouble(inputA);

		for (int i = (int) Math.sqrt(doubleA); i > 0; i--) {
			if (A % i == 0) {
				long x = i;
				long y = A / i;
				System.out.print(x + y - 2);
				break;
			}
		}
		
	}
}


Measured memory_bytes: 23764
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
#define INF 1e+12
#define PI acos(-1)
#define MOD 100000009
using ll = long long;
using ull = unsigned long long;

int main(){
    int a, b;
    cin >> a >> b;
    int tax = 0;
    for(int i = 1; i <= 10000; ++i){
        int A = i * 0.08;
        int B = i * 0.1;
        if(A == a && B == b){
            tax = i;
            println(tax);
            stop;
        }
    }

    println(-1);
}

Measured memory_bytes: 256
S = input()
from itertools import groupby
S_length = len(S)
k = 1
s_l=[k*len(list(g)) for k, g in groupby(S)]
  
        
        
def n_sum(n):
  return n*(n+1)//2
        

s_l_length = len(s_l)
answer=0
if s_l[0][0]=='<':
  if s_l_length%2==0:
    for i in range(0,s_l_length,2):
      s_1=s_l[i]
      s_2=s_l[i+1]
      s_1_l=len(s_1)
      s_2_l=len(s_2)
      if s_1_l<=s_2_l:
        answer+=n_sum(s_1_l-1)+n_sum(s_2_l)
      else:
        answer+=n_sum(s_1_l)+n_sum(s_2_l-1)
  else:
    for i in range(0,s_l_length,2):
      if i==s_l_length-1:
        answer+=n_sum(len(s_l[i]))
      else:
        s_1=s_l[i]
        s_2=s_l[i+1]
        s_1_l=len(s_1)
        s_2_l=len(s_2)
        if s_1_l<=s_2_l:
          answer+=n_sum(s_1_l-1)+n_sum(s_2_l)
        else:
          answer+=n_sum(s_1_l)+n_sum(s_2_l-1)
          
else:
  answer+=n_sum(len(s_l.pop(0)))
  s_l_length-=1
  if s_l_length%2==0:
    for i in range(0,s_l_length,2):
      s_1=s_l[i]
      s_2=s_l[i+1]
      s_1_l=len(s_1)
      s_2_l=len(s_2)
      if s_1_l<=s_2_l:
        answer+=n_sum(s_1_l-1)+n_sum(s_2_l)
      else:
        answer+=n_sum(s_1_l)+n_sum(s_2_l-1)
  else:
    for i in range(0,s_l_length,2):
      if i==s_l_length-1:
        answer+=n_sum(len(s_l[i]))
      else:
        s_1=s_l[i]
        s_2=s_l[i+1]
        s_1_l=len(s_1)
        s_2_l=len(s_2)
        if s_1_l<=s_2_l:
          answer+=n_sum(s_1_l-1)+n_sum(s_2_l)
        else:
          answer+=n_sum(s_1_l)+n_sum(s_2_l-1)
  
      
print(answer)

Measured memory_bytes: 13416
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
using namespace std;
int main(){
	int n ; 
	cin>> n ; 
	set<int>s ; 
	for(int i = 0 ; i < n ; ++i){
		int x ; 
		cin>> x ; 
	   s.insert(x) ; 
   }
	   
	   if(n == (int)s.size())
	   cout<<"YES"<<endl;
	   else
	   cout<<"NO"<<endl;
   }
	
	

	


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b + c || a + b == c || a + c == b) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }  
}


Measured memory_bytes: 3608
hw = []
buff = []

while True:
    buff = list(map(int, input().split()))
    if [0, 0] == buff:
        break
    else:
        hw.append(buff)

for i in hw:
    for j in range(i[0]):
        for k in range(i[1]):
            print("#", end="")
        print()
    print()


Measured memory_bytes: 7012
#include <iostream>
#include <map>
#include <vector>
#include <cassert>
#include <unordered_set>
#include <set>
#include <bitset>
#include <memory.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <queue>

using namespace std;
 
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
 
const int MOD = (int) 1e9 + 7;
const int MAGIC = 400;

long long binPow(long long a, long long b) {
    if (b == 0)
        return 1;

    long long ans = binPow(a, b / 2);
    ans = ans * ans % MOD;

    if (b % 2)
        ans = ans * a % MOD;

    return ans;
}

int main() {
    // freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    long long ans = 0;
    vector<long long> b;
    for (int i = 0; i < n; ++i) {
        long long a, num;
        cin >> a >> num;
    
        vector<long long> temp;
        while (num) {
            if (num % 2) {
                temp.push_back(a);
                --num;
            }

            long long merge = a * 2;
            ans += num / 2;

            if (merge >= 10) {
                merge = merge % 10 + merge / 10;
                ans += num / 2;
            }

            a = merge;

            num /= 2;
        }

        reverse(all(temp));
        for (auto j : temp)
            b.push_back(j);
    }

    for (int i = 0; i + 1 < b.size(); ++i) {
        ++ans;
        if (b[i] + b[i + 1] >= 10) {
            b[i + 1] = (b[i] + b[i + 1]) % 10 + (b[i] + b[i + 1]) / 10;
            ++ans;
        } else {
            b[i + 1] = b[i] + b[i + 1];
        }
    }
    // cout << b.back() << "\n";

    cout << ans << "\n";
}


Measured memory_bytes: 35172
#include <iostream>
using namespace std;
typedef long long ll;
ll n,m,k,s[100000],a;
int main(void){
    cin>>n>>m>>k;
    for(int i=0;i<n;i++){
        s[i]=m-k;
    }
    for(int i=0;i<k;i++){
        cin>>a;
        s[a-1]++;
    }
    for(int i=0;i<n;i++){
        if(s[i]>0)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#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 srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(const auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) {cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl;}

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>&m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}
template<typename S,typename T,typename U>
struct TRI{S fi;T se;U th;TRI(){}TRI(S f,T s,U t):fi(f),se(s),th(t){}
bool operator<(const TRI&_)const{return(fi==_.fi)?((se==_.se)?(th<_.th):(se<_.se)):(fi<_.fi);}};
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,TRI<S,T,U>&t){return o<<"{"<<t.fi<<","<<t.se<<","<<t.th<<"}";}

typedef pair<int, int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 200005;

vector<int> G[MAX_N];
int c[MAX_N], cnt[MAX_N];
ll ans[MAX_N];
int cur;

void dfs(int u, int p){
    int kp = cur - cnt[c[u]];
    ++cur;
    for(const int v : G[u]){
        if(v == p) continue;
        cnt[c[u]] = cur;
        dfs(v, u);
        ans[c[u]] += (ll)(cur - cnt[c[u]] + 1) * (cur - cnt[c[u]]) / 2;
    }
    cnt[c[u]] = cur - kp;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n) cin >> c[i], --c[i];
    int u, v;
    rep(i,n-1){
        cin >> u >> v;
        --u, --v;
        G[u].push_back(v), G[v].push_back(u);
    }
    dfs(0, -1);
    rep(i,n){
        ans[i] += (ll)(cur - cnt[i] + 1) * (cur - cnt[i]) / 2;
    }
    rep(i,n){
        cout << (ll)(n + 1) * n / 2 - ans[i] << "\n";
    }
    return 0;
}

Measured memory_bytes: 33284
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;cin>>n;
	set<int> st;
	for(int i=0;i<n;i++){
		int a;cin>>a;st.insert(a);
	}
	if(st.size()==n){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}


Measured memory_bytes: 9600
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int INF=1000000000;
struct data{
    int x,d;
    data(int a,int b){
        x=a;d=b;
    }
};
int abso(data a,data b){
    int ans=a.x-b.x;
    if(ans<0)ans*=-1;
    return ans;
}
int dp[77][200][1001];
int main(){
    int n,m;
    while(cin>>n>>m,n||m){
        vector<vector<data> >stone(n+2);
        int k;
        for(int i=0;i<n;i++){
            cin>>k;
            for(int j=0;j<k;j++){
                int x,d;
                cin>>x>>d;
                stone[i+1].push_back(data(x-1,d));
            }
        }


        for(int i=0;i<1000;i++){
            stone[0].push_back(data(i,0));
            stone[n+1].push_back(data(i,0));
        }
        fill(dp[0][0],dp[0][0]+77*200*1001,INF);
        for(int k=0;k<=(n+1)/2;k++){
            for(int i=0;i<=n;i++){
                for(int j=0;j<stone[i].size();j++){
                    data At=stone[i][j];
                    if(i==0)dp[k][i][At.x]=0;
                    if(dp[k][i][At.x]==INF)continue;
                    for(int l=0;l<stone[i+1].size();l++){
                        data to=stone[i+1][l];
                        int cost=abso(At,to)*(At.d+to.d);
                        dp[k][i+1][to.x]=min(dp[k][i+1][to.x],dp[k][i][At.x]+cost);

                    }

                    if(i>=n)continue;

                    for(int l=0;l<stone[i+2].size();l++){
                        data to=stone[i+2][l];
                        int cost=abso(At,to)*(At.d+to.d);
                        dp[k+1][i+2][to.x]=min(dp[k+1][i+2][to.x],dp[k][i][At.x]+cost);
                    }

                }
            }
        }

        int Min=INF;
        for(int i=0;i<=m;i++){
            for(int j=0;j<1000;j++)
                Min=min(Min,dp[i][n+1][j]);
        }
        cout<<Min<<endl;
        /*
        cout<<endl<<endl;
        int p=1;
        for(int i=n+1;i>=0;i--){
            cout<<i<<":";
            for(int j=0;j<10;j++){
                if(dp[p][i][j]==INF)cout<<"i ";
                else cout<<dp[p][i][j]<<" ";
            }
            cout<<endl;
        }
        */

    }
}

Measured memory_bytes: 61460
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define DEBUG 0 
#define LIMIT (LONG_MAX / 10)
#define POSITIVE_LAST_D (LONG_MAX % 10)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    int x,y;
    cin>>x>>y;
    int a=4*x-y;
    int b=y-2*x;
    if((a%2==0&&b%2==0)&&(b>=0&&a>=0)){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

int main() {
  
  int n, x;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
  	scanf("%d", &x);
    if (x & 1) {
    	puts("first");
      return 0;
    }
  }
  puts("second");
	
  	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize "trapv"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand rng
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define M_PI 3.14159265358979323846
typedef long long ll;



int main() {
	//fios;
	
	string s;
	cin >> s;
	if(s.back() != 's') s += 's';
	else s += "es";
	cout << s << endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		if (a < 9 && b < 9) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}

		sc.close();
	}
}

Measured memory_bytes: 21588
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  vector<int> b(a);
  rep(i,a)
    cin>>b[i];
  int c=0;
  rep(i,a){
  if(i%2==0&&b[i]%2==1){
  c++;
  }
  }
  out(c);
}

Measured memory_bytes: 3804
#include <iostream>

using namespace std;
int main(){
    int x;
    int y;
    while(1){
        cin >> x >> y;
        if (x == 0 && y == 0) break;
        if(x >= y){
            cout << y << " " << x <<endl;
        }
        else{
            cout << x << " " << y <<endl;
        }
    }
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#pragma 03
using namespace std;
using namespace __gnu_pbds;
ll v[105];
int main(){
	ll sum = 0;
	ll n, m; cin >> n >> m;
	ll cnt = 0;
	for (ll i = 0; i < n; i++) cin >> v[i], sum += v[i];
	for (ll i = 0; i < n; i++){
		if (m * v[i] * 4 >= sum) cnt++;
	}
	if (cnt >= m) cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
	int a[52] = {0};
	char b[4] = {'S','H','C','D'};
	int d, n;
	char c;
	int e, f;

	scanf("%d", &n);
	for (f = 0; f < n; f++)
	{
		scanf(" %c %d", &c, &d);
		for (e = 0; b[e] != c; e++)
		{
			d += 13;
		}
		a[d - 1] = 1;
	}

	for (f = 0; f < 4; f++)
	{
		for (e = 0; e < 13; e++) 
		{
			if (a[f * 13 + e] == 0) 
			{
				printf("%c %d\n", b[f], e + 1);
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1760
# -*- coding:utf-8 -*-

def solve():
    A, B = list(map(int, input().split(" ")))

    ans = 0

    for i in range(2):
        if A >= B:
            ans += A
            A -= 1
        else:
            ans += B
            B -= 1
    print(ans)


if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	if a+b > c+d {
		fmt.Println("Left")
	} else if a+b < c+d {
		fmt.Println("Right")
	} else {
		fmt.Println("Balanced")
	}
}


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

const int MAX_N = 500005;
const int MAX_R = 1000000000;
int N;

struct pt {
	int x, y, id;

	bool operator<(const pt& b) const { return id < b.id; }
} pts[MAX_N];

struct node {
	std::vector<pt> pts;
	pt mid;
	node* l, *r;
} root;

std::set<pt> ans;

void build(int st, int en, int dep, node* n) {
	if (en - st == 1) {
		n->pts.push_back(pts[st]);
		n->mid = pts[st];
		return;
	} else if (en - st == 0) {
		return;
	}
	int mid = (st + en) / 2;
	std::sort(pts + st, pts + en, [dep](const pt& a, const pt& b) {
		bool typ[2] = {a.x < b.x, a.y < b.y};
		bool qal[2] = {a.x != b.x, a.y != b.y};
		if (qal[dep]) return typ[dep];
		return typ[!dep];
	});

	n->pts = std::vector<pt>(pts + st, pts + en);
	n->l = new node;
	n->r = new node;
	n->mid = pts[mid];

	build(st, mid, (dep + 1) % 2, n->l);
	build(mid, en, (dep + 1) % 2, n->r);
}

bool pis(pt tl, pt br, pt p) {
	return p.x >= tl.x && p.x <= br.x && p.y <= tl.y && p.y >= br.y;
}

bool aFullyContainsB(pt tla, pt bra, pt tlb, pt brb) {
	return pis(tla, bra, tlb) && pis(tla, bra, brb);
}

bool intersect(pt tla, pt bra, pt tlb, pt brb) {
	return tla.x <= brb.x && bra.x >= tlb.x && tla.y >= brb.y && bra.y <= tlb.y;
}

void query(int stx, int enx, int sty, int eny, int nstx, int nenx, int nsty, int neny, node* n, int dep) {
	if (!n) return;

	// printf("%d %d %d %d %d %d %d %d\n", stx, enx, sty, eny, nstx, nenx, nsty, neny);
	bool inter = intersect({stx, eny, 0}, {enx, sty, 0}, {nstx, neny, 0}, {nenx, nsty, 0});
	if (!inter) return;

	bool fully = aFullyContainsB({stx, eny, 0}, {enx, sty, 0}, {nstx, neny, 0}, {nenx, nsty, 0});
	if (fully) {
		for (pt p : n->pts) {
			ans.insert(p);
		}
		return;
	}

	pt m = n->mid;
	if (pis({stx, eny, 0}, {enx, sty, 0}, m)) {
		ans.insert(m);
	}
	if (dep) {
		query(stx, enx, sty, eny, nstx, nenx, nsty, m.y, n->l, (dep + 1) % 2);
		query(stx, enx, sty, eny, nstx, nenx, m.y, neny, n->r, (dep + 1) % 2);
	} else {
		query(stx, enx, sty, eny, nstx, m.x, nsty, neny, n->l, (dep + 1) % 2);
		query(stx, enx, sty, eny, m.x, nenx, nsty, neny, n->r, (dep + 1) % 2);

	}
}

void debug(node* n) {
	if (!n) {printf("Node NULL\n"); return;}
	printf("Node, mid: (%d, %d; %d) pts: ", n->mid.x, n->mid.y, n->mid.id);
	for (pt p : n->pts) {
		printf("(%d, %d; %d), ", p.x, p.y, p.id);
	}
	printf("\n L\n");
	debug(n->l);
	printf("R\n");
	debug(n->r);
}

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		scanf("%d %d", &pts[i].x, &pts[i].y);
		pts[i].id = i;
	}
	build(0, N, 0, &root);
	// debug(&root);
	int Q;
	scanf("%d", &Q);
	for (int i = 0; i < Q; ++i) {
		int stx, enx, sty, eny; // inclusive
		scanf("%d %d %d %d", &stx, &enx, &sty, &eny);
		ans.clear();
		query(stx, enx, sty, eny, -MAX_R, MAX_R, -MAX_R, MAX_R, &root, 0);
		for (pt p : ans) {
			printf("%d\n", p.id);
		}
		printf("\n");
	}
}


Measured memory_bytes: 198132
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  int N,M;
  cin >> N >> M;
  vector<vector<bool>> like(N,vector<bool>(M,false));
  int K,A;
  for(int i=0;i<N;i++){
    cin >> K;
    for(int j=0;j<K;j++){
      cin >> A;
      --A;
      like.at(i).at(A)=true;
    }
  }

  int ans=0;
  for(int j=0;j<M;j++){
    bool flag_dislike=false;
    for(int i=0;i<N;i++){
      if(like.at(i).at(j)==false){
	flag_dislike=true;
	break;
      }
    }
    if(flag_dislike==false) ++ans;
  }

  cout << ans << endl;

  return 0;
}


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

const int MAX_N = 100010;

vector<int> f[MAX_N], b[MAX_N];

void dfs(int u, set<int> &s, vector<bool> &vis, int idx, vector<int> &which){
    vis[u] = true;
    which[u] = idx;
    s.insert(u);
    for (auto v: f[u]){
        if (!vis[v]){
            dfs(v, s, vis, idx, which);
        }
    }
}

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

    int n, m, k;
    cin >> n >> m >> k;
    
    vector<int> ans(n);
    for (int i = 0; i < m; i++){
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        f[u].push_back(v);
        f[v].push_back(u);
    }
    for (int i = 0; i < k; i++){
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        b[u].push_back(v);
        b[v].push_back(u);
    }

    vector<set<int>> s;
    vector<bool> vis(n, false);
    vector<int> which(n);
    int idx = 0;
    for (int i = 0; i < n; i++){
        if (!vis[i]){
            set<int> ss;
            dfs(i, ss, vis, idx, which);
            s.push_back(ss);
            idx += 1;
        }
    }

    for (int i = 0; i < n; i++){
        ans[i] = (int) s[which[i]].size() - (int) f[i].size() - 1;
        for (auto j: b[i]){
            if (s[which[i]].find(j) != s[which[i]].end())
                ans[i] -= 1;
        }
    }

    for (auto i: ans)
        cout << i << " ";
    cout << '\n';

    return 0;
}


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


int main(void){
    int n, m;
    cin >> n >> m;
    vector<int> ans(n+1);
    vector<bool> flag(n+1, true);
    // init
    vector<vector<int>> g(n+1);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<int> que;
    que.push(1);
    flag[1] = false;
    while(!que.empty()){
        int v = que.front();
        que.pop();
        for(int i : g[v]){
            if(flag[i]){
                que.push(i);
                ans[i] = v;
                flag[i] = false;
            }
        }
    }
    cout << "Yes" << endl;
    for(int i = 2; i <= n; i++){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 10088
N = int(input())
x = [1,2,3,4,5,6,7,8,9]
t = [1,2,3,4,5,6,7,8,9]
c = "No"
for y in range(len(x)):
  for z in range(len(t)):
    if N == (x[y]*t[z]):
      c = "Yes"
      break
print(c)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

/* UnionFind */

struct UnionFind{
  vector<int> data, tree_size;
  UnionFind(int s):data(s,-1),tree_size(s,1) {}
  
  int root(int x){
    if(data[x]==-1) return x;
    return data[x]=root(data[x]);
  }
  
  bool set(int x,int y){
    x=root(x);
    y=root(y);
    if(x==y) return false;
    data[y]=x;
    tree_size[x] += tree_size[y];
    tree_size[y] = 0;
    return true;
  }
  
  bool check(int x,int y){
    x=root(x);
    y=root(y);
    return x==y;
  }
  
  int size(int x){
    return tree_size[root(x)];
  }
  
};


int main(){
  int n,m;
  int a,b;
  
  scanf("%d%d",&n,&m);

  UnionFind uf(n);

  for(int i=0;i<m;i++){
    scanf("%d%d",&a,&b);
    a--; b--;

    uf.set(a,b);
  }

  ll p = uf.size(0);
  ll q = uf.size(1);

  p = min(p,q);
  
  ll ans = p * (p-1)/2 + (n-p) * (n-p-1)/2;

  printf("%lld\n",ans - m);
  
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using ll = long long;
const int INF_INT = 100000000;
const ll INF_LL = 1000000000000;
#define fir first
#define sec second


int main()
{
    int n;
    std::cin >> n;
    if(n & 1){
        std::cout << (n / 2) * (n / 2 + 1) << std::endl; 
    }else{
        std::cout << (n / 2) * (n / 2) << std::endl;
    }
}


Measured memory_bytes: 256
import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

# available on Google, not available on Codeforces
# import numpy as np
# import scipy


def solve(arr,brr,k):  # fix inputs here
    console("----- solving ------")
    arr = [a-1 for a in arr]

    console(arr)
    console(brr)
    console(k)

    if all(b <= 0 for b in brr):
        return max(brr)

    visited = [False for _ in arr]
    cycles = []

    for start,_ in enumerate(arr):
        if visited[start]:
            continue
        cur_cycle = [start]
        current = start
        visited[current] = True

        while arr[current] != start:
            current = arr[current]
            cur_cycle.append(current)
            visited[current] = True
        
        cycles.append(cur_cycle)

    res = -float("inf")

    for cycle in cycles:
        console(cycle)

        cs = 0
        psum = []
        for idx in cycle+cycle:
            cs += brr[idx]
            psum.append(cs)
        
        lengths = [-float("inf") for i in cycle]
        for start,_ in enumerate(cycle):
            for length,_ in enumerate(cycle):
                lengths[length] = max(lengths[length], psum[start+length] - psum[start])
    
        console([brr[idx] for idx in cycle])
        full_cycle = sum([brr[idx] for idx in cycle])

        if k < len(cycle) or full_cycle <= 0:
            curres = max(lengths[:k+1])
            console(curres)
            res = max(res, curres)
            continue
        
        console(lengths, full_cycle)

        num_cycles = (k // len(cycle)) - 1
        res_baseline = num_cycles * full_cycle
        remainder = k % len(cycle)

        curres1 = res_baseline + max(lengths)
        curres2 = res_baseline + full_cycle + max(lengths[:remainder+1])

        console(curres1)
        console(curres2)

        curres = max(curres1, curres2)
        console(curres)
        res = max(res, curres)

    console(cycles)

    # return a string (i.e. not a list or matrix)
    return int(res)  


def console(*args):  # the judge will not read these print statement
    # print('\033[36m', *args, '\033[0m', file=sys.stderr)
    return

# fast read all
# sys.stdin.readlines()

for case_num in [1]:
    # read line as a string
    # strr = input()

    # read line as an integer
    # k = int(input())
    
    # read one line and parse each word as a string
    # lst = input().split()

    # read one line and parse each word as an integer
    _,k = list(map(int,input().split()))
    arr = list(map(int,input().split()))
    brr = list(map(int,input().split()))

    # read matrix and parse as integers (after reading read nrows)
    # lst = list(map(int,input().split()))
    # nrows = lst[0]  # index containing information, please change
    # grid = []
    # for _ in range(nrows):
    #     grid.append(list(map(int,input().split())))

    res = solve(arr,brr,k)  # please change
    
    # Google - case number required
    # print("Case #{}: {}".format(case_num+1, res))

    # Codeforces - no case number required
    print(res)


Measured memory_bytes: 79608
[n,q] = map(int,input().split())
 
t = [ 0 for _ in range(n) ]
 
max_idx = 0
max_val = 0
 
for _ in range(q):
    [a,v] = map(int,input().split())
    t[a-1] += v
 
    if max_idx == a-1:
        if v > 0:
            max_val = t[a-1]
        else:
            max_val = max(t)
            max_idx = t.index(max_val)
    elif t[a-1] > max_val:
        max_val = t[a-1]
        max_idx = a-1
    elif t[a-1] == max_val:
        if a-1 < max_idx:
            max_val = t[a-1]
            max_idx = a-1
 
    print("{} {}".format(max_idx+1,max_val))


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

int main() {
  long a,v,b,w,t,x;
  cin >> a >> v >> b >> w >> t;
    x = v-w;
  if(w>v){
    cout << "NO" << endl;
  }
  
  
  else{
    if(a>=b){
      if(a-b<=x*t){
       cout << "YES" << endl; 
      }
      else{
       cout << "NO" << endl; 
      }
    }
    
    else{
     if(b-a<=x*t){
       cout << "YES" << endl;
     }
      else{
       cout << "NO" << endl; 
      }
    }
    
  }
}


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

int main() {
	string N;
	cin >> N;
	
	
	
	if (N[0]=='7' || N[1]=='7' || N[2]=='7') {
	cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	
	// your code goes here
	return 0;
}																																																																																																														

Measured memory_bytes: 3604
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
  int N, X, T;
  cin >> N >> X >> T;
  int i = N / X;
  if (N % X != 0) i++;
  cout << i * T;
  return 0;
}

Measured memory_bytes: 3596
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	
	apos,zpos := 0,0
	
	ajudge := true
	for i,v := range s {
		if v == 'A' && ajudge{
			apos = i
			ajudge = false
		}
		if v == 'Z' {
			zpos = i
		}
	}
	fmt.Println(zpos - apos + 1)
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
  
	int n, k;cin >> n >> k;
	int ans = k;
	forn(i, n - 1){
		ans *= (k - 1);
	}
	cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll h,w;
ll direction2[4][2]={{1,0},{0,1},{0,-1},{-1,0}};
bool valid(int a,int b)
{
    if(a>=1&&a<=h&&b>=1&&b<=w)return true;
    else return false;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll l1[n+1];
    for(int i=1;i<=n;i++){
        cin>>l1[i];
    }
    ll j=0;
    while(1){
        if((k*(j+1)-j)>=n){
            cout<<j+1;return 0;
        }j++;
    }
}


Measured memory_bytes: 4272
n = int(input())

t, x, y = 0, 0, 0
for _ in range(n):
  _t, _x, _y = map(int, input().rstrip().split())
  dxy = abs(_x - x) + abs(_y - y)
  dt = _t - t
  
  if dxy == dt:
    pass
  elif dxy > dt:
    print('No')
    exit()
  else:
    if (dxy % 2 == 0) and (dt % 2 == 0):
      pass
    elif ((dxy - 1) % 2 == 0) and ((dt - 1) % 2 == 0):
      pass
    else:
      print('No')
      exit()
  
  x = _x
  y = _y
  t = _t
      
print('Yes')
  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int X,t;cin>>X>>t;
  
  if(X>=t){
    cout<<X-t<<endl;
  }
  else{
    cout<<0<<endl;
  }
}

Measured memory_bytes: 3564
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(__typeof((X).begin()) it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)x.size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<int,int> pi;
typedef stringstream sst;
typedef vector<int> vi;

ll N,H,d[100010],h[100010],sumd[100010];

struct segtree{
	ll x;
	int l,r;
	segtree *cl,*cr;
	
	segtree(int l,int r): l(l),r(r){
		if(l+1==r){
			x=h[l];
			return;
		}
		cl=new segtree(l,l+r>>1);
		cr=new segtree(l+r>>1,r);
		x=max(cl->x,cr->x);
	}
	
	void change(int pos,ll v){
		if(pos<l || r<=pos){
			return;
		}
		if(l+1==r){
			x=v;
			return;
		}
		cl->change(pos,v);
		cr->change(pos,v);
		x=max(cl->x,cr->x);
	}
	
	ll query(int L,int R,int& ind){
		if(R<=l || r<=L){
			return -INF*INF;
		}
		if(l+1==r){
			ind=l;
			return x;
		}
		int ind1,ind2;
		ll res1 = cl->query(L,R,ind1);
		ll res2 = cr->query(L,R,ind2);
		if(res1 >= res2){
			ind=ind1;
			return res1;
		}
		ind=ind2;
		return res2;
	}
} *root;

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	cin>>N>>H;
	rep(i,N-1){
		cin>>d[i]>>h[i];
		sumd[i+1]=sumd[i]+d[i];
	}
	root=new segtree(0,N-1);
	ll ans=0,hp=H,from=0;
	rep(i,N-1){
		hp-=d[i];
		//cout<<hp<<" "<<ans<<" "<<from<<endl;
		while(hp<=0){
			ll need=1-hp;
			int ind;
			ll maxi=root->query(from,i+1,ind);
			from=ind;
			ll HPpre=hp+sumd[i+1]-sumd[ind];
			//cout<<hp<<" "<<HPpre<<endl;
			//cout<<from<<" - "<<i<<" : "<<maxi<<"("<<ind<<")"<<endl;
			ll maxtime=(H-HPpre)/maxi;
			ll want=(need+maxi-1)/maxi;
			//cout<<maxtime<<" "<<want<<endl;
			if(want <= maxtime){
				ans+=want;
				hp=min(H,hp+want*maxi);
				break;
			}else{
				ll rest=(H-HPpre)%maxi;
				root->change(ind,rest);
				ans+=maxtime;
				hp+=maxtime*maxi;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 12916
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

r = int(input())

if (r < 1200):
    print("ABC")
elif (r < 2800):
    print("ARC")
else:
    print("AGC")


Measured memory_bytes: 9032
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;

double p[606];
double dp[606];
vector<int> g[606];


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

  for(int i = 0; i < m; i++) {
    int s,t;
    cin >> s >> t;
    --s;--t;
    g[s].push_back(t);
  }

  p[0] = 1;

  for(int i = 0; i < n; i++) {
    double t = g[i].size();
    for(int j = 0; j < g[i].size(); j++) {
      p[g[i][j]] += p[i] / t;
    }
  }

  // for(int i = 0; i < n; i++) cout << p[i] << endl;

  for(int i = n - 2; i >= 0; i--) {
    double pl = 0;
    double t = g[i].size();
    for(int j = 0; j < g[i].size(); j++) {
      pl += dp[g[i][j]];
    }
    dp[i] = pl / t + 1;
  }

  double ans = dp[0];

 
  
  for(int i = 0; i < n; i++) {
    if(g[i].size() == 1) continue;
    for(int j = 0; j < g[i].size(); j++) {
      double N = g[i].size();
      double a = dp[g[i][j]] / N + 1;
      double b = dp[i] - a;
      double c = b * (N / (N - 1)) + 1;
      double T = (dp[i] - c) * p[i];
    
      if(i == 0) ans = min(ans,c);
      else ans = min(ans,dp[0] - T);
    }
  }

  cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 1408
n, k = map(int, input().split())
*x, = map(int, input().split())

i = 0
ans = float("inf")
while  i+k - 1 < n:
    l = x[i]
    r = x[i+k-1]
    ans = min(ans, min(abs(l), abs(r)) + r - l)
    i += 1

print(ans)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,m;
ll k;
int main(void){
    cin>>n>>m;
    k=1900*m+(n-m)*100;
    for(int i=0;i<m;i++){
        k=k*2;
    }
    cout<<k<<endl;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
    string s;cin >> s;
    if(s == "A")
        cout << "T";
    else if(s == "T")
        cout << "A";
    else if(s == "C")
        cout << "G";
    else
        cout << "C";
}

Measured memory_bytes: 256
// たなこふ先生の input マクロ (´･_･`)
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: usize,
        b: usize,
    }

    println!("{}", if b % a == 0 { a + b } else { b - a } );
}


Measured memory_bytes: 4352
/**
 *    author:  tourist
 *    created: 15.12.2019 11:28:41       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, tt;
  cin >> n >> tt;
  vector<vector<int>> can(n, vector<int>(2, 0));
  can[0][0] = 1;
  can[1][1] = 1;
  while (tt--) {
    int x, y;
    cin >> x >> y;
    --x; --y;
    swap(can[x], can[y]);
    for (int z : {x, y, x - 1, x + 1, y - 1, y + 1}) {
      if (z >= 0 && z < n && can[z][0]) {
        if (z - 1 >= 0) can[z - 1][1] = 1;
        if (z + 1 < n) can[z + 1][1] = 1;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += can[i][0] | can[i][1];
  }
  cout << ans << '\n';
  return 0;
}


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

#ifdef DEBUG
#include "../include/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if (abs(a - c) <= d) {
        cout << "Yes" << endl;
        return 0;
    }

    if (abs(a - b) <= d && abs(b - c) <= d) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AOZ
{
	class MainClass
	{
		static void Main(string[] args)
		{

			{
				StringBuilder output = new StringBuilder();
				while (true)
				{
					var input_arr = Console.ReadLine().Split(' ');
					int a = int.Parse(input_arr[0]); string op = input_arr[1]; int b = int.Parse(input_arr[2]);

					double answer;
					switch (op)
					{
						case "+":
							answer = a + b;
							break;
						case "-":
							answer = a - b;
							break;
						case "*":
							answer = a * b;
							break;
						case "/":
							answer = a / b;
							break;
						case "?":
							Console.Write(output.ToString());
							return;
						default:
							return;
					}
					output.AppendLine(answer.ToString("0"));
				}
			}
		}
	}
}



Measured memory_bytes: 18040
def check(x, A, K):
    import math
    sumA = 0
    for a in A:
        if a > x:
            sumA += math.ceil(a / x) - 1
    if sumA <= K:
        return True
    else:
        return False


def resolve():
    _, K = [int(i) for i in input().split()]
    A = [int(i) for i in input().split()]

    ok = max(A)  # maxVal when minimize
    ng = -1  # maxVal when maximize
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if mid > 0 and check(mid, A, K):
            ok = mid
        else:
            ng = mid
    print(ok)


resolve()


Measured memory_bytes: 30792
#include <bits/stdc++.h>
using namespace std;
int main () {
  int X, Y;
  cin >> X >> Y;
  for(int i = 0; i <= X; i++){
    if(Y == i * 2 + (X - i) * 4){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3652
N=int(input())
A=list(map(int,input().split()))
count=0
flag=0
while flag==0:
    for i in range(N):
        if (A[i]%2==0):
            A[i]=int(A[i]/2)
        else:
            flag=1
            count=count-1
            break
    count = count + 1
print(count)

Measured memory_bytes: 38896
X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

ans = sum(P[:X])+sum(Q[:Y])
pt_x,pt_y = X-1,Y-1
for r in range(len(R)):
    if pt_x >= 0 and pt_y >= 0:
        if P[pt_x] < Q[pt_y]:
            if P[pt_x] < R[r]:
                ans = ans + R[r] - P[pt_x]
                pt_x -= 1
        else:
            if Q[pt_y] < R[r]:
                ans = ans + R[r] - Q[pt_y]
                pt_y -= 1
    elif pt_x >= 0:
        if P[pt_x] < R[r]:
            ans = ans + R[r] - P[pt_x]
            pt_x -= 1
        else:
            break
    elif pt_y >= 0:
        if Q[pt_y] < R[r]:
            ans = ans + R[r] - Q[pt_y]
            pt_y -= 1
        else:
            break
    else:
        break

print(ans)


Measured memory_bytes: 22720
#include <bits/stdc++.h>
using namespace std;
 
#define N 200010
int n, a[N], Bit[50];
unordered_map <int, int> mp; 
 
int main()
{
    Bit[0] = 1;
    for (int i = 1; i <= 30; ++i) Bit[i] = Bit[i - 1] << 1;
    while (scanf("%d", &n) != EOF)
    {
        mp.clear();
        for (int i = 1; i <= n; ++i)  
        {
            scanf("%d", &a[i]);
            ++mp[a[i]];
        }
        sort(a + 1, a + 1 + n);
        int res = 0; 
        for (int i = n; i >= 1; --i) 
        {
            int pos = upper_bound(Bit, Bit + 30, a[i]) - Bit;
            //cout << a[i] << " " << Bit[pos] << endl;
            if (pos >= 31 || mp[a[i]] == 0) continue;
            int tar = Bit[pos] - a[i]; 
            if ((tar != a[i] && mp[tar]) || (tar == a[i] && mp[tar] > 1)) 
            {
                ++res; 
                --mp[tar];
            }    
            --mp[a[i]]; 
        }
        printf("%d\n", res);
    }
    return 0;
}

Measured memory_bytes: 17524
import copy

data = raw_input()
n,ma,mb = map(int,data.split(" "))

ans = {}

for x in range(n):
  data = raw_input()
  a,b,c = map(int,data.split(" "))

  q = a*mb - b*ma
  d = []

  for x in ans:
    d.append( [x,ans[x]] )
  for x in d:
    if x[0]+q in ans:
      ans[ x[0]+q ] = min(ans[x[0]+q], x[1]+c )
    else:
      ans[ x[0]+q ] = x[1]+c
  if q in ans:
    ans[q] = min(ans[q],c)
  else:
    ans[q] = c

if 0 in ans:
  print ans[0]
else:
  print -1



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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, A, B;
    cin >> N >> A >> B;
    ll m = N / (A + B);
    ll ans = m * A + std::min(N - m * (A + B), A);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256