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

using namespace std;

int main() {
  int k;
  string s;
  cin >> k >> s;
  int n = s.size();
  if (n > k) {
    for (int i = 0; i < k; ++i) {
      cout << s[i];
    }
    cout << "...\n";
  } else {
    cout << s << '\n';
  }
  return 0;
}



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

using namespace std;

const int N = 4e5 + 5;

char s[N];
int cnt[N];
int main() {
  int n;
  scanf("%d %s", &n, s);
  int cur = 0;
  for (int i = 0; i < n; ++i) {
    cnt[i] = cur;
    cur += s[i] == 'W';
  }
  int ans = cur;
  cur = 0;
  for (int i = n-1; i >= 0; --i) {
    ans = min(ans, cnt[i] + cur);
    cur += s[i] == 'E';
  }
  ans = min(ans, cur);
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 1664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        string s = sc.Next();

        int[] sumW = new int[n];
        int[] sumE = new int[n];

        int tmpSumW = 0;
        int tmpSumE = 0;
        for (int i = 0; i < n; i++)
        {
            if (s[i] == 'W')
            {
                tmpSumW++;
            } else
            {
                tmpSumE++;
            }
            sumW[i] = tmpSumW;
            sumE[i] = tmpSumE;
        }

        int answer = int.MaxValue;
        for (int i = 0; i < n; i++)
        {
            int leftAnswer = 0;
            if (i > 0)
            {
                leftAnswer = sumW[i - 1];
            }

            int rightAnswer = sumE[n - 1] - sumE[i];

            answer = Math.Min(answer, leftAnswer + rightAnswer);
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 15072
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <time.h>
#include <iomanip>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define double long double
#define int long long
#define low lower_bound
#define upp upper_bound
#define mod (int)1e9+7
#define inf (int)1e16
#define rep(i,n) for (int i = 0; i < n; i++)
#define Rep(i,n) for (int i = n; i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define cend cout<<endl;
#define P pair<int, int>
#define prique priority_queue<P, vector<P>, greater<P>>
struct edge { int to, cost; };
using namespace std;
bool  can(int n, int m) {
	if (12 >= m && m > 0) return true;
	return false;
}
signed main() {
	string s;
	cin >> s;
	int n = stoi(s.substr(0, 2)), m = stoi(s.substr(2, 2));
	if (can(n, m) && can(m, n)) cout << "AMBIGUOUS" << endl;
	else if (can(n, m)) cout << "YYMM" << endl;
	else if (can(m, n)) cout << "MMYY" << endl;
	else cout << "NA" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e,n;
  string s,ss,sss;
  cin>>n>>s;
  ll ans=0;
  for(int i=0;i<=n-3;i++){
    bool fl=true;
    for(int j=i;j<i+3;j++){
      if(s[j]!=(j-i+'A'))fl=false;
    }
    ans+=fl;
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main{
	static boolean[][] graph=new boolean[101][101];
	static state[] step;
	static Queue <state> q;
	static int n;
	static class state{
		int x, minstep;
		state(int x){
			this.x=x;
			this.minstep=0;
		}
	}
	
	static void bfs() {
		while(! q.isEmpty()) {
			state p=q.remove();
			int x=p.x;
			for(int i=2; i<=n; i++) {
				if(graph[x][i] && step[i].minstep==0) {
					step[i].minstep=p.minstep+1;
					q.add(step[i]);
				}
			}
		}
	}
	
	public  static void main(String[] args) {
    	try (Scanner sc = new Scanner(System.in)) {
    		n=sc.nextInt();
    		step= new state[n+1];
    		for(int i=0; i<n; i++) {
    			int u=sc.nextInt();
    			int k=sc.nextInt();
    			for(int j=0; j<k; j++) {
    				int num=sc.nextInt();
    				graph[u][num]=true;
    			}
    		}
    		q = new LinkedList<>();
    		for(int x=1; x<=n; x++) {
    			step[x]=new state(x);
    		}
    		step[1].minstep=0;
    		q.add(step[1]);
    		bfs();
    		for(int i=0; i<n; i++) {
    			if(i+1!=1 && step[i+1].minstep==0) {
    				System.out.println(i+1+" "+"-1");
    			}
    			else
    			System.out.println(i+1+" "+step[i+1].minstep);
    		}
    	}
    }
}


Measured memory_bytes: 28708
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
}init;

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

    vector<LLI> ans(n);

    vector<pair<int,LLI>> b;
    int m = 0;
    REP(i,n){
      if(a[i] > m){
        b.push_back({a[i],i});
        m = a[i];
      }
    }

    reverse(ALL(b));

    dump(b);

    sort(RALL(a));

    b.push_back({0,-1});

    LLI s = 0;
    LLI c = 0;
    LLI t = 0;

    REP(i,(int)b.size()-1){
      while(c < n and a[c] >= b[i+1].fst){
        s += a[c];
        ++c;
      }
      
      dump(s);

      ans[b[i].snd] = s - b[i+1].fst*c - t;
      t += s - b[i+1].fst*c - t;
    }
    
    join(cout, ALL(ans), "\n");
  }

  return 0;
}


Measured memory_bytes: 3952
#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
int bils[3]={10000,5000,1000};
int main()
{
    int n,k;
    cin>>n>>k;
    int yes=0;
    for (int i=0;i<=n;i++)
    {
        for (int j=0;j<=n-i;j++)
        {
            if (10000*i+5000*j+1000*(n-i-j)==k)
            {
                printf ("%d %d %d\n",i,j,(n-i-j));
                yes=1;
                break;
            }
        }
        if (yes==1)break;
    }
    if (yes==0)printf ("-1 -1 -1\n");
}

Measured memory_bytes: 256
n=int(input())
P=[int(x) for x in input().split()]
count=0
for i in range(n-2):
  p1=P[i]
  p2=P[i+1]
  p3=P[i+2]
  if p2>p1 and p2<p3:
    count+=1
    
  if p2>p3 and p2<p1:
    count+=1
print(count)    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0; i < n; i++)
#define reps(i, n) for(ll i=1; i <= n; i++)
#define INF 1e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;
using P=pair<int,int>;
using Pl=pair<ll,ll>;

//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main() {
  int a,b,t;cin >> a >> b >> t;
  cout << b*(t/a);
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include<cmath>
#include<cctype>
#include<cstdio>
#include <algorithm>
#include <string.h>
#include<math.h>
#include<map>
#include<bits/stdc++.h>
#include<unordered_map>
#define Maxn 100005
#define ll long long
using namespace std;

char s[15];
int main(){
	ll n;
	int m=0;

	scanf("%lld",&n);
	while(n){
        s[m++]=(n-1)%26+'a';
        n--;
        n/=26;
	}
	for(int i=m-1;i>=0;i--)
        putchar(s[i]);
    printf("\n");
	return 0;
}


Measured memory_bytes: 3736
from copy import deepcopy
s = list(input())    
N = len(s)
count= 0
counter = []
ans = []
real = deepcopy(s)
syurui = set(s)
for j in syurui:
    while True:
        #終了条件
        if N == s.count(j):
            counter.append(count)
            count = 0
            s = deepcopy(real)
            N = len(s)
            break

        for i in range(N-1):
            if s[i]==j or s[i+1]==j:
                ans.append(j)
            else:
                ans.append(s[i])
        #値の更新
        N = len(ans)
        s = deepcopy(ans)
        count += 1

        #変数のリセット
        ans = []
print(min(counter))


Measured memory_bytes: 44520
{-# OPTIONS_GHC -Wall #-}

import Control.Monad
import Data.Array

readInt :: String -> Int
readInt = read

inf :: Int
inf = 1010000000000000000

calcDp :: Int -> Array Int Int -> Array Int Int -> Array (Int,Int) Int
calcDp n vs ws = dp
    where
        -- i種類目までで価値jを実現する最小重量
        dp = listArray ((0,0),(n,10000)) [f i j | i<-[0..n], j<-[0..10000]]
        f _ 0 = 0
        f 0 _ = inf
        f i j
            | j >= v    = min (w+dp!(i-1,j-v)) (dp!(i-1,j))
            | otherwise = dp!(i-1,j)
            where
                v = vs!(i-1)
                w = ws!(i-1)

main :: IO ()
main = do
    [n,wmax] <- fmap (map readInt . words) getLine
    vws      <- replicateM n $ do
        [v,w] <- fmap (map readInt . words) getLine
        return (v,w)
    let vs = listArray (0,n-1) $ map fst vws
    let ws = listArray (0,n-1) $ map snd vws

    let dp  = calcDp n vs ws
    let ans = maximum $ filter (\j -> dp!(n,j) <= wmax) [0..10000]

    --print dp
    print ans



Measured memory_bytes: 140028
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <fstream>

#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

class AMultipleArray {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n;
        in>>n;
        vector<ll> a(n);
        vector<ll> b(n);
        rep(i,n) in>>a[i]>>b[i];
        ll cnt=0,ad=0;
        reverse(all(a));
        reverse(all(b));

        rep(i,n){
            a[i]+=cnt;
            if(a[i]%b[i]!=0){
                cnt+=(a[i]/b[i]*b[i]+b[i])-a[i];
            }
        }

        out<<cnt<<endl;



	}
};


int main() {
	AMultipleArray solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1792
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = np.array([0] + lr())
for i in range(N//2, 0, -1):
    a = A[i]
    result = A[i::i].sum()
    if result % 2 != a:
        A[i] = 1 - a

B = np.where(A == 1)[0]
print(len(B))
print(*B)


Measured memory_bytes: 21864
#include <stdio.h>
int main()
{
   int n,m,b[1000],a[1000];
   int sum[1000]={0};
   scanf("%d %d",&n,&m);
   for(int i=0;i<=n-1;i++){
     scanf("%d",&a[i]);
   }
   for(int j=0;j<=m-1;j++){
     scanf("%d",&b[j]);
   }
   for(int j=0;j<=m-1;j++){
     for(int i=0;i<=n-1;i++){
        if(b[j]>=a[i]) {sum[i]=sum[i]+1;break;}
     }
   }
   int max=-1;
   for(int k=0;k<=n-1;k++){
      if(sum[k]>=max) max=sum[k];
   }
   for(int i=0;i<=n-1;i++){
     if(sum[i]==max) printf("%d\n",i+1);
   }
   return 0;
}

Measured memory_bytes: 1036
#include <iostream>
#include <iomanip>

using namespace std;

int main(){
	unsigned long N, Times[5], score = 0xffffffffffffffff;
	cin >> N;
	for(int i = 0; i < 5; i++){		
		cin >> Times[i];
		if(score > Times[i])
			score = Times[i];
	}
	double res = 0;
	res += (N / score) + 4;
	if(N % score != 0)
		res += 1;
	cout << setprecision(16) << res << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int rate=0;
    scanf("%d",&rate);
    if(rate<1200){
        puts("ABC");
        return 0;
    }
    if(rate<2800 ){
        puts("ARC");
        return 0;
    }
    if(rate>=2800)
    puts("AGC");
    return 0;
    
}


Measured memory_bytes: 128
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

def lcm(a,b):
    return (a/gcd(a,b))*b
    
A = map(int,raw_input('').split())
a = int(A[0])
b = int(A[1])
c = int(A[2])
d = int(A[3])
l = lcm(c,d)
ans = (b-a+1) - ((b/c) - (a-1)/c) - ((b/d) - (a-1)/d) + ((b/l) - (a-1)/l)
print(ans)

Measured memory_bytes: 2692
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        System.out.println(problem068a(n));
    }

    private static String problem068a(int n) {
        String title = "ABC";
        return String.format("%s%03d", title, n);
    }
}

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

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;
}

int main(){
    int a, b; cin >> a >> b;
    cout << a * b << endl;
}

Measured memory_bytes: 3624
from itertools import product

n = int(input())

if n < 357:
    print(0)
    exit()

ans = 0
for i in range(3, len(str(n))):
    ans += 3**i - 3*(2**i) + 3

for i in product(['3', '5', '7'], repeat=len(str(n))):
    if '3' in i and '5' in i and '7' in i:
        if int(''.join(i)) <= n:
            ans += 1

print(ans)

Measured memory_bytes: 9140
import java.util.*;

public class    Main {
			
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);			
		long n=input.nextLong();		
		long s=f(n);
		System.out.println(s);
	}

	private static long f(long n) {
		if(n==0)
			return 2;
		return (f(n-1)*2)+2;
		
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int N,L;
    scanf("%d%d",&N,&L);
    char S[105][105]={"\0"};
    char s[105]={"\0"};
    int num[105][105]={{0}};
   // int Num[105]={0};
    for(int i=0;i<N;i++)
       {
           scanf("%s",S[i]);
           for(int j=0;j<L;j++)
            num[i][j]=(int)S[i][j];
       }
    for(int i=0;i<N;i++)
    {
        int k=0;
        for(int j=i+1;j<N;j++)
        {
            while(S[i][k]==S[j][k])
            {
                k++;
            }
            if((int)S[i][k]>(int)S[j][k])
            {
                strcpy(s,S[j]);
                strcpy(S[j],S[i]);
                strcpy(S[i],s);
            }

            k = 0;
        }
    }
    for(int i=0;i<N;i++)
        printf("%s",S[i]);
       return 0;
}


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

using namespace std;

#define ll long long
#define ld long double
#define pll pair <ll , ll>

#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair

#define X first
#define Y second

#define LB(x) ((x) & -(x))
#define BIT(a , b) (((a)>>(b)) & 1)

const ll MAXN=1e5+10;

ll a[MAXN];

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

	ll n , e=0 , res=0;
	cin>>n;

	for(ll i=1;i<=n;i++)
    {
        cin>>a[i];

        if (a[i]==a[i-1])
        {
            e++;
        }
        else
        {
            res+=e/2;
            e=1;
        }
    }

    res+=(e/2);

    cout<<res;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>

int main(){
  int n, num;
  
  while(scanf("%d", &n)!=EOF){
    num = 0;
    for(int i=0; i<10; i++){
      for(int j=0; j<10; j++){
        for(int k=0; k<10; k++){
          for(int l=0; l<10; l++){
            if(i+j+k+l==n) num++;
          }
        }
      }
    }
    std::cout << num << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 3128
import * as fs from 'fs';

//in
// 60 88 34
// 92 41 43
// 65 73 48
// 10
// 60
// 43
// 88
// 11
// 48
// 73
// 65
// 41
// 92
// 34
//out
// Yes
const main = (inp: string) => {
    let inpList: string[] = inp.split('\n');

    let a1: number[] = inpList[0].split(' ').map(Number);
    let a2: number[] = inpList[1].split(' ').map(Number);
    let a3: number[] = inpList[2].split(' ').map(Number);

    inpList.shift();
    inpList.shift();
    inpList.shift();

    const n: number = parseInt(inpList[0]);

    inpList.shift();

    for (let i: number = 0; i < n; i++) {
        if (a1[0] === parseInt(inpList[i])) {
            a1[0] = 0;
        }
        if (a1[1] === parseInt(inpList[i])) {
            a1[1] = 0;
        }
        if (a1[2] === parseInt(inpList[i])) {
            a1[2] = 0;
        }
        if (a2[0] === parseInt(inpList[i])) {
            a2[0] = 0;
        }
        if (a2[1] === parseInt(inpList[i])) {
            a2[1] = 0;
        }
        if (a2[2] === parseInt(inpList[i])) {
            a2[2] = 0;
        }
        if (a3[0] === parseInt(inpList[i])) {
            a3[0] = 0;
        }
        if (a3[1] === parseInt(inpList[i])) {
            a3[1] = 0;
        }
        if (a3[2] === parseInt(inpList[i])) {
            a3[2] = 0;
        }
    }

    if (a1[0]===0 && a1[1]===0 && a1[2]===0) {
        console.log('Yes');
        return;
    }
    if (a2[0]===0 && a2[1]===0 && a2[2]===0) {
        console.log('Yes');
        return;
    }
    if (a3[0]===0 && a3[1]===0 && a3[2]===0) {
        console.log('Yes');
        return;
    }

    if (a1[0]===0 && a2[0]===0 && a3[0]===0) {
        console.log('Yes');
        return;
    }
    if (a1[1]===0 && a2[1]===0 && a3[1]===0) {
        console.log('Yes');
        return;
    }
    if (a1[2]===0 && a2[2]===0 && a3[2]===0) {
        console.log('Yes');
        return;
    }

    if (a1[0]===0 && a2[1]===0 && a3[2]===0) {
        console.log('Yes');
        return;
    }
    if (a1[2]===0 && a2[1]===0 && a3[0]===0) {
        console.log('Yes');
        return;
    }
    console.log('No');


};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());


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

#define ll long long
#define pii pair<int,int>
#define pll pair<ll int,ll int>
#define vii vector<int,int>
#define vll vector<ll int,ll int>
#define deb(x) cout << #x << " --> " << x << endl;
#define deb2(x,y) cout << "[ " <<  #x << " --> " << x << " || " << #y << " --> " << y << " ]"<< endl;
#define boost() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i,a,n) for (long long int i=a;i<n;i++)
#define repr(i,n,a) for(long long int i=n-1;i>=a;i--)
#define pb push_back
#define cases int t;cin >> t; while(t--)
#define LLMAX 9223372036854775807

const ll int MOD = 1e9+7;

void debugMode()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}

int main()
{
	debugMode();
	// cases
	{
		int w,s;
		cin >> s >> w;
		cout << ((s>w)?"safe\n":"unsafe\n");	
	}
}

Measured memory_bytes: 3624
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

double EPS = 1e-10;

double add(double a,double b){
  if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0;
  return a+b;
}

struct P{
  double x,y;
  P() {}
  P(double x,double y):x(x),y(y){
  }
  P operator + (P p){
    return P(add(x,p.x),add(y,p.y));
  }
  P operator - (P p){
    return P(add(x,-p.x),add(y,-p.y));
  }
  P operator * (double d){
    return P(x*d,y*d);
  }
  double dot(P p){
    return add(x*p.x,y*p.y);
  }
  double det(P p){
    return add(x*p.y, -y*p.x);
  }
};

bool cmp_x(const P& p, const P& q){
  if(p.x != q.x)return p.x<q.x;
  return p.y < q.y;
}

vector<P>convex_hull(P* ps, int n){
  sort(ps,ps+n,cmp_x);
  int k=0;
  vector<P>qs(n*2);

  for(int i=0;i<n;i++){
    while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)k--;
    qs[k++]=ps[i];
  }

  for(int i=n-2,t=k;i>=0;i--){
    while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)k--;
    qs[k++]=ps[i];
  }
  qs.resize(k-1);
  return qs;
}

int main(void){
  int n;
  double x,y;
  P p[100];

  while(cin >> n,n){
    for(int i=0;i<n;i++)
      scanf("%lf,%lf",&p[i].x,&p[i].y);
 
    vector<P>d=convex_hull(p,n);

    cout << n-d.size() << endl;
  }


  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
    
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){

    int N , M;
    cin >> N >> M;
    int connect[N+1][N+1] = {{0}};
    
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        connect[a][b] = 1;
        connect[b][a] = 1;
    }

    ll ans = 0;
    bool flag = true;
    while(flag){
        flag = false;
        for(int i = 0; i <= N; i++){
            int connect_num = 0;
            for(int j = 0; j <= N; j++){
                if(connect[i][j]) connect_num += 1;
            }
            if(connect_num == 1) {
                for(int j = 0; j <= N; j++){
                    if(connect[i][j]){
                        connect[i][j] = 0;
                        connect[j][i] = 0;
                    } 
                }
                ans ++;
                flag = true;
            }
        }
    }
    cout << ans << endl;

}


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 ans;
    ans = 1000 - N % 1000;
    if (ans == 1000) ans = 0;

    cout << ans << endl;

    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int suma = 0;
    string s, t;
    cin >> s >> t;
    for(int i=0; i<s.size(); i++) {
        if(s[i] != t[i]) {
            suma++;
        }
    }
    cout << suma;
    return 0;
}


Measured memory_bytes: 3780
#include <iostream>
#include <cstdio>

using namespace std;

long long dp[34];

int main()
{
    dp[0] = 1;
    for (int i = 0; i < 30; i++) {
        dp[i+1] += dp[i];
        dp[i+2] += dp[i];
        dp[i+3] += dp[i];
    }

    int n;
    while ( cin >> n, n) {
        cout << dp[n]/3650 + (dp[n]%3650?1:0) << endl;
    }

    return 0;
}

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

using namespace std;

#define int long long

signed main(){
	int a, b, c; cin>>a>>b>>c;
	int k; cin>>k;
	
	while(b <= a){
		b *= 2;
		k--;
	}
	
	while(c <= b){
		c *= 2;
		k--;
	}
	
	if(k >= 0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main()
{
      int n,t=0;
      cin>>n;
      int arr[2*n];
      priority_queue<int,vector<int>,greater<int>> q;
      for(int i=0;i<2*n;i++)
      {
            int k;
            cin>>k;
            q.push(k);
      }
      for(int i=0;i<n;i++)
      {
            int x=q.top();
            q.pop();
            int y=q.top();
            q.pop();
            t=t+min(x,y);
      }
      cout<<t;
}


Measured memory_bytes: 3596
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 +10 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase

#sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def BellmanFord(graph,num_v,source=0):
    # graph = 隣接リスト g[source]=[(destination, dist),...]
    # edgeの初期化 edge = [(source,destination,dist),...]
    edges=[]
    for u in range(num_v):
        for v,d in graph[u]:
            edges.append((u,v,d))
    inf=float("inf")
    dist=[inf for i in range(num_v)]
    dist[source]=0
    neg=[False for i in range(num_v)]
    neg_flg=False
    
    #辺の緩和
    for i in range(num_v):
        if i==num_v-1:
            check=dist[n-1]
        for u,v,d in edges:
            if dist[v] > dist[u] + d:
                dist[v] = dist[u] + d
                if i==num_v-1:# and neg[v]==True:
                    # N回目で更新があったという事は負閉路が存在する
                    neg_flg=True
                neg[v] = True
    if neg_flg:
        for i in range(num_v):
            for u,v,d in edges:
                if dist[v] > dist[u] + d:
                    dist[v] = dist[u] + d
    if dist[n-1]==check:
        neg_flg=False
    return neg_flg,dist
 

show_flg=False
show_flg=True

n,m=LI()
g=[[] for i in range(n)]

for i in range(m):
    a,b,c=LI_()
    c=-c-1
    g[a].append((b,c))
    #g[b].append((a,c))
    #show((a,b,-c))

fl,d=BellmanFord(g,n,0)
if fl:
    ans='inf'
else:
    ans=-d[n-1]
print(ans)

Measured memory_bytes: 44888
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] lines = sc.nextLine().split(" ");
		int a = Integer.parseInt(lines[0]);
		int b = Integer.parseInt(lines[1]);
		int c = Integer.parseInt(lines[2]);
		int x = Integer.parseInt(lines[3]);
		int y = Integer.parseInt(lines[4]);
		sc.close();

		int min = 0;
		if (a+b <= 2*c) {
			min = a*x+b*y;
		} else {
			if (x > y) {
				min += 2*c*y;
				if (a<=2*c) {
					min += a*(x-y);
				} else {
					min += 2*c*(x-y);
				}
			} else {
				min += 2*c*x;
				if (b<=2*c) {
					min += b*(y-x);
				} else {
					min += 2*c*(y-x);
				}
			}
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 23764
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n>>m;
    cout<<((n*3)+m)/2<<endl;

    }


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll n,i;
    cin>>n;
    ll a[n+1],b[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        b[i]=a[i]-i;
    }
    sort(b+1,b+1+n);
    ll med;
    if(n%2!=0)
    {
        med=b[n/2+1];
    }
    else{
        med=(b[n/2]+b[n/2+1])/2;
    }
    ll ans=0;
    for(i=1;i<=n;i++)
    {
        ans+=(abs(b[i]-med));
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3328
X, N = map(int, input().split())
p = list(map(int, input().split()))

for i in range(1, 101):
    if N == 0:
        print(X)
        break
    elif p.count(X) == 0:
        print(X)
        break
    elif p.count(X-i) == 0:
        print(abs(X-i))
        break
    elif p.count(X+i) == 0:
        print(abs(X+i))
        break


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

int main(){
    int a,b;
    cin >> a >> b;
    if(a < b){
        cout << "a < b" << endl;
    }else if(a > b){
        cout << "a > b" << endl;
    }else{
        cout << "a == b" << endl;
    }
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
    char c;
    cin >> c;
    cout << (char) (c+1) << endl;
}

Measured memory_bytes: 256
//What is love?

#include <iostream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define FOR(i,n,m) for(int i=n; i<m; i++)
#define ROF(i,n,m) for(int i=n; i>m; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define ri(a) scanf("%d",&a)
#define rii(a,b) scanf("%d %d",&a,&b)
#define riii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define lri(a) scanf("%lld",&a)
#define lrii(a,b) scanf("%lld %lld",&a,&b)
#define ms(obj,val) memset(obj,val,sizeof(obj))
#define debug true
#define dprintf debug && printf
#define all(v) v.begin(),v.end()

const int INF = 0x3f3f3f3f;
const ll INFLL = 1e18;
const int MOD = 998244353;//1e9+7;
const int MAXN = 2e5+5;


/*--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------*/



int main(){

    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
	int n;
	string s;
	cin >> n;
	cin >> s;

	set<int> open, mid, close;
	vi R, G, B;

	FOR(i,0,3*n){
		char c = s[i];
		if(c == 'R') R.pb(i);
		if(c == 'G') G.pb(i);
		if(c == 'B') B.pb(i);
	}

	int a[3];
	FOR(i,0,n){
		a[0] = R[i];
		a[1] = G[i];
		a[2] = B[i];
		sort(a, a+3);
		open.insert(a[0]);
		mid.insert(a[1]);
		close.insert(a[2]);
	}

	int nOp=0, nMid=0, nCl=0;
	ll ans = 1;

	FOR(i,0,3*n){
		ll coef=-1;
		if(open.find(i)!=open.end()){
			coef = n - nOp;
			nOp++;
		}
		if(mid.find(i)!=mid.end()){
			coef = nOp - nMid;
			nMid++;
		}
		if(close.find(i)!=close.end()){
			coef = nMid - nCl;
			nCl++;
		}

		ans = (ans * coef) % MOD;
	}

	printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 15744
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool a)
{
    if (a == true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

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

int main()
{
    int n;
    cin >> n;
    vi w(n);
    rep(i, 0, n) cin >> w[i];
    int m = INF;
    rep(i, 0, n)
    {
        int sum1 = 0, sum2 = 0;
        rep(j, 0, n)
        {
            if (j <= i)
                sum1 += w[j];
            else
                sum2 += w[j];
        }
        m = min(m, abs(sum1 - sum2));
    }
    cout << m << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C3Or2 solver = new C3Or2();
        solver.solve(1, in, out);
        out.close();
    }

    static class C3Or2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            int res = solve(a);
            out.println(res);
        }

        private int solve(int[] a) {
            int res = 0;
            for (int val : a) {
                while (val % 2 == 0) {
                    val /= 2;
                    res++;
                }
            }
            return res;
        }

    }
}



Measured memory_bytes: 34244
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long X;
    cin >> X;
    long long sum = 0;
    for (long long i = 1; i < 1000000; i++){
        sum += i;
        if (sum >= X){
            printf("%lld\n",i);
            break;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
const ll N=2e5 + 5;
const ll mod=1e9 + 7;
vector<ll> adj[N];
vector<ll> add(N,0);
vector<bool>visited(N,false);

void dfs(ll src,ll parent,ll val)
{
    visited[src]=true;
    add[src] = add[src] + val;
    for(ll i=0;i<adj[src].size();i++)
    {
        ll v=adj[src][i];
        if(v==parent)
            continue;
        dfs(v,src,add[src]);
    }
}
int main()
{
    fast();
    ll n,q;
    cin>>n>>q;

    for(ll i=0;i<n-1;i++)
    {
        ll u,v;
        cin>>u>>v;
        u--;v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    while(q-->0)
    {
        ll v,val;
        cin>>v>>val;
        v--;
        add[v]+=val;
    }


    dfs(0,-1,0);
    for(ll i=0;i<n;i++)
        cout<<add[i]<<" ";
}


Measured memory_bytes: 25056
package main

import "fmt"

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var K, X int
	fmt.Scan(&K, &X)
	from := max(X-K+1, -1000000)
	to := min(X+K-1, 1000000)

	for i := from; i <= to; i++ {
		if i != from {
			fmt.Print(" ")
		}
		fmt.Print(i)
	}
	fmt.Println()
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

string S;
int K;
int main(void){
    cin >> K;
    cin >> S;
    
    if(S.length() <= K) cout << S << endl;
    else{
        REP(i,K) cout << S[i];
        cout << "..." << endl;
    }
    return 0;
}



Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  long long a,b,k;
  cin >> a >> b >> k;
  if (k > a){
    k -= a;
    a = 0;
  }
  else{
    a -= k;
    k = 0;
  }
  if (k > b){
    k - b;
    b = 0;
  }
  else{
    b -= k;
    k = 0;
  }
  cout << a << ' ' << b << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef string str;
typedef vector<str> vst;typedef vector<ll> vll;
ll mod = 1000000007, INF = 10000000000000000;
ll gcd(ll a, ll b){if(b==0){return a;}return gcd(b, a%b);}
int main(){
  ll n,x,i,j;
  cin>>n>>x;
  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  
  vector<ll> b(n-1);
  ll ans=0;
  for(i=0;i<n-1;i++){
    b[i]=a[i]+a[i+1];
  }
   for(i=0;i<n-1;i++){
    if(b[i]-x>0){
      ans+=b[i]-x;
      b[i+1]-=min(a[i+1],b[i]-x);
    }
   }
  
  
  cout<<ans<<endl;
} 
  

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

#define SWAP(x, y) do { int t = x; x = y; y = t; } while (0)

int partition(int a[], int p, int r);

int main(void)
{
    int n;
    int *a;
    int i;
    int k;

    scanf("%d", &n);
    a = calloc(n, sizeof(int));

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

    printf("%d", a[0]);
    for (i = 1; i < n; i++){
        if (i == k){
            printf(" [%d]", a[i]);
        }else{
            printf(" %d", a[i]);
        }
    }
    puts("");
    return (0);
}

int partition(int a[], int p, int r)
{
    int i;
    int x;
    int j;

    x = a[r];
    i = p - 1;

    for (j = p; j < r; j++){
        if (a[j] <= x){
            i = i + 1;
            SWAP(a[i], a[j]);
        }
    }
    SWAP(a[i+1], a[r]);
    return (i + 1);
}


Measured memory_bytes: 2124
n = int(input())
a = [0 for i in range(n)]
v = [0 for i in range(n)]

for i in range(n):
    a[i], v[i] = [int(i) for i in input().split()]
v1 = sorted(v)
max_ = v1[-1]
indexes = [i for i, x in enumerate(v) if x == max_]
a_ = min([a[i] for i in indexes])
print(a_,max_)


Measured memory_bytes: 5604
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)
#define rrep(i,x) for(int i=(int)x-1;i>=0;--i)
#define rrep1(i,x) for(int i=(int)x;i>=1;--i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}
constexpr ll TEN(ll n){return n==0?1:10ll*TEN(n-1);}

constexpr ll inf = TEN(9)+5;
constexpr ll linf = 3*TEN(18);

signed main()
{
    int N; cin >> N;
    ll ans = 0;
    for (int i = 1; i <= N; ++i) {
        ans += (N - 1) / i;
    }

    cout << ans << endl;
}


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

int main(){
  int a,b;cin>>a>>b;
  if((a*b)%2){
    cout << "Yes"<<endl;
  }else{
    cout << "No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
g (x:s) l =(if elem x l then[x] else [])++(if null s then [] else g s [k|k<-l,k/=x])
f s n k = if length s <=n then k else f s (n+1) (max k (length(g(take n s)(drop n s))))
main=do
 x<-getLine
 s<-getLine
 print$f s 1 0

Measured memory_bytes: 892
/* The journey is what brings us pleasure, not the destination <3 */

#include<bits/stdc++.h>

#define PI acos(-1)
#define _fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MOD 1000000007
#define MAX 1000000
#define all(v) v.begin(),v.end()

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

int tc;

void solve(){

    string s;
    cin>>s;
    if(s[s.size()-1]=='s')cout<<s<<"es"<<endl;
    else cout<<s<<"s"<<endl;
}

int main(){

    _fastIO;

    //cin>>tc; while(tc--)
    solve();

    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cctype>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	if(a+b>=10){
		cout<<"error"<<endl;
	}
	else{
		cout<<a+b<<endl;
	}
	return 0;
}


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

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  
  int n, m;
  cin >> n >> m;
  cout << (n*(n-1)*1LL)/2 + (m*(m-1)*1LL)/2;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}

ll w[105];
ll v[105];
ll dp[105][105][305];
int main(){
    int n;cin >> n;
    ll W;cin >> W;
    rep(i,n) cin >> w[i] >> v[i];
    ll w0=w[0];
    ll ans=0;
    rep(i,n) w[i]-=w0;
    rrep(i,n){
        rrep(j,n){
            rep(k,3*n+1){
                dp[i][j][k]=dp[i-1][j][k];
                if(k-w[i-1]>=0) dp[i][j][k]=max(dp[i][j][k],dp[i-1][j-1][k-w[i-1]]+v[i-1]);
                //cout << "i" << i << " " << "j" << j << " " << "k" << k << " " << dp[i][j][k] << endl;
                if(j*w0+k<=W) chmax(ans,dp[i][j][k]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

int main(void)
{
    ll n, cnt = 0; 
    string s;
    cin >> n >> s;
    string ans = "000";
    for(ans[0] = '0'; ans[0] <= '9'; ans[0] ++) {
    for(ans[1] = '0'; ans[1] <= '9'; ans[1] ++) {
    for(ans[2] = '0'; ans[2] <= '9'; ans[2] ++) {        
        //cout << ans << endl;
        int k = 0;
        REP(i, n) {
            if(s[i] == ans[k]) {
                k ++;
                if(k == 3) {
                    cnt ++;
                    break;
                }
            }
        }


    }
    }
    }

    cout << cnt << endl;

}


Measured memory_bytes: 256
s_list = []
while True:
	try:
		s_list.append(input().lower())
	except:
		break
s = ''.join(s_list)
for t in ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']:
	print('{0} : {1}'.format(t, s.count(t)))


Measured memory_bytes: 5560
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
#define F first
#define S second
constexpr auto INF = 1000000000;
constexpr auto LLINF = 9223372036854775807;
constexpr auto mod = 1000000007;
int main() {

	int n, k;
	cin >> n >> k;
	cout << n - k + 1 << endl;
	
	return 0;
}


Measured memory_bytes: 256
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
d,t,s=get_ints()
a=t*s
if a>=d:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61892