akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<queue>
#include<functional>
#define p pair<int,int>
#define P pair<int,p>//from kaisya ID
using namespace std;

vector<p>rinsetu[500000];
P B[400000];
int mincost[500000];
vector<int>ans;
signed main() {
	int a, b; scanf("%d%d", &a, &b);
	//３種類の辺
	//同じ会社　違う会社　電車に乗る
	for (int c = 0; c < b; c++) {
		int d, e, f; scanf("%d%d%d", &d, &e, &f); d--; e--;
		if (d > e)swap(d, e);
		if (e == a - 1) {
			ans.push_back(a + c * 2 + 1);
		}
		rinsetu[d].push_back({ 1,a + c * 2 });
		rinsetu[a + c * 2].push_back({ 0,d });
		rinsetu[e].push_back({ 1,a + c * 2+1 });
		rinsetu[a + c * 2 + 1].push_back({ 0,e });
		rinsetu[a + c * 2].push_back({ 0,a + c * 2 + 1 });
		rinsetu[a + c * 2 + 1].push_back({ 0,a + c * 2 });
		B[c * 2] = { d,{ f,a + c * 2 + 1 } };
		B[c * 2 + 1] = { e,{f,a + c * 2} };
	}
	sort(B, B + b * 2);
	for (int i = 1; i < b * 2; i++) {
		if (B[i].first == B[i - 1].first&&B[i].second.first == B[i - 1].second.first) {
			rinsetu[B[i].second.second].push_back({ 0,B[i - 1].second.second });
			rinsetu[B[i-1].second.second].push_back({ 0,B[i].second.second });
		}
	}
	memset(mincost, 0x3f, sizeof(mincost));
	mincost[0] = 0;
	priority_queue<p, vector<p>, greater<p>>Q;
	Q.push({ 0,0 });
	while (Q.size()) {
		p i = Q.top(); Q.pop();
		for (p t : rinsetu[i.second]) {
			if (mincost[t.second] > mincost[i.second] + t.first) {
				mincost[t.second] = mincost[i.second] + t.first;
				Q.push({ mincost[i.second] + t.first, t.second });
			}
		}
	}
	int MIN = 1 << 29;
	for (int i : ans) {
		MIN = min(MIN, mincost[i]);
	}
	if (MIN == 1 << 29)puts("-1");
	else cout << MIN << endl;
}

Measured memory_bytes: 53488
// E - Simple String Queries
// Segment Tree version
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using vi = vector<int>;

// Segment Tree (sum)
template<class T> struct SegmentTree{//(0_origin)
private:
	int n;//最下段データ数
	T node;//セグ木
public:
	SegmentTree(const T &v){// データ配列 v をセグ木にする。
		int size = v.size();
		for(n=1; n<size; n<<=1);//最下段領域数
		node.resize(2*n-1, 0);//セグ木領域
		for(int i=0; i<size; ++i) node[n-1 + i] = v[i];//最下段データ設定
		for(int i=n-2; i>=0; --i) node[i] = node[2*i+1] + node[2*i+2];//ボトムアップで初期設定(sum)
	}
	void update(int ix, int val){
		ix += n-1;//最下段のindex
		if(node[ix] == val) return;
		node[ix] = val;//ボトムアップで更新
		while(ix){
			ix = (ix-1)/2;
			node[ix] = node[2*ix+1] + node[2*ix+2];//(sum)
		}
	}
	int sum(int a, int b, int k=0, int l=0, int r=-1){// data:[a,b) segT:[l,r) k:self index
		if(r<0) r = n;//first call [l,r)=[0,n)
		if(r<=a || b<=l) return 0;//unmatch: !(l<b & a<r)
		if(a<=l && r<=b) return node[k];//finish
		int retL = sum(a, b, 2*k+1, l, (l+r)/2);//left(sum)
		int retR = sum(a, b, 2*k+2, (l+r)/2, r);//right(sum)
		return retL + retR;//(sum)
	}
};

using SEGT = SegmentTree<vi>;
using VSEG = vector<SEGT>;

int main(){
	int N,Q;
	string S;
	cin>>N>>S>>Q;

	VSEG segT;
	rep(i,26){
		vi a(N); rep(j,N) if(S[j] == i+'a') a[j] = 1;
		segT.push_back(SEGT(a));
	}

	while(Q--){
		int t;
		cin>>t;
		if(t-1){//type2 out
			int l,r,ans=0;
			cin>>l>>r;
			rep(i,26){
				int ret = segT[i].sum(l-1, r);//[l,r)
				if(ret) ans++;
			}
			printf("%d\n",ans);
		}
		else{//type1 update
			int i; char c;
			cin>>i>>c;
			segT[S[i-1]-'a'].update(i-1, 0);//del
			S[i-1] = c;
			segT[S[i-1]-'a'].update(i-1, 1);//add
		}
	}
}

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

int main() {
  string s1, s2;
  cin >> s1 >> s2;
  sort(s1.begin(), s1.end());
  sort(s2.begin(), s2.end());
  reverse(s2.begin(), s2.end());
  if (s1 < s2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

template<class T = int> struct Segtree {
using Func = function<T(T, T)>;
private:
    int n = 1;
    T def;
    vector<T> node;
    const Func f;
public:
    Segtree(int sz, T _def, Func _f) : def(_def), f(_f) {
        while (n < sz) n *= 2;
        node.resize(2 * n - 1, def);
    }
    void update(int x, T val) {
        x += n - 1;
        node[x] = val;
        while (x > 0) {
            x = (x - 1) / 2;
            node[x] = f(node[2 * x + 1], node[2 * x + 2]);
        }
    }
    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (r <= a || b <= l) return def;
        if (a <= l && r <= b) return node[k];
        T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return f(vl, vr);
    }
};

const int M = 600303;

int main() {
    int N, K;
    cin >> N >> K;
    Segtree<int> dp(M, 0, [](auto a, auto b) { return max(a, b);});
    rep(i, N) {
        int a; cin >> a;
        auto tmp = dp.query(max(0, a - K), a + K + 1);
        dp.update(a, tmp + 1);
    }
    cout << dp.query(0, M + 1) << '\n';
    return 0;
}


Measured memory_bytes: 11488
h,w = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
cur = [0,0]
grid = [[0]*w for _ in range(h)]
for i in range(n):
    color = str(i+1)
    remain = a[i]
    while remain > 0:
        y = cur[0]
        x = cur[1]
        grid[y][x] = color
        remain -= 1
        if y % 2 == 0:
            if x == w-1:
                cur[0] += 1
            else:
                cur[1] += 1
        else:
            if x == 0:
                cur[0] += 1
            else:
                cur[1] -= 1
for i in range(h):
    print(" ".join(grid[i]))
            

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

int main (){
  int n;
  cin >> n;
  vector<int> vec(n);
  
  rep(i, n){
    cin >> vec.at(i);
  }

  bool one = false;
  int count = 1;
  int ans = 0;

  rep(i, n){
    if (vec.at(i) == count){
      count++;
      one = true;
    }
    else{
      ans++;
    }
  }
  if (one){
    cout << ans << endl;
  }
  else{
    cout << -1 << endl;
  }
  
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[222222];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
int a[26],x,y;
signed main(){
	string s;
	cin>>s;
	rep(i,4){
		a[s[i]-'A']++;
	}
	rep(i,26){
		if(a[i]==0)x++;
		else if(a[i]==2)y++;
		else{
			puts("No");
			return 0;
		}
	}
	if(y==2)puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;

int N;
int main (){
    cin >> N;
    int a[N];
    ll ans = 99999999999999999;
    ll total = 0;;
    for(int i=0; i<N; i++){
        cin >> a[i];
        total += a[i];
    }
    ll x = 0;
    for(int i=0; i<N-1; i++){
        x += a[i];
        ans = min(abs(total - 2 * x) , ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
//   PIGMEISTER™   //

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

#define ll long long
#define sidha(i,x,n) for(ll i=(ll)(x);i<(ll)(n);++i)
#define ulta(i,x,n) for(ll i=(ll)(x);i>=(ll)(n);--i)
#define sab(a) a.begin(),a.end()
#define bas(a) a.rbegin(),a.rend()
#define test ll _;cin>>_;while(_--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD (ll)1000000007
//#define MOD (ll)998244353
#define MAX 100005

int main()
{
    jaldi;
    
    ll n;
    cin >> n;
    ll x =n%10;
    if (x == 2 or x == 4 or x == 5 or x == 7 or x == 9)
    cout<<"hon";
    else if(x==3)cout<<"bon";
    else cout << "pon";
 
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define LOG1(a)    cerr<< #a << " = " << (a) << "\n"
#define LOG2(a, b) cerr<< #a << " = " << (a) << ", " << #b << " = " << (b) << "\n"
#define endl "\n"
#define sz(a) (int)(a.size())
#define all(a) a.begin(), a.end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll INF = 1e18;
const ll inf = 1e9;
const ll MOD = 1e9 + 7;
const ll nax = 1000000 + 10;

ll n, C, f[nax], x[nax], suff[nax];
ll solve()
{
    ll ans = 0;
    ll sum = 0;
    for(ll i = 1; i <= n; i++)
    {
        sum += f[i];
        ll curans = sum - x[i];
        ans = max(ans, curans);
    }
    sum = 0;
    for(ll i = n; i >= 1; i--)
    {
        sum += f[i];
        suff[i] = sum - (C - x[i]);
    }
    for(ll i = n; i >= 1; i--) suff[i] = max(suff[i], suff[i + 1]);
    sum = 0;
    for(ll i = 1; i <= n - 1; i++)
    {
        sum += f[i];
        ll curans = sum - 2 * x[i];
        curans += suff[i + 1];
        ans = max(ans, curans);
    }
    return ans;
}
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> C;
    for(ll i = 1; i <= n; i++) cin >> x[i] >> f[i];
    ll ans = solve();
    reverse(x + 1, x + n + 1);
    for(int i = 1; i <= n; i++) x[i] = C - x[i];
    reverse(f + 1, f + n + 1);
    ans = max(ans, solve());
    cout << ans;
    return 0;
}


Measured memory_bytes: 9216
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

bool check(int n){
	string s = to_string(n);
	for(int i = 1; i < (int)s.length(); i++){
		if(abs(s[i]-s[i-1]) > 1)
			return 0;
	}
	return 1;
}
 
signed main() {
	IOS;
	int k;
	cin >> k;
	int cur = 1;
	while(true){
		if(check(cur))
			k--;
		if(k == 0){
			cout << cur;
			break;
		}
		for(int i = 1; ; i++){
			int x = pow(10, i);
			if(check(cur/x)){
				cur += x/10;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 512
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {  
		Scanner input = new Scanner(System.in);
		double W = input.nextDouble();
		double H = input.nextDouble();
		double x = input.nextDouble();
		double y = input.nextDouble();
		double A = W*H;
		A/=2; //It's always possible to split rectangle into 2 equal pieces
		//when divider can have any slope and start point
		int ways = 0;
		if (x==W/2&&y==H/2) ways++; //Center of rectangle allows for several lines that divide
		//rectangle into two equal pieces
		System.out.println(A+" "+ways);
	}
}

Measured memory_bytes: 25172
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    ans = 0
    for _ in range(N):
        x, u = input().split()
        if u == "JPY":
            ans += int(x)
        else:
            ans += 380000 * float(x)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 8952
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0

n=I()
p,T=[],[]
for i in range(n):
    s,t=input().split()
    t=int(t)
    p.append(s)
    T.append(t)
x=input()

l=0
for i in range(n):
    ans+=l*T[i]
    if p[i]==x:
        l=1
        
    
    
print(ans)




Measured memory_bytes: 39660
#include <iostream>

#define LENG 100

char map[100][100];

int main()
{
	for (int i = 0; i < LENG; i++)
		for (int j = 0; j < LENG; j++)
		{
			if (i < 50)
			{
				map[i][j] = '.';
			}
			else
			{
				map[i][j] = '#';
			}
		}
	int n, m;
	std::cin >> n >> m;

	int black_i = 51, black_j = 0;
	int white_i = 0, white_j = 0;

	while (n > 1)
	{
		if (black_j == 100)
		{
			black_i += 2;
			black_j = 0;
		}
		if (black_i % 2 == 0)
		{
			if (black_j % 2 == 0)
			{
				map[black_i][black_j] = '.';
				black_j++;
				n--;
			}
			else
			{
				black_j++;
			}
		}
		else
		{
			if (black_j % 2 == 0)
			{
				black_j++;
			}
			else
			{
				map[black_i][black_j] = '.';
				black_j++;
				n--;
			}
		}
	}

	while (m > 1)
	{
		if (white_j== 100)
		{
			white_i += 2;
			white_j = 0;
		}
		if (white_i % 2 == 0)
		{
			if (white_j% 2 == 0)
			{
				map[white_i][white_j] = '#';
				white_j++;
				m--;
			}
			else
			{
				white_j++;
			}
		}
		else
		{
			if (white_j % 2 == 0)
			{
				white_j++;
			}
			else
			{
				map[white_i][white_j] = '.';
				white_j++;
				m--;
			}
		}
	}

	std::cout << "100 100" << std::endl;
	for (int i = 0; i < 100; i++)
	{
		for (int j = 0; j < 100; j++)
		{
			std::cout << map[i][j];
			if (j == 99)
				std::cout << std::endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

limit = max(A) + 1

dp = [True] * (limit + 1)
d = {}

for i in A:
    p = 2
    while i*p<=limit:
        dp[i*p] = False
        p += 1
    d.setdefault(i, 0)
    d[i] += 1

ans = []
for i in A:
    if dp[i] and d[i] == 1:
        ans.append(i)
print(len(ans))


Measured memory_bytes: 43756
H,W = map(int,raw_input().split())
M = [[500]*(W+1)]+[[500]+map(int,list(raw_input())) for i in range(H)]
M[0][1] = 0
for h in range(1,H+1):
	for w in range(1,W+1):
		M[h][w] += min(M[h-1][w],M[h][w-1])
print M[H][W]

Measured memory_bytes: 4272
#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<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
using namespace std;
#define int ll
#define double long double

signed main() {
	int x; cin >> x;
	int money = 100;
	int year = 0;
	while (money < x) {
		money = floor(money * 1.01);
		year++;
	}

	cout << year << endl;
}



Measured memory_bytes: 3744
#include <iostream>
#include <map>

using namespace std;

int main(void){
  int N;
  cin >> N;
  string S[N];
  for(int i=0; i<N; i++)
    cin >> S[i];

  int max = 0;
  map<string, int> S_;
  for(int i=0; i<N; i++){
    S_[S[i]]++;
    if(max < S_[S[i]])
      max = S_[S[i]];
  }

  for(auto i=S_.begin(); i!=S_.end(); i++ ) {
    if(i -> second == max)
      cout << i->first <<  endl;;
  }  
  
  return 0;
}


Measured memory_bytes: 27392
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 400400;
int n, m;
int a[N];
int nxt[N];
int lst[N];
int b[N];
int used[N];
bool hv[N];
ll k;

void solveFrom(int v) {
	m = 0;
	for (int i = v; i < n; i++) {
		int x = a[i];
		if (hv[x]) {
			while(b[m - 1] != x) {
				m--;
				hv[b[m]] = 0;
			}
			m--;
			hv[b[m]] = 0;
		} else {
			b[m++] = x;
			hv[x] = 1;
		}
	}
	for (int i = 0; i < m; i++)
		printf("%d ", b[i]);
	printf("\n");
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%lld", &n, &k);
	k--;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		a[n + i] = a[i];
	}
	for (int i = 2 * n - 1; i >= 0; i--) {
		if (i < n) {
			nxt[i] = lst[a[i]] + 1;
		}
		lst[a[i]] = i;
	}
	/*
	for (int i = 0; i < n; i++)
		eprintf("%d ", nxt[i]);
	eprintf("\n");
	*/
	for (int i = 0; i < n; i++)
		used[i] = -1;
	int cur = 0;
	int v = 0;
	while(cur < k && used[v] == -1) {
		used[v] = cur;
		v = nxt[v];
		while (v >= n) {
			v -= n;
			cur++;
		}
	}
	if (cur > k) {
		printf("\n");
		return 0;
	}
	if (cur == k) {
		solveFrom(v);
		return 0;
	}
	ll z = (k - cur) / (cur - used[v]);
	k -= z * (cur - used[v]);
	while(cur < k) {
		used[v] = cur;
		v = nxt[v];
		while (v >= n) {
			v -= n;
			cur++;
		}
	}
	if (cur > k) {
		printf("\n");
		return 0;
	}
	if (cur == k) {
		solveFrom(v);
		return 0;
	}
	throw;
	return 0;
}


Measured memory_bytes: 8704
#include <stdio.h>

long int operation(a,b){
	return a+b;
}

int main(){
	long int a,b,c,k;
	long int temp_a,temp_b,temp_c;
	long int i;
	long int ans;
	long int d;
	// 整数の入力
	scanf("%ld%ld%ld%ld", &a,&b,&c,&k);
	d = k/2;
	temp_a = a+(a+b+c)*d;
	temp_b = b+(a+b+c)*d;	
	temp_c = b+(a+b+c)*d;	
	a=temp_a;
	b=temp_b;
	c=temp_c;
	if(k%2){
		temp_a=operation(b,c);
		temp_b=operation(c,a);
		temp_c=operation(a,b);
		a=temp_a;
		b=temp_b;
		c=temp_c;
	}
	ans = a-b;
	if(ans/1000000000000000000 >= 1){
		printf("Unfair\n");
	}else{
		printf("%ld\n",a-b);
	}
	return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//ll dx[4] = {1, 0, -1, 0};
//ll dy[4] = {0, 1, 0, -1};

int number(State &);
int factor(State &);
int expr(State &);
int p[3];

int number(State &begin) {
	int ret;
	if (*begin == '-') {
		begin++;
		return -factor(begin) + 2;
	}
	if (isdigit(*begin)) {
		ret = *begin - '0';
		begin++;
	} else {
		int x = *begin - 'P';
		ret   = p[x];
		begin++;
	}
	return ret;
}
int factor(State &begin) {
	if (*begin == '(') {
		begin++;
		ll ret = expr(begin);
		begin++;
		return ret;
	} else {
		return number(begin);
	}
}

int expr(State &begin) {
	int ret = factor(begin);
	while (1) {
		if (*begin == '+') {
			begin++;
			ret = max(ret, factor(begin));
		} else if (*begin == '*') {
			begin++;
			ret = min(ret, factor(begin));
		} else {
			break;
		}
	}
	return ret;
}

int main() {
	string s;
	while (1) {
		cin >> s;
		if (s == ".") break;
		ll ans = 0;
		for (int i = 0; i <= 2; i++)
			for (int j = 0; j <= 2; j++)
				for (int k = 0; k <= 2; k++) {
					p[0] = i, p[1] = j, p[2] = k;
					State begin = s.begin();
					//cout << i << " " << j << " " << k << " " << expr(begin) << endl;
					if (expr(begin) == 2) ans++;
				}
		dump(ans);
	}
	return 0;
}


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


int main(){
    int N;
    scanf("%d",&N);
    vector<int> L(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%d",&L[i]);
    }
    sort(L.begin(),L.end());
    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i+1; j < N; j++)
        {
            for (int k = j+1; k < N; k++)
            {
                if(L[i] + L[j] > L[k]) ans++;
            }
        }
    }
        
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using vi = vector<int>;
using ll = long long;
using vl = vector<ll>;

int main() {
	int n;
	cin >> n;
	vl A(n);
	vl B(n);
	vl C(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> C[i];
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	A.push_back(LLONG_MAX);
	B.push_back(LLONG_MAX);
	C.push_back(LLONG_MAX);
	ll ans = 0;
	ll a = 0;
	ll b = 0;
	ll c = 0;
	for (;c<n;c++) {
		for (; B[b] < C[c] && b<=n; b++) {
			for (; A[a] < B[b] && a <= n; a++) {
			}
			ans += a*(n-c);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3456
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

typedef long long ll;
typedef unsigned long long ull;
//typedef vector<int> vi;
//typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<string> vs;

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

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

	string S; cin >> S;
	int N = S.size();
	string W[4] = { "dream", "dreamer",
		"erase", "eraser" };

	reverse(S.begin(), S.end());
	FOR(i, 0, 4) {
		reverse(W[i].begin(), W[i].end());
	}

	string ans = "YES";
	int i = 0;
	while (i < N) {
		bool found = false;

		FOR(j, 0, 4) {
			if (i == S.find(W[j], i)) {
				i += W[j].size();
				found = true;
				break;
			}
		}

		if (!found) {
			ans = "NO";
			break;
		}
	}

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


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define clr1(arr) memset(arr,-1,sizeof(arr));
#define clr0(arr) memset(arr,0,sizeof(arr));
#define pi pair<int,int>
#define pii pair<int,pi>
#define aint(v) v.begin(),v.end()
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define ump gp_hash_table<int,int,custom_hash>
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
/*int **dp,in main function,int row,col;dp=new int*[n];rep(i,n)dp[i]=new int[m]*/
//**** Maths Section*******/
int power(int x,int y);
bool isPrime(int n);
int modInv(int a,int b);
int gcdExtended(int a,int b,int *x,int* y);
int mpower(int a,int b,int p);
/***************************/
int32_t main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  fastio
  int a;
  cin>>a;
  cout<<a+ a*a+ a*a*a<<endl;
  return 0;
}

int modInv(int a, int m)
{
int x, y;
int g = gcdExtended(a, m, &x, &y);
int res = (x%m + m) % m;
return res;
}

int gcdExtended(int a, int b, int *x, int *y)
{
if (a == 0){
    *x = 0, *y = 1;
    return b;
  }
  int x1, y1;
  int gcd = gcdExtended(b%a, a, &x1, &y1);
  *x = y1 - (b/a) * x1;
  *y = x1;
  return gcd;
}

int mpower(int x, int y, int p)
{
int res = 1;
x = x % p;
while(y > 0){
    if(y & 1) res = (res*x) % p;
      y = y>>1;
      x = (x*x) % p;
    }
    return res;
}
int power(int x, int y)
{
int res = 1;
while (y > 0){
    if (y & 1) res = res*x;
      y = y>>1;
      x = x*x;
    }
    return res;
}

bool isPrime(int n)
{
if (n <= 1)  return false;
  if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
      int p=sqrt(n);
      for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
          return false;
      return true;
}


Measured memory_bytes: 3544
import java.util.Scanner;

public class Main {
	public static void main(String[] argv) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = s.nextInt();
		int d = s.nextInt();

		if ((Math.abs(a - b) <= d && Math.abs(b - c) <= d)||Math.abs(a-c)<=d)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 24916
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const double pi = 3.14159265358979;
using vl = vector<ll>;
# define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((ll)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((ll)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()

string T;

ll Main() {
    cin >> T;
//    string T2(T);
    
//    rep(i, T.length()) {
//        if (T[i] == '?') {
//            T[i] = 'D';
//        }
//    }
//
    
    rep(i, T.length()) {
        if (T[i] == '?') {
            T[i] = 'D';
        }
    }

    cout << T << endl;
    return 0;
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 3788
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

int main(){
    ll N; cin>>N;
    vector<ll> X(26,INF);
    rep(i,N){
        string tmp; cin>>tmp;
        vector<ll> cnt(26,0);
        rep(j,sz(tmp)){
            cnt[(ll)(tmp[j]-'a')]++;
        }
        
        rep(j,26) chmin(X[j],cnt[j]);
    }
    
    rep(i,26){
        rep(j,X[i]) cout<<(char)('a'+i);
    }
    cout<<endl;
}



Measured memory_bytes: 3640
using System;
using System.Windows;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class Program
{
    static string S;
    static void Main(string[] args)
    {
      //入力を受け取る
      S = Console.ReadLine();
      var count0 = 0;
      var count1 = 0;
      
      for(int i = 0 ; i < S.Length ; i++){
        if(S[i] == '0'){
          count0++;
        }else{
          count1++;
        }
      }
      Console.WriteLine(Math.Min(count0,count1)*2);
    }
  
}




Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main(){
  while (1){
    int N, M, Q;
    cin >> N >> M >> Q;
    if (N == 0 && M == 0 && Q == 0){
      break;
    }
    vector<string> S(Q + 1), B(Q + 1);
    for (int i = 1; i <= Q; i++){
      cin >> S[i] >> B[i];
    }
    for (int i = 0; i < N; i++){
      S[0] += '0';
    }
    for (int i = 0; i < M; i++){
      B[0] += '0';
    }
    vector<vector<bool>> tmp(M, vector<bool>(36, true));
    for (int i = 0; i < M; i++){
      for (int j = 0; j < N; j++){
        for (int k = 0; k < Q; k++){
          if (S[k + 1][j] == '0' && B[k][i] != B[k + 1][i]){
            tmp[i][j] = false;
          }
          if (S[k + 1][j] == '1' && B[k][i] == B[k + 1][i]){
            tmp[i][j] = false;
          }
        }
      }
    }
    vector<int> ans(M, -2);
    for (int i = 0; i < M; i++){
      for (int j = 0; j < N; j++){
        if (tmp[i][j]){
          if (ans[i] == -2){
            ans[i] = j;
          } else {
            ans[i] = -1;
          }
        }
      }
    }
    for (int i = 0; i < M; i++){
      if (ans[i] == -1){
        cout << '?';
      } else if (ans[i] < 10){
        cout << (char) ('0' + ans[i]);
      } else {
        cout << (char) ('A' + ans[i] - 10);
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 4320
#include <iostream>
#include <string>

using namespace std;

int main()
{
    // input first line
    int N; int K;
    cin >> N; cin >> K;
    cout << endl;
    int price; int arr[N];
    for (int i = 0; i < N; i++)
    {
        cin >> price;
        arr[i] = price;
        cout << " ";
    }
    int temp;
    for (int i = 0; i < N; i++)
    {
        for (int y = i+1; y < N; y++)
        {
            if (arr[i] > arr[y])
            {
                temp = arr[i];
                arr[i] = arr[y];
                arr[y] = temp;
            }
        }
    }
    int sum = 0;
    for (int i = 0; i < K; i++)
    {
        sum += arr[i];
    }
    cout << sum << endl;





    return 0;
}


Measured memory_bytes: 3604
from sys import stdin

while True:
    (a, op, b) = stdin.readline().split(' ')
    a = int(a)
    b = int(b)
    if op == "?":
        break;
    elif op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)

Measured memory_bytes: 6724
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
  for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
  for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup \
  cin.tie(0);  \
  ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (int i = 0; i < v.size(); ++i) {
    is >> v[i];
  }
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < v.size() - 1; ++i) {
    os << v[i] << " ";
  }
  if (v.size() > 0) {
    os << v[v.size() - 1] << endl;
  }
  return os;
}

int main() {
  int n;
  cin >> n;
  vint a(n+1);
  cin >> a;
  if (a[0] != 0){
    if (n == 0){
      if (a[0] == 1){
        cout << 1 << endl;
      }else{
        cout << -1 << endl;
      }
      return 0;
    }else{
      cout << -1 << endl;
      return 0;
    }
  }

  vll cum(n + 1, 0);
  ll sumval = a[n];
  cum[n] = a[n];
  IREP(i, n) {
    sumval += a[i];
    cum[i] = cum[i + 1] + a[i];
  }
  ll prev = 1, ans = 1;
  REP(i,n){
    ll curmax = prev*2;
    if (curmax < a[i+1]){
      cout << -1 << endl;
      return 0;
    }
    ll cur = min(curmax, cum[i + 1]);
    prev = cur - a[i + 1];
    ans += cur;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4580
#include <stdio.h>
int main(){
    long int i;
    int count;
    while(1){
        count=0;
        scanf("%ld",&i);
        if(i == 0){
            break;
        }
        while(1){
            if(i % 2 == 0){
                i/=2;
                count++;
            }
            if(i == 1){
                break;
            }
            else if(i % 2 == 1){
                i*=3;
                i++;
                count++;
            }
            if(i == 1){
                break;
            }
        }
        printf("%d\n",count);
    }
    return (0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{	
	int n;
	string s;
	set<string>S;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>s;
		S.insert(s);
	}
	int ans=S.size();
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 19176
def 解():
    iN ,iT = [int(_) for _ in input().split()]
    aT = [int(_) for _ in input().split()]
    tb = 0
    iAns = 0
    for ti in aT[1:]:
        if ti - tb <= iT:
            iAns += ti -tb
        else:
            iAns += iT
        tb = ti
    iAns += iT
    print(iAns)
解()


Measured memory_bytes: 25840
#include<iostream>

using namespace std;

int main() {
    #ifdef EV
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif

    int t;
    cin>>t;
    t>=30 ? cout<<"Yes\n" : cout<<"No\n";

    return 0;
}

Measured memory_bytes: 3584
#include<iostream>

using namespace std;

void disp(int A[], int N) {
    
    for (int i = 0; i < N; i++) {
        if (i > 0) {
            cout << " ";
        }
        cout << A[i];
    }
    cout << endl;
}

void insertionSort (int A[], int N) {
    for (int i = 1; i < N; i++) {
        int v = A[i];
        int j;
        for(j = i - 1; j >= 0 && A[j] > v; j--) {
            A[j + 1] = A[j];
        }
        A[j + 1] = v;
        disp(A, N);
    }
}

int main() {

    int N;
    int A[100];

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

    disp(A, N);
    insertionSort(A, N);

    return 0;

}


Measured memory_bytes: 3088
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
//		solveA(args);
		solveB(args);
//		solveC(args);
//		solveD(args);
//		solveE(args);
//		solveF(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int L= nextInt();
		int R= nextInt();
		int d= nextInt();
		int ans=0;
		for(;L<=R;L++) {
			if(L%d==0) {
				ans++;
			}
		}
		pw.println(ans);
	}
	public static void solveB(String[] args) throws Exception{
		int N = nextInt();

		int[] a = nextInts();
		int ans = 0;
		for(int i=0;i<N;i++) {
			if(i%2==0&&a[i]%2==1) {
				ans++;
			}
		}
		pw.println(ans);
	}
	public static void solveC(String[] args) throws Exception{

	}

	public static void solveD(String[] args) throws Exception{

	}


	public static void solveE(String[] args) throws Exception{

	}

	public static void solveF(String[] args) throws Exception{

	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 25340
#include <stdio.h> 
 #include <string.h> 
 #define MAX 100 
  
  
 int main(){ 
     int n; 
     int t_point=0, h_point=0; 
     char tarou[MAX], hanako[MAX]; 
  
  
     scanf("%d", &n); 
     for(;n>0;n--){ 
         scanf(" %s %s", tarou, hanako);
          if(strcmp(tarou, hanako)>0){ 
             t_point+=3; 
         }else if(strcmp(tarou, hanako)==0){ 
             t_point+=1; 
             h_point+=1; 
         }else if(strcmp(tarou, hanako)<0){ 
             h_point+=3; 
         } 
     } 
     printf("%d %d\n", t_point, h_point); 
  
  
     return 0; 
 }


Measured memory_bytes: 2144
#include <iostream>

using namespace std;

int main()
{
    int i,h,w,n=0,j;
    cin>>h>>w;
    string s="",r="";
    for(i=0;i<h;i++){
        cin>>r;
       s=s+r; 
    }
    r="";
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            r=r+s[n];
            n++;
        }
        cout<<r<<endl;
        cout<<r<<endl;
        r="";
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String T = sc.next();

        System.out.println(solve(S, T) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(String S, String T) {
        return String.format("%s%s", S, S).contains(T);
    }
}

Measured memory_bytes: 21716
#include <stdio.h>
int main(void){
    int n,m,a[1001],b[1001],c[1001]={0};
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    for(int j=1;j<=m;j++)scanf("%d",&b[j]);
    for(int j=1;j<=m;j++){
        for(int i=1;i<=n;i++){
            if(a[i]<=b[j]){
                c[i]++;
                b[j]=0;
            }
        }
    }
    int max,maxi;
    max=maxi=0;
    for(int i=1;i<=n;i++){
        if(max<c[i]){
            max=c[i];
            maxi=i;
        }
    }
    printf("%d\n",maxi);
    return 0;
}


Measured memory_bytes: 2092
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = Integer.parseInt(in.nextLine());
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        in.nextLine();
        int currMax = 0;
        long res = 0;
        for (int i = 0; i < n; i++) {
            if (arr[i] > currMax) {
                currMax = arr[i];
            } else {
                res += currMax - arr[i];
            }
        }
        System.out.println(res);
    }
}


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

int Answer(int Goal, vector<int> Prob, vector<int> Comp){
  int D2 = Prob.size();
  
  if (Goal <= 0) {
    return 0;
  }
  
  for (int i = 0; i < D2; i++) {
    if (Comp.at(i) != 0) {
      
      vector<int> Prob2 = Prob;
      vector<int> Comp2 = Comp;
      Prob2.at(i) -= 1;
      Comp2.at(i) = 0;
      vector<int> Prob3 = Prob;
      vector<int> Comp3 = Comp;
      Prob3.at(i) = 0;
      Comp3.at(i) = 0;
      int Compscore = Prob.at(i)*100*(i+1) + Comp.at(i);
      
      return min(Answer(Goal,Prob2,Comp2),Answer(Goal-Compscore,Prob3,Comp3)+Prob.at(i));
    }
  }
  
  int S = 0;
  int A = 0;
  for (int i = D2-1; i >= 0; i--) {
    for (int j = 0; j < Prob.at(i); j++) {
      S += (i+1) * 100;
      A++;
      if (S >= Goal) {
        return A;
      }
        
    }
  }
  
  return 10000;
  
}

int main() {
  int D, G;
  cin >> D >> G;
  
  vector<int> problem(D);
  vector<int> complete(D);
  for (int i = 0; i < D; i++) {
    cin >> problem.at(i) >> complete.at(i);
  }
  
  cout << Answer(G,problem,complete) << endl;
  
  return 0;
}


Measured memory_bytes: 3632
import java.util.*;
import java.io.*;
import java.lang.*;

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

        if (c<=(a+b))
            System.out.println("Yes");
        else
            System.out.println("No");

    }
}


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

using namespace std;
typedef unsigned long long int ll;

int main()
{
    int n,r;
    cin>>n>>r;
    if(n>=10)
    {
        cout<<r;
        return 0;
    }
    cout<<100*(10 - n) + r;
    return 0;
}


Measured memory_bytes: 3540
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, K;
int A[100000];

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

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> K;
  rep(i, N) cin >> A[i];
  sort(A, A+N);

  int g = A[0];
  rep(i, N) g = gcd(g, A[i]);
  if (A[0] <= K && K <= A[N-1] && (K-A[0]) % g == 0) cout << "POSSIBLE\n";
  else cout << "IMPOSSIBLE\n";
  return 0;
}


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

const int64_t INF = 1e16;
 
int main(){ 
  int V, E;
  cin >> V >> E;

  vector<vector<int64_t>> dist(110, vector<int64_t>(110, INF));
  for(int i=0; i<V; i++) dist[i][i] = 0;

  for(int i=0; i<E; i++){
    int s, t, d; cin >> s >> t >> d;
    dist[s][t] = d;
  }

  for(int k=0; k<V; k++){
    for(int i=0; i<V; i++){
      for(int j=0; j<V; j++){
        if(dist[i][k] != INF && dist[k][j] != INF){
          dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
        }
      }
    }
  }

  for(int i=0; i<V; i++){
    if(dist[i][i] < 0){
      cout << "NEGATIVE CYCLE" << endl;
      return 0;
    }
  }

  for(int i=0; i<V; i++){
    for(int j=0; j<V; j++){
      if(dist[i][j] == INF) cout << "INF";
      else cout << dist[i][j];
      if(j != V-1) cout << " ";
    }
    cout << endl;
  }
}


Measured memory_bytes: 3268
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define stp setprecision(15)
#define eps 0.000001
#define endl '\n'
#define ll lli
 
using namespace std ;
 
#define N 10000000 
#define lg 19
 
typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

int main() 
{ 
 
/////////////////////////////////////
    
    fastio;
 
/////////////////////////////////////    
    
    lli n;
    cin>>n;

    lli sum=0;
    loopl(i,1,n+1)
    {
        if(i%2 == 1) sum++;
    }

    lld ans = 1.00*sum;
    ans /= n;

    cout<<fixed<<stp<<ans<<endl;

}   

Measured memory_bytes: 256