akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(){
	int y, n, i;
	char f, g;
	int cards[4][13] = {};
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%c %c %d", &f, &g, &y);
		if(g == 'S'){
			cards[0][y-1] = 1;
		}else if(g == 'H'){
			cards[1][y-1] = 1;
		}else if(g == 'C'){
			cards[2][y-1] = 1;
		}else if(g == 'D'){
			cards[3][y-1] = 1;
		}
	}
	for(y = 1; y < 14; y++){
		if(cards[0][y-1] == 0){
			printf("S %d\n", y);
		}
	}
	for(y = 1; y < 14; y++){
		if(cards[1][y-1] == 0){
			printf("H %d\n", y);
		}
	}
	for(y = 1; y < 14; y++){
		if(cards[2][y-1] == 0){
			printf("C %d\n", y);
		}
	}
	for(y = 1; y < 14; y++){
		if(cards[3][y-1] == 0){
			printf("D %d\n", y);
		}
	}
	
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

template <typename T>
class LCA {
    public:
        int n, log_v = 0;
        vector<int> depth;
        vector<T> costs;
        vector<vector<int> > to;
        vector<vector<T> > cost;
        vector<vector<int> > parent;

        LCA() {}
        LCA(int n_): n(n_) {
            while ((1 << log_v) < n) ++log_v;
            depth.assign(n, 0);
            costs.assign(n, 0);
            to = vector<vector<int> >(n);
            cost = vector<vector<T> >(n);
            parent = vector<vector<int> >(log_v, vector<int>(n, 0));
        }

        void addEdge(int u, int v, T c = 0) {
            to[u].push_back(v);
            to[v].push_back(u);
            cost[u].push_back(c);
            cost[v].push_back(c);
        }

        void init(int root) {
            dfs(root);
            rep (i, log_v - 1) {
                rep (j, n) {
                    // if (parent[i][j] < 0) parent[i + 1][j] = -1;
                    parent[i + 1][j] = parent[i][parent[i][j]];
                }
            }
        }

        void dfs(int v, int p = -1, int d = 0, T c = 0) {
            if (p != -1) parent[0][v] = p;
            depth[v] = d;
            costs[v] = c;
            rep (i, to[v].size()) {
                int e = to[v][i];
                if (e == p) continue;
                dfs(e, v, d + 1, c + cost[v][i]);
            }
        }

        int query(int u, int v) {
            if (depth[u] > depth[v]) swap(u, v);
            rep (i, log_v) {
                if ((depth[v] - depth[u]) >> i & 1) v = parent[i][v];
            }
            if (u == v) return u;
            rrep (i, log_v) {
                if (parent[i][u] != parent[i][v]) {
                    u = parent[i][u];
                    v = parent[i][v];
                }
            }
            return parent[0][u];
        }

        int length(int u, int v) {
            return depth[u] + depth[v] - 2 * depth[query(u, v)];
        }

        // is x on the path u - v
        bool isOnPath(int u, int v, int x) {
            return length(u, x) + length(v, x) == length(u, v);
        }

        T dist(int u, int v) {
            return costs[u] + costs[v] - 2 * costs[query(u, v)];
        }
};


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n, q;
    cin >> n;
    int root;
    LCA<int> lca = LCA<int>(n);
    rep (i, n) {
        int k;
        cin >> k;
        rep (j, k) {
            int c;
            cin >> c;
            lca.addEdge(i, c);
        }
    }
    lca.init(root);
    cin >> q;
    rep (i, q) {
        int u, v;
        cin >> u >> v;
        cout << lca.query(u, v) << endl;
    }

    return 0;
}




Measured memory_bytes: 24532
#include<stdio.h>
#include<string.h>
int N,M,H[1500],W[1500],i,j,ch[1200000],cw[1200000],t,r;

int main()
{
	for(;scanf("%d%d",&N,&M),N;)
	{
		memset(ch,0,sizeof(ch));
		memset(cw,0,sizeof(cw));
		for(i=0;i<N;i++)
			scanf("%d",&H[i]);
		for(i=0;i<M;i++)
			scanf("%d",&W[i]);
		for(i=0;i<N;i++)
			for(j=i,t=H[i];j<N;t+=H[++j])
				ch[t]++;
		for(i=0;i<M;i++)
			for(j=i,t=W[i];j<M;t+=W[++j])
				cw[t]++;
		for(i=r=0;i<=1200000;i++)
			r+=ch[i]*cw[i];
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 9992
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s,t;cin>>s>>t;
  ll a,b;cin>>a>>b;
  string ss;cin>>ss;
  if(s==ss){
    cout<<a-1<<" "<<b<<endl;
  }
  else{
    cout<<a<<" "<<b-1<<endl;
  }
  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
int main(){
    int n;
    cin>>n;
    int p=0;
    int w=0;
    int g=0;
    int y=0;
    rep(i,n){
        string ent;
        cin>>ent;
        if(ent=="P") p++;
        if(ent=="W") w++;
        if(ent=="G") g++;
        if(ent=="Y") y++;
    }
    if(p==0||w==0||g==0||y==0) cout<<"Three"<<endl;
    else cout<<"Four"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>

using namespace std;

void print(char str[],int a,int b){
	for(int i = a; i <= b; i++)	printf("%c",str[i]);
	printf("\n");
}

void replace(char str[],char p[],int a,int b){
	int p_length = b-a+1;
	for(int i = 0; i < p_length;i++) str[a+i] = p[i];
}

void reverse(char str[],int a,int b){
	int left = a,right = b;
	while(left < right){
		swap(str[left++],str[right--]);
	}
}

int main(){
	char str[1001],p[1001],order[8];
	int q,a,b;
	scanf("%s",str);
	scanf("%d",&q);
	for(int i = 0; i < q; i++){
		scanf("%s %d %d",order,&a,&b);
		switch(order[2]){
		case 'i':
			print(str,a,b);
			break;
		case 'v':
			reverse(str,a,b);
			break;
		case 'p':
			scanf("%s",p);
			replace(str,p,a,b);
			break;
		}
	}
}


Measured memory_bytes: 2604
S=input()
T=input()

A=[]
B=[]
C=[]
D=[]

for i in range(len(S)):
    if A.count(S[i])==0:
        A.append(S[i])
        B.append(T[i])
    else:
        if B[A.index(S[i])]!=T[i]:
            print("No")
            exit(0)

for i in range(len(T)):
    if C.count(T[i])==0:
        C.append(T[i])
        D.append(S[i])
    else:
        if D[C.index(T[i])]!=S[i]:
            print("No")
            exit(0)


print("Yes")

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

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

#define ll long long
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const int INF=1e9;

void solve(){
  bool x;cin>>x;
  cout<<(!x)<<endl;
}

int main(){solve();}


Measured memory_bytes: 3636
import os

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, K = list(map(int, sys.stdin.buffer.readline().split()))
A = list(map(int, sys.stdin.buffer.readline().split()))


def test(A, K):
    A = list(A)
    for _ in range(K):
        B = [0] * N
        for i in range(N):
            b = 0
            for j in range(N):
                if A[j] >= abs(j - i):
                    b += 1
            B[i] = b
        A = B
    print(*A)
    return A


def test2(A, K):
    A = list(A)
    for _ in range(K):
        B = [0] * N
        for i in range(N):
            for j in range(N):
                if A[i] >= abs(j - i):
                    B[j] += 1
        A = B
    print(*A)
    return A


def cumsum(it):
    """
    累積和
    :param collections.Iterable it:
    """
    cs = 0
    ret = []
    for v in it:
        cs += v
        ret.append(cs)
    return ret


def solve(A, K):
    prev = A
    for _ in range(K):
        imos = [0] * (N + 1)
        for i in range(N):
            imos[max(0, i - A[i])] += 1
            imos[min(N, i + A[i] + 1)] -= 1
        prev = A
        A = cumsum(imos)[:-1]
        if prev == A:
            break
    print(*A)


# test(A,K)
# test2(A,K)

# N = len(A)
# for k in range(1000):
#     test(A, k)
solve(A, K)


Measured memory_bytes: 188004
n = int(input())
book = []
for i in range(n):
    name, rate = input().split()
    book.append((i+1, name, int(rate)))
b = sorted(book, key=lambda s: s[2], reverse=True)
b2 = sorted(b, key=lambda s: s[1])

for i, _, _ in b2:
    print(i)


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


namespace ConsoleApp6
{
	class Program
	{
		static void Main(string[] args)
		{
			while (true)
			{
				string hw = Console.ReadLine();
				string[] sq = hw.Split(' ');

				int H = int.Parse(sq[0]);
				int W = int.Parse(sq[1]);

				int i, j;
				if (H == 0 && W == 0)
					break;

				for (i = 0; i < H; i++)
				{
					
					for (j = 0; j < W; j++)
					{
						Console.Write("#");
					}
					Console.WriteLine();
				}

				Console.WriteLine();

				//Console.ReadKey();
			}
		}
	}
}



Measured memory_bytes: 15780
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
constexpr uint64_t L1 = 1ull;
constexpr ull bit(int n){ return 1ull << n;}

constexpr ll INF       = 1000000000;/* 1e+9a */

void solve(istream& cin) {
    int t;
    while(cin >> t){
        string s("Christmas");
        cout << s;
        while(t++ < 25){
            cout << " Eve";
        }
        cout << '\n';
    }
}

int main(int argc, char *argv[]) {
    string FileName("A"), Modifier("_MEPH");
    string ExecutionName = FileName + Modifier;
    string sub(argv[0]);
    // pass消去
    if(sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size()-ExecutionName.size(), ExecutionName.size());

	// 数値計算もの用
    cout << setprecision(16) << scientific;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        solve(cin);
    }
    else {    
	    cerr << sub << endl;
        string inFile = "A_sample.txt";
        auto fs = fstream(inFile, fstream::in);
        solve(fs);
    }
}


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

int main() {
  int N;
  cin >> N;
  int num = N;
  int f = 0;
  while(N!=0){
    f += N%10;
    N /= 10;
  }
  if(num%f == 0){
    cout << "Yes" ;
  }else{
    cout << "No" ;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using ll = long long;

using namespace std;


int u_find(int x, vector<int> &par) {
    if(par[x] == x) return x;
    else return u_find(par[x],par);
}

void unite(int x, int y, vector<int> &par, vector<int> &rank) {
    x = u_find(x,par);
    y = u_find(y,par);
    if(x == y) return;
    if(rank[x] < rank[y]) {
        par[x] = y;
        rank[y] += rank[x];
    }
    else {
        par[y] = x;
        rank[x] += rank[y];
    }
}

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> p(n+1);
    vector<int> r(n+1,1);
    rrep(i,n) {
        p[i] = i;
    }
    int ans = 1;
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        unite(a,b,p,r);
        ans = max(ans, r[u_find(a,p)]); // ← なんで通らないの？
    }
    /*rrep(i,n) {
        ans = max(ans, r[u_find(i,p)]);
    }*/
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4824
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <utility>
#include <functional>
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b, a%b);
}
ll lcm(ll a, ll b){
    return a/gcd(a, b)*b;
}
ll powmod(ll a, ll k, ll m){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=m;
        }
        ap=ap*ap;
        ap%=m;
        k>>=1;
    }
    return ans;
}
int main()
{
    ll n; cin>>n;
    vector<ll> fac;
    ll n0=n;
    for(ll i=2; i*i<=n0; i++){
        if(n0%i==0){
            int e=0;
            while(n0%i==0){
                n0/=i; e++;
            }
            if(e>1){
                cout<<-1<<endl;
                return 0;
            }
            fac.push_back(i);
        }
    }
    if(n0>1) fac.push_back(n0);
    if(fac.size()==1){
        cout<<1<<endl;
        return 0;
    }
    ll g=1;
    for(auto p:fac){
        g=lcm(g, p-1);
    }
    if(gcd(n, g)>1){
        cout<<-1<<endl;
        return 0;
    }
    vector<P> facd;
    ll g0=g;
    ll d=g;
    for(ll i=2; i*i<=g0; i++){
        if(g0%i==0){
            while(g0%i==0){
                g0/=i;
            }
            d/=i; d*=(i-1);
        }
    }
    if(g0>1) d=d/g0*(g0-1);
    ll d0=d;
    for(ll i=2; i*i<=d0; i++){
        if(d0%i==0){
            int e=0;
            while(d0%i==0){
                d0/=i; e++;
            }
            facd.push_back(P(i, e));
        }
    }
    if(d0>1) facd.push_back(P(d0, 1));
    ll ans=d;
    for(auto q:facd){
        ll p=q.first; int e=q.second;
        ll d1=d;
        for(int i=1; i<=e; i++){
            d1/=p;
            if(powmod(n, d1, g)!=1) break;
            ans/=p;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3148
#include<bits/stdc++.h>
#define ll long long
using namespace std;
signed main(){
  ll n,k;
  cin>>n>>k;
  vector<ll> a(n);
  for(ll i=0;i<n;i++){
    cin>>a[i];
  }
  vector<ll> s;
  vector<ll> ord(n+1,-1);
  ll c = 1, l = 0;
  {
    ll v = 1;
    while(ord[v] == -1){
      ord[v] = s.size();
      s.push_back(v);
      v = a[v-1];
    }
    c = s.size() - ord[v];
    l = ord[v];
  }
  
  if(k < l){
    cout<<s[k]<<"\n";
  }else{
    k -= l;
    k %= c;
    cout<<s[l+k]<<"\n";
  }
  return 0;
}

Measured memory_bytes: 8440
/*Made by Shivam Solanki*/
#include<bits/stdc++.h> 
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
typedef queue<int> qii;
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define repllr(i,k,n) for (ll i = n; i >= k; --i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;

void solve(){
    int a,b;
    cin>>a>>b;
    // a*=100,b*=100;
    int ans=-1;
    rep(i,1,1001){
        double x=i*0.08;
        double y=i*0.10;
        // cout<<x<<' '<<y<<'\n';
        if((int)x==a and (int)y==b){
            ans=i;
            break;
        }
    }    
    cout<<ans<<'\n';
} 
 
  
int main(){
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
// input macro 
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main(){
    input!{
        a: usize,
        b: usize,
        c: usize,
    }
    println!("{}", std::cmp::min(b / a, c));
}

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

int SKB(double x, double y, double w){
	double n = (x*y)/w;
	return (int)n;
}

int YUK(int x, int y){
	int c;
		c = x%y;
		if(c == 0){
			return y;
		}else{
			return YUK(y,c);
		}
}

int main(){
	int a, b;

	while( cin >> a >> b ){
		int d;
		if(a >= b){
			d = YUK(a,b);
			cout << d << ' ' << SKB(a,b,d);

		}else{
			d = YUK(b,a);
			cout << d << ' ' << SKB(a,b,d);
		}
		cout << '\n';
	}

	return 0;
}

Measured memory_bytes: 0
/*
    ||S|A|M|R|A|T||
    Author:codingsamrat
*/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long 
#define ld long double
#define INF LONG_MAX
#define pb push_back
#define gcd __gcd
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
#define vii vector<int>
#define vll vector<long long>
typedef long long  ll;

ll bpow(ll a, ll b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int32_t main()
{	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
//	#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//    #endif
	char s;
	cin>>s;
	if(s>=97)
	cout<<"a";
	else
	cout<<"A";
     
return 0;

}


Measured memory_bytes: 3596
#include <cstdio>
#include <algorithm>

const long long MAX_N = 100001;
long long a[MAX_N];
long long n;

long long choose(int sign) {
        long long sum, count;
        sum = count = 0;
        for (long long i=1; i<=n; ++i, sign*=-1) {
                sum += a[i];
                if (sum*sign <= 0) {
                        count += 1-sum*sign;
                        sum = sign;
                }
        }
        return count;
}

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

        for (long long i=1; i<=n; ++i) {
                scanf("%lld", &a[i]);
        }

        long long res = std::min(choose(1), choose(-1));
        printf("%lld\n", res);
        return 0;
}


Measured memory_bytes: 896
A , V = map(int, input().split())
B , W = map(int, input().split())
T = int(input())
flag = 0

if (V - W) <= 0:
    flag = 0
else:
    if ((V - W) * T) >= abs(A - B):
        flag = 1

if flag == 1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9192
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#define int long long
#define double long double
#define oku7 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
using namespace std;
std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

double velocity[200000];
int accel[200000];


class Section {
public:
	double firstSpeed, lastSpeed;
	double time;
};

vector<double> t, tsum;
vector<double> v, vans;
vector<vector<double>> vels;

signed main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int tim;
		cin >> tim;
		t.push_back(tim);
	}

	tsum.push_back(t[0]);
	for (int i = 1; i < N; i++) {
		tsum.push_back(tsum[i - 1] + t[i]);
	}

	for (int i = 0; i < N; i++) {
		int vel;
		cin >> vel;
		v.push_back(vel);
	}
	//最初は0
	for (int i = 1; i <= tsum.back()*2; i++) {
		velocity[i] = i * 0.5;
	}
	//最後も0
	for (int i = tsum.back()*2; i > 0; i--) {
		velocity[i] = min((tsum.back()*2 - i)*0.5, velocity[i]);
	}

	for (int i = 0; i < (int)tsum.size();i++) {
		int l, r;
		if(i == 0){
			l = 0;
		}
		else {
			l = tsum[i - 1];
		}
		r = tsum[i];
		l *= 2;
		r *= 2;
		double velo = v[i];
		for (int j = 0; j < tsum.back() * 2; j++) {
			double nowVel;
			if (j <= l) {
				nowVel = velo + (l - j)*0.5;
			}
			else if (l <= j && j <= r) {
				nowVel = velo;
			}
			else {
				nowVel = velo + (j - r)*0.5;
			}
			velocity[j] = min(nowVel, velocity[j]);
		}
	}

	double ans = 0.0;
	for (int i = 0; i < tsum.back() * 2 + 2; i++) {
		ans += (velocity[i] + velocity[i + 1]) * 0.5 / 2.0;
	}

	cout << fixed << setprecision(1000000) << ans << "\n";

	return 0;
}

Measured memory_bytes: 10596
import sys

x,n=map(int,input().split())
p=list(map(int,input().split()))
p.sort()

if n==0:
    print(x)
    sys.exit()

if x not in p:
    print(x)
    sys.exit()
    
q=list(i for i in range(p[0]-1,p[-1]+2))

for i in p:
    q.remove(i)

ans=[]
c=x+n
for i in q:
    if c>abs(x-i):
        c=abs(x-i)
        ans.clear()
        ans.append(i)
    if c==abs(x-i):
        ans.append(i)

print(min(ans))

Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  int n,k;
  cin>>n>>k;
  if((n+1)/2>=k)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(void)
 
{
    int a,b,d,r;
    double f;
 
    scanf("%d %d",&a,&b);
 
    d = a / b;
    r = a % b;
    f = (double)a / b;
 
    printf("%d %d %f",d,r,f);
 
    return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define takearr(a,n) int a[n];for(int i=0;i<n;i++)cin>>a[i]
#define rep(i,n) for(int i=0;i<n;i++)
#define f(i,a,b) for(int i=a;i<=b;i++)
#define mods (1000*1000*1000)+7

int main()
{

  int n;cin>>n;int a1[n],a2[n],a3[n];
  rep(i,n){cin>>a1[i]>>a2[i]>>a3[i];}
  int ans[n][3];
  rep(i,n)
    {
      if(i==0){ans[i][0]=a1[i];ans[i][1]=a2[i];ans[i][2]=a3[i];}
      else
        {
          ans[i][0]=max(0,max(ans[i-1][1]+a1[i],ans[i-1][2]+a1[i]));
          ans[i][1]=max(ans[i-1][0]+a2[i],max(0,ans[i-1][2]+a2[i]));
          ans[i][2]=max(ans[i-1][0]+a3[i],max(ans[i-1][1]+a3[i],0));
        }
    }
  cout<<max(ans[n-1][0],max(ans[n-1][1],ans[n-1][2]))<<endl;
}

Measured memory_bytes: 2560
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;

long long gcd( long long m, long long n )
{
  long long a=m, b=n, tmp, r;
    /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}//gcd

int main() {
  long long n,m;
  scanf("%lld %lld", &n, &m);
  char s[1000000],t[1000000];
  scanf("%s", s);
  scanf("%s", t);

  long long g = gcd(n,m);
  long long dn = n/g, dm = m/g;

  for (long long i = 0; i<n*m/g; ) {
    if (i%dn == 0 && i%dm == 0 && i/dm<n && i/dn<m) {
      if (s[i/dm] != t[i/dn]) {
        printf("-1\n");
        return 0;
      }
    }
    i += dn*dm;
  }

  printf("%lld\n", n*m/g);

  return 0;
}


Measured memory_bytes: 888
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    c = str(inputs[0])
    c_i = ord(c)
    c_i += 1
    return chr(c_i)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


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

int main(){
    string s1,s2;
    cin>>s1;
    cin>>s2;
    short int num1{0},num2{0};
    cin>>num1;
    cin>>num2;
    string r;
    cin>>r;
    if(r==s1){
        num1--;
    }else if(r==s2){
        num2--;
    }
    cout<<num1 <<" "<<num2<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    // 変数一覧
    int n;
    int w;
    int[] weight;
    int[] value;
    long[][] dp;

    long m = 0;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        w = sc.nextInt();
        weight = new int[n];
        value = new int[n];
        for (int i = 0; i < n; i++) {
            weight[i] = sc.nextInt();
            value[i] = sc.nextInt();
        }
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        dp();
        System.out.println(dp[n][w]);
    }

    private void dp() {
        dp = new long[n+1][w+1];
        for (int i = 0; i <= w; i++) {
            dp[0][i] = 0;
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j <= w; j++) {
                if (j >= weight[i]) {
                    dp[i + 1][j] = Math.max(dp[i][j - weight[i]] + value[i], dp[i][j]);
                } else {
                    dp[i + 1][j] = dp[i][j];
                }
            }
        }
        for (int i = 0; i < n+1; i++) {
            for (int j = 0; j <= w; j++) {
                if (m < dp[i][j]) {
                    m = dp[i][j];
                }
            }
        }
    }
}

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

int main(){

    int R,G,B,N;
    cin >> R >> G >> B >> N;

    int r=0,g=0;
    long long int ans=0;
    while(1){
        while(1){
            if(N-r*R-g*G<0) break;
            if((N-r*R-g*G)%B==0) ans++;
            g++;
        }
        if(g==0) break;
        g=0;
        r++;
    }

    cout << ans << endl;
}

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

# define C continue;
# define R return

#define int long long
# define D double
# define I insert
# define ld long double
# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) v.begin() , v.end()
# define allcomp(v) v.begin() , v.end() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

#define PQ(type) priority_queue<type>
#define PQD(type) priority_queue<type, vector<type>, greater<type>>

#define mii map<int, int>
#define mll map<ll, ll>
#define mci map<char, int>
#define msi map<string, int>
#define mis map<int, string>
#define mib map<int, bool>
#define mcb map<char,bool>

#define umii unordered_map<int, int>
#define umll unordered_map<ll, ll>
#define umci unordered_map<char, int>
#define umsi unordered_map<string, int>
#define umis unordered_map<int, string>

#define init(arr,val) memset(arr,val,sizeof(arr))
#define REP(i,a,b) for(int i=a; i<b; i++)
#define distance(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";
int month[] = { -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = { -2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const int mod = 1e9 + 7 ;
#define test int t; cin>>t;
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .
void a_b_c()
{
    #ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
    #endif
}

void solve()
{
   int n,cnt=0; cin>>n;
   string str;
   cin>>str;
   int i=0,j=n-1;
   while(i<j)
   {
      if(str[i]!='W') i++;
      if(str[j]!='R') j--;
      if(str[i]=='W'&&str[j]=='R')
      {
          swap(str[i],str[j]);
          i++;
          j--;
          cnt++;
      }
   }
   cout<<cnt;
}
int32_t main()
{	fast
    int t=1;
    //freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    //int t;  cin>>t;
    for(int i=1; i<=t; i++) solve();

}


Measured memory_bytes: 3736
#include <stdio.h>

int main() {
  char n[4];
  scanf("%s", n);
  for (int i = 0; i < 3; i++) {
    if (n[i] == n[i+1]) {
      printf("Bad\n");
      return 0;
    }
  }
  printf("Good\n");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;

int main(){
  ll A,B,C;
  cin>>A>>B>>C;
    
  if(A==B&&B==C){
  cout<<"No"<<endl;
  }
else  if(A!=B&&B!=C&&A!=C){
  cout<<"No"<<endl;
  }
  else{
  cout<<"Yes"<<endl;
  }
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    /*
    let v = read_vec::<String>();
    println!("{}{}", v[1], v[0]);
    */
    let v = read_vec::<i64>();
    let (mut a, mut b, mut k) = (v[0], v[1], v[2]);
    if k > a {
        k -= a;
        a = 0;
    } else {
        a -= k;
        k = 0;
    }
    b = max(0, b - k);
    println!("{} {}", a, b);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int q = sc.nextInt();
		Map<String, Integer> map = new HashMap<>();

		for(int i = 0; i < q; i++) {
			int query = sc.nextInt();
			String key = sc.next();

			if(query == 0) {  //insert
				int x = sc.nextInt();
				map.put(key, x);
			}
			else if(query == 1){  //get
				System.out.println(map.getOrDefault(key, 0));
			}
			else map.remove(key);
		}
	}

}



Measured memory_bytes: 195388
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int n;
  cin >> n;
  int ans=0;
  for(int i=1;i<=n;i++){
    int cur;
    cin >> cur;
    if(cur%2==1 && i%2==1) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
int bsr(int x) { return 31 - __builtin_clz(x); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
    int n;
    cin >> n; n *= 3;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(begin(v), end(v));
    ll sm = 0;
    int l = 0, r = n;
    while (r-l >= 3) {
        r -= 2; l++;
        sm += v[r];
    }
    cout << sm << endl;
    return 0;
}


Measured memory_bytes: 1408
using System;
using System.Linq;

public class Hello
{
    public static void aiueo(string str)
    {
        int sum=0;
        for(int i=0;i<str.Length;i++)sum+=int.Parse(str[i].ToString());
        
        Console.WriteLine(sum);
    }
    
    public static void Main()
    {
        string str=Console.ReadLine();
        for(;str!="0";){
            aiueo(str);
            str=Console.ReadLine();
        }
        
    }
}


Measured memory_bytes: 15964
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main() {
	ll I, O, T, J, L, S, Z;
	cin >> I >> O >> T >> J >> L >> S >> Z;
	ll ans = 2 * (I / 2) + O + 2 * (J / 2) + 2 * (L / 2);
	if(I % 2 == 1 && J % 2 ==1 && L % 2 == 1)
		ans += 3;
	else if(I % 2 + J % 2 + L % 2 == 2 && I > 0 && J > 0 && L > 0)
		ans++;
	cout << ans << endl;
	return 0;
}


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




int main(){

	int n;
	long long a[200000];
	long long x = 0,y = 0, sum = 0;
	long long min = 9223372036854775807;

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

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

	for(int i=0;i<n-1;i++){
		x += a[i];
		y = sum -x;
		if(min > labs(x - y)){
			min = labs(x - y);
//			cout <<min <<endl;
		}
	}
	cout <<min <<endl;

	return 0;
}


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

int main() {
    vector<int> X(5);

    for (auto &&x : X) {
        cin >> x;
    }

    for (int i = 0; i < X.size(); ++i) {
        if (X[i] == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] header = reader.readLine().split(" ");
        int vertexCount = Integer.parseInt(header[0]);
        int edgeCount = Integer.parseInt(header[1]);

        Map<Integer, List<Integer>> edges = new HashMap<>();
        for (int i = 0; i < vertexCount; ++i) {
            edges.put(i, new ArrayList<>());
        }
        int[] incoming = new int[vertexCount];

        for (int i = 0; i < edgeCount; ++i) {
            String[] parts = reader.readLine().split(" ");
            int src = Integer.parseInt(parts[0]) - 1;
            int dst = Integer.parseInt(parts[1]) - 1;
            edges.get(src).add(dst);
            incoming[dst] += 1;
        }

        ArrayDeque<Integer> queue = new ArrayDeque<>();
        for (int i = 0; i < vertexCount; ++i) {
            if (incoming[i] == 0) {
                queue.addLast(i);
            }
        }

        ArrayList<Integer> sorted = new ArrayList<>();
        while (!queue.isEmpty()) {
            int vertex = queue.removeFirst();
            for (int dst : edges.get(vertex)) {
                incoming[dst] -= 1;
                if (incoming[dst] == 0) {
                    queue.addLast(dst);
                }
            }
            sorted.add(vertex);
        }

        int[] dp = new int[vertexCount];
        int maxPath = 0;
        for (int vertex : sorted) {
            for (int dst : edges.get(vertex)) {
                dp[dst] = Math.max(dp[dst], dp[vertex] + 1);
                maxPath = Math.max(maxPath, dp[dst]);
            }
        }

        System.out.println(maxPath);
    }
}


Measured memory_bytes: 77504
#include "bits/stdc++.h"

using namespace std;

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

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

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

	int n; cin >> n;
	vector<P> v(n);
	map<P, int> mp;
	for (int i = 0; i < n; i++) {
		int x, y, w; cin >> x >> y >> w;
		v[i] = P(x, y);
		mp[v[i]] = w;
	}
	int ma = 0;
	for (int i = 0; i < n; i++) {
		int x = v[i].first, y = v[i].second;
		for (int j = 0; j < 8; j += 2) {
			int sum = mp[P(x, y)] + mp[P(x + dx[j], y + dy[j])] + mp[P(x + dx[(j + 1)%8], y + dy[(j + 1)%8])] + mp[P(x + dx[(j + 2)%8], y + dy[(j + 2)%8])];
			ma = max(ma, sum);
		}
	}
	cout << ma <<" / 1" <<endl;
}

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

int h;
int const MAX = 2000000;

int parent(int i){return i / 2;}
int left(int i){return i * 2;}
int right(int i){return i * 2 + 1;}

void maxHeapify(int t[], int i){
  int large;
  int l = left(i);
  int r = right(i);
  if(l <= h && t[l] > t[i]) large = l;
  else large = i;
  if(r <= h && t[r] > t[large]) large = r;
  if(large != i){
    swap(t[i], t[large]);
    maxHeapify(t, large);
  }
}

void buildMaxHeap(int t[]){
  for(int i=h/2;i>=1;i--){
    maxHeapify(t, i);
  }
}

void heapIncreaseKey(int t[], int i, int key){
  if(key < t[i]) return;
  t[i] = key;
  while(t[parent(i)] < t[i] && i > 1){
    swap(t[parent(i)], t[i]);
    i = parent(i);
  }
}

void insert(int t[], int key){
  h++;
  t[h] = -numeric_limits<int>::infinity();
  heapIncreaseKey(t, h, key);
}

int extract(int t[]){
  int ans = t[1];
  t[1] = t[h];
  h--;
  maxHeapify(t, 1);
  return ans;
}

int main(){
  int tree[MAX + 1];
  string com;
  int k;
  while(1){
    cin >> com;
    if(com == "end") break;
    else if(com == "insert"){
      cin >> k;
      insert(tree, k);
    }
    else if(com == "extract"){
      cout << extract(tree) << endl;
    }
  }
  // for(int i=1;i<=h;i++){
  //   cout << " " << tree[i];
  // }
  // cout << endl;
  return 0;
}



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


int main(){
    int n;
    int b,f,r,v;
    int num_b = 4;
    int num_f = 3;
    int num_r = 10;
    cin >> n;
    int num_guest[num_b + 1][num_f + 1][num_r + 1];
    std::fill(num_guest[0][0], num_guest[num_b + 1][0], 0);
    
    for(int i = 0; i < n; i++){
        cin >> b >> f >> r >> v;
        num_guest[b][f][r] += v;
    }
    
    for(int building = 1; building < num_b + 1; building++){
        for(int floor = 1; floor < num_f + 1; floor++){
            for(int room = 1; room < num_r + 1; room++){
                cout << " " << num_guest[building][floor][room];
            }
            cout << endl;
        }
        if(building == num_b){
            continue;
        }else{
            cout << "####################" << endl;
        }
    }
}



Measured memory_bytes: 3116
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;

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

	int d, n;
	cin >> d >> n;

	int nd = 1;
	rep(i, d) nd *= 100;

	if (n <= 99) {
		out(nd * n);
	}
	else {
		out(nd * 101);
	}

	return 0;
}

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

ll fp(ll base, int idx) {
	if (idx == 0) return 1;
	ll t = fp(base, idx/2);
	t = t * t % P;
	if (idx % 2) t = t * base % P;
	return t;
}

ll inv(ll x) {
	return fp(x, P-2);
}


vector <int> fac;
int main() {
	int n, m, M; cin >> n >> m; M = m; 
	for (int i = 2; i*i <= M; i ++) {
		if (m % i == 0) {
			int idx = 0;
			while (m % i == 0) { idx ++; m /= i; }
			fac.push_back(idx);
		}
	}
	if (m > 1) fac.push_back(1);
	ll ans = 1;
	for (int i = 0; i < fac.size(); i ++) {
		for (int j = 1; j <= fac[i]; j ++) 
			ans = ans * (n+fac[i]-j+P) % P * inv(j) % P;
	}	
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main() {
  int n, k; cin >> n >> k;
  vector<long> hs(n);
  for (int i = 0; i < n; ++i) {
    cin >> hs[i];
  }

  sort(hs.begin(), hs.end());

  long min = 1000000000;
  for (int i = k - 1; i < n; ++i) {
    long sub = hs[i] - hs[i - k + 1];
    if (sub < min) min = sub;
  }

  cout << min << endl;

  return 0;
}

Measured memory_bytes: 1024
def input_from_console():
    p, q, r = map(int, input().split())
    return p, q, r


def solve(p, q, r ):
    duration_list = [p, q, r]
    duration_list.sort()
    return sum(duration_list[:-1])


def main():
    p, q, r  = input_from_console()
    print(solve(p, q, r ))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


Measured memory_bytes: 3060
def main():
    N, K = map(int, input().split())
    S = input()

    if S[K-1] == 'A':
        char = 'a'
    elif S[K-1] == 'B':
        char = 'b'
    elif S[K-1] == 'C':
        char = 'c'

    print(S[:K-1] + char + S[K:N])


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using vll = vector<ll>;
using vdouble = vector<double>;
using vstr = vector<string>;
typedef pair<int,int> P;
int dx[4] = {1, 0, -1, 0},dy[4] = {0, 1, 0, -1};


int main(){
    ll N,Max=1;
    cin>>N;
    vstr S(N);
    REP(i,N) cin>>S[i];
    vll t(N);
    t[0]=1;
	VSORT(S);
	REP(i,N-1){
		if(S[i]==S[i+1]) t[i+1]=t[i]+1;
		else t[i+1]=1;
	}
	REP(i,N){
		Max=max(t[i],Max);
	}
	REP(i,N){
		if(t[i]==Max)cout<<S[i]<<endl;
	}
}


Measured memory_bytes: 16000
#include <iostream>
int main()
{
    long n;
    std::cin>>n;
    long double check=1;
    long double a;
    long long ans=1;
    for(int i=0;i<n;i++){
        std::cin>>a;
        ans*=a;
        check*=a;
    } 
    if(check>1000000000000000000){
        std::cout<<"-1"<<std::endl;
    }
    else{
        std::cout<<ans<<std::endl;
    }
}

Measured memory_bytes: 3788
#include <iostream>
#include <sstream>  // istringstream
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main()
{   
    int H, W;
    cin >> H >> W;
    char a[H][W];
    for(int i=0; i<H; ++i){
        for(int j=0; j<W; ++j){
            cin >> a[i][j];
        }
    }
    
    char ans[2*H][W];
    for(int i=0; i<H; ++i){
        for(int j=0; j<W; ++j){
            ans[2*i][j] = a[i][j];
            ans[2*i+1][j] = a[i][j];
        }
    }
    
    for(int i=0; i<2*H; ++i){
        for(int j=0; j<W; ++j){
            cout << ans[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;

int main(){
    
    int N;
    int A[1000];
    int v;
    int j;
    
    cin >> N;
    for ( int i = 0; i < N; i++ ){
        cin >> A[i];
    } 
    
    for ( int k = 0; k < N; k++){
            if ( k == N - 1 ){
                cout << A[k] << endl;
                break;
            }
            cout << A[k] << " " ;
        }
    
    for ( int i = 1; i < N; i++){
        
        v = A[i];
        j = i - 1;
        while ( j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        for ( int k = 0; k < N; k++){
            if ( k == N - 1 ){
                cout << A[k] << endl;
                break;
            }
            cout << A[k] << " " ;
        }
    }
}



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

g = [[1] * (n + 1) for _ in range(n + 1)]

if n % 2:
    for i in range(1, n + 1):
        j = n - i
        g[i][j] = 0
        g[j][i] = 0

else:
    for i in range(1, n + 1):
        j = n + 1 - i
        g[i][j] = 0
        g[j][i] = 0

ans = []
for i, row in enumerate(g[1:], 1):
    for j, bl in enumerate(row[i+1:], i+1):
        if bl:
            ans.append((i, j))

print(len(ans))
for i, j in ans:
    print(i, j)


Measured memory_bytes: 3996
#B
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
s = 0
past = -1
for i in a:
    s += b[i - 1]
    if i == past + 1:
        s += c[past - 1]
    past = i

print(s)


Measured memory_bytes: 3060
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int k = in.nextInt();
        int x = in.nextInt();
        final int MIN = -1000000;
        final int MAX = 1000000;
        int right = Math.min(x + k - 1, MAX);
        for (int i = Math.max(x - k + 1, MIN); i <= right; ++i)
            out.print(i + (i == right ? "\n" : " "));
        out.close();
    }
}


Measured memory_bytes: 21972