akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
const int MAXN = 2e5+5;
int A[MAXN];
int suf[MAXN];
int N;

int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &A[i]);
  }
  A[0] = suf[N+1] = 0;
  for (int i = N; i >= 1; --i) {
    suf[i] = std::max(suf[i+1], A[i]);
  }
  for (int i = 1; i <= N; ++i) {
    printf("%d\n", std::max(A[i-1], suf[i+1]));
    A[i] = std::max(A[i-1], A[i]);
  }
  return 0;
}

Measured memory_bytes: 3072
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
using namespace std;
typedef long long ll;


int main(int argc, char *args[]) {
	int N;
	cin >> N;
	int t;
	t = sqrt(N);
	cout << t*t << endl;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import           Control.Exception (assert, evaluate)
import           Data.List         (foldl')

main :: IO ()
main = do
  n <- readLn
  s <- getLine
  evaluate $ assert (length s == n) ()
  q <- readLn
  ks <- take q . map read . words <$> getLine
  putStr . unlines . map (show . (\k -> f k s)) $ ks

f :: Int -> String -> Int
f k = dmc . foldl g initialState . defer k
  where
    g :: State -> (Char, Maybe Char) -> State
    g state (c, c') = (countIn c (maybe id countOut c' state))

-- Strict にしないと TLE がでる
data State =
  State
  { d     :: !Int
  , m     :: !Int
  , dm    :: !Int
  , dmc   :: !Int
  }

defer :: Int -> [a] -> [(a, Maybe a)]
defer n xs = zip xs $ replicate n Nothing ++ map Just xs

initialState :: State
initialState = State { d = 0, m = 0, dm = 0, dmc = 0 }

countIn :: Char -> State -> State
countIn 'D' count = count { d = d count + 1 }
countIn 'M' count = count { m = m count + 1, dm = dm count + d count }
countIn 'C' count = count { dmc = dmc count + dm count }
countIn _   count = count

countOut :: Char -> State -> State
countOut 'D' count = count { d = d count - 1, dm = dm count - m count }
countOut 'M' count = count { m = m count - 1 }
countOut _   count = count


Measured memory_bytes: 145788
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=5e5+5;
const int inf=0x3f3f3f3f;
int n,m,flag=1,x,y,cnt[10];
int main(){
    memset(cnt,-1,sizeof(cnt));
    scanf("%d %d",&n,&m);
    for(int i=1;i<=m;i++){
        scanf("%d %d",&x,&y);
        if(cnt[x]!=-1&&cnt[x]!=y){
            flag=0;
//            printf("bug ");
        }else if(x==1&&y==0&&n>1){
            flag=0;
//           printf("bug ");
        }else{
            cnt[x]=y;
//            printf("bug ");
        }
    }
    if(flag){
        for(int i=1;i<=n;i++){
            if(cnt[i]==-1){
                cnt[i]=0;
            }
            if(cnt[1]==0&&n>1){
                cnt[1]=1;
            }
            printf("%d",cnt[i]);
        }
        printf("\n");
    }else{
        printf("-1\n");
    }
    return 0;
}


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

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

    int n;
    cin>>n;
    int a[n];
    for(int i = 0;i < n;i++) cin>>a[i];
    int pre[n], suf[n];
    pre[0] = a[0];
    for(int i = 1;i < n;i++) pre[i] = pre[i-1] + a[i];
    suf[n-1] = a[n-1];
    for(int i = n-2;i >= 0;i--) suf[i] = suf[i+1] + a[i];

    int ans = INT_MAX;
    for(int i = 0;i < n-1;i++) ans = min(ans, abs(pre[i] - suf[i+1]));

    cout<<ans<<endl;
    
}

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

class B
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		int[] h = Read(), a = Read(), b = Read();
		Console.WriteLine(new int[h[2]].Select(_ => Read()).Select(x => a[x[0] - 1] + b[x[1] - 1] - x[2]).Append(a.Min() + b.Min()).Min());
	}
}


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

int main() {
    int x,y;
    cin >> x >> y;
    if(y%2==1){
        cout << "No" << endl;
    }
    else{
        int a;
        a=(y/2)-x;
        if(a<0||a>x){
            cout << "No" << endl;
        }
        else{
           cout << "Yes" << endl; 
        }
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int N_MAX=1e5;
vector<vector<pll> >g(N_MAX);
vector<ll>color(N_MAX,0);


void dfs(ll u,ll p=-1){
    for(auto v:g[u]){
        if(v.ff==p)continue;
        if(v.ss%2)
            color[v.ff]=1-color[u];
        else
        color[v.ff]=color[u];
        dfs(v.ff,u);
    }
}
int main(){
    fio;
    ll n;
    cin >>n;
    for (int i = 0; i < n - 1; ++i) {
        ll u,v,w;
    cin >>u>>v>>w;
    u--;
    v--;
        g[u].pb({v,w});
        g[v].pb({u,w});
    }
    dfs(0);
    for (int i = 0; i < n; ++i) {
        cout <<color[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 13620
#include<stdio.h>
char dice[8][5][5];
int i,j,res,f[3];
int MIN(int x,int y){ return x<y?x:y; }
int input()
{
    for(i=1;i<=6;i++)
        for(j=2;j>=0;j--)
        {
            scanf("%s",dice[i][j]);
            if(i==1&&j==2&&dice[i][j][0]=='#') return 0;
        }
    return 1;
}
void f1(int a,int b,int m)
{
    for(f[m]=i=0;i<3;i++) if(dice[a][b][i]=='*') f[m]=1;
}
void f2(int a,int b,int m)
{
    for(f[m]=i=0;i<3;i++) if(dice[a][b][i]=='*') f[m]=1;
}
void f3(int a,int b,int m)
{
    for(f[m]=i=0;i<3;i++) if(dice[a][i][b]=='*') f[m]=1;
}
void f4(int a,int b,int m)
{
    for(f[m]=i=0;i<3;i++) if(dice[a][i][b]=='*') f[m]=1;
}
void C(int x)
{
    if(f[1]&&f[2]) res=MIN(res,x);
}
int main()
{
    while(input())
    {
        res=9;

        f1(1,0,1),f2(3,0,2),C(0);
        f1(1,2,1),f2(3,2,2),C(2);
        f3(1,0,1),f4(3,2,2),C(1);
        f3(1,2,1),f4(3,0,2),C(1);

        f1(2,0,1),f2(4,0,2),C(3);
        f1(2,2,1),f2(4,2,2),C(3);
        f3(2,0,1),f4(4,2,2),C(2);
        f3(2,2,1),f4(4,0,2),C(2);

        f1(5,0,1),f2(6,2,2),C(1);
        f1(5,2,1),f2(6,0,2),C(1);
        f3(5,0,1);
        for(f[2]=i=0;i<3;i++) if(dice[6][2-i][0]=='*') f[2]=1;
        C(2);
        f3(5,2,1);
        for(f[2]=i=0;i<3;i++) if(dice[6][2-i][2]=='*') f[2]=1;
        C(2);

        printf("%d\n",res);
    }
}

Measured memory_bytes: 532
#pragma GCC optimize(3)
#pragma GCC optimize("inline")
#pragma once
#include<bits/stdc++.h>
#define q register

typedef long long ll;

using namespace std;

ll n,ans,tot;

string s;

inline void Qspeed()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

inline ll Max(ll x,ll y)
{
	return x>y?x:y;
}

int main()
{
	cin>>n;
	cin>>s;
	for(q ll i=0;i<s.length();i++){
		if(s[i]=='I')   tot++;
		else            tot--;
		ans=Max(ans,tot);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int r = sc.nextInt();
			if (n == 0 && r == 0) break;
			int[] card = new int[n];
			for (int i = 0; i < n; i++) {
				card[i] = n - i;
			}
			for (int i = 0; i < r; i++) {
				int p = sc.nextInt();
				int c = sc.nextInt();
				for (int j = 0; j < c; j++) {
					for (int k = p + c - 2; k > 0; k--) {
						int l = card[k];
						card[k] = card[k - 1];
						card[k - 1] = l;
					}
				}
			}
			System.out.println(card[0]);
		}
	}
}



Measured memory_bytes: 38988
#include<iostream>
#include <math.h>
using namespace std;

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

    int T, A;
    cin >> T >> A;

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

    double T_ave[N];
    int ans = 0;
    double min = 100000000000;
    for(int i = 0; i < N; i++){
        T_ave[i] = fabs(A - (T - H[i] * 0.006));
        if(min > T_ave[i]){
            min = T_ave[i];
            ans = i;
        }
    }

    cout << ans + 1 << endl;
}

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

int main() {
  ll A, V, B, W; cin >> A >> V >> B >> W;
  ll T; cin >> T;

  if (V < W) {
    cout << "NO" << endl;
    return 0;
  }

  if ((V - W) * T >= max(A - B, B - A)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 3620
# -*- coding: utf-8 -*-

n,m = map(int,input().split())
a = [0] * m
b = [0] * m
for i in range(m):
    a[i],b[i] = map(int,input().split())
city = [0] * n

for i in range(m):
    city[a[i]-1] += 1
    city[b[i]-1] += 1

for i in range(n):
    print(city[i])


Measured memory_bytes: 3060
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
#include <array>
// ===============================================================
//using系
#pragma region header
using namespace std;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#define INF (lint)10000000000000000;
#define mod (int)1000000007
#pragma region header
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
#pragma endregion
#pragma endregion



int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k; cin >> n >> k;
	vector<char> d(k);
	for (int i = 0; i < k; i++) cin >> d[i];
	for (int i = n;; i++) {
		bool h = true;
		string s = to_string(i);
		for (int j = 0; j < s.length(); j++) {
			for (int l = 0; l < k; l++) {
				if (s[j] == d[l]) h = false;
			}
		}
		if (h) { cout << i << endl; break; }
	}

	return 0;
}

Measured memory_bytes: 3688
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <climits>
#include <cstring>
#include <functional>
using namespace std;

#define rep(i,N) for(int i = 0;i < N;++i)
using LL = long long;

typedef pair<LL, LL> P;

int N;
int shop[101][10];
int joi[101][11];
int ans = -2000000000;

int func(int i) {
	int score = 0;
	rep(j, N) {
		int cnt = 0;
		rep(k, 10) {
			if ((i & (1 << k)) != 0 && shop[j][k] == 1) {
				cnt++;
			}
		}
		score += joi[j][cnt];
	}
	return score;
}

int main() {
	cin >> N;
	rep(i, N) {
		rep(j, 10) {
			cin >> shop[i][j];
		}
	}
	rep(i, N) {
		rep(j, 11) {
			cin >> joi[i][j];
		}
	}
	for (int i = 1; i < (1 << 10); i++) {
		ans = max(ans, func(i));
		if (ans == 0) {
			int sa = 0;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
s = input()
q = int(input())
results_forward = str("")
results_back = str("")
qlist = []
for i in range(q):
  qlist.extend(input().split(" "))

amount = 0
for i in range(len(qlist)):
  if qlist[i] == "1" or qlist[i] == "2":
    amount += int(qlist[i])
  elif amount%2 == 1:
    results_forward = qlist[i] + results_forward
    amount -= int(qlist[i-1])
  elif amount%2 == 0:
    results_back = results_back + qlist[i]
    amount -= int(qlist[i-1])

if q%2 == (len(results_forward)+len(results_back))%2:
  print(results_forward+s+results_back)
else:
  print((results_forward+s+results_back)[::-1])

Measured memory_bytes: 9244
import sys
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

A,B,C = read_int()

first = A % B

for i in range(1,B+2):
    rem = A*i % B
    if rem == C:
        print('YES')
        break
    elif i != 1 and rem == first:
        print('NO')
        break

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define pf push_front
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	int n, k, r, s, p;
	cin >> n >> k >> r >> s >> p;
	string t;
	cin >> t;
	vector<int> mod(k, 0);
	ll sum = 0;
	for(int i = 0; i < n; i++) {
		if(t[i] == 'r') {
			if(mod[i%k] == 1) {
				mod[i%k] = 0;
				continue;
			} else {
				sum += p;
			}
			mod[i%k] = 1;
		} else if(t[i] == 's') {
			if(mod[i%k] == 2) {
				mod[i%k] = 0;
				continue;
			} else {
				sum += r;
			}
			mod[i%k] = 2;
		} else {
			if(mod[i%k] == 3) {
				mod[i%k] = 0;
				continue;
			} else {
				sum += s;
			}
			mod[i%k] = 3;
		}
	}
	cout << sum << endl;
	return 0;
}



Measured memory_bytes: 3796
<?php
 	$a = fgets(STDIN);
// 	var_dump($a);
	$array = array();
	for($i=1;$i<=$a;$i++){
	   // echo $i;
	    if($i % 3 ==0 && $i % 5 == 0){
	       // echo "fizzbuzz";
	    }elseif($i % 3 == 0){
	       // echo "fizz";
	    }elseif($i % 5 == 0){
	       // echo "buzz";
	    }else{
	       // echo $i;
	        array_push($array, $i);
	    }
	}
	echo(array_sum($array));
?>

Measured memory_bytes: 49732
#include <stdio.h>
#define Num 10000
#define INF 200000000
#define White 0
#define Gray  1
#define Black 2
/*隣接行列*/
int M[Num][Num];
int n;

void dijkstra() {
    int u , v;
    int i;
    int min;

    int D[Num] , P[Num] , Color[Num];
    

    for(i = 0 ; i < n ; i ++) {
        D[i]     = INF;
        Color[i] = White;
    }
    
    D[0] = 0;
    Color[0] = Gray;
    
    while(1) {
        min = INF;
        u   = -1;
        
        for(i = 0 ; i < n ; i++) {
            if(min > D[i] && Color[i] != Black) {
                u   = i;
                min = D[i];
            }
        }
        if(u == -1)
            break;
        Color[u] = Black;
        for(v = 0 ; v < n ; v++) {
            if(Color[v] != Black && M[u][v] != INF) {
                /*dijkstraのアルゴリズムの適用*/
                if(D[v] > D[u] + M[u][v]) {
                    D[v]     = D[u] + M[u][v];
                    P[v]     = u;
                    Color[v] = Gray;
                }
            }
        }
    }
    for(i = 0 ; i < n ; i++)
        printf("%d %d\n" , i , ((D[i] == INF) ? -1 : D[i]));
    
}

int main(void)
{
    int i , j;
    int u , k , v , c;
    scanf("%d" , &n);
    
    for(i = 0 ; i < n ; i++){
        for(j = 0 ; j < n ; j++){
            M[i][j] = INF;
        }
    }
    
    for(i = 0 ; i < n ; i++) {
        scanf("%d %d" , &u , &k);
        for(j = 0 ; j < k ; j++) {
            scanf("%d %d" , &v , &c);
            M[u][v] = c;
        }
    }
    
    dijkstra();
    
    return 0;
}



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

int main(){
    int A,B,i = 1,num = 0;
    double T;

    cin >> A;
    cin >> B;
    cin >> T;

    while(A*i < T+0.5){
        num += B;
        i++;
    }

    cout << num << endl;
    return 0;
}

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

typedef struct{
    int key;
    int right;
    int left;
    int parent;
}node;

void insert(vector<node> &T, int i, int *root) {
    int x=*root, y = NIL;
    while(x != NIL){
        y = x;
        T[i].key<T[x].key?x=T[x].left:x=T[x].right;
    }
    T[i].parent = y;
    if(y == NIL) *root = i;
    else if(T[i].key < T[y].key) T[y].left = i;
    else T[y].right = i;
}

void inorder(vector<node> &T, int i){
    if(T[i].left != NIL) 
        inorder(T,T[i].left);
    cout << " " << T[i].key;
    if(T[i].right != NIL)
        inorder(T,T[i].right);
}

void preorder(vector<node> &T, int i){
    cout << " " << T[i].key;
    if(T[i].left != NIL)
        preorder(T,T[i].left);
    if(T[i].right != NIL)
        preorder(T,T[i].right);
}

int main(void) {
    int n,i,root=NIL;
    string od;
    vector<node> T;
    cin >> n;
    T.resize(n);
    rep(i,n) {
        T[i].key = 0;
        T[i].right = NIL;
        T[i].left = NIL;
        T[i].parent = NIL;
    }
    rep(i,n){
        cin >> od;
        if(od == "insert"){
            cin >> T[i].key;
            insert(T,i,&root);
        } else if(od == "print") {
            inorder(T,root);
            cout << endl;
            preorder(T,root);
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 8984
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD  998244353
#define REP(i,n) for(long long i = 0;i < n;++i)
long long flowing[200][200] = {};
vector<int> kouho[200];
int visited[200] = {};
int finding(long long now,long long back,long long now_max) {
	if (now == 101) {
		return now_max;
	}
	for (int i = 0; i < kouho[now].size(); ++i) {
		if (kouho[now][i] != back) {
			if (visited[kouho[now][i]] == 0&&flowing[now][kouho[now][i]] != 0) {
				visited[kouho[now][i]] = 1;
				int geko = finding(kouho[now][i], now, min(now_max, flowing[now][kouho[now][i]]));
				if (geko != 0) {
					flowing[now][kouho[now][i]] -= geko;
					flowing[kouho[now][i]][now] += geko;
					return geko;
				}
			}
		}
	}
	return 0;
}
int main() {
	int n;
	cin >> n;
	long long ans = 0;
	REP(i, n) {
		int b;
		cin >> b;
		if (b <= 0) {
			flowing[0][i + 1] = -b;
			kouho[0].push_back(i + 1);
			ans += b;
		}
		else {
			flowing[i + 1][101] = b;
			kouho[i + 1].push_back(101);
			ans += b;
		}
	}
	for (int i = 1; i <= 100; ++i) {
		for (int q = 2; i * q <= 100; ++q) {
			kouho[i].push_back(i*q);
			kouho[q * i].push_back(i);
			flowing[i][i * q] = LONG_INF;
		}
	}
	visited[0] = 1;
	while (finding(0,-1,LONG_INF)) {
		REP(i, 200) {
			visited[i] = 0;
		}
		visited[0] = 1;
	}
	for (int i = 1; i <= 101; ++i) {
		ans += flowing[0][i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
n = gets.chomp.split("").map(&:to_i)

patterns = [
  ["+", "+", "+"],
  ["+", "+", "-"],
  ["+", "-", "-"],
  ["+", "-", "+"],
  ["-", "+", "+"],
  ["-", "+", "-"],
  ["-", "-", "-"],
  ["-", "-", "+"],
]

patterns.each do |ops|
  fomula = "#{n[0]}#{ops[0]}#{n[1]}#{ops[1]}#{n[2]}#{ops[2]}#{n[3]}"
  sum = eval(fomula)
  if sum === 7
    puts fomula + "=7"
    break
  end
end

# 出力ミス

Measured memory_bytes: 1788
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/


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


return 0;
}

Measured memory_bytes: 3620
# C
N = int(input())
S = list(input())
Q = int(input())
k_list = list(map(int, input().split()))

res = 0

# precompute
C_cnt = [0]*N
M_cnt = [0]*N
MC_cnt = [0]*N

M = 0
C = 0
MC = 0

for i in range(N):
    if S[i] == "M":
        M += 1
    if S[i] == "C":
        C += 1
        MC += M
    C_cnt[i] = C
    M_cnt[i] = M
    MC_cnt[i] = MC
    
res_list = [0]*Q

for q in range(Q):
    k = k_list[q]
    res = 0
    for i in range(N):
        if S[i] == "D":
            j = min(i + k - 1, N - 1)
            res += MC_cnt[j] - MC_cnt[i] - (C_cnt[j] - C_cnt[i]) * M_cnt[i]
    res_list[q] = res
    
for r in res_list:
    print(r)

Measured memory_bytes: 121068
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
#include <utility>
using namespace std;
typedef unsigned long ulong;

void solve() {
	vector<int> res;
	while (true) {
		int n, r;
		cin >> n >> r;
		if (n == r && n == 0)break;

		vector<int> card;
		for (int i = 0; i < n; i++)card.push_back(n - i);

		for (int i = 0; i < r; i++) {
			int p, c;
			cin >> p >> c;
			vector<int> ps;
			vector<int> cs;
			for (int j = 0; j < p - 1; j++)ps.push_back(card[j]);
			for (int j = 0; j < c; j++) {
				card[j] = card[j + p - 1];
			}
			for (int j = 0; j < p - 1; j++)card[j + c] = ps[j];
		}
		res.push_back(card[0]);
	}
	for (int i = 0; i < res.size(); i++)cout << res[i] << endl;
}

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


Measured memory_bytes: 3112
#include <stdio.h>

int main(){
	int N,i,j,ball,a,b,flag;

	scanf("%d",&N);

	for(i = 0;i < N;i++){
		a = b = 0;
		flag = 1;
		for(j = 0;j < 10;j++){
			scanf("%d",&ball);
			if(a < ball){
				a = ball;
			}else if(b < ball){
				b = ball;
			}else{
				flag = 0;
			}
		}
		printf("%s\n",flag ? "YES" : "NO");
	}

	return 0;
}

Measured memory_bytes: 580
function Main(input) {
  var X = input.split(" ")[0];
  var Y = input.split(" ")[1];
  var tmp = 2 * X -Y/2;
  if (Y % 2 === 0 && tmp >= 0 && X >= tmp) {
    console.log('Yes');
  } else {
    console.log("No");
  }
  }

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29624
#include <stdio.h>

void output(int A[],int N)
{
  int i;
  for(i=0; i<N ;i++){
    printf("%d",A[i]);
    if(i==N-1){
    printf("\n");
    }else {
    printf(" ");
    }
  }
}


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


int main(){
  int N,i,j,v;
  scanf("%d",&N);

  int A[N];
  for(i=0; i<N ;i++){
    scanf("%d",&A[i]);
  }
    output(A,N);
    insertionSort(A,N);
  return 0;
}





Measured memory_bytes: 2072
#include <bits/stdc++.h>
using namespace std;
const int N=3e5;
#define rint register int
#define IL inline
#define rep(i,h,t) for (rint i=h;i<=t;i++)
int a[N],n,m;
int main()
{
  ios::sync_with_stdio(false);
  cin>>n>>m;
  rep(i,1,n) cin>>a[i];
  int k=1;
  for (k=1;k<=n;k++)
    if (a[k]>=0) break;
  int k1=k-1,k2=k;
  int ans=1e9;
  rep(i,1,k1)
  {
    if (k1-i+1==m) ans=min(ans,-a[i]);
    if (((k1+m-(k1-i+1))<=n)&&(k1-i+1)<=m)
     ans=min(ans,abs(a[i])*2+a[k1+m-(k1-i+1)]);
  }
  rep(i,k2,n)
  {
    if ((i-k+1)==m) ans=min(ans,a[i]);
    if ((i-k+1)<=m&&(k-(m-(i-k+1))>=1))
      ans=min(ans,abs(a[i])*2+abs(a[k-(m-(i-k+1))]));
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 998244353;

LLONG lengths[51], patties[51];

LLONG GetPattyNum(LLONG N, LLONG X)
{
    if (X == 1) return N == 0 ? 1 : 0;
    else if (X <= lengths[N - 1] + 1) return GetPattyNum(N - 1, X - 1);
    else if (X == lengths[N - 1] + 2) return patties[N - 1] + 1;
    else return GetPattyNum(N - 1, X - lengths[N - 1] - 2) + patties[N - 1] + 1;
}

int main()
{
    LLONG N, X; cin >> N >> X;
    lengths[0] = 1; patties[0] = 1;
    for (int l = 1; l <= 50; ++l)
    {
        lengths[l] = lengths[l - 1] * 2 + 3;
        patties[l] = patties[l - 1] * 2 + 1;
    }
    cout << GetPattyNum(N, X) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,e) for(int i = a;i < e;++i)
using LL = long long;

int main() {
	int A, B;
	cin >> A >> B;
	int ans = 0;
	int c = 1;
	while (c < B) {
		ans++;
		c += A - 1;
	}
	cout << ans << endl;

}




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

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


def solve(N: int):
    for i in range(1, 10):
        m = N // i
        d = N % i
        if d == 0 and 1 <= m <= 9:
            print(YES)
            return
    print(NO)
    return


# Generated by 1.1.5 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
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
number = str(input())[::-1]
remainderDictionary = {0: 1}
    
sum = 0
x = 1
for i in number:
  x = (x * 10) % 2019
  sum = (sum + int(i) * x) % 2019 
  remainderValue = remainderDictionary.get(sum,0) + 1
  remainderDictionary[sum] = remainderValue
     
ans = 0
for i in remainderDictionary:
  value = remainderDictionary[i]
  ans += value * (value - 1) // 2 # N C 2
print(ans)

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

int main() {
  int W, H, N;
  cin >> W >> H >> N;
  vector<int> x(N), y(N), a(N);
  for (int i=0; i<N; ++i) {
    cin >> x.at(i) >> y.at(i) >> a.at(i);
  }
  
  vector<vector<int>> s(W+1, vector<int>(H+1, 1));
  //cout << s.size() << endl;
  //cout << s.front().size() << endl;
  for (int i=0; i<N; ++i) {
    if (a[i] == 1) {
      for (int j=0; j<x[i]; ++j) {
        for (int k=0; k<=H; ++k) {
          s[j][k] = 0;
        }
      }
    } else if (a[i] == 2) {
      for (int j=x[i]+1; j<=W; ++j) {
        for (int k=0; k<=H; ++k) {
          s[j][k] = 0;
        }
      }
    } else if (a[i] == 3) {
      for (int j=0; j<=W; ++j) {
        for (int k=0; k<y[i]; ++k) {
          s[j][k] = 0;
        }
      }
    } else if (a[i] == 4) {
      for (int j=0; j<=W; ++j) {
        for (int k=y[i]+1; k<=H; ++k) {
          s[j][k] = 0;
        }
      }
    } else cout << "Error" << endl;
  }
  
  int cx=0, cy=0;
  for (int i=0; i<=H; ++i) {
    for (int j=0; j<=W; ++j) {
      if (s[j][i] == 1) ++cx;
    }
    if (cx > 0) break;
  }
  for (int i=0; i<=W; ++i) {
    for (int j=0; j<=H; ++j) {
      if (s[i][j] == 1) ++cy;
    }
    if (cy > 0) break;
  }
  
  if (cx > 0 && cy > 0) {
    cout << (cx - 1) * (cy - 1) << endl;
  } else cout << 0 << endl;
  
}

Measured memory_bytes: 256
color = {
	'black' 	: '#000000',
	'blue' 		: '#0000ff',
	'lime' 		: '#00ff00',
	'aqua' 		: '#00ffff',
	'red' 		: '#ff0000',
	'fuchsia' 	: '#ff00ff',
	'yellow' 	: '#ffff00',
	'white' 	: '#ffffff',
}

def list_chunk(arr, n):
	return [arr[i:i+3] for i in range(0,15,n)]

def code2rgb(code):
	code = code.lstrip('#')
	r, g, b = [code[i:i+2] for i in range(0,len(code),2)]
	return [int(v, 16) for v in [r, g, b]]
def dk2(a, b):
	return sum([(a[i]-b[i])**2 for i in range(0,3)])


while True:
	v = input()
	if(v is '0'): break
	rgb = code2rgb(v)
	dks = [dk2(code2rgb(c), rgb) for c in color.values()]
	k = list(color.keys())
	print(k[dks.index(min(dks))])

Measured memory_bytes: 7440
#include <stdio.h>
#include <math.h>

int main(void){
    // Your code here!
    int score[1001];
    int *s;
    s = score;
    int cnt;
    int i;
    
    double sum;
    double ave;
    double buf;
    
    while(1){
        sum = 0;
        buf = 0;
        
        scanf( "%d" , &cnt);
        if( cnt == 0 ){ break; }
        
        for( i = 0 ; i < cnt; i++ ){
            scanf( "%d" , s + i );
            sum += *( s + i );

        }
        ave = (double)sum / cnt;
        sum = 0;
        
        for( i = 0 ; i < cnt; i++ ){
            buf = fabs( *( s + i ) - ave ) * fabs( *( s + i ) - ave );
            sum += buf;
            
            //printf("%f %f\n", ave , *( s + i ) - ave );
        }
        
        printf("%f\n" , sqrt(sum / cnt) );
    }
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define ffor(n) for(int i = 0; i < n; i++)
#define fffor(n) for(int j = 0; j < n; j++)
int INF = 1e9 + 7;

long long f(int l, int r, vector <int>& v, vector <vector <long long>>& dp) {
  if (dp[l][r] != -1) return dp[l][r];
  if (l == r) {
    dp[l][r] = v[l];
    return dp[l][r];
  }
  dp[l][r] = max(v[l] - f(l + 1, r, v, dp), v[r] - f(l, r - 1, v, dp));
  return dp[l][r];
}

int main(void) {
  int n;
  cin >> n;
  vector <int> v(n);
  ffor(n) cin >> v[i];
  vector <vector <long long>> dp(n, vector <long long>(n, -1)); // dp[l][r] contains max score over segment
  cout << f(0, n - 1, v, dp) << '\n';
}

Measured memory_bytes: 73936
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		int result = 0;
		HashMap<Integer, Boolean> map = new HashMap<Integer, Boolean>();
		for (int i = 0; i < N; i++) {
			int Ai = sc.nextInt();
			if (map.get(Ai) != null) {
				if (map.get(Ai)) {
					map.put(Ai, false);
					result--;
				} else {
					map.put(Ai, true);
					result++;
				}
			} else {
				map.put(Ai, true);
				result++;
			}
		}
		sc.close();
		System.out.println(result);
	}
}

Measured memory_bytes: 63384
#include<bits/stdc++.h>
using namespace std;
int main() {
    long long n,k,king = 1,beg = 1,move=0;
    cin>>n>>k;
    vector<long long> arr(n+1),vis(n+1);
    for(long long i=1;i<=n;i++) cin>>arr[i];
    if(arr[1] == 1)
    {
        cout<<1<<endl;
        return 0;
    }
    
    while(1){
        if(vis[king]) break;
        vis[king] = 1;
        king = arr[king];
    }
    while(beg != king){
        beg = arr[beg];
        move++;
    }
    if(k<=move){
        beg = 1;
        while(k--) beg = arr[beg];
        cout<<beg;
        return 0;
    }
    k = k-move;
    move = 0;
    for(long long i=1;i<=n;i++) vis[i] = 0;
    while(1){
        if(vis[king]) break;
        vis[king] = 1;
        king = arr[king];
        move++;
    }
    k = k%move;
    while(k--) king = arr[king];
        cout<<king;
    
}

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


int main(){
  int r;
  cin >> r;
  if (r < 1200) cout << "ABC" << endl;
  else if (1200 <= r && r < 2800) cout << "ARC" << endl;
  else if (2800 <= r) cout << "AGC" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define space putchar('\n')
#define enter putchar(' ')
#define MAXN 300005
//#define ivorysi
using namespace std;
typedef long long int64;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0){putchar('-');x = -x;}
	if(x >= 10) out(x / 10);
	putchar('0' + x % 10);
}
const int MOD = 998244353;
int N,fac[MAXN],invfac[MAXN],inv[MAXN];
int64 A,B,K;
int mul(int a,int b) {
	return 1LL * a * b % MOD;
}
int inc(int a,int b) {
	return a + b >= MOD ? a + b - MOD : a + b;
}
int C(int n,int m) {
	if(m > n) return 0;
	return mul(fac[n],mul(invfac[m],invfac[n - m]));
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	read(N);read(A);read(B);read(K);
	inv[1] = 1;
	for(int i = 2 ; i <= N ; ++i) {
		inv[i] = mul(inv[MOD % i],MOD - MOD / i);
	}
	fac[0] = invfac[0] = 1;
	for(int i = 1 ; i <= N ; ++i) {
		fac[i] = mul(fac[i - 1],i);
		invfac[i] = mul(invfac[i - 1],inv[i]);
	}
	int ans = 0;
	for(int i = 0 ; i <= N ; ++i) {
		if(K < i * A) break;
		if((K - i * A) % B != 0) continue;
		int s = i,t = (K - i * A) / B;
		ans = inc(ans,mul(C(N,s),C(N,t)));
	}
	out(ans);enter;
}


Measured memory_bytes: 3712
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

const int MAXN = 100005;
int color[MAXN];

int n, m, cs; bool bip;

vector< vector<int> > adj;

void dfs(int u) {
    for (auto& v : adj[u]) {
        if (color[v] != 0) {
            if (color[u] == color[v]) bip = false;
        }
        else {
            color[v] = 3 - color[u]; cs++;
            dfs(v);
        }
    }
}

int main() {
    memset(color, 0, sizeof color);

    GI(n);
    GI(m);

    adj.resize(n+1);

    FOR1(i, m) {
        int u, v;
        GI(u); GI(v);
        adj[u].PB(v);
        adj[v].PB(u);
    }

    LL odd = 0, noOdd = 0, single = 0;

    FOR1(i, n) {
        if (color[i] == 0) {
            color[i] = 1; cs = 1; bip = true;

            dfs(i);

//            DEBUG(i); DEBUG(bip);

            if (cs == 1) {
                single++;
            }
            else if (bip) {
                noOdd++;
            }
            else {
                odd++;
            }
        }
    }

//    DEBUG(single);
//    DEBUG(noOdd);
//    DEBUG(odd);

    cout << 2 * single * (n - single) + single * single + 2 * odd * noOdd + odd * odd + 2 * noOdd * noOdd << endl;
 
    return 0;
}


Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

LL dp[51][2501];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,X;
    cin >> N >> X;
    memset(dp,0,sizeof(dp));
    int a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    dp[0][0]=1;
    for(int i=0;i<N;i++){
        for(int j=N;j>=0;j--){
            for(int s=2500;s>=0;s--){
                if(dp[j][s]>0) dp[j+1][s+a[i]]+=dp[j][s];
            }
        }
    }
    LL ans=0LL;
    for(int i=1;i<=N;i++){
        for(int j=0;j<=2500;j++){
            if(dp[i][j]>0){
                if((double)j/i==X) ans+=dp[i][j];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1280
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

public class Program
{
    public static void Main(string[] args)
    {
        new Program().Solve(new ConsoleInput(Console.In, ' '));
    }

    public void Solve(ConsoleInput cin)
    {
        var n = cin.ReadIntArray(2);
        var m1 = n[0];
        var d1 = n[1];
        var x = cin.ReadIntArray(2);
        var m2 = x[0];
        var d2 = x[1];

        if (m1 == m2)
        {
            WriteLine(0);
        }
        else
        {
            WriteLine(1);
        }
        ReadKey();
    }
}

public class ConsoleInput
{
    private readonly System.IO.TextReader _stream;
    private char _separator = ' ';
    private Queue<string> inputStream;
    public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
    {
        this._separator = separator;
        this._stream = stream;
        inputStream = new Queue<string>();
    }
    public string Read
    {
        get
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(_separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
    }
    public string ReadLine { get { return _stream.ReadLine(); } }
    public int ReadInt { get { return int.Parse(Read); } }
    public long ReadLong { get { return long.Parse(Read); } }
    public double ReadDouble { get { return double.Parse(Read); } }
    public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
    public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
    public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
}


Measured memory_bytes: 13268
#include <iostream>

using namespace std;

    int
    main()
{
    int X{}, A{};

    cin >> X >> A;

    if(X < A) {
        cout << "0" << endl;
    }

    else if(X > A) {
        cout << "10" << endl;
    }

    else if(X == A) {
        cout << "10" << endl;
    }
}

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

int main() {
	string s; cin >> s;
	int res = 1;
	int pre = 1;
	for (int i = 1; i < s.size(); i++)
	{
		if(pre == 2 || s[i] != s[i-1]) {
			res++;
			pre = 1;
		}
		else {
			if(i == s.size()-1) continue;
			res++;
			pre = 2;
			i++;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
int main()
{
    int i,x,a[5];
    for(i=0;i<5;i++){
        scanf("%d",&a[i]);

    }
    for(i=0;i<5;i++){

        if(a[i]==0){
             x=i;
        }
    }
    printf("%d",x+1);

}


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

int main(){
    stack<int> s;
    string op;
    int a,b;
    
    while(cin >> op){
        
        if(op == "+"){
            a = s.top();
            s.pop();
            b = s.top();
            s.pop();
            s.push(a+b);
        }else if(op == "-"){
            b = s.top();
            s.pop();
            a = s.top();
            s.pop();
            s.push(a-b);
        }else if(op == "*"){
            a = s.top();
            s.pop();
            b = s.top();
            s.pop();
            s.push(a*b);
        }else{
            int x;
            x = stoi(op);
            s.push(x);
        }
    }
    cout << s.top() << endl;
    return 0;
}
    


Measured memory_bytes: 3172
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back

using namespace std;
typedef long long ll;
int main()
{
	string s;
	cin >> s;
  
	rep(i,s.size()) cout << "x";
}

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

int main() {
    int a, b, c;
    std::cin >> a;
    std::cin >> b;
    std::cin >> c;
    if(a < b && b < c){
      std::cout << "Yes" << std::endl;
    } else {
      std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 3080
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << "[line : " << __LINE__ <<"]"<< pp(x)
#define dg2(x,y) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y)
#define dg3(x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(w) pp(x) pp(y) pp(z)
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x , y) memset(x , y , sizeof x);
#define sz(x) (int)x.size()

const int Mod = 1e9 + 7;
const int inf = 1e18;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  set<int> st;
  vector<int>Cnt(2e5,0);
  for(int i = 0;i < N; i++) {
    int x, y;
    cin >> x >> y;
    st.insert(x);
    Cnt[x] += y;
  }

  int sum = 0;
  for(auto i : st) {
    sum += Cnt[i];
    if(sum < K) continue;
    cout << i << '\n';
    return 0;
  }
}

Measured memory_bytes: 7688
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll MOD = 1000000007;
const int MAX = 100000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }


int main(){
    int N; cin >> N;
    vector<ll> X(N);
    vector<ll> a(N);
    for (int i=0;i<N;i++){
        cin >> X[i];
        a[i] = X[i];
    }
    sort(a.begin(),a.end());
    for(int i=0;i<N;i++){
        ll n = X[i];
        if (n<a[N/2]){
            cout << a[N/2] << endl;
        }else{
            cout << a[N/2-1] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 5376
def main():
	n = int(input())
	*t, = map(int, input().split())
	tot = sum(t)
	*v, = map(int, input().split())
	lim1 = []
	lim2 = [(1, 0, 0), (-1, tot, tot)]
	til = 0
	for t1, t2, v1 in zip([0] + t, t, v):
		lim1.append((til, til + t2, v1))
		lim2.append((-1, til, til + v1))
		lim2.append((1, til + t2, v1 - (til + t2)))
		til += t2

	def mi(time):
		ret = float("inf")
		for l, r, lim in lim1:
			if l <= time <= r:
				ret = min(ret, lim)
		for f, tt, y in lim2:
			if f == -1 and time <= tt:
				ret = min(ret, y - time)
			if f == 1 and time >= tt:
				ret = min(ret, time + y)
		return ret

	print(sum(mi(i / 2) for i in range(tot * 2 + 1)) / 2)

if __name__ == '__main__':
	main()

Measured memory_bytes: 43868
sx,sy,tx,ty = list(map(int,input().split()))
dx = tx-sx
dy = ty-sy

print(dx*"R"+dy*"U"+dx*"L"+(dy+1)*"D"+(dx+1)*"R"+(dy+1)*"U"+"L"+"U"+(dx+1)*"L"+(dy+1)*"D"+"R")

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  int n,k;cin>>n>>k;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  int zero=0;
  rep(i,k){
    if(a[i]==0)zero+=1;
  }
  int last=a[0];
  vector<bool> res(n);
  for(int i=k;i<n;++i){
    last=a[i-k];
    
    if(last==0)zero-=1;
    if(a[i]==0)zero+=1;

    if(zero==0){
      if(a[i]>last)res[i]=true;
      else res[i]=false;
    }
    else{
      res[i]=false;
    }
  }
  for(int i=k;i<n;++i){
    	if(res[i]){
        cout<<"Yes"<<endl;
      }
      else{
        cout<<"No"<<endl;
      }
  }
  return 0;
}


Measured memory_bytes: 4840
/* ****Shrey97**** */

#include <bits/stdc++.h>

#define hell 1000000007
#define N 100005

using namespace std;


signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    cout << n*n*n;   
    return 0;
}

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

template<class INT>
std::vector<INT> factorize(INT n){
    std::vector<INT> res;
    for (INT i = 1; i * i <= n; i++){
        if (n % i == 0){
            res.push_back(i);
            if (i * i != n)
                res.push_back(n / i);
        }
    }
    return res;
}

int main(){
    int n, k;
    cin >> n >> k;
    vector<int64_t> A(n);
    copy_n(istream_iterator<int64_t>(cin), n, A.begin());
    auto s = accumulate(A.begin(), A.end(), 0L);
    auto factors = factorize(s);

    int64_t ans = 0;
    for (const auto &f: factors){
        vector<int64_t> B(n);
        for (int i = 0; i < n; i++)
            B[i] = A[i] % f;
        sort(B.begin(), B.end());
        vector<int64_t> acc(n + 1);
        for (int i = 0; i < n; i++)
            acc[i + 1] = acc[i] + B[i];
        for (int i = 0; i < n; i++){
            if (max(acc[i], f * (n - i) - (acc[n] - acc[i])) <= k)
                ans = max(ans, f);
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 256