akhauriyash/Code-Regression huggingface dataset:
X = int(input())

if X >= 1800:
    print("1")
elif X >= 1600:
    print("2")
elif X >= 1400:
    print("3")
elif X >= 1200:
    print("4")
elif X >= 1000:
    print("5")
elif X >= 800:
    print("6")
elif X >= 600:
    print("7")
elif X >= 400:
    print("8")

Measured memory_bytes: 9180
n = int(input())
h = list(map(int, input().split()))

dp = [float("inf")] * (n + 10)
dp[0] = 0

for i in range(n):
    for j in range(1, 3):
        if i + j < n:
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]))

print(dp[n - 1])


Measured memory_bytes: 13980
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
typedef long double ld;
typedef unsigned long long ull;
#define X first
#define Y second
#define mp make_pair
template<class T> using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T, class X> using indexed_map = tree<T, X, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int M = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int modpow(int n, int k, int MOD);

/**************** code starts here ****************/

void poppingfever() {
	int N;
	cin >> N;
	cout << 0 << endl;
	string s;
	cin >> s;
	int l = 0, r = N;
	string sl = s, sr = s;
	while (s != "Vacant") {
		int c = (l + r) / 2;
		cout << c << endl;
		cin >> s;
		if (((c - l) % 2) ^ (sl == s)) {
			l = c;
			sl = s;
		} else {
			r = c;
			sr = s;
		}
	}
}

/**************************************************/

signed main() {
	#ifdef fastfurioustransform
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	#endif
 
	//ios::sync_with_stdio(0); cin.tie(0);
	//cout << fixed << setprecision(12);
 
	poppingfever();
 
	return 0;
}

int modpow(int n, int k, int MOD) {
	int ans = 1; n %= MOD;
	while (k > 0) {
		if (k & 1) ans = (ans*n) % MOD;
		k >>= 1; n = (n*n) % MOD;
	}
	return ans;
}

Measured memory_bytes: 852
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val H = Integer.parseInt(sc.next())
    val W = Integer.parseInt(sc.next())
    val h = Integer.parseInt(sc.next())
    val w = Integer.parseInt(sc.next())

    println(H * W - h * W - H * w + h * w)
  }
}

Measured memory_bytes: 25548
from collections import Counter
counter = Counter()
n, f = map(int, input().split())
for _ in range(n):
  items = input().split()
  m = int(items[0])
  items = items[1:]
  items.sort()
  for i in range(m):
    for j in range(i + 1, m):
      counter[(items[i], items[j])] += 1

lst = [(k, v) for k, v in counter.most_common() if v >= f]
lst.sort()
print(len(lst))
for k, v in lst:
  print(*k)




Measured memory_bytes: 7056
N, M = map(int, input().split())
A = sorted(map(int, input().split()))
BC = sorted((tuple(map(int, input().split())) for _ in range(M)), key=lambda x:x[1])
D = []
x = 0
for i in range(M-1,-1,-1):
    if x + BC[i][0] >= N:
        D += [BC[i][1]]*(N-x)
        break
    D += [BC[i][1]]*BC[i][0]
    x += BC[i][0]
for i in range(len(D)):
    if A[i] >= D[i]:
        break
    A[i] = D[i]
print(sum(A))

Measured memory_bytes: 22520
#include <iostream>
#include <math.h>

using namespace std;

int main(){
  long long int H;
  cin >> H;
  long long int depth=0;
  while(H!=0){
    H = H/2;
    depth++;
  }
  long long int count=0;
  for(long long int i=0;i<depth;i++){
    count += pow(2,i); 
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

int main(){
	string s;

	cin >> s;

	for(int i = 0 ; i < s.size() ; i++){
		if(s[i] == '?'){
			if(i < s.size() - 1){
				if(i > 1 && s[i-1] == 'P'){
					s[i] = 'D';
				}else if(s[i+1] == '?'){
					s[i] = 'P';
					s[i+1] = 'D';
				}else if(s[i+1] == 'D'){
					s[i] = 'P';
				}else{
					s[i] = 'D';
				}
			}else{
				s[i] = 'D';
			}
		}
		cout << s[i];
	}
}


Measured memory_bytes: 3752
def main():
    k = int(input())

    if k < 10:
        print(k)
        exit()

    S = [str(i) for i in range(1, 10)]
    Sa = [str(i) for i in range(1, 10)]
    while True:
        Ad = []
        for sa in Sa:
            if sa[-1] == '0':
                Ad.append(sa + '0')
                Ad.append(sa + '1')
            elif sa[-1] == '9':
                Ad.append(sa + '8')
                Ad.append(sa + '9')
            else:
                for i in [-1, 0, 1]:
                    Ad.append(sa + str(int(sa[-1]) + i))

        Sa = Ad
        S.extend(Ad)
        if k <= len(S):
            print(S[k - 1])
            exit()

if __name__ == "__main__":
    main()


Measured memory_bytes: 61276
import sys
import itertools

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def TI(): return tuple(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n=II()
    p=TI()
    q=TI()
    for i,s in enumerate(itertools.permutations(range(1,n+1))):
        if s==p:a=i
        if s==q:b=i
    print(abs(b-a))
main()

Measured memory_bytes: 3064
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main(){
    int a, b;
  	cin >> a >> b;
  	if(a + b == 15){
    	cout<<("+")<<endl;
    }
  	else if(a * b == 15){
    	cout<<("*")<<endl;
    }
  	else{
    	cout<<("x")<<endl;
    }
}

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

int main(void){
  int w,a,b;
  cin>>w>>a>>b;
  
  int A=a+w;
  int B=b+w;
  
  if(A<b){
   cout<<b-A<<endl; 
  }else if(B<a){
   cout<<a-B<<endl; 
  }else{
   cout<<'0'<<endl; 
  }
  return 0;
}

Measured memory_bytes: 3512
#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>

using namespace std;

ifstream fin("../data.txt");

int x1, y1, x2, y2, aux, sx, sy, tx, ty, roads, minix, miniy, nx, ny, ax, ay;
char dir;
int a[2005][2005];
string ans, sdir;
vector<pair<int, int>> d = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};

int absVal(int x) {
  if (x < 0) return -x;
  return x;
}

bool isValid(int x, int y) {
  if (x > 2004 || x < 0 || y > 2004 || y < 0 || a[x][y] == 1) return 0;
  return 1;
}

int main() {
   ans = "", sdir = "URDL";
   cin >> x1 >> y1 >> x2 >> y2;
   aux = x1;
   x1 -= aux - 1;
   x2 -= aux - 1;
   aux = y1;
   y1 -= aux - 1;
   y2 -= aux - 1;
   sx = x1;
   sy = y1;
   tx = x2;
   ty = y2;
   //cout << sx << " " << sy << " " << tx << " " << ty << "\n";
   //cout << x1 << " " << y1 << " " << x2 << " " << y2;
   a[sx][sy] = 1;
   while (roads < 4) {
    //  cout << sx << " " << sy << " " << tx << " " << ty << "\n\n";
    //  for (int i = 0; i < 5; i++) {
    //   for (int j = 0; j < 5; j++) {
    //     cout << a[i][j] << " ";
    //   }
    //   cout << "\n";
    // }
    //if (sx == 0 && sy == 2) return 0;
    //cout << "\n";
     minix = miniy = 20000;
     for (int i = 0; i < 4; i++) {
      if (isValid(sx + d[i].first, sy + d[i].second)) {
        ax = absVal(tx - sx - d[i].first);
        ay = absVal(ty - sy - d[i].second);
        if (minix > ax || miniy > ay) {
          //cout << ax << " " << ay << "\n";
          minix = ax;
          miniy = ay;
          nx = sx + d[i].first;
          ny = sy + d[i].second;
          dir = sdir[i];
        }
     }
     }

     ans += string(1, dir);
     a[nx][ny] = 1;
     sx = nx;
     sy = ny;
     if (sx == tx && sy == ty) {
       roads++;
       if (roads % 2) {
         sx = x2;
         sy = y2;
         tx = x1;
         ty = y1;
       } else {
         sx = x1;
         sy = y1;
         tx = x2;
         ty = y2;
       }
       a[sx][sy] = 1;
       a[tx][ty] = 0;
     }
    }
  cout << ans;
  return 0;
}


Measured memory_bytes: 11600
#include <bits/stdc++.h>
using namespace std;
#define li long long int
#define pb push_back
#define rep(i,n) for(li i=0;i<n;i++)
void solve()
{
   li n;
   cin>>n;
   li a[n+1];
   rep(i,n)
   cin>>a[i+1];
   li sum=1000;
   for(li i=2;i<=n;i++)
   {
       if(a[i]>a[i-1])
       {
           li e=sum/a[i-1];
           sum-=e*a[i-1];
           sum+=e*a[i];
       }
   }
   cout<<sum;
   
}

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    li t;
    t=1;
    while(t--)
    {
        solve();
        
    }
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=2010;
vector<int> less_pos,as,pos[maxn];
int a[maxn],bit[maxn];
int n,k,q;
inline int lowbit(int x){
	return x&-x;
}
inline void modify(int pos,int add){
	for(int i=pos;i<=n;i+=lowbit(i))
		bit[i]+=add;
}
inline int query(int pos){
	int res=0;
	for(int i=pos;i;i-=lowbit(i))
		res+=bit[i];
	return res;
}
inline int get_sum(int l,int r){
	return query(r)-query(l-1);
}
inline int get_less_pos(int p){
	auto it=lower_bound(less_pos.begin(),less_pos.end(),p);
	if(it==less_pos.begin()) return 0;
	it--;
	return *it;
}
inline int get_greater_pos(int p){
	auto it=upper_bound(less_pos.begin(),less_pos.end(),p);
	if(it==less_pos.end()) return n+1;
	return *it;
}
int get_min_y(int x){
	int y=x,fin=0;
	for(int i=0;i<(int)as.size() && fin<q;i++){
		if(as[i]<x) continue;
		y=max(y,as[i]);
		for(int j=0;j<(int)pos[i].size() && fin<q;j++){
			int cur_pos=pos[i][j];
			int l=get_less_pos(cur_pos)+1,r=get_greater_pos(cur_pos)-1;
			if(r-l+1-get_sum(l,r)>=k){
				fin++;
				modify(cur_pos,1);
			}
		}
	}
	if(fin<q) y=0x7fffffff;
	return y;
}
int main(){
	scanf("%d%d%d",&n,&k,&q);
	for(int i=1;i<=n;i++){
		scanf("%d",a+i);
		as.push_back(a[i]);
	}
	sort(as.begin(),as.end());
	as.erase(unique(as.begin(),as.end()),as.end());
	for(int i=1;i<=n;i++){
		int v=lower_bound(as.begin(),as.end(),a[i])-as.begin();
		pos[v].push_back(i);
	}
	int ans=0x7fffffff;
	for(int i=0;i<(int)as.size();i++){
		int v=as[i];
		less_pos.clear();
		memset(bit,0,sizeof bit);
		for(int j=1;j<=n;j++)
			if(a[j]<v) less_pos.push_back(j);
		ans=min(ans,get_min_y(v)-v);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
import itertools
N, M = map(int, input().split())
ab = []
for i in range(M):
    ab.append(list(map(int, input().split())))
ans = 0
if M >= N - 1:
    for i in list(itertools.combinations(ab, N - 1)):
        g = {}
        for j in range(N):
            g[j + 1] = []
        for j, k in i:
            g[j].append(k)
            g[k].append(j)
        if len(g[1]) == 1:
            p = 1
            q = g[p][0]
            for j in range(N - 2):
                l = g[q]
                if len(l) != 2:
                    break
                l.remove(p)
                p = q
                q = l[0]
            else:
                ans += 1
print(ans)

Measured memory_bytes: 171456
h,w,k=map(int,input().split())
#a(h,x)
p=[-1]*(w+1)
p[0]=1
p[1]=2
def pat(x):
    if x<0 or x>=w:
        return 1
    else:
        if p[x]!=-1:
            return p[x]
        else:
            p[x]=pat(x-2)+pat(x-1)
            return p[x]
        
for j in range(1):
    0
mo=10**9 +7

a=[[0 for i in range(w)] for i in range(h+1)]
a[0]=[1]+[0]*(w-1)
for i in range(1,h+1):
    #a[i][0]=a[i-1][0]*pat(-1)*pat(h-1)+a[i-1][1]*pat(0)*pat(h-2)
    #a[i][w-1]=a[i-1][w-2]*pat(w-3)*pat(h-w+1)+a[i-1][w-1]*pat(w-1-1)*pat(h-w)
    for j in range(0,w):
        if j>0: a[i][j]+=a[i-1][j-1]*pat(j-2)*pat(w-j-2)
        a[i][j]+=a[i-1][j]*pat(j-1)*pat(w-1-j-1)
        if j<w-1: a[i][j]+=a[i-1][j+1]*pat(j-1)*pat(w-j-3)
print(a[h][k-1] % mo)
#print(a)


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

using namespace std;

typedef long long ll;

const int mod = 1e9 + 7;
const int N = 200000;

ll fac[N + 10], inv[N + 10];
ll H, W, A, B;

ll PowMod(ll a,ll b) {
	ll res = 1;
	while(b) {
		if(b & 1) res = res * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return res;
}

void pre() {
	fac[0] = inv[0] = 1;
	for(int i = 1;i <= N; ++i) 
		fac[i] = fac[i - 1] * i % mod;
	inv[N] = PowMod(fac[N], mod - 2);
	for(int i = N - 1;i >= 1; --i)
		inv[i] = inv[i + 1] * (i + 1) % mod;
}

ll C(ll n, ll m) {
	if(n == 0 || m == 0) return 1;
	ll res = 1;
	res = res * fac[n] % mod;
	res = res * inv[n - m] % mod;
	res = res * inv[m] % mod;
	return res;
}

int main() {
	cin >> H >> W >> A >> B;
	pre(); // 2 3 1 1
	ll ans = 0; 
	for(int i = 1;i <= H - A; ++i) 
		ans = (ans + (C(i + B - 2, i - 1) * C(H - i + W - B - 1, H - i) % mod))% mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6756
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;

int main(int argc,char const* argv[])
{
  string s;
  int n;
  string ans="";
  cin >> s;
  cin >> n;
  for(int i=0;i<s.size();i+=n)
    {
      ans+=s[i];
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
(* O(n) *)
let rec fold_btw f a i n = if i >= n then a else fold_btw f (f a i) (i + 1) n
let fold_int f a n = fold_btw f a 0 n

(* O(|s|) *)
let string_to_char_array s = Array.init (String.length s) (fun i -> s.[i])
let string_to_chars s = Array.to_list (string_to_char_array s)

(* O(1) *)
let is_acgt_char = function
| 'A' | 'C' | 'G' | 'T' -> true
| _ -> false

(* O(|s|) *)
let is_acgt_string s = List.for_all is_acgt_char (string_to_chars s)

(* O(|s|^3) *)
let solve s =
  let n = String.length s in
  fold_int
    (fun acc_i i ->
      fold_btw
        (fun acc_j j ->
          let len = j - i in
          if is_acgt_string (String.sub s i len) then
            max acc_j len
          else
            acc_j)
        acc_i
        (i + 1)
        (n + 1))
    0
    n

let _ = read_line () |> solve |> string_of_int |> print_endline

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    string str1=to_string(a);
    string str2=to_string(b);
    str1=str1+str2;
    int NUM=atoi(str1.c_str());
    int j=sqrt(NUM);
    if(j*j!=NUM)cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

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

int main(){
        int sx,sy,tx,ty;
        cin >>sx >> sy >> tx >> ty;
        const int dx = tx-sx,dy = ty - sy;
        cout << string(dy,'U') << string(dx,'R');
        cout << string(dy,'D') << string(dx,'L');

        cout << 'L' << string(dy+1,'U') << string(dx+1,'R') << 'D';
        cout << 'R' << string(dy+1,'D') << string(dx+1,'L') << 'U';
        cout << endl;
        return 0;
}


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

namespace AOJV0
{
    class P0003
    {
        static void Main()
        {
            foreach(var i in Enumerable.Range(0, int.Parse(Console.ReadLine()))
                                       .Select(_ => Console.ReadLine())
                                       .Select(x => x.Split(' '))
                                       .Select(x => x.Select(int.Parse))
                                       .Select(x => x.OrderBy(i => i).ToArray()))
            {
                if(Math.Pow(i[0], 2) + Math.Pow(i[1], 2) == Math.Pow(i[2], 2))
                    Console.WriteLine("YES");
                else
                    Console.WriteLine("NO");
            }
        }
    }
}

Measured memory_bytes: 6412
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    int x,now,beki;
    cin >> x;
    beki = 2;
    int id = 2;
    now = 2;
    int ans = 1;
    while(id < x){
       now = id*id;
       beki = id;
       while(now <= x){
          ans = max(ans,now);
          now *= beki; 
       }
       id++;
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
/*
  
                                _oo0oo_
                               088888880
                               88" . "88
                               (| -_- |)
                                0\ = /0
                             ___/'---'\___
                          .' \\\\|     |// '.
                         / \\\\|||  :  |||// \\
                        /_ ||||| -:- |||||-  \\
                        |   | \\\\\\  -  /// ||
                        | \_|  ''\---/''  |_/ |
                        \  .-\__  '-'  __/-.  /
                      ___'. .'  /--.--\  '. .'___
                   ."" '<  '.___\_<|>_/___.' >'  "".
                  | | : '-  \'.;'\ _ /';.'/ - ' : | |
                  \  \ '_.   \_ __\ /__ _/   .-' /  /
              ====='-.____'.___ \_____/___.-'____.-'=====
                                '=---='

            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             AC  AC  AC  AC  AC  AC  AC  AC  AC  AC  AC  AC
     
*/
#define OJ
#include <bits/stdc++.h>
#define pb push_back
#define _1 first
#define _2 second
#define FOR(i,a,b) for(int i=a;i<(b);i++)
#define FORN(i,b) for(int i=0;i<(b);i++)
#define reset(a,b) memset(a,b,sizeof(a))
#define MAX(a,b)  a>b?a:b
#define MIN(a,b)  a>b?b:a
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int> > vii;

int main()
{
	#ifndef OJ
	freopen("abc.in","r",stdin);
	freopen("abc.out","w",stdout);
	#endif
  int n,a[100],b[100],c[100];
  char d[105];
  scanf("%d%s",&n,d);
  int i,j,k;
  for(i=0;i<n;i++)  
    if(d[i]=='(')  a[i]=0;
    else a[i]=1;
  for(k=1;k<n;k++)
  {
    j=k-1;
    if(a[j]==0&&a[k]==1)
    { 
      for(i=j;i<n-2;i++)
        a[i]=a[i+2];
      n-=2; k-=2;
    }
  }
  for(i=0;a[i]!=0&&i<n;i++)
    printf("(");
  printf("%s",d);
  for(;i<n;i++)
    printf(")");
	#ifndef OJ
	fclose(stdin);
	fclose(stdout);
	#endif
}

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

#define FREP(i,a,b) for(int i=a;i<b;i++)
#define REP(i,n) FREP(i,0,n)
#define PB push_back
#define mod 1000000007
#define endl "\n"
#define ll long long
#define MP make_pair
#define vi vector<ll>
#define si set<ll>
#define mi map<ll, ll>
#define pri(a,n) REP(i,n)cout<<a[i]<<" ";
#define sa(a,n) sort(a,a+n)
#define sra(a,n) sort(a, a + n, greater<ll>())
#define sv(v) sort(v.begin(),v.end())
#define srv(v) sort(v.rbegin(),v.rend())
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll bin(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b % 2 == 0)
		return bin((a * a) % mod , b / 2) % mod;
	return ((a % mod) * (bin((a * a) % mod , b / 2) % mod)) % mod;
}

void g_o_a_l()
{
	ll n, q;
	int a[6]={0};
	FREP(i,1,6)
	a[i]=i;
	FREP(i,1,6)
	cin>>a[i];
	FREP(i,1,6)
	if(a[i]==0)
	{
		cout<<i;
		break;
	}
	
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	FASTIO;

	ll t = 1;
	// cin >> t;
	while (t--)
	{
		g_o_a_l();
	}

}

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

int main(void)
{
  int n, k;
  cin >> n >> k;
  vector<int> data(n);
  for(int i = 0; i < n; i++)
  {
    cin >> data[i];
  }
  int cnt = 0;
  for(int i = 0; i < n; i++)
  {
    if(data[i] >= k)
      cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
using namespace std;

#define ll long long int
#define ld long long double
#define reps(i,f,n) for(int i=f;i<n;i++)
#define rep(i,n) reps(i,0,n)
#define m1 cout<<"move1"<<endl
#define m2 cout<<"move2"<<endl
#define m3 cout<<"move3"<<endl
#define m4 cout<<"move4"<<endl


#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
using namespace std;

#define ll long long int
#define ld long long double
#define reps(i,f,n) for(int i=f;i<n;i++)
#define rep(i,n) reps(i,0,n)
#define m1 cout<<"move1"<<endl
#define m2 cout<<"move2"<<endl
#define m3 cout<<"move3"<<endl
#define m4 cout<<"move4"<<endl

int main(){
  int flag = 1;
  int a,b,c;
  int t=0;
  int c_ans;
  int counter =0;

  cin>>a>>b>>c;
  c_ans = c;

  while(1){
    counter++;
    if(counter >= 100000)
      {
	cout<<-1<<endl;
	break;
      }
    if( c+60*t - a <= 0 && flag == 1){
      //m1;
      cout<< c_ans + 60*t<<endl;
      break;
    }
    //else if(c + 60 * t - a <=0 && flag == 1){
    //t++;
    //flag = 0;
    //}
    else if(c + 60 * t - a >= 0 && flag == 1){
      //m2;
      c-=a;
      flag = 0;
    }
    else if(c + 60 * t - b == 0 && flag == 0){
      //m3;
      cout<<c_ans + 60 * t <<endl;
      break;
    }
    else if(c + 60 * t - b < 0 && flag == 0){
      if( 60 % ( a + b ) == 0){
	cout<<-1<<endl;
	break;
      }
      else{
	t++;
      flag = 1;
      c-=b;
      // m4;
      }
    }
    else {
      c -= b;
      flag = 1;
    }
  }

  return 0;
}




      
      
      
      

Measured memory_bytes: 3112
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;

int main()
{
	string s;

	cin >> s;

	if (s == "SUN")
		cout << "7";
	if (s == "MON")
		cout << "6";
	if (s == "TUE")
		cout << "5";
	if (s == "WED")
		cout << "4";
	if (s == "THU")
		cout << "3";
	if (s == "FRI")
		cout << "2";
	if (s == "SAT")
		cout << "1";

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,j,num,n=0,N,minj,flag,A[100];

  scanf("%d",&N);
  for(i = 0; i < N;i++) scanf("%d",&A[i]);

  for(i = 0 ; i < N-1;i++){
    flag =0;
    minj = i;
    for(j = i; j < N; j++){
      if(A[j] < A[minj]){
	minj = j;
	flag =1;
      }
    }
    num = A[minj];
    A[minj] = A[i];
    A[i] = num;
    if(flag == 1)n++;
      
  }
   for(i = 0; i < N-1; i++)   printf("%d ",A[i]);
    printf("%d",A[N-1]);
  printf("\n%d\n",n);

}



Measured memory_bytes: 2084
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    d, t, s =MI()
    num = d/s
    if num <= t:
        print("Yes")
    else:
        print("No")
if __name__ == "__main__":
    main()

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

int main()
{
  ll n,i,j;
  string a,b="s",c="es";
  cin>>a;
  n=a.size();
  if(a[n-1]=='s')
  {
    a=a+c;}
  else
    a=a+b;
  cout<<a<<endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

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

int main() {
    int n;
    cin >> n;
    int a[2*n];
    for (int i = 0; i < 2*n; i++) {
        cin >> a[i];
    }
    sort(a, a+2*n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += a[2*i];
    }
    cout << ans << endl;
    return 0;
}

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

#define N 1000000

int main(void){
	vector<bool> isprime(N+1);
	for(int i=0;i<isprime.size();i++) isprime[i]=true;
	int upto = (int)sqrt(isprime.size());
	isprime[1]=false;
	for(int i=2;i<=upto;++i){
		if(isprime[i]){//消されてなければその倍数を消す
			for(int j=2;i*j<isprime.size();++j) isprime[i*j] = false;
		}
	}
	int n;
	while(cin>>n,n){
		int c=0;
		for(int i=2;i<=n/2;++i){
			if(isprime[i]&&isprime[n-i])++c;
		}
		cout<<c<<endl;
	}
	return 0;
}

Measured memory_bytes: 1316
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

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

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

	for (int i = 0; i < 3; i++) {
		if (n[i] == '7') {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3624
solve xs
  | xs /= xs' = "No"
  | ys /= reverse ys = "No"
  | zs /= reverse zs = "No"
  | otherwise = "Yes"
    where
      l = length xs
      a = (l - 1) `div` 2
      b = (l + 3) `div` 2
      xs' = reverse xs
      ys = take a xs
      zs = drop (b-1) xs

main = do
  xs <- getLine
  putStrLn $ solve xs


Measured memory_bytes: 508
package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
	"fmt"
)

// 文字列を1行取得
func strStdin() (stringInput string) {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	stringInput = scanner.Text()
	stringInput = strings.TrimSpace(stringInput)
	return
}

// 空白や空文字だけの値を除去したSplit()
func splitWithoutEmpty(stringTargeted string, delim string) (stringReturned []string) {
	stringSplited := strings.Split(stringTargeted, delim)

	for _, str := range stringSplited {
		if str != "" {
			stringReturned = append(stringReturned, str)
		}
	}
	return
}

// デリミタで分割して文字列スライスを取得
func splitStrStdin(delim string) (stringReturned []string) {
	// 文字列で1行取得
	stringInput := strStdin()

	// 空白で分割
	stringReturned = splitWithoutEmpty(stringInput, delim)

	return
}

// デリミタで分割して整数値スライスを取得
func splitIntStdin(delim string) (intSlices []int, err error) {
	// 文字列スライスを取得
	stringSplitted := splitStrStdin(" ")

	// 整数スライスに保存
	for i := range stringSplitted {
		var iparam int
		iparam, err = strconv.Atoi(stringSplitted[i])
		if err != nil {
			return
		}
		intSlices = append(intSlices, iparam)
	}
	return
}

func main() {
	num, _ := splitIntStdin(" ")

	if num[0] == num[1] {
		fmt.Println(num[2])
	} else if num[0] == num[2] {
		fmt.Println(num[1])
	} else {
		fmt.Println(num[0])
	}
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define bug(x) cout<<#x<<" : "<<x<<endl
#define de puts("#")
using namespace std;


int main(){
	int k,n;
	scanf("%d %d",&k,&n);
	for(int i=n-k+1;i<=n+k-1;i++)printf("%d ",i);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

const int maxn=100000;

int main(){
    
    ll a,b;
    ll c=0;
    vector<ll> rest;
    ll pow[41]={0};
    ll ans=0;
    
    cin >>a>>b;
    pow[0]=1;
    
    for(int i=0;i<40;i++){
        pow[i+1]=pow[i]*2;
    }
    
    if(a==b){
        cout << a<<endl;
        return 0;
    }
    
    if(a%2==0){
        a++;
        c++;
    }else{
        rest.push_back(a);
    }
    if(b%2==0){
        rest.push_back(b);
        b--;
    }
    
    if(a<=b)c+=(b-a)/2;
    if(c%2==1)rest.push_back(1);
    
    for(int i=40;i>=0;i--){
        int cnt=0;
        rep(j,rest.size()){
            if(rest[j]>=pow[i]){
                rest[j]-=pow[i];
                cnt++;
            }
        }
        if(cnt%2==1)ans+=pow[i];
    }
    
    cout << ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n, total = 1;
    scanf("%d", &n);
    vector<int> a(n);
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    sort(a.begin(), a.end());
    for(int i = n - 2; i >= 0; i--)
    {
        total += a[i + 1] != a[i];
    }
    printf("%d\n", total);
}

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

int main()
{
 int a, b, k;
  cin >> a >> b >> k;
  int gcd, r=1;
  if (a<b) swap(a,b);
  while (r!=0) {
    r = a%b;
    a = b;
    b = r;
  }
  gcd = a;
  int count = 0, i = 0;
  while (count < k){
    i ++;
    if (gcd % i == 0){
      count ++;
    }
  }
  int output = gcd/i;
  cout << output << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int f[100010];
int a[100010];
map <ll, ll> t;
int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++ i)
	{
		scanf("%d", &a[i]);
		a[i] %= m;
	}
	for(int i = 1; i <= n; ++ i)
		f[i] = (f[i - 1] + a[i]) % m;
	ll ans = 0;
	for(int i = 0; i <= n; ++ i)
	{
		ans += t[f[i]];
		++ t[f[i]];
	}
	printf("%lld", ans);
	return 0;
}

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

int main()
{
int t;cin>>t;
int cost[t];
for(int i=0;i<t;i++)
{
cin>>cost[i];
}

int dp[t];
dp[0]=0;
dp[1]=abs(cost[1]-cost[0]);

for(int i=2;i<t;i++)
{
dp[i]=min(abs(cost[i]-cost[i-1])+dp[i-1],abs(cost[i]-cost[i-2])+dp[i-2]);
}

int ans= dp[t-1];
cout<<ans;
return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int m=t.size();

    bool flag=false;
    for(int i=n-m;i>=0;i--){
        string r=s.substr(i,m);
        bool ok=true;
        rep(j,m){
            if(r[j]==t[j] || r[j]=='?') continue;
            ok=false;
        }
        if(ok){
            rep(j,m){
                if(s[i+j]=='?') s[i+j]=t[j];
            }
            flag=true;
            break;
        }
    }
    
    rep(i,n){
        if(s[i]=='?') s[i]='a';
    }
    if(flag) cout<<s<<endl;
    else cout<<"UNRESTORABLE"<<endl;
}

Measured memory_bytes: 384
#include <cstdio>

int n,k[101]={0},mem[101][4][4]={0},kd,ks,kn;

int check(int m,int d1,int d2){
    if(m>n) return 1;
    if(mem[m][d1][d2]) return mem[m][d1][d2];
    
    if(d1==d2 && d1==k[m] && d1) return 0;
    
    if(k[m])
        mem[m][d1][d2] = check(m+1,d2,k[m])%10000;
    else
        for(int i=1;i<=3;i++)
            if(d1!=d2 || d1!=i)
                mem[m][d1][d2] += check(m+1,d2,i)%10000;
    
    return mem[m][d1][d2];
}

int main(){
    scanf("%d%d",&n,&kn);
    
    for(int i=0;i<kn;i++){
        scanf("%d%d",&kd,&ks);
        k[kd]=ks;
    }
    
    printf("%d\n",check(1,0,0)%10000);
    
}

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

int next(char a) { return a - 'a'; }

int main() {
  vector<string> cs(3);
  for(int i = 0; i < 3; ++i) {
    cin >> cs[i];
  }
  vector<int> idx(3, 0);

  int ni = 0;
  while(true) {
    auto cards = cs[ni];
    auto i = idx[ni];
    if(i < cards.size()) {
      idx[ni]++;
      ni = next(cards[i]);
    } else {
      break;
    }
  }
  cout << char(ni + 'A') << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;

//Union-Findライブラリ.1は後で修正すること.
class UF{
public:
    int par[1];
    int ran[1];

    void init(int n){
        for(int i = 0;i < n;i++){
            par[i] = i;
            ran[i] = 0;
        }
    }

    int find(int x){
        if(par[x] == x)return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x,int y){
        x = find(x);
        y = find(y);

        if(ran[x] < ran[y])par[x] = y;
        else{
            par[y] = x;
            if(ran[x] == ran[y])ran[x]++;
        }
    }

    bool same(int x,int y){
        return find(x) == find(y);
    }
};
int main(){
    int n;
    cin >> n;
    map<int,bool> mp;
    for(int i = 0;i < n;i++){
        int a;
        cin >> a;
        if(mp[a]){
            cout << "NO" << endl;
            return 0;
        }
        mp[a] = true;
    }

    cout << "YES" << endl;
}


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

int main(){
  int i,n,q,sum=0,x,tin;
  string s,sin;
  queue<string> Name;
  queue<int> Time;

  cin >> n >> q;

  for(i=0;i<n;i++){
    cin >> sin >> tin;
    Name.push(sin);
    Time.push(tin);
  }
  while(Name.empty()==0){
    s=Name.front();
    x=Time.front();
    if(x<=q){
      sum+=x;
      cout << s << " " << sum <<endl;
    }
    else{
      sum+=q;
      x-=q;
      Name.push(s);
      Time.push(x);
    }
    Name.pop();
    Time.pop();
  }
  return 0;
}


Measured memory_bytes: 6144
/**Bismillahir Rahmanir Rahim.**/
#include<bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<cstring>
#include<cstdio>
using namespace std;
typedef long long int            ll;
typedef long double              ld;
#define Faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi                 acos(-1);
#define test        int t; cin>>t; while(t--)
//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());
//cin.getline(array,size);
int main()
{
    ll n,i,j,ans=0;
    cin>>n;
    ll a[n+1];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=0;i<n-1;i++)
    {
        if(a[i]>a[i+1])
        {
            ans+=(a[i]-a[i+1]);
            a[i+1]+=(a[i]-a[i+1]);
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 5180
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(b<a) { a=b; return 1; } return 0; }

int main(){
  int n; cin >> n;
  vector<vi> v(n,vi(26));
  rep(i,n){
    string s; cin >> s;
    rep(j,s.size()) v[i][s[j]-'a']++;
  }
  string ans = "", txt = "abcdefghijklmnopqrstuvwxyz";
  rep(i,26){
    int mn = INF;
    rep(j,n) chmin(mn,v[j][i]);
    rep(j,mn) ans += txt[i];
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for (int i=0; i < n; ++i)
#define rep2(i, x, n) for (int i = x; i < n; ++i)

int main()
{
    int a, b;
    cin >> a >> b;
    cout << max(0,a-2*b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a[3],t,i,j,k,max,m;
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
        for(j=0;j<3;j++)
        {
            scanf("%d",&a[j]);
        }
        if(a[0]>a[1]&&a[0]>a[2])
            max=a[0];
        else if(a[1]>a[2]&&a[1]>a[0])
        {
            k=a[0];
            a[0]=a[1];
            a[1]=k;
        }
        if(a[2]>a[0]&&a[2]>a[1])
        {
            k=a[2];
            a[2]=a[0];
            a[0]=k;
        }
        if(a[0]*a[0]==(a[1]*a[1])+(a[2]*a[2]))
            printf("YES\n");
        else
            printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 580
#ifdef _MSC_VER
#  define _CRT_SECURE_NO_WARNINGS
#  define _USE_MATH_DEFINES
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double;
using u32 = unsigned int; using u64 = unsigned long long int; using str = string;
template <typename T> using vec = vector<T>; void in() { }
template <typename T, typename...TS> void in(T &&x, TS &&...xs) { cin >> x; in(move(xs)...); }
template <typename T> void out(T &&x) { cout << x << "\n"; }
template <typename T, typename...TS> void out(T &&x, TS &&...xs) { cout << x << " "; out(move(xs)...); }
#define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__)
#define get(t) []{ t x; cin >> x; return x; }()
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(a, b, i) for (i32 i = (a); i < (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define even(x) ((abs(x) & 1) == 0)
#define odd(x) ((abs(x) & 1) == 1)
#define bit(x, i) (((x) >> i) & 1)
#define append emplace_back
#define bisect_left lower_bound
#define bisect_right upper_bound
#define bound(a, x, b) (a <= x && x <= b)
const i64 MOD = 1000000007ll;
const f64 EPS = 1e-10;

void solve() {
    indef(i64, k);

    downto(50, 2, n) {
        multiset<i64> s;

        i64 x = k/n+n;
        times(n, i) {
            s.insert(x);
        }
        i64 of = 0;
        times(n-(k%n), _) {
            i64 a = *(--s.end());
            s.erase(--s.end());
            s.insert(a-n-1);
            of++;
        }

        bool valid = true;
        for (auto a : s) {
            if (a+of < 0) {
                valid = false;
                break;
            }
        }
        if (!valid) continue;

        out(n);
        auto it = s.begin();
        while (it != --s.end()) {
            cout << (*it) + of << " ";
            it++;
        }
        cout << (*--s.end()) + of << endl;
        break;
    }
}

i32 main()
{
    ios::sync_with_stdio(false);

#ifdef _MSC_VER
    /**
    ifstream fin("input.txt"); cin.rdbuf(fin.rdbuf()); assert(fin);
    ofstream fout("output.txt"); cout.rdbuf(fout.rdbuf()); assert(fout);
    /**/
#endif

    //cout << fixed << setprecision(9);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n,i,j,a[1002],ans,k,b[1002],l,x,q;
    map<ll,ll>s;
    cin>>n;
    j=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        s[a[i]]++;
        k=a[i];
        if(s[k]==1)
            b[j++]=k;

    }
    sort(b,b+j);
    ans=0;
    for(i=0;i<j-2;i++)
    {
        for(l=i+1;l<j-1;l++)
        {
            x=b[i]+b[l];
            for(q=l+1;q<j;q++)
            {
               if(x>b[q])
                ans+=s[b[i]]*s[b[l]]*s[b[q]];
            }
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 3584
def main():
    mod = 1000000007
    S = input()
    n = len(S)

    # dp[i][j] 左からi文字目までの数で, 余りがjになるものの総数
    dp = [[0] * 13 for i in range(n)]

    s = S[0]
    if s == "?":
        for i in range(10):
            dp[0][i] = 1
    else:
        dp[0][int(s)] = 1

    for i in range(1,n):
        s = S[i]
        if s == "?":
            for rem in range(10):
                for pre in range(13):
                    dp[i][(10*pre + rem) % 13] += dp[i-1][pre]
                    dp[i][(10*pre + rem) % 13] %= mod

        else:
            rem = int(s)
            for pre in range(13):
                    dp[i][(10*pre + rem) % 13] += dp[i-1][pre]
                    dp[i][(10*pre + rem) % 13] %= mod

    res = dp[n-1][5]
    print(res)


if __name__ == "__main__":
    main()

Measured memory_bytes: 95628
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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

const int INF = 1e9;
const long long LINF = 1e18;

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

    cout << 3 * r * r << endl;

    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<deque>
#include<bitset>
#include<cmath>
#include<map>
#include<iomanip>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a; i < b; i++)

int main() {

	ll x;
	cin >> x;

	ll y = 100, cnt = 0;

	while (y < x) {
		y = y + y / 100;
		cnt++;
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3576
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

L = str(input())
n = len(L)
dp = [[0,0] for i in range(n+1)]
dp[0][0] = 1
for i in range(n):
    if L[i] == "0": #a+b = 0
        dp[i+1][0] = dp[i][0]
        dp[i+1][1] = (dp[i][1] + dp[i][1]*2) % mod
    else:
        dp[i+1][0] = dp[i][0] * 2 % mod
        dp[i+1][1] = (dp[i][0] + dp[i][1] + dp[i][1]*2) % mod


print(sum(dp[n]) % mod)


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

int main(void) {
int n, m, x, i;
int y, z;
int cost1 = 0;
int cost2 = 0;
array<int, 102>a = {0};

std::cin >> n >> m >> x;
y = x;
z = x;

for (i = 0; i < m; i++) {
  std::cin >> a[i];
  }

while (y != 0) {
  for (i = 0; i < m; i++) {
    if (y == a[i]) {
      cost1++;
    }
  }
    y--;
}

while (z != n) {
  for (i = 0; i < m; i++) {
    if (z == a[i]) {
      cost2++;
    }
  }
    z++;
}

if (cost1 <= cost2) {
  std::cout << cost1 << '\n';
} else {
  std::cout << cost2 << '\n';
}
  return 0;
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
 	while (x->left != NIL) 
 	x = x->left;
  return x;
}

Node treeSearch(Node u, int k){
   /*if(u == NIL || k != u->key){
    return u;
   }
  if(k < u->key){
    return treeSearch(u->left, k);
   }
  else{
    return treeSearch(u->right, k);
   }*/
     if(u==NIL || k==u->key)return u;
  if(k<u->key)return treeSearch(u->left,k);
  else return treeSearch(u->right,k);
  
  }

Node treeSuccessor(Node x){
	
  Node y;
  if (x->right != NIL) 
  return treeMinimum(x->right);
 
  y = x->parent;
 
  while (y != NIL && x == y->right) {
    x = y;
    y = y->parent;
  }
 
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y  
  if (z->left == NIL || z->right == NIL) y = z;
  else {
  	y = treeSuccessor(z);
 }
 
  if (y->left != NIL) x = y->left;
  else {
  	x = y->right;
 }
  if (x != NIL) x->parent = y->parent;
 
  if (y->parent == NIL) root = x;
  else if (y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;
 
  if (y != z) z->key = y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
    while (x != NIL) {
    y = x;
    if (z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if (y == NIL) 	root = z;
  else if (z->key < y->key) y->left = z;
  else y->right = z;
}

void inorder(Node u){
  if (u != NIL) {
  inorder(u -> left);
  printf(" %d",  u->key);
  inorder(u -> right);
  }
  }
void preorder(Node u){
  if (u != NIL) {
  printf(" %d", u->key);
  preorder(u -> left);
  preorder(u -> right);
  }
  }


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

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


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

//#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

#define mod 1000000007

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}



int main(){
	string s;
	cin >> s;
	if (s == "AAA" || s == "BBB")print("No");
	else print("Yes");
}

Measured memory_bytes: 256
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"2017/12/01"# => "2018/12/01",
r#"9 45000"# => "0 9 0",
r#"2000 20000000"# => "2000 0 0",
// r#"24"# => "No",
//
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        n: i64,
        d: i64,
    }

    let mut ans = "-1 -1 -1".to_string();
    'f: for x in 0..n+1 {
        for y in 0..n-x+1 {
            let z = n - x - y;
            if x + y + z == n && x * 10000 + y * 5000 + z * 1000 == d {
                ans = format!("{} {} {}", x, y, z);
                break 'f;
            }
        }
    }

    ans.to_string()
}

Measured memory_bytes: 4352
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = STR()
ans = ''
for i in s:
    if i == '0':
        ans += '0'
    elif i == '1':
        ans += '1'
    elif len(ans) > 0:
        ans = ans[:-1]
print(ans)

Measured memory_bytes: 5144