akhauriyash/Code-Regression huggingface dataset:
import math
a = [[] for i in range(5)]
min_inp = 0
for i in range(5):
    inp = int(input())
    inp_ceil = math.ceil(inp/10)*10
    first = inp - int(inp/10) * 10
    if first == 0:
        first = 10
    a[i].append(inp)
    a[i].append(inp_ceil)
    a[i].append(first)
a = sorted(a, key=lambda x: x[2])
ans = a[0][0]

for i in range(4):
    ans += a[i+1][1]

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
  int N,i,j,minj,temp,count=0;
  int A[100];
  scanf("%d",&N);
  for(i=0;i<N;i++)
    scanf("%d",&A[i]);

  for(i=0;i<N;i++){
    minj=i;
    for(j=i;j<N;j++)
      if(A[j]<A[minj])minj=j;

    if(minj!=i){
      temp=A[i];
      A[i]=A[minj];
      A[minj]=temp;
      count++;
    }
  }
  for(i=0;i<N;i++){
    printf("%d",A[i]);
    if(i!=N-1)printf(" ");
  }
  printf("\n%d\n",count);
  return 0;
}


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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(ll i=0;i<(n);i++)

using namespace std;


void solve(ll n, ll x){
    if(n == 2){
        if(x != 2)  cout << "No" << endl;
        else{
            cout << "Yes" << endl;
            cout << 1 << endl;
            cout << 2 << endl;
            cout << 3 << endl;
        }
    }
    else{
        if(x == 1)                 cout << "No" << endl;
        else if(2*n-1 == x)        cout << "No" << endl;
        else{
            cout << "Yes" << endl;
            ll o = 1;
            rep(i, n-3){
                if(o == x-2)    o += 5;
                if(o == x-1)    o += 4;
                cout << o << endl;
                o++;
            }
            if(x != 2)      cout << x-2 << endl;
                            cout << x+1 << endl;
                            cout << x << endl;
                            cout << x-1 << endl;
            if(x != 2*n-2)  cout << x+2 << endl;
            rep(i, n-2){
                if(o == x-2)    o += 5;
                if(o == x-1)    o += 4;
                if(o <= 2*n-1)  cout << o << endl;
                o++;
            }
        }
    }
}


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

    solve(n, x);

    return 0;
}

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

template<typename T>
struct WeightedUnionFind {
    vector<int> data;
    vector<T> ws;
    WeightedUnionFind(int sz) : data(sz, -1), ws(sz) { }
    bool merge(int x, int y, T w) {             // ws(y) = ws(x) + w
        w += weight(x); w -= weight(y);
        if ((x = root(x)) == (y = root(y))) return false;
        if (data[x] > data[y]) swap(x, y), w = -w;
        data[x] += data[y]; data[y] = x; ws[y] = w;
        return true;
    }
    bool find(int x, int y) { return root(x) == root(y); }
    T diff(int x, int y) { return weight(y) - weight(x); }
    T weight(int t) { root(t); return ws[t]; }
    int root(int k) {
        if (data[k] < 0) return k;
        int par = root(data[k]);
        ws[k] += ws[data[k]];
        return data[k] = par;
    }
};

int main() {
    int n, m; cin >> n >> m;
    WeightedUnionFind<int> wuf(n);
    while (m--) {
        int l, r; cin >> l >> r; l--, r--;
        int d; cin >> d;
        if (wuf.find(l, r)) {
            if (wuf.diff(l, r) != d) return !(cout << "No" << endl);
        } else {
            wuf.merge(l, r, d);
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1024
/*
    inputファイル見ないと通るか分からない奴やめろ
 */

#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

int n;
int c;

int pow(int base, int exp) {
    int res;
    if (exp == 0) return 1;

    res = pow(base*base, exp/2);
    if (exp % 2 == 1) res *= base;
    return res;
}

bool isprime(int p) {
    for (int i=2; i<=(int)floor(sqrt(p)); i++) {
        if (p % i == 0) return false;
    }

    return true;
}

int dfs(int now, int count) {
    int ans = -1;

    if (count == 0) {
        if (now % 10 == 0 || !isprime(now)) return -1;
        return now;
    }

    for (int i=0; i<10; i++) {
        ans = max(ans, dfs(now * 10 + i * pow(10, (n-count+1)*2) + i, count-1));
    }

    return ans;
}


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

    if (c < 0) {
        if (n == 1) {
            puts("11");
        } else {
            for (int i=0; i<n*2; i++) printf("9");
            puts("");
        }
    } else {
        int ans = dfs(c, n);
        if (ans == -1) {
            for (int i=0; i<n; i++) printf("9");
            printf("%d", c);
            for (int i=0; i<n; i++) printf("9");
            puts("");
        } else {
            printf("%d\n", ans);
        }
    }
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
int N;
int solve(){
    int res = 0;
    vector<vector<int>> G(N);
    for(int i = 0; i < N;i++){
        int M; cin >> M;
        for(int j = 0; j < M;j++){
            int p; cin >> p; p--;
            G[p].push_back(i);
        }
    }
    vector<int> f(N);
    int K; cin >> K;
    for(int i = 0; i < K;i++){
        int l; cin >> l; l--;
        for(auto p:G[l]){
            f[p]++;
        }
    }
    //  for(auto v:f) cout << v << " "; cout << endl;
    if(count(f.begin(),f.end(),K) != 1) return -1;
    return res = (int)(find(f.begin(),f.end(),K) - f.begin()) + 1;
}
int main(void){
    cin.tie(0); ios_base::sync_with_stdio(false);
    while(cin >> N,N){
        cout << solve() << endl;
    }
    return 0;
}



Measured memory_bytes: 3276
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:isize,
    b:isize,
    c:isize,
    }
    println!("{}",if b-a==c-b{"YES"}else{"NO"})
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    int n, x; cin >> n >> x;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    int ans = 1;
    int now = 0;
    rep(i,n){
        now += l[i];
        if(now <= x) ans++;
    }
    cout << ans << endl;
}

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

constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
using ll = long long int;
using ull =  unsigned long long int;

int main() {
	int N;
	cin >> N;
	vector<pair<string, int>> shops(N);
	map<pair<string, int>,int> a;
	for (int i = 0; i < N; i++) {
		cin >> shops[i].first >> shops[i].second;
		shops[i].second = -shops[i].second;
		a[shops[i]] = i;
	}
	sort(shops.begin(), shops.end());
	for (int i = 0; i < N; i++) {
		cout << a[shops[i]] + 1 << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define i64 long long
#define N (int)(1e5)
#define pii pair<int,int>
#define L first 
#define R second
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
	int n; cin>>n;
	i64 L[87];
	L[0] = 2, L[1] = 1;
	for(int i=2;i<=86;i++) L[i] = L[i-1]+L[i-2];
	printf("%lld\n", L[n]);
	return 0;
}

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

int main() {
	int money = 100000;
	int week;
	cin >> week;
	for (int i = 0; i < week; i++) {
		money = money*1.05;
		if (money % 1000 == 0)continue;
		else money = 1000 * (money / 1000 + 1);
	}
	cout << money << endl;
}

Measured memory_bytes: 2988
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    char t='A';
    int ans=0;
    rep(i,n-2){
        bool k=true;
        rep(j,3){
            if(s[i+j]!=t+j) k=false;
        }
        if(k) ans++;
    }
    cout << ans << endl;
}


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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
    string s;
    cin>>s;
    bool N=false,W=false,S=false,E=false;
    ll n=s.size();
    REP(i,n){
        if(s[i]=='W') W=true;
        else if(s[i]=='E') E=true;
        else if(s[i]=='S') S=true;
        else N=true;
    }
    cout<<((W==E)&&(S==N)?"Yes":"No")<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define MN 1000001
using namespace std;

int read_p,read_ca;
inline int read(){
    read_p=0;read_ca=getchar();
    while(read_ca<'0'||read_ca>'9') read_ca=getchar();
    while(read_ca>='0'&&read_ca<='9') read_p=read_p*10+read_ca-48,read_ca=getchar();
    return read_p;
}
const int MOD=1e9+7;
int n,a[MN],m=0,mmh=0;
int main(){
	int i,j;
	n=read();
	for (i=1;i<=n;i++) a[i]=read();
	for (i=2;i<=n;i++){
		if (a[i]==a[i-1]) continue;
		if (m==-1&&a[i]>a[i-1]) mmh++,m=0;else
		if (m==1&&a[i]<a[i-1]) mmh++,m=0;else
		m=a[i]>a[i-1]?1:-1;
	}
	printf("%d\n",mmh+1);
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 1000000007

int main(){

    string s;
    cin >> s;
    REP(s.length()){
        if(i == 5 || i == 13){
            cout << " ";
        }else{
            cout << s[i];
        }
    }
    cout << endl;

    return 0;
}

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

int main(){
  int X;
  cin >> X;
  if(X >= 2300){
    cout << 1 << endl;
  }else if(X < 100){
    cout << 0 << endl;
  }else{
    int n = X / 100;
    int m = X % 100;
    if(m <= n*5){
      cout << 1 << endl;
    }else{
      cout << 0 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) A[i] = scanner.nextInt();

    long left = 2, right = 3;
    for (int i = N - 1; i >= 0; i--) {
      left = ((left - 1) / A[i] + 1) * A[i];
      right = ((right - 1) / A[i] + 1) * A[i];
      if (left == right) {
        System.out.println(-1);
        return;
      }
    }
    System.out.printf("%d %d\n", left, right - 1);
  }
}


Measured memory_bytes: 52232
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    int N;
    cin >> N;
    int A[N];
    for(int i=0; i<N; i++){
        cin >> A[i];
        A[i] -= i+1;
    }
    sort(A, A+N);
    int mid = A[N/2];
    long ans = 0;
    for(int i=0; i<N; i++){
        ans += abs(A[i] - mid);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
//main
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int64_t n;
    cin>>n;
    long long sum=0;
    for(int64_t i=1;i<=n;i++){
        if(i%3==0){//iが3の倍数のとっき
            continue;
        }
        if(i%5==0){
            continue;
        }
        sum+=i;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3584
import Control.Applicative

xor True b = not b
xor False b = b

main :: IO()
main = do
  [s,e,n,w] <- (\x -> map (flip elem x) "SENW") <$> getLine
  putStrLn $ if (s `xor` n) || (e `xor` w) then "No" else "Yes"


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

int main() {

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

    int n, k;
    cin >> n >> k;

    unsigned long long int cnt1 = 0;
    unsigned long long int cnt2 = 0;
    for (int i = 1; i <= n; i++) {
        if (i % k == 0)
            cnt1++;

        if (k % 2 == 0 && (i % k == k / 2))
            cnt2++;
    }
    cout << cnt1 * cnt1 * cnt1 + cnt2 * cnt2 * cnt2 << endl;
}

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


int main(){
  ll n,d,a;
  cin >> n >> d >> a;
  vector<pair<ll,ll>> xh(n);
  for(ll i=0;i<n;++i){
    ll x,h;
    cin >> x >> h;
    xh[i]=make_pair(x,h);
  }

  sort(xh.begin(),xh.end());
  d=d*2;
  ll ans=0;
  ll tot=0;
  queue<pair<ll,ll>> q;
  for(ll i=0;i<n;++i){
    ll x=xh[i].first;
    ll h=xh[i].second;
    while(q.size()!=0 && q.front().first<x){
      tot-=q.front().second;
      q.pop();
    }
    h-=tot;
    if(h>0){
      ll num=(h+a-1)/a;
      ll damage=num*a;
      ans+=num;
      tot+=damage;
      q.push(make_pair(x+d,damage));
    }
  }

  cout << ans << endl;
  return 0;

}


Measured memory_bytes: 7888
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2149

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

int main() {

	int N,A,B,C,X;

	while(cin >> N >> A >> B >> C >> X)
	{

		if(N == 0 && A == 0 && B == 0 && C == 0 && X == 0){ break; }
		
		vector<int> list(N,0);
		rep(i,N){ cin >> list[i]; }

		int frame=0;
		int nth=0;
		int rand=X;
		while(true)
		{
			if(frame > 10000){ frame = -1; break; }
			if(list[nth] == rand){ nth++; }
			if(nth == N){ break; }
			rand = (A * rand + B) % C;
			frame++;
		}

		cout << frame << endl;
	}

	return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
//long long num[100000];
int main(){
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int tmp=1;
	int ch=0,i;
	for(i=1;i<n;i++){
		tmp=a[tmp-1];
		if(tmp==2) {
			ch++;
			break;
		}
	}
	if(ch==0) cout<<-1<<endl;
	else cout<<i<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;


double l[20],a[20],b[20];
double d[20][20];

double dis(int x, int y){
  return (l[x]-l[y])*(l[x]-l[y]) + (a[x]-a[y])*(a[x]-a[y]) + (b[x]-b[y])*(b[x]-b[y]);
}

int main(){
  int n,m;
  double dp[1<<20];
  
  cin >> n >> m;

  for(int i=0;i<n;i++)cin >> l[i] >> a[i] >> b[i];

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)d[i][j] = dis(i,j);
  }

  for(int i=0;i<(1<<n);i++)dp[i] = 0.0;

  double mx = 0.0;
  for(int i=0;i<(1<<n);i++){
    int cnt = 0;
    for(int j=0;j<n;j++){
      if( i & (1<<j) ){
	cnt++;
	if(dp[i]<1e-10){
	  dp[i] = dp[i-(1<<j)];
	  for(int k=0;k<n;k++){
	    if( (i-(1<<j)) & (1<<k) )dp[i] += d[j][k];
	  }
	}
      }
    }
    if(cnt == m)mx = max(dp[i],mx);
  }
  printf("%.8lf\n",mx);
}

Measured memory_bytes: 0
/*
    author: Salam_35
    Created at :

*/

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

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define sci(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define load(array,size)  for(ll i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(ll i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF	1LL<<19
#define pll pair<ll,ll>
#define mst(arr,value) memset(arr,value,sizeof(arr));
#define tst() int t;cin >> t;while(t--)
#define Mod 100000007
#define YES cout<<"Yes"<<endl;
#define NO cout<<"No"<<endl;
void inversemod(ll n, ll mod, ll invmod[],ll MOD){for(int i=2; i<=n; ++i) invmod[i]=MOD-MOD/i*invmod[MOD%i]%MOD;}
//void bigmod( ll a, ll b ,ll mod){ll r = 1;a = a%mod;while(b){if( b%2 ) r = (r*a)%mod;b = b/2;a = (a*a)%mod; }return (ll)r;}

typedef vector<ll>vec;
typedef pair<ll,ll> pii;
typedef map<ll,ll>mpll;
typedef set<ll>seet;

int main()
{
    string s;
    cin >> s;
    std::vector<char> v;
    for(char c:s)
    {
    	if(c=='B' and v.size())
    	{
    		v.pop_back();
    	}
    	else if(c!='B') v.push_back(c);
    }
    for(char c:v)cout<<c;cout<<endl;
}


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

#define ENGZ ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define sfi(x) scanf("%d" , &x)
#define sfi2(x, y) scanf("%d%d" , &x,&y)
#define sfl2(x, y) scanf("%I64d%I64d" , &x,&y)
#define sfl(x) scanf("%I64d" , &x)
#define sfl3(x, y, z) scanf("%I64d%I64d%I64d", &x, &y, &z)
#define sfd(x) scanf("%lf", &x)
#define sfd2(x, y) scanf("%lf", &x, &y)
#define sfs(x) scanf("%s", &x)
#define testv(x) cerr << x << ' '
#define wtf(s) freopen((s), "w", stdout)
#define rff(s) freopen((s), "r", stdin)
#define test cerr << "here"
#define fst(x) cout << fixed << setprecision(x)
#define mod 1000000007
#define pi (2 * acos(0))
typedef long double ld;
typedef long long ll;

void H()
{
    int t, n, a[52];
    bool iseven, x;
    string s;
    cin >> t;
    while (t--)
    {
        cin >> n >> s;
        if (s == "Dee")
            iseven = true;
        else
            iseven = false;
        for (int i = 0; i < n; i++)
            cin >> a[i];
        x = true;
        while (x)
        {
            x = false;
            for (int i = 0; i < n && iseven; i++)
            {
                if (a[i] && a[i] % 2 == 0)
                {
                    a[i] = 0;
                    x = true;
                    break;
                }
            }
            for (int i = 0; i < n && !iseven; i++)
            {
                if (a[i] && a[i] % 2 == 0)
                {
                    a[i] /= 2;
                    x = true;
                    break;
                }
            }
            for (int i = 0; i < n && !iseven && !x; i++)
            {
                if (a[i] % 2)
                {
                    a[i] = 0;
                    x = true;
                    break;
                }
            }
            if (!x)
                break;
            iseven = !iseven;
        }
        if (iseven)
            cout << "Dum\n";
        else
            cout << "Dee\n";
    }
}

int n;
ll a[200005];
ll f(ll x)
{
    ll ans = 0;
    for (int i = 0; i < n; i++)
        ans += abs(a[i] - (x + i + 1));
    return ans;
}

void C()
{
    ll ans = LONG_LONG_MAX, low = 0, high = 0, mid1, mid2;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i], high = max(high, a[i]), low = min(low, -a[i]);
    while (high - low > 10)
    {
        mid1 = low + (high - low) / 3;
        mid2 = high - (high - low) / 3;
        ll f1 = f(mid1), f2 = f(mid2);
        if (f1 < f2)
            ans = min(ans, f1), high = mid2 - 1;
        else
            ans = min(ans, f2), low = mid1 + 1;
    }
    for (ll i = low; i <= high; i++)
    {
        ans = min(ans, f(i));
    }
    cout << ans;
}

int main()
{
    ENGZ
    C();
    return 0;
}

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

using namespace std;
int main() {
    int a[4];
    int z=0, x=0, c=0, v=0;
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    string answer = "NO";
    for(int i = 0; i < 4; i++){
        if(a[i] == 1){
            z=1;
        }
        else if(a[i] == 9){
            x=1;
        }
        else if(a[i] == 7){
            c=1;
        }
        else if(a[i] == 4){
            v=1;
        }
    }
    if(z + x + c + v == 4) answer = "YES";

    cout << answer << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;




const int INF = 1000000;
const int mod = 1e9 + 7;


int main(){
	// vector<string> v;
	// string s = "I";
	// v.pb(s);
	// for(int i = 0; i < 1000000; i++){
	// 	s += "OI";
	// 	v.pb(s);
	// }

	int n, m, ans, p;
	string v, s;
	while(cin>>n){
		if(n == 0) break;
		cin>>m>>s;
		ans = 0;
		p = 0;
		v = "I";
		for(int i = 0; i < n; i++) v += "OI";
		while(s.find(v, p) != string::npos){
			p = s.find(v, p);
			p++;
			ans++;
		}
		cout<<ans<<endl;
	}

}

Measured memory_bytes: 2112
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
----
-- D
local N, K = read.nn()
local P = read.N(N)
local E = {}
local S = {}
S[0] = 0
for i=1,N do
    E[i] = (P[i] + 1) / 2
    S[i] = S[i-1] + E[i]
end
local ans = 0
for i=K,N do
    ans = math.max(ans, S[i] - S[i-K])
end
print(ans)

Measured memory_bytes: 26780
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    string s1,s2;
    cin>>s1>>s2;
    for(int i=0;i<s1.size();i++){
    	cout<<s1[i]<<s2[i];
	}
	return 0;
} 

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <tuple>
#include <climits>

using namespace std;


int main() {
    string s;
    cin>>s;
    for (int i=0; i<8; i++) {
        int sum = s[0] - '0';
        for (int j=0; j<3; j++) {
            if (i & (1<<j)) sum += s[j+1] - '0';
            else sum -= s[j+1] - '0';
        }
        if (sum == 7) {
            cout<<s[0];
            for (int j=0; j<3; j++) {
                if (i & (1<<j)) cout<<'+';
                else cout<<'-';
                cout<<s[j+1];
            }
            cout<<"=7\n";
            return 0;
        }
    }
}

Measured memory_bytes: 256
function Main(input: string) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  const args = input.split("\n");
  const N: number = parseInt(args[0], 10);
  const A: number[] = args[1].split(" ").map(s => parseInt(s, 10));

  const reducer = (acc: number, current: number): number => acc + current;

  const sumOfReciprocals = A.map(n => Math.pow(n, -1)).reduce(reducer);
  const ans = Math.pow(sumOfReciprocals, -1);
  console.log(ans);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;

int calc(
    vector<int> b, 
    vector<int> ai, 
    int c,
    int m
) {
    int sum = 0;
    for (int i = 0; i < m; i++) {
        int tmp = ai.at(i) * b.at(i);
        sum += tmp;
    }
    return sum + c;
}

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

    vector<int> b(m);

    for (int i = 0; i < m; i++)
    {
        cin >> b.at(i);
    }

    vector<vector<int>> a(n, vector<int>(m));

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> a.at(i).at(j);
        }
    }
    
    int sum_of_pass = 0;
    for (int i = 0; i < n; i++)
    {
        int result = calc(
            b,
            a.at(i),
            c,
            m
        );
        if (result > 0) {
            sum_of_pass += 1;
        }
    }

    cout << sum_of_pass << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>

using namespace std;

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

  deque<int> values(n);
  for (int i = 0; i < n; i++) {
    cin >> values[i];
  }

  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if ((i + 1) % 2 == 0) {
      continue;
    }

    if (values[i] % 2 == 1) {
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define  rep(i,n) for(li i = 0; i < (n); ++i)
#define  red(i,n) for(li i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a) 
using namespace std;
using li = long long;
using ul = unsigned long long;
using vi = vector<li>;
using vs = vector<string>;
inline ul gcd(ul a,ul b) { return b?gcd(b,a%b):a; }
const int INF=1000000009;


int main()
{
    int n,a,q=INF;
    cin>>n;
    rep(i,n) {
        cin>>a;
        for(int x=0;;x++) if(!(a%2))a/=2; else {q=min(q,x); break;}
    }
    cout<<q<<endl;

    return 0;
}



Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]

import bisect
min_list = [-1]
for i in reversed(range(n)):
    if a[i] >= min_list[-1]:
        min_list.append(a[i])
    else:
        insert_index = bisect.bisect_right(min_list, a[i])
        min_list[insert_index] = a[i]
    # print(a[i], min_list)


print(len(min_list) - 1)


Measured memory_bytes: 7928
def main():
    n, k = list(map(int, input().split()))
    ans = 0
    for b in range(1, n + 1):
        q, r = divmod(n, b)
        ans += q * max(0, b - k)
        ans += max(0, r - k + 1)
    if k == 0:
        ans -= n
    print(ans)





if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int 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; }
#define all(a)  (a).begin(),(a).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define vll vector<ll>
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
const ll INF =1LL << 62;

int main(){
  int n; cin >> n;
  vector<int> b(n),ans(0);
  
  for(int i=0;i<n;i++){
    cin >> b.at(i);
    if(b.at(i) >i+1){
      cout << -1 << endl;
      return 0;
    }
  }
  for(int i=n;0<i;i--){
    bool check = false;
    for(int j=i;0<j;j--){
      if(b.at(j-1) == j){
        ans.push_back(b.at(j-1));
        b.erase(b.begin()+j-1);
        check = true;
        break;
      }
    }
    if(check == false){
      cout << -1 << endl;
      return 0;
    }
  }
  reverse(all(ans));
  rep(i,n)
    cout << ans.at(i) <<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] k=new char[4];
		for(int i=0; i<3; i++){
			if(s.charAt(i)==s.charAt(i+1)){
				System.out.println("Bad");
				return;
			}
		}
		System.out.println("Good");
	}
}


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

int ceiling_div(int a, int b){ // ceiling(a/b)= floor((a+b-1)/b)
  return (a+b-1)/b;
}

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

  vector<int> damage(N);
  vector<int> mp(N);
  for(int i=0; i<N; i++){
    cin >> damage.at(i) >> mp.at(i);
  }

  vector<int> DP(H+1, INT_MAX); // DP[i]:体力をi以上削るための最小消費MP
  DP.at(0)= 0;
  for(int i=1; i<=H; i++){
    for(int j=0; j<N; j++){
      int id_prev= max(0, i-damage.at(j));
      DP.at(i)= min(DP.at(i), DP.at(id_prev)+mp.at(j));
    }
  }

  cout << DP.at(H) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include<cstring>
#include<tuple>


#define rep(i,p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

//AGC24 C
int main(void) {
	ll n;
	cin >> n;
	vector<ll> a = vector<ll>(n);
	rep(i, 0, n)cin >> a[i];

	ll ans = 0;
	rep(i, 0, n) {
		if (i == 0) {
			if (a[i] != 0) {
				ans = -1;
				break;
			}
		}
		else if (a[i] - a[i - 1] > 1) {
			ans = -1;
			break;
		}
		else if (a[i] - a[i - 1] == 1) {
			ans++;
		}
		else ans += a[i];
	}
	cout << ans << endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  int range;
  
  for (int i = 0; i < N; i++){
    int x;
    cin >> x;
    if (x < K - x){
      range += x*2;
    }
    else {
      range += (K - x)*2;
    }
  }
  cout << range << endl;
}

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

int check(int, int*, int);

int main(){
    while(1){
        int N,M;
        cin >> N >> M;

        if(N==0 && M==0){
            break;
        }

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

        int left=1;
        int right=1000001;
        while(right-left>1){
            int temp=(left+right)/2;

            if(check(temp,s,N)>=M){
                left = temp;
            }else{
                right = temp;
            }
        }
        if(check(left,s,N)!=10000000 && check(left,s,N)>=M){
            cout<<left<<endl;
        }else{
            cout<<-1<<endl;
        }
    }
}

int check(int X, int* s, int N){
    int num=0;
    int lv=1;
    if(s[0]>=1+X){
        return 10000000; // cannot clear
    }

    while(lv+X<=s[N-1]){
        int enemy1 = lower_bound(s,s+N,lv)-s;
        int enemy2 = enemy1-1;


        int lvup=1;
        if(enemy1>=0 && enemy1<=N-1 && s[enemy1]<lv+X){
            lvup = max(lvup, X-abs(lv-s[enemy1]));
        }
        if(enemy2>=0 && enemy2<=N-1 && s[enemy2]<lv+X){
            lvup = max(lvup, X-abs(lv-s[enemy2]));
        }
        num++;
        lv+=lvup;
    }
    num++;
    return num;
}



Measured memory_bytes: 3476
s = input()
n = len(s)
k = int(input())
start = True
start_count = 0
start_char = s[0]
inside_num = 0
end_count = 0
end_char = ""
memory = s[0]
count = 1
for i in range(1,n):
    if s[i] == memory:
        count += 1
    else:
        if start:
            start_count = count
            start = False
        else:
            inside_num += count//2
        count = 1
        memory = s[i]
end_count = count
end_char = memory
ans = 0
if start_char == end_char:
    if end_count == n:
        ans = n*k//2
    else:
        ans += inside_num*k
        ans += (start_count+end_count)//2*(k-1)+start_count//2+end_count//2
else:
    inside_num += start_count//2
    inside_num += end_count//2
    ans += inside_num*k
print(ans)

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

long long n,tmp;
bool ok;

vector<int> v,ans;

int main(){
	
	cin>>n;
	
	
	for(int i=0;i<n;i++){
		cin>>tmp;
		v.push_back(tmp);
	}
	
	
	for(int i=0;i<n;i++){
		ok=false;
		
		for(int j=v.size()-1;j>=0;j--){
			if((j+1)==v[j]){
				ok=true;
				ans.push_back(v[j]);
				v.erase(v.begin()+j);
				break;
			}
		}
		
		if(ok==false){
			cout<<"-1"<<endl;
			return 0;
		}
	}
	
	for(int i=ans.size()-1;i>=0;i--)cout<<ans[i]<<endl;


	return 0;
}


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

int main(int argc, char const* argv[])
{
    int a, b, c, x, y;
    std::cin >> a >> b >> c >> x >> y;

    int result = std::numeric_limits<int>::max();

    auto more = std::max(x, y);
    for (int i = 0; i <= more * 2; i+=2)
    {
        int rem_x = x - i / 2;
        int rem_y = y - i / 2;

        auto a_cost = std::max(rem_x * a, 0);
        auto b_cost = std::max(rem_y * b, 0);
        auto c_cost = i * c;
        result = std::min(result, a_cost + b_cost + c_cost);
    }

    std::cout << result << std::endl;
}

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

	public static void main(String[] args) {
		Scanner t=new Scanner(System.in);
		int a=t.nextInt(), cont = 0;
		for(int i=1;i<=a;i++) {
			if(i<=9 && i>=1 || i>=100 && i<1000 || i>=10000 && i<100000 || i>= 1000000 && i<=10000000) {
			cont += 1;
			}
		}
		
		System.out.println(cont);
	}
	}


Measured memory_bytes: 23124
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define loop(n) for (int i = 0; i < n; i++)
#define INT_MAX 2147483647
#define LLINT_MAX 9223372036854775807
#define mod 1000000007
#define ll long long int
using namespace std;

int main() {
	int n, k, x, cnt = 0;
	cin >> n >> k;
	loop(n) {
		cin >> x;
		cnt += min(abs(x), abs(k - x));
	}
	cout << cnt * 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    int A[200];

    int counter_m = 0;

    cin >> N;

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

    while(1){
        for(int i = 0; i < N; i++){
            if(A[i] != 0 && (A[i] % 2) == 0){
                A[i] /= 2; 
            }else{
                goto BREAK_LABEL;
            }
        }
        counter_m++;
    }

    BREAK_LABEL:

    cout << counter_m << endl;



}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}



//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
キュー　queue<int> q;
   q.push(7);　//７が入る
   cout << q.front() << endl;  // 先頭の値を出力
   q.pop();  // 先頭の値を削除
*/



int main(void){
cout<<fixed<<setprecision(14);
//cin.tie(0); ios::sync_with_stdio(false);

  ll X;
  cin>>X;
  
  if(400<=X&&X<=599){
    cout<<8<<endl;
  }else if(600<=X&&X<=799){
    cout<<7<<endl;
  }else if(800<=X&&X<=999){
    cout<<6<<endl;
    }else if(1000<=X&&X<=1199){
    cout<<5<<endl;
    }else if(1200<=X&&X<=1399){
    cout<<4<<endl;
    }else if(1400<=X&&X<=1599){
    cout<<3<<endl;
    }else if(1600<=X&&X<=1799){
    cout<<2<<endl;
    }else if(1800<=X&&X<=1999){
    cout<<1<<endl;
  }
    
  
}




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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 1e7 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int  cnt[N];


void solve()
{
	cin >> n;
	lop(i, 1, n + 1)
	{
		for (int j = i; j <= n; j += i) cnt[j]++;
	}

	int ans = 0;
	lop(i, 1, n + 1) ans += cnt[i] * i;
	cout << ans << endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

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


}





Measured memory_bytes: 81772
n,c = list(map(int,input().split()))

xv = []
go = []
goback = []
back = []
backgo = []

max1 = 0
sumt = 0

for i in range(n):
    xv.append(list(map(int,input().split())))
    sumt += xv[i][1]
    max1 = max(max1,sumt - xv[i][0])
    go.append(max1)
    goback.append(sumt - 2*xv[i][0])

max1 = 0
sumt = 0

for i in range(n)[::-1]:
    sumt += xv[i][1]
    max1 = max(max1, sumt - (c - xv[i][0]))
    back.append(max1)
    backgo.append(sumt - 2 * (c - xv[i][0]))

res = 0

for i in range(n-1):
    res = max(res,backgo[i]+go[-2-i],goback[i]+back[-2-i])

res = max(res,go[-1],back[-1],0)

print(res)

Measured memory_bytes: 43276
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	int R;
	cin >> R;
	if (R < 1200) cout << "ABC";
	else if (R < 2800) cout << "ARC";
	else cout << "AGC";
	system("pause");
	return 0;
}

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

template <typename T>
using lim = numeric_limits<T>;

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

	int ans = 0;
	int k; cin >> k;
	for (int i = 1; i <= k; i++){
		for (int j = 1; j <= k; j++){
			for (int l = 1; l <= k; l++){
				ans += __gcd(__gcd(i,j),l);
			}
		}
	}

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

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

string str;

int main()
{
  int i,j;//2テ」ツ?、テ」ツ?ョテ・ツ閉?・ツ督?」ツ?ョテァツィツ偲ヲツ環?
  int x,y,s;
  int max=0;
  int a,b;//2テ」ツ?、テ」ツ?ョテ・ツ閉?・ツ督?」ツ?ョテァツィツ偲ィツセツシ

 while(1){
  cin>>x>>y>>s;
  if(x==0&& y==0&&s==0)break;
  max=0;
  for(i=1;i<s;i++)
    //    cout<<'B'<<endl;
    for(j=1;j<=i;j++){
      a=i*(100+x)/100;
      b=j*(100+x)/100;
      //      cout<<'C'<<endl;
      if(a+b==s){
	//	cout<<'D'<<endl;
	//	cout<<'A'<<a<<" "<<b<<endl;
	a=i*(100+y)/100;
	b=j*(100+y)/100;

	if(max<a+b)
	  max=a+b;

	//	cout<<max<<'M'<<endl;
	//	cout<<'I'<<i<<" "<<j<<endl;

      }
    }
  cout<<max<<endl;     
 }
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n, m;
  cin >> n >> m;
  cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
  return 0;
}

Measured memory_bytes: 3632
n,m=map(int,input().split())
k=[]
s=[]
for i in range(m):
  arr=input().split()
  k.append(int(arr[0]))
  s.append([int(arr[j+1]) for j in range(k[i])])
p=list(map(int,input().split()))
chk=[]
for i in range(1<<n):
  wk=[]
  for j in range(n):
    if 1&(i>>j)==1:
      wk.append(j+1)
  chk.append(wk)
ans=0
for i in range(len(chk)):
  calc=[0]*m
  for j in range(len(chk[i])):
    for l in range(m):
      for x in range(k[l]):
        if s[l][x]==chk[i][j]:
          calc[l]+=1
  ans+=1
  for l in range(m):
    if calc[l]%2!=p[l]:
      ans-=1
      break
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mk make_pair
#define all(a) a.begin(), a.end()
#define len(a) (int)a.size()

using namespace std;

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

ll mod = 1e9 + 7;

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

	ll ten = 1, nine = 1, eight = 1;
	for(int i = 0; i < n; i++){
		ten = (ten * 10) % mod;
		nine = (nine * 9) % mod;
		eight = (eight * 8) % mod;
	}
	
	ll ans = ten - nine - nine + eight;
	ans %= mod;
	ans = (ans + mod) % mod;

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


Measured memory_bytes: 3628
N = int(input())
A = [int(i) for i in input().split()]

A_sum = 0
res0 = 0
for i,j in enumerate(A):
    A_sum += j
    if (i+1) % 2 != 0 and A_sum >= 0:
        res0 += A_sum + 1
        A_sum = -1
    if (i+1) % 2 == 0 and A_sum <= 0:
        res0 += abs(A_sum - 1)
        A_sum = 1
#     print("A_sum", A_sum)
#     print("res0", res0)
# print(res0)

A_sum = 0
res1 = 0
for i,j in enumerate(A):
    A_sum += j
    if (i+1) % 2 != 0 and A_sum <= 0:
        res1 += abs(A_sum - 1)
        A_sum = 1
    if (i+1) % 2 == 0 and A_sum >= 0:
        res1 += A_sum + 1
        A_sum = -1
#     print("A_sum", A_sum)
#     print("res1", res1)
# print(res1)

print(min(res0, res1))

Measured memory_bytes: 14468
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long
#define inf 1000000001
#define y1 y1___
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
ll read(){
    char ch=gc();ll x=0;int op=1;
    for (;!isdigit(ch);ch=gc()) if (ch=='-') op=-1;
    for (;isdigit(ch);ch=gc()) x=(x<<1)+(x<<3)+ch-'0';
    return x*op;
}
#define N 105
#define mod 1000000007
int ksm(int x,int p){
    int ret=1;
    for (;p;p>>=1,x=(ll)x*x%mod) if (p&1) ret=(ll)ret*x%mod;
    return ret;
}
int n,h[N];
pii solve(int l,int r,int lim){
    int mi=inf,cnt=0;pii ret;
    rep (i,l,r) if (h[i]<mi) mi=h[i],cnt=1;else if (h[i]==mi) cnt++;
    if (cnt==r-l+1){
        ret.fi=(ksm(2,r-l+1)+mod-2)%mod;
        ret.se=ksm(2,mi-lim);
        return ret;
    }
    int rest=r-l+1,s0=1,s1=1,last=0;
    rep (i,l,r+1)
        if (!last&&h[i]>mi) last=i;
        else if (last&&(h[i]<=mi||i>r)){
            rest-=i-last;
            pii tmp=solve(last,i-1,mi);
            s0=(ll)s0*(tmp.fi+2ll*tmp.se%mod)%mod;
            s1=(ll)s1*(tmp.se%mod)%mod;
            last=0;
        }
    s0=(s0+mod-s1)%mod;
    ret.fi=(ll)s0*ksm(2,rest)%mod;
    ret.fi=(ret.fi+(ll)s1*(ksm(2,rest)+mod-2)%mod)%mod;
    ret.se=(ll)s1*ksm(2,mi-lim)%mod;
    return ret;
}
int main(){
    n=read();rep (i,1,n) h[i]=read();
    if (n==1){
        printf("%d\n",ksm(2,h[1]));
        exit(0);
    }
    int ex=1;
    rep (i,1,n) if (h[i]>h[i-1]&&h[i]>h[i+1]){
        ex=(ll)ex*ksm(2,h[i]-max(h[i-1],h[i+1]))%mod;
        h[i]=max(h[i-1],h[i+1]);
    }
    pii ans=solve(1,n,0);
    printf("%d",(ll)ex*(ans.fi+ans.se%mod)%mod);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int m, f, r;
	while(true)
	{
		cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1)
			break;
		if (m == -1 || f == -1)
			cout << "F" << endl;
		else if (m + f >= 80)
			cout << "A" << endl;
		else if (m + f >= 65)
			cout << "B" << endl;
		else if (m + f >= 50)
			cout << "C" << endl;
		else if (m + f >= 30)
		{
			if (r >= 50)
				cout << "C" << endl;
			else
				cout << "D" << endl;
		}
		else
			cout << "F" << endl;
	}
	return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,all;
  cin >> n;
  all = 0;
  vector<int>l(n);
  for(int i=0;i<n;i++){
    cin >> l.at(i);
  }
  for(int i=0;i<n;i++){
    all += l.at(i);
  }
  if(*max_element(l.begin(), l.end())<all-*max_element(l.begin(), l.end())){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main() {
  int N, M, X, a = 0, b = 0;
  cin >> N >> M >> X;
  vector<int>A(M);
  for (int i = 0; i < M; i++) {
    cin >> A.at(i);
  }
  for (int i = X + 1; i <= N; i++) {
    for (int j = 0; j < M; j++) {
      if (i == A.at(j)) {
        a++;
      }
    }
  }
  for (int i = 0; i < X; i++) {
    for (int j = 0; j < M; j++) {
      if (i == A.at(j)) {
        b++;
      }
    }
  }
  if (a < b) {
    cout << a;
  }
  else {
    cout << b;
  }
}

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

int main(){
  vector<vector<char>>s(3,vector<char>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>s[i][j];
    }
  }
  cout<<s[0][0]<<s[1][1]<<s[2][2]<<endl;
}

Measured memory_bytes: 256