akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

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

	String S  = str.nextLine();
	String x[] = S.split("");

	int m = 0;

	for (int i = 0; i < x.length - 1; i++) {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	}

	if (m == 2) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
}

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

#define watch(x) cerr << "\n" \
					  << (#x) << " is " << (x) << endl
const double PI = 3.141592653589793238463;
const int MOD = 1000000007;
const long long MAXI = ULONG_MAX;

/*
$alil03

URL: url

Solution Begins here
*/

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	int a[n], b[n], c[n];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i] >> b[i] >> c[i];
	}
	int prea = a[0];
	int preb = b[0];
	int prec = c[0];
	int newa = INT_MIN;
	int newb = INT_MIN;
	int newc = INT_MIN;
	for (int i = 1; i < n; i++)
	{
		newa = a[i] + max(preb, prec);
		newb = b[i] + max(prea, prec);
		newc = c[i] + max(prea, preb);
		prea = newa;
		preb = newb;
		prec = newc;
	}
	cout << max({prea, preb, prec});
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
void solve(long long N, std::vector<long long> A){
  vector<ll> a(N);
  for (int i = 0; i < N-1; i++) {
    a[A[i]-1]++;
  }
  for (int i = 0; i < N; i++) {
    cout << a[i] << endl;
  }
}

int main(){
    long long N;
	scanf("%lld",&N);
	std::vector<long long> A(N-2+1);
	for(int i = 0 ; i < N-2+1 ; i++){
		scanf("%lld",&A[i]);
	}
    solve(N, std::move(A));
}


Measured memory_bytes: 6432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll md = 1000000007;
#define rep(i, b) for(i = 0; i < b; i++)
#define fr first
#define sc second
using vl = vector<ll>;
using vvl = vector<vl>;
vl fac(2,1), ifac(2,1);

ll ad(ll a, ll b, ll mod = md) {
    return (a%mod + b%mod + mod) % mod;
}

ll ml(ll a, ll b, ll mod = md) {
    return ( (a%mod) * (b%mod) ) % mod;
}

ll pw(ll x, ll n, ll mod = md) {
    ll res = 1;
    x %= mod;
    while (n) {
        if (n & 1)  res = (res*x)%mod;
        n = (n >> 1);
        x = (x*x)%mod;
    }
    return res;
}

void cachefact(ll lim, ll mod = md) {
    for(int i = 2; i <= lim; i++) {
        ifac.push_back((ifac[mod%i] * (mod - mod/i) % mod)%mod);
    }
    for(ll i = 2; i <= lim; i++) {
        fac.push_back((fac[i-1] * i)%mod);
        ifac[i] = (ifac[i-1] * ifac[i])%mod;
    }
}

ll C(int n, int r) {
    if(n < r || r < 0) return 0;
    return ml(fac[n], ml(ifac[r], ifac[n-r]));
}

ll PIE(ll n, ll k, ll e, ll s, ll mod = md) {
	if(e < 0 || k < 0 || n < 0) return 0;
	ll ans = 0;
	for(int i = 0; i <= n && (e+1) * i + (n-i)*s <= k; i++) {
		ans = ad(ans, (i&1 ? -1 : 1) * ml(C(n, i), C(n - 1 + k - (e+1) * i - (n - i) * s, n-1)));
	}
	return ans;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie();
    cachefact(2e6);
    int x, y;
    cin >> x >> y;
    if((x + y)%3 == 0) {
    	int n = (x + y)/3;
	    cout << PIE(n, x, 2, 1) << "\n";
	} else {
		cout << "0\n";
	}
    return 0;
}

Measured memory_bytes: 43304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll k, a[100010];
bool possible = true;
int main()
{
	scanf("%lld", &k);
	for (int i = 0; i < k; i++) scanf("%lld", &a[i]);
	ll l = 2, h = 2;
	for (int i = k-1; i >= 0; i--)
	{
		//first consider l;
		ll s = 0, e = ((ll)1 << 61);
		while (s != e)
		{
			ll m = (s+e)/2;
			if (m - m%a[i] < l) s = m+1;
			else e = m; 
		}
		if (s - s%a[i] < l) 
		{
			possible = false;
		}
		l = s;
		s = 0; e = ((ll)1 << 61);
		while (s != e)
		{
			ll m = (s+e+1)/2;
			if (m - m%a[i] > h) e = m-1;
			else s = m; 
		}
		if (s - s%a[i] > h) 
		{
			possible = false;
		}
		h = s;
	}
	if (!possible || l > h) printf("-1\n");
	else printf("%lld %lld\n", l, h);

}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

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

int main() {
	int N;
	cin >> N;
	vector<int> B(N);
	rep(i,N) cin >> B[i];
	ll odd = 1;
	ll res = 1;
	rep(i,N) {
		if(B[i]%2) {
			odd *= 1;
		}
		else {
			odd *= 2;
		}
		res *= 3;
	}
	cout << res-odd << endl;
	return 0;
}


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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 int main(){
int A, B;
cin >> A >> B;

if(A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) print("Possible");
else print("Impossible");
 }

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define M int (1e9+7)
int main() {
	string s;
	cin >> s;
	int a, b;
	a = (s[0] - '0') * 10 + (s[1] - '0');
	b = (s[2] - '0') * 10 + (s[3] - '0');
	if ((a > 12 || a < 1) && (b > 12 || b < 1))
		cout << "NA" << endl;
	else if ((a > 0 && a < 13) && ( b > 0 && b < 13))
		cout << "AMBIGUOUS" << endl;
	else if ((a > 12 || a < 1) && ( b > 0 && b < 13))
		cout << "YYMM" << endl;
	else
		cout << "MMYY" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<map>
#include<set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int N = 2000000 + 10;
const int MOD = (int)1e9 + 7;

int m;
vector<pair<int, int>> query[N];
int ans[N];
long long p25[N];
long long inv_fact[N];
long long fact[N];
long long f[N];

long long mod_pow(long long a, long long b)
{
    long long ret = 1;
    for( ; b; b >>= 1) {
        if (b & 1) {
            ret = ret * a % MOD;
        }
        a = a * a % MOD;
    }
    return ret;
}

long long binom(int n, int m)
{
    return fact[n] * inv_fact[m] % MOD * inv_fact[n - m] % MOD;
}

int do_it(int len, int s)
{
    for(int i = 0; i < len; ++ i) f[i] = 0;
    f[len] = 1;
    for(int i = len; i + 1 < N; ++ i) {
        f[i + 1] = f[i] * 26 % MOD;
        (f[i + 1] += binom(i, len - 1) * p25[i - len + 1]) %= MOD;
    }
    return f[s];
    // for(auto e: query[len]) {
    //     ans[e.second] = f[e.first];
    // }
}

void solve()
{
    int k;
    string s;
    cin >> k >> s;
    cout << do_it(s.size(), k + s.size());
}

int main()
{
#ifdef SHUBHAM107
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("err.txt", "w", stderr);
#endif
    fact[0] = 1;
    inv_fact[0] = 1;
    for(int i = 1; i < N; ++ i) {
        fact[i] = fact[i - 1] * i % MOD;
        inv_fact[i] = inv_fact[i - 1] * mod_pow(i, MOD - 2) % MOD;
    }
    for(int i = 0; i < N; ++ i) {
        p25[i] = mod_pow(25, i);
    }
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 113652
from collections import deque
import sys
input = sys.stdin.readline
N=int(input())
ki=[[] for f in range(N)]
for i in range(N-1):
 u,v,w = map(int,input().split())
 ki[u-1].append([v-1,w%2])
 ki[v-1].append([u-1,w%2])
stack = deque([[0,0]])
check = [0]*N #チェック済みリスト
ans=[2]*N
ans[0]=0
while stack != deque([]) :
 a=stack.pop()
 ne=a[0]
 if check[ne]==0:
  check[ne]=1
  for i in range(len(ki[ne])):
   eda=ki[ne][i][0]
   edanum=ki[ne][i][1]
   edaans=(edanum+ans[ne])%2
   if check[eda]==0:
    stack.append([eda,edaans])
    ans[eda]=edaans
for i in ans:
 print(i)

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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    string s;
    cin>>s;
    bool flg1 = (s[0]=='A');

    if(flg1==0)
    {
        cout<<"WA\n";
        return 0;
    }

    int n = s.size();
    int cnt = 0;
    for(int i=2;i<n-1;++i)
        if(s[i]=='C')
            cnt++;
    bool flg2 = 0;
    if(cnt==1)
        flg2 = 1;

    if( flg2==0 )
    {
        cout<<"WA\n";
        return 0;
    }

    int pos = 2;
    while(s[pos]!='C')
        ++pos;

    for(int i=0;i<n;++i)
    {
        if(i==0 || i==pos)
            continue;
        if(isupper(s[i]))
        {
            cout<<"WA\n";
            return 0;
        }
    }

    cout<<"AC\n";
    return 0;
}   

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

void GetGCD(int a, int b, int& GCD)
{
	if(a == 0){
		GCD = b;
		return;
	}
	if(b == 0){
		GCD = a;
		return;
	}
	if(a >= b){
		a = a % b;
	}else{
		b = b % a;
	}
	GetGCD(a, b, GCD);
}

int main()
{
	while(true){
		int a, b;
		cin >> a >> b;
		if(cin.eof()) break;
		int GCD;
		GetGCD(a, b, GCD);
		int LCM = a * (b / GCD);
		cout << GCD << ' ' << LCM << endl;
	}
	return 0;
}

Measured memory_bytes: 3004
N = int(input())
S = list(input())
def app(S):
  for i in range(1,len(S)):
    if S[i] == S[i-1]:
      S[i] = ''
  S = [S[i] for i in range(len(S)) if S[i]!='']
  return S
while app(S) != S:
  S = app(S)
print(len(S))

Measured memory_bytes: 4652
n, c = gets.split.map(&:to_i)
stc = n.times.map {gets.split.map(&:to_i)}.sort_by{|e| e[0]}

memo = Array.new(c+1)
stc.each do |s,t,ch|
    i = memo.index{|e| e && e < s}
    memo[i] = nil if !memo[ch] && i
    memo[ch] = t
end

p memo.compact.size

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

int main()
{
    int n, cou = 0;
    cin >> n;
    for (int i = 0; i < 4; i++)
    {
        if (n % 10 == 2)
            cou++;
        n /= 10;
    }
    cout << cou << endl;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int tenten = n / 100 % 10;
    int ten = n / 10 % 10;
    int one = n % 10;

    if(tenten == 7||ten == 7 || one == 7){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 3592
coins = [10, 50, 100, 500]
def s(value):
    a = list(map(int, input().split()))
    pay = [0, 0, 0, 0]
    ms = sum([a[i] * coins[i] for i in range(4)]) - value
    m = [ms % 50 // 10, ms % 100 // 50, ms % 500 // 100, ms // 500]
    for cc, aa, mm in zip(coins, a, m):
        if aa > mm:
            print(cc, aa - mm)

s(int(input()))
while True:
    value = int(input())
    if not value:
        break
    print()
    s(value)

Measured memory_bytes: 6724
#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()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000000000000007;
const int MOD=1000000007;
signed main(){
  int n,k;cin>>n>>k;
  vector<int> a(n+1,0);
  rep1(i,n){
      cin>>a[i];
  }
  vector<vector<vector<int>>> dp(n+1,vector<vector<int>>(n+1,vector<int>(n+1,inf)));
  //dp[0][0][1]=a[1];
  dp[0][0][0]=0;
  //dp[0][1][0]=0;
  //cout<<"OK"<<endl;
  rep1(i,n){
      rep(j,n+1){
          rep(l,n+1){
              dp[i][j][i]=min(dp[i][j][i],dp[i-1][j][l]+max(a[i]-a[l],(int)0));
              if(j>0)dp[i][j][l]=min(dp[i][j][l],dp[i-1][j-1][l]);
          }
      }
  }
  int res=inf;
  rep(i,n+1){
      res=min(res,dp[n][k][i]);
  }
  cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 216832
s=input()
t=input()
b=[0]*160
c=[0]*160
res=False
for i in range(len(s)):
    b[ord(s[i])]+=1
    c[ord(t[i])]+=1
for i in range(160):
    if b[i]!=c[i]:
        res=True
if res:
    print("No")
else:   
    l=len(s)
    n=l
    while n>0:
        s=s[l-1]+s[:l-1]
        if s==t:
            res=False
            print("Yes")
            break
        else:
            res=True
        n-=1
    if res:
        print("No")
        


Measured memory_bytes: 3064
#include <regex>
#include "bits/stdc++.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 LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
#define mkpr make_pair
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
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 psl = pair<string, ll>;


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


  int N; cin>>N;

  int  ans = (N+1)/2;
  
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat Mar  2 17:11:49 2019

@author: Yamazaki Kenichi
"""

m = int(input())
A = [list(input().split()) for i in range(m)]

T = [[-1,-1,-1,-1]]
def insert(T,u,x):
    if T[0][3] == -1:
        T[0][3] = x
        return
    if x < T[u][3]:
        if T[u][1] == -1:
            T[u][1] = len(T)
            T.append([u,-1,-1,x])
        else:
            insert(T,T[u][1],x)
    else:
        if T[u][2] == -1:
            T[u][2] = len(T)
            T.append([u,-1,-1,x])
        else:
            insert(T,T[u][2],x)
def ino(u):
    if T[u][1] != -1:
        ino(T[u][1])
    ino_res.append(str(T[u][3]))
    if T[u][2] != -1:
        ino(T[u][2])
def pre(u):
    pre_res.append(str(T[u][3]))
    if T[u][1] != -1:
        pre(T[u][1])
    if T[u][2] != -1:
        pre(T[u][2])
def find(u,x):
    if x == T[u][3]:
        return True
    elif x < T[u][3]:
        if T[u][1] == -1:
            return False
        return find(T[u][1],x)
    else:
        if T[u][2] == -1:
            return False
        return find(T[u][2],x)
for c in A:
    if c[0] == 'insert':
        insert(T,0,int(c[1]))
    elif c[0] == 'find':
        print('yes') if find(0,int(c[1])) else print('no')
    else:
        ino_res = []
        ino(0)
        pre_res = []
        pre(0)
        print(' '+' '.join(ino_res))
        print(' '+' '.join(pre_res))
    


Measured memory_bytes: 273172
def A():
    s = input()
    if s == 'SSS': print(3)
    elif s=='RSS' or s=='SSR': print(2)
    elif s=='RRR': print(0)
    else: print(1)

def B():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = 0
    for i in range(n):
        for j in range(i+1, n):
            if a[i] == a[j]: continue
            for k in range(j+1, n):
                if a[i]==a[k] or a[j] == a[k]: continue
                s = a[i] + a[j] + a[k]
                if s > 2 * max(a[i], a[j], a[k]):
                    cnt += 1
    print(cnt)

def C():
    x, k, d = map(int, input().split())
    if abs(x) > k * d:
        print(abs(x) - k*d)
    else:
        tm = abs(x) // d
        x = abs(x) % d
        k -= tm
        if k % 2 == 0:
            print(x)
        else:
            print(d-x)
B()


Measured memory_bytes: 74040
s = input()
K = int(input())
sub = []
N = len(s)
for i in range(N):
  for j in range(1,K+1):
    if i+j <= N:
      tmp = s[i:i+j]
      sub.append(tmp)
#      if len(sub) < K and tmp not in sub:
#        sub.append(tmp)
#      elif sub[-1] > tmp:
#        sub
sub = set(sub)
sub = sorted(sub)
print(sub[K-1])

Measured memory_bytes: 4980
#!/usr/bin/env python
MOD = 10**9+7
N, A, B, C = map(int, input().split())


def get_inv(N):
    inv = [0] * (N + 1)
    inv[0] = 1
    inv[1] = 1
    for i in range(2, N + 1):
        inv[i] = (-(MOD // i) * inv[MOD%i]) % MOD
    return inv

mod_inv = get_inv(max(2*N-1, 100))

a = A*mod_inv[A+B]%MOD
b = B*mod_inv[A+B]%MOD
pa = [1]*(N+1)
pb = [1]*(N+1)
for i in range(N):
    pa[i+1] = (pa[i]*a)%MOD
    pb[i+1] = (pb[i]*b)%MOD

c = 1
ans = pa[N]*N + pb[N]*N
ans %= MOD
for m in range(N+1, N*2):
    c *= (m-1) * mod_inv[m-N]
    c %= MOD
    ans += c * ( pa[N]*pb[m-N] + pb[N]*pa[m-N]) % MOD * m % MOD
    ans %= MOD
print(ans*100*mod_inv[100-C]%MOD)


Measured memory_bytes: 19956
import math
def C(x):
  return math.ceil(x/10)*10
def I():
  return int(input())
def S(x):
  s=str(x)
  if s[-1]!='0':
    return 10-int(s[-1])
  else:
    return 0
a,b,c,d,e=I(),I(),I(),I(),I()
sum=C(a)+C(b)+C(c)+C(d)+C(e)
x=max(S(a),max(S(b),max(S(c),max(S(d),S(e)))))
print(sum-x)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int fivehundred = in.nextInt();
        int oneHundred = in.nextInt();
        int fifty = in.nextInt();
        int total = in.nextInt();

        int sum = 0;
        int patterns = 0;

        for (int i = 0; i < fivehundred + 1; i++) {
            for (int j = 0; j < oneHundred + 1; j++) {
                for (int k = 0; k < fifty + 1; k++) {
                    sum = 500 * i + 100 * j + 50 * k;
                    if (sum == total) {
                        patterns++;
                    }
                }
            }
        }
        System.out.println(patterns);
    }
}

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

int main(){
    long long n, a, b;
    cin >> n >> a >> b;
    long long X[n];
    for(int i = 0; i < n; i++){
        cin >> X[i];
    }

    long long ans = 0;
    for(int i = 1; i < n; i++){
        long long hoge = (X[i] - X[i - 1]) * a;
        if(hoge < b) ans += hoge;
        else ans += b;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    string S; cin >> S;
    if (S == "ABC") cout << "ARC\n";
    else cout << "ABC\n";
    return 0;
}

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

using namespace std;
typedef long long ll;

int main()
{
  int n;
  cin >> n;
  vector<int> a;

  int r;
  for (int i = 0; i < n; i++)
  {
    cin >> r;
    r--;
    a.push_back(r);
  }

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

  cout << res / 2 << endl;
}

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

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

  ll n;
  cin >> n;

  ll ans = 0;

  if (n % 2 == 0) {
    n /= 2;
    while (n) {
      ans += n / 5;
      n /= 5;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
/* Author: Dhruv Rastogi */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int> 
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
const long double PI = acos(-1.0);

const int N = 2e5+5;
int fact[N],invfact[N];

int expo(int base,int exponent,int MODULO){
    int ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%MODULO;
        base=(1LL*base*base)%MODULO;
        exponent>>=1;
    }
    return ans%MODULO;
}
int inv(int a){
	return expo(a,hell-2,hell);
}
void computefact(){
	fact[0]=1;
	rep(i,1,N){
		fact[i]=(fact[i-1]*i)%hell;
	}
	invfact[N-1]=inv(fact[N-1]);
	repd(i,N-2,0){
		invfact[i]=(i+1)*invfact[i+1];
		invfact[i]%=hell;
	}
}

int ncr(int n,int r){
    assert(r>=0 and n>=r);
	return fact[n]*invfact[r]%hell*invfact[n-r]%hell;
}

int get(int x1,int y1,int x2,int y2){
	return ncr(y2-y1+x2-x1,x2-x1);
}

void solve(){  
	computefact();
	int h,w,a,b;
	cin>>h>>w>>a>>b;
	int ans=0;
	rep(i,b,w){
		ans+=get(0,0,h-a-1,i)*get(h-a,i,h-1,w-1);
		ans%=hell;
	}
	cout<<ans<<endl;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3328
import sys

counter = 0
block = []
for line in sys.stdin:
  if line == "\n":
    counter = -1
    block = []
  else:
    counter += 1
    for i in line:
      if i == "1":
        block.append([counter,line.index(i)])
  if counter == 7:
    if block[0][0] == block[1][0]:
      if block[1][0] == block[2][0]:
        print("C")
      elif block[0][1] == block[2][1]:
        print("A")
      elif block[0][1] < block[2][1]:
        print("E")
      else:
        print("G")
    else:
      if block[0][1] == block[3][1]:
        print("B")
      elif block[0][1] < block[3][1]:
        print("F")
      else:
        print("D")

Measured memory_bytes: 7376
#import math
#import fractions

def main():

    # 1 <= a <= b <= 10^18
    # 1 <= c,d <= 10^9

    n = int(input())
    hi = list(map(int,input().split()))

    b = [0]*n

    for i in range(n-1):
        if hi[i] >= hi[i+1]:
            b[i] = 1
    
    countA = 0
    countB = 0
    for i in range(n):
        if b[i] == 1:
            countA += 1
        else:
            countA = 0
        
        if countB < countA:
            countB = countA
    
    print(countB)



if __name__ == '__main__':
    main()



Measured memory_bytes: 63856
function Main(input) {
   input = input.split("\n")[0]

    const getCounterPart = (s) => {
        switch (s){
          case 'A':
              return 'T'
          case 'T':
              return 'A'
          case 'C':
              return 'G'
          case 'G':
              return 'C'
        }
    }
    console.log(getCounterPart(input))
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"))

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

int main() {
  int N, l, r;
  cin >> N;
  int sum = 0;
  
  for (int i = 0; i < N; i++) {
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int K,X;
    cin >> K >> X;
    int count=1;
    while(1)
    {

        cout << X-K+count << " ";
        count++;
        if(count==2*K)
        {
            break;
        }
    }
    cout << endl;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>

using namespace std;

int main() {
	int K;
	string str;
	set<string> check;
	vector<string> strings;

	cin >> str;
	cin >> K;

	for (int i = 0; i < str.length(); i++) {
		for (int j = 0; j < 5 && i + j < str.length(); j++) {
			string s = str.substr(i, j + 1);
			if (check.count(s) == 0) {
				check.insert(s);
				strings.push_back(s);
			}
		}
	}

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

	cout << strings[K - 1] << endl;

	return 0;
}

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

int main() {
	int n, u[100000], i, kicount[100001], gucount[100001], min = 100000, min2 = 100000, mini, mini2, min3 = 100000, min4 = 100000;
	memset(kicount, 0, sizeof(kicount));
	memset(gucount, 0, sizeof(gucount));
	
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &u[i]);
		if (i % 2 == 0) {
			kicount[u[i]]++;
		}
		else {
			gucount[u[i]]++;
		}
	}

	for (i = 0; i <= 100000; i++) {
		if (min > abs(n / 2 - kicount[i])) {
			min = abs(n / 2 - kicount[i]);
			mini = i;
		}
		if (min2 > abs(n / 2 - gucount[i])) {
			min2 = abs(n / 2 - gucount[i]);
			mini2 = i;
		}
	}

	if (mini != mini2) {
		printf("%d", min + min2);
		return 0;
	}

	for (i = 0; i <= 100000; i++) {
		if (min3 > abs(n / 2 - kicount[i]) && i != mini) {
			min3 = abs(n / 2 - kicount[i]);
		}
		if (min4 > abs(n / 2 - gucount[i]) && i != mini2) {
			min4 = abs(n / 2 - gucount[i]);
		}
	}

	if (min + min4 < min2 + min3) {
		printf("%d", min + min4);
	}
	else {
		printf("%d", min2 + min3);
	}

	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    int n,k;
    vector<int> p;
    int x;
    
    cin >> n >> k;
    for (int i = 0;i < n;i++){
        cin >> x;
        p.push_back(x);
    }
    
    sort(p.begin(),p.end());
    
    long long ans = 0;
    for (int i = 0;i < k;i++){
        ans += p[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628
MOD = 10**9+7

N, K = map(int, input().split())
a = list(map(int, input().split()))

# i 番目までに j 枚使ったときの場合の数
dp = [[0]*(K+1) for _ in range(N+1)]
dp[0][0] = 1

for i in range(1, N+1):
    for j in range(1, K+1):
        dp[i-1][j] += dp[i-1][j-1]
    for j in range(K+1):
        dp[i][j] = dp[i-1][j]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-a[i-1]-1]
        dp[i][j] %= MOD

print((dp[N][K]+MOD)%MOD)

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

int primes[100000];
int prime_size;

int phi(int n)
{
  int ans = n;
  for (int i = 0; primes[i]*primes[i] <= n; i++) {
    if (n % primes[i] == 0) {
      ans -= ans / primes[i];
      while (n % primes[i] == 0) {
        n /= primes[i];
      }
    }
  }
  if (n > 1) {
    ans -= ans / n;
  }
  return ans;
}

int main()
{
  static const int N = 1000000;
  static bool sieve[N+1];
  for (int i = 2; i <= N; i++) {
    if (!sieve[i]) {
      primes[prime_size++] = i;
      for (int j = i+i; j <= N; j += i) {
        sieve[j] = true;
      }
    }
  }
  static long long f[N+1];
  f[1] = 2;
  for (int i = 2; i <= N; i++) {
    f[i] = f[i-1] + phi(i);
  }

  int T;
  cin >> T;
  while (T-- > 0) {
    int n;
    cin >> n;
    cout << f[n] << endl;
  }
  return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;

class MainClass
{
    static void Main()
    {
        var NK = Console.ReadLine().Split().Select(long.Parse).ToArray();
        int N = (int)NK[0];long K = NK[1];
        var ab = new long[N][];
        for (int i = 0; i < N; i++)
        {
            ab[i] = Console.ReadLine().Split().Select(long.Parse).ToArray();
        }
        Array.Sort(ab, (x, y) => x[0].CompareTo(y[0]));

        long index = 0;
        int num = -1;
        for(int i = 0; i < ab.Length; i++)
        {
            num = (int)ab[i][0];
            index += ab[i][1];

            if (index >= K) break;
        }
        Console.WriteLine(num);
    }
}

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


int main(){
  int x,y;
  cin >> x >> y;
  int ans=0;
  if(x==1 && y==1)ans=1000000;
  else{
    if(x==1)ans+=300000;
    else if(x==2) ans+=200000;
    else if(x==3) ans+=100000;

    if(y==1)ans+=300000;
    else if(y==2) ans+=200000;
    else if(y==3) ans+=100000;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353,INF=1e18;



int main() {
    ll N,A,B,C;
    cin>>N>>A>>B>>C;
    vector<ll> ABC={A,B,C};
    vector<string> s(N);
    rep(i,N){cin>>s.at(i);}
    vector<char> choice(N);
    rep(i,N){
        int x=s.at(i).at(0)-'A',y=s.at(i).at(1)-'A';
        if(ABC.at(x)==0 && ABC.at(y)==0){cout<<"No"<<endl;return 0;}
        if(ABC.at(x)>ABC.at(y)){
            choice.at(i)=y+'A';
            ABC.at(x)--;
            ABC.at(y)++;
        }
        else if(ABC.at(y)>ABC.at(x)){
            choice.at(i)=x+'A';
            ABC.at(y)--;
            ABC.at(x)++;
        }
        else{
            if(ABC.at(x)==1 && ABC.at(3-x-y)==0 && i<N-1){
                if(s.at(i)==s.at(i+1)){
                    choice.at(i)=y+'A';
                    ABC.at(x)--;
                    ABC.at(y)++;
                }
                else{
                    int nx=s.at(i+1).at(0)-'A',ny=s.at(i+1).at(1)-'A';
                    choice.at(i)=x+y-3+nx+ny+'A';
                    ABC.at(3-nx-ny)--;
                    ABC.at(x+y-3+nx+ny)++;
                }
            }
            else{
                choice.at(i)=y+'A';
                ABC.at(x)--;
                ABC.at(y)++;
            }
        }
    }
    cout<<"Yes"<<endl;
    rep(i,N){cout<<choice.at(i)<<endl;}
    return 0;
}


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

#define Fast            ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define fWrite          freopen ("out.txt","w",stdout);
#define TC              int t;cin >> t;FOR(tc,1,t)
#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define all(a)          a.begin(),a.end()
#define MEM(a,x)        memset(a,x,sizeof(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)

#define Make(x,p)       (x | (1<<p))
#define DeMake(x,p)     (x & ~(1<<p))
#define Check(x,p)      (x & (1<<p))
#define popcount(x)     __builtin_popcount(x)

int main()
{
    LL a,b;
    cin >> a >> b;
    a=a%b;
    cout << min(b-a,a);
}


Measured memory_bytes: 256
import java.awt.Point;
import java.io.PrintStream;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {
	final static PrintStream so = System.out;
	final static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] field = new char[h][w];
		int [][]     d = new  int[h][w];
		
		int countDots = 0;
		for (int i = 0; i < h; i++) {
			String line = sc.next();
			
			for (int j = 0; j < w; j++) {
				field[i][j] = line.charAt(j);
				if (field[i][j] == '.') countDots++;
			}
		}
		
		int[] my = {0, 1, 0, -1};
		int[] mx = {1, 0, -1, 0};
		 
		Point start = new Point(0, 0);
		Point goal  = new Point(w-1, h-1);
		Deque<Point> deq = new ArrayDeque<>();
		deq.add(start);
		d[start.y][start.x] = 1;
		
		
		while(!deq.isEmpty()) {
			Point current = deq.poll();
			
			for (int i = 0; i < my.length; i++) {
				int ny = current.y + my[i];
				int nx = current.x + mx[i];
				
				if (ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
				if (field[ny][nx] == '#') continue;
				if (d[ny][nx] != 0) continue;
				
				d[ny][nx] = d[current.y][current.x] + 1;
				deq.add(new Point(nx, ny));
			}
		}
		so.println(d[goal.y][goal.x] == 0 ? -1 : (countDots - d[goal.y][goal.x]));
	}
}


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

const double INF = (double)(1 << 28);
const int MOD = 256;
const double EPS = 1e-10;

int main () {
    int n;
    while (cin >> n, n) {
        vector<int> I(n);
        for (auto &i : I) cin >> i; 

        double H = INF;
        int S, A, C;
        for (int s = 0; s < 16; s++) {
            for (int a = 0; a < 16; a++) {
                for (int c = 0; c < 16; c++) {
                    vector<int> o(MOD, 0);
                    int r = s;
                    for (int i = 0; i < n; i++) {
                        r = (r * a + c) % MOD;
                        o[(r + I[i]) % MOD]++;
                    }
                    double h = 0.;
                    for (auto i : o) {
                        if (i > 0) h -= ((double)i / n) * log((double)i / n);
                    }
                    if (h + EPS < H) {
                        H = h, S = s, A = a, C = c;
                    }
                }
            }
        }
        cout << S << " " << A << " " << C << endl;
    }

    return 0;
}

Measured memory_bytes: 1240
#include <stdio.h>
int main(void){
	int w, a, b;
	scanf("%d %d %d", &w, &a, &b);
	int c = a < b ? a : b, d = a < b ? b : a;
	printf("%d", w+c < d ? d-w-c : 0);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(void){

  char c;

  while(1){
    c = getc(stdin);
    if( c == '\n'){
      break;
    }

    if( 'a' <= c && c <= 'z' ){
      c -= 0x20;
    }

    printf("%c",c);
  }

  printf("\n");

  return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>

#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
using namespace std;

int main()
{
    int a, b; cin >> a >> b;
    if (a <= 0 && 0 <= b) {
        cout << "Zero" << endl;
    }
    else if (a > 0 && b > 0) {
        cout << "Positive" << endl;
    }
    else if (a < 0 && b < 0) {
        int dist = abs(abs(a) - abs(b));
        int num = dist - 1 + 2;
        if (num % 2 == 0) {
            cout << "Positive" << endl;
        }
        else {
            cout << "Negative" << endl;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>

typedef long long ll;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}


//深さ優先探索
void dfs(vector<string> &m,vector<vector<bool>> &seen, ll x, ll y, ll h, ll w){

	seen[y][x]=true;

	
	for(ll i=0;i<4;i++){
		ll nx=x,ny=y;
		if(i==0){ //up
			ny=y-1;
		}
		else if(i==1){ //down
			ny=y+1;
		}
		else if(i==2){ //right
			nx=x+1;
		}
		else{ //left
			nx=x-1;
		}

		if(nx<0 || nx>=w || ny<0 || ny>=h){
			continue;
		}
		if(seen[ny][nx]){
			continue;
		}
		
		if(m[ny][nx]=='#'){
			continue;
		}

		dfs(m,seen,nx,ny,h,w);
	}
}

const ll MOD=1000000007;

void solve(){
	
	ll a,b,c,d;
	cin>>a>>b>>c>>d;

	ll t,o;
	if(c%b==0){
		t=c/b;
	}
	else{
		t=c/b+1;
	}

	if(a%d==0){
		o=a/d;
	}
	else{
		o=a/d+1;
	}

	if(t<=o){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}


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


Measured memory_bytes: 3620
def low_left(ls,key):
    left,right = -1,len(ls)
    while right - left > 1:
        mid = (right+left)//2
        if ls[mid] >= key:
            right = mid
        else:
            left = mid
    return left+1


def high_right(ls,key):
    left,right = -1,len(ls)
    while right - left > 1:
        mid = (right+left)//2
        if ls[mid]<=key:
            left = mid
        else:
            right = mid
    return right


def test():
    n = int(input())
    A,B,C = [list(sorted((map(int,input().split())))) for i in range(3)]
    ans = 0

    for b in B:
        ans += (n-high_right(C,b))*low_left(A,b)
    print(ans)


if __name__ == "__main__":
    test()


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  string s;
  cin >> s;
  cout << s.substr(0, SZ(s) - 8) << endl;;

  return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn.readLine

object Main extends App {
  def calc(op:String,x:Int,y:Int) = {
    op match {
      case "+" => x+y
      case "-" => x-y
      case "*" => x*y
    }
  }

  val l = readLine.split(" ")

  def revP(n:Int,stack:List[Int]):Int =  {
    if(n==l.length) stack(0)
    else {
      val s = l(n)
      val stack2 =
        if(s.forall(_.isDigit)) s.toInt::stack
        else {
          val x::y::tail = stack
          calc(s,y,x)::tail
        }
      revP(n+1,stack2)
    }
  }

  println(revP(0,List()))

}

Measured memory_bytes: 43684
#include <iostream>
//#include <string>
//#include <iomanip>

using namespace std;
//#define

int main() {
	int gyou, retsu;
	int count_yoko = 0;
	int count_tate = 0;
	cin >> gyou >> retsu;
	int hyou[gyou+1][retsu+1];
	for(int i = 0; i <= gyou-1; ++i){
		for(int j = 0; j <= retsu-1; ++j){
			cin >> hyou[i][j];
		}
	}
	for(int i = 0; i <= gyou-1; ++i){
		count_yoko = 0;
		for(int j = 0; j <= retsu; ++j){
			if(j == retsu){
				hyou[i][j] = count_yoko;
			}
		count_yoko += hyou[i][j];
		}
	}

	for(int i = 0; i <= retsu; ++i){
		count_tate = 0;
		for(int j = 0; j <= gyou; ++j){
			if(j == gyou){
				hyou[j][i] = count_tate;
			}
			count_tate += hyou[j][i];
		}
	}

	for(int i = 0; i <= gyou; ++i){
		for(int j = 0; j <= retsu; ++j){
			if(j == retsu){
				cout << hyou[i][j] << endl;
			} else {
				cout << hyou[i][j] << " ";
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define mod 10e9+7

#define rep(i,n) for(int i=1;i<=n;i++)
int main(){
   ll n,x,all=0;
   cin >> n;
   if(n==3 ||n==5 || n==7 )
   cout << "YES" << endl;
   else cout << "NO"<< endl;
  }



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,M; cin>>N>>M;
  string ans="No";
  if(N==M)
    ans="Yes";
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.text.DecimalFormat;

public class Main {
	public static void main(String[] args) throws IOException {
		StringBuilder sb = new StringBuilder();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		DecimalFormat df = new DecimalFormat("0.000");
		String line;
		while ((line = br.readLine()) != null) {
			String[] tmp = line.split(" ");
			double[] values = toDoubleArray(tmp);
			double x = (values[2] * values[4] - values[1] * values[5]) / (values[0] * values[4] - values[1] * values[3]);
			double y = (values[2] * values[3] - values[0] * values[5]) / (values[1] * values[3] - values[0] * values[4]);

			x = new BigDecimal(x).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
			y = new BigDecimal(y).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
			sb.append(df.format(x)).append(" ").append(df.format(y)).append("\n");
		}

		System.out.print(sb.toString());
	}

	public static double[] toDoubleArray(String[] lines) {
		double[] doubles = new double[lines.length];
		for (int i = 0; i < lines.length; i++) {
			doubles[i] = Double.parseDouble(lines[i]);
		}
		return doubles;
	}
}

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

int x;
vector<int> v = {1,2,3};
unordered_map<int,int> m;
int main() {
    cin >> x;
    if(x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
} 


Measured memory_bytes: 3568
import java.util.Scanner;

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

        for(Integer i=3; i<=n; i++) {
            if(i % 3 == 0 || Integer.toString(i).contains("3")) {
                System.out.print(" " + i);
            }
        }
        System.out.print("\n");
    }
}



Measured memory_bytes: 29468
{-
 - AOJ #1186: Integral Rectangles
 - nextrect (h,w) = (h',w')
 -   where (h',w') is the smallest wide integral rectangle
 -   bigger than (h,w).
 -}

import Control.Monad        -- unless
import Control.Applicative  -- <$>

-- Type of the integral rectangles
data IntRect = IR Int Int deriving Eq

instance Ord IntRect where
  compare (IR h w) (IR h' w')
    | h == h' && w == w'            = EQ
    | d < d' || (d == d' && h < h') = LT
    | otherwise                     = GT
    where diagSq h w = h^2 + w^2
          d  = diagSq h  w
          d' = diagSq h' w'

instance Show IntRect where
  show (IR h w) = (show h) ++ " " ++ (show w)

-- nextRect
nextRect :: IntRect -> IntRect
nextRect (IR h w) = minimum $
  map head [dropWhile (<= (IR h w)) [(IR h' w') | w'<-[h'+1..]] | h'<-[1..w]]
  -- (IR h w) < (IR w w+1) < (every wide rectangle whose height > w).

main :: IO ()
main = do
  [h,w] <- (map read . words) <$> getLine
  unless (h == 0 && w == 0) $ do
    putStrLn (show $ nextRect (IR h w))
    main  -- recursion

Measured memory_bytes: 5576
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define MMOD(i) ((i%MOD)+MOD)%MOD;
#define all(v) v.begin() , v.end()
#define vec(i,j) vector<vector<ll>>(i,vector<ll>(j,0))
const ll INF=99999999999999;
const ll MOD=1000000007;
const ll MAX_N=100010;
ll a,b,c,d,e,x,y,z,k,m,n,l,q,h,w,ans=0;
vl v,v1,dp(200001);
ll vv[2001][2001],tate[2001][2001],yoko[2001][2001];
vp p,p1;
string s;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
   cin>>h>>w;
   rep(i,h+1){
       rep(j,w+1){
           tate[i][j]=0;
           yoko[i][j]=0;
       }
   }

   rep(i,h){
       cin>>s;
       rep(j,w){
           if(s[j]=='#'){
               vv[i+1][j+1]=1;
           }
           else vv[i+1][j+1]=0;
       }
   }

   rep(i,h){
       rep(j,w){
           if(vv[i+1][j+1]==0)yoko[i+1][j+1]=yoko[i+1][j]+1;
           else yoko[i+1][j+1]=0;
       }
       for(ll j=w-2;j>-1;j--){
           if(yoko[i+1][j+1]>0&&yoko[i+1][j+2]>0)yoko[i+1][j+1]=yoko[i+1][j+2];
       }
   }

   rep(j,w){
       rep(i,h){
           if(vv[i+1][j+1]==0)tate[i+1][j+1]=tate[i][j+1]+1;
           else tate[i+1][j+1]=0;
       }
       for(ll i=h-2;i>-1;i--){
           if(tate[i+1][j+1]>0&&tate[i+2][j+1]>0)tate[i+1][j+1]=tate[i+2][j+1];
       }
   }

   rep(i,h){
       rep(j,w){
           //cout<<i<<" "<<j<<" "<<tate[i+1][j+1]<<" "<<yoko[i+1][j+1]<<endl;
           ans=fmaxl(ans,tate[i+1][j+1]+yoko[i+1][j+1]);
       }
   }

   cout<<ans-1<<endl;
}

Measured memory_bytes: 95616
#include<stdio.h>
#include<stdlib.h>

int main(){
  int N,A[100],f=0,temp,i,j;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<N-1;i++){
    for(j=N-1;j>i;j--){
      if(A[j]<A[j-1]){
	temp=A[j];
	A[j]=A[j-1];
	A[j-1]=temp;
	f++;
      }
    }
  }
   for(i=0;i<N;i++){
     if(i!=N-1)printf("%d ",A[i]);
     else printf("%d",A[i]);
   }
   printf("\n%d\n",f);
   return 0;
}



Measured memory_bytes: 2104
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	long long int D,N;
	cin>>D>>N;
	long long int ans=0,tmp=0,M=100;
	int cnt=0;
	if(D==1){
		M=100*100;
	}else if(D==2){
		M=100*100*100;
	}
	for(int i=1;;i++){
		tmp=i*pow(100,D);
		if(tmp%M==0){
			continue;
		}
		ans=tmp;
		cnt++;
		if(cnt==N){
			break;
		}
	}

		cout<<ans<<endl;

	return 0;
}

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

using namespace std;

int main()
{
    int r, g, b;
    cin >> r >> g >> b;
    
    int total  = r * 100 + g * 10 + b;
    
    if(!((total%4)==0)) cout << "NO" << endl;
    else cout << "YES" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define cin(a,n) for(i=0;i<n;i++){cin>>a[i];sum+=a[i];}
#define ll long long int
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rf1(i,a,n) for(int i=a;i>n;i--)
#define cases() int q;cin>>q;while(q--)
#define ld long double
#define cout(a,n) for(i=0;i<n;i++)cout<<a[i]<<" ";
#define inf 1e9;
#define mod 1000000007;
using namespace std;
int main(){
  int n;
  cin>>n;
   int res=n%10;
   if(res==2||res==4||res==5||res==7||res==9){
    cout<<"hon";
   }
   else if(res==0||res==1||res==6||res==8){
    cout<<"pon";
   }
   else
    cout<<"bon";
return 0;
}



Measured memory_bytes: 3636