akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main()
{
	int a,b;
	while(scanf("%d",&a)!=EOF&&a)
	{
		int b[10000]={0};
		int i,j;
		for(i=0;i<a;i++)
		{
			scanf("%d",&b[i]);
		}
		printf("%d",b[i-1]);
		for(j=i-2;j>=0;j--)
		{
			printf(" %d",b[j]);
		}
		printf("\n");
	}
	return 0;
 } 

Measured memory_bytes: 1076
//A
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
int A, B;

int main()
{
  cin >> A >> B;
  if(A >=13){
    cout << B << endl;
  } else if (A>=6 && A <=12 ){
    cout << B/2 << endl;
  } else {
    cout << "0" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define mod2 998244353
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define sz(v) ((ll)(v).size())
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define pb push_back
	#define f first
	#define s second
	#define dbg(a) cout<<#a<<" --> "<<(a)<<"\n";
	#define forn(i,n) for (ll i=0; i<(n); ++i)
	#define fornd(i,n) for (ll i=(n)-1; i>=0; --i)
	#define forab(i,a,b) for (ll i=(a); i<=(b); ++i)
	#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
	using namespace std;
	bool isPowerOfTwo(int x) {
    return x && (!(x & (x - 1)));
	}
	int takemod(int x) {
    return (x % mod + mod) % mod;
	}
 
	ll fpow(ll base, ll power, ll MOD) {
    ll result = 1;
    base = base % MOD;
    while (power) {
        if (power & 1)
            result = (result * base) % MOD;
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result;
	}
	ll modinv(ll x) {return fpow(x, mod - 2, mod);}
	ll n,m;
	vll fact(500000+2,1);
	vll invfact(500000+2,1);
	void ini()
	 {
		fact[0]=1;
		invfact[0]=1;
		forab(i,1,m+3)
		{
			fact[i]=(i%mod*fact[i-1]%mod)%mod;
			invfact[i]=modinv(fact[i]);
		}		
		
	}	
 
	ll permute(ll n,ll k)
	{
		return (fact[n]%mod*invfact[n-k]%mod)%mod;
	}
	ll comb(ll n,ll k)
	{
		return (permute(n,k)%mod*invfact[k]%mod)%mod;
	}
	void solve()
	{
		cin>>n>>m;
		ini();
		//dbg(fact[0]);
		ll cur=1;
		ll add=1LL;
		ll ans=0;
		forab(i,0,n)
		{
			ans=(ans%mod+(cur)*comb(n,i)%mod*comb(m-i,n-i)%mod*fact[n-i]%mod+mod)%mod;
			cur*=-1;
		}
		cout<<(ans%mod*comb(m,n)%mod*fact[n]%mod)<<endl;
		
	}
	int main()
	{	
		#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		#endif
		fast_io;
		int T=1;
	//	cin>>T;
		// cin.ignore(); must be there when using getline(cin, s)
		while(T--)
		{
			solve();
		}
		return 0;
	}


Measured memory_bytes: 10928
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 10;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif 


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

    int N, Q; cin >> N >> Q;
    vi A(N - 1), B(N - 1);
    REP(i, N - 1) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
    }

    vi P(Q), X(Q);
    REP(i, Q) {
        cin >> P[i] >> X[i];
        P[i]--;
    }

    vi c(N, 0);
    vi ps(N);
    REP(i, N - 1) {
        ps[B[i]] = A[i];
    }

    REP(i, Q) {
        c[P[i]] += X[i];
    }

    for (int i = 1; i < N; i++) {
        c[i] += c[ps[i]];
    }

    cout << c[0];
    FOR(i, 1, N) cout << " " << c[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,x;
  cin >> n >> x;
  int mini = 1000000;
  vector<int>m(n);
  int sum = 0;
  for(int i = 0;i < n;i++){
    cin >> m[i];
sum += m[i];
mini = min(mini,m[i]);
  }
  int a = x-sum;
  int b = a/mini;
cout << n+b <<endl;
}



Measured memory_bytes: 256
if __name__ == '__main__':
    n = int(input())
    a = [int(input()) for _ in range(n)]
    max_a = max(a)
    if a.count(max_a) > 1:
        for i in range(n):
            print(max_a)
    else:
        index = a.index(max_a)
        max2_a = sorted(a, reverse=True)[1]
        for i in range(n):
            if index == i:
                print(max2_a)
            else:
                print(max_a)



Measured memory_bytes: 13320
#include <stdio.h>

int main(void) {
    char s[4];
    scanf("%s", s);
    int j;
    int i = 0;
    int tmpcount;
    int flag = 1;
    int same;
    same = 1;
    if(s[0]==s[1] && s[0]==s[2]){
        if(s[0] == s[3]){
            same = 0;
        }
    }
    while(s[i]){
        flag = 1;
        for(j=i+1;j<4;j++){
            tmpcount = j;
            if(s[i]==s[j]){
                while(s[tmpcount]){
                    s[tmpcount] = s[tmpcount+1];
                    tmpcount++;
                }
                tmpcount = i;
                while(s[tmpcount]) {
                    s[tmpcount] = s[tmpcount+1];
                    tmpcount++;
                }
                flag = 0;
                break;
            }
        }
        if(flag==1)
            break;

    }
    if(s[0]=='\0' && same!=0)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
set<string> items;
int n;
string s;
int main() {
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> s;
		items.insert(s);
	}
	cout << items.size() << "\n";
	return 0;
}

Measured memory_bytes: 19224
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        String S;

        try (Scanner sc = new Scanner(System.in)) {
            S = sc.next();
        }
        char[] carr = S.toCharArray();
        int bitSign = 0;
        while (bitSign < 8) {
            int sign1 = (bitSign >>> 2) & 0x1;
            int sign2 = (bitSign >>> 1) & 0x1;
            int sign3 = bitSign & 0x1;

            int result = 0;
            result += (carr[0] - 48);
            result += ((sign1 == 0) ? (carr[1] - 48) : -(carr[1] - 48));
            result += ((sign2 == 0) ? (carr[2] - 48) : -(carr[2] - 48));
            result += ((sign3 == 0) ? (carr[3] - 48) : -(carr[3] - 48));
            if (result == 7) {
                char s1 = sign1 == 0 ? '+' : '-';
                char s2 = sign2 == 0 ? '+' : '-';
                char s3 = sign3 == 0 ? '+' : '-';
                StringBuilder sb = new StringBuilder();
                sb.append(carr[0]).append(s1).append(carr[1]).append(s2).append(carr[2]).append(s3).append(carr[3]).append("=7");
                System.out.println(sb.toString());
                return;
            }
            bitSign++;
        }
        //System.out.println(0);
    }
}


Measured memory_bytes: 22736
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
	char s[20],t[20]="CODEFESTIVAL2016";
	int i, ans = 0;;
	scanf("%s", s);
	for (i = 0; i < 16; i++) {
		if (s[i] != t[i])ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
const int N = 100003;
int n, a[N], ans, now, fac[N], alp[N], tot;
inline int gcd(int a, int b){return b ? gcd(b, a % b) : a;}
int main(){
	scanf("%d", &n);
	for(Rint i = 1;i <= n;i ++) scanf("%d", a + i);
	if(n == 1){
		puts("1000000000");
		return 0;
	}
	ans = a[2];
	for(Rint i = 3;i <= n;i ++) ans = gcd(ans, a[i]);
	for(Rint i = 1;i * i <= a[1];i ++)
		if(!(a[1] % i)){
			fac[++ tot] = i;
			if(i * i != a[1]) fac[++ tot] = a[1] / i;
		}
	for(Rint i = 1;i <= tot;i ++){
		int cnt = 0;
		for(Rint j = 2;j <= n;j ++)
			if(!(a[j] % fac[i])) ++ cnt;
		if(cnt >= n - 2) ans = max(ans, fac[i]);
	}
	printf("%d", max(ans, now));
}

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

int n, m;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int x, y, z, ans = 0;
    cin >> n >> m;
    UnionFind uf(n);
    for (int i = 0; i < m; i++) {
        cin >> x >> y >> z;
        x--;
        y--;
        uf.merge(x, y);
    }
    for (int i = 0; i < n; i++) {
        if (uf.root(i) != i) continue;
        ans += 1;
    }
    cout << ans << endl;
    return 0;
}

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

const int INF = (1 << 30) - 1;

struct Edge
{
    int to, time;
    Edge () {}
    Edge ( int to, int time ) : to(to), time(time) {}
};

int N, M;
using T = pair < int , int >;
priority_queue < T , vector < T > , greater < T > > pq;
int min_cost[100005];
vector < Edge > G[100005];

int main()
{
    int maxv = -1;

    scanf("%d %d", &N, &M);

    while ( M-- ) {
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c); --a, --b;
        G[a].emplace_back(b, c);
    }

    fill_n(min_cost, 100005, INF);
    min_cost[0] = 0;
    pq.emplace(0, 0);

    while ( !pq.empty() ) {
        T d = pq.top(); pq.pop();
        if ( d.first > min_cost[d.second] ) continue;
        for ( auto x : G[d.second] ) {
            if ( x.to == N - 1 ) {
                if ( d.first <= x.time ) {
                    maxv = max(maxv, x.time);
                }
            } else {
                if ( d.first <= x.time && x.time < min_cost[x.to] ) {
                    min_cost[x.to] = x.time;
                    pq.emplace(x.time, x.to);
                }
            }
        }
    }
    cout << maxv << endl;

    return ( 0 );
}



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

using namespace std;

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            return 0;
        }
        int a = 0, b = 0;
        for (int i = 0; i < n; ++i) {
            int ai, bi;
            cin >> ai >> bi;
            if (ai == bi) {
                a += ai;
                b += bi;
            }
            else if (ai > bi) {
                a += ai + bi;
            }
            else {
                b += ai + bi;
            }
        }
        cout << a << " " << b << endl;
    }
}

Measured memory_bytes: 1160
import sys
import numpy as np
input = sys.stdin.readline
A = list(input().rstrip())
B = list(input().rstrip())
N = len(A)
change_1 = [[0] * 26 for _ in range(26)]
change_2 = [[0] * 26 for _ in range(26)]
alpha2num = lambda c: ord(c) - ord("a")
for i, j in zip(A, B):
    change_1[alpha2num(i)][alpha2num(j)] += 1
change_1 = np.array(change_1)
for i, j in zip(B, A):
    change_2[alpha2num(i)][alpha2num(j)] += 1
change_2 = np.array(change_2)
for k in change_1:
    if np.count_nonzero(k) > 1:
        print("No")
        sys.exit()
for k in change_2:
    if np.count_nonzero(k) > 1:
        print("No")
        sys.exit()
print("Yes")

Measured memory_bytes: 16128
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
using namespace std;

bool func(vector<int>& v, vector<int>& a){
  if(v.size() == 3){
    int ret = a[0];
    for(int i = 0; i < 3; i++){
      if(v[i] == 0) ret += a[i + 1];
      else ret -= a[i + 1];
    }
    if(ret == 7){
      cout << a[0];
      for(int i = 0; i < 3; i++){
        if(v[i] == 0) cout << '+';
        else cout << '-';
        cout << a[i + 1];
      }
      cout << "=7\n";
      return true;
    }
    else return false;
  }
  v.push_back(0);
  bool b1 = func(v, a);
  v.pop_back();
  if(b1 == true) return true;
  v.push_back(1);
  bool b2 = func(v, a);
  v.pop_back();
  if(b2 == true) return true;
  return false;
}

void solve(){
  string s; cin >> s;
  vector<int> a(4);
  for(int i = 0; i < 4; i++){
    a[i] = s[i] - '0';
  }
  vector<int> v;
  func(v, a);
  return;
}

int main(){
  solve();
  return 0;
}


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

int main(void) {
	int n;
	int x = 0;
	int max = 0;
	string s;
	cin >> n;
	cin >> s;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'I') {
			x++;
		}
		else {
			x--;
		}
		if (x > max) {
			max = x;
		}
	}
	cout << max << endl;
	return 0;
}

Measured memory_bytes: 256
/*input
6
30 10 60 10 60 50
*/

#include <bits/stdc++.h>
#define pb(x) push_back(x);
#define in(y) insert(y);
#define tt(t) while(t--)
#define int long long int
#define itr ::iterator it;
#define ll long long
#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
#define si set<int>                      
#define msi map<string, int>
#define lines printsf("\n")
#define ff(n) for(int i=0;i<n;i++)
#define fors(i,a,b) for(int i=a;i<b;i++)
#define all(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
const int MOD = 998244353;
int n;
int dp[200000][3];
vi a1,a2,a3;
int solve(int pos,int prev){
	if(pos==n-1) return 0;
	if(dp[pos][prev]!=-1) return dp[pos][prev];
	int ret=0;
	ff(3){
		if(i==prev) continue;
		if(i==0){
			ret = max(ret,solve(pos+1,i)+a1[pos+1]);
		}
		else if(i==1){
			ret = max(ret,solve(pos+1,i)+a2[pos+1]);	
		}
		else{
			ret = max(ret,solve(pos+1,i)+a3[pos+1]);	
		}
	}
	return dp[pos][prev]=ret;
}
signed main(){
	//ff(1000000-1) dp[i]=-1;
	ff(100009){
		fors(j,0,3){
			dp[i][j]=-1;
		}
	}
	
	cin>>n;
	a1.resize(n);
	a2.resize(n);
	a3.resize(n);
	ff(n){
		cin>>a1[i]>>a2[i]>>a3[i];
		
	}
	int ans = max(solve(0,0)+a1[0],max(solve(0,1)+a2[0],a3[0]+solve(0,2)));
	cout<<ans;
	
}



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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const int MOD = 1000003;
int q;
int x,d,n;
ll fact[MOD+1];
ll inv[MOD+1];

long long mod_pow(long long a, long long b)
{
  if (b == 0) return 1;
  long long ret = mod_pow(a, b/2);
  ret = ret * ret % MOD;
  if (b % 2 == 1) ret = a * ret % MOD;
  return ret;
}

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  fact[0] = 1;
  forn1(i,MOD) {
    fact[i] = fact[i-1] * i % MOD;
    inv[i] = mod_pow(fact[i], MOD-2);
  }

  cin >> q;
  while (q--) {
    cin >> x >> d >> n;
    if (d == 0) {
      cout << mod_pow(x,n) << endl;
    } else {
      ll init = x * mod_pow(d,MOD-2) % MOD;
      ll res;
      if (init + n - 1 >= MOD) {
        res = 0;
      } else {
        res = fact[init+n-1] * inv[init-1] % MOD;
      }
      cout << res * mod_pow(d,n) % MOD << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 16512
#include <bits/stdc++.h>
#define N 200006
using namespace std;
int  a,b;
int main()
{
	scanf("%d%d",&a,&b);
	if(a==b)return puts("Draw"),0;
	if(a==1)return puts("Alice"),0;
	if(b==1)return puts("Bob"),0;
	if(a>b)return puts("Alice"),0;return puts("Bob"),0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int main()
{
  int n, k;
  cin>>n>>k;
  int m=2*k;
  vector<vecint> imos(m+1, vecint(m+1, 0));
  REP(i,n) {
    int x, y;
    string s;
    cin>>x>>y>>s;
    x %= m;
    y %= m;
    REP(p,4)REP(q,4) {
      if (((p + q) % 2 == 0) != (s[0] == 'B')) continue;
      int left = min(m, max(0, p*k - x));
      int top = min(m, max(0, q*k - y));
      int right = min(m, max(0, (p+1)*k - x));
      int bottom = min(m, max(0, (q+1)*k - y));
      ++imos[left][top];
      --imos[right][top];
      --imos[left][bottom];
      ++imos[right][bottom];
    }
  }
  REP(i,m) {
    REP(j,m+1) {
      imos[i+1][j] += imos[i][j];
    }
  }
  REP(i,m+1)REP(j,m) {
    imos[i][j+1] += imos[i][j];
  }
  int mx = 0;
  REP(i,m)REP(j,m) mx = max(mx, imos[i][j]);
  cout << mx << endl;
  return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  
  rep(i,n) cin>>a[i];
  bool ok=true; 
  rep(i,n) {
    if(a[i]%2==1) continue;
    if(a[i]%3 !=0 && a[i]%5 !=0) ok=false;
  }
  if(ok) cout<<"APPROVED"<<endl;
  else   cout<<"DENIED"<<endl;
  
return 0;
}


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



using namespace std;

int main(){
  
  long long int n,k;
  cin>>n>>k;
  
  map<int,long long int> checker;
  int tmp_key,tmp_num;
  for(int i=0;i<n;i++){
    cin>>tmp_key>>tmp_num;
    checker[tmp_key]+=tmp_num;
  }
  for(pair<int,long long int> p:checker){
   
    k-=p.second;
     
    if(k<=0){
      
      cout<<p.first<<endl;
      return 0;
    }
  }


  return 0;
}


Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if (H == 0 && W == 0) {
                break;
            }
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    System.out.print("#");
                }
                System.out.println("");
            }
            System.out.println("");
        }
        sc.close();
    }
}


Measured memory_bytes: 34996
#pragma region template

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

//--type
using str = string;
using ll = int64_t;
using pii = pair<int64_t, int64_t>;
using pis = pair<int64_t, str>;
using psi = pair<str, int64_t>;
using vi = vector<int64_t>;
using vvi = vector<vector<int64_t>>;
using vs = vector<str>;
using vpii = vector<pair<int64_t, int64_t>>;


//--const
constexpr ll MOD = 1000000007;

constexpr ll INF = ll(0x3f0000003f000000);
constexpr double EPS = 1e-9;
constexpr int dx[] = {0, 1, 0, -1, 1, -1, 1, -1},
              dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


// clang-format off
//--define
#define _overload3(_1, _2, _3, name, ...) name
#define  rep(...) _overload3(__VA_ARGS__,  _rep3,  _rep2,)(__VA_ARGS__)
#define repc(...) _overload3(__VA_ARGS__, _repc3, _repc2,)(__VA_ARGS__)
#define repr(...) _overload3(__VA_ARGS__, _repr3, _repr2,)\(__VA_ARGS__)
#define repcr(...) _overload3(__VA_ARGS__,_repcr3,_repcr2,)(__VA_ARGS__)
#define _rep(i,k,n) for(int i=(k)   , i##_len=(n); i < i##_len; ++i)
#define   _rep2(i  ,n) _rep(i,0,n) 
#define   _rep3(i,k,n) _rep(i,k,n)
#define  _repc2(i  ,n) _rep(i,1,n+1)
#define  _repc3(i,k,n) _rep(i,k,n+1) 
#define _repr(i,k,n) for(int i=(n-1), i##_len=(k); i >=i##_len; --i)
#define  _repr2(i  ,n) _repr(i,0,n)
#define  _repr3(i,k,n) _repr(i,k,n) 
#define _repcr2(i  ,n) _repr(i,1,n+1)
#define _repcr3(i,k,n) _repr(i,k,n+1)

#define all(o) begin(o), end(o)
#define sz(a) ((int)(a).size())
#define debug(...) debug_args(__LINE__, __VA_ARGS__)
#define bit(n) (1LL<<(n))


//--functions
inline bool in(string s, string c) {return (s.find(c) != string::npos);}
inline bool in(string s,   char c) {return (s.find(c) != string::npos);}

template <class T> T udiv(T a, T b) {return (a + b - 1) / b;}
template <class T> T rdiv(T a, T b) {return (a + b / 2) / b;}

void print_args(ostream&) {}
template <class S, class... T>
void print_args(ostream& out,const S& a,const T&... args) {
    out << ' ' << a;
    print_args(out, args...);
}
template <class S, class... T>
void print(const S& a, const T&... args) {
    std::cout << a;
    print_args(std::cout, args...);
    std::cout << '\n';
}
template <class S, class... T>
void debug_args(const S& a, const T&... args) {
    std::cout << "(L:" << std::setw(3) << a << ")";
    print_args(std::cout, args...);
    std::cout << '\n';
}
// clang-format on

struct setup_main {
    setup_main() {
        std::cin.tie(0);
        std::ios::sync_with_stdio(0);
        std::cout << fixed << setprecision(15);
    }
} setup_main_;

ll ans = 0;
#pragma endregion

void solve(long long N, long long R) {
    ans = R;
    if (N < 10) {
        ans += 100 * (10 - N);
    }
    print(ans);
}
signed main() {
    long long N;
    scanf("%lld", &N);
    long long R;
    scanf("%lld", &R);
    solve(N, R);

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int buf = 0;
        int counter = 1;
        while ((buf = input.nextInt()) != 0) {
            System.out.println(String.format("Case %d: %d", counter++, buf));
        }
    }
}



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

int main() {
    int n,m,a,b;
    cin>>n>>m;
    vector<vector<int>> g(n);
    rep(i,m) {
        cin>>a>>b;
        a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<int> q;
    q.push(0);
    vector<int> ans(n);
    vector<bool> visited(n,false);
    visited[0]=true;
    while(!q.empty()) {
        int v=q.front();
        q.pop();
        for (int nv:g[v]) {
            if (visited[nv]) continue;
            q.push(nv);
            ans[nv]=v;
            visited[nv]=true;
        }
    }
    cout<<"Yes"<<endl;
    for (int i=1; i<n; i++) {
        cout<<ans[i]+1<<endl;
    }
}


Measured memory_bytes: 10136
#include <iostream>

#include <string>

using std::cin;
using std::cout;
using std::endl;

using std::string;

static string
make_str(int a, int b)
{
  char buf[10];
  for (int i = 0; i < a; i++)
  {
    buf[i] = '0' + b;
    buf[i + 1] = '\0';
  }
  return string(buf);
}

static string
solve(int a, int b)
{
  string a_str = make_str(a, b);
  string b_str = make_str(b, a);
  return a_str < b_str ? a_str : b_str;
}

int
main()
{
  int a, b;
  cin >> a >> b;
  cout << solve(a, b) << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;

const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define FILE(s) freopen(s"in", "r", stdin), freopen(s"out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T>
inline void chkmin(T&a, T b) { a = a < b ? a : b; }

char s[510][510];
char a[510][510];
char b[510][510];

int main() {
#ifdef LOCAL
	FILE("");
#endif

	int n = ri, m = ri;

	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) {
			char c = ge;
			while(c != '.' && c != '#') c = ge;
			s[i][j] = c;
		}

	for(int i = 1; i <= n; i++)
		a[i][1] = '#', a[i][m] = '.',
		b[i][1] = '.', b[i][m] = '#';
	
	for(int i = 1; i <= n; i++)
		for(int j = 2; j < m; j++)
			if(i & 1) a[i][j] = '#', b[i][j] = '.';
			else a[i][j] = '.', b[i][j] = '#';

	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			if(s[i][j] == '#')
				(i & 1 ? b[i][j] : a[i][j]) = '#';

	for(int i = 1; i <= n; i++) printf("%s\n", a[i] + 1);
	puts("");
	for(int i = 1; i <= n; i++) printf("%s\n", b[i] + 1);

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <assert.h>
#include <cstdio>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;


//----------------------------------------------------------------

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    while (a > 0)
    {
        c -= b;
        if (c <= 0)
        {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if (a <= 0)
        {
            cout << "No" << endl;
            break;
        }
    }
}


Measured memory_bytes: 3600
INF = 1 << 29
def solve
  memo = [INF] * (1<<$n)
  memo[0] = 0
  (1<<$n).times do |bits|
    next if memo[bits] == INF
    $n.times do |i|
      next if bits | (1<<i) == bits
      nbits = bits | (1<<i)
      mint = 0
      (0..$n).each do |j|
        k = $stg[i][j][1]
        if k < 0 || bits | 1<<k == bits
          mint = memo[bits] + $stg[i][j][0]
          break
        end
      end
      memo[nbits] = mint if memo[nbits] > mint
    end
  end
  memo[(1<<$n)-1]
end

while $n = gets.to_i
  break if $n == 0
  $stg = $n.times.map{ gets.split.map(&:to_i)
                 .map.with_index(-1) { |t, i| [t, i] }
                 .sort }
  p solve
end

Measured memory_bytes: 15800
n, m = map(int, input().split())
x = []

for i in range(n):
    x.append(list(map(int, input().split())))

y = []
for i in range(m):
    y.append(int(input()))

for i in range(n):
    s = 0
    for j in range(m):
        s += x[i][j] * y[j]
    print(s)


Measured memory_bytes: 6012
#include <iostream>
#include <vector>
#include <string>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

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

    if((n%((n/1000000000)+((n/100000000)%10)+((n/10000000)%10)+
    ((n/1000000)%10)+((n/100000)%10)+((n/10000)%10)+
    ((n/1000)%10)+((n/100)%10)+((n/10)%10)+n%10))==0){
        cout << "Yes" << endl;

    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define cinf(n,x) for(int i=0;i<(n);I++) cin >> x[i];

int main(){
  string s;
  cin >> s;
  if(s == "a"|| s == "i" || s == "u" || s == "e" || s == "o")
    cout <<"vowel" <<endl;
  else
    cout << "consonant" << endl;
}


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

using namespace std;
typedef long long ll;
const ll inf=(1ll<<61);
const ll mod=1e9+7;
const int MX=3e5+9;
int n,x,y,z,m,vis[MX],par[MX];
int get(int x){
    if(x==par[x])return x;
    return par[x]=get(par[x]);
}
void mrg(int x,int y){
    x=get(x);y=get(y);
    if(x==y)return;
    par[x]=y;
}
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++)par[i]=i;
    for(int i=0;i<m;i++){
        scanf("%d%d%d",&x,&y,&z);
        mrg(x,y);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(vis[get(i)])continue;
        ans++;
        vis[get(i)]=1;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
typedef long long LL;

int main() {
	int y, m, d;
	char c;

	std::cin >> y >> c >> m >> c >> d;

	if (m > 4) {
		std::cout << "TBD" << std::endl;
	}
	else {
		std::cout << "Heisei" << std::endl;
	}

}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(N: int, A: "List[int]"):
    s = set()
    for a in A:
        if a in s:
            print(NO)
            exit()
        s.add(a)
    print(YES)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


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

using namespace std;

using ll = int64_t;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = 2147483647;
constexpr ll L_INF = 9223372036854775807LL;

//===


int main()
{
  ll n;
  cin >> n;
  cout << n*(n-1)/2 << endl;
  return 0;
}


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

int main(){
  long N;
  cin >> N;
  map<long, int> A;
  for(int i=0; i<N; i++){
    long x;
    cin >> x;
    A.emplace(x, 0);
  }
  if(N==A.size())cout << "YES" << endl;
  if(N!=A.size())cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes                \
    cout << "Yes" << endl; \
    return 0;
#define No                \
    cout << "No" << endl; \
    return 0;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template <typename T>
void print(const T &v);

int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<int> W(N + 1), E(N + 1);
    int w = 0, e = 0;
    for (int i = 0; i < N; i++)
    {
        if (S[i] == 'W')
            w++;
        if (S[i] == 'E')
            e++;
        W[i + 1] = w;
        E[i + 1] = e;
    }
    int ans = INF;
    for (int i = 0; i < N; i++)
    {
        int total = W[i] + E[N] - E[i + 1];
        ans = min(total, ans);
    }
    cout << ans << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=200001;
#define M 1000000007
#define double long double
#define BINF 1000000000000000001
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
const int LG = 22;



#undef int
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
#define int long long int

	
	int n;
	cin>>n;
	string a,b,c;
	cin>>a>>b>>c;
	int x=0,y=0,z=0;

	for(int i=0;i<n;i++){
		//for(int j=0;j<n;j++){
		//	for(int k=0;k<n;k++){

				if(a[i]==b[i] && a[i]==c[i]) continue;
				else if(a[i]!=b[i] && a[i]!=c[i] && b[i]!=c[i]) x+=2;
				else x++;
		//	}
		//}
	}

	cout<<x;



return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s; cin >> s;
    deque<char> que(s.begin(), s.end());
    int q; cin >> q;
    bool rev = false;
    for (int i = 0; i < q; i++) {
        int t; cin >> t;
        if (t == 1) {
            rev = !rev;
        } else {
            int f; char c; cin >> f >> c;
            if (f == 1) {
                if (rev) {
                    que.push_back(c);
                } else {
                    que.push_front(c);
                }
            } else {
                if (rev) {
                    que.push_front(c);
                } else {
                    que.push_back(c);
                }
            }
        }
    }
    if (rev) reverse(que.begin(), que.end());
    for (char c : que) cout << c;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    //--<for debugging>
    #define whatis(x) cout << #x << " is " << x<<" ";
    #define whatisl(x) cout << #x << " is " << x<<"\n";
    #define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
    #define lline cout<<"\n";
    #define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
     
    void err(istream_iterator<string> it) {}
    template<typename T, typename... Args>
    void err(istream_iterator<string> it, T a, Args... args) {
    	cout << *it << " = " << a <<" , ";
    	err(++it, args...);
    }
    //--</for debugging> 
    #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
    #define testcase ll tt; cin >> tt; while(tt--)
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
    #define pb push_back 
    #define vars ll h,p,q,i,j,g,k,d,l,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;
    #define vll vector<ll>
    #define pll pair<ll,ll>
    #define sll set<ll>
    #define pint pair<int,int>
    const ll INF=1e9+7;
    const ll MOD=1e9+7;
    int main()
    {
        boost vars
        string str;
        cin>>str;
        if(str[2]==str[3]&&str[4]==str[5])cout<<"Yes";
        else cout<<"No";

    }

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

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

int main() {
    int n;
    cin >> n;
    ll ans;
    cin >> ans;
    rep(i,n-1) {
        ll a;
        cin >> a;
        ans = gcd(ans, a);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define int long long
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,c[li],x,y;
int cev;
string s;
priority_queue<int> pq,pq1;
vector<int> v;

int32_t main(void){
	scanf("%lld %lld %lld %lld %lld",&x,&y,&n,&m,&k);
	FOR{
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+n+1);
	reverse(a+1,a+n+1);
	for(int i=1;i<=x;i++){
		pq.push(-a[i]);
		cev+=a[i];
	}
	for(int i=1;i<=m;i++){
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+m+1);
	reverse(a+1,a+m+1);
	for(int i=1;i<=y;i++){
		pq1.push(-a[i]);
		cev+=a[i];
	}
	for(int i=1;i<=k;i++){
		scanf("%lld",&a[i]);
		int at=-pq.top();
		int at1=-pq1.top();
		if(at<=at1 && at<a[i]){
			pq.pop();
			pq.push(-a[i]);
			cev-=at;
			cev+=a[i];
		}
		else if(at1<a[i]){
			pq1.pop();
			pq1.push(-a[i]);
			cev-=at1;
			cev+=a[i];
		}
		//~ cout<<cev<<endl;
	}
	printf("%lld\n",cev);
	return 0;
}



Measured memory_bytes: 6644
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second 
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int k,a,b;
	cin>>k>>a>>b;
	fo(i,a,b+1) if(i%k==0){
		cout<<"OK\n";
		return 0;
	}
	cout<<"NG\n";
	return 0;
}


Measured memory_bytes: 3624
object Main extends App {
  import scala.io.StdIn._

  val hands = Array(
    "Rock",
    "Gun",
    "Lightning",
    "Devil",
    "Dragon",
    "Water",
    "Air",
    "Paper",
    "Sponge",
    "Wolf",
    "Tree",
    "Human",
    "Snake",
    "Scissors",
    "Fire"
  )
  val handToIndex = hands.zipWithIndex.toMap
  solve
  def solve: Unit = {
    val n = readInt
    if (n == 0) return
    val players = Array.tabulate(n)(_ ⇒ handToIndex(readLine.trim))
    val count = Array.tabulate(15){_ ⇒ 0}
    players.foreach(i ⇒ count(i) += 1)
    count.indices.find(i ⇒ count(i) != 0 && (1 to 7).map(n ⇒ (n + i) % 15).forall(h ⇒ count(h) == 0)) match {
      case Some(h) if count(h) != n ⇒ println(hands(h))
      case _ ⇒ println("Draw")
    }
    solve
  }
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline
    def let[A](func: T ⇒ A): A = func(value)
    @inline
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
  }
}



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

constexpr int dx[] = {1, 0, -1, 0};
constexpr int dy[] = {0, 1, 0, -1};
constexpr int inf = 1e9 + 10;
vector<string> g;
vector<vector<int>> d;
int n, m, k;
bool valid(int x, int y) {
  return x >= 0 && y >= 0 && x < n && y < m && g[x][y] == '.';
}

int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  g.resize(n);
  d.resize(n, vector<int>(m, inf));

  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  x1--, y1--, x2--, y2--;

  for (string &s : g) {
    cin >> s;
  }

  queue<pair<int, int>> q;
  q.emplace(x1, y1);
  d[x1][y1] = 0;
  while (q.size()) {
    int x, y;
    tie(x, y) = q.front();
    q.pop();
    for (int dir = 0; dir < 4; ++dir) {
      int tx = x, ty = y;
      for (int i = 1; i <= k; ++i) {
        tx += dx[dir], ty += dy[dir];
        if (valid(tx, ty) && d[tx][ty] == inf) {
          d[tx][ty] = d[x][y] + 1;
          q.emplace(tx, ty);
        } else if (valid(tx, ty) && d[tx][ty] == d[x][y] + 1) {
          continue;
        } else {
          break;
        }
      }
    }
  }
  int ans = d[x2][y2];
  if (ans >= inf)
    ans = -1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11116
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        v: [usize; n]
    }
    println!("{}", v.iter().cloned().max().unwrap() - v.iter().cloned().min().unwrap());
}


Measured memory_bytes: 4352
//all possible//
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,n,i,mx=-9000,mn=9000;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a;
		if(a>mx)
		mx=a;
		if(a<mn)
		mn=a;
		
	}
	cout<<mx-mn;

}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

//????????¢????±???????
public class Main {
	static Scanner sc = new Scanner(System.in);
	private static final int RECTANGLE = 4; //????????¢???????????°

	public static void main(String[] args) {
		while(sc.hasNext()) {
			int[] e = new int[RECTANGLE];

			for(int $ = 0; $ < RECTANGLE; $++) {
				e[$] = sc.nextInt();
			}

			String jugh = null;

			Arrays.sort(e);

			if((e[0] == e[1]) && (e[2] == e[3])) {
				jugh = "yes";
			} else {
				jugh = "no";
			}

			System.out.println(jugh);
		}

	}

}

Measured memory_bytes: 26244
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    char c;
    cin >> c;
    cout << char(((int)c + 1)) << '\n';
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
using namespace std;

int main(){

  string s, t;
  bool flag=false;
  string ans;

  cin >> s >> t;

  for(int i=0; i<s.size(); i++){
    int x=0;
    for(int j=0; j<t.size(); j++){
      if(s[i+j]==t[j] || s[i+j]=='?'){
        x++;
      }
    }
    if(x==t.size()){
      string tmp=s;
      tmp.replace(i, t.size(), t);
      replace(tmp.begin(), tmp.end(), '?', 'a');
      if(flag!=true){
        ans=tmp;
        flag=true;
      }
      if(ans>tmp){
        ans=tmp;
      }
    }
  }

  if(flag){
    cout << ans << endl;
  } else {
    cout << "UNRESTORABLE" << endl;
  }
 
  return 0;
}

Measured memory_bytes: 256
import math
# Calculate amount of water that won't oveflow
def calc(a,b,deg): 
    
    rad = math.radians(deg)
    # deg90_in_rad = math.radians(90)
    # a_sect = a*math.sin(rad) - b*math.sin(deg90_in_rad - rad)
    # b_sect = b*math.sin(deg90_in_rad - rad) - a*math.sin(rad) # 縦と水の切片

    # if b_sect >= 0:
    #     sqr_a = a * b_sect 
    #     tri_a = (b-b_sect)*a*1/2  

    # else:
    #     sqr_a = 0
    #     tri_a = (a - a_sect) * b *1/2
    # total_area = (sqr_a + tri_a) 

    if b*math.tan(math.pi/2-rad) <= a:
        total_area = (b*math.tan(math.pi/2-rad)*b*1/2)
    if b*math.tan(math.pi/2-rad)>a:
        total_area = (a*b - a*math.tan(rad)*a*1/2)       

    return total_area * a

import bisect
def main():
    a, b, x = list(map(int, input().split()))

    left = 0
    right = 90
    deg = 45
    while True:
        y = calc(a, b, deg)
        if y - x >= -10 ** -7 and y - x <= 0:
            break
        if y > x:
            deg, left = (right+deg)/2, deg
        elif y < x:
            deg, right = (left+deg)/2, deg
    print(deg)

if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

int main() {
    ll n, w;
    cin(n); cin(w);

    vector<ll> weight(n), value(n);
    rep2(i, n) {
        cin(weight[i]);
        cin(value[i]);
    }

    vector<vector<ll>> dp(n + 1, vector<ll>(w + 1, 0));

    erep3(i, 1, n) {
        ll wi = weight[i - 1];
        ll vi = value[i - 1];

        erep2(j, w) {
            if (j - wi >= 0) {
                dp[i][j] = max(dp[i - 1][j - wi] + vi, dp[i - 1][j]);
            } else {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }

    print(dp[n][w]);
    return 0;
}

Measured memory_bytes: 80256
N, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
dp = [0 for _ in range(W + 1)]

for a in A:
  for j in range(W, a[1] - 1, -1):
    dp[j] = max(dp[j], dp[j - a[1]] + a[0])
print(max(dp))



Measured memory_bytes: 5924
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll x,y,h,H,idx_H;
int main() {
    int N; cin >> N;
    vector<tuple<ll, ll, ll>> A(N);
    for (int i=0; i<N; ++i) {
        cin >> x >> y >> h;
        if (h > 0) idx_H = i;
        A[i] = make_tuple(x,y,h);
    }
    for (int cx = 0; cx<=100; cx++){
        for (int cy=0; cy<=100; cy++){
            H = get<2>(A[idx_H]) + abs(get<0>(A[idx_H])-cx) + abs(get<1>(A[idx_H])-cy);
            bool can = true;
            for (auto a : A) {
                tie(x,y,h) = a;
                if (h > 0 && h != max((H - abs(x-cx) - abs(y-cy)), (ll)0)) can = false;
                if (h== 0 && (H - abs(x-cx) - abs(y-cy)) > 0) can = false;
            }
            if (can) {
                cout << cx << " " << cy << " " << H << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3576
n,p=map(int,input().split())
s=list(input())

if p==2 or p==5:
  ans=0
  for i,ss in enumerate(s):
    if int(ss)%p==0:
      ans+=i+1
  print(ans)
  exit(0)
from collections import Counter
c=Counter()
m=0
c[m]+=1
d=1
s=s[::-1]
for i in range(n):
  m+=int(s[i])*d
  m%=p
  d*=10
  d%=p
  c[m]+=1
ans=0
for v in c.values():
  ans+=v*(v-1)//2
print(ans)

Measured memory_bytes: 12084
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<float.h>
using namespace std;


int main() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    int b = 0;
    for (int i = 0; i < 2; i++) {
        b += abs(a[i] - a[i + 1]);
    }
    cout << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;

using ll = long long;

int main()
{
    char a;
    cin >> a;
    if('a' <= a && a <= 'z')
    {
        cout << 'a' << endl;
    }
    else
    {
        cout << 'A' << endl;
    }

    return 0;
}

Measured memory_bytes: 3064