akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main() {
    int x;
    int y;
    int z;
    int sum;
    scanf("%d%d%d",&x,&y,&z);
    sum=x+y+z;
    if((sum)>=22){
        printf("bust");
    }
    else {
        printf("win");
    }
    return 0;
}


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

using namespace std;

// ?????????????????????????????°?????????
int selectionSort(int *A, int n) {
    int minj, count;
    count = 0;
    for (int i = 0; i < n; i++) {
        minj = i;
        for (int j = i + 1; j < n; j++) {
            if (A[j] < A[minj]) {
                minj = j;
            }
        }
        if (i != minj) {
            swap(A[i], A[minj]);
            count++;
        }
    }
    return count;
}

int main(int argc, char const* argv[]) {
    int n;
    cin >> n;
    int A[100];
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    int count;
    count = selectionSort(A, n);
    for (int i = 0; i < n; i++) {
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3088
n = int(input())
s = input()

W = 0
E = 0

for c in s:
    if c == 'W':
        W += 1
    if c == 'E':
        E += 1

arr = []

e_left = 0
w_left = 0
for c in s:
    if c == 'W':
        e_right = E - e_left
        arr.append(w_left + e_right)
        w_left += 1
    if c == 'E':
        e_right = E - e_left - 1
        arr.append(w_left + e_right)
        e_left += 1

print(min(arr))


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

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

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int score = 0;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == s[i + 1]) {
      score++;
    }
  }
  int ans = min(score + 2 * k, n - 1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        List<Integer> A = new ArrayList<>();
        while (true) {
            A.add(sc.nextInt());
            if (A.get(A.size() - 1) == 0) {
                break;
            }
        }
        int i = 1;
        while(i < A.size()){
            System.out.println("Case " + i +": " + A.get(i-1));
            i++;
        }
        sc.close();
    }

}



Measured memory_bytes: 44084
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define lim (int) (1e5+5)
using namespace std;
typedef pair<int,int> ii;
typedef string string;
typedef long long int lli;
int n,a[15],t,pw[15],pw2[15];
int main()
{
	pw[0]=1;
	pw2[0]=1;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		pw[i]=pw[i-1]*3;
	for(int i=1;i<=n;i++)
		pw2[i]=pw2[i-1]*2;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]%2==0)
			t++;
	}
	printf("%d",pw[n]-pw2[t]);
}



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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

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

    ll N;
    cin >> N;
    vll A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];

    sort(all(A));
    sort(all(B));
    ll ma = N%2==0? (A[N/2]+A[(N-1)/2]) : A[N/2];
    ll mb = N%2==0? (B[N/2]+B[(N-1)/2]) : B[N/2];
    cout << (N%2==0? ((mb-ma)+1) : (mb-ma+1)) << endl;
}


Measured memory_bytes: 6360
#include <iostream>
#include <iterator>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>

using namespace std;

int main(void){
	string str;
	string str2;
	int a,b,n,nn;
	while(1){
		cin >> n;
		if(n==0)break;
		cin >> str;
		for(a=0;a<n;a++){
			nn=1;
			for(b=1;b<str.size();b++){
				if(b==str.size()-1){
					if(str[b-1]==str[b]){
						nn++;
						while(nn>=0){
							if(nn>=10)str2+=nn/10+'0';
							else{
								str2+=nn%10+'0';
								nn=-1;
							}
							int nnn=10;
							while(nn>nnn*10){
								nnn*=10;
							}
							nn=nn-nnn;

						}
						back_inserter(str2)=str[b-1];
					}else{
						while(nn>=0){
							if(nn>=10)str2+=nn/10+'0';
							else{
								str2+=nn%10+'0';
								nn=-1;
							}
							int nnn=10;
							while(nn>nnn*10){
								nnn*=10;
							}
							nn=nn-nnn;
						}
						back_inserter(str2)=str[b-1];
						back_inserter(str2)='1';
						back_inserter(str2)=str[b];
					}
				}else{
					if(str[b-1]==str[b]){
						nn++;
					}else{
						while(nn>=0){
							if(nn>=10)str2+=nn/10+'0';
							else{
								str2+=nn%10+'0';
								nn=-1;
							}
							int nnn=10;
							while(nn>nnn*10){
								nnn*=10;
							}
							nn=nn-nnn;
						}
						back_inserter(str2)=str[b-1];
						nn=1;
					}
				}
			}
			str=str2;
			str2="";
		}
		cout << str << endl;
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())
A = list(input())

L = [0] * N
R = [0] * N
L[0] = 0
R[N-1] = 0
for i in range(1, N):
    count = 1 if A[i-1] == 'W' else 0
    L[i] = L[i-1] + count

    count = 1 if A[N-i] == 'E' else 0
    R[N-i-1] = R[N-i] + count

print(min(list(map(lambda a, b: (a+b), L, R))))

Measured memory_bytes: 41472
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

k = ni()
x = 7 % k
for i in range(k+1):
    if x == 0:
        print(i+1)
        sys.exit(0)
    x = (x*10+7) % k
print(-1)


Measured memory_bytes: 63040
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

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

  bool ok = true;
  if(s.size()%2 != 0){
    cout << "No" << endl;
    return 0;
  }
  rep(i, s.size()){
    if(i%2 == 0){
      if(s[i] != 'h'){
        ok = false;
      }
    }
    else{
      if(s[i] != 'i'){
        ok = false;
      }
    }
  }

  cout << (ok ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
# D
n = int(input())
a_list = list(map(int, input().split()))

p = max(a_list)
gap = p
q = p
for i in range(n):
    gap_ = abs(a_list[i] - p / 2)
    if gap_ < gap and a_list[i] != p:
        gap = gap_
        q = a_list[i]
print(" ".join([str(p), str(q)]))

Measured memory_bytes: 14052
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
L=get_i.sort
ans=0
(2*N).times do|i|
  ans+=L[i] if (i+1).odd?
end
puts ans

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s=="SUN")
	cout<<7;
	if(s=="SAT")
	cout<<1;
	if(s=="FRI")
	cout<<2;
	if(s=="THU")
	cout<<3;
	if(s=="WED")
	cout<<4;
	if(s=="TUE")
	cout<<5;
	if(s=="MON")
	cout<<6;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ )
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair 
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is " << (x) <<"\n"
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = 1e6+10;
const ll inf = 1e18+7;

int main(){
	fastio;
	ld sum,ans;
	cin>>sum;
	ans=pow(sum,3);
	ans/=27.0;
	cout<<fixed<<setprecision(12)<<ans<<"\n";
    return 0; 
}

Measured memory_bytes: 3772
#include<stdio.h>
int main()
{
	int a,b,c,k;
	int x,y,z,w;
	scanf("%d %d %d %d",&a,&b,&c,&k);
	x=0;
	y=0;
	z=0;
	w=0;
	while(1){
		if(k==x) break;
		else if(a!=0){
			a=a-1;
			x++;
			y++;
		}
		if(k==x) break;
		else if(a==0&&b!=0){
			b=b-1;
			x++;
			z++;
		}
		if(k==x) break;
		else if(a==0&&b==0&&c!=0){
			c=c-1;
			x++;
			w++;
		}
	}
	printf("%d\n",y*1+z*0+w*(-1));
	return 0;
}


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

int counter(string s,int k){
  int saisyo=s[0]-'0',leng=s.size();
  int firstzero=1;
  while(firstzero<leng&&s[firstzero]=='0')firstzero++;
  if(leng==1&&k>1)return 0;
  else if(leng==1&&k==1)return saisyo;
  else if(leng==2&&k>2)return 0;
  else if(k==1){
    int ans=0;
    ans+=(leng-1)*9;
    ans+=saisyo;
    return ans;
  }
  else if(k==2){
    int ans=0;
    ans+=81*(leng-1)*(leng-2)/2;
    ans+=(saisyo-1)*(leng-1)*9;
    if(firstzero!=leng){
    ans+=(s[firstzero]-'0');
    ans+=(leng-firstzero-1)*9;
    }
    return ans;
  }
  else{
    int ans=0;
    ans+=243*(leng-1)*(leng-2)*(leng-3)/2;//最初の桁は０
    ans+=(saisyo-1)*81*(leng-1)*(leng-2)/2;//最初の桁は１～saisyo未満
    if(firstzero==leng)return ans;
    string s2=s.substr(firstzero,leng-firstzero);
    return ans+counter(s2,k-1);
  }
}

int main() {
  string s;
  cin >> s;
  int k;
  cin >>k;
  
  cout<<counter(s,k)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,c,d;
  string s;
  while(true){
    cin>>a;
    cin>>s;
    cin>>b;
    c=a;
    d=b;
    if(s[0]=='?') break;

 else   if(s[0]=='+'){
      cout<<c+d<<"\n";
    }
    else if(s[0]=='-'){
      cout<<c-d<<"\n";
    }
    else if(s[0]=='*'){
      cout<<c*d<<"\n";
    }
    else if(s[0]=='/'){
      cout<<c/d<<"\n";
    }
  }
  return 0;
}



Measured memory_bytes: 3168
# coding:utf-8
def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    total = 0
    count = 0

    for a_cont in range(a+1):
        for b_cont in range(b+1):
            for c_cont in range(c+1):
                total = (a_cont*500) + (b_cont*100) + (c_cont*50)
                if total == x:
                    count = count + 1

    print(count)


if __name__ == '__main__' :
    main()

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

int main(){
    string S;
    cin >> S;
    
    int n = 0;
    for(int i=0;i<4;i++){
        if(S.at(i) == '+') n++;
        else if(S.at(i) == '-') n--;
    }
    
    cout << n << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int m;
long long cnt = 0;

int dp[50][100010];
int mod(int x, int m) {
	if (x%m != 0) return x%m;
	if (x > 0) return m;
	return 0;
}
int maken(int a, int x) {
	if (x == m) return true;
	if (a == 0 && x == 0) return false;
	if (dp[a][x] == -2) return false;
	if (dp[a][x] != -1) return dp[a][x];
	dp[a][x] = -2;
	for (int i = 0; i < 10 && i <= a; i++) if(maken(a - i, mod(x * 10 + i, m))) return dp[a][x] = 1;
	return dp[a][x] = 0;
}
int min(int x, int y) { return x > y ? y : x; }
int main() {
	scanf("%d", &m);
	for(int k=0; k<50; k++)for (int i = 0; i < m; i++) dp[k][i] = -1;
	int i;
	for (i = 1; i < 50; i++) {
		if (maken(i, 0)) break;
	}
	printf("%d\n", i);
	return 0;
}

Measured memory_bytes: 24320
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;
int main()
{
	int N = 0;

	cin >> N;

	if (N <= 999) {
		cout << "ABC";
	}
	else { cout << "ABD"; }


	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
#include "string.h"
#include "algorithm"
 
using namespace std;
typedef int64_t ll;
typedef vector<int64_t> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int,int> P;
typedef vector<P> vp;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SIZE(a) int((a).size())

int main(){
  int n;
  cin>>n;
  vp xl(n);
  REP(i,n){
    cin>>xl[i].first>>xl[i].second;
  }
  vp robo(n);
  REP(i,n){
    robo[i].second=xl[i].first-xl[i].second;
    robo[i].first=xl[i].first+xl[i].second;
  }
  sort(robo.begin(),robo.end());
  int count=0,t=-INT_MAX;
  REP(i,n){
    if(t<=robo[i].second){
      count++;
      t=robo[i].first;
    }
  }
  cout<<count<<endl;
}


Measured memory_bytes: 1792
while 1:
    in_tmp = input()
    if (in_tmp == "0"):
        break
    list_team = []
    for i in range(int(in_tmp)):
        list_team.append(list(map(int,input().split())))
    list_sorted = sorted(list_team, key=lambda x:(-x[2], x[3], x[0]))
    
    cnt_passed = 0
    dict_passed = {}
    for item in list_sorted:
        if (item[1] not in dict_passed.keys()):
            dict_passed[item[1]] = 0
        if (cnt_passed < 10):
            if(dict_passed[item[1]] < 3):
                print(item[0])
                dict_passed[item[1]] += 1
                cnt_passed += 1
        elif (cnt_passed < 20):
            if(dict_passed[item[1]] < 2):
                print(item[0])
                dict_passed[item[1]] += 1
                cnt_passed += 1
        elif (cnt_passed < 26):
            if(dict_passed[item[1]] < 1):
                print(item[0])
                dict_passed[item[1]] += 1
                cnt_passed += 1
        else:
            break


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

using namespace std;

int main() {

	long n;
	cin >> n;

	map<string, long> ma;
	string s;

	for (long i = 0; i < n; i++) {
		cin >> s;
		ma[s]++;
	}



	cout << ma.size() << endl;
}

Measured memory_bytes: 19116
#include <iostream>
#include <climits>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 1; (i) <= (int)(n); i++)
using namespace std;

int memo[205][205] = { 0 };

int gcd(int a, int b) {
	if (memo[a][b] != 0) {
		return memo[a][b];
	}
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

int gcd2(int a, int b, int c) {
	int x = gcd(a, b);
	memo[a][b] = x;
	memo[b][a] = x;
	int y = gcd(x, c);
	memo[x][c] = y;
	memo[c][x] = y;
	return y;
}

int main() {
	int K;
	cin >> K;
	int sum = 0;
	rep(i, K) rep(j, K) rep(k, K) {
		//cout << i << " " << j << " " << k << " = " << gcd2(i, j, k) << endl;
		sum += gcd2(i, j, k);
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3756
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, w, sum = 0;
		int min = 1000;
		int max = 0;
		while (true) {
			w = sc.nextInt();
			sum=0;
			min = 1000;
			max = 0;
			if(w==0)
				break;
			for (int i = 0; i < w; i++) {
				n = sc.nextInt();
				sum += n;
				if (n > max)
					max = n;
				if (n < min)
					min = n;

			}
			System.out.println((sum - (max + min)) / (w - 2));
		}
	}
}

Measured memory_bytes: 20952
#include <iostream>
using namespace std;
int main()
{
	int a,b,a1,a2,a3,a4,a5,ans;
	cin>>a>>b;
	for(int i=a;i<=b;++i)
	{
	a1=i/10000;
	a2=i/1000%10;
	a3=i/100%10;
	a4=i/10%10;
	a5=i%10;
	if(a1==a5&&a2==a4)
	ans++;
	else
	ans=ans;
	}
	cout<<ans;
    return 0;
} 

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

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

    int s; cin >> s;
    map<int,int> mp;
    int now = s;
    mp[now]++;
    FOR(i,1,INF){
        if(now%2==0){now/=2;}
        else{now=now*3+1;}
        mp[now]++;
        bool ok = 0;
        for(auto x:mp){if(x.second==2)ok=1;}
        if(ok){out(i+1); break;}
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	int t = sc.nextInt();
      	
      	System.out.println((int)Math.floor(t*1.0 / a*1.0)*b);
    }
}


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

const long long int INF = 1LL << 60;
template<typename Type>
struct QuickFind {
  int N;
  vector<int> i2g;
  vector< vector<int> > g2i;
  vector<Type> weight;

  QuickFind(int N_) {
    N = N_;
    i2g.resize(N);
    g2i.resize(N);
    weight.resize(N);

    for(int i=0; i<N; i++) {
      i2g[i] = i;
      g2i[i] = vector<int>{i};
    }
  }
  bool same(int u, int v) {
    return i2g[u] == i2g[v];
  }
  void merge(int u, int v, Type w) {
    int ru = i2g[u], rv = i2g[v];

    // merge v into u
    if(g2i[ru].size() < g2i[rv].size()) {
      swap(u, v);
      swap(ru, rv);
      w = -w;
    }

    Type cost = weight[v];
    weight[u] += abs(w);
    weight[v] = weight[u] + w;
    
    for(auto e : g2i[rv]) {
      i2g[e] = ru;
      Type diff = weight[e] - cost;
      if(e != u && e != v) {
        weight[e] = weight[v] - abs(w) + diff;
      }
    }
    
    if(ru != rv) {
      g2i[ru].insert(g2i[ru].end(), g2i[rv].begin(), g2i[rv].end());
      g2i[rv].clear();
    }
  }
  Type calc_weight(int u, int v) {
    if(!same(u, v)) return INF;
    return weight[v] - weight[u];
  }
};

int main() {
  int N, Q; cin >> N >> Q;

  QuickFind<long long int> qf(N);
  for(int i=0; i<Q; i++) {
    string query; cin >> query;

    if(query == "COMPARE") {
      int u, v; cin >> u >> v;
      u--; v--;
      long long int ans = qf.calc_weight(u, v);
      if(ans == INF) cout << "WARNING" << endl;
      else cout << ans << endl;
    }
    else {
      int u, v, w; cin >> u >> v >> w;
      u--; v--;
      qf.merge(u, v, w);
    }
  }
  return 0;
}



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

int main()
{
  int t;
  cin>>t;
  for(;t--;)
    {
      int h,w;
      cin>>h>>w;
      //      cout<<h<<" "<<w<<endl;
      char maps[h][w];
      int x,y;
      //      char move;     //^=0,>=1,v=2,<=3
      for(int i=0;i<h;i++)
	for(int j=0;j<w;j++)
	  {
	    cin>>maps[i][j];
	    
	    if(maps[i][j]=='^' ||maps[i][j]=='>'
	       ||maps[i][j]=='v'||maps[i][j]=='<')
	      {
		x=i;
		y=j;
	      }
	    
	  }
      int n;
      cin>>n;
      for(;n--;)
	{
	  char tmp;
	  cin>>tmp;
	  if(tmp=='U')
	    {
	      maps[x][y]='^';
	      if(x>0&&maps[x-1][y]=='.')
		{
		  maps[x][y]='.';
		  x--;
		  maps[x][y]='^';
		}
	    }
	  if(tmp=='D')
	    {
	      maps[x][y]='v';
	      if(x<h-1&&maps[x+1][y]=='.')
		{
		  maps[x][y]='.';
		  x++;
		  maps[x][y]='v';
		}
	    }


	  if(tmp=='L')
	    {
	      maps[x][y]='<';
	      if(y>0&&maps[x][y-1]=='.')
		{
		  maps[x][y]='.';
		  y--;
		  maps[x][y]='<';
		}
	    }
	  if(tmp=='R')
	    {
	      maps[x][y]='>';
	      if(y<w-1&&maps[x][y+1]=='.')
		{
		  maps[x][y]='.';
		  y++;
		  maps[x][y]='>';
		}
	    }
	  if(tmp=='S')
	    {
	      int dx=0,dy=0;
	      int tmpx=x,tmpy=y;
	      if(maps[x][y]=='^')
		dx=-1;
	      else if(maps[x][y]=='v')
		dx=1;
	      else if(maps[x][y]=='<')
		dy=-1;
	      else
		dy=1;
	      while(tmpx+dx<h&&tmpy+dy<w &&tmpx+dx>=0&&tmpy+dy>=0)
		{
		  tmpx+=dx;
		  tmpy+=dy;
		  if(maps[tmpx][tmpy]=='*')
		    {
		      maps[tmpx][tmpy]='.';
		      break;
		    }
		  if(maps[tmpx][tmpy]=='#')
		    {
		      break;
		    }
		}
	    }	  
	}
	
	
	for(int i=0;i<h;i++,cout<<endl)
	  for(int j=0;j<w;j++)
	    {
	      cout<<maps[i][j];
	    }
	if(t!=0)
	  cout<<endl;
    }
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

string n;

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

	cin >> n;
	int len = n.length();
	for (int i = 0; i < len; i++) {
		if (n.at(i) == '1') {
			n.at(i) = '9';
		}
		else {
			n.at(i) = '1';
		}
	}
	cout << n << "\n";

	return 0;
}

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

#define ll long long

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    ll ans = 0;
    ans += 1ll*min(a, k);
    k -= min(a, k);
    k -= min(k, b);
    ans -= 1ll*min(k, c);
    cout << (ll)ans;
}


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



Measured memory_bytes: 2132
//Abhinav ---IIIT_A
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define f(i,x,n) for(int i=x;i<(int)n;++i)
#define vpii vector<pair<int,int>>
#define vi vector<int>
#define mpii map<pair<int,int>,int>
#define mpivpii map<int,vector<pair<int,int>>>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define mpi map<int,int>
#define vvi vector<vector<int>>
#define vvvi vector<vvi>
ld pie=3.141592653589;
int mod=1e9+7;


void solve(){
 	int n,w; cin>>n>>w;
 	int Val[n],wei[n]; 
 	f(i,0,n) cin>>wei[i]>>Val[i];
 	int val[100005];
 	f(i,0,100005) val[i]=-1;
 	val[0]=0;
 	for(int j=0;j<n;++j)
 	for(int i=100004;i>=0;--i){
 		if(val[i]!=-1){
 			int x=val[i]+wei[j];
 			if(x<=w){
 				if(val[i+Val[j]]==-1) val[i+Val[j]]=x;
 				else val[i+Val[j]] = min(val[i+Val[j]],x);
			 }
		 }	
	 }
	 for(int i=100004;i>=0;--i) if(val[i]!=-1) {
	 	cout<<i;
	 	return ;
	 }
}



signed main(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
  int t=1; //cin>>t;
  while(t--) solve();
  return 0;
}
// check for overflows dummy !!!


Measured memory_bytes: 4420
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    vi a(n+1);
    rep(i,n+1)cin >> a[i];
    vi b(n);
    rep(i,n)cin >> b[i];
    int ans = 0;
    rep(i,n){
        int t = min(a[i],b[i]);
        ans += t;
        b[i] -= t;
        ans += min(a[i+1],b[i]);
        a[i+1] -= min(a[i+1],b[i]);
    }
    cout << ans << endl;

}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int W,H;
char c[71][71];
string s[71][71];
string t = ".";

bool operation(const string &l,const string &r){
	if(l.size() != r.size()){
		return l.size() < r.size();
	}
	else{
		return l < r;
	}
}

string solve(int i,int j){
	string s1,s2;
	s1 = s2 = c[i][j];
	if(s[i][j] != t)return s[i][j];
	if(c[i][j+1] >= '0' && c[i][j+1] <= '9' && j+1 < W){
		if(s[i][j+1] != t) s1 += s[i][j+1];
		else s1 += solve(i,j+1);
	}
	if(c[i+1][j] >= '0' && c[i+1][j] <= '9' && i+1 < H){
		if(s[i+1][j] != t) s2 += s[i+1][j];
		else s2 += solve(i+1,j);
	}

	s[i][j] = max(s1,s2,operation);
	return s[i][j];
}

int main(){
	string res;
	while(1){
		cin >> W >> H;
		if(W == 0)break;
		res = "";
		for(int i = 0;i < 71;i++){
			for(int j = 0;j < 71;j++){
				s[i][j] = ".";
			}
		}
		for(int i = 0;i < H;i++){
			for(int j = 0;j < W;j++){
				cin >> c[i][j];
			}
		}
		for(int i = 0;i < H;i++){
			for(int j = 0;j < W;j++){
				if(c[i][j] >= '1' && c[i][j] <= '9'){
					solve(i,j);
					res = max(res,s[i][j],operation);
				}
			}
		}		
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 1580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll N = 100005;
ll w, h, x, y, ans;
vector<pll> edg;

int main()
{
	scanf("%lld%lld",&w,&h);
	for(ll i=1;i<=w+h;i++) {
		ll T;
		scanf("%lld",&T);
		edg.push_back({T, i});
	}
	sort(edg.begin(), edg.end());
	for(auto &T : edg) {
		ll A, B; tie(A, B) = T;
		if(B <= w) {ans += A * (h+1-y); x++;}
		else {ans += A * (w+1-x); y++;}
	}
	printf("%lld\n",ans);
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<class T>
struct Point {
	typedef Point P;
	T x, y;
	explicit Point(T x=0, T y=0) : x(x), y(y) {}
	bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); }
	bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); }
	P operator+(P p) const { return P(x+p.x, y+p.y); }
	P operator-(P p) const { return P(x-p.x, y-p.y); }
	P operator*(T d) const { return P(x*d, y*d); }
	P operator/(T d) const { return P(x/d, y/d); }
	T dot(P p) const { return x*p.x + y*p.y; }
	T cross(P p) const { return x*p.y - y*p.x; }
	T cross(P a, P b) const { return (a-*this).cross(b-*this); }
	T dist2() const { return x*x + y*y; }
	double dist() const { return sqrt((double)dist2()); }
	// angle to x-axis in interval [-pi, pi]
	double angle() const { return atan2(y, x); }
	P unit() const { return *this/dist(); } // makes dist()=1
	P perp() const { return P(-y, x); } // rotates +90 degrees
	P normal() const { return perp().unit(); }
	// returns point rotated 'a' radians ccw around the origin
	P rotate(double a) const {
		return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); }
};

using P = Point<long double>;

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cout << fixed << setprecision(15);
	P p1, p2;
	cin >> p1.x >> p1.y >> p2.x >> p2.y;
	int q;
	cin >> q;
	for(int i = 0; i < q; i++){
		P p;
		cin >> p.x >> p.y;
		P proj = p1 + (p2 - p1).unit() * (p - p1).dot((p2-p1).unit());
		P ref = proj * 2 - p;
		cout << ref.x << " " << ref.y << '\n';
	}
}


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

int main() {
  int N,pro,count;
  pro = 0;
  cin >> N;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    count = 0;
    while(a%2==0){
      a /= 2;
      count++;
    }
    if(count != 0){
      pro += count;
    }
  }
  cout << pro << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace Flandle_Scarlet
{
    #define N 200100
    int n,a[N];

    void Input()
    {
        scanf("%d",&n);
        for(int i=1;i<(n<<1);++i)
        {
            scanf("%d",&a[i]);
        }
    }

    int greater2(int x,int a,int b)
    {
        return (a>x) and (b>x);
    }
    int less2(int x,int a,int b)
    {
        return (a<=x) and (b<=x);
    }
    bool check(int Mid)
    {
        for(int i=0;i<n-1;++i)
        {
            if (greater2(Mid,a[n+i],a[n+i+1]) or greater2(Mid,a[n-i],a[n-i-1])) return 0;
            if (less2(Mid,a[n+i],a[n+i+1]) or less2(Mid,a[n-i],a[n-i-1])) return 1;
        }
        return (a[1]<=Mid);
    }
    void Solve()
    {
        int Low=1,High=(n<<1)-1;
        while(Low<High)
        {
            int Mid=(Low+High)>>1;
            if (check(Mid))
            {
                High=Mid;
            }
            else
            {
                Low=Mid+1;
            }
        }
        printf("%d\n",High);
    }
    void Main()
    {
        if (0)
        {
            freopen("","r",stdin);
            freopen("","w",stdout);
        }
        Input();
        Solve();
    }
    #undef N//200100
};
main()
{
    Flandle_Scarlet::Main();
    return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){ 
    string s; cin >> s;
    int cnt = 0;
    rep(i, s.size()){
        if(i%2==0 && s[i]=='p'){
            cnt--;
        }else if(i%2==1 && s[i]=='g'){
            cnt++;
        }
    }
    cout << cnt << ln;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int D = sc.nextInt();
		int ans = sc.nextInt();
		
		for(int i = 1; i <= 10; i++) {
			ans = r * ans - D;
			System.out.println(ans);
		}
		
	}
}


Measured memory_bytes: 22100
n,m = map(int, input().split())
lisppp = []
lisppm = []
lispmp = []
lispmm = []
lismpp = []
lismpm = []
lismmp = []
lismmm = []
for i in range(n):
    x,y,z = map(int, input().split())
    lisppp.append(x+y+z)
    lisppm.append(x+y-z)
    lispmp.append(x-y+z)
    lispmm.append(x-y-z)
    lismpp.append(-x+y+z)
    lismpm.append(-x+y-z)
    lismmp.append(-x-y+z)
    lismmm.append(-x-y-z)
lisppp.sort(reverse = True)
lisppm.sort(reverse = True)
lispmp.sort(reverse = True)
lispmm.sort(reverse = True)
lismpp.sort(reverse = True)
lismpm.sort(reverse = True)
lismmp.sort(reverse = True)
lismmm.sort(reverse = True)
for i in range(1,m):
    lisppp[i] += lisppp[i-1]
    lisppm[i] += lisppm[i-1]
    lispmp[i] += lispmp[i-1]
    lispmm[i] += lispmm[i-1]
    lismpp[i] += lismpp[i-1]
    lismpm[i] += lismpm[i-1]
    lismmp[i] += lismmp[i-1]
    lismmm[i] += lismmm[i-1]
ans = max(lisppp[m-1],lisppm[m-1],lispmp[m-1],lispmm[m-1],lismpp[m-1],lismpm[m-1],lismmp[m-1],lismmm[m-1]) if m != 0 else 0
print(ans)


Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

ll pw(ll a, ll n)
{
    ll ans = 1;
    while (n > 0)
    {
        if (n % 2 != 0)
            ans = ans * a;
        a = a * a;
        n = n / 2;
    }
    return ans;
}

int main()
{
    ll h;
    cin >> h;
    ll x = log(h) / log(2) + 1;
    cout << pw(2, x) - 1;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

#define MAX_N 10000
struct edge{ int to, cap, rev; };

vector<edge> G[MAX_N];
int level[MAX_N]; // sからの距離
int iter[MAX_N];  // どこまで調べ終わったか

void add_edge(int from, int to, int cap) {
  G[from].PB({to, cap, (int)G[to].size()});
  G[to].PB({from, 0, (int)G[from].size()-1});
}

void bfs(int s) {
  memset(level, -1, sizeof(level));
  queue<int> que;
  level[s] = 0;
  que.push(s);
  while(que.size()) {
    int v = que.front(); que.pop();
    for(auto i: G[v]) {
      if(i.cap > 0 && level[i.to] < 0) {
        level[i.to] = level[v] + 1;
        que.push(i.to);
      }
    }
  }
}

int dfs(int v, int t, int f) {
  if(v == t) return f;
  for(int &i = iter[v]; i<(int)G[v].size(); ++i) {
    edge &e = G[v][i];
    if(e.cap > 0 && level[v] < level[e.to]) {
      int d = dfs(e.to, t, min(f, e.cap));
      if(d > 0) {
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(int s, int t) {
  int flow = 0;
  while(1) {
    bfs(s);
    if(level[t] < 0) return flow;
    memset(iter, 0, sizeof(iter));
    int f;
    while((f = dfs(s, t, INF)) > 0) flow += f;
  }
}

string s[105];
int a[105][105];
signed main(void)
{
  int h, w;
  cin >> h >> w;
  REP(i, h) cin >> s[i];

  REP(i, h) REP(j, w) {
    if(s[i][j] == 'o') {
      add_edge(i, h+j, 1);
      add_edge(h+j, i, 1);
    } else if(s[i][j] == 'S') {
      add_edge(h+w, i, INF);
      add_edge(h+w, h+j, INF);
      add_edge(i, h+j, INF);
      add_edge(h+j, i, INF);
    } else if(s[i][j] == 'T') {
      add_edge(i, h+w+1, INF);
      add_edge(h+j, h+w+1, INF);
      add_edge(i, h+j, INF);
      add_edge(h+j, i, INF);
    }
  }

  int res = max_flow(h+w, h+w+1);
  if(res >= INF) cout << -1 << endl;
  else cout << res << endl;

  return 0;
}


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

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

    int ans;
    if (n < 10)
    {
        ans = n;
    }
    else if (n < 100)
    {
        ans = 9;
    }
    else if (n < 1000)
    {
        ans = 9 + n - 100 + 1;
    }
    else if (n < 10000)
    {
        ans = 9 + 900;
    }
    else if (n < 100000)
    {
        ans = 9 + 900 + n - 10000 + 1;
    }
    else
    {
        ans = 9 + 900 + 90000;
    }

    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
def is_in(W, H, x, y, r):
    x_min = r
    x_max = W - r
    y_min = r
    y_max = H - r
    if x_min <= x <= x_max and y_min <= y <= y_max:
        return 'Yes'
    return 'No'


if __name__ == "__main__":
    W, H, x, y, r = map(int, input().split())
    print(is_in(W, H, x, y, r))



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

 

int main() {
    ll N, M;
    string S, T;
    cin >> N >> M >> S >> T;
    ll L = N * M / __gcd(N, M);
    bool ok = true;
    ll baseN = N / __gcd(N, M);
    ll baseM = M / __gcd(N, M);
    for (int i = 0; i * baseN * baseM < L; ++i) {
        if (S.at(baseN * i) != T.at(baseM * i)) {
            ok = false;
            break;
        }
    }
    if (ok) cout << L << endl;
    else cout << -1 << endl;
}


Measured memory_bytes: 3708
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll M1,D1,M2,D2;
	while(cin>>M1>>D1>>M2>>D2) {
		ll ans = D1+1!=D2;
		cout<<ans<<endl;
	}
	
	return 0;
}


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

using namespace std;
typedef double D;

struct P {
    D x, y;
    P(D x, D y) : x(x), y(y) { }
    P() { }
};


P operator +(P a, P b) {
    a.x += b.x, a.y += b.y;
    return a;
}

P operator -(P a, P b) {
    a.x -= b.x, a.y -= b.y;
    return a;
}

// ???????????????
P operator *(P p, D s) {
    p.x *= s, p.y *= s;
    return p;
}

D inp(P a, P b) {
    return a.x*b.x + a.y*b.y;
}

D norm(P p) {
    return inp(p, p);
}

struct L : vector<P> {
    L(P a, P b) {
        this->push_back(a);
        this->push_back(b);
    }

    L() {
        this->resize(2);
    }
};

// ??卒???l???????????????p?????????
// (l??????p??????????????????????????即????????????????賊???????)
// norm??則?????贈?????????(abs??則??????????????????)
P projection(L l, P p) {
    P a = l[1] - l[0];
    P b = p - l[0];
    double t = inp(b, a) / norm(a);
    return l[0] + a * t;
}

// ??卒???l???????????????p???????属?
// (l????????????????則属???p??????)
P reflection(L l, P p) {
    return p + (projection(l, p) - p) * 2;
}

int main() {
    double x, y;

    cin >> x >> y;
    P p0(x, y);

    cin >> x >> y;
    P p1(x, y);

    L l(p0, p1);

    int Q; cin >> Q;
    while(Q--) {
        cin >> x >> y;
        P p2(x, y);
        P p = reflection(l, p2);
        printf("%.10f %.10f\n", p.x, p.y);
    }
}

Measured memory_bytes: 1252
import java.util.*;
import java.io.*;

public class Main {

    private static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(final String[] args) throws IOException {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out, true);
        int a = in.nextInt();
        int b = in.nextInt();

        int answer = a + b;
        int difference = a - b;
        if (difference > answer) {
            answer = difference;
        }
        int product = a * b;
        if (product > answer) {
            answer = product;
        }
        out.println(answer);
    }

}


Measured memory_bytes: 21204
#include <stdio.h>
#include <string.h>
int main()
{
 
  int time=0,i,head=0,tail,n,k,x[100000];
  char p[100000][10];
 
  scanf("%d %d",&n,&k);
  tail =n;
  for(i =0; i <n; i++) {
    scanf("%s %d",p[i],&x[i]);
  }
 
 
  while(tail != head) {
    if(x[head] > k) {
      time += k;
      x[head] -= k;
 
      strcpy(p[tail],p[head]);
      x[tail] = x[head];
      tail++;
      if(tail == 100000) {
        tail = 0;
      }
    }
    else{
      time += x[head];
      printf("%s %d\n",p[head],time);
    }
    head++;
    if(head == 100000) {
      head = 0;
    }
  }
  return 0;
}



Measured memory_bytes: 3048
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  int A, B, C; std::cin >> A >> B >> C;
  
  if ( A == B ) std::cout << C << std::endl;
  else if ( B == C ) std::cout << A << std::endl;
  else if ( C == A ) std::cout << B << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll l,n;
	cin>>l>>n;
	vl v(n);
	rep(i,n)cin>>v[i];
	ll mx=l-v[n-1]+v[0];
	rep(i,n-1)chmax(mx,v[i+1]-v[i]);
	puta(l-mx);
}


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

typedef long long ll;
const int N = 2000006;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll x = (a-1)/c,y = (b/c);
	ll ans = b-a+1;
	ans -= (y*c - x*c)/c;
	x = (a-1)/d;
	y = (b)/d;
	ans -= (y*d - x*d)/d;
	ll l = c*d;
	l /= (__gcd(c,d));
	x = (a-1)/l;
	y = (b)/l;
	ans += (y*l-x*l)/l;
	cout<<ans;
	
	return 0;
}


Measured memory_bytes: 3532