akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

const int MAX = 111;
const int MOD = 1e9 + 7;
int N;
long long dp[MAX][4/*cur*/][4/*prev*/][4/*prev prev*/][4/*prev prev prev*/];
const string key = "AGCT";

// ACG
// AGC, GAC

bool check(string str) {
    if (str.find("AGC") != string::npos) return false;
    for (int i = 0; i < str.size() - 1; i++) {
        swap(str[i], str[i + 1]);
        if (str.find("AGC") != string::npos) return false;
        swap(str[i], str[i + 1]);
    }
    return true;
}

int main() {
    cin >> N;

    if (N == 3) {
        cout << 61 << endl;
        return 0;
    }

    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                for (int l = 0; l < 4; l++) {
                    string s = string(1,key[i]) + string(1,key[j]) + string(1,key[k]) + string(1,key[l]);
                    reverse(begin(s), end(s));
                    if (check(s)) {
                        dp[3][i][j][k][l] = 1;
                    }
                }
            }
        }
    }

    for (int i = 4; i < N; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                for (int l = 0; l < 4; l++) {
                    for (int m = 0; m < 4; m++) {
                        for (int n = 0; n < 4; n++) {
                            string s = string(1, key[j])
                                     + string(1, key[k])
                                     + string(1, key[l])
                                     + string(1, key[m])
                                     + string(1, key[n]);
                            reverse(begin(s), end(s));
                            if (check(s)) {
                                (dp[i][j][k][l][m] += dp[i - 1][k][l][m][n]) %= MOD;
                            }
                        }
                    }
                }
            }
        }
    }

    long long ans = 0;
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                for (int l = 0; l < 4; l++) {
                    (ans += dp[N - 1][i][j][k][l]) %= MOD;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
import sys
N = int(input()) 
A = [int(sys.stdin.readline()) for _ in range(N)]
b = 0
for i, a in enumerate(A):
    if i + b < a:
        print(-1)
        sys.exit()
    else:
        b = a - i
ans = 0
pre = -1
for a in A[::-1]:
    if pre - 1 != a:
        ans += a
    pre = a
print(ans)

Measured memory_bytes: 12584
N,K=map(int,input().split())
H=list(map(int,input().split()))
dp=[0]#足場iまでの最小コスト
for i in range(1,N):
    l=max(0,i-K)
    m=min([d+abs(H[i]-h) for d,h in zip(dp[l:i],H[l:i])])
    #m=min(map(lambda d,h:d+abs(H[i]-h),dp[l:i],H[l:i]))
    dp.append(m)
print(dp[-1])

Measured memory_bytes: 58720
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

int main(int argc, char* argv[]){
	int A, B, H, M;

	cin >> A >> B >> H >> M;

	double ans = 0, s = 0, v = 0;
	s = (660*H + 11*M)/360.0;
	//printf("s=%.10lf\n", s);
	s = s*M_PI;
	v = A*B*cos(s);
	ans = A*A + B*B + v*(-2);
	ans = sqrt(ans);

	printf("%.10lf\n", ans);
	return 0;
}

Measured memory_bytes: 4188
from collections import deque

S = input()
Q = int(input())

t = deque(S)
reverse = False
for _ in range(Q):
    query = input()
    if query[0] == '1':
        reverse = not reverse
    elif query[0] == '2':
        _, F, C = query.split()
        if F == '1':
            if reverse:
                t.append(C)
            else:
                t.appendleft(C)
        elif F == '2':
            if reverse:
                t.appendleft(C)
            else:
                t.append(C)
result = ''.join(t)
if reverse:
    result = result[::-1]
print(result)

Measured memory_bytes: 14448
#include<iostream>
#include<string>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
int main()
{
  int N,M;
  cin >> N >> M;
  string ans;
  if(N>M){
    rep(i,N) ans.append(to_string(M));
  }else
    rep(i,M) ans.append(to_string(N));
  cout << ans << endl;
}

Measured memory_bytes: 256
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],4)[0];
  var K = myconv(input[0],4)[1];
  var R = myconv(input[1],4)[0];
  var S = myconv(input[1],4)[1];
  var P = myconv(input[1],4)[2];
  var output = 0;
  var list = myconv(input[2],6);
  var jibun = [];
  for(var i = 0; i < N; i++){
    switch(list[i]){
      case "r":
        if(i < K){
           output += P;
          jibun.push("p");
        }else{
          if(jibun[i-K] != "p"){
             output += P;
          	jibun.push("p");
          }else{
            jibun.push("x");
          }
        }
        break;
      case "s":
        if(i < K){
           output += R;
          jibun.push("r");
        }else{
          if(jibun[i-K] != "r"){
             output += R;
          	jibun.push("r");
          }else{
            jibun.push("x");
          }
        }
        break;
      case "p":
        if(i < K){
           output += S;
          jibun.push("s");
        }else{
          if(jibun[i-K] != "s"){
             output += S;
          	jibun.push("s");
          }else{
            jibun.push("x");
          }
        }
        break;
	}
  }
  //myout(jibun);
  myout(output);
}
Main(myin());

Measured memory_bytes: 21064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		String[] s1 = sc.nextLine().split("");
		String[] s2 = sc.nextLine().split("");
		String[] s3 = sc.nextLine().split("");
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if(s2[i].charAt(0) != s3[i].charAt(0))
				ans++;
			if(s1[i].charAt(0) != s2[i].charAt(0) && s1[i].charAt(0) != s3[i].charAt(0))
				ans++;
		}
		System.out.println(ans);
	}


}

class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public char nextChar() throws IOException {
		return next().charAt(0);
	}

	public Long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public void waitForInput() throws InterruptedException {
		Thread.sleep(3000);
	}

}


Measured memory_bytes: 22996
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using ll = long long;

int main()
{
    string s;
    cin >> s;
    size_t n = s.length();

    bool strong = true;
    for (size_t i = 0; i < n / 2; i++) {
        if (s[i] != s[n - i - 1]) {
            strong = false;
            break;
        }
    }
    if (strong) {
        size_t end = n / 2;
        for (size_t i = 0; i < end / 2; i++) {
            if (s[i] != s[end - i - 1]) {
                strong = false;
                break;
            }
        }
    }
    if (strong) {
        size_t start = (n + 2) / 2;
        for (size_t i = start; i < (n + start) / 2; i++) {
            if (s[i] != s[n - i - 1]) {
                strong = false;
                break;
            }
        }
    }
    if (strong) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C 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_C() {
    std::cin.tie(0);
    ios::sync_with_stdio(false);

    int N; cin >> N;
    vd V(N); REP(i, N) cin >> V[i];

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

    double ans = V[0];
    FOR(i,1,N) {
        ans = (ans + V[i]) / 2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	ll n;
	cin>>n;
	ll c[502],s[502],f[502];
	for(ll i=0;i<n-1;i++){
		cin>>c[i]>>s[i]>>f[i];
	}
	c[n-1]=s[n-1]=f[n-1]=0;
	for(ll i=0;i<n;i++){
		ll now=c[i]+s[i];
		for(ll j=i+1;j<n-1;j++){
			if(now<=s[j]){
				now+=s[j]-now+c[j];
			}
			else{
				if(now%f[j]!=0){
					now+=f[j]-now%f[j];
				}
				now+=c[j];
			}
		}
		cout <<now<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main(){
  string str,cnt;
  string code[32]={"101","000000","000011","10010001","010001","000001","100101","10011010","0101","0001","110","01001","10011011","010000","0111","10011000","0110","00100","10011001","10011110","00101","111","10011111","1000","00110","00111","10011100","10011101","000010","10010010","10010011","10010000"};
  string alph=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  string code2[32]={"00000","00001","00010","00011","00100","00101","00110","00111","01000","01001","01010","01011","01100","01101","01110","01111","10000","10001","10010","10011","10100","10101","10110","10111","11000","11001","11010","11011","11100","11101","11110","11111"};
  string alph2="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
  string ans,sub;
  while(getline(cin,str)){
    cnt="",ans="";
    for(int i=0,l=str.size();i<l;i++){
      for(int j=0;j<32;j++){
        if(str[i] == alph2[j]){
          cnt += code2[j];
        }
      }
    }
    int j;
    for(int i=0,l=cnt.size();i<l;i+=code[j].size()){
      for(j=0;j<32;j++){
        if(i+code[j].size()-1>=cnt.size()) continue;
        sub = cnt.substr(i,code[j].size());
        if(sub == code[j]){
          ans += alph[j];
          break;
        }
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1200
<?php

while (TRUE) {
    fscanf(STDIN, '%f', $v);
    if (feof(STDIN)) {
        break;
    }
    $minT = $v / 9.8;
    $minY = 4.9 * $minT * $minT;
    $N = ceil($minY / 5) + 1;
    echo (string) $N;
    echo PHP_EOL;
}

Measured memory_bytes: 9188
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N;
  cin>>N;
  ll A[N];
  for(ll i=0;i<N;++i) cin>>A[i];
  ll ans = 1000;
  bool up;
  ll index=-1;
  for(ll i=0;i<N-1;++i) {
    if(A[i]!=A[i+1]) {
      index = i;
      break;
    }
  }
  if(index==-1) {
    cout<<1000<<endl;
    return 0;
  }
  ll kabu=0;
  if(A[index]<A[index+1]) {
    up = true;
    kabu = ans/A[index];
    ans -= A[index]*kabu;
  }
  else up = false;
  for(ll i=index;i<N-1;++i) {
    if(up) {
      if(A[i]>A[i+1]) {
        ans += kabu*A[i];
        kabu = 0;
        up = false;
      }
    }
    else {
      if(A[i]<A[i+1]) {
        kabu = ans/A[i];
        ans -= A[i]*kabu;
        up = true;
      }
    }
  }
  ans += kabu*A[N-1];
  cout<<ans<<endl;
}



Measured memory_bytes: 3640
#include <stdio.h>
#include <string.h>

int main(void)
{
	int a[11][11];
	int n;
	int i, j;
	
	while (1){
		scanf("%d", &n);
		
		if (!n){
			break;
		}
		
		memset(a, 0, sizeof(a));
		
		for (i = 0; i < n; i++){
			for (j = 0; j < n; j++){
				scanf("%d", &a[i][j]);
				a[i][n] += a[i][j];
				a[n][j] += a[i][j];
				a[n][n] += a[i][j];
			}
		}
		
		for (i = 0; i <= n; i++){
			for (j = 0; j <= n; j++){
				printf("%5d", a[i][j]);
			}
			printf("\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 616
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

int main()
{
    int N; cin >> N;
    vector<int> A(N), B(N);
    int res=0, resB;
    REP(i,N){
        cin >> A[i] >> B[i];
        if(res<A[i]){
            res=A[i];
            resB=B[i];
        }
    }

    cout << res+resB << endl;

    return 0;
}

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

typedef long long ll;
typedef long long ld;
typedef vector<ll> vi;
typedef priority_queue<ll> pq;
typedef pair<ll, ll> pii;

struct Node
{
    int node, len;
    Node() {node = len = 0;}
    Node(int node, int len) {this -> node = node, this -> len = len;}
};
typedef vector<Node> vg;

#define MAX 200001
#define NON 0
#define MOD 1000000007

#define FOR(type, i, a, b) for(type i = a; i <= b; i++)
#define FORR(type, i, b, a) for(type i = b; i >= a; i--)

#define testBit(n, bit) ((n >> bit) & 1)
#define flipBit(n, bit) (n ^ (1ll << bit))
#define randomize mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

ll n, k;
ll loop[MAX];
ll save[MAX], step[MAX], len = 0, st;

void dfs(ll node){
    while (true){
        node = loop[node];
        st = step[node];
        if (st) break;
        save[++len] = node, step[node] = len;
    }
}

main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> k; k++;
    FOR(ll, i, 1, n) cin >> loop[i];
    save[++len] = 1; step[1] = 1; dfs(1);
    // FOR(ll, i, 1, len) cout << save[i];
    //  cout << ' ' << st << ' ' << len << '\n';
    int cycle = len - st + 1;
    if (k <= st) cout << save[k];
    else cout << save[st + ((k - st) % cycle)];
}

Measured memory_bytes: 8260
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>

using namespace std;
typedef long long ll;
const int maxN=3e5+5;

multiset <int> s;
multiset <int,greater<int> > t;
ll a[maxN],b[maxN],c[maxN];

int main()
{
    ll k,n,now=0,ans=-1e18;
    cin>>n;
    for(k=1;k<=n*3;k++)
    {
        cin>>a[k];
        s.insert(a[k]);
        now+=a[k];
        if(s.size()>n)
        {
            now-=*s.begin();
            s.erase(s.begin());
        }
        b[k]=now;
    }
    now=0;
    for(k=n*3;k>=1;k--)
    {
        t.insert(a[k]);
        now+=a[k];
        if(t.size()>n)
        {
            now-=*t.begin();
            t.erase(t.begin());
        }
        c[k]=now;
    }
    for(k=n;k<=n*2;k++)
    {
        ans=max(ans,b[k]-c[k+1]);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 16768
a,b,c,x,y = map(int,input().split())
l = 0
p = x

if x > y:
    l += (x - y) * a
    p = y
elif x < y:
    l += (y - x) * b
    p = x
else:
    pass
l += p * 2 * c
n = max(x,y) * 2 * c
m = x * a + y * b
print(min(l,n,m))

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

template< typename SType>
class SegmentTree
{
    public:
        // 集合の要素 2 つを引数に取リ、その二項演算結果を返す関数
        using Func = function< SType(SType, SType) >;

    public:
        SegmentTree() {}
        SegmentTree(int n, const Func f, const SType &e) { Init(n, f, e); }
        // セグ木を初期化します。
        // サイズは 10^6 くらいまでならいけそう
        // n  : セグ木のサイズ
        // f  : セグ木で判定する関数
        // e : 初期値(単位元)
        void Init(int n, const Func f, const SType &e) {
            m_F = f; m_E = e;
            // 要素数は 2 のべき乗じゃないといけないのでそうする
            m_Size = 1;
            while(m_Size < n) { m_Size <<= 1; }
            m_Seg.assign(2 * m_Size, m_E);
        }

        // k 番目の要素に x をセット (0-indexed)
        void Set(int k, const SType &x) { m_Seg[k + m_Size] = x; }

        // セグ木構築 O(N)
        void Build() {
            for(int k = m_Size - 1; k > 0; k--) {
                // 子ノードに対しての演算結果を親ノードに格納
                m_Seg[k] = m_F(m_Seg[2 * k + 0], m_Seg[2 * k + 1]);
            }
        }

        // k 番目の要素を x に変更する O(log N) (0-indexed)
        // Build 後も利用可能
        void Update(int k, const SType &x) {
            k += m_Size;
            m_Seg[k] = x;
            while(k >>= 1) {
                m_Seg[k] = m_F(m_Seg[2 * k + 0], m_Seg[2 * k + 1]);
            }
        }

        // 区間 [a, b) に対して初期設定した関数をした結果を返す O(log N)
        // 開区間なので b は含まれないので注意
        // 0-indexed
        SType Query(int a, int b) {
            SType l = m_E, r = m_E;
            for(a += m_Size, b += m_Size; a < b; a >>= 1, b >>= 1) {
                if(a & 1) l = m_F(l, m_Seg[a++]);
                if(b & 1) r = m_F(m_Seg[--b], r);
            }
            return m_F(l, r);
        }

        SType operator[](const int &k) const
        {
            return m_Seg[k + m_Size];
        }
    public:
        Func m_F;               // このセグ木で処理する関数（二項演算）
        SType m_E;              // 初期値(単位元)

        int m_Size;             // セグ木の要素数
        vector< SType > m_Seg;  // セグ木本体。一次元で管理する
};

int N;

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

    cin >> N;

    auto Rmq = [](int a, int b) -> int
    {
        return max(a, b);
    };
    SegmentTree<int> seg(N, Rmq, 0);
    REP(i, N) {
        int a;
        cin >> a;
        seg.Set(i, a);
    }
    seg.Build();
    REP(i, N) {
        printf("%lld\n", max(seg.Query(0, i), seg.Query(i + 1, N)));
    }

    return 0;
}


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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int x[14];

int main()
{
    for(int i = 1; i <= 9; i++)
        cin >> x[i];

    int A = min(x[1], min(x[2], x[3]));
    for(int i = 0; i <= A; i++){
        int b1 = x[1] - i, b2 = x[2] - i, b3 = x[3] - i;
        int a4 = x[4] - b1, a5 = x[5] - b2, a6 = x[6] - b3;
        int a7 = x[7] - b1, a8 = x[8] - b2, a9 = x[9] - b3;

        if(a4 == a5 && a5 == a6 && a7 == a8 && a8 == a9)
            return cout << "Yes\n", 0;
    }
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<climits> //INT_MIN/MAX
using namespace std;

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

#define FOR(i,s,e) for(ll (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(ll (i)=(s);(i)>(e);(i)--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define mp make_pair
#define pb push_back
const ll MOD = 1000000007;
const int INF = 1e9;
const ll LINF = 1e16;
const double PI = acos(-1.0);
int dx[8] = { 0,0,1,-1,1,1,-1,-1 };
int dy[8] = { 1,-1,0,0,1,-1,1,-1 };

/* -----  xtimex  Problem: ABC 0 ABCD / Link:  ----- */
/* ------蝠城｡---



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

ll N, M;
ll a[60], b[60], c[60], d[60];
ll ans = 0LL;

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

    cin >> N >> M;
    cout << (N + M) % 24 << endl;
   /* FOR(i, 0, N) {
        cin >> a[i] >> b[i];
    }
    FOR(i, 0, M) {
        cin >> c[i] >> d[i];
    }

    FOR(i, 0, N) {
        ll m = 1e18; int id;
        FOR(j, 0, M) {
            ll x = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (x < m) {
                m= x;
                id = j;
            }
        }
        cout << id+1 << endl;

    }*/

    return 0;
    }


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

public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
  
    void solve() throws IOException {
        int n=ni();
        int[]A=new int[n+1];
        for (int x=0;x<=n;x++) A[x]=ni();
        long ans=0;
        for (int x=0;x<n;x++) {
            int p=ni();
            if (A[x]>=p) { ans+=p; continue; }
            p-=A[x];
            ans+=A[x];
            if (A[x+1]>=p) {
                ans+=p;
                A[x+1]-=p;
            }
            else {
                ans+=A[x+1];
                A[x+1]=0;
            }
        }
        System.out.println(ans);
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

class FordFulkerson{
  vector<vector<int>> e;
  vector<bool> usd;
  int n,s,t;
public:
  FordFulkerson(vector<vector<int>> &v,int ss,int tt){
    e=v,s=ss,t=tt,n=v.size();
  }
  int solve(){
    int ans=0,ret;
    usd=vector<bool>(n,false);
    while(1){
      usd=vector<bool>(n,false);
      ret=dfs(s);
      if(ret==0) break;
      else ans+=ret;
    }
    return ans;
  }
  int dfs(int x,int d=INF){
    usd[x]=true;
    int ret;
    for(int i=0;i<n;i++){
      if((!usd[i])&&e[x][i]>0){
        if(i==t){
          ret=min(d,e[x][i]);
          e[x][i]-=ret;
          e[i][x]+=ret;
          return ret;
        }else{
          ret=dfs(i,min(d,e[x][i]));
          if(ret>0){
            e[x][i]-=ret;
            e[i][x]+=ret;
            return ret;
          }
        }
      }
    }
    return 0;
  }
};

int main(){
  while(1){
    int h,w,c,m,nw,nc,nm;
    cin >> h >> w >> c >> m >> nw >> nc >> nm;
    if(h<0) return 0;
    int sz=308;
    vector<vector<int>> e(sz,vector<int>(sz,0));

    int ni,ch;
    for(int i=0;i<h;i++){
      e[sz-2][i]=1;
    }
    for(int i=0;i<w;i++){
      cin >> ni;
      for(int j=0;j<ni;j++){
        cin >> ch;
        e[ch-1][50+i]=1;
      }
      e[50+i][100+i]=1;
    }
    for(int i=0;i<c;i++){
      cin >> ni;
      for(int j=0;j<ni;j++){
        cin >> ch;
        e[100+ch-1][150+i]=1;
      }
      e[150+i][200+i]=1;
    }
    for(int i=0;i<m;i++){
      cin >> ni;
      for(int j=0;j<ni;j++){
        cin >> ch;
        e[200+ch-1][250+i]=1;
      }
      e[250+i][sz-1]=1;
    }
    e[301][302]=nw;
    e[303][304]=nc;
    e[305][sz-1]=nm;
    for(int i=0;i<h;i++){
      e[i][301]=1;
    }
    for(int i=0;i<c;i++){
      e[302][150+i]=1;
    }
    for(int i=0;i<w;i++){
      e[100+i][303]=1;
    }
    for(int i=0;i<m;i++){
      e[304][250+i]=1;
    }
    for(int i=0;i<c;i++){
      e[200+i][305]=1;
    }

    // for(int i=0;i<sz;i++){
    //   for(int j=0;j<sz;j++){
    //     cout << e[i][j] << " ";
    //   }
    //   cout << endl;
    // }

    FordFulkerson solver(e,sz-2,sz-1);
    cout << solver.solve() << endl;
  }
  return 0;
}



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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  int mx = *max_element(A.begin(), A.end());
  int ok = mx, ng = 0;
    while (ok - ng > 1) {
      int mid = (ok + ng) / 2;
      auto f = [&](int mid) {
        int cut = 0;
        for (int i = 0; i < N; i++) {
          cut += (A.at(i) + mid - 1) / mid - 1;
        }
        return (cut <= K) ? true : false;
      };
      (f(mid)) ? ok = mid : ng = mid;
    }
  cout << ok << "\n";
}

Measured memory_bytes: 4048
for i in range(1,int(input())+1):
    ky=False
    if i%3==0:
        ky=True
    else:
        j=i
        while j:
            if j%10==3:
                ky=True;break
            j//=10
    if ky:
        print(' ',i,sep='',end='')
print()


Measured memory_bytes: 6160
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t {... : as Swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

const auto size = 1000000000;
int main() {
    int n;
    cin >> n;
    
    map<int, int> countMap;
    forin(i, 0, n) {
        int a;
        cin >> a;
        auto map = countMap.find(a);
        if (map == countMap.end()) {
            countMap.insert(make_pair(a, 1));
        } else {
            map->second++;
        }
    }
    auto delNum = 0;
    for (auto m : countMap) {
        cerr << m.first << ' ' << m.second << endl;
        if (m.second > m.first)
            delNum += m.second - m.first;
        else if (m.second < m.first)
            delNum += m.second;
    }
    cout << delNum << endl;
    
    return 0;
}



Measured memory_bytes: 4736
Z='RUBY_THREAD_VM_STACK_SIZE';ENV[Z]||(require'rubygems';exec({Z=>'50000000'},Gem.ruby,$0));def f(i)a=H[i].map{|e|f(e)}.sort_by(&:-@);r=0;a.size.times{|i|x=a[i]+i+1;r<x&&r=x};r end;N=gets.to_i;H=Hash.new{|h,k|h[k]=[]};(N-1).times{|i|H[gets.to_i-1]<<i+1};f(N/2);p f(0)

Measured memory_bytes: 235916
#include<cstdio>
using ull = unsigned long long;
const static ull MOD = 1000000007;

int main(){
	ull N;
	scanf("%llu", &N);
	ull n_1[60];
	for (int i = 0; i < 60; ++i){
		n_1[i] = 0;
	}
	for (int i = 0; i < N; ++i){
		ull a;
		scanf("%llu", &a);
		for (unsigned j = 0; j < 60; ++j){
			if(a & (1ULL << j)) n_1[j]++;
		}
	}
	ull ans = 0;
	for (unsigned i = 0; i < 60; ++i){
		ans = (ans + n_1[i]*(N - n_1[i])%MOD*((1ULL << i)%MOD))%MOD;
	}
	printf("%llu\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main ()
{
    int  x,a,b,c,d,e,f,g,h,i,j,k,l,re;
    scanf("%d",&x);
    a=x/500;
    b=x%500;
    c=b/100;
    d=b%100;
    e=d/50;
    f=d%50;
    g=f/10;
    h=f%10;
    i=h/5;
    j=h%5;
    k=c*100+e*50+g*10+i*5+j;
    l=k/5;
    re=a*1000+l*5;
    printf("%d\n",re);
    return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include<queue>
using namespace std;


int  main(){
  string s;
  cin>>s;
  stack<int> S;
  for(int i=0;i<s.size();i++){
    int temp=s[i]-'0';
    if(S.size()!=0){
      if(S.top()!=temp){
        S.pop();
      }else{
        S.push(temp);
    }
  }else{
    S.push(temp);
  }
  }
  cout<<s.size()-S.size()<<endl;
}

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

ll s[60];
ll p[60];

ll rec(ll n, ll x){
    if(n == 0) return 1;
    else if(x == 1) return 0;

    if(1 < x && x <= s[n-1] + 1) return rec(n-1, x-1);
    else if(s[n-1]+2 == x) return p[n-1] + 1;
    else if(s[n-1]+2 < x && x < s[n]) return p[n-1] + 1 + rec(n-1, x - s[n-1] - 2);
    else if(s[n] == x) return p[n];
}

int main(){
    ll n, x;
    cin >> n >> x;

	for(int i = 1; i < 60; i++){
        s[i-1] = (1LL<<(i+1)) - 3;
        p[i-1] = (1LL<<i) - 1;
	}
    cout << rec(n, x) << endl;
}

Measured memory_bytes: 256
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N,K = LI()
    root = [[] for _ in range(N)]
    for _ in range(N-1):
        a,b = LI()
        root[a-1].append(b-1)
        root[b-1].append(a-1)

    q = collections.deque()
    q.append((0,K))
    node = [0] * N
    node[0] = 1
    ans = 1
    while q:
        v,c = q.popleft()
        ans = (ans * c) % MOD
        if c < K: c = K-1
        for u in root[v]:
            if node[u] > 0: continue
            c -= 1
            q.append((u,c))
            node[u] = 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 65248
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;


int main() {
    ll N;
    vector<ll> A;
    vector<char> op;

    cin >> N;
    A.resize(N);
    op.resize(N);
    cin >> A[0];
    for (ll i = 1; i < N; i++) {
        cin >> op[i] >> A[i];
    }

    vector<vector<ll>> dp(N + 1, vector<ll>(3, -1e14));
    dp[1][0] = A[0];
    for (ll i = 1; i < N; i++) {
        if (op[i] == '+') {
            dp[i + 1][2] = dp[i][2] + A[i];
            dp[i + 1][1] = max(dp[i + 1][2], dp[i][1] - A[i]);
            dp[i + 1][0] = max(dp[i + 1][1], dp[i][0] + A[i]);
        } else {
            dp[i + 1][2] = dp[i][1] + A[i];
            dp[i + 1][1] = max({ dp[i + 1][2], dp[i][0] - A[i], dp[i][2] - A[i] });
            dp[i + 1][0] = max(dp[i + 1][1], dp[i][1] + A[i]);
        }
    }

    cout << max({ dp[N][0], dp[N][1], dp[N][2] }) << endl;
}

Measured memory_bytes: 6656
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

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

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

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	K := sc.nextInt()
	q := K / 50
	r := K % 50
	fmt.Fprintln(wtr, 50)
	for i := 0; i < 50; i++ {
		if i != 0 {
			fmt.Fprint(wtr, " ")
		}
		if i < r {
			fmt.Fprint(wtr, 49+q+1)
		} else {
			fmt.Fprint(wtr, 49+q-r)
		}
	}
	fmt.Fprintln(wtr)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int n,m,cnt=0,aa[220000];
pair<int,int> p[220000];
string s,ss[110000];
char c;
signed main(){
    cin>>n>>m;
    cout<<min(n%m,m-n%m);
}

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

int main(){
  int a[5];
  int ans;
  rep(i,5) {
    cin >> a[i];
    if(a[i] == 0) ans = i+1;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

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

    vector<long long> vt(n);
    for (int i = 0; i < n; ++i) {
        cin >> vt[i];
    }
    sort(vt.begin(), vt.end());

    // 短い方から順にl[i],l[j],l[k]とする。
    long long ans = 0;
    for (int i = 0; i < n; ++i) {//一番短いもの
        for (int j = i + 1; j < n; ++j) {//二番目に短いもの
            auto itr = lower_bound(vt.begin(), vt.end(), vt[i] + vt[j]);
            ans += distance(vt.begin() + j + 1, itr);
        }
    }

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


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *p, const void *q) {
	return *(int*)p - *(int*)q;
}
int main(void)
{
	int n, k, A[100001], i,mini, x;

	scanf("%d%d", &n, &k);
	for (i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}

	qsort(A, n, sizeof(int), cmp);

	for (i = k-1; i < n; i++) {
		x = A[i] - A[i - k + 1];
		if (i == k-1)mini = x;
		else if (mini > x)mini = x;
	}
	printf("%d\n", mini);

	return 0;
}

Measured memory_bytes: 892
/*    Don’t Quit
    
    When things go wrong as they sometimes will;
        When the road you’re trudging seems all uphill;
            When the funds are low, and the debts are high;
                And you want to smile, but you have to sigh;
                    When care is pressing you down a bit
                        Rest if you must, but don’t you quit.
*/
#pragma gcc optimize ("unroll-loop")
#pragma gcc optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=2e5+5;
int gcd(int n,int m)
{
    if(n==0)
        return m;
    else
        return gcd(m%n,n);
}
int a[N],b[N],c[N];
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
    {
        cin>>b[i];
    }
    for(int i=1;i<=n-1;i++)
    {
        cin>>c[i];

    }
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]==n)
        {
            sum+=b[a[i]];
        }
        else if(a[i]+1==a[i+1]&&i+1<=n)
        {   
            sum+=c[a[i]]+b[a[i]];
        }
        else
        {
            sum+=b[a[i]];
        }
    }
    cout<<sum<<endl;
    
         
}


Measured memory_bytes: 2304
#include <iostream>
#include <string>
#include <numeric>
#include <vector>
using namespace std;

int main() {
    int n,q;
    int ac = 0;
    cin >> n >> q;
    string s;
    cin >> s;
    int a[s.length()] = {0};
    vector<int> ans;
    for (int i=0;i<n;i++){
        if(s[i] == 'A' && s[i+1] == 'C'){
            ac++;
        }
        a[i+1] = ac;
    }
    for (int i=0;i<q;i++){
        int tmp0,tmp1;
        cin >> tmp0 >> tmp1;
        cout << a[tmp1-1]-a[tmp0-1] << endl;
    }

}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(auto& i: A) cin >> i;
  vector<vector<int>> G(N);
  for(auto i=1; i<N; ++i) {
    int u, v;
    cin >> u >> v;
    --u; --v;
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }

  vector<int> d(N, 1);
  vector<int> dp = {A[0]};
  function<void(int, int)> dfs = [&](auto pre, auto cur) {
    auto i = -1, p = -1;
    if(dp.back() < A[cur]) {
      dp.emplace_back(A[cur]);
    } else {
      i = lower_bound(begin(dp), end(dp), A[cur]) - begin(dp);
      p = dp[i];
      dp[i] = A[cur];
    }
    d[cur] = dp.size();
    for(auto nex: G[cur]) if(pre != nex) dfs(cur, nex);
    if(i < 0) dp.pop_back();
    else      dp[i] = p;
  };

  dfs(0, 0);

  for(auto i: d) cout << i << endl;
}


Measured memory_bytes: 32956
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


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

def func(i, N, cs_n, cs_x):
    left, right = i - 1, N + 1
    ans = -1
    while right - left > 1:
        middle = (left + right) // 2
        x = cs_x[middle] ^ cs_x[i]
        t = cs_n[middle] - cs_n[i]
        if x == t:
            left = middle
            ans = middle
        else:
            right = middle

    return ans


def main():
    N = int(input())
    A = list(map(int, input().split()))

    cs_n = [0] * (N + 1)
    cs_x = [0] * (N + 1)
    for i in range(0, N):
        cs_n[i + 1] = cs_n[i] + A[i]
        cs_x[i + 1] = cs_x[i] ^ A[i]

    ans = 0
    for l in range(N):
        num = func(l, N, cs_n, cs_x)
        ans += num - l
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 31300
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int d, n;
	cin >> d >> n;
	
	int base = (int)pow(100, d);
	int ans;
	
	if( n == 100 ) ans = 101 * base;
	else ans = base * n;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

int main()
{
	int N;
	cin >> N;
	set<int> st;
	int t;
	rep(i, N) {
		cin >> t;
		st.insert(t);
	}
	
	if (st.size() == N) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	
	return 0;
} 

Measured memory_bytes: 12952
W, H, N = gets.split.map(&:to_i)
 
x_max = W
x_min = 0
y_max = H
y_min = 0
 
N.times do
	x, y, a = gets.split.map(&:to_i)
	case a
	when 1
		if (x_min < x)
			x_min = x
		end
	when 2
		if (x_max > x)
			x_max = x
		end
	when 3
		if (y_min < y)
			y_min = y
		end
	when 4
		if (y_max > y)
			y_max = y
		end
	end
end
 
area = (x_max - x_min)*(y_max - y_min)
 
if (x_max - x_min) <= 0 or (y_max - y_min) <= 0
	puts 0
else
	puts area
end

Measured memory_bytes: 1916
program atcoder_contest_scheduling
  implicit none
  integer :: d, c(26) = 0, s(26, 365) = 0, t(365) = 0, u(365), m, n, p, q, i
  real(8) :: t1, t2
  call cpu_time(t1)
  call random_seed_clock()
  read(*,*) d
  read(*,*) c
  read(*,*) (s(:, i), i = 1, d)
  t = [(maxloc(s(:, i), 1), i = 1, d)]
  m = score(1)
  u = t
  do
    p = next_int(365)
    q = next_int(26)
    t(p) = q
    n = score(p)
    if (m < n) then
      m = n
      u(p) = q
    else
      t(p) = u(p)
    end if
    call cpu_time(t2)
    if (t2 - t1 > 1.975d0) exit
  end do
  write(*,'(i0)') (u(i), i = 1, d)
contains
  integer function score(p) result(res)
    integer, intent(in) :: p
    integer :: mem(0:365) = 0, diff(26, 0:365) = 0, i
    do i = p, d
      diff(:, i) = diff(:, i - 1) + c
      diff(t(i), i) = 0
      mem(i) = mem(i - 1) + s(t(i), i) - sum(diff(:, i))
    end do
    res = mem(d)
  end
  subroutine random_seed_clock()
    integer :: nseed, clock
    integer, allocatable :: seed(:)
    call system_clock(clock)
    call random_seed(size = nseed)
    allocate(seed(nseed))
    seed = clock
    call random_seed(put = seed)
    deallocate(seed)
  end
  integer function next_int(m) result(res)
    integer, intent(in)  :: m
    real(8) :: r
    call random_number(r)
    res = int(m * r) + 1
  end
end program atcoder_contest_scheduling

Measured memory_bytes: 3072
using System;
class Program
{
  static void Main(string[] args)
  {
    bool isFirst = true;
    int bill, ownedMoney, changeMoney;
    int[] coins = new int[] { 10, 50, 100, 500 };
    int range = coins.Length;
    int[] ownedCoins = new int[range], changeCoins = new int[range], paymentCoins = new int[range];

    while ( true )
    {
      bill = int.Parse( Console.ReadLine() );
      if ( bill == 0 ) break;
      if (isFirst) { isFirst = false; } else { Console.WriteLine(); }
      ownedCoins = Array.ConvertAll( Console.ReadLine().Split(' '), int.Parse);

      ownedMoney = 0;
      for ( int i = range - 1; i >= 0; i--)
        ownedMoney += coins[i] * ownedCoins[i];

      changeMoney = ownedMoney - bill;

      for ( int i = range - 1; i >= 0; i--)
      {
        changeCoins[i] = changeMoney / coins[i];
        changeMoney = changeMoney % coins[i];
        paymentCoins[i] = ownedCoins[i] - changeCoins[i];
      }
      for ( int i = 0; i <= range - 1; i++)
        if ( paymentCoins[i] > 0 ) Console.WriteLine( "{0} {1}",  coins[i], paymentCoins[i] );
    }
  }
}


Measured memory_bytes: 9308
import java.util.Scanner;

public class Main {
	static int[]bit;
	static int A, B, C, D;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		A = s.charAt(0) - '0';
		B = s.charAt(1) - '0';
		C = s.charAt(2) - '0';
		D = s.charAt(3) - '0';
		bit = new int[3];
		rec(0);
	}
	static void rec(int k) {
		if(k == bit.length) {
			solve();
			return;
		}
		rec(k + 1);
		bit[k] = 1;
		rec(k + 1);
		bit[k] = 0;
	}
	static void solve() {
		int t = 0;
		if(bit[0] == 0) {
			t += A + B;
		}else {
			t += A - B;
		}
		if(bit[1] == 0) {
			t += C;
		}else {
			t -= C;
		}
		if(bit[2] == 0) {
			t += D;
		}else {
			t -= D;
		}
		if(t == 7) {
			String[]op = {"+", "-"};
			System.out.println(A + op[bit[0]] + B + op[bit[1]] + C + op[bit[2]] + D +"=7");
			System.exit(0);
		}
	}
}

Measured memory_bytes: 23380
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(all(a));
  deque<ll> de;
  deque<ll> de2;
  deque<ll> de3;
  deque<ll> de4;
  rep(i,n){
    de.push_back(a[i]);
    de3.push_front(a[i]);
  }
  int i=0;
  while(de.size()){
    if(i==0){
      de2.push_back(de.front());
      de.pop_front();
    }
    else if(i%2==1){
      de2.push_back(de.back());
      de.pop_back();
      if(de.empty()) break;
      de2.push_front(de.back());
      de.pop_back();
    }
    else{
      de2.push_back(de.front());
      de.pop_front();
      if(de.empty()) break;
      de2.push_front(de.front());
      de.pop_front();
    }
    i++;
  }
  i=0;
  while(de3.size()){
    if(i==0){
      de4.push_back(de3.front());
      de3.pop_front();
    }
    else if(i%2==1){
      de4.push_back(de3.back());
      de3.pop_back();
      if(de3.empty()) break;
      de4.push_front(de3.back());
      de3.pop_back();
    }
    else{
      de4.push_back(de3.front());
      de3.pop_front();
      if(de3.empty()) break;
      de4.push_front(de3.front());
      de3.pop_front();
    }
    i++;
  }
  ll ans1=0;
  while(de2.size()){
    ll a=de2.front();
    de2.pop_front();
    if(de2.empty()) break;
    ll b=de2.front();
    ans1+=abs(a-b);
  }
  ll ans2=0;
  while(de4.size()){
    ll a=de4.front();
    de4.pop_front();
    if(de4.empty()) break;
    ll b=de4.front();
    ans2+=abs(a-b);
  }
  cout << max(ans1,ans2) << endl;
}

Measured memory_bytes: 2816