akhauriyash/Code-Regression huggingface dataset:
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
//#define all(v) ((v).begin(),(v).end())
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    int k;
    cin>>k;
    int even=0,odd=0;

    rep(i,1,k+1){
        if(i%2==0)even++;
        else odd++;
    }
    cout<<even*odd<<endl;


    
}


Measured memory_bytes: 256
nn = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

ans = len(make_divisors(nn-1)) - 1
lis = make_divisors(nn)
del lis[0]

for i in lis:
  t = nn
  while t%i==0 and t != 0:
    t = t//i
  if t%i == 1:
    ans += 1

print(ans)

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

using namespace std;

typedef long long ll;
#define MP make_pair
int dist[10005];
int dista[10005], distb[10005];
vector<pair<int, int> > edges[10005];
int n;
int max_val, max_ind;

void dfs(int root, int prev, int *rec) {
    for (auto ele : edges[root]) {
        if (ele.first == prev) continue;
        rec[ele.first] = rec[root] + ele.second;
        if (rec[ele.first] >= max_val) {
            max_val = rec[ele.first];
            max_ind = ele.first;
        }
        dfs(ele.first, root, rec);
    }
}

int main() {
    scanf("%d", &n);
    for (int t = 0; t < n - 1; t++) {
        int si, ti, wi;
        scanf("%d%d%d", &si, &ti, &wi);
        edges[si].push_back(MP(ti, wi));
        edges[ti].push_back(MP(si, wi));
    }
    memset(dist, 0, sizeof dist);
    memset(dista, 0, sizeof dista);
    memset(distb, 0, sizeof distb);
    max_val = 0;
    max_ind = 0;
    dfs(0, -1, dist);
    dfs(max_ind, -1, dista);
    dfs(max_ind, -1, distb);
    for (int i = 0; i < n; i++) {
        printf("%d\n", max(dista[i], distb[i]));
    }
}

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

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int score = 0;
  rep(i, n - 1) {
    if (s[i] == s[i + 1]) score++;
  }
  int ans = min(score + 2 * k, n - 1);
  cout << ans << endl;
  return 0;
}

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

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

using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;

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

	int n; cin >> n;

	vector<int>ruizyo(6);
	ruizyo[0] = 10;
	for (int i = 1; i < 6; i++) {
		ruizyo[i] = ruizyo[i - 1] * 10;
	}
	
	bool okay = true;
	for (int i = 0; i < 6; i++) {
		if (n == ruizyo[i]) {
			okay = false;
		}
	}
	
	int sum = 0;
	for (int i = 0; i < 6; i++) {
		sum = sum + n % 10;
		n = n / 10;
	}

	if (okay) {
		cout << sum << endl;
	}
	else {
		cout << 10 << endl;
	}
}	




Measured memory_bytes: 256
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

n,m = map(int,input().split())
a = gcd(n,m)
b = (n*m)//a


s = input()
t = input()
ans = b

for i in range(a):
    if s[i*b//m] != t[i*b//n]:
        ans = -1
print(ans)

Measured memory_bytes: 3316
#include <stdio.h>
int main(void)
{
  int a;
  int b;
  int q;
  int p;
  int i;
  while (scanf("%d%d", &a, &b) != EOF){
  	p = 0;
  	q = 1;
  	i = 1;
  	while (q != 0){
    	     i *= 10;
        	 q = (a + b)/ i;
         	p++;
   	}
   	printf("%d\n", p);
  }
  return (0);
}

Measured memory_bytes: 0
from collections import Counter
n = int(input())

S = [input() for i in range(n)]
S = Counter(S)

li = ['AC', 'WA', 'TLE', 'RE']

for i in li:
    if S.get(i):
        print(i+' x '+str(S[i]))
    else:
        print(i+' x '+str(0))

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

int main(){
  long long N,A,B,C,D;
  cin >> N >> A >> B;
  C=N/(A+B),D=N%(A+B);
  if(D==0){
    cout << A*C << endl;
  }
  else if(D<=A){
    cout << A*C+D << endl;
  }
  else{
    cout << A*(C+1) << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(X: int, N: int, p: "List[int]"):
    if N == 0:
        print(X)
        return
    
    arr = [0 for _ in range(102)]

    for i in p:
        arr[i] = 1
    
    i = 0
    while True:
        if not arr[X - i]:
            print(X - i)
            return
        elif not arr[X + i]:
            print(X + i)
            return
        i += 1
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(X, N, p)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9216
#include "bits/stdc++.h"
using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define debug(x) cout << #x << ": " << x << endl
using ll = long long;

//#define int ll

//**********

signed main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int ans = 0;

    REP(i,a+1){
        REP(j,b+1){
            REP(k,c+1){
                if(500*i+100*j+50*k==x) ans++;
            }
        }
    }
    
    printf("%d\n",ans);
    
    return 0;
    
}






Measured memory_bytes: 256
n=int(input())
AB=[]
A=[]
B=[]
for _ in range(n):
    a,b = map(int,input().split())
    AB.append((a,b))
    A.append(a)
    B.append(b)
A.sort()
B.sort()
#AB = sorted(AB,key=lambda x: x[1])
med = n//2
if n%2 != 0:
    print(B[n//2]-A[n//2]+1)
else:
    p = (A[n//2] + A[n//2-1])/2
    q = (B[n//2] + B[n//2-1])/2
    print(int((q-p)*2+1))

Measured memory_bytes: 119600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		int d=scan.nextInt();
		if(a+b>c+d) System.out.println("Left");
		else if(a+b<c+d) System.out.println("Right");
		else System.out.println("Balanced");
	}

}


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

#define en "\n"
#define INF (int) 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fs first
#define sc second
#define size(a) (int) a.size()
#define deb(x) cerr << #x << " => " << x << en
#define deba(x) cerr << #x << en; for (auto a : x) cerr << a << " "; cerr << en;
#define debp(x) cerr << #x << en; for (auto a : x)cerr<<"("<<a.fs<<", "<<a.sc<<") "; cerr << en;
#define debm(x) cerr << #x << en; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << en;}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)
int fastpow(int a, int b, int m = HELL) { int res = 1; a %= m;
while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res;}
#define inv(a) fastpow(a, HELL - 2)

int32_t main() { fastio;
	int n, m, x;
	cin >> n >> m;
	int sum = 0;
	for (int i = 0; i < m; i++) {
		cin >> x;
		sum += x;
	}
	int res = max(-1LL, n - sum);
	cout << res << endl;
	return 0;
}


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

#define f(i, q) for(int i = 0; i < q; i++)  

typedef long long ll;

ll X, Y, Z, K, A[1009], B[1009], C[1009];
vector<ll> vec;

int main() {
    cin >> X >> Y >> Z >> K;
    for(int i = 0; i < X; i++) {
        cin >> A[i]; sort(A, A + X, greater<ll>());
    }
    for(int i = 0; i < X; i++) {
        cin >> B[i]; sort(B, B + Y, greater<ll>());
    }
    for(int i = 0; i < Z; i++) {
        cin >> C[i]; sort(C, C + Z, greater<ll>());
    }

    for(int i = 0; i < X; i++) {
        for(int j = 0; j < Y; j++) {
            for(int k = 0; k < Z; k++) {
                if((i + 1) * (j + 1) * (k + 1) <= K) vec.push_back(A[i] + B[j] + C[k]);
                else break;
            }
        }
    }

    sort(vec.begin(), vec.end(), greater<ll>());
    for(int i = 0; i < K; i++) cout << vec[i] << endl;

    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	ll h, a;
	cin >> h >> a;
	h = h / a + (h % a != 0);
	cout << h << endl;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
ac = [0]*n
wa = [0]*n
for i in range(m):
    p,s = input().split()
    p = int(p)
    if ac[p-1]:
        continue
    if s == 'AC':
        ac[p-1] = 1
    else:
        wa[p-1] += 1
count_ac = 0
count_wa = 0
for i in range(n):
    count_ac += ac[i]
    if ac[i]:
        count_wa += wa[i]
print(str(count_ac) + " " + str(count_wa))

Measured memory_bytes: 4596
import java.io.IOException;
import java.util.*;

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

		while (true) {
			int m = in.nextInt();
			int d = in.nextInt();
			if(m == 0) break;
			String[] weeks = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
			System.out.println(weeks[zeller(2004, m, d)]);
		}
	}

	public static int zeller(int y, int m, int d) {
		if(m<3){m+=12;--y;}

		return ( y + y/4 - y/100 + y/400 + ( 13*m + 8 )/5 + d )%7;
	}
}

Measured memory_bytes: 26300
n, m = map(int, input().split())


def facmod(a, mod):
    res = 1
    for i in range(1, a+1):
        res = (res*i) % mod
    return res


mod = 10**9+7
mn = min(m, n)
mx = max(m, n)
if abs(mn-mx) > 1:
    ans = 0
else:
    if n == m:
        ans = (2*facmod(m, mod)*facmod(n, mod)) % mod
    else:
        ans = (facmod(mx, mod)*facmod(mn, mod)) % mod
print(ans)


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

int main() {
	int N, W;
	cin >> N >> W;
	vector<int> w(N), v(N);
	rep(i, N) cin >> w[i] >> v[i];

	vector<vector<ll>> dp(N+1, vector<ll>(W+1, 0));
	for(int i = 1; i <= N; i++) {
		for(int j = 1; j <= W; j++) {
			dp[i][j] = dp[i-1][j];
			if(j - w[i-1] >= 0)
				dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]] + v[i-1]);
		}
	}

	cout << dp[N][W] << endl;
	return 0;
}

Measured memory_bytes: 83212
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=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 FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
int n, m;

//使用する関数
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;
}

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

	cin >> n >> m;
	int nmin = min(n, m);
	int nmax = max(n, m);
	REP(i, nmax) {
		cout << nmin;
	}
	cout << endl;
}

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

int GCD(int a,int b){
    int tmp;
    
    if(!(a >= b)){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    
    
    for(;;){
        if(!b) break;
        a %= b;
        tmp = a;
        a = b;
        b = tmp;
    }
    
    return a;
}

int main(){
    int a,b;
    
    cin >> a >> b;
    cout << GCD(a,b) << endl;
    
    return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include<map>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<stack>
#include<cstdlib>
#include<cctype>
#include<cmath>
#define ll long long
#define inf 99999999
using namespace std;
int n;
int num[201];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>num[i];
    }
    int res=0;
    int flag=1;
    while (flag){

        for(int i=1;i<=n;i++){
            if(num[i]%2==0){
                num[i] = num[i]/2;
            }else{
                flag=0;
                break;
            }
        }
        if(!flag){
            break;
        }
        ++res;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        int n = sc.nextInt();
        int m = sc.nextInt();

        int l = 1;
        int r = n;

        boolean end = false;
        for (int i=0; i < m; i++) {
            if (!end) {
                int ln = sc.nextInt();
                int rn = sc.nextInt();

                if (overlap(l, r, ln, rn)) {
                    l = l >= ln ? l : ln;
                    r = rn >= r ? r : rn;
                } else {
                    l = 0;
                    r = -1;
                    end = true;
                }
            }
        }

        System.out.println(r - l + 1);

    }

    public static boolean overlap(int l1, int r1, int l2, int r2) {
        return r1 >= l2 && l1 <= r2;
    }
}


Measured memory_bytes: 65240
x = [0]*6
x[0],x[1] = [int(_) for _ in input().split()]
x[2],x[3] = [int(_) for _ in input().split()]
x[4],x[5] = [int(_) for _ in input().split()]

if 1 <= x.count(1) <=2 and 1 <= x.count(2) <=2 and 1 <= x.count(3) <=2 and 1 <= x.count(4) <=2:
    print("YES")
else:
    print("NO")

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

int main() {
    int n;
    cin >> n;
    int ans = 1e9;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        int c = 0;
        while (a % 2 == 0) a /= 2, c++;
        ans = min(ans, c);
    }

    cout << ans << endl;
}


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

int N, Z, W;
vector<int> C;

int cost(int l, int r) {return abs(l-r);}

int memo[2][2001];
int dfs(int turn, int n) {
  if(memo[turn][n]) return memo[turn][n];
  auto res = cost(C[0],C[n]);
  for(auto i=1; i<n; ++i) {
    if(turn) res = min(res, dfs(!turn, i));
    else     res = max(res, dfs(!turn, i));
  }
  return memo[turn][n] = res;
}

int main() {
  cin >> N >> Z >> W;
  C.resize(N);
  for(auto& i: C) cin >> i;
  reverse(begin(C), end(C));
  C.emplace_back(W);
//   cout << dfs(0, N) << endl;
  auto r=dfs(0,N);
  auto R=max(cost(W,C[0]),cost(C[1],C[0]));
  if(r!=R)assert(r<R);
  cout<<r<<endl;
}


Measured memory_bytes: 256
# C - 白昼夢

S = str(input())
S = S[::-1]
l = len(S)
i = 0
ans = 'YES'
while True:
    if S[i:i+5] == 'maerd' or S[i:i+5] == 'esare':
        i += 5
        if i == l:
            break
    elif S[i:i+6] == 'resare':
        i += 6
        if i == l:
            break
    elif S[i:i+7] == 'remaerd':
        i += 7
        if i == l:
            break
    else:
        ans = 'NO'
        break
print(ans)

Measured memory_bytes: 3188
n = int(input())
l = []
for i in range(n):
    sp = list(map(str,input().split()))
    l.append([i+1,sp[0],int(sp[1])])

l.sort(key=lambda x:x[2],reverse=True)
l.sort(key=lambda x:x[1])

ans = [x[0] for x in l]
for i in range(len(ans)):
    print(ans[i])

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

int compare(const void *a, const void *b)
{
    if (*(int*)a > *(int*)b)
        return 1;
    else if (*(int*)a < *(int*)b)
        return -1;
    else
        return 0;
}

int main(void)
{
	int time[3];
	int i;
	for (i = 0; i < 3; i++)
		scanf("%d", &time[i]);

	qsort((void*)time, 3, sizeof(time[0]), compare);
	
	printf("%d\n", time[0] + time[1]);
	return 0;
}


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

using namespace std;

int main() {

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

	vector<int> v(3), l(3);
	int c = 0;

	for (auto &x : v)
		cin >> x;

	for (auto &x : v) {
		if (x & 1) {
			cout << 0 << endl;
			return 0;
		}
	}

	if (v[0] == v[1] && v[1] == v[2]) {
		cout << -1 << endl;
		return 0;
	}

	while (true) {
		c++;
		swap(v, l);
		for (auto &x : l)
			x >>= 1;
		v[0] = l[1] + l[2];
		v[1] = l[0] + l[2];
		v[2] = l[0] + l[1];
		for (auto &x : v) {
			if (x & 1) {
				cout << c << endl;
				return 0;
			}
		}
	}

	return 0;

}

Measured memory_bytes: 256
//#include"bits/stdc++.h"
#include<iostream>
#include<string.h>
#include<algorithm>
#include<cstdio>
using namespace std;
long long n,c,i,j,maxx;
long long x[100200],v[100200],val1[100200],val2[100200],go[100200],back[100200];
int main()
{
while(cin>>n>>c)
{
		maxx=0;
	for(i=1;i<=n;i++)
		scanf("%lld%lld",&x[i],&v[i]);
	for(i=1;i<=n;i++)
	{
		val1[i]=val1[i-1]+v[i];
		go[i]=max(go[i-1],val1[i]-x[i]);
		maxx=max(maxx,go[i]);
	}
		
	for(i=n;i>=1;i--)
	{
		val2[i]=val2[i+1]+v[i];
		back[i]=max(back[i+1],val2[i]-(c-x[i]));
		maxx=max(maxx,back[i]);
	}
	for(i=1;i<=n;i++)
		maxx=max(maxx,val1[i]-2*x[i]+back[i+1]);
	for(i=n;i>=1;i--)
		maxx=max(maxx,val2[i]-2*(c-x[i])+go[i-1]);
	cout<<maxx<<endl;
}
}

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

int main() {
    int a, b, c, x, ans = 0;
    cin >> a >> b >> c >> x;
    for(int i = 0; i <= a; ++i) {
        for(int j = 0; j <= b; ++j) {
            for(int k = 0; k <= c; ++k) {
                int total = 500 * i + 100 * j + 50 * k;
                if(total == x) ++ans;
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  ll T[N], A[N];
  for (int i=0; i<N; i++)
    cin >> T[i] >> A[i];
  for (int i=1; i<N; i++) {
    ll t = (T[i]+T[i-1]-1)/T[i], a = (A[i]+A[i-1]-1)/A[i], t1, t2, a1, a2;
    t1 = t*T[i];
    a1 = t*A[i];
    t2 = a*T[i];
    a2 = a*A[i];
    if (t < a) {
      if (a1 >= A[i-1]) {
        T[i] = t1;
        A[i] = a1;
      } else {
        T[i] = t2;
        A[i] = a2;
      }
    } else {
      if (t2 >= T[i-1]) {
        T[i] = t2;
        A[i] = a2;
      } else {
        T[i] = t1;
        A[i] = a1;
      }
    }
  }
  cout << T[N-1]+A[N-1] << endl;
  return 0;
}

Measured memory_bytes: 384
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()

H = ini()


def solve(h):
    if h == 1:
        return 1
    return 1 + 2 * solve(h >> 1)


print(solve(H))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
using namespace std;
 
 
int main(){
    int n,m; cin >> n >> m;
    vector<vector<int> > bul(m);
    rep(i,m){
        int k; cin >> k;
        rep(j,k){
            int s; cin >> s;
            bul[i].push_back(s);
        }
    }
    vector<int> p(m);
    rep(i,m) cin >> p[i];

    vector<int> now(n+1);

    int ans=0;
    int sw=(int)pow(2,n);
    rep(i,sw){
        int seg=i;
        rep(j,n){
            if(seg%2==1) now[j+1]=1;
            else now[j+1]=0;
            seg/=2;
        }
        rep(j,m){
            int ppp=0;
            rep(g,bul[j].size()) ppp+=now[bul[j][g]];
            //cout << i << ' ' << j << ' ' << ppp << endl;
            if(ppp%2!=p[j]) break;
            if(j==m-1) ans++;
        }
    }

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

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

using namespace std;

int main (){
    
    string str;
    cin >>str ;
    
    bool w,e,n,s;
    w = e = n = s = 0;
    
    for (char ch : str) {
        switch (ch) {
            case 'W':
                w = 1;
                break;
            case 'S':
                s = 1;
                break;
            case 'E':
                e = 1;
                break;
            case 'N':
                n = 1;
                break;
                
            default:
                break;
        }
        
    }
    
    if(w == e && n == s){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long 
#define ull unsinged long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
const int inf=1039074182;
using namespace std;
int n;
int a[100005];
bool b[100005];
int m;
int l[100005];
int r[100005];
vector <int> lsh;
vector <pii> g[100005];
int visit[100005];
vector <int> res;

void dfs(int x)
{
	visit[x]=1;
	for(auto u:g[x])
	{
		if(visit[u.first]) continue;
		dfs(u.first);
		if(b[u.first])
		{
			res.push_back(u.second);
			b[u.first]^=1;
			b[x]^=1;
		}
	}
}

int main() {
    ios_base::sync_with_stdio(false);
	cin>>n>>m;
	vector <pair<int,int> > psort;
//	psort.reserve(n);
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
		psort.push_back(mp(a[i],b[i]));
		lsh.push_back(a[i]);
	}
	sort(all(psort));
	for(int i=0;i<n;i++)
	{
		a[i]=psort[i].first;
		b[i]=psort[i].second;
	}
	for(int i=n;i>=0;i--)
	{
		b[i]^=(i?b[i-1]:0);
	}
	sort(all(lsh));
    for (int i = 0; i < m; ++i) {
    	int l,r;
		cin>>l>>r;
		l=lower_bound(all(lsh),l)-lsh.begin();
		r=upper_bound(all(lsh),r)-lsh.begin();
		g[l].push_back(make_pair(r,i));
		g[r].push_back(make_pair(l,i));
    }
	for(int i=0;i<=n;i++)
	{
		if(visit[i]) continue;
		dfs(i);
		if(b[i])
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	sort(all(res));
	cout<<res.size()<<endl;
	for(auto x:res)
	{
		cout<<x+1<<' ';
	}
	cout<<endl;
    return 0;
}


Measured memory_bytes: 15092
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] X = new int[N];
		int X_sum = 0;
		for(int i=0; i<N; i++) {
			X[i] = sc.nextInt();
			X_sum += X[i];
		}

		int P = (int)Math.round((double)X_sum / (double)N);
		int ans = 0;
		for(int i=0; i<N; i++) {
			ans += (X[i] - P) * (X[i] - P);
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 21588
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;

ll N, M;
vector<unordered_map<ll, vector<ll> > > G;
vector<ll> dist;
vector<unordered_set<ll> > used;
queue<ll> que;

void dfs(int i, int c, int d) {
    used[i].insert(c);

    if (dist[i] == -1) {
        dist[i] = d;
        que.push(i);
    }

    for (ll j : G[i][c]) {
        if (used[j].count(c)) {
            continue;
        }
        if (dist[j] != -1 && dist[j] < d) {
            continue;
        }

        dfs(j, c, d);
    }
}

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

    cin >> N >> M;
    G = vector<unordered_map<ll, vector<ll> > >(N);
    
    for (ll i = 0; i < M; i++) {
        ll p, q, c;
        cin >> p >> q >> c;
        p--; q--;
        G[p][c].push_back(q);
        G[q][c].push_back(p);
    }

    dist = vector<ll>(N, -1);
    dist[0] = 0;
    que.push(0);
    used = vector<unordered_set<ll> >(N);

    while (!que.empty()) {
        ll i = que.front(); que.pop();
        for (auto g : G[i]) {
            ll c = g.first;
            if (!used[i].count(c)) {
                dfs(i, c, dist[i] + 1);
            }
        }
    }

    cout << dist[N - 1] << endl;
    return 0;
}



Measured memory_bytes: 68224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
//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; }
template<class T> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const string MINUSINF = "-";
ll match[10] = {2,5,5,4,5,6,3,7,6};
vector<string> dp(11000);

void chmax(string &a, string b)
{
    if (a == MINUSINF) a = b;
    else if (a.size() < b.size()) a = b;
    else if (a.size() == b.size())
    {
        if (a < b) a = b;
    }
}

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

    rep(i, 11000) dp[i] = MINUSINF;
    dp[0] = "";

    rep(i, n + 1)
    {
        if (dp[i] == MINUSINF) continue;
        for (auto c : a) chmax(dp[i + match[c - 1]], dp[i] + (char)(c + '0'));
    }

    cout << dp[n] << endl;
}

Measured memory_bytes: 43648
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定
#include <list> //前後に数値を入れれる配列
#include <map> //map



#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = 3.141592653589793; //円周率

//常設関数↓

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

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

//degree → radian
ll chg_DegRad(int deg) {
	return deg * PI / 180.0;
}

//radian → degree
ll chg_RadDeg(int rad) {
	return rad * 180.0 / PI;
}

//提出コード↓

ll n, m, c;
ll L[100010], R[100010], tmp[100010];
ll MaL, MiR = 1000000;





int main() {
	cin >> n >> m;
	rep(i, m) cin >> L[i] >> R[i];
	
	rep(i, m) {
		MaL = max(MaL, L[i]);
		MiR = min(MiR, R[i]);
	}
	if ((MiR - MaL + 1) > 0) {
		cout << MiR - MaL + 1 << endl;
	}
	else cout << 0 << endl;




	return 0;
}



Measured memory_bytes: 1792
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    String[] input = sc.next().split("");
    int cnt=0;
    int a = Integer.parseInt(input[0]);
    int b= Integer.parseInt(input[1]);
    int c= Integer.parseInt(input[2]);
    if(a==1){
      cnt++;
    }
    if(b==1){
      cnt++;
    }
    if(c==1){
    cnt++;
    }
    System.out.println(cnt);
  }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
   int N;
  cin >> N;
  vector<int> math(N);
  
  for (int i = 0; i < N; i++) {
    cin >> math.at(i);
}
  // 合計値を求める
  int sum = std::accumulate(math.begin(), math.end(), 0);
  int max = *std::max_element(math.begin(), math.end());
  
if (max < sum-max) {
  cout << "Yes" << std::endl;
}
 
else{
  cout << "No" << std::endl;
}
 
}

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

int main()
{
	int n;
	cin>>n;
	int a[n];
	
	int sum=0;
	for(int i=0;i<n;i++){
	   cin>>a[i];
	   sum+=a[i];
    }
    
	int sum1=sum/n;
    int ans1=0;
    for(int i=0;i<n;i++){
        ans1+=fabs(a[i]-sum1)*fabs(a[i]-sum1);
	}
	
	int sum2=sum/n+1;
	int ans2=0;
	for(int i=0;i<n;i++){
	   ans2+=fabs(a[i]-sum2)*fabs(a[i]-sum2);	
	}
	
	if(ans1<ans2)
	   cout<<ans1;
	else
	   cout<<ans2;
}



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

int main() {
	int n;
	cin >> n;
	vector<ll> a(n + 1), b(n);
	rep(i, 0, n + 1) cin >> a[i]; rep(i, 0, n) cin >> b[i];

	ll sum = 0;
	rep(i, 0, n) {
		if (a[i] >= b[i]) sum += b[i];
		else {
			b[i] -= a[i];
			sum += a[i] + min(a[i + 1], b[i]);
			a[i + 1] -= min(a[i + 1], b[i]);
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	char c;
	cin >> c;
	if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
		cout << "vowel";
	else
		cout << "consonant";

	return 0;
}


Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  int n,k,a[100],sum=0;
  cin>>n>>k;
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a,a+n);
  for(int i=0;i<k;i++)sum+=a[n-1-i];
  cout<<sum;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,n,i,j,k,x,y,m,p,s,mx,mn;
    char t;
    cin>>t;
    if(t=='A')
        cout<<"T"<<endl;
    else if(t=='T')
        cout<<"A"<<endl;
    else if(t=='C')
        cout<<"G"<<endl;
    else if(t=='G')
        cout<<"C"<<endl;

}



Measured memory_bytes: 3600
#include "stdio.h"
#include <stdlib.h>
#include <string.h>

int main (){
  /*  int a, b, c;
  char x,y,z;
  //  scanf("%c%c%c", &x, &y, &z);
  int N, a;
  scanf("%d %d",&N, &a);
  scanf("%d",&a);
  int d=(int)3.8;
  */
  int N;
  scanf("%d",&N);
  int array[N+1];
  int out[N+1];
  int enable_sum=0;
  for (int i=1; i<=N ; i++){
    scanf("%d",&array[i]);
  }
  for (int i=1; i<=N; i++){
    //printf("array[%d]=%d\n",i,array[i]);
  }


  for (int i=N; i>=1; i--){
    //    printf("============--\n");
    //    printf("i=%d\n",i);
    int sum_other = 0;
    int j = 2*i;
    while(j<=N){
      //      printf("add %d\n",j);
      sum_other += out[j];
      j+=i;
    }
    //    printf("sum_other=%d\n",sum_other);
    out[i] = (array[i]+sum_other)%2;
    if (out[i]==1){
      enable_sum++;
    }
    //    printf("out[%d]=%d\n",i,out[i]);
  }

  printf("%d\n",enable_sum);
  int counter=0;
  for (int i=1; i<=N; i++){
    if (counter==0 & out[i]==1){
      printf("%d",i);
      counter=1;
    }
    else if (out[i]==1){
      printf(" %d",i);
    }
  }

  if (enable_sum!=0){
    printf("\n");
  }

  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    bool ans = true;
    for(int i = 0; i < n; i++){
        if(a[i]%2 == 0 && a[i]%3 != 0 && a[i]%5 != 0){
           ans = false;
           break;
        }
    }

    if(ans) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;

   return 0;
}

Measured memory_bytes: 3608
n = int(input())
*a, = map(int, input().split())
a = [x - i for i, x in enumerate(a, 1)]

a.sort()
m = n // 2
b = a[m] if n % 2 == 1 else (a[m - 1] + a[m]) // 2

print(sum(abs(x - b) for x in a))


Measured memory_bytes: 26360
from collections import deque
import sys
input = sys.stdin.readline
from heapq import heapify

N = int(input())

table = []

for i in range(N):
    X,L = map(int, input().split())
    table.append((X-L,X+L))

table.sort(key=lambda x:x[0])
cur = table[0]
for i in range(1,N):
    if table[i][0] < cur[1]:
        N -= 1
        if cur[1] >= table[i][1]:
            cur = table[i]
    else:
        cur = table[i]

print(N)

Measured memory_bytes: 18596
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

using vec2 = pair<int, int>;
#define X first
#define Y second

int main()
{
    int H, W, M;
    cin >> H >> W >> M;

    vector<vec2> bs(M);
    vector<int> xs(W + 1, 0);
    vector<int> ys(H + 1, 0);

    int xmax = 0, ymax = 0;
    for (auto& b : bs)
    {
        cin >> b.Y >> b.X;
        xmax = max(xmax, ++xs[b.X]);
        ymax = max(ymax, ++ys[b.Y]);
    }

    int xn = 0, yn = 0;
    for (const auto& x: xs) { if (x == xmax) { ++xn; } }
    for (const auto& y: ys) { if (y == ymax) { ++yn; } }

    int zn = 0;
    for (const auto& b : bs) { if (xs[b.X] == xmax && ys[b.Y] == ymax) { ++zn; } }

    cout << xmax + ymax - (zn == xn * yn ? 1 : 0) << endl;

    return 0;
}

Measured memory_bytes: 7612
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut buf = buf.split_whitespace();
    let a: i32 = buf.next().unwrap().parse().unwrap();
    let b: i32 = buf.next().unwrap().parse().unwrap();

    let mut max = a + b;
    if (a - b) > max {
        max = a - b;
    }

    if (a * b) > max {
        max = a * b;
    }

    println!("{}", max);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {

	int n, m; scanf("%d%d", &n, &m);
	if (n > m) swap(n, m);
	long long ans = 0;
	if (n >= 3)
		ans = 1ll * (n - 2) * (m - 2);
	else if (n == 2) ans = 0;
	else if (n == 1) {
		if (m == 1) puts("1");
		else printf("%d", m - 2);
		return 0;
	}
	printf("%lld", ans);
	return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int>b(n - 1);
	rep(i, n - 1)cin >> b[i];

	int ans = b[0] + b[n - 2];
	rep(i, n - 2) {
		ans += min(b[i], b[i + 1]);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=100000000000000LL;

int main() {
	string s;
	cin>>s;
	int a[27]={};
	for(int i=0;i<s.size();++i){
		a[s[i]-'a']++;
	}
	bool h=false;
	for(int i=0;i<26;++i){
		if(a[i]>1)h=true;
	}
	if(h)cout<<"no"<<endl;
	else cout<<"yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

// abc
// bcd
int main(void) {
    int num;
    cin >> num;
    string str1;
    string str2;
    cin >> str1;
    cin >> str2;

    int common = 0;
    for(int st = 0; st < num; st++) {
        int size = num-st;
        if(str1.substr(st) == str2.substr(0, size)) {
            common = size;
            break;
        }
    }
    cout << 2*num - common << endl;
    return 0;
}

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

using namespace std;

const int maxn=1e5+10;

long long int dp[maxn][3];


int main()
{
    int n;
    cin>>n;
    int a[n][3];
    for(int i=0;i<n;i++)
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    dp[0][1]=a[0][1];
    dp[0][0]=a[0][0];
    dp[0][2]=a[0][2];
    for(int i=1;i<n;i++)
    {
        dp[i][0]=a[i][0]+max(dp[i-1][2],dp[i-1][1]);
        dp[i][1]=a[i][1]+max(dp[i-1][2],dp[i-1][0]);
        dp[i][2]=a[i][2]+max(dp[i-1][0],dp[i-1][1]);
    }
    long long o=max(dp[n-1][1],dp[n-1][0]);
    o=max(o,dp[n-1][2]);
    cout<<o;
	return 0;
}


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

#define ll long long
#define pb push_back
#define mp make_pair

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

	/*#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r+", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w+", stdout);
	#endif*/

    ll ans = 0;
    int n;
    cin >> n;
    for(int i=1;i<=n;i++) {
    	if(i % 3 ==0 or i % 5 == 0 or i % 15 == 0) {
    		continue;
    	}
    	else {
    		ans+=i;
    	}
    }
    cout << ans;
}

Measured memory_bytes: 3652
import java.io.*;

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String line;
		while((line=br.readLine())!=null){
			StringBuffer reverse = new StringBuffer().append(line);
			System.out.print(reverse.reverse()+"\n");
		}
	}
}

Measured memory_bytes: 16856
//****** @author mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)



void solve() {
    ll i,j;
    ll n, k;
    cin >> n >> k;
    ll a[n], b[n];
    for (i = 0; i < n; i++)cin >> a[i];
    for (i = 0; i < n; i++)cin >> b[i];

    sort(a,a+n);
    sort(b,b+n);
    reverse(b,b+n);

    ll low=0,high=1000000000010,ans=LONG_LONG_MAX;
    while(low<=high){
        ll mid=low+(high-low)/2;
        ll sum=0;
        for( j=0;j<n;j++){
            if (a[j] * b[j] > mid) {
               ll temp=mid/b[j];
               sum+=(a[j]-temp);
            }
        }
        if(sum<=k){
            ans=min(ans,mid);
            high=mid-1;
        } else{
            low=mid+1;
        }
    }
    cout<<ans<<endl;

}
int main()
{
    IOS;
    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		long sum = 0;


		int l = s.length();
		for(int i = 0; i < l; i++) {
			int num = Character.getNumericValue(s.charAt(i));
			sum += num;
		}


		if(sum % 9 == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}




		scan.close();
	}

}


Measured memory_bytes: 41040
#pragma region

#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (register int i = (begin); i < (end); i++)
#define IFOR(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define MOD 1000000007
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  REP(i, vec.size())
  i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &deq) {
  os << "deq[ ";
  REP(i, deq.size())
  i == 0 ? os << deq[i] : os << ", " << deq[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}

#pragma endregion
#pragma region

#define out(x) cout << (x) << '\n';

ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(a - b, b);
}

bool isPrime(ll a) {
  if (a == 2) return true;
  if (a < 2 || a % 2 == 0) return false;
  int b = sqrt(a);
  for (register int i = 3; i <= b; i += 2)
    if (b % i == 0) return false;
  return true;
}

#pragma endregion
#define INF 2147483647

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

  ll A, B, T;
  cin>>A>>B>>T;
  out(T/A*B);
}


Measured memory_bytes: 256
//Caesar Cipher

#include <iostream>
#include <string>
using namespace std;

int main(){
  char word[1000];
  char std[1000];
  int i;
  int pulas;
  int finish;

  cin >> std ;

  for (i=0; std[i] != '\0' ;i++){
    if ('D' <= std[i] && std[i] <= 'Z'){
      word[i] = std[i] - 3; //ASCII??????????????°???????????????
      cout << word[i];
    }
    else if ('A' == std[i]){
      word[i] = 'X' ;
      cout << word[i];
    }
    else if ('B' == std[i]){
      word[i] = 'Y' ;
      cout << word[i];
    }
    else if ('C' == std[i]){
      word[i] = 'Z' ;
      cout << word[i];
    }
  }
  cout << "\n";

  return 0;
}

Measured memory_bytes: 1104
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
ll coun[5];
int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	ll n,res=0;
	string s;
	cin>>n;
	for (int i=0;i<5;i++) coun[i]=0;
	for (int i=0;i<n;i++){
		cin>>s;
		if (s[0]=='M') coun[0]++;
		else if (s[0]=='A') coun[1]++;
		else if (s[0]=='R') coun[2]++;
		else if (s[0]=='C') coun[3]++;
		else if (s[0]=='H') coun[4]++;
	}
	for (int i=0;i<5;i++)
		for (int j=i+1;j<5;j++)
			for (int k=j+1;k<5;k++)
				res+=coun[i]*coun[j]*coun[k];
	cout<<res;
	return 0;
}

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

struct UnionFind{
    int num;
    vector<int> par,rank;
    UnionFind(int n):num(n),par(n),rank(n,1){
        iota(par.begin(),par.end(),0);
    }
    int root(int x){
        return (par[x]==x?x:par[x]=root(par[x]));
    }
    bool merge(int x, int y){
        x=root(x); y=root(y);
        if (x==y) return false;
        if (rank[x]<rank[y]) swap(x,y);
        par[y]=x;
        rank[x]+=rank[y];
        --num;
        return true;
    }
    bool same(int x, int y){return root(x)==root(y);}
    int size(int x){return rank[root(x)];}
    int count(){return num;}
};

// https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/1/DSL_1_A

void DSL_1_A(){
    int n,q; cin >> n >> q;
    UnionFind UF(n);

    for (;q--;){
        int c,x,y; cin >> c >> x >> y;
        if (!c) UF.merge(x,y);
        else cout << UF.same(x,y) << '\n';
    }
}

// https://atcoder.jp/contests/practice2/tasks/practice2_a

void practice2_a(){
    int N,Q; cin >> N >> Q;
    UnionFind UF(N);

    for (;Q--;){
        int t,u,v; cin >> t >> u >> v;
        if (!t) UF.merge(u,v);
        else cout << UF.same(u,v) << '\n';
    }
}

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

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

int main() {
  int K, N;
  cin >> K >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  vector<int> V(N);
  V.at(0) = A.at(0) + (K - A.at(N - 1));
  for (int i = 0; i + 1 < N; i++) {
    V.at(i + 1) = A.at(i + 1) - A.at(i);
  }

  cout << K - *max_element(V.begin(), V.end()) << "\n";
}

Measured memory_bytes: 1792
import copy
import heapq
import math
import fractions

def j(n):
    if n:print("Yes")
    else:print("No")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printmultiplerow(a):
    for i in a:
        print(i)
def printrow(a):
    for i in range(len(a)-1):
        print(a[i],end = " ")
    print(a[-1])


n = ip()
for i in range(10):
    for k in range(10):
        if i*k==n: j(1)
j(0)


Measured memory_bytes: 5332