akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int abbs(int a)
{
    if(a<0) return -a;return a;
}
int w[200],q[200],p[200];

int main()
{
    int n;scanf("%d",&n);
    for (int i=1;i<=n;i++) scanf("%d",&w[i]);
    for (int i=0;i<=n+1;i++) q[i]=p[i]=0;
    for (int i=1;i<=n;i++) q[i]=q[i-1]+w[i];
    for (int i=n;i>=1;i--) p[i]=p[i+1]+w[i];

    int ans=q[n];
    for (int i=1;i<n;i++)
    {
        if (abbs( q[i]-p[i+1]  ) <ans  )
            ans = abbs(q[i]-p[i+1]);
    }
    printf("%d\n",ans);


}




Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;

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

		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		int  N = Integer.parseInt(br.readLine());
      	int  A = Integer.parseInt(br.readLine());
		br.close();
		isr.close();

		System.out.print(N*N-A);
    }
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007

int main() {
    int a, b;
    cin >> a >> b;
    a--, b--;
    vector<int> v(3, 0);
    v[a] = 1, v[b] = 1;
    for(int i = 0; i < 3; i++) {
        if(v[i] == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

template <class T = int>
int in() {
  T x;
  cin >> x;
  return x;
}
int bpm(int x, int y) {
  if (x == 0)
    return 0;
  else if (y == 0) {
    return 1;
  }
  int ans = 1;
  x %= MOD;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) {
      ans *= x;
      ans %= MOD;
    }
    x = x * x;
    x %= MOD;
  }
  return ans;
}

class CDistinctOrNot {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int N;
    cin >> N;
    map<int, bool> check;
    rep(i, N) {
      int temp;
      cin >> temp;
      if (check[temp]) {
        cout << "NO" << endl;
        return;
      }
      check[temp] = true;
    }
    cout << "YES" << endl;
  }
};


signed main() {
  CDistinctOrNot solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 12800
n, y=gets.split.map &:to_i
y/=1000
puts ((0..n).map{|a|
    t=y+4*a
    t%5==0 && t>=5*n && t+5*a<=10*n && [(t-5*n)/5, (10*n-t-5*a)/5, a]
}.select{|e|e}[0] || [-1, -1, -1])*' '

Measured memory_bytes: 1788
#include <iostream>
using namespace std;
  int A,B,C,D;
  int main(){
    cin >> A >> B >> C >> D;
  if(A+B>C+D){
    cout << "Left" << endl;
  }
  else if(A+B<C+D){
    cout << "Right" << endl;
  }
    else{
      cout << "Balanced" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define re return
#define ull unsigned long long
#define ll long long
#define ld long double
#define mid (l+r+1)/2
#define f first
#define s second
#define oo 1e9
#define pi acos(-1)
#define OO 1e18
#define EPS 1e-11
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define Hossam_Yehia ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
string s;
int main(){
    Hossam_Yehia;
    cin >> s;
    cout<<s[0]<<s.size()-2<<s.back()<<endl;
    re 0;
}

Measured memory_bytes: 256
(d=[]
t=[]
x=[u=1000,n=$_.to_i].min
([n-3*u,s=0].max..x).map{|a|s+=t[y=n-a]||=(([y-2*u,r=0].max..[x,y].min).map{|b|r+=d[z=y-b]||=[x,z].min-[z-u,0].max+1};r)}
p s)while gets

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;  cin >> s;
    rep(i, s.size()) {
      if (i % 2 == 0) {
        t += s[i];
      }
    }
    cout << t << '\n';
    return 0;
}


Measured memory_bytes: 592
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(_,v.size()){rep(__,v[_].size())cout<<" "<<v[_][__];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU

int n,m;
vvi nex[2],dp(2);
vi in;
void f(int a){
	int N=-1,t=m;
	while(1){
		vi dp(n,-1);
		int w=0;
		rep(i,n)if(dp[i]==-1){
			int l=i,r=i+1;
			while(r<n&&in[r]-in[r-1]<=t)r++;
			loop(j,l,r)dp[j]=r;
		}
		nex[a].pb(dp);
		N++;
		if(!t)break;
		t/=2;
	}
	dp[a]=vi(1<<N,-1);
	dp[a][0]=0;
	rep(i,1<<N)if(dp[a][i]-n)rep(j,N)if((i&1<<j)==0)
		cmax(dp[a][i|1<<j],nex[a][j+1][dp[a][i]]);
	rep(i,1<<N)rep(j,N)if((i&1<<j)==0)
		cmax(dp[a][i|1<<j],dp[a][i]);
}
int main(){
	cin>>n>>m;
	in=vi(n);
	rep(i,n)cin>>in[i];
	
	f(0);
	rep(i,n)in[i]*=-1;
	sort(all(in));
	f(1);
	
	// show2d(nex[0]);
	// show2d(nex[1]);
	// show2d(dp);
	
	vi ma(n,inf);
	rep(i,dp[0].size()){
		int t=dp[0].size()-1-i;
		int l=dp[0][i],r=n-dp[1][t]-1;
		cmin(ma[l],r);
	}
	for(int i=n-2;i>=0;i--)
		ma[i]=min(ma[i],ma[i+1]);
	
	// show1d(ma);
	rep(i,n){
		int l=n-nex[1][0][n-1-i],r=nex[0][0][i]-1;
		// cout<<l<<" "<<r<<endl;
		if(ma[l]<=r)cout<<"Possible"<<endl;
		else cout<<"Impossible"<<endl;
	}
	
}









Measured memory_bytes: 35696
#include <iostream>

int max(int a, int b, int c)
{
    int max = a;

    if (b>max)
        max = b;
    if (c>max)
        max = c;

    return max;
}


int main()
{
    int n, **a;
    int **dp;

    std::cin >> n;

    a = (int **)malloc(sizeof(int*) * n);
    for (int i = 0; i < n; i++)
        a[i] = (int *)malloc(sizeof(int) * 3);

    dp = (int **)malloc(sizeof(int*) * n);
    for (int i = 0; i < n; i++)
        dp[i] = (int *)malloc(sizeof(int) * 3);
    
    for (int i = 0; i < n; i++)
        for (int j = 0; j < 3; j++)
            std::cin >> a[i][j];

    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];

    for(int i=1;i<n;i++)
    {
        dp[i][0] = max(dp[i-1][1], dp[i-1][2], -9) + a[i][0];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2], -9) + a[i][1];
        dp[i][2] = max(dp[i-1][1], dp[i-1][0], -9) + a[i][2];
    }

    printf("%d", max(dp[n-1][0], dp[n-1][1], dp[n-1][2]));

    return 0;
}

Measured memory_bytes: 8064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<vector<pair<int, int> > > vvp;
typedef vector<pair<int, int> > vp;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<vector<ll> > vvl;
typedef vector<ll> vl;
typedef vector<vector<bool> > vvb;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define yn(f) (f?"yes":"no")
#define YN(f) (f?"YES":"NO")
#define Yn(f) (f?"Yes":"No")
#define mod (1e9+7)
#define inf (1e9+7)
#define nil -1
int main() {
	string s;
	cin >> s;
	int len = s.length();
	vi A(len);
	queue<int> Q;
	for (int i = 0; i < len - 1; i++)
	{
		if (s[i] == 'R' && s[i + 1] == 'L') {
			Q.push(i);
		}
	}
	int leftP = Q.front(); Q.pop();
	int rightP = -1;
	if (!Q.empty()) { rightP = Q.front(); Q.pop(); }
	if (rightP == -1) {
		for (int i = 0; i < len; i++)
		{
			A[i] = leftP;
		}
	}
	else {
		for (int i = 0; i < len; i++)
		{
			if (i < leftP) {
				A[i] = leftP;
				continue;
			}
			if (rightP < i) {
				leftP = rightP;
				if (!Q.empty()) { rightP = Q.front(); Q.pop(); }
			}
			if (leftP == i) {
				A[i] = leftP;
			}
			else if (rightP == i) {
				A[i] = rightP;
			}
			else {
				if (s[i] == 'L') {
					A[i] = leftP;
				}
				else {
					A[i] = rightP;
				}
			}

		}
	}

	vl count(len, 0);
	for (int i = 0; i < len; i++)
	{
		int ans;
		if (abs(A[i] - i) % 2 == 0) {
			ans = A[i];
		}
		else {
			ans = A[i] + 1;
		}
		count[ans]++;
	}
	for (int i = 0; i < len; i++)
	{
		cout << count[i];
		if (i != len - 1)cout << " ";
	}
	cout << endl;
}

Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll d;
    cin >> d;
    vector<ll> z(26);
    for (int i = 0; i < 26; i++) {
        cin >> z[i];
    }
    vector<vector<ll>> x(d, vector<ll>(26));
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < 26; j++) {
            cin >> x[i][j];
        }
    }
    vector<ll> ans(d,1);
    vector<ll> f(26);
    for (int j = 0; j < d; j++) {
        ll mx = 0;
        ll atai = 0;
        for (int k = 0; k < 26; k++) {
            mx = max(x[j][k], mx);
            if (mx == x[j][k])atai = k;
        }
        ans[j] = atai + 1;
        for (int k = 0; k < 26; k++) {
            f[k]++;
            if (f[k] * z[k] > 3000)ans[j] = k+1;
        }
        f[ans[j] - 1] = 0;
    }
    for (int i = 0; i < d; i++) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

/*------------------------------------------------------------------*/

int main(){
    int n, m, x; cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i, n){
        cin >> c[i];
        rep(j, m){
            cin >> a[i][j];
        }
    }
    int nedan_min = 1e7;
    int nedan;
    for(int bit = 0; bit < (1 << n); bit++){
        bool flag = true;
        nedan = 0;
        vector<int> sum(m, 0);
        for(int i = 0; i < n; i++){
            if(bit & (1 << i)){
                nedan += c[i];
                rep(j, m){
                    sum[j] += a[i][j];
                }
            } 
        }
        rep(i, m){
            if(sum[i] < x) flag = false;
        }

        if(flag) nedan_min = min(nedan_min, nedan);
    }
    if(nedan_min == 1e7) cout << -1 << endl;
    else cout << nedan_min << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define  ll long long
using namespace std;
int main(){
	ll n,p[5],minn,ans=0,times=0;
	int flag=0;
	cin>>n>>p[0]>>p[1]>>p[2]>>p[3]>>p[4];
	minn=p[0];
	for(int i=0;i<5;i++){
		if(p[i]<minn)minn=p[i];
		if(p[i]<n)flag=1;
	}
	if(flag==0){
		cout<<5;
		return 0;
	}
	if(n%minn==0)times=n/minn;
	else times=n/minn+1;
	ans=times+4;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
S = input()
ans = 0
for i in range(1,N):
    cnt = 0
    count1 = Counter(S[:i])
    count2 = Counter(S[i:])
    for char in [chr(i) for i in range(97, 97+26)]:
        if char in count1.keys() and char in count2.keys():
            cnt += 1
    ans = max(ans, cnt)
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a / gcd(a, b) * b; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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

    int a,b,c,d;
    string s;

    cin>>s;
    if(s[2] == s[3] && s[4] == s[5])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<cmath>
#include<sstream>
#include<iomanip>
#include <map>
#include <stack>

struct max_min
{
    int64_t max = 0;
    int64_t min = 0;
};

const int64_t cc = pow( 10, 9 ) + 7;
//std::cout<< std::fixed << std::setprecision(10) << ( double )( max ) / 2;
bool sort_pair( std::pair< int64_t, int64_t > origin, std::pair< int64_t, int64_t > another )
{
    return origin.first < another.first;
}

int main()
{
    std::string word;
    std::string w = "Yes";
    int64_t a,b,c,d,e,f;
    std::cin>> a;
    std::cin>> b;

    if( a == b )
    {
        c = 0;
    }
    else if( a < b )
    {
        if( a < b - a )
        {
            c = a;
        }
        else
        {
            c = b - a;
        }
    }
    else
    {
        d = a % b;

        if( d == 0 )
        {
            c = 0;
        }
        else
        {
            c = b - d;
        }
    }

    std::cout<< c;
}


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


int main(){
    int n;
    cin >>n;
    int count =0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(i*j>=n){
                break;
            }
            count ++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	final static int MOD = 998244353;

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

		int n = Integer.parseInt(sc.next());
		int[] d = new int[n - 1];
		int first = Integer.parseInt(sc.next());

		TreeMap<Integer, Integer> tm = new TreeMap<>();
		tm.put(first, tm.getOrDefault(first, 0) + 1);
		for (int i = 0; i < d.length; i++) {
			int num = Integer.parseInt(sc.next());
			tm.put(num, tm.getOrDefault(num, 0) + 1);
		}

		if (first != 0 || tm.get(0) != 1) {
			System.out.println(0);

		} else {
			long ans = 1;
			int cnt = 1;
			int now = 1;
			int parent = 1;
			boolean flag = true;
			while (flag) {
				int getNow = tm.getOrDefault(now, 0);

				cnt += getNow;
				if (getNow == 0) {
					if (cnt < n) {
						System.out.println(0);
						System.exit(0);
					} else {
						flag = false;
					}
				}
				ans *= power(parent, getNow);
				ans %= MOD;
				parent = getNow;
				now++;
			}
			System.out.println(ans);
		}

		sc.close();
	}

	public static long power(int p, int c) {
		long res = 1;

		for (int i = 0; i < c; i++) {
			res *= p;
			res %= MOD;
		}

		return res;
	}
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    ll T,r=0,ans=0;
    cin >> n >> T;
    for(int i = 0;i < n;i ++){
        ll t;
        cin >> t;
        if(t<r){
            ans += t + T - r;
            r += t + T - r;
        }
        else {
            ans += T;
            r = t+T;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
mv=((0,-1),(1,0),(0,1),(-1,0))

def check(x,y,di):
    mx=x+mv[di%4][0]
    my=y+mv[di%4][1]
    for tx,ty in mv:
        if my+ty==y and mx+tx==x:
            continue
        if L[my+ty][mx+tx]=="#":
            return False
    return True

d=input()
for p in range(d):
    n=input()
    L=[[" "]*(n+4) for i in range(n+4)]
    for i in range(n+4):
        L[0][i]=L[i][0]=L[n+3][i]=L[i][n+3]="#"
    x,y,di=2,n+1,0
    while n!=0:
        while check(x,y,di):
            L[y][x]="#"
            x+=mv[di%4][0]
            y+=mv[di%4][1]
        else:
            L[y][x]="#"
        di+=1
        n-=1
    for i in range(2,len(L)-2):
        print "".join(L[i][2:-2])
    if p!=d-1:
        print

Measured memory_bytes: 4388
/* -------------------------------- Template -------------------------------- */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

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

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

// template<typename T> constexpr T inf = [](){ assert(false); };
// template<> constexpr int inf<int> = 1e9;
// template<> constexpr ll inf<ll> = 1e18;
// template<> constexpr ld inf<ld> = 1e30;

struct yes_no : std::numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve();

int main() {
  std::locale loc(std::locale(), new yes_no);
  std::cout << std::boolalpha << std::setprecision(12) << std::fixed;
  std::cout.imbue(loc);
  solve();
  return 0;
}

using namespace std;

/* -------------------------------- Library -------------------------------- */

/* ---------------------------------- Main ---------------------------------- */

void solve() {
  set<int> s;
  REP(i,3) {
    int x; cin >> x;
    s.insert(x);
  }
  cout << s.size() << endl;
  return;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
      	int T = sc.nextInt();
		int[][] array = new int[N][2];
      	for(int i=0;i<N;i++){
        	array[i][0] = sc.nextInt();
          	array[i][1] = sc.nextInt();
        }
      	int min = array[0][0];
      	boolean flg = false;
      	for(int i=0;i<N;i++){
        	if(array[i][1]<=T){
              	flg = true;
            	if(min > array[i][0]){
                	min = array[i][0];
                }
            }
        }
        if(flg){	
      	System.out.println(min);
        }else{
        System.out.println("TLE");
        }
    }
}

Measured memory_bytes: 23252
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod   998244353
#define PI 2*acos(0.0)
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};

ll bigmod(ll x, ll p)
{
    ll res = 1;
    while(p)
    {
        if(p&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        p >>= 1;
    }
    return res;
}

//=============================================ASIFAZAD==============================================//


int32_t main()
{
    io;
    int n;
    cin>>n;
    vi cnt(60005);
    int lim = ceil(sqrt(n));
    for(int x = 1; x<= lim; x++)
    {
        for(int y = 1; y <= x; y++)
        {
            for(int z = 1; z <= y; z++)
            {
                int ac = x*x + y*y + z*z + x*y + y*z + z*x;
                if(x == y && y == z)
                    cnt[ac]++;
                else if(x == y || y == z || z == x)
                    cnt[ac] += 3;
                else
                    cnt[ac] += 6;
            }
        }
    }
    for(int i = 1; i<= n; i++)
        cout<<cnt[i] <<"\n";
    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int d = scanner.nextInt();
		int n = scanner.nextInt();
		if (n==100){n++;}
		System.out.println((int)Math.pow(100,d)*n);
	}
}

Measured memory_bytes: 21716
import java.util.*;

public class Main{
  public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String s = sc.nextLine();
      int ret = 0;
	  for(int i=0; i<3; i++){
        if(s.charAt(i) == '1') ret++;
      }
    System.out.println(ret);
  }
}

Measured memory_bytes: 35708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll x[50],dp[51][51][2510];
int main() {
	ll n,a;
	cin>>n>>a;
	for(ll i=1;i<=n;i++){
		cin>>x[i];
	}
	dp[0][0][0]=1;
	ll ans=0;
	for(ll i=1;i<=n;i++){
		for(ll j=0;j<=i;j++){
			for(ll k=0;k<=2500;k++){
				if(k-x[i]>=0&&j-1!=-1){
					dp[i][j][k]+=dp[i-1][j-1][k-x[i]];
				}
				dp[i][j][k]+=dp[i-1][j][k];
				if(j*a==k&&i==n&&j!=0){
					ans+=dp[i][j][k];
				}
			}
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

#define ll long long

using namespace std;

int main()
{
	int n,k,tc=0;
	cin>>n>>k;
	int r,s,p;
	cin>>r>>s>>p;
	char str[n];
	cin>>str;
	char ch[n];
	int t =0;
	while(t<k){
	if(str[t]=='r')
	 {
	   ch[t++]='p';
	   tc+=p;
	 }
	 else if(str[t]=='p')
	 {
	   ch[t++]='s';
	   tc+=s;	
	 }
	 else 
	 {
	 	ch[t++]='r';
	 	tc+=r;
	 }
    }
    for(int i=k;i<n;i++)
    {
       if(str[i]==str[i-k]&&str[i]!=ch[i-k])
       {
       	tc+=0;
       	ch[i]=str[i];
	   }
	   else
	   {
	   	if(str[i]=='r')
	   	{
	   		tc+=p;
	   		ch[i]='p';
		}
		else if(str[i]=='s')
		{
			tc+=r;
			ch[i]='r';
		}
		else
		{
			tc+=s;
			ch[i]='s';
		}
	   }
	}
	cout<<tc;
	return 0;
}

Measured memory_bytes: 384
n, m = map(int, input().split())
if abs(n-m) >= 2:
    print(0)
    exit()
res = 1
if n == m:
    for i in range(1, n+1):
        res *= i * i
        res %= 10**9 + 7
    res *= 2
else:
    for i in range(1, min(n, m)+1):
        res *= i * i
        res %= 10**9 + 7
    res *= max(n, m)
res %= 10**9 + 7
print(res)


Measured memory_bytes: 3060
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  List = list(map(int,input().split()))
  k = int(input())
  
  List = sorted(List,reverse=True)
  for _ in range(k):
    List[0] *= 2
  print(sum(List))
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 2940
#include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
int main(){
    string S;
    cin>>S;
    int c=0;
    int s=0;
    REP(i,S.size()){
        if(S[i]=='S')s++;
        if(S[i]=='T'){
           if(s>0){
              s--;
           }else{
              c++;
           }
        }
    }
    cout<<s+c<<endl;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int N;
int cnt[5];
double dp[310][310][310];

double rec(int c1, int c2, int c3){
    if(c1 + c2 + c3 == 0){
        return 0;
    }

    if(dp[c1][c2][c3] >= 0){
        return dp[c1][c2][c3];
    }

    double res = (1. - 1. * (c1 + c2 + c3) / N);
    if(c1 > 0){
        res += 1. * c1 / N * (rec(c1 - 1, c2, c3) + 1);
    }

    if(c2 > 0){
        res += 1. * c2 / N * (rec(c1 + 1, c2 - 1, c3) + 1);
    }

    if(c3 > 0){
        res += 1. * c3 / N * (rec(c1, c2 + 1, c3 - 1) + 1);
    }

    res = 1. * N / (c1 + c2 + c3) * res;

    return dp[c1][c2][c3] = res;
}

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

    std::cin >> N;

    for(int i=0;i<N;++i){
        int A;
        std::cin >> A;

        cnt[A] += 1;
    }

    std::fill(&dp[0][0][0], &dp[0][0][0]+310*310*310, -1);

    double res = rec(cnt[1], cnt[2], cnt[3]);
    printf("%.10f\n", res);
}


Measured memory_bytes: 233088
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define N 1000002
#define mod 1000000007
#define pb push_back
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int mxN = 1005;
int n,m;
string s[mxN];
int cnt;
int cache[mxN][mxN];
int findpath(int i,int j){
	if(i<0 || j>=m || i>=n || j<0)
		return 0;
	if(s[i][j]=='#')
		return 0;
	if(i==n-1 && j==m-1)
		return 1;
	int &ans = cache[i][j];
	if(ans!=-1)
		return ans;
	return ans = (findpath(i,j+1)%mod + findpath(i+1,j)%mod)%mod;
	
}
void solve()
{
	cin>>n>>m;
	cnt =  0;
	memset(cache,-1,sizeof(cache));
	for(int i =0;i<n;i++)
		cin>>s[i];
	cout<<findpath(0,0)<<'\n';
}
int main() {	
	// IOS
	ll T;
	// cin>>T;
	
	T = 1;
	// ll i = 1;
	while(T--){
		// cout<<"Case #"<<i<<": ";
		
		solve();
		// i++;
	}
	return 0;
	
}

Measured memory_bytes: 9540
{-# LANGUAGE BangPatterns #-}

module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as MV
import           Control.Monad.ST

parse = fst . fromJust
parseInt = parse . BS.readInt
parseInteger = parse . BS.readInteger
readInt = parseInt <$> BS.getLine
readInteger = parseInteger <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine
readIntegerList = map parseInteger . BS.words <$> BS.getLine

res = 1000000000 + 7

main = do
  [n, m] <- readIntList
  con    <- concat <$> replicateM
    m
    ((\[a, b] -> [(a - 1, b - 1), (b - 1, a - 1)]) <$> readIntList)
  let matrix     = createMatrix n con
      perm       = map (0:) $ permutations [1 .. (n - 1)]
      validPaths = filter (judge matrix) perm
  print . length $ validPaths

judge matrix (a : b : rest) = ((matrix V.! a) V.! b) && judge matrix (b : rest)
judge matrix _ = True

type AdjacencyMatrix = V.Vector (V.Vector Bool)
createMatrix :: Int -> [(Int, Int)] -> AdjacencyMatrix
createMatrix n con =
  V.fromList
    $ map
        (\conByStart -> V.create $ do
          adj <- MV.replicate n False
          forM_ conByStart (\(i, j) -> MV.write adj j True)
          return adj
        )
    . groupBy (\a b -> fst a == fst b)
    . sort
    $ con


Measured memory_bytes: 1020
#!/usr/bin/env python3.4
# -*- coding: utf-8 -*-

# abc123_c
import math

# input
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
#arr = [a, b, c, d, e]
neck = min(a, b, c, d, e)
# output
ans = math.ceil(n/neck)
ans += 4
print(ans)


Measured memory_bytes: 3060
n, y = map(int, input().split())

flag = False
for i in range(n + 1):
    for j in range(n + 1 - i):
        res = y - 10000 * i - 5000 * j
        if res // 1000 == n - i - j:
            print(i, j, res // 1000)
            flag = True
            break
    if flag:
        break
else:
    print(-1, -1, -1)


Measured memory_bytes: 9104
import unittest
import itertools
import sys

def triangle(n):
    return (n * (n+1)) // 2

def solve(problem):
    rl = [(k, len(list(g))) for (k, g) in itertools.groupby(problem)]
    print(rl, file=sys.stderr)

    result = 0
    pos = 0
    while pos < len(rl):
        if rl[pos][0] == '>':
            assert pos == 0
            result += triangle(rl[pos][1])
            pos += 1
        elif pos + 1 < len(rl): # < then >
            result += triangle(max(rl[pos][1], rl[pos+1][1]))
            result += triangle(min(rl[pos][1], rl[pos+1][1]) - 1)
            pos += 2
        else: # last <
            result += triangle(rl[pos][1])
            pos += 1
    return result

class Tests(unittest.TestCase):
    def test_1(self):
        self.assertEqual(solve('<>>'), 3)

    def test_2(self):
        self.assertEqual(solve('<>>><<><<<<<>>><'), 28)

if __name__ == '__main__':
    print(solve(input().strip()))


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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
#define rSORT(a, i) sort(all(a),(i))

using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;
constexpr int MAX = 2000200;

using namespace std;

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

	int cnt = 0;
	rep(i, s.size()) {
		if (s[i] == 'x') {
			cnt++;
		}
	}
	if (cnt > 7) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
      int x,y,z;
      Int(x,y,z);

      printf("%d %d %d\n", z,x,y);

        //printf("Case %d: ",++te);
    }
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<map>
#include<bitset>
#include<stack>
#include<set>
#include<vector>
#include <time.h>
#include<string.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 1e5+5;
const int Mod=1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e=exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl
ll dp[maxn];
int w[maxn],v[maxn];
int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);
    int n,V;
    scanf("%d%d",&n,&V);
    for(int i=1;i<=n;i++) scanf("%d%d",&w[i],&v[i]);
    memset(dp,LL_INF,sizeof(dp));
    dp[0]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=100000;j>=1;j--)
        {
            if(j>=v[i]) dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
        }
    }
    int ans=0;
    for(int j=1;j<=100000;j++)
    {
        if(dp[j]<=V) ans=max(ans,j);
    }
    printf("%d\n",ans);
    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <stack>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int a[15];

int main()
{
	int n;
	cin >> n;
	while (n--) {
		for (int i = 0; i < 10; i++)	cin >> a[i];
		stack<int> s1, s2;
		s1.push(a[0]);
		
		bool flag = true;
		
		for (int i = 1; i < 10; i++) {
			if (s2.empty()) {
				if (s1.top() < a[i])	s1.push(a[i]);
				else	s2.push(a[i]);
			}
			else {
				if (s1.top() > a[i]) {
					if (s2.top() > a[i])	{
					   flag = false; break;
					}
					else	s2.push(a[i]);
				}
				else {
					if (s2.top() > a[i])	s1.push(a[i]);
					else {
						if (s1.top() > s2.top())	s1.push(a[i]);
						else	s2.push(a[i]);
					}
				}
			}
		}
		if (flag)	cout << "YES\n";
		else	cout << "NO\n";
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) x.begin(), x.end()

using namespace std;
typedef long long int ll;

int n, d[1005], ans=0;
bool check(int i, int k){
	for(;i>=0; i--){
		if(d[i] != k%10) break;
		k /= 10;
		if(k == 0) return true;
	}
	return false;
}
int main(){
	cin >> n;
	rep(i,n) cin >> d[i];
	rep(k,10005){
		bool b = false;
		rep(i,n) b |= check(i,ans);
		if(!b) break;
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3080
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <deque>
#include <stack>
#include <stdio.h>
#include <map>
#include <set>
#include <time.h>
#include <string>
#include <fstream>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <assert.h>
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define pdd pair<double,double>
#define pii pair<ll,ll>
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD2 1000000009
#define INF ((ll)1e+18)
#define x1 fldgjdflgjhrthrl
#define x2 fldgjdflgrtyrtyjl
#define y1 fldggfhfghjdflgjl
#define y2 ffgfldgjdflgjl
#define N 131072
#define SUM 377
#define MAG 33554431
#define RED 0
#define BLUE 1
#define eps 1e-7
typedef long long ll;
typedef long double ld;
using namespace std;
ll i,j,n,k,l,m,tot, flag,r,z, K,x1,y1,x2,y2,x3,y3,x,y,h,num,h2,timer,sz,q,ans, curL, curR, SQ, P, Q, bad;
string s, t, s1, t1;
int main() {
	//freopen("input.txt","r",stdin);
 	//freopen("output.txt","w",stdout);
 	cin >> n >> m;
 	if (n*2 > m)
    {
        cout << m/2 << endl;
    } else
        cout << n + (m-n*2)/4 << endl;
    return 0;
}


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

int main() {
    int cur, nxt, price;
    while (cin >> cur >> nxt >> price, cur) {
        int ma = 0;
        for (int x = 1; x < price; x++) {
            for (int y = 1; y < price; y++) {
                int cur_x = x * (100 + cur) / 100;
                int cur_y = y * (100 + cur) / 100;
                if (cur_x + cur_y != price) continue;
                int nxt_x = x * (100 + nxt) / 100;
                int nxt_y = y * (100 + nxt) / 100;
                ma = max(ma, nxt_x + nxt_y);
            }
        }
        cout << ma << endl;
    }
    return 0;
}


Measured memory_bytes: 3056
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(1000000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def sim(N, K, v=False):
    s = [N]
    while N >= K:
        if N % K == 0:
            N = N // K
        else:
            N = N % K
        s.append(N)
    if v:
        print(K, s)
    return N


def divisor(n):
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            yield i
            if i != n // i:
                yield n // i


@mt
def slv(N):
    ans = set()
    for _ in divisor(N):
        if _ != 1 and sim(N, _) == 1:
            ans.add(_)
    for _ in divisor(N-1):
        if _ != 1 and sim(N, _) == 1:
            ans.add(_)

    return len(ans)


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6344
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int a, b, c, d, e, f;
    int i, j, k, l;
    k = 0;
    l = 0;
    int *water;
    int *suger;
    int solute, solution;
    solute = 0;
    solution = 0;
    double x;
    double limit;
    double dens;
    dens = 0.0;
    suger = (int *)malloc(sizeof(int) * 3001*3001);
    water = (int *)malloc(sizeof(int) * 31 * 31);
    
    
    scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);

    limit = (double)e*100 / (e+100);


    for (i = 0; i < 31; i++){
        for (j = 0; j < 31; j++){
            if (f >= a*100*i + b*100*j){
                water[k] = a*100*i + b*100*j;
                k++;
            }
        }
    }

    for (i = 0; i < 3001; i++){
        for (j = 0; j < 3001; j++){
            if (f >= c*i + d*j){
                suger[l] = c*i + d*j;
                l++;
            }
        }
    }


    for (i = 0; i < k; i++){
        for (j = 0; j < l; j++){
            if (water[i] == 0){
                continue;
            }
            if (water[i] + suger[j] <= f
                && limit >= (double)100*suger[j]/ (water[i] + suger[j])){
                    if (x = (double)100*suger[j]/ (water[i] + suger[j]), dens < x){
                        dens = x;
                        solute = suger[j];
                        solution = water[i] + suger[j];
                    }
            }
        }
    }

    if (solute == 0 && solution == 0){
        for (i = 0; i < k; i++){
            if (solution < water[i]){
                solution = water[i];
            }
        }
    }

    printf("%d %d\n", solution, solute);

    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  int n, x;
  cin >> n >> x;
  ll c_all = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    c_all += a.at(i);
  }
  if (a.at(0) > x) a.at(0) = x;
  for (int i = 0; i < n - 1; i++) {
    if (a.at(i) + a.at(i + 1) > x) {
      int tmp = a.at(i) + a.at(i + 1) - x;
      a.at(i + 1) -= tmp;
    }
  }
  ll c_min = accumulate(a.begin(), a.end(), 0LL);
  cout << c_all - c_min << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	vector<bool>color(8);
	int cnt = 0;
	rep(i, N) {
		if (A[i] >= 3200) {
			cnt++;
		}
		else {
			color[A[i] / 400] = true;
		}
	}
	int cntcolor = 0;
	rep(i, 8) {
		if (color[i]) {
			cntcolor++;
		}
	}
	if (cntcolor == 0) {
		cout << 1 << ' ' << cnt << endl;
	}
	else {
		cout << cntcolor << ' ' << cntcolor + cnt << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;
ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m));
  rep(i, n){
    cin >> c[i];
    rep(j, m){
      cin >> a[i][j];
    }
  }

  
  int ans2 = INF;
  for(int i = 0; i < (1 << n); ++i){
    int index = i;
    int count = 0;
    int money = 0;
    vector<int> ans(m, 0);
    while(index > 0){
      if(index & 1){
        money += c[count];
        for(int j = 0; j < m; ++j){
          ans[j] += a[count][j];
        }
      }
      index >>= 1;
      count++;
    }

    // check
    bool fail = false;
    for(int j = 0; j < m; ++j){
      if(x > ans[j]){
        fail = true;
      }
    }
    if(!fail){
      ans2 = min(ans2, money);
    }
  }

  if(ans2 == INF){
    ans2 = -1;
  }
  cout << ans2 << endl;
  return 0;
}

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

ll ans = 100000000;
int n;
int hate[10];

void dfs(int now)
{
	if(n<=now)
	{
		ans = min<ll>(now,ans);
		return;
	}
	for(int i = 0;i<10;i++)
	{
		if(now*10+i==0)continue;
		if(hate[i]==0)dfs(now*10+i);
	}
}

int main()
{
	int k;
	cin >> n >> k;
	for(int i = 0;i<k;i++)
	{
		int x;
		cin >> x;
		hate[x] = 1;
	}
	dfs(0);
	cout<<ans<<endl;


}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
int main()
{
    int flag=1;
    char s[11],t[12];
    scanf("%s %s",s,t);
    for(int i=0;i<strlen(s);i++)
    {
        if(s[i]!=t[i])
            flag=0;
    }
    if(flag==1)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

void solve(long long N){
    cout<<N*N*N<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
}


Measured memory_bytes: 256