akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;
int main(){
	int t = 0;
	int k = 0;
	int s = 0;
	int i = 0;
	int sa = 0;
	int th[100];
	int kh[100];
	int sh[100];
	while (true){
		cin >> th[i] >> kh[i] >> sh[i];
		if (th[i] == -1 && kh[i] == -1 && sh[i] == -1){
			break;
		}
		t = th[i];
		k = kh[i];
		s = sh[i];
		if (th[i] == -1 && kh[i] != -1 && sh[i] != -1){
			if (i == 0){
				sa = sa + 10;
			}
			sa = sa + 1;
			t = t + 1;
		}
		else if (th[i] != -1 && kh[i] == -1 && sh[i] != -1){
			if (i == 0){
				sa = sa + 20;
			}
			sa = sa + 1;
			k = k + 1;
		}
		else if (th[i] != -1 && kh[i] != -1 && sh[i] == -1){
			if (i == 0){
				sa = sa + 30;
			}
			sa = sa + 1;
			s = s + 1;
		}
		i++;
		if (t == -1 || k == -1){
			cout << "F" << endl;
		}
		else{
			if (t + k >= 80){
				cout << "A" << endl;
			}
			else if (t + k >= 65){
				cout << "B" << endl;
			}
			else if (t + k >= 50){
				cout << "C" << endl;
			}
			else if (s >= 50){
				cout << "C" << endl;
			}
			else if (t + k >= 30){
				cout << "D" << endl;
			}
			else if (t + k <= 30 && t + k >= 0){
				cout << "F" << endl;
			}
		}
	}
}

Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;
string i;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin >>a;
  b=a*800;
  a=a/15;
  cout <<b-a*200<<'\n';
  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++)
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 ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
  ll n;
  cin >> n;
  vector <string> v(n);
  rep(i, n) cin >> v.at(i);
  sort(v.begin(), v.end());
  vector <pair<ll, string>> data;
  ll tmp = 1;
  rep(i, n-1) {
    if (i != n-2) {
      if (v.at(i) == v.at(i+1)) {
        tmp++;
      } else {
        data.push_back(make_pair(tmp, v.at(i)));
        tmp = 1;
      }
    } else {
      if (v.at(i) == v.at(i+1)) {
        tmp++;
        data.push_back(make_pair(tmp, v.at(i)));
      } else {
        data.push_back(make_pair(tmp, v.at(i)));
        data.push_back(make_pair(1, v.at(i+1)));
      }
    }
  }
  sort(data.begin(), data.end());
  ll max = data.at(data.size()-1).first;
  vector <string> ans;
  rep(i, data.size()) {
    if (max == data.at(i).first) {
      ans.push_back(data.at(i).second);
    }
  }
  sort(ans.begin(), ans.end());
  rep(i, ans.size()) cout << ans.at(i) << endl;
}

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

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

    for(int i=0; i<s.length(); ++i){
        s[i] -= 'A';
        s[i] += n;
        s[i] %= 26;
        s[i] += 'A';
    }
    cout << s << "\n";
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);	
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll qw(ll x,ll y){ll res = 1;while(y){if(y & 1) res *= x;x = x * x;y >>= 1;}return res;}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){if(x < 2) return 0; for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
double x;
void solve(){
	double t = 100;
	for(int i = 1;i <= 3800;i++){
		t *= 1.01;
		t = floor(t);
		if(t >= x){
			cout << i << endl;
			return;
		}
	}
	return;
}
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> x;
	solve();
	return 0;
}
//do smt instead of nothing! never give up!


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

using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;

int main() {
    int n;
    cin >> n;
    char a[n];
    char b[n];

    rep(i,n) {
        cin >> a[i];
    }

    rep(i,n) {
        cin >> b[i];
    }

    rep(i,n) {
        cout << a[i] << b[i];
    }
    cout << endl;
    return 0;   
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
     
using namespace std;
     
typedef long long ll;
typedef pair<int, int> pii;
     
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
     
mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());

const int N = (int)1e5 + 1;
const int D = 11;
int col[N][D];

vector<int> T[N];

void dfs(int u, int di, int co){
    if(col[u][di] > 0){
        return;
    }
    col[u][di] = co;
    if(di>0){
        dfs(u,di-1,co);
        for(auto x : T[u]){
            dfs(x,di-1,co);
        }
    }
}

int main(){
    fastIO;
    int n, m, q;
    cin >> n >> m;
    int u, v;
    for(int i = 0 ; i < m ; i ++ ){
        cin >> u >> v;
        T[u].push_back(v);
        T[v].push_back(u);
    }
    cin >> q;
    int vr[q], di[q], cl[q];
    for(int i = 0 ; i < q; i ++ ){
        cin >> vr[i] >> di[i] >> cl[i];
    }
    for(int i = q - 1 ;i >= 0 ; i -- ){
        dfs(vr[i], di[i], cl[i]);
    }
    for(int i = 1; i <= n; i ++ )
        cout << col[i][0] << "\n";
    return 0;
}

Measured memory_bytes: 12024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();

		String[] aa = n.split("");
		int ans = 0;
		boolean flag = true;

		for(String str:aa) {
			if(str.equals("R")) {
				if(flag) {
					ans++;
				}else {
					ans = 1;
					flag = true;
				}
			}else {
				flag = false;
			}
		}
		System.out.println(ans);

	}
}

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

int main(){
    string s,t,u;
    cin>>s>>t;
    u=s+s;
    for(int i=0;i<s.size();i++){
        if(u.substr(i,s.size())==t){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int Y = scan.nextInt();
		int Z = scan.nextInt();

		System.out.println(Z + " " + X + " " + Y);
	}

}

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

int main(){
    int D,T,S;
    cin>>D>>T>>S;
    int temp = 0;
    if(D%S==0){
        temp = 1;
    }
    if(temp==1){
        if(D/S<=T){
            cout<<"Yes";
        }
        else{
            cout<<"No";
        }
    }
    else{
        if(D/S<T){
            cout<<"Yes";
        }
        else{
            cout<<"No";
        }
    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstring>
using namespace std;


int main(){
    char s[ 2 ][ 10 ];
    for( int i = 0; i < 2; i++ )
        cin >> s[ i ];
    int k = strcmp( s[ 0 ], s[ 1 ] );
    if( k > 0 ) cout << ">" << endl;
    else if( k == 0 ) cout << "=" << endl;
    else cout << "<" << endl;
}

Measured memory_bytes: 256
H, W=map(int, input().split())
maxK=80*80+1
A=[list(map(int, input().split())) for _ in range(H)]
B=[list(map(int, input().split())) for _ in range(H)]
C=[[abs(A[i][j]-B[i][j]) for j in range(W)] for i in range(H)]
dp=[[[0 for _ in range(maxK+1)] for _ in range(W+1)] for _ in range(H+1)]
dp[1][1][C[0][0]]=1
for i in range(1, H+1):
    for j in range(1, W+1):
        for k in range(maxK):
            if dp[i-1][j][k]==1 or dp[i][j-1][k]==1:
                k_candidate1, k_candidate2=abs(k-C[i-1][j-1]), abs(k+C[i-1][j-1])
                if k_candidate1<maxK:
                    dp[i][j][k_candidate1]=1
                if k_candidate2<maxK:
                    dp[i][j][k_candidate2]=1
for k in range(maxK):
    if dp[H][W][k]==1:
        print(k)
        break

Measured memory_bytes: 386952
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long


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

    int x; cin >> x;
    int k = 0;
    for(int i = 1;;i ++){
        k += i;
        if(k >= x){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  map<int, int> mp;
  rep(i, n){
    int in;
    cin >> in;
    mp[in-1]++;
    mp[in]++;
    mp[in+1]++;
  }
  int ans = 0, mx = 0;
  repit(itr, mp){
    if(itr->second > mx){
      ans = itr->first;
      mx = itr->second;
    }
  }
  cout << mx << endl;
  return 0;
}

Measured memory_bytes: 7992
A,B = map(int,input().split())
c = 0
ana = 0
if B == 1 :
    print("0")
    exit()
for i in range(1000):
    if i == 0:
        c+= 1
        ana += A
    else:
        c+= 1
        ana += A-1
    if ana >= B:
        break
print(c)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":"\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
template <class T> bool chmax(T &a,const T &b) {if(a<b) {a=b;return 1;} return 0;}
template <class T> bool chmin(T &a,const T &b) {if(b<a) {a=b;return 1;} return 0;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N,K;
    cin>>N>>K;
    vector<int> w(N),d(N);
    REP(i,N) {
        cin>>w[i]>>d[i];
    }

    int L=-1,R=2'000'000'000'000'000'000;
    while(R-L>1) {
        int M=(L+R)/2;
        int cnt=0;
        REP(i,N) {
            int dist=M-w[i];
            if(dist<0) continue;
            int t=dist/d[i]+1;
            cnt+=t;
        }
        if(cnt>=K) {
            R=M;
        } else {
            L=M;
        }
    }
    cout<<R<<endl;
    return 0;
}


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

int main(){
	int n;
	cin>>n;
	int arr[n];
	for(int i=0; i<n; i++) cin>>arr[i];
	for(int i=1; i<=n; i++) arr[i-1]-=i;
	sort(arr,arr+n);
	int p1 = 0;
	int p2 = n-1;
	long long total = 0;
	while(p1<p2){
		total+=arr[p2]-arr[p1];
		p2--;
		p1++;
	}
	cout<<total;
}

Measured memory_bytes: 3928
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define INF 99999999
int main()
{
    ll a,b;
    cin >> a >> b;
    ll tmp1,tmp2;
    vector<pair <ll,ll> > c(a);
    for(ll i = 0;i < a;i++)
    {
        cin >> tmp1>> tmp2;
        c[i] = make_pair(tmp1,tmp2);
    }
    ll ans = 0;
    sort(c.begin(),c.end());
    for(ll i = 0;i < c.size();i++)
    {
        if(c[i].second >= b)
        {
            ans += c[i].first * b;
            cout << ans << endl;
            return 0;
        }
        else
        {
            ans += c[i].first * c[i].second;
            b -= c[i].second;
        }
    }
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
typedef long long ll;
int a, b;
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    cin >> a >> b;
    if((a + b) % 3 == 0 || a % 3 == 0 || b % 3 == 0)puts("Possible");
    else puts("Impossible");
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void swap(int A[], int i, int j)
{
    int tmp = A[j];
    A[j] = A[i];
    A[i] = tmp;
}

int selectionSort(int n, int A[])
{
    int count = 0;
    int i, j;
    for (i = 0; i < n; i++) {
        int m = i;
        for (j = i+1; j < n; j++) {
            if (A[m] > A[j]) {
                m = j;
            }
        }
        if (m != i) {
            swap(A, i, m);
            count++;
        }
    }
    return count;
}

int main()
{
    int i;
    int N;
    int A[100];
    scanf("%d", &N);
    for (i = 0; i < N ;i++) {
        scanf("%d", &A[i]);
    }
    
    int count = selectionSort(N, A);
    for (i = 0; i < N ;i++) {
        if (i > 0) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n%d\n", count);
        
    return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll long long int
#define endl "\n"
#define db(x) cout<<#x<<" ->"<<x<<endl
#define db2(x,y) cout<<#x<<"->"<<x<<", "<<#y<<" -> "<<y<<endl
#define db3(x,y,z) cout<<#x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define db4(w,x,y,z) cout<<#w <<" -> " << w << " , " << #x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define prt(x) for(auto it = x.begin(); it!=x.end(); it++) { cout<<*it<<" "; } cout<< endl
#define IN freopen("input.txt","r",stdin)
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = (int)2e5+5;
int cnt[N];
int ara[N];
ll bal[N];

int32_t main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
//    IN;
    double l;
    cin >> l;
    cout <<fixed << setprecision(10) <<  (l/3.0) * (l/3.0) * (l/3.0) << endl;
    return 0;
}


Measured memory_bytes: 256
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

import re
# import numpy as np
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 # 10^9 + 7

# W行H列, x[W][H]
def create_grid(W, H, value = 0):
    return [[ value for _ in range(H)] for _ in range(W)]

########

A, B = l_inpl()

if (A+B)%2 == 0:
    print((A+B)//2)
else:
    print("IMPOSSIBLE")

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

ll a, b, c, d, e, f;

bool soluble(ll sugar, ll water) {
    if(100*sugar <= water*e) return true;
    else return false;
}

double density(double sugar, double water) {
    double temp = sugar;
    temp /= (sugar + water);
    temp *= 100.0;
    return temp;
}

void solve() {
    double ans = -1000000000;
    ll ans1, ans2;

    for(ll ai = 0; ai<=f; ai += 100*a) {
        for(ll bi = 0; ai + bi<=f; bi += 100*b) {
            if(!(ai + bi)) continue;
            ll water = ai + bi;

            for(ll ci = 0; water + ci <= f; ci += c) {
                if(100*ci > water*e) continue;

                for(ll di = 0; water + ci + di <= f && soluble(ci + di, water); di += d) {
                    ll solute = ci + di;
                    if(density(solute, water) > ans) {
                        ans = density(solute, water);
                        ans1 = solute + water;
                        ans2 = solute;
                    }
                }
//                if(soluble(f - water, water)) di = f - water - ci;
//                else di = water*e - 1

            }
        }
    }

    cout<<ans1<<" "<<ans2<<endl;
}

int main() {
    cin>>a>>b>>c>>d>>e>>f;
    solve();
    return 0;
}


Measured memory_bytes: 256
N=int(input())
H=list(map(int, input().split()))
Z=0
count=0
for i in range(N-1):
    A=H[i+1]
    B=H[i]-1
    if A < B:
        print('No')
        Z=Z+1
        break
    if A == B:
        count=count+1
        if count >=2 and A < C:
            print('No')
            Z=Z+1
            break
        else:
            C=A
if Z == 0:
    print('Yes')

Measured memory_bytes: 14252
import numpy as np
       
N = input()
A = np.array([int(x) for x in input().split(" ")])

if len(np.where(A<0)[0])%2 == 0:
  print(np.abs(A).sum())
else:
  print(np.abs(A).sum() - np.abs(A).min()*2)

Measured memory_bytes: 23324
t_num = 4
f_num = 3
r_num = 10
m_dict = dict()
for i in range(t_num):
    m_dict.setdefault(i+1,list())
    for j in range(f_num):
        m_dict[i+1].append([0]*r_num)
n = input()

for i in range(int(n)):
    a = input()
    IOinfo = a.split()
    b,f,r,v = IOinfo
    tou = int(b)
    flo = int(f)
    rnm = int(r)
    vis = int(v)
    m_dict[tou][flo-1][rnm-1] = m_dict[tou][flo-1][rnm-1] + vis
else:
    for t in range(t_num):
        for f in range(f_num):
            out_c = ''
            for r in range(r_num):
                v = m_dict[t+1][f][r]
                out_c = '{} {}'.format(out_c,v)
            else:
                print(out_c)
        else:
            if t < t_num-1:
                out_m = '#'*20
                print(out_m)


Measured memory_bytes: 5604
from collections import defaultdict
money = defaultdict(int)
for i, m in enumerate([300000, 200000, 100000]):  
    money[i] = m
    
X, Y = map(int, input().split())
X -= 1; Y -= 1
ans = money[X] + money[Y]
if X + Y:
    print(ans)
else:
    print(ans + 400000)

Measured memory_bytes: 3316
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N, M;
int P[MAX], Y[MAX];
vector<int> py[MAX];

int main() {
    cin >> N >> M;
    rep(i, M) {
        cin >> P[i] >> Y[i];
        py[P[i]].push_back(Y[i]);
    }

    rep(i, 1, N + 1) {
        auto& v = py[i];
        sort(all(v));
    }

    rep(i, M) {
        auto& v = py[P[i]];
        int j = int(lower_bound(all(v), Y[i]) - v.begin());

        printf("%06d", P[i]);
        printf("%06d\n", j + 1);
    }
}

Measured memory_bytes: 7808
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n, t; cin >> n >> t;
	ll a[n];
	for(ll i = 0; i < n; ++i)cin >> a[i];
	ll ma[n];
	ma[n - 1] = a[n - 1];
	for(ll i = n - 2; i >= 0; --i) ma[i] = max(ma[i + 1], a[i]);
	ll po[n];
	for(ll i = 0; i < n; ++i)po[i] = (ma[i] - a[i]) * t;
	sort(po, po + n);
	ll ans = 1;
	for(ll i = n - 1; i >= 1; --i){
		if(po[i] == po[i - 1]) ++ans;
		else break;
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair
using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

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

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

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

vector<pair<ll, int>> prime_div(ll n){
  vector<pair<ll, int>> res;
  for (ll i=2; i*i <= n;i++){
    if (n%i == 0){
      int a = 0;
      while(n%i == 0){
        n /= i;
        a++;
      }
      pair<ll, int> tmp;
      tmp.first = i;
      tmp.second = a;
      res.push_back(tmp);
    }
  }
  if (n != 1){
    pair<ll, int> now;
    now.first = n;
    now.second = 1;
    res.push_back(now);}
  return res;
}


// printf("%.10f\n" , ans);
int main(void){
  ios::sync_with_stdio(false);
  int n_max = 2000010;
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  vector<int> val(n_max, 0);
  REP(i, n){
    val[a[i]]++;
  }
  sort(val.rbegin(), val.rend());
  int tmp = 0;
  REP(i, k){
    tmp += val[i];
  }
  int ans = n - tmp;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 11880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=3e5+5;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n;cin>>n;
    ll gcd=0,x;
    for(ll i=0;i<n;i++)cin>>x,gcd=__gcd(gcd,x);
    cout<<gcd;
}



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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 5e3 + 9, M = 5e3 + 9, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;

int n, k, a[N], dp[N][N], temp;

//int solve(int i, int sum){
//    if(i == n)  return (sum >= k - temp && sum < k);
//
//    int &ret = dp[i][sum];
//    if(~ret)    return ret;
//
//    return ret = solve(i + 1, sum) | solve(i + 1, min(k, sum + a[i]));
//}

//int solve(){
//    for(int i = 0;i < N;i++)
//        for(int sum = 0;sum < N;sum++)
//            dp[i][sum] = (sum >= k - temp && sum < k);
//
//    for(int i = N - 2;i >= 0;i--){
//        for(int sum = N - 2;sum >= 0;sum--){
//            dp[i][sum] = dp[i + 1][sum] | dp[i + 1][min(k, sum + a[i])];
//        }
//    }
//
//    return dp[0][0];
//}



bitset<N> sum;

int solve(){
    sum.reset();

    sum[0] = 1;
    for(int i = 0;i < n;i++)
        sum |= sum << a[i];

    for(int i = k - temp;i <= k - 1;i++)
        if(sum[i])  return 1;

    return 0;
}


int main(){
    init();

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

    sort(a, a + n);
    while(n - 1 >= 0 && a[n - 1] >= k)  n--;

    int l = 0, r = n - 1;
    while(l <= r){
        int i = (l + r) >> 1;

        temp = a[i];    a[i] = 0;
//        memset(dp, -1, sizeof dp);
        int ok = !(solve());
        a[i] = temp;

        if(ok == 1)
            l = i + 1;
        else
            r = i - 1;
    }

    cout << l;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
#include <stdlib.h>

using namespace std;

int main()
{
	int n, x[1000] = {}, y[1000] = {}, t;
	double p1 = 0, p2 = 0, p3 = 0, pi = 0;

	cin >> n;
	for (int i = 0; i < n; i++) cin >> x[i];
	for (int j = 0; j < n; j++) cin >> y[j];

	for (int k = 0; k < n; k++) {
		t = abs(x[k] - y[k]);
		p1 += t;
		p2 += t * t;
		p3 += t * t * t;
		if (pi < t) pi = t;
	}

	cout << fixed << p1 << endl << sqrt(p2) << endl << cbrt(p3) << endl << pi << endl;

	return 0;
}

Measured memory_bytes: 1264
SEG_LEN = 1 << 18

seg = [0 for i in range(2*SEG_LEN)]

def add(ind, v):
    ind += SEG_LEN
    seg[ind] += v
    while True:
        ind //= 2
        if ind == 0:
            break
        seg[ind] = seg[ind*2] + seg[ind*2+1]

def sum(l, r):
    l += SEG_LEN
    r += SEG_LEN
    ans = 0
    while l < r:
        if (l % 2 == 1):
            ans += seg[l]
            l += 1
        l //= 2
        if r % 2 == 1:
            ans += seg[r-1]
            r -= 1
        r //= 2
    return ans


def main():
    n, q = map(int, input().split())
    ans = []
    for i in range(q):
        com, x, y = map(int, input().split())
        if com == 0:
            add(x, y)
        elif com == 1:
            ans.append(sum(x, y+1))
    for i in range(len(ans)):
        print(ans[i])

    

if __name__ == '__main__':
    main()


Measured memory_bytes: 15076
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair
#define PB push_back

int hon[100];
int m,n;

bool can(int w){
  int dan=1,tw=0;
  rep(i,n){
    if(hon[i]>w)return false;
    if(tw+hon[i]<=w)tw+=hon[i];
    else{
      tw=hon[i];
      ++dan;
    }
    //cout<<dan<<" "<<tw<<endl;
    if(dan>m)return false;
  }
  return true;
}

main(){
  while(cin>>m>>n,m){
    rep(i,n)cin>>hon[i];

    int l=0,r=1500000;

    while(l<r){
      int mid=(l+r)/2;
      //cout<<mid<<endl;
      if(can(mid))r=mid;
      else l=mid+1;
    }
    cout<<l<<endl;
  }
}

Measured memory_bytes: 0
a=[0]*5
for _ in range(int(input())):
    s=input()
    if s=="AC":
        a[0]+=1
    elif s=="TLE":
        a[1]+=1
    elif s=="WA":
        a[2]+=1
    else:
        a[3]+=1
        
print("AC x"+ " " +str(a[0]))
print("WA x" + " " + str(a[2]))
print("TLE x" + " " + str(a[1]))
print("RE x" + " " + str(a[3]))


Measured memory_bytes: 69804
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<assert.h>
#include<stdlib.h>
#include<stack>
using namespace std;
/*********************Contest Template***********************/
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef pair<int,int> Cord;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(0);
struct S{
    int a,b; S(){}S(int _a,int _b){
        a=_a;
        b=_b;
    }
    const bool operator<(const S &o) const{
        return a<o.a;
    }
};
priority_queue<int,vector<int>,greater<int>> mpq;
#define SPACE 0
#define NL 1
inline void showAll(vector<int> &v,int NL_or_space){ 
    //0 is space, 1 is NL
    for(int &here:v){
        printf("%d",here);
        printf("%c",(NL_or_space)?'\n':' ');
    }
}
/*********************Contest Template***********************/
const int SIZE= 100009;

int arr[SIZE],pref[SIZE],suf[SIZE];

int getGCD(int a,int b){
    return (b==0)?a:getGCD(b,a%b);
}

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

    for(int i=1 ; i<=n ; i++)
        scanf("%d",&arr[i]);

    // int G=0;
    for(int i=1 ; i<=n ; i++){
        pref[i]=getGCD(pref[i-1],arr[i]);
    }

    for(int i=n ; i ; i--){
        suf[i]=getGCD(suf[i+1],arr[i]);
    }

    int ans=0;
    for(int i=1 ; i<=n ; i++){
        int res=getGCD(pref[i-1],suf[i+1]);
        ans=max(ans,res);
    }
    printf("%d\n",ans);

    return 0;
}



Measured memory_bytes: 1408
X,K,D = map(int,input().split())
X = abs(X)
a = int(X/D)
if a < K:
        K -= a
        X -= a*D

if K*D <= X:
    X -= K*D
else:
    K %= 2
    for i in range(K):
        if X > 0:
            X -= D
        else:
            X += D
print(abs(X))

Measured memory_bytes: 9196
#include <iostream>
using namespace std;
int main()
{
	long i,n,x,sum=0,ans=0;
	cin >> n >> x;
	long l[n+1];

	for(i=0;i<n;i++){
		cin >> l[i];
	} 
	for(i=0;sum<=x;i++){
		sum += l[i];
		ans++;
	} 

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
H,W=[int(i) for i in input().split()]
A=[]
for i in range(H):
    s=input()
    S=list(s)
    A.append(S)
for i in range(H):
    for j in range(W):
        if A[i][j]!="#":            
            s=0
            for k in range(-1,2):
                for l in range(-1,2):
                    if k==0 and l==0:
                        continue
                    if i+k>=0 and i+k<=H-1 and j+l>=0 and j+l<=W-1:
                        if A[i+k][j+l]=="#":
                            s+=1
            A[i][j]=str(s)
for i in range(H):
    for j in range(W):
        print(A[i][j],end="")
    print()                        


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

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> A(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&A[i]);
	}
	ll res = 0, now = -1;
	for (ll i = N-1; i >= 0; i--) {
		now--;
		if (A[i] > i || now > A[i]) {
			cout << "-1" << endl;
			return 0;
		} 

		if (now < A[i]) {
			res += A[i];
		}
		now = max(now, A[i]);
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 1792
import java.util.*;
public class Main {
	
	public static class unionfind{
		int[] parent;
		int[] rank;
		int[] size;
		public unionfind(int n){
			this.parent = new int[n+1];
			this.rank = new int[n+1];
			this.size = new int[n+1];
			for(int i = 1; i <= n; i++) set(i);
		}
		public void set(int i) {
			parent[i] = i;
			rank[i] = 0;
			size[i] = 1;
		}
		public int find(int i) {
			if (i == parent[i])
				return parent[i];
			else
				return parent[i] = find(parent[i]);
			
		}
		public void unite(int x, int y) {
			int xroot = find(x);
			int yroot = find(y);
			if(xroot == yroot)
				return;
			if(rank[xroot] > rank[yroot]) {
				parent[yroot] = xroot;
				size[xroot] += size[yroot];
			}
			else if(rank[xroot] < rank[yroot]) {
				parent[xroot] = yroot;
				size[yroot] += size[xroot];
			}
			else {
				parent[yroot] = xroot;
				size[xroot] += size[yroot];
				rank[xroot]++;
			}
		}
		public int getnumber(int i) {
			return size[find(i)];
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] a = new int[M];
		int[] b = new int[M];
		int ans = 0;
		for(int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		for(int i = 0; i < M; i++) {
			unionfind u = new unionfind(N);
			for(int j = 0; j < M; j++) {
				if(j != i)
					u.unite(a[j], b[j]);
			}
			if(u.getnumber(1) != N)
				ans += 1;
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define pb push_back
#define tam 5120
#define offset 320000
#define se second
#define fi first
#define pitem item*
#define forr(i,p,n) for(ll i=p;i<n;i++)
using namespace std;
typedef long long ll;
const ll MOD=1000000009 ;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
typedef pair<ll,ll> ii;

ll dp[100][100];
ll val[100];
const ll EPS=1e-15;
int main()
{
    memset(dp,0,sizeof dp);
    dp[0][0]=1;
    forr(i,1,60)
    {
        dp[i][0]=dp[i][i]=1;
        forr(j,1,i)
        dp[i][j]=dp[i-1][j]+dp[i-1][j-1];
    }
    ll n,iz,der;
    cin>>n>>iz>>der;
    map<ll,ll> mapa;
    forr(i,0,n)
    {
        cin>>val[i];
        mapa[val[i]]++;
    }
    sort(val,val+n);
    reverse(val,val+n);
    ll cond=0;
    forr(i,0,iz)
    {
        cond+=val[i];
    }
    ll tot=cond;

    ii auxcon=ii(cond/__gcd(cond,iz),iz/__gcd(cond,iz));
    ll otrotot=0;
    ll last=0;
    forr(j,0,iz)
        if (val[j]==val[iz-1])
            last++;
    otrotot=dp[mapa[val[iz-1]]][last];
    //cout<<mapa[val[iz-1]]<<" "<<last<<endl;
    //cout<<otrotot<<endl;
    forr(i,iz,der)
    {
        tot+=val[i];    
        last=0;
        forr(j,0,i+1)
        if (val[j]==val[i])
            last++;
        //cout<<0<<" "<<i<<" "<<tot<<" "<<last<<endl;
        if (auxcon==ii(tot/__gcd(tot,i+1),(i+1)/__gcd(tot,i+1)))
        {
            otrotot+=dp[mapa[val[i]]][last];
        }
        
    }
    printf("%.6lf\n",(double)cond/iz);
    cout<<otrotot<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        if (i >= K)
            cout << (A[i - K] < A[i] ? "Yes" : "No") << '\n';
    }

    return 0;
}


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

int main() {
  long long A, B;
  cin >> A >> B;
  
  for (long long i = 1; i <= B; i++) {
  long long N = A * i;
    if (N % B == 0) {
    cout << N << endl;
      break;
    }
  } 
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,a,b;
	scanf("%d",&n);
	if(n==1){
		printf("Hello World\n");
	}
	if(n==2){
		scanf("%d",&a);
		scanf("%d",&b);
		printf("%d\n",b+a);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;

int main()
{
    int a, b;
    int ans = 0;
    cin >> a >> b;
    if (a >= (b + 1))
    {
        ans += 2 * a - 1;
    }
    else if (b >= (a + 1))
    {
        ans += 2 * b - 1;
    }
    else
    {
        ans += (a + b);
    }
    cout << ans << endl;

    return 0;
}


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

using namespace std;
typedef long long ll;
const ll INF = 1e9;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N, 0), L(N + 1, 0), R(N + 1, 0);
    for (int i = 0; i < N; i++) { cin >> A[i]; }

    for (int i = 1; i <= N; i++) {
        L[i] = L[i - 1] == 0 ? A[i - 1] : __gcd(L[i - 1], A[i - 1]);
    }
    for (int j = N - 1; j >= 0; j--) {
        R[j] = R[j + 1] == 0 ? A[j] : __gcd(R[j + 1], A[j]);
    }

    // for (int i = 0; i <= N; i++) cout << L[i] << " ";
    // cout << endl;
    // for (int i = 0; i <= N; i++) cout << R[i] << " ";
    // cout << endl;

    ll mm = -INF;
    for (int i = 0; i < N; i++) {
        ll gcd = L[i] == 0 ? R[i + 1] : (R[i + 1] == 0 ? L[i] : __gcd(L[i], R[i + 1]));
        // mm = max(mm, __gcd(L[i], R[i + 1]));
        mm = max(mm, gcd);
    }
    cout << mm << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
 
int main(){ 
  int q;
  cin>>q;
  int n=100000;
  int arr[n+1];
	for (int i = 0; i < n; i++) {
		arr[i] = 1;
	}
  arr[1]=0;
	for (int i = 2; i < sqrt(n); i++) {
		if (arr[i]) {
			for (int j = 0; i * (j + 2) < n; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

  int wa[100001];
  rep(i,100001){
    wa[i]=0;}
  
for(int i=1;i<=100000;i++){
  if(i>=3&&i%2==1){
  if(arr[i]&&arr[(i+1)/2]){
    wa[i]=wa[i-1]+1;}
    else{wa[i]=wa[i-1];}
  }
  else{wa[i]=wa[i-1];}
    
  }
rep(i, q){
  int l,r;
  cin>>l>>r;
  
  cout<<wa[r]-wa[l-1]<<endl;
  
}
 
 
}

Measured memory_bytes: 1408
N = int(input())
L = list(map(int,input().split()))

ans = 0
for i in range(N) :
    flag = 0
    while flag == 0 :
        if (L[i] % 2) == 0 :
            ans += 1
            L[i] = L[i]//2
        else :
            flag = 1
print(ans)


Measured memory_bytes: 4148
fun main(args: Array<String>) = ABC166C.main()

object ABC166C {
    fun log(message: Any?) {
        println(message)// TODO: ←消す
    }

    fun main() {
        val (N, M) = readInts()
        val H = readInts()
        val ab = (1..M).map {
            val (a, b) = readInts()
            a to b
        }

        val neighbors = (1..N).map { mutableListOf<Int>() }.toList()

        ab.forEach { (A, B) ->
            neighbors[A - 1].add(B - 1)
            neighbors[B - 1].add(A - 1)
        }

        val isGood = neighbors.mapIndexed { index, it ->
            val h = H[index]
            val heights = it.map { H[it] }
            val highest = heights.max()
            (highest == null) || (h > highest)
        }
        val ans = isGood.filter { it }.size
        println(ans)
    }


    /*####################################################################################*/

    fun readString() = readLine()!!
    fun readStrings() = readLine()!!.split(" ")
    fun readInt() = readLine()!!.toInt()
    fun readInts() = readLine()!!.split(" ").map { it.toInt() }
    fun readLong() = readLine()!!.toLong()
    fun readLongs() = readLine()!!.split(" ").map { it.toLong() }
    fun readMatrixRows(height: Int) = (1..height).map { readLine()!!.toList() }

    fun Boolean.yesOrNo() = if (this) "Yes" else "No"
    fun Double.toNaturalExpr() = println("%f".format(this))
}

Measured memory_bytes: 85752
def restore():
    for i in range(N - M, -1, -1):
        if all(s == '?' or s == t for s, t in zip(S[i:i + M], T)):
            ans = S[:i] + T + S[i + M:]
            return ''.join('a' if c == '?' else c for c in ans)
    return 'UNRESTORABLE'


S = input()
T = input()
N = len(S)
M = len(T)
print(restore())

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

double pou(int jk, int jd, int dk, int dd){
    double hk=sqrt((jk-jd)*(jk-jd)+(dk-dd)*(dk-dd));
    return hk;
}


int main(){
    int n;
    cin>>n;
    vector<int> x(n), y(n);
    for(int i=0;i<n;i++){
        cin>>x.at(i)>>y.at(i);
    }



    double dist=0;
    for(int r=0;r<n;r++){
        for(int q=0;q<n;q++){
            dist+=pou(x.at(r),x.at(q),y.at(r),y.at(q));
        }
    }
    dist=dist/(n*1.0);
    printf("%.10lf",dist);
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>
#include <atcoder/fenwicktree>

using namespace std;
using namespace atcoder;
typedef long long ll;

int main()
{
   int N, Q;
   cin >> N >> Q;
   vector<int> a(N);
   fenwick_tree<ll> fw(N);
   for (int i = 0; i < N; i++)
   {
      cin >> a[i];
      fw.add(i, a[i]);
   }
   for (int i = 0; i < Q; i++)
   {
      int op, q, x;
      cin >> op >> q >> x;
      if (op == 0)
         fw.add(q, x);
      else
         cout << fw.sum(q, x) << endl;
   }

   return 0;
}


Measured memory_bytes: 10168
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
#include<set>

using namespace std;
using LLI = long long int;

//struct UnionFind {
//	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
//
//	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
//		for (int i = 0; i < N; i++) par[i] = i;
//	}
//
//	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
//		if (par[x] == x) return x;
//		return par[x] = root(par[x]);
//	}
//
//	void unite(int x, int y) { // xとyの木を併合
//		int rx = root(x); //xの根をrx
//		int ry = root(y); //yの根をry
//		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
//		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
//	}
//
//	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
//		int rx = root(x);
//		int ry = root(y);
//		return rx == ry;
//	}
//};

int main(void) {
	LLI N, M;
	string a;
	map<string, LLI>Map;
	cin >> N;
	for (int i = 0; i < N;i++) {
		cin >> a;
		Map[a]++;
	}
	cin >> M;
	for (int i = 0; i < M;i++) {
		cin >> a;
		Map[a]--;
	}
	LLI MAX = 0;
	for (auto i : Map) {
		MAX = max(MAX,i.second);
	}
	cout << MAX << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int M,D,ans;
int main()
{
	scanf("%d%d",&M,&D);
	for(int d=22;d<=D;d++){
		int a=d%10,b=d/10;
		if(a*b<=M&&a>=2&&b>=2)ans++;
	}
	printf("%d",ans);
}


Measured memory_bytes: 256
N,K = map(int,input().split())
A = list(map(int,input().split()))
dic = {}
for i in range(N):
    if A[i] in dic:
        dic[A[i]] += 1
    else:
        dic[A[i]] = 1
L = len(set(A)) - K
ans = 0
new = sorted(dic.values())
for i in range(L):
    ans += new[i]
print(ans)

Measured memory_bytes: 43708
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

size_t N, W;
vector<int64_t> w(110), v(110);

auto dp = make_v(-1_im, 110, int(1e5) + 5);

intmax_t rec(size_t idx, int64_t weight) {
    if (idx >= N) return 0;
    if (weight + w[idx] > W) return rec(idx + 1, weight);
    if (~dp[idx][weight]) return dp[idx][weight];
    return dp[idx][weight] = max(rec(idx + 1, weight + w[idx]) + v[idx], rec(idx + 1, weight));
}

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

    cin >> N >> W;
    for (size_t i = 0; i < N; ++i) {
        cin >> w[i] >> v[i];
    }

    cout << rec(0, 0) << "\n";

    return 0;
}


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

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define ll long long
#define dl double long

using namespace std;

const int NN = 1e6 + 7;
const int N = 3e3 + 7;
const int M = 20;
const int mod = 998244353;
const ll inf = 1e18 + 7;
const dl rf = 1e-14;

void solve1()
{
    string s;
    cin >> s;
    vector < int > v(2);
    for( auto c : s ){
        v[c - 'A'] += 1;
    }
    if( v[0] == 3 || v[1] == 3 )cout << "No";
    else cout << "Yes";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


Measured memory_bytes: 256