akhauriyash/Code-Regression huggingface dataset:
nums = []
while true do
  line = gets.chomp
  if line =~ /\d/ then
    nums.push line.to_i
  elsif line =~ /[\-+\/*]/ then
    num = case line
          when ?-
            nums.pop - gets.to_i
          when ?+
            nums.pop + gets.to_i
          when ?/
            nums.pop / gets.to_i
          when ?*
            nums.pop * gets.to_i
          end
    nums.push num
  else
    p nums.pop
    break
  end
end

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

int N, T, L, B;
int stop[100], start[100];
double dp[100][101];

double rec(int idx, int tern)
{
  if(tern > T) return(0.0);
  if(idx == N) return(1.0);
  if(idx > N) return(rec(N + N - idx, tern));
  if(dp[idx][tern] != -1.0) return(dp[idx][tern]); 
  if(start[idx]) return(dp[idx][tern] = rec(0, tern));
  double val = 0.0;
  for(int i = 1; i <= 6; i++) {
    val += rec(idx + i, tern + 1 + stop[idx]) / 6;
  }
  return(dp[idx][tern] = val);
}

int main()
{
  while(cin >> N >> T >> L >> B, N) {
    memset(stop, false, sizeof(stop));
    memset(start, false, sizeof(start));
    while(L--) {
      int k;
      cin >> k;
      stop[k] = true;
    }
    while(B--) {
      int k;
      cin >> k;
      start[k] = true;
    }
    fill_n(*dp, 100 * 101, -1.0);
    cout << fixed << setprecision(10) << rec(0, 0) << endl;
  }
}

Measured memory_bytes: 1320
n,c = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
mod = 10**9+7

ex400 = [[1] * 401 for _ in range(401)]
for i in range(2,401):
    for j in range(1,401):
        ex400[i][j] = (ex400[i][j-1] * i) % mod

cumsum400 = [[1] * 401 for _ in range(401)]
for i in range(1,401):
    for j in range(401):
        cumsum400[i][j] = (cumsum400[i-1][j] + ex400[i][j]) % mod

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


for i in range(1,n+1):
    for j in range(c+1):
        for k in range(j+1):
            dp[i][j] += dp[i-1][j-k] * (cumsum400[b[i-1]][k] - cumsum400[a[i-1]-1][k])
            dp[i][j] %= mod

print(dp[-1][-1])

Measured memory_bytes: 78000
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
  int n;
  cin >> n;
  double a[n];
  for (int i=0; i < n;i++){
    cin >> a[i];
  }
  double kotae;
  for (int i=0; i<n; i++){
    kotae += 1/a[i];
  }
  kotae = 1/kotae;
  cout << kotae << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    n,m = map(int,input().split())
    M = {}
    for i in range(n):
        M[i+1] = []
    for _ in range(m):
        a,b = map(int,input().split())
        M[a] += [b]
        M[b] += [a]
    G = [0 for _ in range(n)]
    g = 0
    for i in range(n):
        if G[i] == 0:
            g+=1
            G[i] = g
            que = [i+1]
            while len(que)>0:
                q = que.pop(0)
                for nv in M[q]:
                    if G[nv-1] != 0:
                        continue
                    G[nv-1] = g
                    que.append(nv)
    print(max(G)-1)

if __name__ == "__main__":
    main()


Measured memory_bytes: 34140
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 200010;
int prime[MAX_N];
bool is_prime[MAX_N + 1];
void sieve(int n){
    int p = 0;
    for(int i = 0; i <= n; i++) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <= n; i++){
        if(is_prime[i]){
            prime[p++] = i;
            for(int j = 2*i; j <= n; j += i) is_prime[j] = false;
        }
    }
}


signed main(){
    int n, p;
    sieve(200000);
    while(1){
        cin >> n >> p;
        if(n == -1 && p == -1) break;
        int ans = 0;
        vector<int> d;
        set<int> st;
        int id = -1;
        rep(i, 0, 200010){
            if(prime[i] > n){
                id = i;
                break;
            }
        }
        rep(i, 0, 200){
            rep(j, i, 200){
                int sum = prime[id + i] + prime[id + j];
                // if(!st.count(sum)){
                    d.push_back(sum);
                    st.insert(sum);
                // }
            }
        }
        sort(all(d));
        cout << d[p - 1] << endl;
    }
}

Measured memory_bytes: 3752
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		int n=in.nextInt(),vec[][]=new int[2][n];
		for(int i=0;i<2;i++) {
			for(int j=0;j<n;j++) vec[i][j]=Integer.parseInt(in.next());
		}
		
		double D=0;
		for(int i=0;i<n;i++)D+=Math.abs(vec[0][i]-vec[1][i]);
		out.printf("%f\n",D);
		
		D=0;
		for(int i=0;i<n;i++)D+=Math.pow(vec[0][i]-vec[1][i], 2);
		out.printf("%f\n",Math.sqrt(D));
		
		D=0;
		for(int i=0;i<n;i++)D+=Math.pow(Math.abs(vec[0][i]-vec[1][i]), 3);
		out.printf("%f\n",Math.cbrt(D));
		
		D=Math.abs(vec[0][0]-vec[1][0]);
		for(int i=1;i<n;i++)D=Math.max(D, Math.abs(vec[0][i]-vec[1][i]));
		out.printf("%f\n", D);
		out.flush();
	}
}


Measured memory_bytes: 26400
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());

    if(n%2==0){
      System.out.println(n);
    }else{
      System.out.println(2*n);
    }
  }
}

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

int main()
{
	int N, M, b = 0, bc = 0;
	cin >> N >> M;
	for (int i = 0, bit; i < N; i++) {
		cin >> bit;
		if (bit) {
			b += 1 << i;
			bc++;
		}
	}
	vector<int> p(M);
	int o = 0, e = 0, sum = 0, ps = 0;
	for (int i = 0; i < M; i++) {
		cin >> p[i];
		if (i & 1) {
			ps += ((1 << p[i]) - 1) << sum;
			o += p[i];
		}
		else {
			e += p[i];
		}
		sum += p[i];
	}
	int r1 = 100000, r2 = 100000;
	if (bc == o) {
		r1 = 0;
		vector<int> pos(bc);
		for (int i = 0, j = 0; i < N; i++) {
			if (b & (1 << i)) {
				pos[j++] = i;
			}
		}
		for (int i = 0, j = 0; i < N; i++) {
			if (ps & (1 << i)) {
				r1 += abs(pos[j++] - i);
			}
		}
	}
	if (bc == e) {
		r2 = 0;
		ps = (1 << N) - 1 - ps;
		vector<int> pos(bc);
		for (int i = 0, j = 0; i < N; i++) {
			if (b & (1 << i)) {
				pos[j++] = i;
			}
		}
		for (int i = 0, j = 0; i < N; i++) {
			if (ps & (1 << i)) {
				r2 += abs(pos[j++] - i);
			}
		}
	}
	cout << min(r1, r2) << endl;
	return 0;
}

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

long long gcd(long long a, long long b);

int main(void){
    long long N, X;
    cin >> N >> X;
    
    long long x;
    cin >> x;
    int D = abs(X - x);
    
    int i;
    for(i = 2; i <= N; i++){
        cin >> x;
        D = gcd(D, abs(X - x));
    }
    
    cout << D << endl;
    
    return 0;
}

long long gcd(long long a, long long b){
    int c;
    while(b != 0){
        c = a % b;
        a = b;
        b = c;
    }
    
    return a;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;

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

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

signed main() {
    //srand((unsigned)time(NULL));

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

    int n, k;
    int sum = 0;
    cin >> n >> k;
    
    for (int i = k; i <= n + 1; i++) {
        int a = (n - i + 1 + n) * i / 2;
        int b = (1 + i - 1) * (i - 1) / 2;
        int c = a - b + 1;
        //cout << c << endl;
        sum += c;
        sum %= MOD;
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3676
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    static void solve() {
        int x = nextInt();
        int a = nextInt();
        int b = nextInt();

        int ans = (x - a) % b;
        out.println(ans);
    }

    static PrintWriter out;
    static Scanner sc;

    static int[][] newIntArray(int h, int w, int value) {
        int[][] ret = new int[h][w];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                ret[i][j] = value;
            }
        }
        return ret;
    }

    static int nextInt() {
        return Integer.parseInt(sc.next());
    }

    static long nextLong() {
        return Long.parseLong(sc.next());
    }

    static String nextString() {
        return sc.next();
    }

    static int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    static List<Integer> nextIntList(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    }

    static List<Long> nextLongList(int n) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    }

    static char[][] nextCharArray(int h, int w) {
        char[][] c = new char[h][w];
        for (int i = 0; i < h; i++) {
            String str = nextString();
            for (int j = 0; j < w; j++) {
                c[i][j] = str.charAt(j);
            }
        }
        return c;
    }

    static <T extends Comparable<? super T>> void sort(List<T> list) {
        Collections.sort(list);
    }

    // greatest common divisor
    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    // baseのn乗を計算を返す
    static int pow(int base, int n) {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    }

    // return n^k mod m
    static long powMod(long n, long k, long m) {
        if (k == 0) {
            return 1;
        } else if (k % 2 == 1) {
            return powMod(n, k - 1, m) * n % m;
        } else {
            long tmp = powMod(n, k / 2, m);
            return tmp * tmp % m;
        }
    }

    // intをlength桁のbit文字列に変換
    static String toBinaryString(int input, int length) {
        return toBinaryString(input).substring(29 - length);
    }

    // intを29桁のbit文字列に変換
    static String toBinaryString(int input) {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    }

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

        solve();

        out.flush();
        sc.close();
    }

}


Measured memory_bytes: 23892
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

vector<int> divisors(int n)
{
	vector<int> div2;

	for (int i = 1; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			if (i % 7 == 1 || i % 7 == 6)
			{
				div2.push_back(i);
			}

			if (((n / i) % 7 == 1 || (n / i) % 7 == 6) && i * i != n)
			{
				div2.push_back(n / i);
			}
		}
	}

	sort(div2.begin(), div2.end());

	return div2;
}

vector<int> divisorsdiv2(int n)
{
	vector<int> divisor = divisors(n);

	vector<int> div2;

	for (int i = 0; i < divisor.size(); i++)
	{
		if (divisors(divisor[i]).size() == 2 && divisor[i] != 1)
		{
			div2.push_back(divisor[i]);
		}
	}

	return div2;
}

int main()
{
	int n;

	while (true)
	{
		cin >> n;

		if (n == 1) { break; }

		vector<int> div2 = divisorsdiv2(n);

		cout << n << ':';

		for (int i = 0; i < div2.size(); i++)
		{
			cout << ' ' << div2[i];
		}

		cout << endl;
	}

	return 0;
}

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

int bubbleSort(int a[],int n){
    int flag=1;
    int c=0;
    for(int i=0;flag;i++){
        flag=0;
        for(int j=n-1;j>i;j--){
            if(a[j-1]>a[j]){
                swap(a[j],a[j-1]);
                flag=1;
                c++;
            }
        }
    }
    return c;
}

int main(void){
    int n;
    cin>>n;
    int a[n];
    string s="";
    for(int i=0;i<n;i++) cin>>a[i];
    int c=bubbleSort(a,n);
    for(int i=0;i<n;i++){
        cout<<s<<a[i];
        s=" ";
    }
    cout<<"\n"<<c<<"\n";
}


Measured memory_bytes: 3084
#include <iostream>

using namespace std;

int isPrime(int x){
  for (int i=2; i*i<=x; i++){
    if (x%i==0) return 0;
  }
  return 1;
}

int main(void){
  int n, x, ans=0;
  
  cin >> n;
  for (int i=0; i<n; i++){
    cin >> x;
    ans += isPrime(x);
  }
  cout << ans << endl;
    
 
  return 0;
}



Measured memory_bytes: 3132
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    int n,l,sum,c,a=999999;
    int ans;
    scanf("%d%d", &n,&l);
    for(int i=1; i<=n; i++)
    {
        c=l-1+i;
        if(abs(c)<a)
        {
            a=abs(c);
            ans=c;
        }
    }
    sum=n*(l-1)+(1+n)*n/2-ans;
    printf("%d", sum);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 100009;
ll i,j,n,c,ans;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n;
    rep(i,1,n + 1){
        j = i;
        c = 0;
        while(j > 0){
            c += 1;
            j /= 10;
        }
        if(c & 1)
            ans += 1;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left
N = int(input())
L = [int(c) for c in input().split()]
L.sort()
ans = 0
for i in range(N):
  for j in range(i+1, N):
    x = L[i]+L[j]
    ind = bisect_left(L, x)
    ans += ind-j-1
#    print(x,ind)

print(ans)

Measured memory_bytes: 45052
toInt :: (String -> Int)
toInt x = read x ::Int

getInts = do
  x <- getLine
  let y = (map$toInt)$words x 
  return y

getStr = do
  x <- getLine
  let y = words x 
  return y  

main :: IO ()
main = do
  [xn, yn, x, y] <- getInts
  xs <- getInts
  ys <- getInts
  putStrLn $ if (maximum $ xs ++ [x]) >= (minimum $ ys ++ [y]) then "War" else "No War"

Measured memory_bytes: 1020
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <cstring>
#include <stack>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cassert>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> pii;
int main(){
    string s;
    cin >> s;
    rep(i,s.size()-8){
        cout << s[i];
    }
    cout << endl;
}

Measured memory_bytes: 764
n = int(input())
ary = [int(input()) for _ in range(n)]
dic = {}
cnt = 0
for num in ary:
    if num in dic:
        dic[num] += 1
    else:
        dic[num] = 1
for item in dic.items():
    if item[1] % 2 == 1:
        cnt += 1
print(cnt)

Measured memory_bytes: 16268
N = int(input())
A = [int(input()) for _ in range(N)]

dic = {}

for i in range(N):
  if A[i] in dic.keys():
    dic[A[i]] += 1
  else:
    dic[A[i]] = 1
    
cnt = 0

for j in dic.keys():
  if dic[j] % 2 == 1:
    cnt += 1
    
print(cnt)

Measured memory_bytes: 20536
#include <bits/stdc++.h>  
 
using namespace std;
 
//#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
 
const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};
 
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
 
signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i += 2) cout << s[i];
    cout << "\n";
    return 0;
}

Measured memory_bytes: 592
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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; }
string dp[10005];
int main(){
    V<ll> d={0,2,5,5,4,5,6,3,7,6};
    ll n,m;
    cin>>n>>m;
    V<int> a(n);
    for(int i=0;i<m;i++)cin>>a[i];
    sort(all(a),greater<ll>());
    for(int i=0;i<m;i++){
        for(int j=n;j>=d[a[i]];j--){
            if(j!=n&&dp[j].size()==0)continue;
             string t=dp[j];
            t.push_back(a[i]+'0');
             if(dp[j-d[a[i]]].size()<t.size())dp[j-d[a[i]]]=t;
            else if(dp[j-d[a[i]]].size()==t.size()){
                for(int k=0;k<t.size();k++){
                    if(dp[j-d[a[i]]][k]>t[k])break;
                    if(dp[j-d[a[i]]][k]<t[k]){
                        dp[j-d[a[i]]]=t;
                        break;
                    }
                }
           }
        }
    }
    cout<<dp[0]<<"\n";
}

Measured memory_bytes: 39700
#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <cmath>
#include <random>
#include <cctype>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define MK make_pair
#define PB push_back
#define VI vector<int>
#define VII vector<int,int>
#define MSI map<string,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define W1 while(1);
const int MOD = 1000000007;
int main()
{
	int a, b;
	cin >> a >> b;
	if (a == 1)a = 14;
	if (b == 1)b = 14;
	if (a > b)
	{
		cout << "Alice"<< endl;
	}
	if (a < b)
	{
		cout << "Bob" << endl;
	}
	if (a == b)
	{
		cout << "Draw" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
def main():
    H, W = map(int, input().split())
    
    if H == 1 or W == 1:
        print('1')
    elif H * W % 2 == 0:
        print(int(H * W / 2))
    else:
        print(int(H * W / 2) + 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
# -*- coding:utf8 -*-

n = int(input())
l = list(map(int, input().split()))
c,p = 0,0
t = [0]
for i,n in enumerate(l):
    if p == 0:
        pass
    elif n <= p:
        c += 1
        if i == len(l) - 1:
            t.append(c)
    else:
        t.append(c)
        c = 0
    p = n
ans = max(t)
print(ans)



Measured memory_bytes: 14224
from collections import deque
def is_palindrome(S):
    d = deque(S)
    while d:
        if len(d) <= 1:
            return True
        if d[0] != d[-1]:
            return False
        d.popleft()
        d.pop()
    return True
def union(S1,S2):
    l1 = len(S1)
    l2 = len(S2)
    for i in range(min(l1,l2)):
        if S1[i] != S2[-i-1]:
            return (-1,'')
    if abs(l1-l2) <= 1:
        return (2,'')
    if l1 > l2:
        return (0,S1[l2:])
    else:
        return (1,S2[:l2-l1])

N = int(input())
S = []
C = []
d = deque()
dic = {}
ans = 10**18
for i in range(N):
    Si,Ci = input().split()
    Ci = int(Ci)
    S.append(Si)
    C.append(Ci)
    if is_palindrome(Si):
        ans = min(ans,Ci)
    else:
        d.append((Ci,Si,0))
        d.append((Ci,Si,1))
        dic[(Si,0)] = Ci
        dic[(Si,1)] = Ci
while d:
    cost,string,order = d.popleft()
    for i in range(N):
        if order == 0:
            x,y = union(string,S[i])
        else:
            x,y = union(S[i],string)
        if x == -1:
            continue
        if is_palindrome(y):
            ans = min(ans,cost+C[i])
        else:
            if (y,x) in dic.keys():
                if dic[(y,x)] > cost+C[i]:
                    d.append((cost+C[i],y,x))
                    dic[(y,x)] = cost+C[i]
            else:
                d.append((cost+C[i],y,x))
                dic[(y,x)] = cost+C[i]
if ans == 10**18:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 69344
#include <bits/stdc++.h>
using namespace std;
/*
3 1 4 1 5 9 2
1 1 2 3 4 5 9 
*/
int main() {
  int N; cin >> N;
  vector<int> v(100001);
  
  while(N--){
    int a; cin >> a;
    v.at(a)++;
  }
  
  int ans = 0;
  for(int i = 1; i < 100000; i++){
    ans = max(ans,v.at(i-1)+v.at(i)+v.at(i+1));
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    vector<vector<int>> A(3, vector<int>(3)), B(3, vector<int>(3));
    for(int i = 0; i < 3; ++i){
        cin >> A.at(i).at(0) >> A.at(i).at(1) >> A.at(i).at(2);
    }
    int N, b;
    cin >> N;
    for(int i = 0; i < N; ++i){
        cin >> b;
        for(int j = 0; j < 3; ++j){
            for(int k = 0; k < 3; ++k){
                if(b == A.at(j).at(k)) B.at(j).at(k)++;
            }
        }
    }
    if(B.at(0).at(0) == 1 && B.at(0).at(1) == 1 && B.at(0).at(2) == 1) cout << "Yes" << endl;
    else if(B.at(1).at(0) == 1 && B.at(1).at(1) == 1 && B.at(1).at(2) == 1) cout << "Yes" << endl;
    else if(B.at(2).at(0) == 1 && B.at(2).at(1) == 1 && B.at(2).at(2) == 1) cout << "Yes" << endl;

    else if(B.at(0).at(0) == 1 && B.at(1).at(0) == 1 && B.at(2).at(0) == 1) cout << "Yes" << endl;
    else if(B.at(0).at(1) == 1 && B.at(1).at(1) == 1 && B.at(2).at(1) == 1) cout << "Yes" << endl;
    else if(B.at(0).at(2) == 1 && B.at(1).at(2) == 1 && B.at(2).at(2) == 1) cout << "Yes" << endl;

    else if(B.at(0).at(0) == 1 && B.at(1).at(1) == 1 && B.at(2).at(2) == 1) cout << "Yes" << endl;
    else if(B.at(2).at(0) == 1 && B.at(1).at(1) == 1 && B.at(0).at(2) == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll dp[105][2][105];

void Main() {
    string S;
    cin >> S;
    ll N = S.size();
    ll K;
    cin >> K;

    dp[0][0][0] = 1;
    rep(i, N) {
        ll d = S[i] - '0';
        rep(j, 2) {
            if (j == 1) {
                d = 9;
            }
            rep(k, K + 1) {
                rep(m, d + 1) {
                    if (j == 1) {
                        if (m != 0) {
                            dp[i + 1][j][k + 1] += dp[i][j][k];
                        } else {
                            dp[i + 1][j][k] += dp[i][j][k];
                        }
                    } else {
                        if (m == d) {
                            if (m != 0) {
                                dp[i + 1][j][k + 1] += dp[i][j][k];
                            } else {
                                dp[i + 1][j][k] += dp[i][j][k];
                            }
                        } else {
                            if (m != 0) {
                                dp[i + 1][1][k + 1] += dp[i][j][k];
                            } else {
                                dp[i + 1][1][k] += dp[i][j][k];
                            }
                        }
                    }
                }
            }
        }
    }
    cout << dp[N][1][K] + dp[N][0][K] << '\n';
}

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


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
using namespace std;
int main(){
  int n,q; cin>>n>>q;
  string s; cin >>s;

  int t[100000];
  int cnt=0;
  for(int i=0;i<n-1;i++){
    if(s[i]=='A' && s[i+1]=='C') cnt++;
    t[i]=cnt;
  }

  for(int i=0; i<q ;i++){
    int l,r; cin >>l >>r;
    cout<<t[r-2]-t[l-2]<<endl;
  }
}


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

static bool grid[20][1024];

#ifdef _MSC_VER
static constexpr bool debug = true;
#else
static constexpr bool debug = false;
#endif

struct Piece {
    int left, top;
    int right, bottom;
    int white_count;
};

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    for (int y = 0; y < h; ++y) {
        for (int x = 0; x < w; ++x) {
            char c;
            cin >> c;
            grid[y][x] = (c != '0');
        }
    }

    auto horz_sum = vector<int>(h);
    auto vert_sum = vector<int>(w);
    for (int y = 0; y < h; ++y)
        for (int x = 0; x < w; ++x)
            horz_sum[y] += grid[y][x];
    for (int x = 0; x < w; ++x)
        for (int y = 0; y < h; ++y)
            vert_sum[x] += grid[y][x];

    // horizontal
    auto min_splits = 1'000'000'000;

    for (int mask = 0; mask < (1 << (h - 1)); ++mask) {
        auto h_sections = vector<pair<int, int>>();
        int y_start = 0;
        for (int i = 0; i < h - 1; ++i) {
            if (mask & (1 << i)) {
                int y_end = i + 1;
                h_sections.push_back(make_pair(y_start, y_end));
                y_start = y_end;
            }
        }
        int y_end = h;
        h_sections.push_back(make_pair(y_start, y_end));

        if (debug) {
            fprintf(stderr, "mask %04x, ", mask);
            for (auto &s : h_sections)
                cerr << s.first << ":" << s.second << " ";
            cerr << "\n";
        }

        auto last_split_pos = 0;
        auto vert_splits = 0;
        auto total_splits = 0;
        auto sums = vector<int>(h_sections.size());
        auto column_sums = vector<int>(h_sections.size());

        for (int x = 0; x < w; x++) {
            for (int i = 0; i < h_sections.size(); ++i) {
                column_sums[i] = 0;
                for (int y = h_sections[i].first; y != h_sections[i].second; ++y) {
                    column_sums[i] += grid[y][x];
                }

                if (column_sums[i] > k)
                    goto next_mask;
            }

            bool greater = false;
            for (int i = 0; i < h_sections.size(); ++i) {
                greater = sums[i] + column_sums[i] > k;
                if (greater)
                    break;
            }
            if (!greater) {
                for (int i = 0; i < h_sections.size(); ++i)
                    sums[i] += column_sums[i];
                continue;
            }

            if (x == last_split_pos)
                goto next_mask;

            last_split_pos = x;
            vert_splits++;
            for (int i = 0; i < h_sections.size(); ++i)
                sums[i] = column_sums[i];
        }

        if (debug) {
            cerr << "split v" << vert_splits << " h" << (h_sections.size() - 1) << "\n";
        }

        total_splits = vert_splits + ((int)h_sections.size() - 1);
        min_splits = min(min_splits, total_splits);

    next_mask:
        (void)0;
    }

    cout << min_splits;
    return 0;
}


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


int main()
{
  string s, t;
  cin >> s >> t;
  int len = s.length();
  int ans = 0;
  rep(i, len)
    if (s[i] != t[i])
      ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3916
import java.util.Scanner;


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

			int n = sc.nextInt();
			int i;
			int j;

			String array[] = new String[52];

			for(i = 0; i < 52; i++) {

				if(i < 13) {
					array[i] = "S" + " " + (i + 1);
				} else if(i < 26) {
					array[i] = "H" + " " + (i + 1 - 13);
				} else if(i < 39) {
					array[i] = "C" + " " + (i + 1 - 26);
				} else {
					array[i] = "D" + " " + (i + 1 - 39);
				}

			}

			for(i = 0; i < n; i++) {

				String b = sc.next();
				int a = sc.nextInt();

				for(j = 0; j < 52; j++) {
					if(array[j].equals(b + " " + a)) {
						array[j] = "1";
					}
				}
			}

			for(i = 0; i < 52; i++) {
				if(array[i] != "1") {
					System.out.println(array[i]);
				}
			}

	}
}

Measured memory_bytes: 26792
#include <bits/stdc++.h>
    #define ll long long
    using namespace std;
    const int N=1000006, INF=1000000009;
    long long a[N], b[N], t[200002], n, u, Ans;
     
    void upd(int i){ while(i <= 200002) ++t[i], i+=(i&-i); }    
     
    ll sum(int i){
        int x=0;
       	while(i) x+=t[i], i-=(i&-i); 
        return x;
    }     
            
    int main(){ ios_base::sync_with_stdio(false);
        cin>>n;
        for (int i=1; i<=n; i++)
          	cin>>a[i];
        int l=1, r=1e9;
    	ll x=(n*(n+1)/2 + 1) / 2;
        while(l<=r){
           	int mid=(l+r)/2, k=100001;
          ll ans = 0;
          	for (int i=0; i<=200002; i++)t[i]=0;
           	upd(k);
        	for (int i=1; i<=n; i++)
         		if(a[i]>=mid) ++k, ans+=sum(k), upd(k);
          		else 		  --k, ans+=sum(k), upd(k);
         	
           	if(ans>=x)Ans=mid, l=mid+1;
           	else	  r=mid-1;
        }
        cout<<Ans;
       	return 0;
    }

Measured memory_bytes: 3840
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N + 1, 0);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i + 1];
	}
	map<int, int> mp;
	for (int i = 0; i < N; i++) {
		A[i + 1] += A[i];
	}
	for (int i = 0; i < A.size(); i++) {
		mp[A[i]]++;
	}
	for (auto m : mp) {
		res += (m.second*(m.second - 1)) / 2;
	}
	cout << res << endl;
}

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

typedef long long ll;

const ll INF = (ll)1e15;
int N;
vector<ll> S;

int main(void) {
	cin >> N;

	S.resize(N + 1);
	S[0] = 0LL;
	for (int i = 1; i <= N; ++i) {
		ll a;
		cin >> a;
		S[i] = S[i - 1] + a;
	}

	ll ans = INF;
	for (int i = 1; i <= N - 1; ++i) {
		ll x = S[i];
		ll y = S[N] - x;
		ans = min(ans, abs(x - y));
	}

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int H = input.nextInt();
        int W = input.nextInt();
        
        while (H != 0 && W != 0) {
            for (int i = 0; i < H; i ++) {
                for (int j = 0; j < W; j++) {
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
            
            H = input.nextInt();
            W = input.nextInt();
        }
    }
}


Measured memory_bytes: 33320
import sys
read = sys.stdin.readline
n, k = map(int, read().split())
# 種類数を増やすときは、各種類で最もでかいのを食べる
# 種類数最大降順配列、他降順配列みたいなの用いしtえ
# 食べる出井数を全探索する
# 累積和
sushi = [[] for _ in range(n)]

for i in range(n):
    t, d = map(int, read().split())
    t -= 1
    sushi[t].append(d)

max_sushi = []
other_sushi = []
for i in range(n):
    if len(sushi[i]) == 0:
        continue
    sushi[i].sort()
    max_sushi.append(sushi[i][-1])
    for j in range(len(sushi[i]) - 1):
        other_sushi.append(sushi[i][j])
max_sushi.sort(reverse=True)
other_sushi.sort(reverse=True)

for i in range(len(max_sushi) - 1):
    max_sushi[i + 1] += max_sushi[i]
for i in range(len(other_sushi) - 1):
    other_sushi[i + 1] += other_sushi[i]

a = len(max_sushi)
b = len(other_sushi)
ans = 0
for x in range(1, k + 1):
    if x > a or k - x > b:
        continue
    other = 0 if k - x - 1 < 0 else other_sushi[k - x - 1]
    ans = max(ans, x * x + max_sushi[x - 1] + other)
print(ans)


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

int main() {
  
  int N,R;
  cin >> N >>R;
  
  if(N>=10) {
    cout << R <<endl;
  }
  
  else {
    cout << R + 100*(10-N) <<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
int main()
{
	int a = 0, b = 0, c = 0, d = 0, e = 0, min = 0, ma = 0, ans = 0, ansb = 0, count = 0, countb, crowdy[101] = {}, bu = 0;
	int reset = 0, w = 0;
	unsigned int super;
	char hairetu[200] = {};
	int number[10000], price[10000], sort[100000] = {}, kisu[10000] = { 100000 }, gusu[10000] = { 100000 };
	using namespace std;
	int x = 0, y = 0, z = 0, play[200] = {}, acount = 0, bcount = 0;
	std::string str, tokit, fun, funt;
	int cake = 4, cookie = 7;
	bool okada = true;
	cin >> str>>super;
	for (int i = 0; i < str.size(); i++) {
	
	
		
		if (str[0] == '1') {
			if (str[i] == '1') {
				count++;
				okada = false;
			}
			if (okada == false) {
				if (str[i] != '1') {
				
					w = i;
					e=1;
					break;
				}
			}
		}
		else {
			break;
		}
	}
	if (e == 1) {
		if (count >= super) {
			cout << 1 << endl;
		}
		else {
			cout << str[w] << endl;
		}
	}
	else {
		cout << str[0] << endl;
	}
	
	return 0;
	
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc169/tasks/abc169_e
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int const maxn = 2e5;
int A[maxn], B[maxn];

int main() {
  int N;
  cin >> N;
  rep(i, N) { cin >> A[i + 1] >> B[i + 1]; }
  sort(A + 1, A + N + 1);
  sort(B + 1, B + N + 1);
  if (N % 2 == 1)
    cout << B[(N + 1) / 2] - A[(N + 1) / 2] + 1 << '\n';
  else
    cout << (B[N / 2] + B[N / 2 + 1] - A[N / 2] - A[N / 2 + 1]) + 1 << '\n';
}

Measured memory_bytes: 5192
#include<bits/stdc++.h>
#define ll long long int
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
const ll MOD = 1e9 + 7; 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
using namespace std;
void vok()
{
    FAST
    FO
    FI
 }
int func(vector<int> &A,int n)
 {
}
int main()
{
  vok();
  
   int t=1; // cin>>t;
  
while(t--)
 { 
   int n,m,a,b,c,d,x,y,k;
    cin>>n;
    cin>>d;
  if(d>=n)
       cout<<"unsafe"<<endl;
  else
     cout<<"safe"<<endl;
   
   } 
   return 0;
}

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

typedef pair<int, int> P;

int main() {
    int N;
    cin >> N;
    vector<int> G[N];
    vector<P> vp;
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
        vp.emplace_back(P(a, b));
    }

    int res = 0;
    map<P, int> I;
    vector<int> cs(N, 0);

    vector<bool> used(N);
    queue<int> que;
    used[0] = true;
    que.push(0);
    while (!que.empty()) {
        int v = que.front(); que.pop();
        res = max(res, (int)G[v].size());
        int cur = 1;
        for (int i = 0; i < G[v].size(); i++) {
            int u = G[v][i];
            if (used[u]) continue;
            if (cur == cs[v]) cur++;
            cs[u] = I[P(u, v)] = I[P(v, u)] = cur++;
            used[u] = true;
            que.push(u);
        }
    }

    cout << res << endl;
    for (int i = 0; i < vp.size(); i++) {
        cout << I[vp[i]] << endl;
    }
    return 0;
}

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

int main(){
	int H, W, i, j;
	
	while(1){
		cin >> H >> W;
		if (H == 0 && W == 0){
			break;
		}
		for (i = 0; i < H; i++){
			for(j = 0; j < W; j++){
				cout << '#';
			}
			cout << endl;
		}
		cout << endl;
	}
    return 0;
}

Measured memory_bytes: 3104
n = gets.to_i
h = gets.split.map &:to_i

def stairs(n,h)
  (n-1).downto(0) do |i|
    if i == 0
      puts "Yes"
      return
    end
    if h[i-1] - h[i] > 1
      puts "No"
      return
    elsif h[i-1] - h[i] == 1
      h[i-1] -= 1
    end
  end
end

puts stairs(n,h)


Measured memory_bytes: 8580
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
  int N;
  cin>>N;
  vector<vector<int>> G(N);
  vector<pair<int,int>> vp;
  for(int i=1;i<N;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
    vp.push_back(make_pair(a,b));
  }

  int K=0;
  map<pair<int,int>,int> I;
  vector<int> cs(N,0); // color of edge between its parent

  vector<int> used(N,0);
  queue<int> que;
  used[0]=1;
  que.push(0);
  while(!que.empty()){
    int v=que.front();que.pop();
    if(K<(int)G[v].size()) K=G[v].size();
    int cur=1;
    for(int u:G[v]){
      if(used[u]) continue;
      if(cur==cs[v]) cur++;
      cs[u]=I[make_pair(u,v)]=I[make_pair(v,u)]=cur;
      cur++;
      used[u]=1;
      que.push(u);
    }
  }

  cout<<K<<endl;
  for(auto p:vp) cout<<I[p]<<endl;
  return 0;
}


Measured memory_bytes: 20084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    vector<ll> x(5);
    rep(i, 5) cin >> x[i];
    rep(i, 5) {
        if (x[i] == 0) {
            cout << (i + 1) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

struct factorial
{
    vector<ll> fac, finv, inv;

    factorial(int n) : fac(2, 1), finv(2, 1), inv(2, 1)
    {
        int i;

        rep(i, 2, n + 1)
        {
            fac.push_back(fac[i - 1] * i % MOD);
            inv.push_back(MOD - inv[MOD % i] * (MOD / i) % MOD);
            finv.push_back(finv[i - 1] * inv[i] % MOD);
        }
    }

    ll comb(int n, int k)
    {
        if (n < k)
        {
            return 0;
        }

        if (n < 0 || k < 0)
        {
            return 0;
        }

        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    ll perm(int n, int k)
    {
        if (n < k)
        {
            return 0;
        }

        if (n < 0 || k < 0)
        {
            return 0;
        }

        return fac[n] * finv[n - k] % MOD;
    }
};

int main(void)
{
    int n, k;
    int i;
    ll ans = 0;

    cin >> n >> k;

    factorial f(n);

    rep(i, 0, min(k + 1, n))
    {
        ans += f.comb(n, i) * f.comb(n - 1, n - i - 1);
        ans %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 5204
#include <bits/stdc++.h>
#define up(i,a,b) for(int i=a;i<=b;i++)
#define down(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a-1;i>=b;i--)
#define CL(x) (x<<1)
#define CR(x) (x<<1)+1
#define pb push_back
#define bit1(x) __builtin_popcount(x)
#define self (*this)

using namespace std;

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

template<typename T> inline void _read(T &x){
    char ch; x=0; bool neg=false;
    for(ch=getchar();ch<'0'||ch>'9';ch=getchar())
        if(ch=='-') neg=true;
    for(;ch>='0'&&ch<='9';ch=getchar()) x=10*x+ch-'0';
    if(neg) x=-x;
}
#define read(a) _read(a)
#define Read(a,b) _read(a),_read(b)
#define READ(a,b,c) _read(a),_read(b),_read(c)

const int maxn=1e5+7;
const int Nblocks=400;
const int maxk=1e3+7;
const ll mod=1e9;
const int inf=1e9+7;
const ll linf=1e16+9;
const ll Radix=1e9;
const int Length=9;
const int MaxDigit=2e3+1;
const int nDigits=MaxDigit/Length+1;

int n,k;
int d[maxn];
ll res;

inline void Enter(){
    cin>>n>>k;
}

inline void Prepare(){
    up(i,1,n) d[i%k]++;
}

inline void Solve(){
    up(i,1,n) res+=1ll*d[i%k]*d[i%k]*((2*(i%k))%k==0);
    cout<<res;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);

    Enter();
    Prepare();
    Solve();

    return 0;
}


Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int nowX = 0;
            int nowY = 0;
            int nowT = 0;
            for (int i = 0; i < n; i++) {
                int t = in.nextInt();
                int x = in.nextInt();
                int y = in.nextInt();
                int dist = Math.abs(nowX - x) + Math.abs(nowY - y);

                if (dist % 2 == (Math.abs(nowT - t) % 2)) {
                    if (dist <= Math.abs(nowT - t)) {
                        nowX = x;
                        nowY = y;
                        nowT = t;
                    } else {
                        out.print("No");
                        return;
                    }
                } else {
                    out.print("No");
                    return;
                }
            }
            out.print("Yes");

        }

    }
}



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

int main(){
  char s(1);
  cin >> s;
  if(s == 'A'){
    cout << "T" <<endl;
  }else if(s == 'T'){
    cout << "A" << endl;
  }else if(s == 'C'){
    cout << "G" << endl;
  }else{
    cout << "C" << endl;
  }
}



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

using namespace std;

typedef  long long LL;


void ok(){

   int a, b;
   cin >> a >> b;
   if(a%2 != 0 && b % 2 != 0){
    cout <<"Yes";
   }
   else cout <<"No";

}

int main(){
    ok();
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1e+9 + 7;

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

    string s;
    cin >> s;
    if(s[0] == s[1] && s[1] == s[2]){
        cout << "No\n";
    }
    else{
        cout << "Yes\n";
    }
}

Measured memory_bytes: 256