akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    while(a > 0 && c > 0){
        c -= b;
        if(c <= 0)break;
        a -= d;
    }
    if(a <= 0) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
    int A, B;
    cin >> A >> B;
    if (!(B % A)) {
        cout << A + B << endl;
    } else {
        cout << B - A << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 922337203685477580;//7;
constexpr auto mod = 1000000007;

int main() {

	int n;
	cin >> n;
	map<int, int> m;
	int a;
	FOR(i, n) {
		cin >> a;
		m[a]++;
	}
	if (n % 2 == 0) {
		for (int i = 1; i < n; i += 2) {
			if (m[i] != 2) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	else {
		if (m[0] != 1) {
			cout << 0 << endl;
			return 0;
		}
		for (int i = 2; i < n; i += 2) {
			if (m[i] != 2) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	ll ans = 1;
	FOR(i, n / 2) {
		ans *= 2;
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3200
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("\\s"); //?????????????????´??????????????¨?????±???????????????\\???????????????
		int i = 0;
		while(i == 0) { //break????????????????????°????????????
			int h = scan.nextInt();//??´??°??\????????????
			int w = scan.nextInt();//??´??°??\???????¨?)
			if (h == 0 && w == 0) {  //h w???0?????¨????????????
				break;
			} else if (h > 0){  //0??§???????????£?????¨????????????
				for (int j = 0; j < h; j++) { //j???h????????§?????????????????§??????
					for (int k = 0; k < w; k++) { //k???w????????§?????????????????§??????
						if (j%2 == 0 && k%2 == 1 || k%2 == 0 && j%2 ==1){
							System.out.print(".");
						} else {
							System.out.print("#");
							}
					}
						System.out.println();//\\s??§??????
				}
					System.out.println();//\\s??§??????
			}
		}
	}
}

Measured memory_bytes: 35372
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;



int main(){
	long long X,Y;
	scanf("%lld %lld", &X, &Y);

	int ans = 0;
	long long a = X;
	while(a<=Y){
		a *= 2;
		ans++;
	}
	
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 256
N = int(raw_input())
a = [int(raw_input()) for i in xrange(N)]
i = 0
ans = 0
while True:
    if a[i] == -1:
        break
    ni = a[i] - 1
    a[i] = -1
    i = ni
    ans += 1
    if i == 1:
        break
print ans if a[i] != -1 else -1



Measured memory_bytes: 5764
word = input()
n = int(input())

for i in range(n):
    direction = input().split()
    
    if direction[0]=="replace":
        word = word[:int(direction[1])] + direction[3] + word[int(direction[2])+1:]
        
    elif direction[0]=="print":
        print(word[int(direction[1]):int(direction[2])+1])
        
    elif direction[0]=="reverse":
        word = word[:int(direction[1])] + word[int(direction[1]):int(direction[2])+1][::-1] + word[int(direction[2])+1:]



Measured memory_bytes: 5620
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define	pb            push_back
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigboi        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(all(v), RNG);
// Use mt19937_64 for 64 bit random numbers.

void solve(){	
	int n, res=0;
	cin>>n;
	FOR(i, 1, n+1){
		FOR(j, 1, n+1){
			FOR(k, 1, n+1){
				res+=__gcd(i, __gcd(j, k));
			}
		}
	}
	cout<<res<<endl;
}	
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0); 	
	int t=1;
	//cin>>t;
	FOR(i, 1, t+1){	
		//cout<<"Case #"<<i<<": ";
		solve();
	}
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
 
}


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

const int INF = 12345678;
const int A = 10000;
int dp[101][A+1];

int main()
{
    int n,C;
    cin >>n >>C;
    vector<int> a(n),b(n),c(n);
    rep(i,n) cin >>a[i] >>b[i] >>c[i];

    fill(dp[0],dp[101],-INF);
    dp[0][0] = 0;
    rep(i,n)
    {
        for(int cost=C; cost>=0; --cost)
        {
            if(cost+c[i]<=C)
            {
                int nx = cost+c[i];
                rep(j,A+1)
                {
                    dp[nx][min(A,j+a[i])] = max(dp[nx][min(A,j+a[i])], dp[cost][j]+b[i]);
                    dp[nx][min(A,j+b[i])] = max(dp[nx][min(A,j+b[i])], dp[cost][j]+a[i]);
                }
            }
        }
    }

    int ans = 0;
    rep(i,C+1)rep(j,A+1)
    {
        ans = max(ans,min(j,dp[i][j]));
    }

    cout << ans << endl;
}

Measured memory_bytes: 7032
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int n;
    cin>>n;
    vector<bool> col(8,0);
    int per = 0,cnt=0;
    rep(i,n){
        int x;
        cin>>x;
        if(x<400) col[0]=1;
        else if(x<800) col[1]=1;
        else if(x<1200) col[2]=1;
        else if(x<1600) col[3]=1;
        else if(x<2000) col[4]=1;
        else if(x<2400) col[5]=1;
        else if(x<2800) col[6]=1;
        else if(x<3200) col[7]=1;
        else per++;
    }
        rep(j,8){
            if(col[j]) cnt++;
        }
    if(cnt==0) cout<<1<<endl;
    else cout<<cnt<<endl;
    cout<<cnt+per<<endl;

    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    rep(i,N) cin >> X[i];
    ll ans = 100100100;
    rep(p,101){
        ll tot = 0;
        rep(i,N){
            tot += pow(X[i]-p,2);
        }
        ans = min(ans, tot);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
#include <iostream>
using namespace std;
int main(void){
int A = 0,B = 0;
cin >> A >> B;
if(A > 0 && B > 0){
    if(A < 10 && B < 10)
    cout << A*B << endl;
    else 
    cout << -1 << endl;
}
else
cout << -1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <string.h>
#include <cstring>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define NEWLINE cout << '\n'
#define loop(n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define MULTI_TEST int t; cin >> t; while (t--) 

#define EXTERNAL_FILES 0
#if EXTERNAL_FILES
ifstream fin("input.txt");
ofstream fout("output.txt");
#define cin fin
#define cout fout
#endif

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<vi, int> msi;

#define EXTERNAL_OUT 0
#if EXTERNAL_OUT 
ofstream fout("output.txt");
#define cout fout
#endif

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

string binary(int n) {
	string bin;
	while (n) {
		bin += (n % 2 ? '1' : '0');
		n /= 2;
	}
	reverse(bin.begin(), bin.end());
	return bin;
}
bool isPalindrome(string s) {
	for (int i = 0, j = s.size() - 1; i < j; i++, j--)
		if (s[i] != s[j]) return 0;
	return 1;
}
bool isPrime(ll n) {
	if (n <= 1) return false;
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) return false;
	}
	return true;
}
inline vi sieve(int n) {
	vector<bool> isPrime(n + 1, true);
	for (int i = 2; i <= sqrt(n); i++) {
		if (isPrime[i])
			for (int j = 2 * i; j <= n; j += i) {
				isPrime[j] = false;
			}
	}
	vi primes;
	for (int i = 2; i <= n; i++)
		if (isPrime[i]) primes.push_back(i);
	return primes;
}

inline vi primeFactors(int n) {
	vi factors;
	vi primes = sieve(100000);
	int i = 0;
	while (n != 1 && i < primes.size()) {
		if (n % primes[i] == 0) {
			factors.push_back(primes[i]);
			n /= primes[i];
		}
		else {
			i++;
		}
	}
	return factors;
}

void shift_right(vi& A, int x) {
	int n = A.size();
	x %= n;
	vi B(n);
	for (int i = 0; i < n; i++)
		B[(i + x)%n] = A[i];
	A = B;
}
inline vector<bool> sieveQuery(int n) {
	vector<bool> isPrime(n + 1, true);
	for (int i = 2; i <= sqrt(n); i++) {
		if (isPrime[i])
			for (int j = 2 * i; j <= n; j += i) {
				isPrime[j] = false;
			}
	}
	return isPrime;
}



int main()
{
	IOS;
	
	int n; cin >> n;
	vi A(n); loop(n) cin >> A[i];
	int mx = A[0];
	ll ans = 0;
	for (int i = 1; i < n; i++) {
		if (A[i] < mx)
			ans += mx - A[i];
		mx = max(mx, A[i]);
	}
	cout << ans;
}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
#define dis distance
#define so sort
#define rev reverse
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int sum = 0;
	int minnot10 = 101;
	REP(i,n){
		int a;
		cin >> a;
		sum += a;
		if(a % 10 != 0)minnot10 = min(minnot10,a);
	}
	DUMP(minnot10);
	if(sum % 10 != 0)cout << sum << endl;
	else if(minnot10 == 101){
		cout << 0 << endl;
	}
	else{
		cout << sum - minnot10 << endl;
	}
	return 0;
}

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

int dp[3001][3001];
string s, t;

int recurse(int i, int j) {
	if(dp[i][j] != -1) {
		return dp[i][j];
	} else if(!i or !j) {
		return dp[i][j] = 0;
	} else if(s[i - 1] == t[j - 1]) {
		return dp[i][j] = recurse(i - 1, j - 1) + 1;
	} else {
		return dp[i][j] = max(recurse(i - 1, j), recurse(i, j - 1));
	}
}

signed main() {
    string lcs = ""; cin >> s >> t;
	int n = int(s.length()), m = int(t.length());
	memset(dp, -1, sizeof dp);
	recurse(n, m);
	int x = n, y = m;
	while(x > 0 and y > 0) {
		if(s[x - 1] == t[y - 1]) {
			lcs = s[x - 1] + lcs;
			x = x - 1; y = y - 1;
		} else if(dp[x - 1][y] > dp[x][y - 1]) {
			x = x - 1;
        } else {
			y = y - 1;
		}
	}
	cout << lcs;
	return 0;
}

Measured memory_bytes: 35968
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;

int n,m,cnt,sum,a[100005],ans[100005]; bool flag;
int ksm(int x,int y){
	int z=1; for (; y; y>>=1,x=(ll)x*x%mod) if (y&1) z=(ll)z*x%mod;
	return z;
}
int main(){
	scanf("%d%d",&n,&m);
	int i,j; 
	if (n&1) flag=1; else n/=2;
	for (i=1; i*i<=n; i++) if (!(n%i)){
		a[++cnt]=i;
		if (i*i<n) a[++cnt]=n/i;
	}
	sort(a+1,a+cnt+1);
	for (i=1; i<=cnt; i++){
		ans[i]=(ans[i]+ksm(m,(flag)?(a[i]+1>>1):a[i]))%mod;
		sum=(sum+(ll)ans[i]*a[i])%mod;
		for (j=i+1; j<=cnt; j++) if (!(a[j]%a[i])) ans[j]=(ans[j]+mod-ans[i])%mod;
	}
	printf("%d\n",sum);	
	return 0;
}


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

ll w,h;
vector<vector<ll>> ans(50,vector<ll> (50,-1));
vector<vector<ll>> maze(50,vector<ll> (50));

vector<ll> idx={1,0,-1,0,1,1,-1,-1};
vector<ll> idy={0,1,0,-1,1,-1,1,-1};

bool dfs(ll th,ll tw,ll n) {
  if(ans[th][tw]<0&&maze[th][tw]==1) {
    ans[th][tw]=n;
    for(ll i=0;i<8;i++) {
      ll nh=th+idy[i];
      ll nw=tw+idx[i];
      if(nh>-1&&nh<h&&nw>-1&&nw<w) {
        dfs(nh,nw,n);
      }
    }
    return true;
  }
  else {
    return false;
  }
}

int main() {
  while(1) {
    cin >> w >> h;
    if(w==0&&h==0) {
      return 0;
    }
    for(ll i=0;i<h;i++) {
      for(ll j=0;j<w;j++) {
        cin >> maze[i][j];
        ans[i][j]=-1;
      }
    }
    ll count=0;
    for(ll i=0;i<h;i++) {
      for(ll j=0;j<w;j++) {
        if(dfs(i,j,count)) {
          count++;
        }
      }
    }
    cout << count << endl;
  }
}


Measured memory_bytes: 3308
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
int n,m;
bool vis[max_n];
int dp[max_n];
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        int x;
        scanf("%d",&x);
        vis[x]=true;
    }
    dp[0]=1;
    if(!vis[1])dp[1]=1;
    for(int i=2;i<=n;i++)
    {
        dp[i]=Add(dp[i-1],dp[i-2]);
        if(vis[i])dp[i]=0;
    }
    printf("%d\n",dp[n]);
    return 0;
}


Measured memory_bytes: 768
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
a.sort()
res = 0
ind = n
for i in range(n):
    if i == 0:
        res += a[ind]
        continue
    ind += 2
    res += a[ind]
print(res)

Measured memory_bytes: 107548
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  ll n;
  cin >> n;
  vector<ll> vec(n);
  rep(i,n){
    cin >> vec[i];
  }
  ll piv = vec[n-1];
  rep(i,n){
    piv = gcd(vec[i],piv);
  }
  vector<ll> comp(1000001,INFLONG);
  REP(i,2,1000001){
    ll piv = i*2;
    while(piv <= 1000000){
      chmin(comp[piv],(ll)i);
      piv += i; 
    }
  }
  vector<ll> emb(1000000,0);
  if(piv != 1){
    cout << "not coprime" << endl;
  }else{
    sort(all(vec));
    rep(i,n){
      t1 = vec[i];
      while(1){
        t2 = comp[t1];
        if(t2 == INFLONG){
          emb[t1]++;
          break;
        }
        emb[t2]++;
        while(t1 % t2 == 0){
          //cout << t2 << endl;
          t1 /= t2;
        }
      }
    }
    bool can = true;
    REP(i,2,1000001){
      if(emb[i] > 1){
        //cout << i << endl;
        can = false;
      }
    }
    //cout << emb[2] << endl;
    if(can){
      cout << "pairwise coprime" << endl;
    }else{
      cout << "setwise coprime" << endl;
    }
  }
}

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

using namespace std;

#define L long long int
#define in(x) L x; cin>>x;
#define vi vector<L>
#define pb push_back
#define re(i,n) for(L i=0; i<n; i++) 
#define mp make_pair
#define pi(v) vector<pair<L,L>> v;
#define bi begin();3

bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 

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

L power(L b,L e,L m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    in(n);
    L z=0,ans=0;
    for(L i=1;i<n;i++)
    {
        ans+=((n-1)/i);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3660
a = int(input())
b = int(input())
ans = [0, 0, 0, 0]
ans[a] = 1
ans[b] = 1
if ans[1] == 0:
    print(1)
if ans[2] == 0:
    print(2)
if ans[3] == 0:
    print(3)

Measured memory_bytes: 3060
def check(s,c)
  return 0 if s.chars.all?{|i|i==c}
  t = s[0...-1]
  t.size.times do |i|
    t[i] = c if s[i+1]==c
  end
  1 + check(t,c)
end

S = gets.chomp
p (?a..?z).map{|c|check(S,c)}.min


Measured memory_bytes: 1788
N = int(input())
S = list(input())

w_cnt = [0]
w = 0
for s in S:
    if s == '.':
        w += 1
    w_cnt.append(w)

b_cnt = [0]
b = 0
for s in S[::-1]:
    if s == '#':
        b += 1
    b_cnt.append(b)


ans = float('inf')
i = 0
for b, w in zip(b_cnt[::-1], w_cnt):
    ww, bb = i, N - i
    ans = min(ans, abs(b - bb) + abs(w - ww))
    i += 1
print(ans)


Measured memory_bytes: 68552
#include<iostream>
#include<algorithm> 
#include<cstdio>
#include<cctype>
#include<string>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const int N = 1e6+5;
const double pi = acos(-1.0);
const ll mod = 1e9+7;
int main()
{
 ll x,sum=100,ans=0;
   cin>>x;
while(sum<x){
	sum=sum+sum*0.01;
	ans++;
}
cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int N, M, K, a, b, c, g[3009][3009], dist[3009]; bool vis[3009];
int main() {
	scanf("%d%d%d", &N, &M, &K);
	memset(g, 0x3f, sizeof(g)); 
	for(int i = 0; i < M; i++) {
		scanf("%d%d%d", &a, &b, &c); a--, b--;
		g[a][b] = g[b][a] = c;
	}
	memset(dist, 0x3f, sizeof(dist));
	for(int i = 0; i < K; i++) {
		scanf("%d", &a); a--;
		dist[a] = 0;
	}
	for(int i = 0; i < N; i++) {
		int ptr = -1;
		for(int j = 0; j < N; j++) {
			if(!vis[j] && (ptr == -1 || dist[ptr] > dist[j])) {
				ptr = j;
			}
		}
		vis[ptr] = true;
		for(int j = 0; j < N; j++) {
			if(dist[j] > dist[ptr] + g[ptr][j]) {
				dist[j] = dist[ptr] + g[ptr][j];
			}
		}
	}
	int ret = 0;
	for(int i = 0; i < N; i++) {
		for(int j = i; j < N; j++) {
			if(g[i][j] == 0x3f3f3f3f) continue;
			ret = max(ret, (dist[j] + dist[i] + g[i][j] + 1) >> 1);
		}
	}
	printf("%d\n", ret);
	return 0;
}

Measured memory_bytes: 38596
##C
n,k,q = map(int,input().split())
a = [int(input()) for i in range(q)]
b = [k]*n

for j in range(n):
        b[j] += -q

for i in range(q):
    b[a[i]-1] += 1

for i in b:
    if i >= 1:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 11780
import java.util.*;

public class Main {
    static final int MOD = 1000000007;
	public static void main (String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int all = x + y;
		if (all % 3 != 0 || x - all / 3 < 0 || y - all / 3 < 0) {
		    System.out.println(0);
		    return;
		}
		int n = x - all / 3;
		int m = y - all / 3;
		Combination cmb = new Combination(x + y + 1);
		System.out.println(cmb.getComb(n + m, n));
	}
}


class Combination {
    static final int MOD = 1000000007;
    long[] fac;
    long[] finv;
    long[] inv;
    
    public Combination (int size) {
        fac = new long [size];
        finv = new long [size];
        inv = new long [size];
        fac[0] = 1;
        fac[1] = 1;
        finv[0] = 1;
        finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < size; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }
    
    
    public long getComb(int n, int k) {
        if (n < k || n < 0 || k < 0) {
            return 0;
        }
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
    
}



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

const ll MOD=1000000007;

ll abs1(ll a){
  if(a>=0)return a;
  else return -a;
}

ll gcd1(ll a,ll b){
  if(a==0 && b==0)return 0;
  ll n;
  while(a%b!=0){
    n=a%b;
    a=b;
    b=n;
  }
  return b;
}

ll solveLinear(ll n,ll m,ll c){
  if(n==0 && m==0)return 0;
  ll a[100],b[100];
  a[0]=n;b[0]=m;
  int i=1;
  while(b[i-1]!=0){
    a[i]=b[i-1];
    b[i]=a[i-1]%b[i-1];
    i++;
  }
  n=i;
  if(c%a[n-1]!=0){
    return 0;
  }
  ll x=c/a[n-1],y=0;
  for(i=1;i<n;i++){
    ll cnt=x;
    x=y;
    y=cnt-(a[n-i-1]/b[n-i-1])*y;
  }
  return x;
}

ll modRev(ll a,ll p){
  ll n=solveLinear(a,p,1);
  n=n%p;
  if(n<0)return n+p;
  return n;
}
 
int main(){
  int i,j,cnt;
  int n;
  cin>>n;
  ll x[n],y[n],h[n];
  for(i=0;i<n;i++)cin>>x[i]>>y[i]>>h[i];
  int cx,cy;
  for(cx=0;cx<=100;cx++){
    for(cy=0;cy<=100;cy++){
      cnt=1;
      int flg=1;
      ll mi=INT_MAX,H=0;
      for(i=0;i<n;i++){
        if(h[i]==0){
          mi=min(mi,abs1(x[i]-cx)+abs1(y[i]-cy));
        }
      }
      for(i=0;i<n;i++){
        if(h[i]!=0){
          if((H!=h[i]+abs1(x[i]-cx)+abs1(y[i]-cy) && cnt==0)){
            flg=0;
            break;
          }
          H=h[i]+abs1(x[i]-cx)+abs1(y[i]-cy);
          cnt=0;
          if(H>mi){
            flg=0;
            break;
          }
        }
      }
      if(flg==1){
        cout<<cx<<" "<<cy<<" "<<H<<endl;
        return 0;
      }
    }
  }
  return 1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n;
    cin >> n;
    ll ans = 1145141919810;
    for (ll i = 1; i < n; i++)
    {
        ll tmp = 0;
        ll sum = 0;
        ll j = n - i;
        ll k = i;
        while (j != 0)
        {
            tmp += j % 10;
            j /= 10;
        }
        sum += tmp;
        tmp = 0;
        while (k != 0)
        {
            tmp += k % 10;
            k /= 10;
        }
        sum += tmp;
        ans = min(sum, ans);
    }
    cout << ans << endl;
}

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

int main(){
    ll n,k;
    cin >> n >> k;
    ll ans=n*n;

    rep(i,n){
        //cout << ans << endl;
        if((i+1)<=k){
            ans-=n;
        }
        else{
        ans-=(n/(i+1))*k;
        if(n%(i+1)>=k){
            ans-=(k-1);
        }
        else{
            ans-=(n%(i+1));
        }
        }

    }

    if(k==0){
        ans=n*n;
    }
    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 3564
#include <stdio.h>

int main(){
  int n,i,j,h,p[20005],a[2005],b[2005],m,max=0,mm;
  scanf("%d",&h);
  scanf("%d",&n);
  for(i=0;i<n;i++){
  	scanf("%d",&a[i]);
  	scanf("%d",&b[i]);
    if(a[i]>max){
      max=a[i];
    }
  }
  mm=100000000;
  for(i=1;i<=h+max;i++){
    p[i]=100000000;
    for(j=0;j<n;j++){
      m=b[j];
      if(a[j]<i){
        m+=p[i-a[j]];
      }
      if(p[i]>m) p[i]=m;
    }
    if((i>=h)&&(mm>p[i])){
      mm=p[i];
    }
  }
  printf("%d",mm);
  return 0;
}



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

using ll = long long;

const int MOD = 1e9 + 7;

int add(int a, int b) {
    return (a + b) % MOD;
}

int sub(int a, int b) {
    return (a - b + MOD) % MOD;
}

int mul(ll a, ll b) {
    return (a * b) % MOD;
}

int main() {
    int n, h, d;
    cin >> n >> h >> d;

    vector<int> f(n + 1);
    f[0] = 1;
    for (int i = 1; i <= n; i++)
        f[i] = mul(f[i - 1], i);

    int coef = accumulate(f.begin() + 1, f.end(), 0LL) % MOD;

    vector<int> delta(h + d + 2);
    delta[1] = add(delta[1], f[n]);
    delta[d + 1] = sub(delta[d + 1], f[n]);

    int val = 0;
    for (int i = 1; i <= h; i++) {
        val = add(val, delta[i]);
        delta[i + 1] = add(delta[i + 1], mul(coef, val));
        delta[i + d + 1] = sub(delta[i + d + 1], mul(coef, val));
    }

    cout << val << endl;
}


Measured memory_bytes: 11904
#include <iostream> // cout, endl, cin
#include <vector>   // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
using namespace std;

int main(void)
{
  long long int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  if(x + r <= W&&x - r >= 0&&y + r <= H&&y - r >= 0) cout << "Yes";
  else cout << "No";
  cout << endl;
  return 0;
}


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

const ll MAX = 1000000;
const ll MOD = 998244353;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll n,a,b,k,ans;

int main(){
    COMinit();
    cin>>n>>a>>b>>k;
    for(ll i=0;i*a<=k;i++){
        if((k-a*i)%b)continue;
        ll j=(k-a*i)/b;
        (ans+=COM(n,i)*COM(n,j))%=MOD;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 23680
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        String a="Three";
        for(int i=0;i<N;i++) {
            String s=sc.next();
            if(s.equals("Y")) {
                a="Four";
            }
        }
        System.out.println(a);

    }

}


Measured memory_bytes: 23636
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

MOD = 10 ** 9 + 7

S = gets.chomp.split('')

dp = Array.new(S.length + 1) { Array.new(4, 0) }

dp[0][0] = 1

def add_with_mod(a, b)
  res = a + b
  res -= MOD if res >= MOD
  res
end

S.each.with_index do |s, i|
  dp[i+1] = dp[i].dup
  dp[i+1] = dp[i+1].map { |x| x * 3 % MOD } if s == '?'
  dp[i+1][1] = add_with_mod(dp[i+1][1], dp[i][0]) if s == 'A' || s == '?'
  dp[i+1][2] = add_with_mod(dp[i+1][2], dp[i][1]) if s == 'B' || s == '?'
  dp[i+1][3] = add_with_mod(dp[i+1][3], dp[i][2]) if s == 'C' || s == '?'
end

puts dp[S.length][3]


Measured memory_bytes: 46584
#include <stdio.h> 
int main()
{
	char x;
	int i,j,n[26]={},flag=0;
	for(i=0;i<4;i++){
		scanf("%c",&x);
		n[x-65]++;
	}
	for(i=0;i<26;i++){
		if(n[i]==2){
			for(j=i+1;j<26;j++){
				if(n[j]==2){
					flag=1;
					break;
				}
			}
		}
	}
	if(flag==1)
		printf("Yes");
	else
		printf("No");
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    ll a, b,cnt=0;
    cin >> a >> b;
    while (b >= a) {
        b /= 2;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/

int main(){
    double pai=3.141592653589;
    int m,h,l;
    char s[200];
    string ans,tmp1,tmp2;
    for(;;){
        scanf("%s",&s);
        tmp1=s;
        if(tmp1=="-"){
            break;
        }
        scanf("%d",&m);
        l=tmp1.length();
        for(int i=0;i<m;i++){
            scanf("%d",&h);
            ans="";
            ans.assign(tmp1,h,l-h+1);
            tmp2.assign(tmp1,0,h);
            ans+=tmp2;
            tmp1=ans;
        }
        printf("%s\n",ans.c_str());
    }
    return 0;
}

Measured memory_bytes: 1204
n,m,x = map(int,input().split())
ca = [list(map(int,input().split())) for i in range(n)]
min_ = float('inf')
# print(ca)

for bit in range(1 << n):
#     print(bin(bit))
    cost = 0
    alg = [0]*m
    ok = [0]*m
    flag = 0
    for i in range(n):
#         print(bool(bit & 1<<i))
        if bool(bit & 1<<i) == 1:
            cost += ca[i][0]
#             print('hoge',ca[i][0])
            for j in range(1,m+1):
                alg[j - 1] += ca[i][j]
                if alg[j - 1] >= x:
                    ok[j - 1] = 1
        if ok.count(1) >= m:
            flag = 1
            break
#     print(cost)
    if flag == 1:
        min_ = min(min_,cost)
if min_ == float('inf'):
    print(-1)
else:
    print(min_)

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

int main(){
    int x=0;
    int ans=0;
    int N;
    string S;
    cin>>N;
    cin>>S;

    for(int i=0;i<N;i++){
        switch (S.at(i)){
            case 'I':
                ans=max(ans,++x);
                break;
            case 'D':
                ans=max(ans,--x);
                break;
            default:
                break;
        }
    }
    cout<<ans<<endl;

    return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int k; cin>>k;
  int v[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout<<v[k-1]<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int R = sc.nextInt();

		if(R < 1200) {
			System.out.println("ABC");
		} else if( R < 2800) {
			System.out.println("ARC");
		} else {
			System.out.println("AGC");
		}
	}

}


Measured memory_bytes: 21332
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    A, B, C = map(int, input().split())
    num = min(B // A, C)
    print(num)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4452
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 0x3fffffff;


int main(){
	//ios_base::sync_with_stdio(0);
	ll N, ans=0;
	ll a[300005];
	vector<ll> v;

	cin >> N;
	rep(i,3*N) cin >> a[i];
	rep(i,3*N) v.push_back( a[i] );
	sort( all(v) );

	rep(i,N){
		ans += v[ 3*N - i*2 - 2 ];
	}

	cout << ans << endl;

	return 0;
}


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

int best[310][310][310];
int main(){
    string s;
    cin >> s;
    int k;
    cin >> k;
    int n = s.size();
    for(int i = n-1; i >= 0; i--){
        for(int a = 0; a <= k; a++){
            if(i > 0) best[i][i-1][a] = 0;
        }
    }
    for(int i = n-1; i >= 0; i--){
        for(int j = i; j < n; j++){
            for(int a = 0; a <= k; a++){
                best[i][j][a] = 1;
                if(i == j) continue;
                best[i][j][a] = max(best[i][j][a], best[i+1][j][a]);
                best[i][j][a] = max(best[i][j][a], best[i][j-1][a]);
                if(s[i] == s[j]){
                    best[i][j][a] = max(best[i][j][a], 2 + best[i+1][j-1][a]);
                } else {
                    if(a > 0){
                        best[i][j][a] = max(best[i][j][a], best[i+1][j-1][a-1] + 2);
                    }
                }
            }
        }
    }


    cout << best[0][n-1][k] << endl;
}

Measured memory_bytes: 112768
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
#define INF (1<<29)

int cost[100][100];

struct Node{
	int p;
	int s;	
	int cost;
	Node(){}
	Node(int a,int b,int c):p(a),s(b),cost(c){}
	bool operator<(const Node &a)const{return cost>a.cost;} 
};
int dijkstra(int n){
	int dp[100][3];
	priority_queue<Node> pq;
	Node a,b;
	fill_n((int*)dp,300,INF);
	a=Node(0,0,0);
	dp[a.p][a.s]=a.cost;
	pq.push(a);
	while(!pq.empty()){
		a=pq.top();
		pq.pop();
		if(a.p==n-1 && a.s!=1)return a.cost;
		if(dp[a.p][a.s] < a.cost)continue;
		for(int i=0;i<n;i++){
			if(cost[a.p][i]==INF)continue;
			for(int j=0;j<=1;j++){
				b=Node(i,a.s,a.cost);
				if(a.s==0){
					if(j==0)b.cost += cost[a.p][i];
					else b.s=1;
				}
				else if(a.s==1){
					b.s = 2;
				}
				else if(a.s==2){
					b.cost += cost[a.p][i];
				}
				if(b.cost < dp[b.p][b.s]){
					dp[b.p][b.s] = b.cost;
					pq.push(b);
				}
				if(a.s!=0)break;
			}
		}
	}
}
int main(){
	int n,m;
	while(cin>>n>>m&&(n||m)){
		fill_n((int*)cost,10000,INF);
		while(m--){
			int a,b,c;
			cin>>a>>b>>c;
			a--;b--;
			cost[a][b]=cost[b][a]=c;
		}
		cout<<dijkstra(n)<<endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{
    int ch[150] = {};
    int n, n1;
    cin>>n;
    n1 = n;
    vector<string>str;
    while(n1--)
    {
        string s;
        cin>>s;
        for(int i = 0; i<s.size(); i++)
        {
            ch[s[i]]++;
        }
        str.push_back(s);
    }
   vector<char> vec;
   for(int i = 97; i<=122; i++)
   {
       if(ch[i]>=n)
       {   char c = i;
           vec.push_back(c);
       }
   }

    for(int k = 0; k<vec.size(); k++)
   {   ll mi = INT_MAX;
            int i = 0;
       char check = vec[k];
       for(i = 0; i<n; i++)
       {
           ll cnt = 0;
           string s = str[i];
           for(int j = 0; j<s.size(); j++)
           {
               if( s[j] == check) cnt++;
           }
           mi = min(mi, cnt);
       }
       //cout<<mi<<endl;
       while(mi--)
       {
           cout<<check;
       }
   }
   return 0;
}



Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main() {
  int l, r, d, ans=0;
  cin >> l >> r >> d;
  for(int i=l; i<=r; i++) {
    if(i%d==0) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
using namespace std;
int main(){
  string n;
  cin >> n;
  for(int i = 0; i < 3; i++){
    if(n[i] == '1') n[i] = '9';
    else if(n[i] == '9') n[i] = '1';
  }
  cout << n << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

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

		int n = sc.nextInt();
		int top = 0;

		int ans = 0;
		for (int i = 0; i < n; i++) {
			int h = sc.nextInt();
			if (h >= top) {
				ans++;
				top = h;
			}
		}

		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
//#include "Local_Debug.h"
using namespace std;
#define Endl endl
#define debug(x) cout << #x << " = " << (x) << endl
typedef long long ll;
const int MOD = 998244353;
const int MAXN = (int)2e5 + 5;
ll n, d;
ll quick_mul(ll a, ll b, ll mod)
{
	ll res = 0;
	while (b)
	{
		if (b & 1)
			res = (res + a) % mod;
		a = (a + a) % mod;
		b >>= 1;
	}
	return res;
}
ll quick_pow(ll a, ll b, ll mod)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = quick_mul(res, a, mod);
		a = quick_mul(a, a, mod);
		b >>= 1;
	}
	return res;
}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while (cin >> n)
	{
		map<ll, vector<ll>> m;
		vector<pair<ll, ll>> v;
		bool flag = true;
		for (ll i = 1; i <= n&&cin >> d; ++i)
		{
			if (i == 1 && d)
				flag = false;
			m[d].emplace_back(i);
		}
		if (flag)
		{
			for (auto i : m)
				v.emplace_back(i.first, i.second.size());
			ll ans = 0;
			if (v.front().first == 0 && v.front().second == 1 && v.back().first == v.size() - 1)
			{
				ans++;
				if (v.size() > 1)
					for (ll i = 1; i < v.size(); ++i)
					{
						if (v[i - 1].first != i - 1 || v[i].first != i)
						{
							ans = 0;
							break;
						}
						ans = quick_mul(ans, quick_pow(v[i - 1].second, v[i].second, MOD), MOD);
					}
			}
			cout << ans << endl;
		}
		else
			cout << 0 << endl;
	}
}
/*
4
0 1 1 2

4
1 1 1 1

7
0 3 2 1 2 2 1
*/

Measured memory_bytes: 13428
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  int n,m;
  cin>>n>>m;
  priority_queue<int> q;
  rep(i,n){
    int a;
    cin>>a;
    q.push(a);
  }
  rep(i,m){
    int a=q.top();q.pop();
    q.push(a/2);
  }
  ll ans=0;
  rep(i,n){
    ans+=q.top();q.pop();
  }
  cout<<ans<<endl;
    
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll; // int -> ll
#include <utility> // C++11から

int main(){
    ll x,y,z,t;
    cin >> x>>y>>z;
    t=x;
    x=y;
    y=t;

    t=x;
    x=z;
    z=t;
    cout << x <<" "<< y << " " << z << endl;


}


Measured memory_bytes: 3580
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
using namespace std;

int main()
{
    int num;
    cin >> num;
    
    vector<long long int> vec(num);
    for(int i=0; i<num; ++i) cin >> vec.at(i);
    
    long long int maxi = 0;
    
    for(int i=0; i<num; ++i){
        for(int j=0; j<num; ++j){
        long long int dis = abs(vec.at(i) - vec.at(j));
        if(maxi < dis) maxi = dis;
        else continue;
        }
    }
    
    cout << maxi << endl;
    
}

Measured memory_bytes: 256
a, b = input().split()
a = int(a)
b = int(b)

def sebe(p,q):
    for i in range(p+1):
        for j in range(p+1):
            if (p-j-i) < 0:
                break
            if (10000*i +5000*j + 1000*(p-j-i)) == q :
                return i,j,(p-j-i)


    else: return -1, -1, -1

a,b,c = sebe(a,b)

print(a, b, c)






Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<limits.h>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<int> s(N);
	for (int i = 0; i < N; i++) cin >> s[i];
	int sum = 0;
	for (int i = 0; i < N; i++) sum += s[i];
	if (sum % 10 != 0) {
		cout << sum << endl;
		return 0;
	}
	int minRemove = INT_MAX;
	for (int i = 0; i < N; i++) {
		if (minRemove > s[i] && s[i] % 10 != 0) {
			minRemove = s[i];
		}
	}
	if (minRemove < INT_MAX) {
		cout << sum - minRemove << endl;
		return 0;
	}
	cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
import math


def read():
    return int(input())


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


def readmap():
    return map(int, input().split())


def usage(n):
    fct = factorize(n)
    ret = []
    for div in divisorize(fct):
        ret.append(num(div))
    return ret

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base ** exponent
    return a


N, M = readmap()
if M == 1:
    print(1)
    quit()
div = usage(M)
ans = 0
for d in div:
    if N * d <= M:
        ans = max(ans, d)
print(ans)

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

int main() {

  int A, B;
  int x=0;
  cin >> A >> B;
  for (int i = A; i <= B; i++) {
    int a,b,c,d,e;
    a = i % 10 - i % 1;
    b = (i % 100 - i % 10)/10;
    d = (i % 10000 - i % 1000)/1000;
    e = (i % 100000 - i % 10000)/10000;
    if(a==e && b==d){x++;}
  }
 cout << x << endl;
}


Measured memory_bytes: 256
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        long N = Long.parseLong(str);
        long[] A_E = new long[5];
        for (int i=0;i<5;i++){
            str = br.readLine();
            A_E[i] = Long.parseLong(str);
        }
        long min = A_E[0];
        for (long l:A_E){
            if (l<min){
                min = l;
            }
        }
        long ans;
        if (N%min!=0){
            ans = N/min+5;
        } else {
            ans = N/min+4;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

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

void solve();
#ifndef ONLINE_JUDGE
#include "./lib.hpp"
#endif

void solve() {
  ini(x, y);
  vll set = {0, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 0};
  if (set[x - 1] == set[y - 1])
    out("Yes");
  else
    out("No");
}


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

#define crap ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define CY cout<<"Yes\n"
#define CN cout<<"No\n"
#define MOD 1000000007
using namespace std;
using ll = long long;
vector<ll> dp(100005,-1);
ll gcd(ll a,ll b)
{
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// ll rec(vector<ll>v,int k,int l,ll ans,int i,int f1,int f2)
// {

//     if(l==k)
//         return ans;
//     if(f1==1)
//     {
//         if(i>=v.size())
//         return INT_MAX;
//     }

//     return min(rec(v,k,l+1,max(ans,v[i]),i+2),rec(v,k,l,ans,i+1));
// }
ll bs(vector<ll>v,ll n)
{
    ll c=0;
    bool s=1;
    while(s)
    {
        s=0;
        c++;
        for(int i=0;i<n-1;i++)
        {
            if(v[i]>v[i+1])
                {swap(v[i],v[i+1]);s=1;}
        }
    }
    return c;
}
void solve()
{
    ll n; cin>>n;
    ll arr[100005]={0};
    ll sum=0;
    rep(i,n) {ll x; cin>>x; arr[x]++;sum+=x;}
    ll k; cin>>k;
    rep(i,k)
    {
        ll b,c; cin>>b>>c;
        sum-=b*arr[b];
        sum+=c*arr[b];
        arr[c]+=arr[b];
        arr[b]=0;
        cout<<sum<<"\n";
    }
}
int main() {
    crap;
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r", stdin) ;
        freopen("output.txt","w", stdout) ;
        freopen("error.txt","w", stderr) ;
    #endif
    ll t;t=1;
 //cin>>t;
    while(t--) solve();
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long

const int MOD =  1000000007;
const int IINF = INT_MAX;
const ll INF = 1LL << 60;


int main() {
    int n; cin >> n;
    if(n == 1){
        cout << "Hello World" << endl;
    }else{
        int a, b; cin >> a >> b;
        cout << a + b << endl;
    }

    return 0;
}


Measured memory_bytes: 3564