akhauriyash/Code-Regression huggingface dataset:
import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.util.*;
class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int z = sc.nextInt();
			
			if(x == 0 && y == 0 && z == 0) break;
			int[] v = new int[x];
			for(int i = 0; i < x; i++) {
				v[i] = sc.nextInt();
			}
			
			int[] n = new int[z];
			int[] e = new int[z];
			int[] A = new int[z];
			
			
			for(int i = 0; i < z; i++) {
				n[i] = sc.nextInt();
				e[i] = sc.nextInt();
				A[i] = sc.nextInt();
			}
			
			double[][] dp = new double[5000][y+1];
			for(int i = 0; i < 5000; i++) {
				Arrays.fill(dp[i], 0);
			}
			dp[0][0] = 1.0;
			
			for(int j = 0; j < dp[0].length-1; j++) {
				for(int i = 0; i < dp.length; i++) {
					if(dp[i][j] == 0) continue;
					for(int k = 0; k < x; k++) {
						int to = Math.min(y, j + v[k]);
						int money = i;
						Z:for(int l = 0; l < z; l++) {
							if(n[l] != to) continue;
							switch (e[l]) {
							case 1: to = Math.min(to + A[l], y); break Z;
							case 2: money += A[l]; break Z;
							case 3: money = Math.max(money - A[l], 0); break Z;
							}
							break Z;
						}
						dp[money][to] += dp[i][j] * (1.0/x);
					}
				}
			}
			double ans = 0;
			
			for(int i = 0; i < 5000; i++) {
				ans += i * dp[i][y];
			}

			System.out.println((int)ans);
			
		}
		
	}

	
}

Measured memory_bytes: 65472
import heapq
N,M= list(map(lambda x: int(x),input().split()))

lst = list(map(lambda x: -int(x),input().split()))
heapq.heapify(lst)

for i in range(M):
    a = heapq.heappop(lst)
    a = a/2.0
    heapq.heappush(lst,a)
    #print(a)

ans=0
for i in lst:
    i *= (-1)
    #print(i)
    ans += i//1
print(int(ans))



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

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		if(s.equals("SUN")) {
			System.out.println(7);
		}else if(s.equals("MON")) {
			System.out.println(6);
		}else if(s.equals("TUE")) {
			System.out.println(5);
		}else if(s.equals("WED")) {
			System.out.println(4);
		}else if(s.equals("THU")) {
			System.out.println(3);
		}else if(s.equals("FRI")) {
			System.out.println(2);
		}else if(s.equals("SAT")) {
			System.out.println(1);
		}

	}

}


Measured memory_bytes: 23636
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	vector<string> days = { "SUN","MON","TUE","WED","THU","FRI","SAT" };
	string s; cin >> s;
	FOR_LT(i, 0, 7) {
		if (s == days[i]) {
			cout << (7 - i) << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = list(iss())
    print('Yes' if all([N.count(n) % 2 == 0 for n in set(N)]) else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if ((a + b) % 3 == 0 || a % 3 == 0 || b % 3 == 0) {
            System.out.println("Possible");
        } else {
            System.out.println("Impossible");
        }
    }
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long h,w;
    scanf("%ld%ld", &h, &w);

    long w0=w*2/3;
    long h0=h/2;

    ll min = LINF;
    long i, j;

    {
        for(i=w0; i<=w0+1; i++) {
            for(j=h0; j<=h0+1; j++) {
                ll s0 = (ll)i*j;
                ll s1 = (ll)i*(h-j);
                ll s2 = (ll)(w-i)*h;

                ll min0 = MIN(MIN(s0,s1),s2);
                ll max0 = MAX(MAX(s0,s1),s2);
                min = MIN(min, (max0-min0));
            }
        }

        long tmp=h;
        h=w;
        w=tmp;
        long w0=w*2/3;
        long h0=h/2;
        for(i=w0; i<=w0+1; i++) {
            for(j=h0; j<=h0+1; j++) {
                ll s0 = (ll)i*j;
                ll s1 = (ll)i*(h-j);
                ll s2 = (ll)(w-i)*h;

                ll min0 = MIN(MIN(s0,s1),s2);
                ll max0 = MAX(MAX(s0,s1),s2);
                min = MIN(min, (max0-min0));
            }
        }
    }

    if(h%3==0) {
        min = 0;
    }
    else {
        min = MIN(min, w);
    }

    if(w%3==0) {
        min = 0;
    }
    else {
        min = MIN(min, h);
    }

    printf("%lld\n", min);

    return 0;
}



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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

const ll com_max = 510000;

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

void com_init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;

    for (ll i = 2; i < com_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;
}

int main() {
source:
    com_init();
    ll n, k;
    cin >> n >> k;
    ll a[n];
    rep(i, n) { cin >> a[i]; }
    sort(a, a + n);

    ll min_sum = 0, max_sum = 0;
    rep(i, n) {
        ll rem = n - i - 1;
        if (rem < k - 1) {
            break;
        }

        ll combination = com(rem, k - 1);
        ll temp_min = a[i] * combination;
        min_sum += temp_min;
        min_sum %= mod;

        ll temp_max = a[n - i - 1] * combination;
        max_sum += temp_max;
        max_sum %= mod;
    }

    ll ans = (max_sum - min_sum + 2 * mod) % mod;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 12928
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class CReplacingInteger {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      ll n, k; cin >> n >> k;

      ll r = n%k;
      ll s = (k-r)%k;
      cout << min(r,s) << endl;
    }
};

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

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
//construction 
long long a[1005];
int even[1005], odd[1005];

void printAnswer(int n,int seq[],int total){
    //printf("n = %d\n",n);
    std::vector<int>step;
    int ptr = total;
    for(int i = seq[n]+1; i <= total; i++){ 
        step.push_back(ptr);
        ptr--;
    }
    for(int i = 1; i <= seq[1]-1; i++) step.push_back(1);
    for(int i = 1; i < n; i++){
        int u = seq[i], v = seq[i+1];
        int len = v-u-1;
        for(int j = 0; j < (len-1)/2; j++) step.push_back(3);
        step.push_back(2);
    }
    printf("%d\n",(int)step.size());
    for(int u: step) printf("%d\n",u);
}

int main(){
    int n; 
    scanf("%d",&n);
    for(int i = 1; i <= n; i++) scanf("%lld",&a[i]);
    int maxnE = -1, maxnO = -1;
    int sizeE = 0, sizeO = 0;
    for(int i = 1; i <= n; i++){
        if(i%2){
            if(a[i]>=0) odd[++sizeO] = i;
            else if(maxnO==-1 || a[i]>a[maxnO]) maxnO = i;
        }
        else{
            if(a[i]>=0) even[++sizeE] = i;
            else if(maxnE==-1 || a[i]>a[maxnE]) maxnE = i;
        }
    }
    if(sizeE==0) even[++sizeE] = maxnE;
    if(sizeO==0) odd[++sizeO] = maxnO;
    long long sumE = 0, sumO = 0;
    for(int i = 1; i <= sizeE; i++) sumE += a[even[i]];
    for(int i = 1; i <= sizeO; i++) sumO += a[odd[i]];
    if(sumE>sumO){
        printf("%lld\n",sumE);
        printAnswer(sizeE,even,n);
    }
    else{
        printf("%lld\n",sumO);
        printAnswer(sizeO,odd,n);
    }
    return 0;
}


Measured memory_bytes: 3220
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 1e5;
int N;
ll H[Nmax];

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

	H[0]--;
	bool lowable=true;
	for(int i=1; i<N; i++){
		if(H[i]>H[i-1]){
			H[i]--;
			lowable=true;
		}
		else if(H[i]==H[i-1]) lowable=false;
		else {
			cout << "No" << endl;
			return 0;
		}
		//cout << i << " " << H[i] << endl;
	}

	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
const double PI = acos(-1);
using namespace std;
int main() {
    int h, w;
    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0){
            break;
        }
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(i == 0 || i == h - 1 || j == 0 || j == w - 1){
                    cout << "#";
                }
                else
                {
                    cout << ".";
                }
                
            }
            cout << endl;
        }
        cout << endl;
    }
        
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,K; cin>>N>>K;
    vector<ll> H(N);
    rep(i,N) cin>>H[i];
    sort(ALL(H),greater<ll>());
    ll ans=0;
    rep(i,N){
        if(K<=0) ans+=H[i];
        --K;
    }
    cout<< ans <<"\n";
}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int count_max = 0;
    int num_max = 1;
    for (int i = 1; i <= n; i++) {

        int num = i;
        int count = 0;
        while(num % 2 == 0) {
            num /= 2;
            count++;
        }
        if (count > count_max) {
            count_max = count;
            num_max = i;
        }
    }
    cout << num_max;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<cmath>
using namespace std;
typedef long long ll;

const ll MAX = 1000000;
const ll MOD = 1000000007;

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;
}

signed main(){
  // 前処理
  COMinit();
  ll h,w,a,b;cin >> h >> w >> a >> b;
  ll ans=COM(h+w-2,h-1);//cout << ans << endl;
  ll m=min(a,b);
  for(int i=0;i<m;i++){
    //cout << 1 << endl;
    ll ans_sub=COM(h-a+b-1,b-i-1)*COM(w-b+a-1,a-i-1)%MOD;
    ans-=ans_sub;
    if(ans<0){
      ans+=MOD;
      //cout << 1 << endl;
    }
  }
  cout << ans%MOD << endl;
}


Measured memory_bytes: 23680
def main():
    n, x = map(int, input().split())
    al = list(map(int, input().split()))
    ans = 0
    for i in range(n - 1):
        l, r = i, i + 1
        exc = al[l] + al[r] - x
        if exc <= 0:
            continue
        rd = min(al[r], exc)
        al[r] -= rd
        ans += rd
        exc -= rd
        if exc > 0:
            al[l] -= exc
            ans += exc
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 14152
import sys
sys.setrecursionlimit(250000)

# a = comb(n, r)

def main():
    # a,b,c,d = map(int, input().split())
    n = int(input())

    # temp = (10 ** 9 + 7)
    # sum = 0
    # if n >= 2:
    #     for i in range(2, n+1):
    #         a = int(comb(i, 2)) * 2
    #         a = (a * 8**(i-2)) % temp
    #         sum = sum + a
    # else:
    #     print(0)

    print((10**n - 9**n*2 + 8**n) % (10 ** 9 + 7))

main()


Measured memory_bytes: 10964
n = int(input())
s = []
for i in range(n):
    s.append(''.join(sorted(input())))
s.sort()
ans = 0
t = 0
for i in range(1,n):
    if s[i-1]==s[i]:
        t += 1
        if i==n-1:
            ans += t*(t+1)/2
    else:
        if t>0:
            ans += t*(t+1)/2
            t = 0

print(int(ans))

Measured memory_bytes: 10764
#include <bits/stdc++.h>
using namespace std;
int N, K;
int main() {
    cin >> N >> K;
    vector<int> l(N, 0);
    for(int i = 0; i < N; ++i) {
        cin >> l.at(i);
    }

    sort(l.begin(), l.end(), greater<int>());

    int sum = 0;
    for(int i = 0; i < K; ++i) {
        sum += l.at(i);
    }

    cout << sum << endl;
}

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

n = int(a + b)
i = 0
m = 0
k = 0
while m <= 100100:
	if n == m:
		k = 1
		break
	elif n < m:
		break
	i += 1
	m = i**2
if k == 1:
	print("Yes")
else:
	print("No")

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

const int N = 4005;

int a, b, n;
bool chk[N], rem[N];
vector<int> adj[N];
vector<int> ve;

int ask(int u, int v) {
    cout << "? " << u << " " << v << endl;
    char c; cin >> c;
    return c == 'Y';
}

void DFS(int u) {
    for (int &v : adj[u]) {
        chk[v] = chk[u];
        DFS(v);
    }
}

int solve(vector<int> ve) {
    if (ve.size() == 1) {
        rem[ve.back()] = true;
        return ve.back();
    }
    int odd = -1;
    if (ve.size() & 1) {
        odd = ve.back();
        ve.pop_back();
    }
    vector<int> nxt;
    for (int i = 0; i < ve.size(); i += 2) {
        int u = ve[i], v = ve[i + 1];
        if (ask(u, v) && ask(v, u)) {
            rem[v] = true;
            adj[u].push_back(v);
            nxt.push_back(u);
        }
    }
    if (!(nxt.size() & 1) && odd != -1) {
        nxt.push_back(odd);
    }
    return solve(nxt);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> a >> b;
    if (b >= a) {
        return cout << "Impossible", 0;
    }
    n = a + b;
    for (int i = 0; i < n; i++) {
        ve.push_back(i);
    }
    int rt = solve(ve);
    chk[rt] = true; DFS(rt);
    for (int i = 0; i < n; i++) {
        if (!rem[i]) {
            chk[i] = ask(rt, i);
            DFS(i);
        }
    }
    cout << "! ";
    for (int i = 0; i < n; i++) {
        cout << chk[i];
    }
    cout << endl;
}


Measured memory_bytes: 976
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
//ここから

void solve(){
  int h,w;
  cin>>h>>w;
  vector<string>s(h);
  rep(i,h)cin>>s[i];
  rep(i,h){
    cout<<s[i]<<"\n";
    cout<<s[i]<<"\n";
  }
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  vector<int> dist(100);
  for (int j = 0; j < 100; j++) {
    int sum = 0;
    for (int k = 0; k < N; k++) {
      sum += (j + 1 - vec.at(k)) * (j + 1 - vec.at(k));
    }
    dist.at(j) = sum;
  }
  sort(dist.begin(), dist.end());
  cout << dist.at(0) << endl;
}

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

int main() {

  int N;
  cin >> N;

  int min = 1000000000;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;

    int j = 0;
    while ((A % 2) == 0) {
      A /= 2;
      j++;
    }
    
    if (j == 0)
    {
      min = 0;
      break;
    }
    
    if (min > j) {
      min = j;
    }
  }
  
  cout << min << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
   int num[10000];
   int a = 1;
   int b;
   int i = 1;
   
   while(a){
      scanf("%d", &num[i]);
   
      if(num[i]==0){
         a = 0;}
   	i++;
   }
	
	b = i-1;
         
   for(i=1;i<b;i++){
      printf("Case %d: %d\n", i,num[i]);
      }
      
   return 0;
}


Measured memory_bytes: 2092
#include <iostream>
#include <string>

using namespace std;

int same(char a, char b, char c){
	if (a==b && b==c){
		return 2;
	}
	else if (a==b || b==c || c==a){
		return 1;
	}
	else{
		return 0;
	}
}

int main(){
	int n;
	string a,b,c;

	cin >> n;
	cin >> a;
	cin >> b;
	cin >> c;

	int ans = 0;
	char ta,tb,tc;
	int tmp;

	for (int i=0; i<n; i++){
		ta = a[i];
		tb = b[i];
		tc = c[i];
		tmp = same(ta,tb,tc);
		ans += 2-tmp;
	}

	cout << ans << endl;

	return 0;
}

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

int main(void){
    int k;
    cin >> k;
    if(k%2 == 0){
        cout << (k/2)*(k/2) << endl;
    }else{
        cout << (k/2)*((k+1)/2) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3", "unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a, b;
	cin >> a >> b;
	if (max(a, b) > 9)
		cout << "-1\n";
	else
		cout << a * b << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#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(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

const float INF = 1e9;

struct edge{
	int to;
	int dist;
};

struct P{
	int city;
	float time;
	unsigned char tickets;

	bool operator >(const P& p)const{
		return time > p.time;
	}
};


int main() {
	int ticket_n, city_n, road_n, start, goal;
	while (cin >> ticket_n >> city_n >> road_n >> start >> goal, ticket_n | city_n | road_n | start | goal){
		vi tickets(ticket_n);
		REP(i, ticket_n){
			cin >> tickets[i];
		}

		vector<vector<edge>> E(city_n + 1);
		REP(i, road_n){
			int x, y, z;
			cin >> x >> y >> z;
			E[x].push_back({ y, z });
			E[y].push_back({ x, z });
		}
		vector<vector<float>> G(city_n + 1, vector<float>(0xff + 1, INF));
	
		G[start][(1 << ticket_n) - 1] = 0.0;

		priority_queue < P, vector<P>, greater<P> > que;
		que.push({ start, 0.0, (unsigned char)((1 << ticket_n) - 1 )});

		float result = -1;
		while (!que.empty()){
			P p = que.top(); que.pop();
			if (p.city == goal){
				result = p.time;
				break;
			}
			for (auto e : E[p.city]){
				REP(i, ticket_n){
					if (p.tickets & (1 << i)){
						unsigned char next_tickets = p.tickets& (~(1 << i));
						float next_time = p.time + (float)e.dist / tickets[i];
						if (G[e.to][next_tickets] > next_time){
							G[e.to][next_tickets] = next_time;
							que.push({ e.to, next_time, next_tickets });
						}
					}
				}
			}

		}
		if (result != -1)printf("%f\n", result);
		else cout << "Impossible" << endl;
	}
}

Measured memory_bytes: 2216
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n,k,*a=map(int,open(0).read().split());t,s=2**40,0\n"
"while t:\n"
" c=sum((i&t)//t for i in a)\n"
" if k<t or c*2>=n:s+=t*c\n"
" else:s+=t*(n-c);k-=t\n"
" t//=2\n"
"print(s)\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 14748
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
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;}

ll dp[200001];

template <typename T>
struct ConvexHullTrick_ {
  vector<pair<T, T> > lines;
  function<bool(T l, T r)> comp;
  ConvexHullTrick_(function<bool(T l, T r)> comp_=[](T l, T r){return l >= r;}): comp(comp_){}
  bool isnot_require(pair<T, T> l1, pair<T, T> l2, pair<T, T> l3){
    if(l1 < l3)swap(l1, l3);
    return (l3.second - l2.second) * (l2.first - l1.first) >= (l2.second - l1.second) * (l3.first - l2.first);
  }
  void add(pair<T, T> p){
    while(lines.size() >= 2 && isnot_require(*(lines.end()-2), *(lines.end()-1), p))lines.pop_back();
    lines.push_back(p);
  }
  T f(int i, T x){
    return lines[i].first * x + lines[i].second;
  }
  T val(T x){
    int ld = -1;
    int rd = lines.size() - 1;
    while(rd - ld > 1){
      int md = (rd + ld) / 2;
      if(comp(f(md, x), f(md + 1, x)))ld = md;
      else rd = md;
    }
    return f(rd, x);
  }
};

using ConvexHullTrickI = ConvexHullTrick_<int>;
using ConvexHullTrickL = ConvexHullTrick_<long long>;

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  ll c;
  cin >> c;
  vector<ll> h(n);
  rep(i, n)cin >> h[i];
  ConvexHullTrickL cht;
  cht.add(make_pair(-2*h[0], h[0]*h[0]+dp[0]));
  dp[0] = 0;
  FOR(i, 1, n){
    dp[i] = cht.val(h[i]) + h[i] * h[i] + c;
    cht.add(make_pair(-2*h[i], h[i]*h[i]+dp[i]));
  }
  cout << dp[n-1] << endl;
	return 0;
}


Measured memory_bytes: 9328
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n;
	int a[201010]={};
	map<int,int> mp;
	cin>>n;
	FOR(i,0,n){
		cin>>a[i];
		mp[a[i]]++;
	}
	sort(a,a+n);
	int cnt=0;
	FORD(i,n,0){
		FORD(j,31,0){
			int sum=1<<j;
			int rest=sum-a[i];
			if(rest<=0)continue;
			if(mp[a[i]]>0&&mp[rest]>0){
				if(rest==a[i]){
					if(mp[rest]>=2){
						mp[rest]-=2;
						cnt++;
						break;
					}
				}else{
					mp[a[i]]--;
					mp[rest]--;
					cnt++;
					break;
				}
			}
		}
	}
	cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 29824
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

string A[36], B[36];

void bubbleSort(string A[], int N) {
	bool flag = true;
	//i:??????????????¨?????????????????????????????????
	for (int i = 0; flag; i++) {
		flag = false;
		for (int j = N - 1; j >= i + 1; j--) {
			if (A[j][1] < A[j - 1][1]) {
				swap(A[j], A[j - 1]);
				flag = 1;
			}
		}
	}

	for (int i = 0; i < N; i++) {
		cout << A[i];
		if (i != N - 1)cout << " ";
	}
	cout << endl;
	cout << "Stable" << endl;
}

void selectionSort(string B[], int N) {
	for (int i = 0; i < N; i++) {
		int minj = i;
		for (int j = i + 1; j < N; j++) {
			if (B[j][1] < B[minj][1]) {
				minj = j;
			}
		}
		swap(B[i], B[minj]);
	}

	for (int i = 0; i < N; i++) {
		cout << B[i];
		if (i != N - 1)cout << " ";
	}
	cout << endl;

	for (int i = 0; i < N; i++) {
		if (A[i] != B[i]) {
			cout << "Not stable" << endl;
			return;
		}
	}
	cout << "Stable" << endl;
}


int main() {
	int N; cin >> N;
	for (int i = 0; i < N; i++)	{
		cin >> A[i];
		B[i] = A[i];
	}
	bubbleSort(A, N);
	selectionSort(B, N);

	return 0;
}

Measured memory_bytes: 1212
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

long dp[110][100010] = { 0 };
long N, W;
vector<pair<long, long>> vec;

long rec(long i, long j) {
  if (dp[i][j] != 0) return dp[i][j];
  if (i == N) return 0;
  long ret = 0;
  if (j < vec[i].first) ret = rec(i+1, j);
  else ret = max(rec(i+1, j), rec(i+1, j-vec[i].first) + vec[i].second);
  dp[i][j] = ret;
  return ret;
}

void solve() {
  cin >> N >> W;
  rep (i, N) {
    long w, v;
    cin >> w >> v;
    vec.push_back(make_pair(w, v));
  }
  cout << rec(0, W) << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 78080
s = input()
N = len(s)
flag = 0
i = int((N-1)/2)
if s[0:i] == s[i+1:N]:
    flag = 1;
b = ""
for j in range(i):
    b += s[i-j-1]
if b == s[0:i]:
    flag += 1

if flag == 2:
    print("Yes")
else:
    print("No")







Measured memory_bytes: 3060
S = input()
hantei = 0

serch = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','y','z')

for i in range(0,25):
    if S.count(serch[i]) == 0 :
        hantei = 1
        print(serch[i])
        break

if hantei == 0:
    print('None')

Measured memory_bytes: 3188
from math import *
from collections import *
import sys
sys.setrecursionlimit(10**9)
n,m,k = map(int,input().split())
a = []
ans = [[0 for i in range(m)] for j in range(n)]
ct = 0
for i in range(n):
	a.append(list(input()))
for i in range(n):
	flag = 0
	for j in range(m):
		if(a[i][j] == '#'):
			flag += 1 
	if(flag == 0):
		if(ct == 0):
			continue
		for j in range(m):
			ans[i][j] = ans[i-1][j]
	else:
		ct += 1
		for j in range(m):
			ans[i][j] = ct
			if(a[i][j] == '#'):
				ct += 1
				flag -= 1
			if(flag == 0):
				ct -= 1
				flag -= 1
for i in range(n):
	if(ans[i][0] != 0):
		ind = i
		break
for i in range(ind):
	for j in range(m):
		ans[i][j] = ans[ind][j]
for i in range(n):
	for j in range(m):
		print(ans[i][j],end = " ")
	print()


Measured memory_bytes: 54104
#include <iostream>
#include <string>

using namespace std;

int main()
{
  int N,K;
  string S;
  cin >> N >> S >> K;

  char c = S[K-1];
  for( int i=0;i<N;i++ )
    if( S[i]!=c )
      cout << '*';
    else
      cout << c;
  cout << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;cin>>n;
    map<int,int>m;
    vector<int> key;
    vector<int> value;
    for(int i=0;i<n;i++)
    {
        int t;cin>>t;
        m[t]+=1;
        key.push_back(t);
        
    }
    sort(key.begin(),key.end());
    
    key.erase(unique(key.begin(), key.end()), key.end());
    int keynum=key.size();
    int sum=0;
    for(int x:key)
    {
        int a=m[x]-x;
        if(a<0)
        {
            sum+=m[x];
        }else{
            sum+=a;
        }
    }
    cout<<sum;
    return 0;
    
}

Measured memory_bytes: 5112
#include <bits/stdc++.h>
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
*/
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
using ll=long long; using dd=double;
using pii=pair<int,int>; using pll=pair<ll,ll>;
typedef vector<int> vi;
const ll INFLL=(ll)2e18, MOD=1'000'000'007;
const int INF=0x3f3fffff;
/////////////////// DEBUG MODE ///////////////////////////////////
#define D(x) cerr<<"DEBUG: "<<#x<<" is: "<<x<<'\n';
#define DD(x,y) cerr<<"DEBUG:("<<#x<<","<<#y<<") are: "<<x<<" "<<y<<'\n';
/////////////////// GLOBAL VARIABLES ////////////////////////////
vector<vector<int>> adj; vector<bool> vis;
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
/////////////////// FUNCTIONS ////////////////////////////////////
inline ll mexp(ll x,ll n,ll m){ll res=1;while(n){if(n&1)res=(res*x)%m;n>>=1;x=((x%m)*(x%m))%m;}return res;}
bool ispow2(ll x){ return x && (!(x&(x-1)));}
ll gcd(ll x, ll y){ pll p{x,y}; while(p.ss) p={p.ss,p.ff%p.ss}; return p.ff;}

/////////////////// MAIN STARTS //////////////////////////////////
int main(){
  ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
  cout<<fixed;cerr<<fixed; cout<<setprecision(8); cerr<<setprecision(3);
  srand(time(NULL)); rand();

#ifdef DEBUG
  clock_t tStart = clock(); //freopen("op.txt","w",stdout);
#endif

  int ans=0; char c;
  while(cin>>c){
    c=='+'?++ans:--ans;
  }
  cout<<ans<<'\n';


#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
#endif
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;


int n;
ll s;
int main()
{
    cin>>n;
    for (int i=1; i<=n; ++i)
    {
        if (i%3!=0 && i%5!=0)
            s+=i;
    }
    cout<<s<<endl;
    return 0;
}



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

typedef long long ll;

int main(){
    //代入部
    ll N,K,Q;
    cin>>N>>K>>Q;
    vector<ll> A(Q);
    for(ll i=0;i<Q;i++){
        cin>>A.at(i);
    }

    //mpの初期値代入
    map<ll,ll> mp;
    for(ll i=0;i<N;i++){
        mp[i+1]=0;
    }

    //正解した数を数える。
    for(ll i=0;i<Q;i++){
        mp[A.at(i)]++;
    }

    //勝利条件
    //持ち点(K)-問題数(Q)+正解数(mp[その人の番号])>0
    for(ll i=0;i<N;i++){
        if(K-Q+mp[i+1]>0){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
}

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

typedef long long ll;
#define rep1(i, n) for(int i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(int i = 0; i <=(ll)(n); i++)

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c >= 22){
        cout << "bust" << endl;
    }else{
        cout << "win" << endl;
    }

    return 0;
}

Measured memory_bytes: 3100
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    string A, B;
    cin >> A >> B;
    bool good = true;
    if (A[0] != B[2] || A[1] != B[1] || A[2] != B[0])
        good = false;
    cout << (good ? "YES" : "NO") << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


Measured memory_bytes: 256
import sys
def p(*a):
  s=" ".join(map(str,a))
  #print(s)
  sys.stderr.write(s+"\n")

import fractions
from functools import reduce

def gcd(*numbers):
	return reduce(fractions.gcd, numbers)
	#return reduce(math.gcd, numbers)

def gcd_list(numbers):
	return reduce(fractions.gcd, numbers)
	#return reduce(math.gcd, numbers)



N=int(input())
A=[int(i) for i in input().split()]	# 1 2 3 4 5 ...

p("N", N)
p("A", A)


if N==2:
	print( max(A) )
	exit()


L=[0]*(N)		#左側用
R=[0]*(N)		#右側用



L[0]=A[0]		#初項は、Aの左端
p("L", L)
for i in range(1,N):
	L[i]=gcd(L[i-1],A[i])
	p(i, L[i])
p("L", L)



R[N-1]=A[N-1]		#初項は、Aの右端
p("R", R)
for i in range(N-2,-1,-1):
	R[i]=gcd(R[i+1],A[i])
	p(i, R[i+1])
p("R", R)



M=[0]*N
for i in range(1,N-1):
	M[i]=gcd(L[i-1],R[i+1])		#A[i]を起点に、左側(L[i-1])、右側(R[i+1])
p("M", M)

M[0]=R[1]				#左端は、右側のみ
M[N-1]=L[N-2]		#右端は、左側のみ

p("M", M)

print( max(M) )

Measured memory_bytes: 16152
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a,b,c,d,e,f;
  cin>>a>>b>>c>>d;
  e=c;
  f=d;
  int64_t p,q,r,s,t,u,x,tmp,R,w;
  
  x = c * d;
  
  if(c<d){
    tmp = c;
    c = d;
    d = tmp;
  }
 
  R = c % d;
  while(R!=0){
    c = d;
    d = R;
    R = c % d;
  }
 
  w=x/d;
  
  c=e;
  d=f;
  
  p=(a+(c-1))/c;
  q=b/c;
  r=(a+(d-1))/d;
  s=b/d;
  t=(a+(w-1))/w;
  u=b/w;
  
  int64_t y;
  y=b-a-q+p-s+r+u-t;
  cout<<y<<endl;
}



Measured memory_bytes: 256
N, T = map(int, input().split())

minimize = 10000
index = 0
for i in range(N):
    c_i, t_i = map(int, input().split())
    if t_i <= T and c_i < minimize:
        minimize = c_i

if minimize == 10000:
    print('TLE')
else:
    print(minimize)

Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
mod = 10 ** 9 + 7
ans = 1
for _ in range(2*n-2):
  ans *= 2
  ans %= mod
cef = [i+2 for i in range(n)]
for i in range(n):
  a[i] *= cef[i]
ans *= sum(a)
ans %= mod
print(ans)

Measured memory_bytes: 26800
#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <cmath>
#include <bits/stdc++.h>
#include <limits>

#define MOD 1000000007
//#define MOD 7

using namespace std;

int main(void){
    // Your code here!
    long long a, b, c, x, count = 0;
    
    cin >> a >> b >> c >> x;
    
    for(int i = 0; i <= a; i++){
        for(int j = 0; j <= b; j++){
            long long leave = x - 500 * i - 100 * j;
            if(leave >= 0 && leave % 50 == 0 && leave / 50 <= c){
                count++;
            }
        }
    }
    
    cout << count << endl;
    
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    cout << fixed << setprecision(12);
    double sum = 0.0;
    for (int i = 0; i < N; i++)
    {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY")
        {
            sum += x;
        }
        else
        {
            sum += x * 380000.0;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;

int main(){
    DRII(N,M);
    REP(i,N)REP(j,M){
        char s[24];
        RS(s);
        if(strcmp(s,"snuke")==0){
            printf("%c%d\n",'A'+j,i+1);
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#-*- coding: utf-8 -*-

import numpy as np

#input
N, M = map(int, raw_input().split())
list = [map(int, raw_input().split()) for i in range(0, N)]

arr = np.array(list)

arrsort = arr[arr[:,0].argsort()]

hon = 0
yen2 = 0
yen3 = 0

for x in range(0,N):
            yen3 += yen2
            for i in range(0,arrsort[x,1]):
                yen2 = arrsort[x,0] * (i+1)
                hon += 1
                if hon == M:
                    break
                else:
                    continue
                break
            else:
                continue
            break

print(yen3 + yen2)


Measured memory_bytes: 35332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

  string s,t;
  cin >> s >> t;
  int ans = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] != t[i]) ans ++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3884
n = int(input())
h = [[int(i) for i in input().split()] for _ in range(n)]

dp = [[0]*(n+1) for _ in range(3)]

for i in range(n):
    for p in range(3):
        if p == 0:
            q, r = p+1, p+2
        elif p == 1:
            q, r = p+1, p-1
        else:
            q, r = p-2, p-1
        dp[p][i+1] = max(dp[q][i] + h[i][p], dp[r][i] + h[i][p])

print(max(dp[0][-1], dp[1][-1], dp[2][-1]))


Measured memory_bytes: 65112
#include<bits/stdc++.h>
using namespace std;
int main(){
	int h,w;
	char a[105][105];
	scanf("%d%d",&h,&w);
	for(int i=1;i<=h;i++){
		scanf("%s",a[i-1]);
	}
	for(int i=1;i<=h;i++){
		printf("%s\n%s\n",a[i-1],a[i-1]);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using Graph = vector<vector<int>>;
using P = pair<int,int>;
using ll =long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

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

int main(){
    int h,w;
    cin >> h >> w;

    vector<string> maze(h);
    rep(i,h) cin >> maze[i];
    int cnt=0;
    rep(i,h) rep(j,w){
        if(maze[i][j]=='#') cnt++;
    }


    queue<P> q;
    vector<vector<int>> d(h,vector<int>(w,INF));

    q.push(make_pair(0,0));
    d[0][0] = 0;

    while(!q.empty()){
        P p = q.front();
        q.pop();



        rep(i,4){
            int nx=p.first + dx[i];
            int ny=p.second + dy[i];

            if(nx>=0 && nx<h && ny>=0 && ny<w && maze[p.first][p.second]!='#' && d[nx][ny]==INF){
                d[nx][ny] = d[p.first][p.second] + 1;
                q.push(make_pair(nx,ny));
            }
        }
    }

    int ans = h*w -(d[h-1][w-1]+1 +cnt);
    if(d[h-1][w-1]==INF){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
    
}

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


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

	int a = 0;
	bool find = false;
	for (int i = 0; i < 2 * K; ++i) {
		a = (a * 10 + 7) % K;
		if (!a) {
			cout << i + 1 << endl;
			find = true;
			break;
		}
	}
	if (!find) cout << -1 << endl;

	return 0;
}


Measured memory_bytes: 3192
#include "iostream"
using namespace std;

int main()
{
	int a,b;
	char op;

	while (1){

		cin >> a >> op >> b;
		
		if(op == '+'){
			cout << a + b<< endl;
		}
		if (op == '-'){
			cout << a - b << endl;
		}
		if (op == '*'){
			cout << a * b << endl;
		}
		if (op == '/'){
			cout << a / b << endl;
		}

		if(op == '?'){
			break;
		}
	}





	return 0;
}



Measured memory_bytes: 3108
#include <stdio.h>
#include<iostream>
#include <algorithm>
#include <cstring>
#include<set>
#include<queue>
#define Long long long int
#define For(i,a,b) for(int i=a;i<=b;i++)
#define ForR(i,a,b) for(int i=a;i>=b;i--)
#define maxN 300009
#define mp make_pair
using namespace std;

Long Min(Long a, Long b, Long c){
	return max(max(a,b),c);
}
main(){
	Long ans = 1e15;
	Long h,w,h1,h2,h3,w1,w2,w3,h23,w23;
	cin >>  h >> w;
	For(h1,h/3,h/3 + 1){
		if(h1>0 && h1<h){
			h2 =(h-h1)/2;
			h3 = (h-h1) - h2;
//			cout << h1 <<" ," << h2  << ","<< h3 << endl;
			if(h2>0 && h3 > 0){
				ans = min(ans,Min(abs(h1-h2),abs(h2-h3),abs(h3-h1))*w);				
			}			
			h23 = h - h1;
			w2 = w/2;
			w3 = w - w2;			
			ans = min(ans,Min(abs(h1*w-h23*w2),abs(w2*h23-w3*h23),abs(h23*w3-h1*w)));			
		}
	}
	Long temp = h;
	h = w;
	w = temp;
		For(h1,h/3,h/3 + 1){
		if(h1>0 && h1<h){
			h2 =(h-h1)/2;
			h3 = (h-h1) - h2;
			if(h2>0 && h3 > 0){
				ans = min(ans,Min(abs(h1-h2),abs(h2-h3),abs(h3-h1))*w);
			}			
			h23 = h - h1;
			w2 = w/2;
			w3 = w - w2;			
				ans = min(ans,Min(abs(h1*w-h23*w2),abs(w2*h23-w3*h23),abs(h23*w3-h1*w)));			
		}
	}
	cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i <= (ll)(n); ++i)
#define MAX 500010
#define MOD 1000000007
typedef long long  ll;

using namespace std;


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

	string S;
	ll N,P; cin >> N;
	map<string,vector<ll>> m;
	map<ll,ll> tensuu;
	rep(i,N){
		cin >> S >> P;
		m[S].push_back(P);
		tensuu[P] = i+1;
	}
		
	for(auto& p:m){
		sort(p.second.begin(),p.second.end(),greater<ll>());
	}

	for(auto p:m){
		rep(i,p.second.size()){
			cout << tensuu[p.second[i]] << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int
#define Vec vector

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	int N,M;
	cin >> N >> M;
	Vec<int> A(N),B(N);
	for(int i=0;i<N;i++) cin >> A[i] >> B[i];
	
	Vec<pair<int,int>> P(N);
	for(int i=0;i<N;i++){
		P[i] = make_pair(A[i], B[i]);
	}
	
	sort(P.begin(), P.end());
	
	ll tot = 0;
	int rest = M;
	for(int i=0;i<N;i++){
		int buy = min(rest, P[i].second);
		rest -= buy;
		tot += (ll) buy * P[i].first;
	}
	
	cout << tot << endl;
	
	
	return 0;
}

Measured memory_bytes: 1792