akhauriyash/Code-Regression huggingface dataset:
package main

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

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	stdInScanner.Scan()
	return stdInScanner.Text()
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	S := nextString()

	aCounter := 0
	bCounter := 0
	for _, s := range strings.Split(S, "") {
		switch s {
		case "A":
			aCounter++
		case "B":
			bCounter++
		}
	}
	if aCounter >= 1 && bCounter >= 1 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a) cout << k << endl;
  else if(k<=a+b) cout << a << endl;
  else cout << a-(k-a-b) << endl;
}


Measured memory_bytes: 3624
n,m=map(int,input().split())
A = [list(map(int,input().split())) for _ in range(n)]
C = [list(map(int,input().split())) for _ in range(m)]
for a,b in A:
  l=[abs(a-c)+abs(b-d) for c,d in C]
  print(l.index(min(l))+1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define faster  ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;

int main()
{
    faster

    string s;
    cin>>s;

    //cout<<'0'-48<<endl;

    ll ss=0;
    for(int i=0; i<s.length(); i++)
    {
        ss=ss+(s[i]-48);
    }

    if(ss%9==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;




    return 0;
}



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

int main(){
	int a,b;
	cin >>a>>b;
	if (a<=5)
		cout <<"0";
	else if (a<=12)
		cout <<b/2;
	else
		cout <<b;

}

Measured memory_bytes: 256
/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.

*/
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;
typedef long long ll;

int mod = 1000000007;
ll dp[100005];;

ll gcd(long long a,long long b){

  if(b == 0)
    return a;
  else return gcd(b,a%b);
}

bool compare(pair<int,int>p1, pair<int,int>p2){

  return p1.second > p2.second;
 }

 int main(){

 string s;
 cin>>s;

   long long bc=0,result=0;

 for(int i=0;i<s.length();i++){

    if(s[i] == 'B')
        bc++;
    else
      result += bc;
 }

 cout<<result<<endl;

 return 0;
 }


Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
ll const mod=998244353;
const ll MAX=300000;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


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


int main(){
    int a,b;
    cin>>a>>b;
    if(a%3==0||b%3==0||(a+b)%3==0)cout<<"Possible";
    else cout<<"Impossible";
    return 0;
}

Measured memory_bytes: 256
def my_func(i):
	return i*i
raw_input()
while True:
	try:
		splited = map(int, raw_input().split())
		sort_num = sorted(splited)
		if my_func(sort_num[0])+my_func(sort_num[1]) == my_func(sort_num[2]):
			print 'YES'
		else:
			print 'NO'
	except EOFError:
		break

Measured memory_bytes: 6440
#include <bits/stdc++.h>
#define ll long long int

using namespace std;
 
int main ()
{
	int x, y;
	ll sum = 0;
	cin >> x >> y;
	if (x == 1){
		sum += 300000;
		if (y == 1){
			sum += 400000;
		}
	}
	else if (x == 2){
		sum += 200000;
	}
	else if (x == 3){
		sum += 100000;
	}
	if (y == 1){
		sum += 300000;
	}
	else if (y == 2){
		sum += 200000;
	}
	else if (y == 3){
		sum += 100000;
	}
	cout << sum << endl;
}

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

using namespace std;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

typedef long long  int ll;
#define endl '\n'

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


const int MOD = 1000000007;

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    string t;

    cin >> s;
    cin >>t;



   ll sSize = s.size();
    ll tSize = t.size();

    vector< vector<ll> > vect(26, vector<ll>());

    for(ll i = 0; i < sSize; i++) {

        vect[s[i] - 'a'].push_back(i);
    }

    int ans = 0;
    int pos = -1;

    for(ll i = 0; i < tSize; i++) {

        ll c = t[i] - 'a';

        if(vect[c].empty()) {

            cout << -1 << endl;
            return 0;
        }
        vector<ll>::iterator itr;

        itr = upper_bound(vect[c].begin(), vect[c].end(), pos);

        if(itr == vect[c].end()) {

            pos = vect[c][0];
            ans++;
        }
        else {
            pos = *itr;
        }

    }

    cout << ans * sSize + pos + 1 << endl;


}



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

int main()
{
    priority_queue<pair<ll, ll> > pq;
    ll n, m;
    cin >> n >> m;

    for (ll i = 0; i < n; i++) {
        ll coin, num;
        scanf("%lld %lld", &coin, &num);

        pq.push({-coin, num});
    }

    ll cnt = 0;
    ll koyta_nilam = 0;
    while (!pq.empty()) {
        auto tmp = pq.top();
        pq.pop();

        ll curcoin = -tmp.first;
        ll curnum = tmp.second;

        if (curnum + koyta_nilam > m) cnt += (ll) (((ll)m -(ll) koyta_nilam) * (ll)curcoin), koyta_nilam = m;
        else cnt += ll (curnum * curcoin), koyta_nilam += curnum;

        if (koyta_nilam == m) break;
    }

    cout << cnt << endl;
}


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

using namespace std;

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

  set< int > aa;
  for(int i = 0; i < S.size(); i++) aa.insert(i);

  bool update = true;
  auto p = aa.begin();

  while(p != aa.end()) {
    auto q = p;
    q++;
    if(q == aa.end()) break;
    if(S[*p] == 'S' && S[*q] == 'T') {
      int a = *p, b = *q;
      aa.erase(aa.find(a));
      aa.erase(aa.find(b));
      p = aa.lower_bound(a);
      if(p != aa.begin()) --p;
    } else {
      ++p;
    }
  }
  cout << aa.size() << endl;
}


Measured memory_bytes: 9860
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll N, ll Q, std::string S, std::vector<ll> l, std::vector<ll> r) {
  vector<ll> a(N, 0);
  FOR(i, 1, N) {
    a.at(i) = a.at(i - 1);
    if (S.at(i) == 'C' && S.at(i - 1) == 'A') a.at(i) += 1;
  }

  rep(i, Q) cout << a.at(r.at(i) - 1) - a.at(l.at(i) - 1) << endl;
}

int main() {
  ll N;
  scanf("%lld", &N);
  ll Q;
  scanf("%lld", &Q);
  std::string S;
  std::cin >> S;
  std::vector<ll> l(Q);
  std::vector<ll> r(Q);
  for (int i = 0; i < Q; i++) {
    scanf("%lld", &l[i]);
    scanf("%lld", &r[i]);
  }
  solve(N, Q, S, std::move(l), std::move(r));
  return 0;
}


Measured memory_bytes: 5936
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import deque
'''
d = deque([1,2,3])
d.append(1)であれば右(末尾)
d.appendleft(1)であれば左(先頭)
d.pop()であれば3、つまり末尾
d.popleft()であれば1、つまり先頭
'''
h,w = map(int,readline().split())
grid = '#'*(w+2)
A = []
A.append(grid)
for i in range(h):
    tmp = "#" + readline().rstrip().decode() + "#"
    A.append(tmp)
A.append(grid)

def bfs(i,j ):
    inf = 10 ** 9
    dist = [[inf]*(w+2) for i in range(h+2)]
    dist[i][j] = 0
    q = deque()
    q.append((i,j ))
    ans = 0
    while q:
        hh, ww = q.popleft()
        dv = dist[hh][ww]
        for k,l in [(1,0),(0,1),(-1,0),(0,-1)]:
            if A[hh+k][ww+l] == "#":
                continue
            if dist[hh+k][ww+l] <= dv +1:
                continue
            dist[hh+k][ww+l] = dv +1
            ans = dv + 1
            q.append((hh+k,ww+l))

    return ans

anss = 0
for i in range(h+2):
    for j in range(w+2):
        if A[i][j] == "#":
            continue
        anss = max(anss,bfs(i,j))
print(anss)
            
    



Measured memory_bytes: 42092
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int a,b,n;
  cin >> n >> a >> b;
  
  if(n*a > b) cout << b << endl;
  else        cout << n*a << endl;


 return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def combinations_mod(n, r, mod=1000000007):
    """Returns nCr in mod."""
    r = min(r, n - r)
    combs = 1
    for i, j in zip(range(n - r + 1, n + 1), range(1, r + 1)):
        combs *= (i % mod) * pow(j, mod - 2, mod)
        combs %= mod
    return combs


def main():
    n, a, b = NMI()
    all = pow(2, n, MOD) - 1
    ans = all - combinations_mod(n, a) - combinations_mod(n, b)
    ans %= MOD
    print(ans)



if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
import sys
sys.setrecursionlimit(500*500)

h,w=list(map(int,input().split()))
s=[[1 if c=='#' else 0 for c in input()] for _ in range(h)]
g=[[] for _ in range(h*w)]

for i in range(w):
    for j in range(h):
        for di in [-1,0,1]:
            for dj in [-1,0,1]:
                if abs(di)+abs(dj)!=1:
                    continue
                if 0<=i+di<w and 0<=j+dj<h:
                    if s[j][i]!=s[j+dj][i+di]:
                        g[j*w+i].append(i+di+(j+dj)*w)

visit=[0]*(h*w)
black=[0]*(h*w)
white=[0]*(h*w)

def rec(j,i,rj,ri):
    if s[j][i]:
        black[rj*w+ri]+=1
    else:
        white[rj*w+ri]+=1
    
    for n in g[j*w+i]:
        if visit[n]:
            continue

        visit[n]=1

        rec(n//w,n%w,rj,ri)

ans=0

for i in range(w):
    for j in range(h):
        if visit[w*j+i]:
            continue
        visit[w*j+i]=1

        rec(j,i,j,i)
        
        ans+=black[w*j+i]*white[w*j+i]

print(ans)

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

typedef long long LL;
const int MAXN = 100010;
LL A[MAXN], dp[MAXN][3];
int opt[MAXN], n, bak;
char buf[10];
void getmax(LL & x, LL y) { x < y ? x = y : 0; }
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n;
	for (int i = 1; i <= n; ++i) {
		if (i > 1) std::cin >> buf, opt[i] = *buf == '-';
		std::cin >> A[i];
	}
	memset(dp, 0xcf, sizeof dp);
	dp[0][0] = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= 2; ++j) {
			int t = j + opt[i];
			if (t <= 2)
				getmax(dp[i][t], dp[i - 1][j] + A[i] * (t & 1 ? -1 : 1));
		}
		getmax(dp[i][1], dp[i][2]);
		getmax(dp[i][0], dp[i][1]);
	}
	std::cout << dp[n][0] << std::endl;
	return 0;
}


Measured memory_bytes: 3840
n = int(input())
A = list(map(int,input().split())) + [0]
B = list(map(int,input().split()))
C = [0] + list(map(int,input().split()))

ans = sum(B)
for i in range(n):
  if A[i]+1 == A[i+1]:
    ans += C[A[i]]
print(ans)



Measured memory_bytes: 3060
import numpy as np

N, M = map(int, input().split())

ifAC = np.zeros(N, dtype='bool')
WAcount = np.zeros(N, dtype='int')

for i in range(M):
    pi, Si = input().split()
    pi = int(pi) - 1
    if Si == 'AC':
        ifAC[pi] = True
    if ifAC[pi] == False and Si == 'WA':
        WAcount[pi] += 1

print(np.sum(ifAC), np.sum(np.dot(WAcount, ifAC)))


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

typedef int64_t s64;
int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int64_t rll() {
	long long n;
	scanf("%lld", &n);
	return n;
}

bool ok(int n, int *a) {
	int ch = 0;
	for (int i = 0; i < n; i++) ch = std::max(ch, a[i]);
	std::multiset<int> as;
	for (int i = 0; i < n; i++) as.insert(a[i]);
	as.erase(ch);
	if (ch % 2) {
		int half = (ch + 1) / 2;
		for (int i = half; i < ch; i++) {
			if (as.count(i) < 2) return false;
			as.erase(as.find(i));
			as.erase(as.find(i));
		}
		for (auto i : as) if (i <= half) return false;
	} else {
		if (!as.count(ch / 2)) return false;
		as.erase(as.find(ch / 2));
		for (int i = ch / 2 + 1; i < ch; i++) {
			if (as.count(i) < 2) return false;
			as.erase(as.find(i));
			as.erase(as.find(i));
		}
		for (auto i : as) if (i <= ch / 2) return false;
	}
	return true;
}

int main() {
	int n = ri();
	int a[n];
	for (int i = 0; i < n; i++) a[i] = ri();
	
	std::cout << (ok(n, a) ? "Possible" : "Impossible") << std::endl;
	return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    sys.setrecursionlimit(300000)
    n, q, *abpx = map(int, sys.stdin.read().split())

    g = [[] for _ in range(n + 1)]
    for u, v in zip(*[iter(abpx[:2 * (n - 1)])] * 2):
        g[u].append(v)
        g[v].append(u)

    f = [0 for _ in range(n + 1)]

    for p, x in zip(*[iter(abpx[2 * (n - 1):])] * 2):
        f[p] += x

    k = [0 for _ in range(n + 1)]
    vis = [False for _ in range(n + 1)]

    def c(i, p):
        if vis[i]:
            return
        vis[i] = True
        w = f[i] + p
        k[i] = w
        ch = g[i]
        for x in ch:
            c(x, w)
    c(1, 0)
    ans = ' '.join(map(str, k[1:]))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 294848
N = 998244353

def calc_divisors(n)
  divisors = []
  1.upto(Math.sqrt(n).to_i) do |k|
    if n % k == 0
      divisors << k
      divisors << n / k
    end
  end
  divisors.uniq.sort
end

def get_int
  gets.chop.to_i
end

def get_ints
  gets.chop.split.map(&:to_i)
end

def get_double
  gets.chop.to_f
end

def get_str
  gets.chop
end

def get_strs
  gets.chop.split
end

def main
  n = get_int
  x_s = get_str
  x_i = x_s.to_i(2)
  ks = calc_ks(n)
  c = 0
  ans = 0
  pairs = []
  ks.each do |k|
    s = x_s[0...k]
    s_rev = s.chars.map {|c| c == "0" ? "1" : "0" }.join
    s_n = s.to_i(2)
    y_s = s + (s_rev + s) * ((n/k - 1)/2)
    y_i = y_s.to_i(2)
    s_n += 1 if (y_i <= x_i)
    pairs.each do |pair|
      s_n -= pair[1] if k % pair[0] == 0
    end
    pairs << [k, s_n]
    c += s_n
    ans += (2 * k) * s_n
    ans = ans % N
  end
  ans += (x_i%N + 1 - (c%N) + N) * (2 * n)
  ans = ans % N
  puts ans
end

def calc_ks(n)
  ks = []
  calc_divisors(n).each do |d|
    m = n / d
    if m >= 3 and m % 2 == 1
      ks << d
    end
  end
  ks
end

def calc_x_mod(x)
  m = 0
  x.each_with_index do |b, i|
    next if b == 0
    l = 1
    i.times do
      l = l * 2
      l = l % N
    end
    m += l
    m = m % N
  end
  m
end

if __FILE__ == $0
  main
end

Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

short dp[5010][5010] = {};

int main(){
    int n, m; cin >> n >> m;
    rep(i, m){
        int x, y, c; cin >> x >> y >> c;
        x--, y--, c++;
        dp[x][y] = c;
    }

    int ans = 0;
    if (dp[0][0]) ans++;
    loop(i, 1, n)rep(j, i + 1){
        int t = -100;
        if (j - 1 >= 0) t = max(t, dp[i - 1][j - 1] - 1);
        if (j < i + 1) t = max(t, dp[i - 1][j] - 1);
        dp[i][j] = max<short>(dp[i][j], t);
        if (dp[i][j]) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 48912
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;

int N;

int main() {
    cin >> N;
    int tmpT = 0, tmpX = 0, tmpY = 0;
    int nextT, nextX, nextY;
    for (int i = 0; i < N; i++) {
        cin >> nextT >> nextX >> nextY;
        int time = nextT - tmpT, dist = abs(nextX - tmpX) + abs(nextY - tmpY);
        if (time < dist || (time - dist) % 2) {
            cout << "No" << endl;
            return 0;
        }
        tmpT = nextT; tmpX = nextX; tmpY = nextY;
    }
    cout << "Yes" << endl;
}

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

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

	long long a,b;
	int length=11;
	for(long long i=1;i<=sqrt(n);++i){
		a = i;
		b = n/a;
		if(a*b == n){
			length = to_string(b).length();
		}
	}
	cout<<length<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int N;
  cin >> N;
  int Amax=1000010;
  vector<int> a(Amax,0);

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

  for(int i=1;i<Amax;i++){
    if(a[i]==0) continue;
    for(int j=2;i*j<Amax;j++){
      a[i*j]=0;
    }
  }

  int ans=0;
  for(int i=0;i<Amax;i++){
    if(a[i]==1) ans++;
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 7216
#include<iostream>
using namespace std;
int main(){
    int n;
    char s;
    bool flag=false;
  	cin >> n;
    for(int i=0;i<n;i++){
        cin >> s;
        if(s =='Y'){
            flag = true;
        }
    }
    if(flag){
        cout << "Four" << endl;
    }else{
        cout << "Three" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long ll;

 int main(){
    int n;cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    for(int i=0;i<n;i++){
        if(v[i]%2==0){
            if(v[i]%5==0||v[i]%3==0)continue;
            else {cout<<"DENIED";return 0;}
        }
    }
cout<<"APPROVED";
 }

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,m,n,y,x;
    scanf("%d%d",&m,&n);
    if(m>n)x=m-n;
    else if(m<n)x=n-m;
    else x=0;
    y=16-(m+n);
    x=x-1;
    if(x<=y) printf("Yay!\n");
    else printf(":(\n");

   return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    long x = sc.nextLong();
    System.out.print(Logic.run(x));
  }
}
class Logic{
  public static int run(long x){
    int res = 0;
    long money = 100;
    while ( money < x ){
      money*=1.01;
      res++;
    }
    return res;
  }
}

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

vector<int> getGcdVec(vector<int> numVec)
{
    vector<int> gcdVec;
    int gcd = numVec.at(0);
    for (const int &singleNum : numVec)
    {
        int a = singleNum, b = gcd;
        int remainder = singleNum % b;
        while (remainder != 0)
        {
            a = b;
            b = remainder;
            remainder = a % b;
        }
        gcd = b;

        gcdVec.push_back(gcd);
    }

    return gcdVec;
}

int getGcd(int a, int b)
{
    int remainder = a % b;
    while (remainder != 0)
    {
        a = b;
        b = remainder;
        remainder = a % b;
    }

    return b;
}

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

    vector<int> numVec;
    int minNum = 1000000000;
    for (int i = 0; i < n; ++i)
    {
        int input;
        cin >> input;
        numVec.push_back(input);
        minNum = min(minNum, input);
    }

    vector<int> gcdFromTopVec, gcdFromEndVec;

    gcdFromTopVec = getGcdVec(numVec);

    reverse(numVec.begin(), numVec.end());

    gcdFromEndVec = getGcdVec(numVec);

    reverse(gcdFromEndVec.begin(), gcdFromEndVec.end());

    int maxGcd = 1;

    for (int i = 0; i < n; ++i)
    {
        if (i == 0)
        {
            maxGcd = max(maxGcd, gcdFromEndVec.at(1));
        }
        else if (i == n - 1)
        {
            maxGcd = max(maxGcd, gcdFromTopVec.at(i - 1));
        }
        else
        {
            int leftGcd = gcdFromTopVec.at(i - 1);
            int rightGcd = gcdFromEndVec.at(i + 1);
            int singleGcd = getGcd(leftGcd, rightGcd);
            maxGcd = max(maxGcd, singleGcd);
        }
    }

    cout << maxGcd << endl;
}

Measured memory_bytes: 2288
H, W = map(int, input().split())
ch, cw = map(int, input().split())
dh, dw = map(int, input().split())
S = []
for i in range(H):
  S.append(str(input()))
  
def main(h, w, cnt):
  global H
  global W
  global S
  tmp = []
  if (h<H-1) and (S[h+1][w]=='.') and (ans[h+1][w]<0):
    ans[h+1][w] = cnt
    tmp.append([h+1, w])
  if (w<W-1) and (S[h][w+1]=='.') and (ans[h][w+1]<0):
    ans[h][w+1] = cnt
    tmp.append([h, w+1])
  if (0<h) and (S[h-1][w]=='.') and (ans[h-1][w]<0):
    ans[h-1][w] = cnt
    tmp.append([h-1, w])
  if (0<w) and (S[h][w-1]=='.') and (ans[h][w-1]<0):
    ans[h][w-1] = cnt
    tmp.append([h, w-1])
  return tmp

def sub(h, w, cnt):
  global H
  global W
  global S
  tmp = []
  for x in range(max(h-2, 0), min(h+3, H)):
    for y in range(max(w-2, 0), min(w+3, W)):
      if (S[x][y]=='.') and (ans[x][y]<0):
        ans[x][y] = cnt
        tmp.append([x, y])
  return tmp

ans = [[-1]*W for i in range(H)]
ans[ch-1][cw-1] = 0
lis = [[ch-1, cw-1]]
li = [[ch-1, cw-1]]
flag = False
for i in range(1000000):
  for j in range(1000000):
    l = []
    for n in li:
      l += main(n[0], n[1], i)
    if l == []:
      break
    elif [dh-1, dw-1] in l:
      flag = True
      break
    else:
      lis += l
      li = l
  if flag:
    break
  else:
    z = []
    for m in lis:
      z += sub(m[0], m[1], i+1)
    if z == []:
      break
    else:
      lis = z
      li = z
print(ans[dh-1][dw-1])

Measured memory_bytes: 120360
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

total_white = 0
for i in s:
  total_white += i.count(".")

sh = 0
sw = 0
gh = H-1
gw = W-1

s[sh][sw] = 0
q = [[sh, sw]]
min_path = 0

while len(q) > 0:
  h, w = q.pop(0)
  if h == gh and w == gw:
    min_path = s[h][w]
    print(total_white - min_path -1)
    exit()
  for dh, dw in ([0, 1], [0, -1], [1, 0], [-1, 0]):
    if 0 <= h + dh < H and 0 <= w + dw < W:
      if s[h+dh][w+dw] == ".":
        s[h+dh][w+dw] = s[h][w] + 1
        q.append([h+dh, w+dw])

print(-1)


Measured memory_bytes: 3064
a,b,k = map(int,input().split())

i = k

while i > 0:
  if a % 2 == 1:
    a -=1
    b += a//2
    a -= a//2
  else:
    b += a//2
    a -= a//2
  i -= 1
  if i:
    if b % 2 == 1:
      b -=1
      a += b//2
      b -= b//2
    else:
      a += b//2
      b -= b//2
    i -=1

print(int(a),int(b))

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define Set(i, v) memset(i, v, sizeof i)
#define pb push_back
#define x first
#define y second

using namespace std;

typedef long long LL;

LL n, c[5], f[10];
int w[5];

int main(){
	For(i, 0, 3) cin >> c[i], w[i] = 1 << i;
	cin >> n; n <<= 2;
	LL x = min(min(c[0] * 8, c[1] * 4), min(c[2] * 2, c[3]));
	LL ans = n / 8 * x;
	f[0] = 0;
	For(i, 1, n % 8){
		f[i] = 1LL << 60;
		For(j, 0, 3) if(i >= w[j]) f[i] = min(f[i], f[i - w[j]] + c[j]);
	}
	printf("%lld\n", ans + f[n % 8]);
	return 0;
}

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

class Volumen0
{
    static void Main()
    {
        Calq keHsaN = new Calq();
        string line;
        while ((line = Console.ReadLine()) != null)
        {
            var alpha = line.Split().Select(int.Parse).ToArray();
            if (alpha[0] < alpha[1])
            {
                int tmp = alpha[1];
                alpha[1] = alpha[0];
                alpha[0] = tmp;
            }
            int gcd = keHsaN.GCD(alpha[0], alpha[1]);
            Console.WriteLine("{0} {1}", gcd, alpha[0] * (alpha[1] / gcd));
        }
    }
}
class Calq
{
    internal int GCD(int a, int b)
    {
        if (b == 0)
            return a;
        else
            return GCD(b, a % b);
    }
}


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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

int main(void) {
  arrst(s,3);
  cout << s[0][0] << s[1][0] << s[2][0] << "\n";
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
//#include <fstream>

using namespace std;

int stoi (string str )
{
	stringstream ss (str );
	int n; 

	ss >> n;

	return n;
}

int main()
{
//	cut here before submit 
//	freopen("testcase.secret", "r", stdin);
	string str = "";
	int res = 0;

	while (getline (cin, str ) ){
		int len = str.length();
		string num = "";

		for (int i = 0; i < len; ++i){
			if (isdigit(str[i]) ){
				num += str[i];
			}else if (!num.empty() ){
				res += stoi (num );
				num = "";
			} // end if
		} // end for
		if (!num.empty() ){
			res += stoi (num );
		} // end if
	} // end loop

	cout << res << endl;	
		
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<math.h>
void primeFactorization(int a,int count[1002]){ //素数を配列に格納
  int i,sq;
  while(a%2==0){
    a/=2;
    count[2]++;
  }
  for(i=3;i<=a;i+=2){ //3以上√a以下の奇数の場合
    while(a%i==0){
      count[i]++;
      a/=i;
    }
  }
}

int main(){
  int n,i;
  scanf("%d",&n);
  int count[1002];
  long long answer=1;
  for(i=0;i<1002;i++)
    count[i]=1;
  for(i=2;i<=n;i++){
    primeFactorization(i,count);
  }
  for(i=0;i<1002;i++){
    answer*=(long long)count[i];
    answer%=1000000007;
  }
  printf("%d\n",answer);
  return 0;
}

Measured memory_bytes: 1716
#include <stdio.h>
int main(){
  int r,c,i,j,sum,s[101][101];
  scanf("%d %d", &r, &c);
  for (i = 0; i < r; i++){
    sum=0;
    for (j = 0; j < c; j++){
      scanf("%d",&s[i][j]);
      sum+=s[i][j];
    }
    s[i][c]=sum;
  }
  for (j = 0; j < c+1; j++){
    sum = 0;
    for (i = 0; i < r; i++)
      sum += s[i][j];
    s[r][j]=sum;
  }
  for (i = 0; i < r+1; i++){
    for (j= 0; j < c+1; j++){
      printf("%d",s[i][j]);
      if (j!=c) printf("%s"," ");
    }
    printf("%s","\n");
  }
  return 0;
}

Measured memory_bytes: 644
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	int H,W;
	cin>>H>>W;
	char C[100][101];
	for(int i=0;i<H;i++){
		cin>>C[i];
	}
	for(int i=0;i<H;i++){
		cout<<C[i]<<endl;
		cout<<C[i]<<endl;
	}
}

Measured memory_bytes: 256
k,a,b = map(int,input().split())
ans = -1

if b-a<3:
    ans = k+1
else:
    if k<a+1:
        ans = k+1
    else:
        ope = k-(a-1)
        ope_ab = ope//2
        ans = ope_ab*b - (ope_ab-1)*a + ope % 2
        ans = int(ans)

print(ans)

Measured memory_bytes: 9184
n = int(input())
l = sorted(map(int, input().split()))
n = len(l)
ans = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if l[i] + l[j] > l[k] > l[j] > l[i]:
        ans += 1
print(ans)


Measured memory_bytes: 9176
#ABC119b

n=int(input())
xlist=[0 for i in range(n)]
ulist=[0 for i in range(n)]
answer=0

for i in range(n):
	xlist[i],ulist[i]=input().split()
	if ulist[i]=="JPY":
		answer+=float(xlist[i])
	else:
		answer+=380000*float(xlist[i])

print(answer)



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

int main(){
    int l, n;
    string s[200];
    string x;
    cin >> n >> l;
    rep(i, n) cin >> s[i];
    sort(s, s + n);
    rep(i, n) x += s[i];
    cout << x << endl;
}

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

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

    string tmp, tmp2;
    for (auto i = 0; i < s.size(); i += 5) {
        tmp = s.substr(i, 5);
        if(tmp != "dream" and tmp != "erase") {
            cout << "NO" << endl;
            return 0;
        }
        if(tmp == "dream"){
            tmp2 = s.substr(i + 5, 3);
            if(i + 5 + 3 > s.size() and tmp2 == "er") i+= 2;
            if(tmp2 == "ere" or tmp2 == "erd") i += 2;
        }
        if(tmp == "erase" and s[i + 5] == 'r') i++;
    }
    cout << "YES" << endl;
    return 0;
}

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

int main(void){
	double a,b,x;
	cin >> a >> b >> x;
	double s = x/a;
	double deg;
	if(s>= a*b/2){
		double b2 = 2*s/a - b;
		deg = atan2(b-b2,a)* 180/acos(-1);
	}else{
		double a2 = 2*s/b;
		deg = atan2(b,a2)* 180/acos(-1);
	}
	printf("%.10lf\n",deg);
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

const int INF = 1000000000;

int clamp(int x){
	if(x < 0){ return 0; }
	if(x >= 256){ return 255; }
	return x;
}

int pow2(int x){ return x * x; }

int main(){
	while(true){
		int n, m;
		cin >> n >> m;
		if(n == 0 && m == 0){ break; }
		vector<int> c(m), x(n);
		for(int i = 0; i < m; ++i){ cin >> c[i]; }
		for(int i = 0; i < n; ++i){ cin >> x[i]; }
		vector< vector<int> > dp(n + 1, vector<int>(256, INF));
		dp[0][128] = 0;
		for(int i = 0; i < n; ++i){
			for(int j = 0; j < 256; ++j){
				if(dp[i][j] >= INF){ continue; }
				for(int k = 0; k < m; ++k){
					int y = clamp(j + c[k]);
					dp[i + 1][y] = min(
						dp[i + 1][y], dp[i][j] + pow2(y - x[i]));
				}
			}
		}
		int answer = INF;
		for(int i = 0; i < 256; ++i){
			answer = min(answer, dp[n][i]);
		}
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 22000
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

ll modpow(ll a, ll b){
    if(b == 0) return 1;
    else if(b % 2 == 0){
        ll d = modpow(a, b/2) % MOD;
        return (d * d) % MOD;
    }
    else{
        return (a * modpow(a, b-1)) % MOD;
    }
}

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

    ll n, k; cin>>n>>k;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];
    vector<int> lcnt(n, 0), rcnt(n, 0);
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(j < i && a[j] < a[i]) lcnt[i]++;
            if(i < j && a[i] > a[j]) rcnt[i]++;
        }
    }

    ll ans = 0;
    for(int i=0; i<n; i++){
        ll a0 = rcnt[i];
        ll d = rcnt[i] + lcnt[i];
        (ans += k * (2LL * a0 + ((k - 1) * d % MOD)) % MOD * modpow(2, MOD - 2)) %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    if (N % 2 == 0) {
    	String str = sc.next();
    	String half = str.substring(0, N/2);
    	if(str.equals(half+half)) {
    		System.out.println("Yes");
    	} else {
    		System.out.println("No");
    	}
    } else {
    	System.out.println("No");
    }
  }
}

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

int n;
map<int, int> m;

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        m[a]++;
    }

    int tot = 0;
    for (auto& i : m) {
        tot += i.second - 1;
    }
    cout << m.size() - (tot % 2);
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
ll N, M, ans_i = 0;
using P = pair<ll, ll>;
vc<P> ans(100005);
bitset<100005> odd;
vvc<ll> G(100005);
bitset<100005> used;

void dfs(ll now, ll parent){
    used[now] = true;
    for(auto to:G[now]){
        if (used[to]) continue;
        dfs(to, now);
    }
    if (parent == -1) return;

    if(odd[now]){
        ans[ans_i++] = {now, parent};
        odd.reset(now);
    }else{
        ans[ans_i++] = {parent, now};
        odd.flip(parent);
    }
    return;
}

struct UnionFind {
private:
    vector<int> par;
    vector<int> count;
    vector<int> rank;
public:
    UnionFind(int N) {
        count.assign(N, 1);
        rank.assign(N, 0);
        par.assign(N, 0);
        rep(i, N) par[i] = i;
    }

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

    void unite(int x, int y) {
        x = root(x), y = root(y);
        if (x == y) return;
        if (rank[x] < rank[y])
            swap(x, y);
        else if (rank[x] == rank[y])
            rank[y]++;
        par[y] = x;
        count[x] += count[y];
        return;
    }

    int size(int x) {
        return count[root(x)];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }
};
using UF = struct UnionFind;

int main() {
    init();

    cin >> N >> M;
    used.reset();
    odd.reset();
    UF uf(N);

    rep(i,M){
        ll a, b;
        cin >> a >> b;
        a--, b--;
        if(!uf.issame(a,b)){
            G[a].eb(b), G[b].eb(a);
            uf.unite(a, b);
        }else{
            odd.flip(a);
            ans[ans_i++] = {a, b};
        }
    }
    if(M%2){
        cout << -1 << endl;
        return 0;
    }

    dfs(0, -1);
    if(odd[0]){
        cout << -1 << endl;
        return 0;
    }


    rep(i, M) cout << ans[i].first+1 << " " << ans[i].second+1 << "\n";
}

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

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        ans += y - x + 1;
    }
    cout << ans << endl;
}


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

using namespace std;

#define ll long long 
#define REPL(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
static const int MAX = 10010;
static const ll INFTY = 1e12;
static const ll NUMMAX = 1000000007;
static const ll MOD = 1000000007;
 #define LOOP 10000000

int main() {

  ll N;
  cin >> N;
  vector<pair<ll, ll>> robo(N);
  ll posi, arm;
  ll r_hand, l_hand, nx_r_hand;
  ll count = 0;
  bool flag = 1;

  REP(i, N){
    cin >> posi >> arm;
    robo[i] = make_pair(posi, arm);
  }

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

  REP(i, N-1){
    if(flag == 1) r_hand = robo[i].first + robo[i].second;

    l_hand = robo[i+1].first - robo[i+1].second;
    nx_r_hand = robo[i+1].first + robo[i+1].second;

    if(r_hand > l_hand){
      count++;
      if(r_hand > nx_r_hand){
        flag = 1;
      } else {
        flag = 0;
      }
    }else{
      flag = 1;
    }

  }

  cout << N - count << endl;


  
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 1792
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String[] astr = str.split(" "); //状況に合わせて
        Boolean flag = true;
        int[] in_data = Stream.of(astr).mapToInt(x -> {
            try {
                return Integer.parseInt(x);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return 0;
        }).toArray();
        sc.close();
        int a = in_data[0];
        int b = in_data[1];
        int c = in_data[2];

        int tmp = a - b;
        int ans = c - tmp;

        if(ans <= 0){
            System.out.println("0");
        }else{
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 26704
#include <iostream>
#include <vector>
#include <stdlib.h>
using namespace std;
const int INF = 1<<28;
struct Vec{
  double x;
  double y;
};
vector<string> split(const string &str, char delim){
  vector<string> res;
  size_t current = 0, found;
  while((found = str.find_first_of(delim, current)) != string::npos){
    res.push_back(string(str, current, found - current));
    current = found + 1;
  }
  res.push_back(string(str, current, str.size() - current));
  return res;
}

double cross(Vec &a,Vec &b){
  return a.x*b.y - a.y*b.x;
}
bool cal(int p,vector<double> &val){
  int np = p;
  int cnt = 0;
  vector<double> ans(3);
  while(cnt < 3){
    np++;
    np %=4;
    int nnp = (np+1)%4;
    if(cnt==2)nnp = (nnp+1)%4;
    Vec a;
    a.x = val[nnp*2] - val[np*2];
    a.y = val[nnp*2+1] - val[np*2+1];
    Vec b;
    b.x = val[p*2] - val[np*2];
    b.y = val[p*2+1] - val[np*2+1];
    ans[cnt] = cross(a,b);
    cnt++;
  }

  if(ans[0] < 0 && ans[1] < 0 && ans[2] < 0)return true;
  else if(ans[0] > 0 && ans[1] > 0 && ans[2] > 0)return true;
  return false;
}
int main(){
  string str;
  while(cin >> str){
    vector<string> s_v = split(str,',');
    vector<double> val(8);
    for(int i = 0;i < 8;i++){
      val[i] = stod(s_v[i]);
    } 
    int flag = 0;
    for(int i = 0;i < 4;i++){
      if(cal(i,val))flag = 1;
    }
    if(flag)cout << "NO" << endl;
    else cout << "YES" << endl;
  }
  return 0;
}

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

const int mod=1000;
const int maxn=1e5+10;
ll x;
int main()
{
    scanf("%lld", &x);
    for ( ll i = -130; i <= 130; i++  ) 
	{
        for ( ll j = -130; j <= 130; j++ ) 
		{
            ll u = i * i * i * i * i, v = j * j * j * j * j;
            if( u -v==x ) 
			{
                printf("%lld %lld\n", i, j);
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3828
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int a, b, c, d;
int main() {
    cin >> a >> b >> c >> d;
    cout << max(0, min(b, d) - max(a, c)) << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
using namespace std;

int main() {
  int N; cin >> N;
  map<string, int> mp;
  for(int i = 0; i < N; i++) {
    string s; cin >> s;
    mp[s]++;
  }

  int max_cnt = 0;
  for(const auto& x : mp) {
    int v = x.second;
    if(v > max_cnt) max_cnt = v;
  }

  for(auto it = mp.begin(); it != mp.end(); it++) {
    if(it->second == max_cnt) {
      cout << it->first << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 25216
def ispossible(a):
    d = [a[i] - a[i-1] for i in range(1, len(a))]
    return not 1 in d


def main():
    N, M = map(int, input().split())
    a = [int(input()) for _ in range(M)]

    MOD = 10**9+7

    if not ispossible(a):
        print(0)
        return

    s = [1] * (N+1)

    a = set(a)

    for i in a:
        s[i] = -1

    for i in range(2, N+1):
        if i in a:
            continue

        s[i] = 0
        if i-1 not in a:
            s[i] += s[i-1] % MOD
        if i-2 not in a:
            s[i] += s[i-2] % MOD
        # print(s[:i+1])

    print(s[N] % MOD)


if __name__ == '__main__':
    main()

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

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

  ll ans = 1;
  for (int i = 0; i < n; i++) {
    ans = lcm(ans, t[i]);
  }

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


Measured memory_bytes: 3620
a = list(map(int,input().split()))
a = a + list(map(int,input().split()))
a = a + list(map(int,input().split()))

n = int(input())
call = [int(input()) for i in range(n)]

for i in call:
	if i in a:
		a[a.index(i)] = 0

ans = 'No'

if a[0] == 0:
	if a[1] == 0 and a[2] == 0:
		ans = 'Yes'
	if a[3] == 0 and a[6] == 0:
		ans = 'Yes'
	if a[4] == 0 and a[8] == 0:
		ans = 'Yes'
if a[1] == 0:
	if a[4] == 0 and a[7] == 0:
		ans = 'Yes'
if a[2] == 0:
	if a[5] == 0 and  a[8] == 0:
		ans = 'Yes'
	if a[4] == 0 and a[6] == 0:
		ans = 'Yes'
if a[3] == 0:
	if a[4] == 0 and a[5] == 0:
		ans = 'Yes'
if a[6] == 0:
	if a[7] == 0 and a[8] == 0:
		ans = 'Yes'
		
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define N 100
#define LL long long 
#define mp make_pair
#define pb push_back
#define ppb pop_back
using namespace std;
LL int n,cnt,q,k;
int main()
{
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);
	cin>>n;
	if(n<10)
	{
		cout<<n;
		return 0;
	}
	int t=n;
	while(t>10)
	{
		t=t/10;
		cnt++;		
	}
	q=n-pow(10,cnt);
	int sum=1;
	//~ cout<<q;		

	while(q)
	{
		k=q%10;
		sum+=k;
		q=q/10;
	} 
	cout<<sum;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define maxn 100000

int main(){
	Fio;
	int t=1;
	//cin >> t;
	while(t--){
		int n;
		cin >> n;
		int a[n][3], ans[n][3];

		for (int i = 0; i < n; ++i)
		{
			cin >> a[i][0] >> a[i][1] >> a[i][2];
		}

		ans[0][0] = a[0][0];
		ans[0][1] = a[0][1];
		ans[0][2] = a[0][2];

		for (int i = 1; i < n; ++i)
		{
			ans[i][0] = a[i][0] + max(ans[i-1][1], ans[i-1][2]);
			ans[i][1] = a[i][1] + max(ans[i-1][0], ans[i-1][2]);
			ans[i][2] = a[i][2] + max(ans[i-1][0], ans[i-1][1]);
		}

		cout << max({ans[n-1][0], ans[n-1][1], ans[n-1][2]});
	}

	return 0;
}

Measured memory_bytes: 2560
stack = []

for v in input().split():
    if v == '+':
        n2 = stack.pop()
        n1 = stack.pop()
        stack.append(n1 + n2)
    elif v == '-':
        n2 = stack.pop()
        n1 = stack.pop()
        stack.append(n1 - n2)
    elif v == '*':
        n2 = stack.pop()
        n1 = stack.pop()
        stack.append(n1 * n2)
    else:
        stack.append(int(v))

ans = stack.pop()
print(ans)


Measured memory_bytes: 5592