akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void) {
    int W, H;
    int w, h;
    while (1)
    {
        scanf("%d%d", &W, &H);
        if (W == 0 && H == 0) break;
        for (w = 0; w < W; w++) {
            for (h = 0; h < H; h++)
            printf("#");
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2088
import sys
sys.setrecursionlimit(sys.getrecursionlimit()*1000)

input = sys.stdin.readline
N = int(input())
tree = [[] for _ in range(N+1)]
for _ in range(N-1):
    a, b = map(int,input().split())
    tree[a].append((b,1))
    tree[b].append((a,1))

depth = [None]*(N+1)
def DFS(v,p,d):
    depth[v] = d
    for e in tree[v]:
        if e[0] != p:
            DFS(e[0], v, d + e[1])
DFS(1,0,0)

depthN = [None]*(N+1)
def DFSN(v,p,d):
    depthN[v] = d
    for e in tree[v]:
        if e[0] != p:
            DFSN(e[0], v, d + e[1])
DFSN(N,0,0)

black = 0
for i in range(1,N):
    if depth[i] <= depthN[i]:
        black += 1

if black > N/2:
    print("Fennec")
else:
    print("Snuke")



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

int main() {
  int N, K, i;
  string S;
  cin >> N >> S >> K;

  for(i = 0; i < S.size(); i++){
    if(S.at(i) != S.at(K - 1)){
    S.at(i) = '*';
    }
  }

  cout << S << endl;
}


Measured memory_bytes: 256
import java.util.*;

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

        int N = sc.nextInt();
        int T = sc.nextInt();

        int time = 0;
        int start_time = -1;
        int stop_time = -1;
        for (int i = 0; i < N; ++i)
        {
            int t = sc.nextInt();
            if (t > stop_time)
            {
                time += stop_time - start_time;

                start_time = t;
                stop_time = t + T;
            }
            else
            {
                stop_time = t + T;
            }
        }
        time += stop_time - start_time;
        System.out.println(time);
    }
}


Measured memory_bytes: 63784
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <iomanip>
#include <unordered_map>
#include <string>
#include <unordered_set>
using namespace std;
typedef long long ll;
const int N = 110;
int snuke[N];
int n, k, d, a;
int main() {
    cin >> n >> k;
    for(int i = 1; i <= k ; i ++) {
        cin >> d;
        for(int j = 1; j <=d ; j ++) {
            cin >> a;
            snuke[a] = i;
        }
    }
    int cnt = 0;
    for(int i = 1; i <= n; i ++){
        if(snuke[i] == 0) cnt ++;
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

lli gcd(lli a, lli b){
	if(b==0) return a;
	if(a < b) swap(a,b);
	return gcd(b,a%b);
}

int main(){
	lli n,x;
	cin >> n >> x;
	cout << 3*(n-gcd(n,x)) << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long 
#define LLU long long unsigned
#define rarr(arr, n) for(int aab = 0; aab < n; aab++){cin >> arr[aab];}
#define parr(arr, n) for(int aab = 0; aab < n; aab++){cout << arr[aab] << " ";}
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n";

#define freopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);ios_base::sync_with_stdio(0);cin.tie(0);

int main(){	
	long long int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	long long int aa[a], bb[b], cc[c];
	rarr(aa, a);
	rarr(bb, b);
	rarr(cc, c);
	sort(aa, aa + a, greater<>()), sort(bb, bb + b, greater<>());
	vector<long long int> v1;
	for(int i = 0; i < x; i++) v1.pb(aa[i]);
	for(int i = 0; i < y; i++) v1.pb(bb[i]);
	for(int i = 0; i < c; i++) v1.pb(cc[i]);
	sort(all(v1), greater<>());
	long long int ans = 0;
	for(int i = 0; i < x + y; i++) ans += v1[i];
	cout << ans;
}


Measured memory_bytes: 9712
#include<iostream>
using namespace std;
int main() {
	string s;
	string sr;
	int cnt = 0;
	int j = 0;
	cin >> s;
	char temp;
	while (s[cnt] != '\0') {
		cnt++;
	}
	sr = s;
	for (int i = 0; i < cnt/2; i++) {
		temp = sr[i];
		sr[i] = sr[cnt-i-1];
		sr[cnt - i-1] = temp;
	}
	for (int i = 0; i <= cnt; i++) {
		if (sr[i] != s[i]) {
			j++;
		}
	}
	cout << j/2;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long double N, ABCDE[5];
    cin >> N >> ABCDE[0] >> ABCDE[1] >> ABCDE[2] >> ABCDE[3] >> ABCDE[4];

    ll max_n = 0;
    REP(i, 5) {
        long double current = ceil(N / ABCDE[i]);
        debug(ABCDE[i], current);
        if (current > max_n) max_n = current;
    }
    cout << max_n + 4 << endl;

    return 0;
}


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

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, a, b, c, d, i;
	bool prior;
	char s[200010];
	cin >> n >> a >> b >> c >> d;
	a--; b--; c--; d--;
	cin >> s;
	s[a] = '#', s[b] = '#';
	prior = (c < d);
	while (a < c or b < d) {
		if (prior) {
			if (b < d) {
				if (s[b + 1] == '.') {
					s[b] = '.'; b++; s[b] = '#';
				} else if (s[b + 2] == '.') {
					s[b] = '.'; b += 2; s[b] = '#';
				} else 
					break;
			} else if (a < c) {
				if (s[a + 1] == '.') {
					s[a] = '.'; a++; s[a] = '#';
				} else if (s[a + 2] == '.') {
					s[a] = '.'; a += 2; s[a] = '#';
				} else 
					break;
			} else
				break;
		} else {
			if (a < c) {
				if (s[a + 1] == '.') {
					s[a] = '.'; a++; s[a] = '#';
				} else if (s[a + 2] == '.') {
					s[a] = '.'; a += 2; s[a] = '#';
				} else if (b < d and s[b + 1] == '.') {
					s[b] = '.'; b++; s[b] = '#';
				} else if (b < d - 1 and s[b + 2] == '.') {
					s[b] = '.'; b += 2; s[b] = '#';
				} else
					break;
			} else if (b < d) {
				if (s[b + 1] == '.') {
					s[b] = '.'; b++; s[b] = '#';
				} else if (s[b + 2] == '.') {
					s[b] = '.'; b += 2; s[b] = '#';
				} else 
					break;
			} else
				break;
		}
	}
	cout << (a == c and b == d ? "Yes" : "No") << "\n";
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define read(x) scanf("%d",&x);
#define readll(x) cin>>x;
#define FOR(x,a,b) for(int x=a;x<b;x++)
#define MP make_pair
#define PB push_back
#define pii pair<int,int>
#define readN(N,X) for(int i=0;i<N;i++) cin>>X[i];
#define pff pair<double,double>
using namespace std;

long long fastpow(int a, int b, int MOD)
{
    long long x=1,y=a; 
    while(b > 0)
    {
        if(b%2 == 1)
        {
            x=(x*y) % MOD;
        }
        y = (y*y) % MOD;
        b /= 2;
    }
    return x;
}

long long InverseEuler(int n, int MOD)
{
    return fastpow(n,MOD-2,MOD);
}
 
long long f[300000];
bool init;
long long C(int n, int r, int MOD)
{
    if (!init){
        init=1;
        f[0]=1;
        for (int i=1; i<300000;i++)
            f[i]= (f[i-1]*i) % MOD;
        
    }
    return (f[n]*((InverseEuler(f[r], MOD) * InverseEuler(f[n-r], MOD)) % MOD)) % MOD;
}


int N;
int a[100005];
int ct[333333];
int main(){
   std::ios::sync_with_stdio(false); 


   cin>>N;
   readN(N,a);
   FOR(i,0,N){
    a[i]+=10;
    ct[a[i]]++;
    ct[a[i]-1]++;
    ct[a[i]+1]++;
   }
   int best=1;
   FOR(i,0,300000)
    best = max(best, ct[i]);

    cout<<best<<endl;


}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007


int main() {
	int N; cin >> N;
	string s; cin >> s;
	string t; cin >> t;
	int maxsub = 0;
	for (int i = 0; i < N; i++) {
		bool clf = true;
		for (int k = i; k < N; k++) {
			if (s[k] != t[k-i])clf = false;
		}
		if (clf)maxsub = max(maxsub, N-i);
	}
	print(2 * N - maxsub);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    int ans=0;
    for(int i=0;i<n;i++){
        char c;
        cin>>c;
        if(c=='Y')
            ans=1;
    }
    if(ans)
        cout<<"Four"<<endl;
    else
        cout<<"Three"<<endl;
    return 0;
}


Measured memory_bytes: 3632
mod = 10**9 + 7

def iip(listed = False):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        #print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

def power(n, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p//2) ** 2) % mod
    if p % 2 == 1:
        return (n * power(n, p-1)) % mod

#####################################################ライブラリ集ここまで

def main():
    X, Y, A, B, C = iip()
    p = iip(listed=True)
    p.extend([0 for i in range(10**6)])
    q = iip(listed=True)
    q.extend([0 for i in range(10**6)])
    r = iip(listed=True)

    p.sort(reverse=True)
    q.sort(reverse=True)
    r.sort(reverse=True)

    red = p[:X]
    blue = q[:Y]
    red.sort()
    blue.sort()

    ir = 0
    ib = 0
    for nocolor in r:
        if min(red[ir], blue[ib]) < nocolor:
            if red[ir] < blue[ib]:
                red[ir] = nocolor
                if ir <= len(red)-2:
                    ir += 1
            else:
                blue[ib] = nocolor
                if ib <= len(blue)-2:
                    ib +=1
        else:
            break

    print(sum(red)+sum(blue))



    pass

if __name__ == "__main__":
    main()

Measured memory_bytes: 129248
import java.util.Scanner;
public class Main {

	public static int I(char a,char b) {
		if(a==b) {
			return 1;
		}
		return 0;
	}
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan=new Scanner(System.in);
		String str=scan.next();
		int ans=0;
		ans+=I(str.charAt(0),'C');
		ans+=I(str.charAt(1),'O');
		ans+=I(str.charAt(2),'D');
		ans+=I(str.charAt(3),'E');
		ans+=I(str.charAt(4),'F');
		ans+=I(str.charAt(5),'E');
		ans+=I(str.charAt(6),'S');
		ans+=I(str.charAt(7),'T');
		ans+=I(str.charAt(8),'I');
		ans+=I(str.charAt(9),'V');
		ans+=I(str.charAt(10),'A');
		ans+=I(str.charAt(11),'L');
		ans+=I(str.charAt(12),'2');
		ans+=I(str.charAt(13),'0');
		ans+=I(str.charAt(14),'1');
		ans+=I(str.charAt(15),'6');
		System.out.println(16-ans);
	}

}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#define NewNode (ListNode *)malloc(sizeof(ListNode))
#define Mem(a,b) memset(a,b,sizeof(a))
const int N = 4e5 + 5;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-10;
const unsigned long long mod = 998244353;
const double II = 3.1415926535;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> piil;
int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int n,k,sum = 0;
    cin >> n >> k;
    int vis[n+5] = {0};
    while(k--)
    {
        int d;
        cin >> d;
        while(d--)
        {
            int a;
            cin >> a;
            vis[a] = 1;
        }
    }
    for(int i = 1;i <= n;i++)
        if(!vis[i])
            sum++;
    cout << sum << endl;
}

Measured memory_bytes: 3608
# 入力
N=int(input())

# 最大回数
c=0

# 最大回数時の整数（初期値は0回である1とする）
a=1

for x in range(1,N+1):
  _c=0
  _x=x
  while True:
    if _x%2==0:
      _x//=2
      _c+=1
    else:
      if c<_c:
        c=_c
        a=x
      break

# 出力
print(a)

Measured memory_bytes: 2940
from heapq import heappush, heappop
N,M = [int(x) for x in input().split()]
A = sorted([-int(x) for x in input().split()])
for _ in range(M):
    # 最大の要素取り出し
    x = -heappop(A)
    x = x//2
    heappush(A, -x)
print(-sum(A))

Measured memory_bytes: 14244
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s, t;
    int ans=0;
    cin >> s >> t;
    if(s[0]==t[0]) ans++;
    if(s[1]==t[1]) ans++;
    if(s[2]==t[2]) ans++;
    cout << ans <<endl;
    return 0;

}

Measured memory_bytes: 256
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

signed main()
{
    int S = 0;
    int N, K, d;
    cin >> N >> K;
    vector<int> sunuke(N, 0);
    REP(i, K) {
        cin >> d;
        REP(j, d){
            int t;
            cin >> t;
            sunuke[t-1] = sunuke[t-1]+1;
        }
    }
    int A = 0;
    REP(i, N){
        if(sunuke[i] == 0){
            A++;
        }
    }
    cout << A << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, s=0;
  cin >> n;
  vector<int> w(n),t(n);
  for (int i=0;i<n;i++){
    cin >> w[i];
  }
  for (int i=0;i<n;i++){
    s+=w[i];
  }
  t[0]=w[0];
  for (int i=1;i<n;i++){
    t[i]=w[i]+t[i-1];
    if(t[i-1]<s/2&&t[i]>=s/2){
      cout << min(abs(t[i-1]*2-s),abs(2*t[i]-s)) << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef pair<pii,int> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
vector<pii> mov = {{1,0},{-1,0},{0,1},{0,-1}};
const Double inf = 100000000.0;
int main(){__
	int n,m,k;
	cin >> n >>m >> k;
	int xs,ys,xf,yf;
	cin >> xs >> ys >> xf >> yf;
	vector<vector<bool>> a(n+1,vector<bool>(m+1));
	vector<vector<vector<Double>>> dist(n+1,vector<vector<Double>>(m+1,vector<Double>(2,inf)));
	for(int i=1; i <=n; i++){
		for(int j=1; j <=m; j++){
			char c;
			cin >> c;
			if(c == '.') a[i][j] = true;
		}
	}
	Double div = 1.0/Double(k);
	dist[xs][ys][0] = dist[xs][ys][1] = 0.0;
	priority_queue<pair<Double,iii>> q;
	for(auto e : mov){
		int f = (e.se!= 0) ? 1 : 0;
		int x = xs + e.fi, y = ys+e.se;
		if(x >=1 && x <= n && y >= 1 && y <= m){
			if(a[x][y]){
				dist[x][y][f] =  div;
				q.push(pair<Double,iii>(-dist[x][y][f],iii(pii(x,y),f)));
			}
		}
	}
	//meto og
	//f = 1 de izq a der o der a izq
	// al cambio de direccion viene el ceil
	while(!q.empty()){
		int xa = q.top().se.fi.fi;
		int ya = q.top().se.fi.se;
		Double d = -q.top().fi;
		int of = q.top().se.se;
		q.pop();
		if(d != dist[xa][ya][of]) continue;
		//movi
		for(auto e : mov){
			int x = xa+e.fi, y = ya+e.se;
			int f= (e.se != 0) ? 1 : 0;
			if(x >=1 && x<=n && y>=1 && y<=m && a[x][y]){
				Double currd = dist[xa][ya][of];
				if(f != of) currd = ceil(currd);
				if(currd+div < dist[x][y][f]){
					dist[x][y][f] = currd+div;
					q.push(pair<Double,iii>(-dist[x][y][f],iii(pii(x,y),f)));
				}
			}
		}
	}
	/*
	cout << "distancias\n";
	for(int i=1; i <=n; i++){
		for(int j=1; j <=m; j++){
			if(dist[i][j]== inf){
				cout << "oooo ";
				continue;
			}
			cout << fixed << setprecision(4) << dist[i][j] << " ";
		}
		cout << endl;
	}
	*/
	//al final ceil al resultado
	Double mini = min(dist[xf][yf][0],dist[xf][yf][1]);
	if(mini == inf){
		cout << -1 << endl;
	}
	else{
		cout << ceil(mini) << endl;
	}
	return 0;
}


Measured memory_bytes: 214360
// Last Change: 02/16/2019 21:01:07.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

int main() {
  int A, B;
  cin >> A >> B;
  if (B % A == 0) {
    cout << A + B << endl;
  } else {
    cout << B - A << endl;
  }

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr ll mod = 1e9+7;
constexpr ll md = mod;
constexpr ll inf = 1e15;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    ll sum = 0;
    for(auto & a : v) cin>>a;
    for(int a = 0; a <=min(n,k);++a){
        for(int b=0;b + a <= min(n,k);++b){
            int sub = k - (b+a);
            ll tmp = 0;
            vector<int> minus;
            for(int i=0;i<a;++i){ tmp+=v[i];if(v[i] <0 ) minus.push_back(v[i]);}
            for(int i=n-1;i+b>n-1;i--){tmp+=v[i];if(v[i] < 0) minus.push_back(v[i]);}
            sort(minus.begin(),minus.end());
            for(int i=0,n = min(sub,(int)minus.size());i<n;++i)tmp-=minus[i];
            sum = max(sum,tmp);
        }
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;

int main ()
{
  prep();
  int n, q;
  cin >> n >> q;
  int arr[n];
  long long evens[n] = {0};
  long long sum[n] = {0};
  for (int i=0; i<n; i++){
      cin >> arr[i];
      sum[i] = arr[i];
      if (i%2== 0){
          evens[i] = (i-1 >= 0 ? arr[i]+evens[i-1] : arr[i]);
      }else{
          evens[i] = evens[i-1];
      }
      sum[i] = (i-1 >= 0 ? arr[i]+sum[i-1] : arr[i]);
  }
 
  for (int i=0; i<q; i++){
      int xx;
      cin >> xx;
      int l = 1;
      int r = n/2+n%2;
      int lastgood = 0;
      while (l <= r){
          int mid = (l+r)/2;
          int below = -1000000001;
          if (n-mid*2-1 >= 0){
              below = arr[n-mid*2-1];
          }
          if (max(xx-below, 0) <= max(arr[n-mid-1]-xx, 0)){
              l = mid+1;
          }else{
              r = mid-1;
              lastgood = mid;
          }
      }
      //cout << lastgood << endl;
      long long res = sum[n-1]-sum[n-1-lastgood];
      if (n%2 == 0 && n-lastgood*2-1 >= 0){
          res += sum[n-lastgood*2-1]-evens[n-lastgood*2-1];
      }else if (n-lastgood*2-1 >= 0){
          res += evens[n-lastgood*2-1];
      }
      cout << res << '\n';
  }
  return 0; 
}


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

const long long N = 3e6 + 17;
ll a[N], b[N], cnt = 1, ans, lnt, n, m, r1, r0, l1, l0, sum, mx, h, c[N], t[N], mn = N, x, y, k;
pair<ll,ll>pr[N];
vector<ll>v,v2;
map<ll,ll>mp;
bool used[N];
char ch[N];
ll prime[N] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n >>m >> k;
    if(m / n > k)
    {
        cout << k;
        return 0;
    }
        ans = m / n;
    cout << ans;
}


Measured memory_bytes: 6400
def main():
    N = int(input())
    a = [int(i) for i in input().split()]

    multi_2 = 0
    multi_4 = 0
    
    for num in a:
        if(num % 2 == 0):
            if(num % 4 == 0):
                multi_4 += 1
            else:
                multi_2 += 1
    
    #print(multi_2)
    #print(multi_4)
    pair_2 = int(multi_2 / 2)
    #print(pair_2)
    permitrange = 3 + (multi_4 - 1) * 2 + pair_2 * 2
    #print(permitrange)
    if(N <= permitrange):
        print("Yes")
    else:
        print("No")
    
if __name__=="__main__":
    main()

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=2005,M=N*N+N+N,P=1e9+7;

int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }

int n,k,f[N][N],fac[M],inv[M];

int C(int n,int m){
	if(m<0||m>n)return 0;
	return mul(fac[n],mul(inv[m],inv[n-m])); 
}

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	fac[0]=1; lop(i,1,M)fac[i]=mul(fac[i-1],i); 
	inv[1]=1; lop(i,2,M)inv[i]=mul(P-P/i,inv[P%i]);
	inv[0]=1; lop(i,1,M)inv[i]=mul(inv[i-1],inv[i]); 

	cin>>n>>k;	
	if(--k==0){
		puts("1"); 
		return 0; 
	}
	f[0][0]=1;
	rep(i,0,n)rep(j,i,n){
		if(i+1<=n)f[i+1][j]=add(f[i+1][j],f[i][j]); 	
		if(j+1<=n)f[i][j+1]=add(f[i][j+1],mul(f[i][j],C(k-1+j*k+i+1-1,j*k+i+1-1)));
		//Pr("f[%d][%d]=%d\n",i,j,f[i][j]); 
	}
	printf("%d\n",mul(f[n][n],fac[n]));
	return 0;
}

Measured memory_bytes: 47488
#include <iostream>
#include <map>

using namespace std;

const int MAX_N = 1e5 + 5;

int arr [MAX_N];

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

  map<int, int> compr;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    compr[arr[i]] = 0;
  }

  int cur = 0;
  for (auto it = compr.begin(); it != compr.end(); it++) {
    it->second = cur;
    cur++;
  }

  for (int i = 0; i < n; i++) {
    arr[i] = compr[arr[i]];
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] % 2 != i % 2) {
      ans++;
    }
  }
  cout << ans / 2 << endl;
}


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

int main() {
	ll n, m; cin >> n >> m;

	if (n == 1 && m == 1) cout << 1 << endl;
	else if (n == 1 || m == 1) cout << n * m - 2 << endl;
	else if (n > 2 && m > 2) cout << (n - 2) * (m - 2) << endl;
	else cout << 0 << endl;

	return 0;
}

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

using namespace std;

#define ll long long

#define DEBUG (0)

int main()
{
    ll N = 0, M = 0;
    cin >> N >> M;

    vector<ll> H(N,0);
    vector<ll> ans(N,0);
    
    for(ll i = 0; i < N; i++){
        cin >> H[i];
    }

    ll A = 0, B = 0;
    for(ll i = 0; i < M; i++){
        cin >> A >> B;
        A--;
        B--;
        if(H[A] < H[B]){
            ans[A] = 1;
        }else if(H[A] > H[B]){
            ans[B] = 1;
        }else{
            ans[A] = 1;
            ans[B] = 1;
        }
    }

    ll count = 0;
    for(ll i = 0; i < N; i++){
        if(ans[i] == 0){
            count++;
        }
    }

    cout << count << endl;

#if DEBUG
    for (ll i = 0; i < N; i++)
    {
        cout << ans[i] << " ";
    }
    cout << endl;    
#endif    
}


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

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

int main(){
	ll a,b,k;
	cin>>a>>b>>k;

	if(a+b<=k){
		cout<<0<<' '<<0<<endl;
		return 0;
	}

	if(a>=k){
		a-=k;
	}else{
		k-=a;
		a=0;
		if(b>=k){
			b-=k;
		}else{
			b=0;
		}
	}

	cout<<a<<' '<<b<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=100000 +117;
const int MM=100000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
struct edge{
	int id,to;
	edge(int i_=0,int t_=0){
		id=i_,to=t_;
	}
};
bool vis[NN]={};
vector<edge> p[NN]={};
int hd[NN]={};
int ans[NN]={};
int acnt=0;
int st[NN]={},top=0;
bool inq[NN]={};
void dfs(int x){
	for(int &i=hd[x];i<p[x].size();++i){
		int cur=p[x][i].to;
		if(!vis[p[x][i].id]){
			vis[p[x][i].id]=1;
			dfs(cur);
		}
	}
	ans[++acnt]=x;
}
int deg[NN]={};
int main(){
	//open();
	n=read();
	m=read();
	for(int i=1;i<=m;++i){
		int x=read(),y=read();
		p[x].push_back(edge(i,y));
		p[y].push_back(edge(i,x));
		deg[x]++;
		deg[y]++;
	}
	int cnt6=0,cnt4=0;
	for(int i=1;i<=n;++i){
		if(deg[i]&1){
			printf("No\n");
			return 0;
		}
		if(deg[i]==6)cnt6++;
		if(deg[i]==4)cnt4++;
	}
	if(cnt6>=1||cnt4>=3){
		printf("Yes\n");
		return 0;
	}
	dfs(1);
	int cir=0;
	for(int i=1;i<=acnt;++i){
		int x=ans[i];
		if(!inq[x]){
			inq[x]=1;
			st[top++]=x;
		}
		else{
			++cir;
			while(st[top-1]!=x){
				inq[st[--top]]=0;
			}
		}
	}
	if(cir>=3){
		printf("Yes\n");
	}
	else printf("No\n");
	close();
	return 0;
}

Measured memory_bytes: 12032
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>

using namespace std;

typedef long double ld;

class Point {
public:
	ld x, y;
	Point(ld x, ld y) :
			x(x), y(y) {
	}
	Point operator +(Point p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator -(Point p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator *(ld a) {
		return Point(x * a, y * a);
	}
};

class Segment {
public:
	Point p1, p2;
	Segment(Point p1, Point p2) :
			p1(p1), p2(p2) {
	}
};
ld cross(Point p1, Point p2) {
	return p1.x * p2.y - p1.y * p2.x;
}
ld norm(Point p) {
	return p.x * p.x + p.y * p.y;
}
ld abs(Point p) {
	return sqrt(norm(p));
}

Point getCrossPoint(Segment s1, Segment s2) {
	Point base = s2.p2 - s2.p1;
	ld d1 = abs(cross(base, s1.p1 - s2.p1));
	ld d2 = abs(cross(base, s1.p2 - s2.p1));
	ld t = d1 / (d1 + d2);
	return s1.p1 + (s1.p2 - s1.p1) * t;
}

int main() {

	int q;
	scanf("%d", &q);

	for (int i = 0; i < q; ++i) {
		int p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y;
		scanf("%d %d %d %d %d %d %d %d", &p0x, &p0y, &p1x, &p1y, &p2x, &p2y, &p3x, &p3y);
		Point p1(p0x, p0y);
		Point p2(p1x, p1y);
		Point p3(p2x, p2y);
		Point p4(p3x, p3y);
		Segment s1(p1, p2);
		Segment s2(p3, p4);

		Point ans = getCrossPoint(s1, s2);
		cout << fixed << setprecision(10) << ans.x << " " << ans.y << endl;

	}
	return 0;
}

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

int main(){
    int N;
    cin >> N;
  if (N % 1000 == 0) cout << 0 << endl;
  else cout << 1000 - (N % 1000) << endl;
}


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

using namespace std;
bool bmap[10][10];
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
void blow(int x,int y){
  bmap[y][x] = false;
  for(int i=0;i<4;i++){    
    for(int j=1;j<=3;j++){
      int nx = x+dx[i]*j,ny = y+dy[i]*j;
      if(0<=nx &&nx<8 && 0<=ny && ny<8){
	if(bmap[ny][nx]){
	  blow(nx,ny);
bmap[ny][nx] = false;
	}
      }
    }
  }

}

void display(){
  for(int i=0;i<8;i++){
    for(int j=0;j<8;j++){
      cout << bmap[i][j];
    }
    cout << endl;
  }
}


int main(){
  int T,xs,ys,NARI=1;
  cin >> T;
  string s;
  while(T-->0){
    for(int i=0;i<8;i++){
      cin >> s;
      for(int j=0;j<8;j++){
	if(s[j] == '0')bmap[i][j] = false;
	else bmap[i][j] = true;
      }
    }
    cin >> xs >> ys;
    xs-=1;ys-=1;
    blow(xs,ys);
    cout << "Data " << NARI++ << ":" << endl; 
    display();
  }
  return 0;
}

Measured memory_bytes: 1204
#include <atcoder/dsu>
#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, q;
  scanf("%d %d", &n, &q);

  atcoder::dsu dsu(n);
  while (q--) {
    int t, u, v;
    scanf("%d %d %d", &t, &u, &v);

    if (t == 0) {
      dsu.merge(u, v);
    } else if (t == 1) {
      printf("%d\n", (int) dsu.same(u, v));
    }
  }  
  return 0;
}


Measured memory_bytes: 3948
#include<bits/stdc++.h> 
#define Re register
#define fo(i, a, b) for (Re int i = (a); i <= (b); ++i)
#define fd(i, a, b) for (Re int i = (a); i >= (b); --i)
#define edge(i, u) for (Re int i = head[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define pb push_back
#define F first
#define S second
#define ll long long
#define inf 10000000000007
#define mp std::make_pair
#define lowbit(x) (x & -x)
#define eps 1e-4
#define itset std::set<node>::iterator
#define lb lower_bound
#define N 55
#define ls (k << 1)
#define rs (k << 1 | 1)
#define M 260
int f[N][N][N][N], a[N][N], b[N][N], ans, n;
int main ()
{
    scanf("%d", &n);
    if (n == 5 || n == 3 || n == 7)
        printf("YES");
    else
        printf("NO");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int num[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
bool uru(int checkyear){if(checkyear%4==0){if(checkyear%100!=0||checkyear%400==0)return true;}return false;}
int gcd( int x, int y ){return y ? gcd(y, x%y) : x;}
signed main() {
    int x=0,y=0,z=0,w=0,n=0,m=0;
char a,b;
cin >>a>>b;
if(a=='H'){
    if(b=='H')cout <<'H';
    else cout << 'D';
}else {
    if(b=='H')cout << 'D';
    else cout << 'H';
}
}

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

//各桁の和を求める関数
int digitSum(int n)
{
  int sum = 0;
  while(n > 0)
  {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main()
{
  int N; cin >> N;
  int min = 100000;
  rep(a,N)
  {
    int b = N - a;
    if(b > 0 && digitSum(a)+digitSum(b) < min)
      min = digitSum(a)+digitSum(b);
  }
  cout << min << endl;
}

Measured memory_bytes: 256
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　| 　_　 _ l
　 　　　／` ミ＿xノ    見ちゃだめ！
　　 　 /　　　 　 |　
　　　 /　 ヽ　　 ﾉ　　
　 　 │　　|　|　|　　
　／￣|　　 |　|　|
　| (￣ヽ＿_ヽ_)__)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;

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 n;
  cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  vector<ll> dp(n + 1, INF);

  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
    chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
  }
  cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1408
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
using namespace std;
using ll = long long;

int main() {
    string s; cin >> s;
    int N = s.size();
    stack<char> st;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (st.empty()) {
            st.push(s[i]);
        }
        else {
            char bef = st.top();

            if (bef == '0' && s[i] == '1') {
                st.pop();
                cnt += 2;
                continue;
            }

            if (bef == '1' && s[i] == '0') {
                st.pop();
                cnt += 2;
                continue;
            }

            st.push(s[i]);
        }
    }

    cout << cnt << endl;
    sysp;
}

Measured memory_bytes: 3864
s = input()
k = int(input())

#正解(全列挙してソートしてる)
sub_string=[]
for i in range(len(s)):
  for j in range(1,k+1):
    string = s[i:i+j]
    if string not in sub_string:
      sub_string.append(string)
sub_string.sort()
print(sub_string[k-1])

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) FOR(i, 0, n)
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define FILLINF(a) memset(a, 0x3f, sizeof(a))
#define POW(n) (1LL << (n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i, a, b) ((a) <= (i) && (i) <= (b))
using namespace std;
template <typename T> inline bool CHMIN(T& a, T b) { if(a > b) { a = b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a, T b) { if(a < b) { a = b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(begin(a), end(a)); }
template <typename T> inline void REV(T& a) { reverse(begin(a), end(a)); }
template <typename T> inline void UNI(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <typename S, typename T> inline T LB(S& v, T a) { return *lower_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int LBP(S& v, T a) { return lower_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> inline T UB(S& v, T a) { return *upper_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int UBP(S& v, T a) { return upper_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> ostream& operator << (ostream& os, const pair<S, T>& p) { os << p.first << " " << p.second; return os; }
template <typename S, typename T> istream& operator >> (istream& is, pair<S, T>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator << (ostream& os, const vector<T>& v) { for (int i = 0; i < v.size(); ++i) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator >> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) { for(auto &e : t) fill_v(e, v); }
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const lint MOD = 1000000007;

void _main() {
    int X;
    cin >> X;
    int ans = 0, now = 100;
    while (now < X) {
        now = now + (int)(now * 0.01);
        ans++;
    }
    cout << ans << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("in.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("out.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 3648
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        // 主処理
        String strA = "";
        for (int i = 0; i < b; i++) {
            strA += a;
        }
        String strB = "";
        for (int i = 0; i < a; i++) {
            strB += b;
        }
        String[] array = new String[] { strA, strB };
        Arrays.sort(array);
        String result = array[0];

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    long long int l, r, ans = 2020;
    cin >> l >> r;
    if(l / 2019 < r /2019){
        cout << 0;
    }
    else{
        for(long long int i = l;i <= r;i++){
            for(long long int j = i + 1;j <= r;j++){
                if(ans > (i * j) % 2019){
                    ans = (i * j) % 2019;
                }
            }
        }

        cout << ans;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
unsigned long int goldencoins(unsigned long int);

int main(){
 
    unsigned long int n;
    cin>>n;
    cout<<goldencoins(n)<<endl;
    return 0;
}
unsigned long int goldencoins(unsigned long int n){
    if(n==0)
    return 0;
    unsigned long int sum=0;
    if(n % 10 ==0)
    return (2*n);
    while(n>500){
        sum += 1000;
        n-=500;
    }
    while(n>5){
        if(n%5==0 && n < 500){
            sum += n;
            return sum;
        }
        sum += 5;
        n-=5;
}
    return sum;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;


void solve()
{
	int n;
	cin >> n;
	printf("%.7f\n", (n + 1) / 2 / (double)n);
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3764
def checkTriangle(i, j, k)

  a = (i ** 2 + j ** 2 == k ** 2)
  b = (i ** 2 + k ** 2 == j ** 2)
  c = (j ** 2 + k ** 2 == i ** 2)

  return a | b | c

end

N = gets.to_i

inputs = Array.new(N) {|x| x = gets.split()}

for a, b, c in inputs
  puts checkTriangle(a.to_i, b.to_i, c.to_i) ? "YES" : "NO"
end

Measured memory_bytes: 6120
//BISMILLAH
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
   int a,b,c,d,minus1,minus2,res=0;
   cin>>a>>b>>c>>d;
   int count1=0,count2=0;
   while(c-b>0)
   {
       c=c-b;
       count1++;
   }
   while(a-d>0)
   {
       a=a-d;
       count2++;
   }
  // cout<<count1<<count2<<endl;

   if(count1==count2) cout<< "Yes"<<endl;
   else if(count1>count2) cout<< "No"<<endl;
   else if(count1<count2) cout<< "Yes"<<endl;

}


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

using namespace std;


int main()
{
long long temp,ans,i;
string s;
cin>>s;
for(i=0,temp=0,ans=0;i<s.size();i++)
{
    if(s[i]=='A')
    {
        temp++;
    }
    else if(s[i]=='B')
    {
        if(i+1<s.size()&&s[i+1]=='C')
        {
            ans+=temp;
            i++;
        }
        else
            temp=0;

    }else temp=0;

}
    cout<<ans;
}


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

#define ll long long
#define inf 0x3f3f3f3f 
#define il inline 

#define in1(a) a=read()
#define in2(a,b) in1(a),in1(b)
#define in3(a,b,c) in2(a,b),in1(c)
#define in4(a,b,c,d) in2(a,b),in2(c,d)
#define out(a) printf( "%d" , a ) 
#define outn(a) out(a),putchar('\n')

#define I_int int 
inline I_int read() {
	
    I_int x = 0 , f = 1 ; char c = getchar() ;
    while( c < '0' || c > '9' ) {
        if( c == '-' ) f = -1 ;
        c = getchar() ;
    }
    while( c >= '0' && c <= '9' ) {
        x = (x << 1) + (x << 3) + c - 48 ;
        c = getchar() ;
    }
    return x * f ;
}
#undef I_int

using namespace std ;

#define N 100010

char s[ N ] ;

int main() {
	scanf( "%s" , s + 1 ) ;
	int len = strlen( s+1 ) ;
	if( len == 2 ) puts( s + 1 ) ;
	else {
		for( int i = len ; i ; i -- ) putchar( s[ i ] ) ;
	}
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int K;
    cin >> K;
    queue<ll> q;
    rep2(i, 1, 10){
        q.push(i);
    }
    ll tmp;
    rep(i, K){
        tmp = q.front();
        q.pop();
        ll res = tmp % 10;
        if (res != 0){q.push(10 * tmp + (res - 1));}
        q.push(10 * tmp + res);
        if (res != 9){q.push(10 * tmp + (res + 1));}
    }
    cout << tmp << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1792
//hahaha
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
#define N 100002
using namespace std;
int n,i,a[N],b[N],c[N*2],sum[N],l=0,r,mid,ans;
int read()
{
	char c=getchar();
	int w=0;
	while(c<'0'||c>'9') c=getchar();
	while(c<='9'&&c>='0'){
		w=w*10+c-'0';
		c=getchar();
	}
	return w;
}
int lowbit(int x)
{
	return x&(-x);
}
void add(int x,int y)
{
	for(int i=x;i<=200000;i+=lowbit(i)) c[i]+=y;
}
long long ask(int x)
{
	long long ans=0;
	for(int i=x;i>=1;i-=lowbit(i)) ans+=c[i];
	return ans;
}
bool check(int x)
{
	sum[0]=100000;
	for(int i=1;i<=n;i++){
		if(a[i]>=x) sum[i]=sum[i-1]+1;
		else sum[i]=sum[i-1]-1;
	}
	memset(c,0,sizeof(c));
	long long ans=0;
	for(int i=0;i<=n;i++){
		ans+=ask(sum[i]);
		add(sum[i],1);
	}
	return (ans>=1LL*n*(n+1)/4);
}
signed main()
{
	n=read();
	for(i=1;i<=n;i++){
		a[i]=read();
		r=max(r,a[i]);
	}
	while(l<=r){
		mid=(l+r)/2;
		if(check(mid)) ans=mid,l=mid+1;
		else r=mid-1;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  ll x = 0;
  string ans = "NO";
  for(int i = 1; i <= 1000000; i++) {
    x += a;
    if(x % b == c) ans = "YES";
  }
  cout << ans << endl;
  return 0;
}

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

#define ll long long

ll gcd (ll a, ll b) {
  return a % b ? gcd(b, a% b) : b;
}
int main() {
  int N;
  ll X;
  cin >> N >> X;
  
  ll x[N];
  for (int i = 0; i < N; i++) {
    cin >> x[i];
    x[i] -= X;
    x[i] = abs(x[i]);
  }  

  ll ans = x[0];
  for (int i = 1; i < N; i++) {
    if (ans >= x[i]) {
      ans = gcd(ans, x[i]);
    } else {
      ans = gcd(x[i], ans);
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4384