akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
    string s;
    cin >> s;
    vector<int> a(4);
    for(int i =0 ; i< 4; i++){
        a[i] = s[i]-'0';
    }

    vector<char> op(3);
    for(int bit = 0; bit < (1 << 3) ; bit++){
        int tmp = a[0];
        for(int i = 0 ; i< 3; i++){
            if(bit & (1 << i)){
                tmp += a[i+1];
                op[i] = '+';
            }else{
                tmp -= a[i+1];
                op[i] = '-';
            }
        }
        if(tmp==7){
             cout << a[0] << op[0] << a[1] << op[1] << a[2] << op[2] << a[3] << "=7" << endl;
             return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,a,b;
    cin>>n>>a>>b;
    if(max(a,b)==a)swap(a,b);
    if((a-b)%2==0)
    {
        cout<<(abs(a-b))/2;
    }
    else
    {
         cout<<min(a+(b-1-a)/2,n-b+1+(b-a-1)/2)   ;
             
    }



    
}

Measured memory_bytes: 256
import math
N,W=map(int,input().split())
dp=[[math.inf for _ in range(100001)] for _ in range(N+1)]
#print(dp[-1][100000])
dp[0][0]=0
def min_(a,b):
  if a<b:
    return a
  else:
    return b
  
def nap():
  for i in range(N):
    w,v=map(int,input().split())
    for j in range(100001):
      if j-v>=0:
        #print(dp[i-1][j-w[i]])
        dp[i+1][j]=min(dp[i+1][j],dp[i][j-v]+w)
      dp[i+1][j]=min(dp[i+1][j],dp[i][j])
  ans=100000
  #print(dp[0][:4])
  while dp[-1][ans]>W:
    ans-=1
  print(ans)

nap()

Measured memory_bytes: 334588
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
typedef long long LL;
using namespace std;
LL a , b , c;
int main()
{
	while(~scanf("%lld%lld%lld" , &a , &b , &c)){
		int cont = 0;
		LL ta , tb , tc;
		bool ok = 0;
		while(cont <= 1000000){
			if(b & 1 || c & 1 || a & 1) { ok = 1; break;}
			ta = (b + c) / 2;
			tb = (a + c) / 2;
			tc = (a + b) / 2;
			a = ta;
			b = tb;
			c = tc;
			cont++;
		}
		if(ok) printf("%d\n" , cont);
		else printf("-1\n");
	}
}

Measured memory_bytes: 128
n=int(input())
alist=list(map(int,input().split()))
adic={}

for a in alist:
    if a in adic:
        adic[a]=adic[a]+1
    else:
        adic[a]=1

kumisum=0
for tmp in adic.values():
    kumisum += int(tmp*(tmp-1)/2)

for i in range(n):
    print(kumisum-(adic[alist[i]]-1))

Measured memory_bytes: 24748
import math


def get_sieve_of_eratosthenes(n):# エラトステネスのふるい(O(NloglogN)). ~nまでの素数をリストで返す.
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


Q = int(input())
ls = [0]
prime = set(get_sieve_of_eratosthenes(10**5 + 10))

output = []
for i in range(1, 10**5+1):
    if (i in prime) & (int((i+1)/2) in prime):
        ls.append(ls[i-1]+1)
    else: ls.append(ls[i-1])
#print(ls[:10])
for q in range(Q):
    l, r = map(int, input().split())
    output.append(ls[r]-ls[l-1])
print(*output, sep="\n")



Measured memory_bytes: 11164
#include <stdio.h>
#include <math.h>
 
int main() {
 
double x1,x2,y1,y2;
double x,y,z;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
 
x = (x2-x1) * (x2-x1);
y = (y2-y1) * (y2-y1);
 
printf("%.11lf",sqrt(x+y));
 
 
return 0;
 
}


Measured memory_bytes: 2096
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


#n = ip()                                     #入力整数1つ
#x,y,z= (int(i) for i in input().split())       #入力整数横2つ以上
a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しに4 3sum変数使用はsum関数使用できないので注意
a.sort()
s = 0
s+=a[2]-a[1]
a[1]+=s
a[0]+=s
#print(a)
if (a[2]-a[0])%2:
    s+=(a[2]-a[0]+1)//2+1
else :
    s+=(a[2]-a[0])//2
print(s)

Measured memory_bytes: 14364
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int dx[4] {-1,+1, 0, 0};
int dy[4] { 0, 0,-1,+1};
void init(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
int main()
{
  init();
  int k, n;  cin >> k >> n;
  vecint a(n,0); REP(i,n) cin >> a[i];
  int ans = a[n - 1] - a[0];
  for(int i = 1; i < n - 1; i ++){
    int tmp1 = k - a[i] + a[i - 1];
    int tmp2 = k - a[i + 1] + a[i];
    int tmp = min(tmp1, tmp2);
    ans = min(tmp, ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i++)
using namespace std;

int main(){
  int money,a,b;
  cin>>money>>a>>b;
  money-=a;
  while(money>=b){
    money-=b;
  }
  cout<<money<<endl;
}


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

using namespace std;

int keisan (int a) {
	if (a == 1) {
		return 2;
	} else {
		return a + keisan(a-1);
	}
}

int main() {
	int n;
	while (cin >> n) {
		cout << keisan(n) << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef ll _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
	doin();
	vi a;
	getv(a, 5);
	int k;
	cin >> k;
	sort(all(a));
	cout << (a.back()-a[0] > k ? ":(" : "Yay!");
	return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define MOD ((int)(1e9) + 7)
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define filename "lynext"
#define freop freopen(filename ".cik","w",stdout);freopen(filename ".gir","r",stdin)
const int N = ((int)1e5) + 5;
const int M = ((int)1e3) + 5;
typedef long long int lli;

float n;
float ans;

int main ()
{
	fast;
	//freop;
	cin >> n;
	ans = (((int)n / 2) + ((int)n % 2 == 1)) / n;
	cout << ans << "\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main()
{
  int n,m,i,j,k,l,ma,res=0;
  vector<int> v[26];
  string s;
  cin >> n;
  cin >> s;
  for(i=n-1;i>=0;i--)
    v[(int)(s[i]-'a')].push_back(i);
  for(i=0;i<n-1;i++){
    m=(int)(s[i]-'a');
    if(v[m].size()<2) continue;
    for(j=0;j<v[m].size()-1;j++){
      k=v[m][j];
      if(min(k-i,n-k)<=res) continue;
      if(s.substr(i,res+1)!=s.substr(k,res+1)) continue;
      res++;
      ma=min(k-i,n-k);
      if(ma==res) continue;
      l=ma;
      while(l>res){
        if(s.substr(i+res,l-res)!=s.substr(k+res,l-res)){
          ma=l-1;
          l=(l+res)/2;
        }else{
          res=l;
          l=(ma+res+1)/2;
        }
      }
    }
    v[m].pop_back();
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define PI 3.1415926535897932
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_order(long long X){
  long long ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}
int main() {
  
  int N;
  cin>>N;
  
  vector<int> L(N);
  for(int i=0;i<N;i++){
    cin>>L[i];
  }
  sort(L.begin(),L.end());
  
  int ans=0;
  
  
  for(int i=2;i<N;i++){
    for(int j=1;j<i;j++){
      for(int k=0;k<j;k++){
        if(L[i]<L[j]+L[k]){
          ans++;
        }
      }
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3632
def main():
	n = int(input())

	info = []
	for i in range(n):
		l = list(map(int, input().split()))
		info.append(l)

	for k in range(info[0][2], info[0][2] + 201):
		for i in range(101):
			for j in range(101):
				# [i][j]に高さkの頂上があった場合
				flg = 0
				for l in info:
					#print(l)
					deltax = abs(l[0] - i)
					deltay = abs(l[1] - j)
					guessh = max(k - deltax - deltay, 0)
					#print(guessh, k)
					if guessh != l[2]:
						flg = 1
						break
				#print("i,j,k,flg: ", i,j,k,flg)
				if flg == 0:
					print(i, j, k)
					return

if __name__ == '__main__':
	main()


Measured memory_bytes: 45676
k = int(input())
a = list(map(int,input().split()))
a = a[::-1]
ansmin = 2
ansmax = 2
for i in range(k):
  x = a[i]
  ansmin = x*((ansmin+x-1)//x)
  ansmax = x*(ansmax//x)+x-1
  if ansmin>ansmax:
    print(-1)
    exit()
print(ansmin,ansmax)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string str;
  cin >> str;
  
  sort(str.begin(),str.end());
  if (str.at(0)=='a' && str.at(1)=='b' && str.at(2)=='c') cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
         
        public class Main {
            static int binarySearchRightMost(int arr[],int key){
                int l=0,r=arr.length-1;
                while (l<r){
                    int mid=Math.floorDiv(l+r,2);
                    if(arr[mid]>key){
                        r=mid;
                    }
                    else{
                        l=mid+1;
                    }
                }
                return r-1;
         
            }
         
            public static void main(String[] args) {
        //        int arr[]={1,2,3,4,4,4,6,7};
        //        System.out.println(binarySearchRightMost(arr,4));
                Scanner scanner=new Scanner(System.in);
                int a=scanner.nextInt();
                int b=scanner.nextInt();
                System.out.println(a%b==0?Math.floorDiv(a,b):Math.floorDiv(a,b)+1);
            }
        }

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int n, cnt=0, sum=0, x;
    float m;
    cin >> n >> m;
    vector<int> a;
    for(int i=0; i<n; i++)
    {
        cin >> x;
        a.push_back(x);
        sum += x;
    }
    //float v = (1/(4*m))*sum;

    for(int i=0; i<n; i++)
    {
        if(a[i]>=(1/(4*m))*sum) cnt++;
    }
    if(cnt>=m) cout << "Yes" << endl;
    else cout << "No" << 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 X = sc.nextInt();

    int c500, c5;

    c500 = X / 500;
    X -= c500 * 500;
    c5 = X / 5;

    System.out.println(c500 * 1000 + c5 * 5);

  }

}

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

class Program {
  static void Main(string[] args) {
  	double[] seq = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
  	double a = seq[0];
  	double b = seq[1];
  	double rad = 2 * Math.PI * seq[2] / 360;
  	double S = a*b*Math.Sin(rad)/2;
  	double c = Math.Sqrt(a*a + b*b - 2*a*b*Math.Cos(rad));
  	Console.WriteLine(S);
  	Console.WriteLine(a+b+c);
  	Console.WriteLine(b*Math.Sin(rad));
  }
}

Measured memory_bytes: 6072
import java.util.*
import kotlin.comparisons.compareByDescending
import kotlin.comparisons.thenByDescending

fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val jobs = Array(n) {
        readLine()!!.split(" ").map { it.toInt() }.let { Job(it[0], it[1]) }
    }
    jobs.sortWith(compareByDescending<Job> { it.b }.thenByDescending { it.a })
    val set: TreeSet<Int> = TreeSet((0 until n).toList())
    var ans = 0
    jobs.forEachIndexed { index, job ->
        val insertP = m - job.a
        val ret = set.floor(insertP)
        if (ret != null) {
            set.remove(ret)
            ans += job.b
        }
    }
    println(ans)
}

class Job(val a: Int, val b: Int)

Measured memory_bytes: 75316
#include <stdio.h>
#include <iostream>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <cassert>
#include <fstream>

using namespace std;

int gcd(int a, int b) {
    while (b) {
        int c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main() {
    int n;
    cin >> n;
    long long cur1 = 0, cur2 = 0;
    for (int i = 0; i < n; ++i) {
        unsigned long long a, t;
        cin >> t >> a;
        int c = gcd(t, a);
        t /= c;
        a /= c;
        unsigned long long l = 0, r = ((1000000000000000000L / min(a, t))) + 1000;
        while (r - l > 1) {
            unsigned long long k = (l + r) / 2;
            if (t * k >= cur1 && k * a >= cur2) {
                r = k;
            } else {
                l = k;
            }
        }
        cur1 = r * t;
        cur2 = r * a;
    }
    cout << cur1 + cur2 << endl;
}

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

typedef long long ll;
 
int main(){
  int n, a, b, ans=0;
  cin >> n >> a >> b;
  for(int i=1; i<=n; i++){
    string s = to_string(i);
    int tmp=0;
    for(int j=0; j<s.length(); j++){
      tmp += s[j]-'0';
    }
    if(a<=tmp&&tmp<=b) ans+=i;
  }
  cout << ans << endl;
  return 0;
}


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

#define vi vector<int>

int main() {

    int R, G, B, N;
    cin >> R >> G >> B >> N;

    int count = 0;
    int sum;
    for (int r = 0; r*R<=N; r++) {
        for (int g = 0; r*R + g*G <= N; g++) {
            sum = r * R + g * G;
            if (N - sum >= 0 &&  (N - sum)%B == 0) count++;
        }
    }

    cout << count << endl;

    return 0;
}


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

using namespace std;

int main(void){

  string g;
  int y,m,d;

  while(cin >> g){

    if(g=="#")
      break;

    cin >> y >> m >> d;

    if(y > 31){
      y=y-30;
      g="?";
    }

    else if(y==31 && m > 4){
      y=1;
      g="?";
    }
    
    cout << g << " " << y << " " << m << " " << d << endl;
  }

  return 0;
}



Measured memory_bytes: 3160
match = {
    1: 2,
    2: 5,
    3: 5,
    4: 4,
    5: 5,
    6: 6,
    7: 3,
    8: 7,
    9: 6,
}

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

# 桁数を決めたい、最大を求めたいので前からDP
# dp[n]: n本のマッチでできる最大の桁？
inf = 10**18
dp = [-1] * (N + 10)
dp[0] = 0
for i in range(N):
    if dp[i] == -1:
        continue
    for a in A:
        dp[i + match[a]] = max(dp[i + match[a]], dp[i] + 1)

digit = dp[N]
pos = N
ans = ""
while pos > 0:
    for a in A[::-1]:
        if dp[pos - match[a]] == digit - 1:
            ans += str(a)
            pos -= match[a]
            digit -= 1
            break

print(ans)


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

#define MAX_N 100000

using namespace std;

vector <int> g[MAX_N + 1];

int p[MAX_N + 1];

int n, m;

void add(int a, int b)
{
    g[a].push_back(b);
}

int viz[MAX_N + 1];

void dfs(int a, int cat)
{
    viz[a] = cat;

    for(auto u : g[a])
    {
        if(viz[u] == 0)
            dfs(u, cat);
    }
}

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

    int i;
    for(i = 1; i <= n; i ++)
        cin >> p[i];

    int a, b;
    for(i = 1; i <= m; i ++)
    {
        cin >> a >> b;
        add(a, b);
        add(b, a);
    }

    int comp = 0;
    for(i = 1; i <= n; i ++)
    {
        if(viz[i] == 0)
        {
            ++ comp;
            dfs(i, comp);
        }
    }

    int rez = 0;
    for(i = 1; i <= n; i ++)
        rez += (viz[p[i]] == viz[i]);

    cout << rez << "\n";

    return 0;
}


Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
const long long mod = 1e9+7;
int main(){
    
    long long n;cin>>n;
    vector<long long> arr(n);
    vector<long long> ct(60,0);
    for(long long i=0;i<n;++i){
        long long curr;cin>>curr;
        arr[i]=curr;
        for(long long j=0;j<60;++j){
            if(((1LL<<j)&curr)>0){
                ct[j]++;
            }
        }
    }
    long long res = 0;
    for(long long i=0;i<60;++i){
        res += 1LL * (1LL<<i)%mod * ct[i]%mod * (n-ct[i])%mod;
        res %= mod;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ZERO(x) memset(x,0,sizeof(x))
#define MINUS(x) memset(x,-1,sizeof(x))
#define UNIQUE(x) (x).erase(unique(ALL(x)), (x).end())
#define TOUPPER(x) transform(ALL(x), (x).begin(), ::toupper)
#define TOLOWER(x) transform(ALL(x), (x).begin(), ::tolower)
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){for(const auto& v : vv){ view(v); } }
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void viewarr(T arr[], int n) { for(int i = 0; i < n; ++i) std::cout << arr[i] << " "; std::cout << std::endl; }
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; }
ll qp(ll a,ll b){ll ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const int INF = 1e9;
const ll INFL = 1e18;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5;

int main() {
    int X, Y, Z;
    cin >> X >> Y >> Z;
    swap(X, Y);
    swap(X, Z);
    cout << X << " " << Y << " " << Z << endl;
    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<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;

ll a[111111];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	ll moves=0;
	for(int i=0;i<n;i++)
	{
		ll x; cin>>x; a[i]=x-a[i]; moves+=a[i];
	}
	ll ext = 0;
	for(int i=0;i<n;i++)
	{
		if(a[i]<0)
		{
			ext-=a[i]; a[i] = 0;
		}
	}
	moves-=ext;
	if(moves<0){cout<<"No\n"; return 0;}
	for(int i=0;i<n;i++)
	{
		if(a[i]>0)
		{
			ll donation = a[i]/2;
			ext-=donation;
			a[i]-=a[i]/2;
		}
	}
	int cntones=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]==1) cntones++;
	}
	if(ext>0)
	{
		cout<<"No\n"; return 0;
	}
	cout<<"Yes\n";
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, L;
  cin >> N >> L;
  vint a(N);
  rep(i, N) cin >> a[i];
  vint sum(N+1);
  rep(i, N) sum[i+1] = sum[i]+a[i];
  auto Sum = [&](int l, int r) {
    return sum[r]-sum[l];
  };
  if(Sum(0, N) < L) {
    cout << "Impossible" << endl;
    return 0;
  }
  int idx = -1;
  reps(i, 1, N) {
    if(Sum(i-1, i+1) >= L) idx = i;
    if(~idx) break;
  }
  if(idx == -1) {
    cout << "Impossible" << endl;
    return 0;
  }
  cout << "Possible" << endl;
  rep(i, idx-1) {
    cout << i+1 << endl;
  }
  for(int i = N-1; i >= idx; i--) {
    cout << i << endl;
  }

  return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
#define int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0)

int gcd(int x,int y){ return (!y ? x : gcd(y, x%y)); }
const int maxn = 1e6 + 10;
int a[maxn], b[maxn];
bool cmp(int i,int j){
	return b[i] < b[j];
}
int32_t main(){
	IOS;
	int n,l;
	cin >> n >> l;
	int mn = 1e9, val;
	int sum = 0;
	for(int i=0 ;i<n; i++){
		int x = l + i;
		if(abs(x) < mn)
			mn = abs(x), val = x;
		sum += x;
	}
	cout << sum - val << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <cstring>
#include <stack>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cassert>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> pii;
int main(){
    int n, k;
    cin >> n >> k;
    vector<string>p(n);
    int a[26]={};
    rep(i,n){
        cin >> p[i];
        a[p[i][0]-'A']++;
    }
    int ans = 0;
    while(1){
        int c = 0;
        
        sort(a,a+26,greater<int>());
        rep(i,26){
            if(a[i]>0){
                a[i]--;
                c++;
            }
            if(c==k)break;
        }
        if(c<k){
            cout << ans << endl;
            return 0;
        }else {
            ans++;
        }
    }
    
}

Measured memory_bytes: 896
function main(input) {
  var n = input[0];
  var len = n.length;
  var ans = 0;
  for(var i=0;i<Math.trunc(len/2);i++){
    var a = n[i], b=n[len-i-1];
    if(a!=b)ans++;
  }
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 7372
// A.

#include <iostream>
#include <sstream>

using namespace std;

int main(int argc, char *argv[])
{
	string c;
	cin >> c;
	const string vowel = "aiueo";
	cout << (vowel.find(c) != string::npos ? "vowel" : "consonant") << endl;
	return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	d := intScanner() * 2
	a := intScanner()
	xh := make([][]int, n)
	for i := 0; i < n; i++ {
		xh[i] = []int{intScanner(), intScanner()}
	}
	sort.Sort(SliceSort(xh))
	x := make([]int, n)
	h := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = xh[i][0]
		h[i] = xh[i][1]
	}
	g := make([]int, n)
	ans := 0
	for i := 0; i < n; i++ {
		if i != 0 {
			g[i] = g[i] + g[i-1]
		}
		h[i] -= g[i]
		if h[i] > 0 {
			m := (h[i] + a - 1) / a * a
			ans += (h[i] + a - 1) / a
			g[i] += m
			idx := sort.Search(len(x), func(j int) bool { return x[j] > x[i]+d })
			if idx < len(x) {
				g[idx] -= m
			}
		}
	}
	fmt.Println(ans)
}

type SliceSort [][]int

func (x SliceSort) Len() int           { return len(x) }
func (x SliceSort) Less(i, j int) bool { return x[i][0] < x[j][0] }
func (x SliceSort) Swap(i, j int)      { x[i], x[j] = x[j], x[i] }


Measured memory_bytes: 17024
#include <bits/stdc++.h>
#define INF 1e9
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define max(v) *max_element(v.begin(), v.end())
#define min(v) *min_element(v.begin(), v.end())
using namespace std;

/*
long long cnt = 0;
void bubbleSort(int a[], int n){
    for(int i = 0; i < n; i++){
        for(int j = n-1; j > i; j--){
            if(a[j] < a[j-1]){
                swap(a[j], a[j-1]);
                cnt++;
            }
        }
    }
}
*/

int a[500000];
long long cnt = 0;
void merge(int a[], int left, int mid, int right){
    int n1 = mid-left, n2 = right - mid;
    int l[n1+1], r[n2+1];
    for(int i = 0; i < n1; i++){
        l[i] = a[left + i];
    }
    for(int i = 0; i < n2; i++){
        r[i] = a[mid + i];
    }
    l[n1] = INF;
    r[n2] = INF;
    int i, j;
    i = 0;
    j = 0;
    for(int k = left; k < right; k++){
        if(l[i] <= r[j]){
            a[k] = l[i];
            i = i+1;
        }
        else{
            a[k] = r[j];
            j = j+1;
            cnt += n1 - i;
        }
    }
}

void mergeSort(int a[], int left, int right){
    if(left+1 < right){
        int mid = (left + right)/2;
        mergeSort(a, left, mid);
        mergeSort(a, mid, right);
        merge(a, left, mid, right);
    }
}

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

    int n;
    cin>>n;
    rep(i, n){
        cin>>a[i];
    }
//    bubbleSort(a, n);
    mergeSort(a, 0, n);
    cout<<cnt<<endl;
    return 0;
}


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

long long X, ans;
bool flag = 1;
int main() {
    cin >> X;
    
    for (int i = X; i < 2*X; i++){
        flag = 1;
        for(int j = 2; j < i; j++){
            if(i % j == 0) {
                flag = 0;
            }
        }
        if (flag == 1) {
            ans = i;
            break;
        }
    }
    
    if (X == 2 || X == 1) ans = 2;
        cout << ans << endl;
}

Measured memory_bytes: 256
// In the name of God
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <bitset>
#define sqr(a) (a)*(a)
using namespace std;

template <typename T>
T next_int() {
	T x = 0, p = 1;
	char ch;
	do { ch = getchar(); } while(ch <= ' ');
	if(ch == '-') {
		p = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		x = x * 10 + (ch - '0');
		ch = getchar();
	}
	return p * x;
}
	
const int max_int = (int)1e9 + 227 + 1;
const int max_n = (int)1e6 + 227 + 1;	
const int mod = (int)1e9 + 7;

int t[max_n * 4];

void modi(int v, int l, int r, int p, int a) {
	if(l == r) {
		t[v] = a;
		return;
	}

	int mid = (l + r) / 2;
	if(p <= mid) modi(v * 2, l, mid, p, a); else
		modi(v * 2 + 1, mid + 1, r, p, a);

	t[v] = min(t[v * 2], t[v * 2 + 1]);
}

int get(int v, int l, int r, int _l, int _r) {
	if(_l > _r) return max_int;
	if(l == _l && r == _r) return t[v];

	int mid = (l + r) / 2;
	return min(get(v * 2, l, mid, _l, min(mid, _r)), get(v * 2 + 1, mid + 1, r, max(mid + 1, _l), _r));
}

int main() {
//	freopen(".in", "r", stdin);

	int n = next_int<int>();
	long long m = next_int<int>();

	vector<int> a(n);
	for(int i = 0; i < n; i++) a[i] = next_int<int>();

	for(int i = 0; i < n; i++) a.push_back(a[i]);

	for(int i = 1; i <= n * 2; i++) modi(1, 1, n * 2, i, a[i - 1]);

	long long ans = (long long)2e18;
	for(int k = 0; k < n; k++) {
		long long e = k * 1LL * m;
		for(int i = 0; i < n; i++) {
			int mn = get(1, 1, n * 2, i + 1 + n - k, i + 1 + n);

			e += mn;
		}

		ans = min(ans, e);
	}

	cout << ans << "\n";
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        for(int i = a; i <= b; i++) {
            if(i == c) {
                System.out.println("Yes");
                return;
            }
        }
        for(int i = b; i <= a; i++) {
            if(i == c) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 23252
n = int(input())
s = list(map(int, input().split()))
q = int(input())
a = list(map(int, input().split()))

def b_search(b, x, l, r):
    while l+1<r:
        m = (l+r)//2
        if b[m]<x:
            l = m
        else:
            r = m
    
    if b[r]==x:
        return True
    else:
        return False
    
s.sort()
cnt = 0
for ai in a:
    if b_search(s, ai, -1, n-1):
        cnt += 1
print(cnt)


Measured memory_bytes: 16712
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int h = 0;
    int w = 0;
    while(true){
      h = sc.nextInt();
      w = sc.nextInt();
      if(h == 0 && w == 0) return;
      for(int i = 0; i<h; i++) {
        for(int j = 0; j<w; j++) {
          if(i == 0 || i == h-1) {
            System.out.print("#");
          }else if(j == 0 || j == w-1){
            System.out.print("#");
          }else {
            System.out.print(".");
          }
        }
        System.out.println();
      }
      System.out.println();
    }
  }
}

Measured memory_bytes: 34400
import sys
from heapq import heappop, heappush
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
INF = float('inf')

def sol():
    N = int(input())
    B = list(map(int, input().split()))

    A = [0] * N
    for i in range(1, N - 1):
        A[i] = min(B[i], B[i - 1])

    A[0] = B[0]
    A[-1] = B[-1]

    print(sum(A))

sol()

Measured memory_bytes: 3380
N, M, X = map(int, input().split())

A = []
C = []

for i in range(N):
    a = list(map(int, input().split()))
    C.append(a[0])
    A.append(a[1:])
flag = False
ans = 12 * 10**6
for i in range(2**N):
    s = 0
    rikai = [0] * M
    for j in range(N):
        if ((i >> j) & 1):
            s += C[j]
            for k in range(M):
                rikai[k] += A[j][k]

        if (len([x for x in rikai if x >= X])) == M:
            flag = True
            ans = min(ans, s)

if flag:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 69052
import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

immutable int mod = 10^^9 + 7;

void main()
{
    auto s = readln.chomp.to!(dchar[]);
    auto rbt = redBlackTree(s);

    if (s.length == rbt.length) {
        writeln("yes");
    }
    else {
        writeln("no");
    }
}

void readVars(T...)(auto ref T args)
{
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        writeln(line);
        throw new Exception("args num < input num");
    }
}

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

int main(){
    int a , b , c , d , e , k;
    scanf( "%d%d%d%d%d%d" , &a , &b , &c , &d , &e , &k );
    if( e - a <= k ) puts( "Yay!" );
    else puts( ":(" );
    return 0;
}

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

const int max_a = 5010;
const int max_b = 5010;

int solve(const vector<int> &a, const vector<int> &b)
{
  int ret = 0;
  int n1 = a.size();
  int n2 = b.size();
  static int dp[max_a][max_b];
  
  for(int i = 0; i <= n1; ++i){
    for(int j = 0; j <= n2; ++j){
      dp[i][j] = 0;
    }
  }

  for(int i = 0; i < n1; ++i){
    for(int j = 0; j < n2; ++j){
      if( a[i] == b[j] ){
	dp[i+1][j+1] = dp[i][j] + 1;
      }else{
	// if( dp[i][j+1] > dp[i+1][j] )
	dp[i+1][j+1] = dp[i][j+1];
	//max( dp[i+1][j], dp[i][j+1] );
      }
    }
  }

  for(int i = 0; i <= n2; ++i){
    ret = max( ret, dp[n1][i] );
  }

  return ret;
}

int main()
{
  int A,B;
  while(cin >> A >> B){
    if( A <= 0 || B <= 0 || A > 5000 || B > 5000 ) break;
    vector<int> vA,vB;
    for(int i = 0; i < A; ++i){
      int t; cin >> t;
      vA.push_back(t);
    }
    for(int i = 0; i < B; ++i){
      int t; cin >> t;
      vB.push_back(t);
    }

    cout << solve(vA,vB) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
S = $stdin.read.chomp

Ss = S.split(//)

a = S.to_i
S.length.times do |n|
  next if n.zero?
  (1...(S.length)).to_a.combination(n) do |comb|
    comb.unshift(0)
    comb.push(S.length)
    comb.each_with_index {|x,idx| next if idx.zero?; a += Ss[comb[idx-1]...x].join.to_i }
  end
end

puts a



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

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while (!(line = br.readLine()).equals("0")) {

			//
			int n = Integer.parseInt(line);
			int[][] grid = new int[n + 2][n + 2];

			for (int i = 0; i < n; i++) {
				line = br.readLine();
				for (int j = 0; j < n; j++) {
					grid[i + 1][j + 1] = line.charAt(j) == '.' ? 1 : 0;
				}
			}

			//
			int max = 0;
			for (int i = 1; i < n + 1; i++) {
				for (int j = 1; j < n + 1; j++) {
					if (grid[i][j] != 0) {
						int min;
						min = grid[i - 1][j - 1] < grid[i - 1][j] ? grid[i - 1][j - 1]
								: grid[i - 1][j];
						min = grid[i][j - 1] < min ? grid[i][j - 1] : min;
						grid[i][j] += min;
						if (grid[i][j] > max) {
							max = grid[i][j];
						}
					}
				}
			}
			System.out.println(max);

		}

	}

}

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

#define fi first
#define se second
#define sc scanf
#define pr printf
#define pb push_back
#define ll long long
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );

const long long N = 200100;
const long long MX = sqrt(N);
const long long H = 17;
const long long MAGIC = 1000;
const long long mod = 1e9 + 7;

using namespace std;

ll n;
ll a;
ll b;

void solve()
{
        cin >> n >> a >> b;
        if(a > b){
                cout << 0 << endl;
        }
        else if(n == 1){
                cout << (a == b) << endl;
        }
        else{
                cout << (b - a) * (n - 2) + 1 << endl;
        }
}

bool mtest = false; int main()
{
        //fin("input.txt");
        //fout("output.txt");
        //fin("landscape.in");
        //fout("landscape.out");
        ios_base::sync_with_stdio(0);
        int TE = 1;
        if(mtest)
                cin >> TE;
        while(TE--)
                solve();
        return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Ds = list(mapint())
mod = 998244353
from collections import Counter

c = Counter(Ds)
if Ds[0]!=0:
    print(0)
elif c[0]>1:
    print(0)
else:
    ans = 1
    for i in range(1, N):
        ans *= pow(c[i-1], c[i], mod)
        ans %= mod
    print(ans)

Measured memory_bytes: 98444
def gcd(a: int, b: int) -> int:
    return gcd(b % a, a) if a != 0 else b


N = int(input())
A = [0] + list(map(int, input().split()))

L = [0 for _ in range(N + 2)]
R = [0 for _ in range(N + 2)]
for i in range(1, N + 1):
    L[i + 1] = gcd(L[i], A[i])

for i in range(1, N + 1)[::-1]:
    R[i] = gcd(R[i + 1], A[i])

ret = 0
for i in range(1, N+1):
    ret = max(ret, gcd(L[i], R[i + 1]))

print(ret)


Measured memory_bytes: 14584
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#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 ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    ll x;
    cin >> x;

    ll cur = 100, year = 0;
    while(cur < x) {
        cur += cur * 0.01;
        year++;
    }

    cout << year << endl;

    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
	vector<int>A(3);
	for (int i = 0; i < 3; i++)cin >> A.at(i);
	sort(A.begin(), A.end());
	if (A.at(0) == A.at(1)) cout << A.at(2) << endl;
	else cout << A.at(0) << endl;
}

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

int main() {
  int A, B, C, K;
  vector<int> x(3);
  for (int i = 0; i < 3; i++)
    cin >> x.at(i);
  cin >> K;
  sort(x.begin(), x.end());
  reverse(x.begin(), x.end());
  int X = x.at(0);
  for (int i = 0; i < K; i++)
    X = X * 2;
  cout << X + x.at(1) + x.at(2) << endl;
}


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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

int modminus(int a, int b, int N) {
  int ret = (a - b) % N;
  return (ret >= 0) ? ret : ret + N;
}

int main() {
  int N;
  std::cin >> N;
  std::vector<int> a(N), b(N);
  rep(i, N) {
    std::cin >> a[i];
  }
  rep(i, N) {
    std::cin >> b[i];
  }

  std::vector<int> c(N), d(N);
  rep(i, N) {
    c[i] = a[i] ^ a[(i + 1) % N];
  }
  rep(i, N) {
    d[i] = b[i] ^ b[(i + 1) % N];
  }

  std::vector<int> table(N + 1);
  {
    table[0] = -1;
    int t = -1;
    rep(i, N) {
      while(t >= 0 && c[i] != c[t]) {
        t = table[t];
      }
      ++t;
      table[i + 1] = t;
    }
  }

  std::vector<int> ks;
  {
    int pos = 0;
    int head = 0;
    while(pos + head < 2 * N && head < N) {
      if(d[(head + pos) % N] != c[pos]) {
        head += pos - table[pos];
        if(pos > 0) {
          pos = table[pos];
        }
      } else {
        ++pos;
      }

      if(pos == N) {
        ks.push_back(modminus(0, head, N));
        head += pos - table[pos];
        pos = table[pos];
      }
    }
  }

  std::sort(ks.begin(), ks.end());

  for(int k : ks) {
    std::cout << k << ' ' << (a[k] ^ b[0]) << '\n';
  }

}


Measured memory_bytes: 8308
#include<iostream>
#include<vector>
#include<algorithm>
#include<cassert>
using namespace std;

typedef long long ll;
const ll a_max = 100;
const int snow_id = 0;

inline vector<int> getRank(const vector<ll> &a){
  int n = a.size();
  vector< pair<ll,int> > sorted(n);
  for(int i=0;i<n;i++){
    sorted[i] = make_pair(a[i], i);
  }
  sort(sorted.begin(), sorted.end(), greater< pair<ll,int> >());

  vector<int> rank(n,0);
  for(int i=0;i<n;i++){
    int id = sorted[i].second;
    rank[id] = i;
    if(i>0){
      int prv_id = sorted[i-1].second;
      if(a[id] == a[prv_id]) rank[id] = rank[prv_id];
    }
  }
  return rank;
}

inline vector<int> getTotalRank(const vector<ll> &p,
                                const vector<ll> &a, const vector<ll> &b, const vector<ll> &c){
  int n = p.size();

  vector<ll> score(n,0);
  vector<int> rank_a = getRank(a);
  for(int i=0;i<n;i++) score[i] += p[rank_a[i]];
  vector<int> rank_b = getRank(b);
  for(int i=0;i<n;i++) score[i] += p[rank_b[i]];
  vector<int> rank_c = getRank(c);
  for(int i=0;i<n;i++) score[i] += p[rank_c[i]];

  return getRank(score);
}

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

  vector<ll> a(n), b(n), c(n);
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i] >> c[i];
  }

  assert(getTotalRank(p, a, b, c)[snow_id] == 8);

  for(int x=0; x<=a_max+1; x++){
    a[snow_id] += x;
    if(getTotalRank(p, a, b, c)[snow_id] < 8){
      cout << x << endl; return 0;
    }
    a[snow_id] -= x;

    b[snow_id] += x;
    if(getTotalRank(p, a, b, c)[snow_id] < 8){
      cout << x << endl; return 0;
    }
    b[snow_id] -= x;

    c[snow_id] += x;
    if(getTotalRank(p, a, b, c)[snow_id] < 8){
      cout << x << endl; return 0;
    }
    c[snow_id] -= x;
  }

  cout << "Saiko" << endl;
}



Measured memory_bytes: 3160
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<iterator>
#include<queue>
#include<stack>
#include<cctype>
#include<deque>
#include<time.h>
#include<bitset>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<sstream>
//by Skeef79

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

const int INF = 2000000000;
const ll LINF = 2000000000000000000;

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

template <typename T> void input(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
		for (int j = 0; j < a[i].size(); j++)
			cin >> a[i][j];
}

void solve()
{
	int x;
	cin >> x;
	vector<int> dp(x + 1);
	if (x < 100)
	{
		cout << 0;
		return;
	}
	if (x >= 100 && x <= 105)
	{
		cout << 1;
		return;
	}

	for (int i = 100; i <= 105; i++)
		dp[i] = 1;

	for (int i = 106; i <= x; i++)
		for (int j = 100; j <= 105; j++)
			dp[i] = max(dp[i], dp[i - j]);
	cout << dp[x];

}

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

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int tst = 1;
	//cin >> tst;
	while (tst--)
		solve();
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

char typing[11]={'y','u','i','o','p','h','j','k','l','n','m'};

int main(){
	string s;
	while(1){
		cin>>s;
		if(s=="#")break;
		bool hand=true;
		rep(i,11)if(s[0]==typing[i])hand=false;
		int count=0;
		loop(i,1,s.size()){
			if(hand){
				rep(j,11){
					if(s[i]==typing[j]){
						count++;
						hand=!hand;
						break;
					}
				}
			}else{
				bool check=false;
				rep(j,11)if(s[i]==typing[j]){check=true;break;}
				if(check)continue;
				count++;
				hand=!hand;
			}
		}
		cout<<count<<endl;
	}
	return 0;
}

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


int main(){
    
    int A, B;
    cin >> A >> B;
    int a = int(A  * 100 / 8);
    // int a = int(A / 0.08);
    int b = B * 10;
    // cout << floor(A);
    //  cout << b;

    // if(a == b)  cout << "same" << endl;
    // else        cout << "not same" << endl;
    

    rep(i,1001) {
        if(floor(i*0.08) == A && floor(i*0.1) == B) {
            cout << i << endl;
            exit(0);
        }
    }
    cout << -1 << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
#define N 200000

int main(){
  int n,a[N],i,j,minv,maxv=0;
  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    scanf("%d",&a[i]);
  }
  minv = a[0];
  for(j=1 ; j<n ; j++){
    if(maxv<a[j]-minv || j==1) maxv=a[j]-minv;
    if(minv>a[j])minv = a[j];
  }
  printf("%d\n",maxv);
  return 0;
}



Measured memory_bytes: 2588