akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ii=pair<ll,ll>;
using vi=vector<ll>;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (ll)1e18
#define all(x) (x).begin(),(x).end()
#define print(a); for(auto x:a)cout<<x<<" "; cout<<"\n";
#define mset(a); memset(a,0,sizeof(a));

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
    ll n,a,b;cin>>n>>a>>b;
    cout<<(ll)(n/(a+b))*a+min(a,n%(a+b));
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main (void) {
    int a,b,angle;
    double PI = acos(-1); 
    scanf("%d %d %d",&a,&b,&angle);
    double rad = 2*PI*angle/360;
    printf("%lf \n%lf \n%lf\n",a*b*sin(rad)/2,sqrt(a*a+b*b-2*a*b*cos(rad))+a+b,b*sin(rad));
    return 0;
}


Measured memory_bytes: 2096
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n;
	cin >> n;

	vector<int> a(n);
	for (auto& v : a) {
		cin >> v;
	}

	int ans = accumulate(begin(a), end(a), 0LL, [](int res, int v) { return res + v - 1; });
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

using namespace std;

int gcd(int x, int y)
{
    int r;
    if (x == 0 || y == 0) // 引数チェック
    {
        //fprintf(stderr, "引数エラーです。\n"
        return 0;
    }

    // ユーグリッドの互除法
    while ((r = x % y) != 0) // yで割り切れるまでループ
    {
        x = y;
        y = r;
    }
    return y;
}

// 最大公約数を求める関数
int lcm(int x, int y)
{
    if (x == 0 || y == 0) // 引数チェック
    {
        //fprintf(stderr, "引数エラーです。\n");
        return 0;
    }

    return (x * y / gcd(x, y));
}

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

    int n, x;
    cin >> n >> x;
    if(n == 1){
        int num;
        cin >> num;
        cout << abs(x-num);
        return 0;
    }
    vector<int> v;

    REP(_,n){
        int num;
        cin >> num;
        v.PB(abs(x-num));
    }

    int r = gcd(v[0], v[1]);
    FOR(i, 2, n-2){
        r = gcd(v[i], r);
    }

    cout << r ;

}

Measured memory_bytes: 892
//  A bug is never just a mistake. It represents something bigger. An error of thinking that makes you who you are.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MAXN 200009
const int INF = 1.01e9;
#define int int64_t
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define dbv(a) cerr << #a << " = "; for (auto xxxx: a) cerr << xxxx << " "; cerr << endl


int t[4*MAXN];

int query(int v,int tl,int tr,int l,int r){
	if(l>r)return 0;
	if(tl==l && tr==r)return t[v];
	int tm = tl + (tr-tl)/2;
	return max(query(2*v,tl,tm,l,min(r,tm)),query(2*v+1,tm+1,tr,max(l,tm+1),r));
}


void update(int v,int tl,int tr,int pos,int new_val){
	if(tl==tr){ 
		t[v] = new_val;
	} else {
	int tm = tl+ (tr-tl)/2;
	if(pos<=tm) 
		update(2*v,tl,tm,pos,new_val);
	else 
		update(2*v+1,tm+1,tr,pos,new_val);
	
	t[v] = max(t[v<<1],t[(v<<1)+1]);
	
	}
}



int32_t main(){
		
	ios::sync_with_stdio(false);
    cin.tie(0);
    int mod = 998244353;
    int n;
    cin>>n;
    vector<pii> arr(n);
    vi a2(n);
    rep(i,0,n){
    	int x,d;
    	cin>>x>>d;
    	arr[i] = {x,d};
    }
    sort(arr.begin(), arr.end());
    rep(i,0,n) a2[i] = arr[i].first;
    int R[n];
    R[n-1] = n-1;
    update(1,0,n-1,n-1,n-1);
    int dp[n+1];
    dp[n] = 1;

    per(i,0,n){
    	int max_idx = lower_bound(a2.begin(),a2.end(),arr[i].first+arr[i].second)-a2.begin();
    	if(max_idx==0){
    		R[i] = i;
    	}
    	else
    		R[i] = max(query(1,0,n-1,i,max_idx-1),i);
    	update(1,0,n-1,i,R[i]);
    	dp[i] = dp[i+1] + dp[R[i]+1];
    	dp[i] %= mod;

    }

    cout<<dp[0]<<"\n";   	



}

Measured memory_bytes: 13440
#include <cmath>
#include <iostream>

int main()
{
    long long int a, b, c;
    std::cin >> a;
    std::cin >> b;
    std::cin >> c;

    if (c - a - b > 0 && (c - a - b) * (c - a - b) > 4 * a * b) {
        std::cout << "Yes" << std::endl;
    } else
        std::cout << "No" << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
#define pb push_back
typedef long long ll;
const ll INF = 1LL << 60;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n),d(n+1);
    rep(i,n){
        cin >> a[i];
    }
    d[0] = abs(a[0]);
    reps(i,1,n){
        d[i] = abs(a[i]-a[i-1]);
    }
    d[n] = abs(a[n-1]);
    ll sum = 0;
    rep(i,n+1){
        sum += d[i];
    }
    rep(i,n){
        ll ans = 0;
        if(i==0){
            ans = sum + abs(a[i+1]-0) - (d[i]+d[i+1]);
        }else if(i==n-1){
            ans = sum + abs(0-a[i-1]) - (d[i]+d[i+1]);            
        }else{
            ans = sum + abs(a[i+1]-a[i-1]) - (d[i]+d[i+1]);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 2816
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
	int t;
	int x[5];
	for (t = 0; t < 5; t++)
		cin >> x[t];
	int xsyou[5];
	int xamari[5];
	int mini = 10;
	int ext = -1;
	for (t = 0; t < 5; t++) {
		xsyou[t] = x[t] / 10;
		xamari[t] = x[t] % 10;
		if (mini > xamari[t] && xamari[t] != 0) {
			mini = xamari[t];
			ext = t;
		}
	}
	int total = 0;
	for (t = 0; t < 5; t++) {
		if (t != ext) {
			total += xsyou[t] * 10;
			if (xamari[t] != 0)
				total += 10;
		}
		else {
			total += x[t];
		}
	}
	cout << total;



}

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

int n;
long long int k;
long long int sum;
int cnt[40];

long long int dfs(int i, int f, long long int d) {
    if(i < 0){
        return sum + d;
    }
    if(f){  // greedy
        return dfs(i-1, 1, d + max(0LL, (1LL << i) * (n - 2*cnt[i])));
    }else{  // not greedy
        if(k >> i & 1){
            return max(dfs(i-1, 1, d + 0),
                       dfs(i-1, 0, d + (1LL << i) * (n - 2*cnt[i])));
        }else{
            return dfs(i-1, 0, d);
        }
    }
}

int main() {
    // input
    cin >> n >> k;
    for(int i=0;i<n;i++){
        long long int a; cin >> a;
        sum += a;
        for(int j=0;j<40;j++){
            cnt[j] += a >> j & 1;
        }
    }
    // output
    cout << dfs(41, 0, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
n = int(input())
array = list(map(int,input().split()))

if not ( 3 <= n <= 20 ): sys.exit()

count = 0
for I in range(n-2):
    if array[I] < array[I+1] < array[I+2]: count += 1
    if array[I] > array[I+1] > array[I+2]: count += 1
print(count)

Measured memory_bytes: 9100
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	int N, T;
	scanf("%d%d", &N, &T);
	int *CC = (int *)malloc(sizeof(int)*N);
	int *TT = (int *)malloc(sizeof(int)*N);
	for (int i = 0; i < N; i++) {
		scanf("%d%d", &CC[i], &TT[i]);
	}

	int cmin = 10000;
	bool ok = false;
	int ans;
	for (int i = 0; i < N; i++) {
		if (TT[i] <= T) {
			ok = true;
			cmin = Min(cmin, CC[i]);
		}
	}

	if (ok) {
		ans = cmin;
		printf("%d\n", ans);
	}
	else {
		puts("TLE");
	}




#ifdef DEBUGF
		getch();
#endif
		return 0;
	}


Measured memory_bytes: 128
a = gets.to_i
b = a.times.map{gets.chomp.to_s}

ac= 0
wc = 0
tle = 0
re = 0 

b.each  do |i|  
  if "AC" == i
    ac += 1
  elsif "WA" == i
    wc += 1
  elsif "TLE" == i
    tle += 1 
  elsif "RE" == i
    re += 1
  end
end

puts "AC x #{ac}"
puts "WA x #{wc}"
puts "TLE x #{tle}"
puts "RE x #{re}"

Measured memory_bytes: 21404
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    vector<P> p;
    int l=s.length(),b,e,pre=s[0],cnt=0;
    p.push_back({pre-'0',1});
    rep(i,l-1){
        if(s[i+1]==pre) p[cnt].second++;
        else{
            p.push_back({s[i+1]-'0',1});
            cnt++;
            pre=s[i+1];
        }
    }
    b=s[0]-'0'; e=s[l-1]-'0';
    int ans=0;
    cnt++;
    rep(i,cnt){
        if(p[i].first==0){
            int x=min(2*k,cnt-i);
            int kari=0;
            for(int j=i; j<i+x; ++j){
                kari+=p[j].second;
            }
            ans=max(ans,kari);
        }
        else{
            int x=min(2*k+1,cnt-i);
            int kari=0;
            for(int j=i; j<i+x; ++j){
                kari+=p[j].second;
            }
            ans=max(ans,kari);
        }
        if(2*k-10>cnt-i) break;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  cin.tie(0);
  string S;
  long long  Q;
  cin >> S;
  cin >> Q;

  deque<char> deq;
  for(int i=0;i<S.length();++i){
    deq.push_back(S[i]);
  }
  int rev = 0;
  for(int i=0;i<Q; ++i){
    char T;
    cin >> T;
    if(T == '1'){
      if(rev == 0){
        rev = 1;
      }else{
        rev = 0;
      }

    }else{
      char F;
      char C;
      cin >> F >> C;
      if((F == '1' && rev == 0) || (F == '2' && rev == 1)){        
        deq.push_front(C);
      }else{
        deq.push_back(C);
      }
    }
  }

  long long L = deq.size();
  if(rev == 0){
    for(int i=0;i<L;++i){
      cout << deq[i];
    }
  }else{
    for(int i=L-1;i>=0;i--){
      cout << deq[i];
    }
  }

  cout << "\n";
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
struct uf{
vector<int> v;
uf(int n):v(n){
iota(v.begin(),v.end(),0);
}
int find(int x) {return v[x] == x ? x : v[x]=find(v[x]);}
void unite(int x,int y) {v[find(x)]=find(y);}
};
struct rmq{
  vector<int> v;
  int size;
  rmq(int n){
    size=1;
    while(size<n)size<<=1;
    v=vector<int>(size*2,2147483647);
  }
  void update(int i,int x){
    v[size+i]=x;
    _update((size+i)/2,x);
    //for(auto&& item : v) cout<<item<<" ";
    //cout<<endl;
  }
  void _update(int i,int x){
    if(i==0)return;
    v[i]=min(v[i*2],v[i*2+1]);
    _update(i/2,x);
  }
  int query(int l,int r,int i,int x,int y){
    if(y<l||r<x) return 2147483647;
    if(l<=x&&y<=r) return v[i];
    
    return min(query(l,r,i*2,x,(x+y)/2),
               query(l,r,i*2+1,(x+y)/2+1,y));
  }
};
int main(){
  int n,q;
  cin>>n>>q;
  rmq r(n);
  for(int i=0;i<q;i++){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==0)r.update(b,c);
    else cout<<r.query(b,c,1,0,r.size-1)<<endl;
  }
}


Measured memory_bytes: 3832
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>	tree_set;
typedef long long ll;
typedef long double ld;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

ll mod=1e9 + 7;

int main()
{
    fast();
    ll r,c;
    cin>>r>>c;

    cout<<(r-1)*(c-1);
}



Measured memory_bytes: 764
using namespace std;

#include<bits/stdc++.h>

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

#define getBit(x,i) (x&(1<<i))
#define setBit(x,i) (x|(1<<i))
#define mem(A,N) memset(A,N,sizeof(A))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define rep(i, x, y)  for(int i = x; i < y; ++i)
#define Rep(i, x, y)  for(int i = x; i <= y; ++i)
#define srep(i, x, y) for(int i = x; i > y; --i)
#define sRep(i, x, y) for(int i = x; i >= y; --i)
#define all(v) v.std::begin(),v.std::end()
#define Sort(x) sort(x.begin(), x.end())
#define f1(i,n) for (int i=1; i<=n; i++)
#define f0(i,n) for (int i=0; i<n; i++)
#define sz(x) ((int)(x).size())
#define len(x) ((int)(x).length())
#define fi first
#define se second
#define concatenate(a, b) std::copy(b.begin(), b.end(), std::back_inserter(a));
// #define concatenate(a, b) a.insert(b.end(), b.begin(), b.end());
// std::move(b.begin(), b.end(), std::back_inserter(a)); "Undefined behaviour if a actually is b (which is OK if you know that can never happen - but worth being aware of in general purpose code)"
#define makeUnique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define inRange(x, a, b) (a <= x && x < b)

#define linf 0x7FFFFFFFFFFFFFFF
#define inf 0x7FFFFFFF
#define mod 1000000007
#define eps 1e-9
#define Pi 3.14159265358979323846

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define write(x) cerr << #x << " = " << (x) << ", ";
#define writeI0 cerr << "i = " << 0 << ", ";
#define dumpI0 cerr << "i = " << 0 << endl;
#define printSet(s) for(auto it = s.begin(); it!=s.end(); it++) (it==s.begin())? cout << *it : cout << ' ' << *it; cout << endl;
#define printMap(m) for(auto it = m.begin(); it!=m.end(); it++) (it==m.begin())? cout << '(' << it->first << ", " << it->second << ')' : cout << " (" << it->first << ", " << it->second << ')'; cout << endl;
#define printPairSet(s) for(auto it = s.begin(); it!=s.end(); it++) (it==s.begin())? cout << '(' << it->first << ", " << it->second << ')' : cout << " (" << it->first << ", " << it->second << ')'; cout << endl;
#define printVector(x) for(auto it = x.begin(); it!=x.end(); it++) (it==x.begin())? cout << *it : cout << ' ' << *it; cout << endl;
#define printArray(a,x,y) for(auto it = a+x; it != a+y; it++) (it==a+x)? cout << *it : cout << ' ' << *it; cout << endl;
#define PrintArray(a,x,y) for(auto it = a+x; it != a+y+1; it++) (it==a+x)? cout << *it : cout << ' ' << *it; cout << endl;

// ***************** End Of Template ********************

// int a[100010];
// int b[100010];
// int c[100010];
string s;
int n, m, k, q;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int t1, t2, t3; char c1, c2;

	int x;
	cin >> k >> x;
	ll d = k * 500;
	if (d >= x) {
		cout << "Yes";
	}else
		cout << "No";
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int p=1e9+7;
typedef long long ll;
int main()
{
  ll n,a,s=0,i,res=0;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a;
    res+=(a*s)%p;
    res%=p;
    s+=a;
    s%=p;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var abc = Console.ReadLine().Split(' ').Select(x => BigInteger.Parse(x)).ToArray();
            if(abc[2]- abc[0]- abc[1]<0)
            {
                Console.WriteLine("No");
                return;
            }
            if (4*abc[0] * abc[1]<(abc[2]- abc[0]- abc[1])* (abc[2] - abc[0] - abc[1]))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 13524
#include<iostream>
#include<string>
#include<map>


using namespace std;

int main() {


	map<string, int> map;

	int n;

	cin >> n;


	string s;

	for (int i = 0; i < n; i++) {

		cin >> s;

		if (map.count(s) == 0) {

			map[s] = 1;
		}
		else {
			map[s]++;
		}
	}
	int max = 0;

	for (auto i = map.begin(); i != map.end(); i++) {
		if (max < i->second)max = i->second;
	}
	for (auto i = map.begin(); i != map.end(); i++) {
		if (i->second == max)cout << i->first << endl;
	}
}

Measured memory_bytes: 25216
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;

int n,k;
int a[200005];

bool check(ll l,ll r){
    ll p=(l+r)/2;
    int temp=0;
    rep(i,n){
        temp+=(a[i]-1)/p;
    }
    //cerr<<l<<r<<temp<<endl;
    if(temp>k)return 0;
    else return 1;
}

int main(){
    cin >> n>> k;
    rep(i,n) cin >> a[i];
    ll l=0,r=INF;
    while(r-l>1){
        if(check(l,r)) r=(r+l)/2;
        else l=(r+l)/2;
    }
    cout<<r<<endl;
    return 0;
}

Measured memory_bytes: 4412
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
min_dif=float('inf')
for i in range(n):
    tem=t-h[i]*0.006
    dif=abs(tem-a)
    if dif<min_dif:
        min_dif=dif
        min_ind=i
print(min_ind+1)

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

#define GMAX 20
#define SMAX 400
#define TMAX 100
#define INFTY (1<<21)

int N, M, D, sy, sx, gy, gx;
int G[GMAX][GMAX][GMAX][GMAX], S[GMAX][GMAX];
bool V[GMAX][GMAX][TMAX+1][4];

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

bool valid( int y , int x ){
    return ( 0 <= y && 0 <= x && y < N && x < M );
}

void dfs( int y, int x, int t, int d ){
    V[y][x][t][d] = true;

    int ny, nx, nt;
    for ( int nd = 0; nd < 4; nd++ ){
	if ( (d+2)%4 == nd ) continue;

	ny = y + dy[nd];
	nx = x + dx[nd];

	if ( !valid(ny, nx) ) continue;
	if ( G[y][x][ny][nx] == INFTY ) continue;

	nt = t + G[y][x][ny][nx];

	if ( nt > TMAX ) continue;

	if ( S[ny][nx] > 0 ){
	    if ( nd % 2 == 0 ){
		if ( (nt/S[ny][nx])%2 != 1 ) continue;
	    } else {
		if ( (nt/S[ny][nx])%2 != 0 ) continue;
	    }
	}

	if ( V[ny][nx][nt][nd] ) continue;

	dfs( ny, nx, nt, nd );
    }
}

int compute(){
    for ( int y = 0; y < N; y++ ){
	for ( int x = 0; x < M; x++ ){
	    for ( int t = 0; t <= TMAX; t++ ){
		for ( int d = 0; d < 4; d++ ) {
		    V[y][x][t][d] = false;
		}
	    }
	}
    }

    for ( int d = 0; d < 4; d++ ) dfs( sy, sx, 0, d );
    
    for ( int t = 0; t <= TMAX; t++ ){
	for ( int d = 0; d < 4; d++ ){
	    if ( V[gy][gx][t][d] ) return t;
	}
    }
}

int getNumber( char ch ){ return ch - 'a';}

bool input(){
    cin >> N >> M;
    if ( N == 0 && M == 0 ) return false;
    cin >> D;

    int ny, nx;
    for ( int y = 0; y < N; y++ ){
	for ( int x = 0; x < M; x++ ){
	    S[y][x] = 0;
	    for ( int nd = 0; nd < 4; nd++ ){
		ny = y + dy[nd];
		nx = x + dx[nd];
		if ( valid(ny, nx) ){
		    G[y][x][ny][nx] = G[ny][nx][y][x] = D;
		}
	    }
	}
    }

    int nsignal, nconst, njam, y1, x1, y2, x2, k, d; 
    char ch, tmp;

    cin >> nsignal;
    for ( int i = 0; i < nsignal; i++ ){
	cin >> ch  >> tmp >> x1 >> k; x1--;
	S[getNumber(ch)][x1] = k;
    }

    cin >> nconst;
    for ( int i = 0; i < nconst; i++ ){
	cin >> ch >> tmp >> x1; x1--;
	y1 = getNumber(ch);
	cin >> ch >> tmp >> x2; x2--;
	y2 = getNumber(ch);
	G[y1][x1][y2][x2] = G[y2][x2][y1][x1] = INFTY;
    }
    
    cin >> njam;
    for ( int i = 0; i < njam; i++ ){
	cin >> ch >> tmp >> x1; x1--;
	y1 = getNumber(ch);
	cin >> ch >> tmp >> x2 >> d; x2--;
	y2 = getNumber(ch);
	G[y1][x1][y2][x2] += d;
	G[y2][x2][y1][x1] += d;
    }

    cin >> ch >> tmp >> sx; sy = getNumber(ch);
    cin >> ch >> tmp >> gx; gy = getNumber(ch);
    sx--; gx--;
    return true;
}

main(){
    while( input() ) cout << compute() << endl;
}

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

int main(){
    string s;
    cin >> s;
    int cou=0;
    int frg=1;
    for(int i=0;i<s.size();i++){
        if(frg){
            if(s[i]=='A'){
                cou++;
                frg=0;
            }
        }else{
            if(s[i]=='Z'){
                cou++;
                frg=1;
            }
        }
    }

    cou/=2;

    if(cou>=1){
        for(int i=0;i<cou;i++)cout << "AZ";
    }else{
        cout << "-1";
    }
    cout << endl;

    return 0;
}

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

int main(){
    int t,k,x,y;
    cin >> x >> y;
    k= y/2 -x;
    t = 2*x - y/2;
    if(t+k == x && 2*t + 4*k == y && t >= 0 && k >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3616
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int loc[200005];
int n;

int main() {
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) {
        int t;
        scanf("%d", &t);
        loc[t] = i;
    }
    int maxLen = 0;
    for(int i = 1; i <= n;) {
        int last = loc[i];
        int j = i+1;
        while(j <= n && loc[j] > last) {
            last = loc[j++];
        }
        maxLen = max(maxLen, j-i);
        i = j;
    }
    printf("%d\n", n - maxLen);
}


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

int main() {
  int N, i, Alice=0, Bob=0;
  cin >> N;
  vector<int> a(N);
  
  for(i=0; i<N; i++)
    cin >> a.at(i);
  
  
  for(i=0; i<N; i++) {
    int max = 0, max_idx;
    for(int j=0; j<N; j++)
      if(max < a.at(j)) {
        max = a.at(j);
        max_idx = j;
      }
    
    a.at(max_idx) = 0;
    
    if(i%2 == 0)
      Alice += max;
    else
      Bob += max;
  }
  
  cout << Alice-Bob << endl;
}

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

int n, a, b, c, x;
int y[100];

int main() {
	int i;
	
	while (true) {
		cin >> n >> a >> b >> c >> x;
		if (!n) break;
		for (i = 0; i < n; i++) cin >> y[i];
		
		int r = x;
		int cor = 0;
		
		for (i = 0; i <= 10000; i++) {
			if (r == y[cor]) {
				cor++;
			}
			if (cor == n) {
				break;
			}
			r = (r * a + b) % c;
		}
		
		if (cor < n) { cout << -1 << endl; }
		else { cout << i << endl; }
	}
	return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main()
{
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
    return 0;
}

Measured memory_bytes: 3628
akiba = ["KIH", "B", "R", ""]
s=input()
for bit in range(2**4):
    a=""
    for i in range(4):
        if bit>>i & 1:
            a+="A"
        a+=akiba[i]
    if s==a:
        print("YES")
        exit()
    
print("NO")

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

int main() {
  int s;
  cin >> s;
  vector<int> a;
  a.push_back(s);
  int cnt = 0;
  while (true) {
    int d = a.back();
    if (d == 4) break;
    else if (d % 2 == 0) a.push_back(d / 2);
    else a.push_back(3 * d + 1);
    cnt++;
  }

  if (s == 1 || s == 2) cout << 4 << endl;
  else cout << cnt+4 << endl;

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
#ABC121 B

N,M,C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]

ans = 0
for i in range(N):
    sum = C
    for j in range(M):
        sum += A[i][j]*B[j]
    if sum > 0:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include <stdio.h>

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    char s[n];
    scanf("%s", s);
    s[k-1] = s[k-1] + 32;

    for (int i = 0; i < n; ++i){
        printf("%c", s[i]);
    }
    return 0;
}

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

int main() {
	int W, H, N;
	cin >> W >> H >> N;
	int W_left = 0, H_under = 0;
	vector<int>x;
	vector<int>y;
	vector<int>a;
	for (int i = 0; i < N; i++)
	{
		int tx, ty, ta;
		cin >> tx >> ty >> ta;
		x.push_back(tx);
		y.push_back(ty);
		a.push_back(ta);
	}

	for (int i = 0; i < N; i++) {
		switch (a[i]) {
		case 1:
			if (W_left < x[i])
				W_left = x[i];
			break;
		case 2:
			if(W>x[i])
				W = x[i];
			break;
		case 3:
			if(H_under<y[i])
				H_under = y[i];
			break;
		case 4:
			if(H>y[i])
				H = y[i];
			break;
		}
	}

	if (W <= W_left)
		cout << 0 << endl;
	else if (H <= H_under)
		cout << 0 << endl;

	else 
		cout << (W - W_left)*(H - H_under) << endl;




	return 0;
}

Measured memory_bytes: 256
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

a, b, k = na()

cnt = 0
ans = 0
for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        cnt += 1
    if cnt == k:
        ans = i
        break

print(ans)

Measured memory_bytes: 3064
import java.io.*;
import java.util.*;
import java.lang.*;
public class Main {
		
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		int n=sc.nextInt();
		int k=sc.nextInt();
		long ans=0;
		int x=k;
		int ans1=0;
		int ans2=0;
		while(x<=n) {
			ans1++;
			x+=k;
		}
		int y=k/2;
		if(k%2==0) {
			while(y<=n) {
				ans2++;
				y+=k;
			}
			
		}
		ans+=(long)Math.pow(ans1,3)+Math.pow(ans2,3);
	
		System.out.println(ans);
		
	}

	
	
//----------------------------------------------------------
	static int l_min(int[] a) {
		Arrays.sort(a);
		return a[0];
	}
	static int l_max(int[] a) {
		int l=a.length;
		Arrays.sort(a);
		return a[l-1];
	}
	
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			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;
		}

	}
	

}



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

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

    int ans = 0;
    for (int i = 0; i < S.size() - 2; i++)
    {
        if (i == 0)
        {
            ans = abs(stoi(S.substr(i, 3)) - 753);
        }
        if (abs(stoi(S.substr(i, 3)) - 753) < ans)
        {
            ans = abs(stoi(S.substr(i, 3)) - 753);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll INF =ll(1e18)+5;

void solve(long long N, long long M, long long K, std::vector<long long> A, std::vector<long long> B){
    vector<ll> Asum(N+1),Bsum(M+1);
    Asum[0] = 0;Bsum[0]=0;
    for(int i=0;i<N;i++){
        Asum[i+1] = Asum[i] + A[i]; 
    }
    for(int i=0;i<M;i++){
        Bsum[i+1] = Bsum[i] + B[i];
    }
    ll l= 0;
    ll r = N+M+1;
    while(l+1<r){
        ll mid = (l+r)/2;
        ll temp = INF;
        for(int i=-1;i<N;i++){
            if(mid-(i+1)<0){
                break;
            }
            if(mid-(i+1)>M){
                continue;
            }
            temp = min(temp,Asum[i+1]+Bsum[(mid)-(i+1)]);
        }
        // cerr <<"mid=" <<mid <<"temp=" <<temp << endl;
        if(temp>K){
            r = mid;
        }else{
            l  =mid;
        }
        
    }
    cout << l << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    std::vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&B[i]);
    }
    solve(N, M, K, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 9616
N,K=map(int,input().split())
S=input()
ans=[]
index=[]#0start, 0end
if S[0]=='0':
    index.append(0)

for i in range(1,len(S)):
    if S[i-1]!=S[i] and S[i]=='1':
        index.append(i-1)
    elif S[i-1]!=S[i] and S[i]=='0':
        index.append(i)

if S[-1]=='0':
    index.append(len(S)-1)

if K<len(index)//2:
    for i in range(len(index)//2-K+1):
        if i == 0:
            start=0
        else:
            start=index[2*i-1]+1
        if i==len(index)//2-K:
            end=len(S)-1
        else:
            end=index[2*(i+K)]-1
        ans.append(end-start+1)

if K>=len(index)//2:
    print(len(S))
else:
    print(max(ans))


Measured memory_bytes: 8768
import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[] H=new int[N];
		for(int i=0; i<N; i++) {
			H[i]=sc.nextInt();
		}
		int[] dp=new int[N];
		Arrays.fill(dp, 0);
		if(N==1) {
			p(0);
			System.exit(0);
		}
		else{
			for(int i=N-1; i>=1; i--) {
				if(H[i-1]>=H[i]) {
					dp[i-1]=dp[i]+1;
				}
				else {
					dp[i-1]=0;
				}
			}
			int max=0;
			for(int i=0; i<N; i++) {
				max=Math.max(max, dp[i]);
			}
			p(max);
		}

	}
	public static void p(Object o) {
		System.out.println(o);
	}
}

Measured memory_bytes: 50344
int main(){
    int n,a[100];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=n-1;i>0;i--){
        printf("%d ",a[i]);
    }
    printf("%d\n",a[0]);
}


Measured memory_bytes: 2092
"use strict"

function Main(stdin){
stdin = stdin.trim().split("\n").reverse();
var stdout = [];
function input(){return stdin.pop()};
function print(x){stdout.push(x)};
function mapint(x){return x.map(n=>parseInt(n))};
function max(x){return x.reduce(function(a,b){ return Math.max(a,b) }) }
function min(x){return x.reduce(function(a,b){ return Math.min(a,b) }) }
function sum(x){return x.reduce(function(a,b){ return a+b }) }
function all(x){return x.reduce(function(a,b){ return a && b }) }


var tmp = mapint(input().split(" "))
var a = tmp[0]
var b = tmp[1]
var k = tmp[2]
var x = [1]
for (var i = 2; i < Math.min(a,b) + 1; i++){
    if (all( [a%i==0, b%i==0] )){ x.push(i) }
}
print(x[x.length - k])




stdout = stdout.join("\n");
console.log(stdout);
return stdout
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 7372
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll n,m; cin >> n >> m;
    vpl a(n);
    vl b(n+m,1);
    rep(i,n){
        cin >> a[i].first;
        a[i].second = b[i];
    }
    ll c;
    rep(i,m){
        cin >> b[n+i] >> c;
        a.emplace_back(c,b[n+i]);
    }
    sort(a.rbegin(), a.rend());
    //rep(i,m+n) cout << a[i].first << endl;
    ll ans = 0;
    ll index = 0;
    ll i=0;
    //rep(i,m+n) cout << a[i].first << " " << a[i].second << endl;
    while(i < n){
        rep(j,a[index].second){
            //cout << a[index].first << endl;
            ans += a[index].first;
            i++;
            if(i == n) break;
        }
        index++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 7036
#include<bits/stdc++.h>
using namespace std;
int x[20],y[20],p[20];
int xd[20][40010],yd[20][40010],u[40010],v[40010];
int X[20],Y[20],tot;
long long ans[30];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d%d%d",&x[i],&y[i],&p[i]);
	int k=1;
	for(int i=0;i<n;i++)k*=3;
	for(int i=0;i<=n;i++)ans[i]=1e18;
	int K=1<<n;
	for(int i=0;i<n;i++){
		for(int j=0;j<K;j++)xd[i][j]=abs(x[i]),yd[i][j]=abs(y[i]);
		for(int j=0;j<K;j++){
			for(int l=0;l<n;l++){
				if(j&(1<<l)){
					xd[i][j]=min(xd[i][j],abs(x[i]-x[l]));
					yd[i][j]=min(yd[i][j],abs(y[i]-y[l]));
				}
			}
		}
	}
	for(int i=0;i<K;i++){
		tot=0;
		for(int j=0;j<n;j++){	
			if(i&(1<<j)){
				X[tot]=x[j];
				Y[tot++]=y[j];
			}
		}
		if(tot){
			sort(X,X+tot);
			u[i]=unique(X,X+tot)-X;
			sort(Y,Y+tot);
			v[i]=unique(Y,Y+tot)-Y;
		}
	}
	for(int i=0;i<k;i++){
		int a=0,b=0;
		for(int j=0,m=1;j<n;j++,m*=3){
			int c=i/m%3;
			if(c==1)a|=(1<<j);
			if(c==2)b|=(1<<j);
		}
		long long tmp=0;
		for(int j=0;j<n;j++)tmp+=(long long)p[j]*min(xd[j][a],yd[j][b]);
		if(ans[u[a]+v[b]]>tmp)ans[u[a]+v[b]]=tmp;
	}
	for(int i=0;i<=n;i++){
		if(i)ans[i]=min(ans[i],ans[i-1]);
		printf("%lld\n",ans[i]);
	}
} 

Measured memory_bytes: 8024
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	char c;
	REP(i, 3) {
		cin >> c;
		cout << (c == '1' ? '9' : '1');
	}
	cout << endl;
	return 0;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
const int INF = 114514810;
const int MOD = 1000000007;
const double EPS = 1e-10;
struct edge
{
	int to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
int dx[] = { -1, 0, 0, 1 }; int dy[] = { 0, -1, 1, 0 };
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
int place(int x, int y, int w) { return w*x + y; }
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///


int main()
{
	int x, y, s;
	while (cin >> x >> y >> s, x)
	{
		x += 100;
		y += 100;
		int ans = -1;
		FOR(i, 1, 1000)
		{
			FOR(j, 1, 1000)
			{
				if (i*x / 100 + j*x/100== s)
				{
					chmax(ans, i*y / 100 + j*y / 100);
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

long long calc(int n, int cc1, int cc2, int s1, int s2, const vector<int>& options,
               int dd, int nt, int ot) {
  int before(dd-1), after(dd+1);
  while (before >= 0 && options[before] != nt) before--;
  while (after < n && options[after] != nt) after++;
  int a(dd - before - 1), b(after - dd - 1), c(after - before - 1);
  int diff = c * (c+1) / 2 - a * (a+1) / 2 - b * (b+1) / 2;
  int before2(dd-1), after2(dd+1);
  while (before2 >= 0 && options[before2] != ot) before2--;
  while (after2 < n && options[after2] != ot) after2++;
  int a2(dd - before2 - 1), b2(after2 - dd - 1), c2(after2 - before2 - 1);
  int diff2 = c2 * (c2+1) / 2 - a2 * (a2+1) / 2 - b2 * (b2+1) / 2;
  return + (long long) diff * cc1 - (long long) diff2 * cc2 + s1 - s2;
}
int main() {
  int n;
  cin >> n;
  vector<int> c(26);
  vector<array<int, 26>> s(n);
  
  vector<int> last(26, -1);
  
  for (int i = 0; i < 26; ++i)
    cin >> c[i];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < 26; ++j)
      cin >> s[i][j];
  
  long long total(0);
  vector<int> options(n);
  
  for (int i = 0; i < n; ++i) {
    int neg(0), test(-1);
    for (int j = 0; j < 26; ++j) {
      neg -= c[j] * (i - last[j]);
    }
    //cout << neg << 'n' << endl;
    int max_score = -1e9;
    for (int j = 0; j < 26; ++j) {
      int ss = s[i][j] + neg + c[j] * (i - last[j]);
      if (ss > max_score) {
        max_score = ss;
        test = j;
      }
    }
    total += max_score;
    //cout << test + 1 << endl;
    options[i] = test;
    //cout << test + 1 << ' ' << max_score << endl;
    last[test] = i;
  }
  //cout << total << endl;
  for (int t = 1; t <= 1000; ++t) {
    for (int dd = n - 1; dd >= 0; --dd) {
      for (int tt = 25; tt >= 0; --tt) {
        if (tt == options[dd]) continue;
        int ot = options[dd];
        
        long long ns = calc(n, c[tt], c[ot], s[dd][tt], s[dd][ot], options, dd, tt, ot);
        //cout << ns << endl;
        if (ns > 0) {
      		total += ns;
          options[dd] = tt;
    	}
      }
    }
  }
  for (const int& i: options) cout << i + 1 << endl;
  //cout << total << endl;
  return 0;
}

Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
const int maxn = 210;
string s1 = "Takahashi",s2 = "Aoki";
inline int read(void)
{
	int x = 0,f = 1; char ch = cin.get();
	while(!isdigit(ch)){f = ch == '-' ? -1 : 1; ch = cin.get();}
	while(isdigit(ch)){x = (x << 3) + (x << 1) + ch - '0'; ch = cin.get();}
	return x * f;
}
int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);
	int n = read();
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		int x = read() , k = read();
		while((x%k)) x -= ((x%k-1)/(x/k+1)+1) * (x/k+1);
		ans ^= x/k; 
	}
	if (ans) cout << s1;
	else cout << s2;
	return 0;
}


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



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll n;
    cin>>n;
    int a[n];
    int ans = 0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(i && a[i] > a[i-1]) ans++;
    }
    cout << ans << endl;
    
}



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

#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const ll INF = (ll)1<<62;
const ll MOD = 1e9+7;

int main(){
	int n;
	cin>>n;
	int mini = n+1, cnt=0;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		if(x<mini){
			mini = x;
			cnt++;
		}
	}
	cout<<cnt<<"\n";
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
#define trav(x,c) for(auto &x:c)
using namespace std;

int toint(string s)
{
    int ans = 0;
    for(char x: s)
        ans = ans*10 + (x - '0');
    return ans;
}

int sum(int x)
{
    int s = 0;
    while(x)
    {
        s += x%10;
        x /= 10;
    }
    return s;
}

bool equal(string s)
{
    for(int i = 0,j = s.size()/2; j < s.size(); i++,j++)
    {
        if(s[i] != s[j])
            return false;
    }
    return true;
}

int main()
{
    int a,b,c,s=0;
  //  freopen("input.txt","r",stdin);
    cin>>a>>b;
    int f = 1;
    set<int> vis;
    set<int> :: iterator it;
    vector < int > v;
    for(int i=0;i<a;i++)
    {
        cin>>c;
        v.push_back(c);
    }
        for(int i=0;i+1<a;i++)
    {
        if(abs(v[i]-v[i+1])<=b)
        {
            s=s+abs(v[i+1]-v[i]);
        }
        else
        {
            s+=b;
        }

    }
    s+=b;
    printf("%d\n",s);

}


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

int main() {
  int W, H, x, y, r;

  cin >> W >> H >> x >> y >> r;
  if(x-r < 0 || x+r > W || y-r < 0 || y+r > H) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

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

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    map<int, int> mp1, mp2;
    for(int i=0; i<n; i++){
        cin >> v[i];
        if(i%2){
            mp2[v[i]]++;
        }else{
            mp1[v[i]]++;
        }
    }

    // 数字, count
    pair<int, int> max1, next_max1;
    max1 = make_pair(0, 0), next_max1 = make_pair(0, 0);
    for(auto m: mp1){
        int tmp = m.second;
        if(tmp > max1.second){
            next_max1 = max1;
            max1 = make_pair(m.first, m.second);
            continue;
        }
        if(tmp > next_max1.second){
            next_max1 = make_pair(m.first, m.second);
            continue;
        }
    }

    pair<int, int> max2, next_max2;
    max2 = make_pair(0, 0), next_max2 = make_pair(0, 0);
    for(auto m: mp2){
        int tmp = m.second;
        if(tmp > max2.second){
            next_max2 = max2;
            max2 = make_pair(m.first, m.second);
            continue;
        }
        if(tmp > next_max2.second){
            next_max2 = make_pair(m.first, m.second);
            continue;
        }
    }

    if(max1.first!=max2.first){
        cout << n - max1.second - max2.second << endl;
        return 0;
    }
    cout << min(n - max1.second - next_max2.second, n - next_max1.second - max2.second) << endl;

    return 0;
}

Measured memory_bytes: 5376
//This Code was made by Chinese_zjc_.
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <time.h>
// #include<windows.h>
#define int long long
#define double long double
using namespace std;
const double PI = acos(-1);
const double eps = 0.0000000001;
const int INF = 0x3fffffffffffffff;
int n;
signed main()
{
    ios::sync_with_stdio(false);
    cin >> n;
    cout << (!n) << endl;
    return 0;
}

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

int dp[11][11];
int calcMinPower(const int cij[10][10], int n) {
    const int M = 1000000;
    rep(i, 11) {
        rep(j, 11) {
            dp[i][j] = M;
        }
    }
    dp[0][n] = 0;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            if (dp[i][j] == M) {
                continue;
            }
            for (int k = 0; k < 10; k++) {
                dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + cij[j][k]);
            }
        }
    }
    return dp[10][1];
}

int main()
{
    int W, H;
    cin >> H >> W;
    int cij[10][10];
    rep(i, 10) {
        rep (j, 10) {
            cin >> cij[i][j];
        }
    }
    //0-9を1にするのに必要な最低魔力を求める
    int minPList[10];
    rep(i, 10) {
        minPList[i] = calcMinPower(cij, i);
    }
    //計算
    int total = 0;
    rep(i, H) {
        rep(j, W) {
            int a;
            cin >> a;
            if (a >= 0) {
                total += minPList[a];
            }
        }
    }
    cout << total << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#define rep(i,a,n) for(int i=a;i<n;i++)

int main(){
	char c;
	int d[26]={0};
	while(scanf("%c",&c)!=EOF){
		//if(c=='0') break;
		if('a'<=c && c<='z') d[c-'a']++;
		else if('A'<=c && c<='Z') d[c-'A']++;
	}
	rep(i,0,26){
		printf("%c : %d\n",'a'+i,d[i]);
	}
	return 0;
}

Measured memory_bytes: 968