akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
	int a;
	int b;
	int x;
	int y;
	double z;
	scanf("%d %d",&a,&b);
	x=a/b;
	y=a%b;
	z=1.0*a/b;
	printf("%d %d %.8lf\n",x,y,z);
	return 0;
}

Measured memory_bytes: 640
N=input()
N=int(N)
A=list(map(int,input().split()))
B=list(map(int,input().split()))
P=0
p1=min(A[0],B[0])
P12=[]
P+=p1
for i in range(N):
    if i>=1:
        p1=min(A[i]-P12[i-1],B[i])
        P+=p1
    p12=min(A[i+1],B[i]-p1)
    P12.append(p12)
    P+=p12
print(P)

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

int main(){
  int a[3010],b[3010];
  for(int i=0;;i++){
    scanf("%d %d",&a[i],&b[i]);
    if(a[i]>b[i])swap(a[i],b[i]);
    if(a[i]==0 && b[i]==0)break;
  }
  for(int i=0;;i++){
    if(a[i]==0 && b[i]==0)break;
    printf("%d %d\n",a[i],b[i]);
  }
}



Measured memory_bytes: 3240
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define NOT_ZERO 1
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;

int main()
{
    int i, j, n, k, h[100000];
    ll cost[100000];
    ll temp[100], min;

    scanf("%d %d",&n, &k);
    for(i=0; i<n; i++) {
        scanf("%d",&h[i]);
    }

    for(i=0; i<k && i<n; i++) {
        cost[i] = abs(h[i] - h[0]);
    }

    for(i=k; i<n; i++) {
        min=1e18;
        for(j=1; j<=k; j++) {
            temp[j] = cost[i-j] + abs(h[i]-h[i-j]);
            //printf("temp[%d][%d]=%d\n",i, j, temp[j]);
            min = MIN(min, temp[j]);
        }
        //printf("cost[%d]=%d\n",i,min);
        cost[i] = min;
    }
    printf("%lld",cost[n-1]);
    return 0;
}

Measured memory_bytes: 1280
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	long K = sc.nextLong();
	long cnt = 0;
	for(int i = 0; i<S.length(); i++) {
	    int n = Character.getNumericValue(S.charAt(i));
	    int x = 5000;
	    long k = 1;
	    for(int j = 0; j< 4; j++) {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    }
	    cnt = cnt + k;
	    //System.out.println(k);
	    if(cnt >= K) {
		System.out.println(n);
		return;
	    }
	}
    }
}

Measured memory_bytes: 22996
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll A, B;

int main() {
	scanf("%lld %lld", &A, &B);
	if(A > 8 || B > 8) {
		printf(":(\n");
	}
	else {
		printf("Yay!\n");
	}
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	long n = rlong, a = rlong, b = rlong;
	// a < b

	long ans;
	if(a % 2 == b % 2){
		ans = (b - a) / 2;
	}
	else{
		long ans1 = a +(b - (a + 1)) / 2;
		long ans2 = (n + 1 - b) + (b - 1 - a) / 2;

		ans = min(ans1, ans2);
	}

	ans.writeln;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/
//int modInverse(int a, int m) {return power(a, m-2);} //gcd(a,m)=1 


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{//cout<<"Case #"<<T1<<": ";
    int n;
    cin>>n;int flag=0;
    while(n!=0)
    {
        if(n%10==7)flag=1;
        n/=10;
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}


return 0;
}





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

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

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

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

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

    vector<int> dp(n, INF);
    dp[0] = 0;
    srep(i, 1, n) {
        if (i >= 2) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
    }

    cout << dp[n - 1] << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 3944
X, N = map(int,input().split())
p = list(map(int,input().split()))

old = 1000
for i in range(200):
    try :
        p.index(i)
    except:
        tmp = i - X
        if abs(old) > abs(tmp):
            old = tmp
            sol = i
        if abs(old) == abs(tmp) and tmp < old:
            old = tmp
            sol = i

print(sol)

Measured memory_bytes: 9196
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>

using namespace std;

int main(void)
{
	int	n;				//学生の人数
	cin >> n;			//学生の数を入力
	double average;		//平均
	double variance;	//分散
	double deviation;	//標準偏差
	vector<int> s;		//学生の得点を格納する配列
	double sum_d;		//合計値を記録(作業用)

	while( n != 0)
	{
		//得点の入力
		for(int i = 0; i < n; i++)
		{
			int tmp_s;
			cin >> tmp_s;

			s.push_back(tmp_s);
		}

		//得点の平均を計算
		sum_d = 0;
		for(int i = 0; i < n; i++)
		{
			sum_d += s[i];
		}
		average = sum_d / n;

		//分散を計算
		sum_d = 0;
		for(int i = 0; i < n; i++)
		{
			sum_d += pow( s[i] - average, 2.0f);
		}
		variance = (double)(sum_d / n);

		//標準偏差を計算
		deviation = sqrt(variance);

		cout << fixed << setprecision(12);
		cout << deviation << endl;

		//配列削除
		vector<int>().swap(s);

		//再度学生の数を入力
		//0の場合は終了となる
		cin >> n;
	}

	return 0;
}



Measured memory_bytes: 3240
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>

using namespace std;

vector<vector<int>>graph;
map<pair<int, int>, int>edges;
vector<int>answer;


int dfs(int pos, int parentcolor) {

	int ans = parentcolor;
	int usingcolor = 1;
	for (const int x : graph[pos])if (pos < x) {
		if (usingcolor == parentcolor)usingcolor++;
		answer[edges[make_pair(pos, x)]] = usingcolor;
		ans = max(ans, dfs(x, usingcolor++));
	}
	return ans;
}

int main() {

	int N;
	cin >> N;
	graph = vector<vector<int>>(N, vector<int>());
	edges = map<pair<int, int>, int>();
	answer = vector<int>(N);
	for (int i = 0; i < N - 1; ++i) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
		edges[make_pair(a, b)] = i;
		edges[make_pair(b, a)] = i;
	}

	cout << dfs(0, -1) << endl;
	for (int i = 0; i < N - 1; ++i) {
		cout << answer[i] << endl;
	}


	return 0;
}

Measured memory_bytes: 15744
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;

void func( int n, const vector<int>& a, vector<ll>& s0 )
{
    set<pair<int,int> > z;
    int i;
    for(i=0; i<n*3; i++) {
        if(i<n) {
            z.insert(make_pair(a[i],i));
            s0[i+1]=s0[i]+a[i];
        }
        else {
            auto it=z.begin();
            if(it->first<a[i]) {
                s0[i+1]=s0[i]-it->first+a[i];
                z.erase(*it);
                z.insert(make_pair(a[i],i));
            }
            else {
                s0[i+1]=s0[i];
            }
        }
    }
    return;
}

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    vector<int> a(n*3);
    int i;
    for(i=0; i<n*3; i++) {
        scanf("%d", &a[i]);
    }

    vector<ll> s0(n*3+1);
    func( n, a, s0 );

    vector<ll> s1(n*3+1);
    vector<int> b(n*3);    
    for(i=0; i<n*3; i++) {
        b[i]=-a[n*3-1-i];
    }
    func( n, b, s1 );

    ll ans=-LINF;
    for(i=n; i<=2*n; i++) {
        ll tmp=s0[i]+s1[n*3-i];
        ans=MAX(ans,tmp);
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 11904
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int N = 100010;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(auto &t:a)cin>>t;return i;}
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T> void prArr(T a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}
 
 
signed main(){
  int n;
  cin>>n;
  vector<int> A(n);
  cin>>A;

  auto check=[&](int k){
    for(int i=k;i<n;i++) if(A[i]!=A[i-k]) return 0;
    return 1;
  };

  int ans = 0;
  for(int i=1;i<=n;i++){
    if(n%i) continue;
    if(check(i) == false) continue;
    Max(ans,n/i);
  }
  
  cout<<ans<<endl;
  return 0;
}




Measured memory_bytes: 4392
using System;

class MyClass
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int m = int.Parse(Console.ReadLine());
        int[] a = new int[2 * n];
        for (int i = 0; i < 2 * n; i++)
        {
            a[i] = i + 1;
        }
        for (int i = 0; i < m; i++)
        {
            int k = int.Parse(Console.ReadLine());
            int[] b = (int[])a.Clone();
            if (k == 0)
            {
                for (int j = 0; j < 2 * n; j++)
                {
                    a[j] = (j % 2 == 0) ? b[j / 2] : b[n + (j - 1) / 2];
                }
            }
            else
            {
                for (int j = 0; j < 2 * n; j++)
                {
                    a[j] = b[(k + j) % (2 * n)];
                }
            }
        }
        foreach (var item in a)
        {
            Console.WriteLine(item);
        }
    }
}


Measured memory_bytes: 5696
open Printf
open Scanf

let id x = x

let n = scanf "%d" id

let vs = Array.init n @@ fun i -> scanf " %d %d" (fun l r -> l, r)

let () =
    let c = ref 0 in
    Array.iteri (fun i (l, r) -> c := !c + (r - l + 1)) vs;
    printf "%d\n" !c


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int S = sc.nextInt();
        int count = 0;
            
            for(int X=0; X<=K; X++){
                for(int Y=0; Y<=K; Y++){
                    int Z = S-X-Y;
                    if(0<=Z && Z<=K){
                        count++;
                    }
                }
            }
            
            System.out.println(count); 
    } 
}


Measured memory_bytes: 35596
#include<stdio.h>
#define MAX 10000
#define NIL -1

typedef struct Node{int p,l,r;}Node;
struct Node T[MAX];
int n;

void preParse(int u){
  if(u==NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u==NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postParse(int u){
  if(u==NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(){
  int i,v,l,r,root;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l!=NIL) T[l].p = v;
    if(r!=NIL) T[r].p = v;
  }
  for(i=0;i<n;i++) if(T[i].p==NIL) root = i;

  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}



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

int main() 
{
	long long int n;
	cin>>n;
	string s;
	while(n>0)
	{
	    if(n%26)
	    s+='a'+(n%26)-1;
	    else
	    {
	        s+='z';
	        n--;
	    }
	    n/=26;
	}
	reverse(s.begin(),s.end());
	cout<<s;
	return 0;
}


Measured memory_bytes: 3560
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>


using namespace std;

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

#ifdef EBUG
#define debug(x) cout << "\033[31m" << #x << ": " << x << "\033[0m\n";
#else
#define debug(x)
#endif

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

string s;

int main() {
  cin >> s;
  if (s == "ABC") {
    cout << "ARC" << endl;
  } else {
    cout << "ABC" << endl;
  }
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] card = new string[3];
            for(int i = 0; i < 3; i++)
            {
                card[i]= Console.ReadLine();
            }
            int num = 0;
            while (true)
            {
                for (int i = 0; i < 3; i++)
                {
                    if (card[i] == "")
                    {
                        if (i == 0 && num == 0)
                        {
                            Console.WriteLine("A");
                            return;
                        }
                        else if (i == 1 && num == 1)
                        {
                            Console.WriteLine("B");
                            return;
                        }
                        else if (i == 2 && num == 2)
                        {
                            Console.WriteLine("C");
                            return;
                        }
                    }
                }
                string name = card[num].Substring(0,1);
                card[num] = card[num].Substring(1);
                if (name == "a")
                {
                    num = 0;
                }
                else if(name == "b")
                {
                    num = 1;
                }
                else if (name == "c")
                {
                    num = 2;
                }
            }
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


//Console.WriteLine(ans);


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


int main() {
  string a, b;
  cin >> a >> b;
  int x = stoi(a+b);
  rep(i,1000){
    if (i*i == x){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

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

int main(){
	int n=0;
	int nn=0;
	int k=0;
	int a=0;
	int b=0;
	int i=0;
	int t=0;
	int s[1000];
	
	cin>>n;
	cin>>k;
	if(n%2==1){
		nn=(n+1)/2;
	}else{
		nn=n/2;
	}
	for(i=0;i<k;i++){
		cin>>a;
		cin>>b;
		if(a>nn){
			a=n-a+1;
		}
		if(b>nn){
			b=n-b+1;
		}
		if(a<b){
			t=a;
		}else{
			t=b;
		}
		if(t%3==0){
			s[i]=3;
		}else{
			s[i]=t%3;
		}
	}
	for(i=0;i<k;i++){
		cout<<s[i]<<endl;
	}
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long 
#define M 1000000007
#define P pair<int,int>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) FOR(i,0,n)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int n,m;
char s[200][100],t[200][100];

int main(){
  cin>>n;
  rep(i,n)
  cin>>s[i];
  cin>>m;
  rep(i,m)
  cin>>t[i];

  int ans = 0;

  rep(i,n){
    int a = 0;
    rep(j,n){
      if(strcmp(s[i],s[j])==0) a++;
    }
    rep(j,m){
      if(strcmp(s[i],t[j])==0) a--;
    }
    ans = max(ans,a);
  }

  cout<<ans<<endl;

  return 0;
}
    


Measured memory_bytes: 256
M1,D1 = map(int,input().split())
M2,D2 = map(int,input().split())
a31 = [1,3,5,7,8,10,12]
a30 = [4,6,9,11]
if M1 in a31:
    if D1 == 31 and M2 == M1+1 and D2 == 1:
        print(1)
    else:
        print(0)
    
elif M1 in a30:
    if D1 == 30 and M2 == M1+1 and D2 == 1:
        print(1)
    else:
        print(0)
elif M1 == 2:
    if D1 == 28 and M2 == M1+1 and D2 == 1:
        print(1)
    else:
        print(0)


Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

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

#define el '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define vii vector<pii>
#define vvi vector<vector<int>>
#define vvii vector<vector<pii>>
#define vvll vector<vector<ll>>
#define umap unordered_map
#define uset unordered_set
#ifdef LOCAL
#define debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define debugrep(i, a, b) for (int i = a; i < b; i++)
#define check(...) assert(__VA_ARGS__)
#else
#define debug(fmt, ...)
#define debugrep(i, a, b)
#define check(...)
#endif

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

    int n;
    ll k;
    cin >> n >> k;
    vi a(n);
    rep(i, 0, n) {
        cin >> a[i];
        a[i]--;
    }
    int now = 0;
    vi dist(n, -1);
    dist[now] = 0;
    while (dist[a[now]] == -1) {
        dist[a[now]] = dist[now] + 1;
        now = a[now];
    }
    int loop_start = a[now];
    debug("loop_start=%d\n", loop_start + 1);
    int loop_len = dist[now] + 1 - dist[loop_start];
    int more, target;
    if (k <= dist[loop_start]) {
        more = k;
        target = 0;
    } else {
        more = (k - dist[loop_start]) % loop_len;
        target = loop_start;
    }
    rep(i, 0, more) {
        target = a[target];
    }
    cout << target + 1;
}


Measured memory_bytes: 4460
#include <iostream>
using namespace std;
int main(void){
  int n,a;
  while(cin>>n){
    a=n%39;
    if(a == 0)
         a=39;
    cout<<"3C";
    if(a<10)
    cout<<"0";
    cout<<a<<endl;
    }
    return 0;
  }


Measured memory_bytes: 3004
#include <iostream>
#include <iomanip>

using namespace std;

int main() {

  int a, c;char b;
  cin >> a; //>> b >> c;
  double ans, ra, rb;
  string dolphinManJotaro;
   if(a < 1200){
    cout << "ABC";
   }else{
     cout << "ARC";
   }
  return 0;
}


Measured memory_bytes: 3628
#define MOD 1000000007;
#define input ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll long long

#include <bits/stdc++.h>

using namespace std;
const int N = 3e5 + 5;
set<int> st[N+1];
int main() {

    int n;
    cin>>n;
    vector<int> vec;
    ll sum=0;
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        ll x;
        cin>>x;
        vec.push_back(x);
        sum+=x;
    }
    sum-=vec[0];
    ll sum2=vec[0];
    ans=abs(sum2-sum);
    for(int i=1;i<n-1;i++)
    {
        sum2+=vec[i];
        sum-=vec[i];
        ans=min(abs(sum2-sum),ans);
    }
    cout<<ans;

}

Measured memory_bytes: 15480
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
      	int B = sc.nextInt();
      	int C = sc.nextInt();
      	int K = sc.nextInt();
      	int ans = 0;
      	while(A >= B){
          B = B * 2;
          ans += 1;
        }
      	while(B >= C){
          C = C * 2;
          ans += 1;
        }
        if (K >= ans)
            System.out.println("Yes");
        else
            System.out.println("No");

    }
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

template <typename T>
bool Setmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  in(int, n);
  vector<int> memo(n + 1, -1);
  function<int(int)> rec = [&](int x) {
    if (x == 0) return 0;
    if (memo[x] == -1) {
      int mini = numeric_limits<int>::max();
      Setmin(mini, 1 + rec(x - 1));
      for (int i = 6; i <= x; i *= 6) {
        Setmin(mini, 1 + rec(x - i));
      }
      for (int i = 9; i <= x; i *= 9) {
        Setmin(mini, 1 + rec(x - i));
      }
      memo[x] = mini;
    }
    return memo[x];
  };
  out(rec(n));
}


Measured memory_bytes: 12972
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b,c,d; cin >> n >> a >> b >> c >> d; --a,--b,--c,--d;
    string s; cin >> s; s+= '#';
    auto judge = [&](int x, int y) {
        FOR(i,x,y) {
            if(s[i]=='#'  && s[i+1]=='#') {
                return false;
            }
        }
        return true;
    };
    auto btod = [&](int x, int y) {
        FOR(i,x,y+1) {
            if(s[i-1]=='.' && s[i]=='.' && s[i+1]=='.') {
                return true;
            }
        }
        return false;
    };
    bool ans = false;
    if(judge(a,c) && judge(b,d)) {
        if(c<d || btod(b,d)) ans = true;
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 592
N, D = map(int, input().split())
X = []



for _ in range(N):
    temp = list(map(int, input().split()))
    X.append(temp)

sq_list = set([])
for i in range(1, 151):
    sq_list.add(i ** 2)


cnt = 0
for i in range(N):
    Y = X[i]
    for j in range(i, N):
        Z = X[j]
        sum_val = 0
        for y, z in zip(Y, Z):
            sum_val += (y - z) ** 2
        if sum_val in sq_list:
            cnt += 1

print(cnt)


Measured memory_bytes: 3064
/*
   Author : BabaYaga42,
   BITS Pilani, Hyderabad.
   Don't give up ;)
   */
#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")

#include<bits/stdc++.h>

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define big long long
using namespace std;

const int N = 1e5+5,MOD = 1000000007;
const long long int INF = 0xFFFFFFFFFFFFFFFL;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void IOS()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
   	cout.precision(10);
   	cout << fixed;
}

int32_t main()
{
	IOS();
	int n,h,w;
	cin >> n >> h >> w;
	int ans = (n-h+1)*(n-w+1);
	cout << ans;
	return 0;
}


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

long long gcd(long long a, long long b) {
        while (b) {
                a %= b;
                swap(a, b);
        }
        return a;
}

int main() {
        int n;
        scanf("%d", &n);
        vector<int> a(n);
        rep(i, n) {
                scanf("%d", &a[i]);
        }
        vector<int> gl(n), gr(n);
        gl[0] = a[0];
        rep(i, n) if (i) gl[i] = gcd(gl[i - 1], a[i]);
        gr[n - 1] = a[n - 1];
        for (int i = n - 2; i >= 0; i --) {
                gr[i] = gcd(gr[i + 1], a[i]);
        }
        int ans = 1;
        rep(i, n) {
                ans = max(ans, (int) gcd(i ? gl[i - 1] : 0, i < n - 1 ? gr[i + 1] : 0));
        }
        printf("%d\n", ans);
        return 0;
}


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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::vector<long long> a){
  long long two = 0;
  long long four = 0;
  long long notandf = 0;

  for(long long i = 0; i < N; i++){
    if(a[i] % 4 == 0) four++;
    else if(a[i] % 2 == 0) two++;
    else notandf++;
  }

  if(four > 0 && (((two == 0) ? four : four-1) >= (notandf-1))) {
    cout << YES << endl;
  }
  else if(notandf == 0) {
    cout << YES << endl;
  }
  else {
    cout << NO << endl;
  }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  std::vector<long long> a(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&a[i]);
  }
    solve(N, std::move(a));
    return 0;
}


Measured memory_bytes: 1024
S = input()
S += "R"
flag = "R"
cnt = 0
r = 0
ans = []
for i in range(len(S)):
    if flag == "R":
        if S[i] == "R":
            cnt += 1
            r += 1
        elif S[i] == "L":
            flag = "L"
            cnt += 1
    elif flag == "L":
        if S[i] == "L":
            cnt += 1
        else:
            r -= 1
            flag = "R"
            tmp = [cnt//2 if ((j == r) or (j == r + 1)) else 0 for j in range(cnt)]
            if cnt % 2:
                if r % 2:
                    tmp[r + 1] += 1
                else:
                    tmp[r] += 1
            ans.extend(tmp)
            r = 1
            cnt = 1

print(*ans)


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

int main()
{
  string s;
  cin>>s;
  int sum=0;
for(int i=0;i<s.size();i++)
{
    string c;
    c=s[i];
    int d=stoi(c);
    sum+=d;
}
 
if(sum%9==0)
    cout<<"Yes";
else
    cout<<"No";
    
return 0;
}

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

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

    const int v=1000000000;

    int x=(v-s%v)%v;
    int y=(s+x)/v;

    cout << "0 0 1000000000 1 " << x << " "<< y << endl;
}

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


int main() {
  int h, w; cin >> h >> w;
  for(int i = 0; i < w+2; i++){
    cout << "#";
  }
  cout << endl;
  char a[h][w];
  for(int i = 0; i < h ; i++)
    for(int j = 0; j < w; j++) cin >> a[i][j];
  for(int i = 0; i < h; i++){
    cout << "#";
    for(int j = 0; j < w; j++){
      cout << a[i][j];
    }
    cout << "#" << endl;
  }
  for(int i = 0; i < w+2; i++)
    cout << "#";
  cout << endl;
}


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


   long long int i,j,k,n,m,t;
   cin>>n;
   long long a[n];
   for(i=0;i<n;i++)
   {
       cin>>a[i];
   }
   j=0;
   long long mi=a[0];
   for(i=0;i<n;i++)
   {
       if(a[i]<mi)
       {
           j=j+mi-a[i];
           a[i]=mi;
       }
       if(a[i]>=mi)
       {
           mi=a[i];
       }
   }
   cout<<j<<endl;





return 0;
}


Measured memory_bytes: 5156
#include <iostream>
using namespace std;
 
int main() {
	int a, b, c, count,mod;
	count = 0;
	cin >> a >> b >> c;
	for(int i = a; i <= b; i++){
		mod = c % i;
		if(mod == 0){
			count += 1;
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
const double eps = 1e-8;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T> ostream& operator << (ostream& os, const set<T>& s) { for (auto si : s) os << si << " "; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { (a += (b % mod + mod)) %= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12);
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    int n; ll d, a;
    cin >> n >> d >> a;
    
    vector<pll> v(n);
    rep(i, n) cin >> v[i].F >> v[i].S;
    sort(all(v));
    
    ll sum = 0, ans = 0;
    priority_queue<pll, vector<pll>, greater<> > q;
    rep(i, n) {
        while (sz(q)) {
            pll q_ = q.top();
            if (q_.F < v[i].F) {
                q.pop();
                sum -= q_.S;
            } else {
                break;
            }
        }
        v[i].S -= sum;
        if (v[i].S <= 0) continue;
        ll cnt = (v[i].S + a - 1) / a;
        // cerr << i << " " << cnt << endl;
        ans += cnt;
        sum += cnt * a;
        q.emplace(v[i].F + 2 * d, cnt * a);
    }
    cout << ans << endl;
}


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

using namespace std;
#define int long long
#define endl '\n'

int cntt(int a) {
    int ans = 0;
    while (a) {
        ans += a % 2;
        a /= 2;
    }
    return ans;
}

int pw(int a, int k, int mod) {
    if (k == 0) return 1;
    if (k % 2) {
        return (pw(a, k - 1, mod) * a) % mod;
    }
    int t = pw(a, k / 2, mod);
    return (t * t) % mod;
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n; cin >> n;
    string s; cin >> s;
    int x1 = 0, x2 = 0, cnt = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '1') cnt++;
    }
    for (int i = 0; i < n; i++) {
        x1 *= 2;
        x2 *= 2;
        if (s[i] == '1') {
            x1++;
            x2++;
        }
        if (cnt <= 1) x1 = 0;
        else x1 %= (cnt - 1);
        x2 %= (cnt + 1);
    }
    for (int i = 0; i < n; i++) {
        int q;
        if (s[i] == '0') {
            q = x2;
            q += pw(2, n - i - 1, cnt + 1);
            q %= (cnt + 1);
        }
        else {
            if (cnt == 1) {
                cout << 0 << endl;
                continue;
            }
            q = x1 + cnt - 1;
            q -= pw(2, n - i - 1, cnt-1);
            q %= (cnt - 1);
        }
        int ans = 1;
        while (q != 0) {
            q %= cntt(q);
            ans++;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3744
/// In The Name Of God

#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)

#define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (int)5e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

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

using namespace std;

int n, m;
int a[N], b[N];
int main() {
	#ifdef wws
		freopen ("in.txt", "r", stdin);
	#endif
	Kazakhstan
	cin >> n >> m;
	rep(i, 1, n) b[i] = 1;
	a[1] = 1;
	rep(i, 1, m) {
		int v, u;
		cin >> v >> u;
		if (a[v]) {
			a[u] = 1;
		}
		b[v]--, b[u]++;
		if (!b[v]) a[v] = 0;
	}	
	int ans = 0;
	rep(i, 1, n) {
		ans += a[i] > 0;
		// cout << a[i] << nl;
	}
	cout << ans;
	ioi
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl
ll GCD(ll a, ll b){
    if(b == 0) return a;
    else return GCD(b,a%b);
}

ll LCM(ll a, ll b){
    return (a*b/GCD(a,b));
}

int main(){
  ll N;
  cin >> N;
  cout << LCM(N,2) << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    int a[N], b[N];
    rep(i, N) cin >> a[i];
    rep(i, N) cin >> b[i];
    ll ans = 0;
    if(N%2 == 1){
        rep(i, N){
            ans ^= a[i];
            ans ^= b[i];
        }
    }
    //2進数で表したときの下から(i+1)桁目の繰り上がりの回数を調べる
    rep(i, 30){
        //繰り上がりの回数
        ll cnt = 0;
        //A[i]:=a[i]の下i桁、B[i]:=b[i]の下i桁
        int A[N], B[N];
        fill(A, A+N, 0), fill(B, B+N, 0);
        rep(j, N){
            A[j] = a[j]%(1<<i);
            B[j] = b[j]%(1<<i);
        }
        sort(B, B+N);
        rep(j, N){
            cnt += B+N - lower_bound(B, B+N, (1<<i)-A[j]);
        }
        if(cnt%2 == 1) ans ^= (1<<i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
N = int(input())
A = tuple(map(int,input().split()))

def solve(f):
    acc = 0
    cnt = 0
    for a in A:
        acc += a
        if f and acc <= 0:
            cnt += 1 - acc
            acc = 1
        elif not f and acc >= 0:
            cnt += acc + 1
            acc = -1
        f = not f
    return cnt

print(min(solve(True),solve(False)))

Measured memory_bytes: 20100
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
from bisect import bisect_left as bl,bisect_right as br
for i in range(n):
    for j in range(i+1,n):
        a,s=l[i],l[j]
        ans+=-1-int(s<2*a)+bl(l,a+s)-br(l,s-a)
print(ans//3)

Measured memory_bytes: 48860
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _20170410_AOJ
{
    class ALDS1_9C
    {
        static void Main(string[] args)
        {
            int[] S = new int[2000000 + 1];
            for (;;)
            {
                string[] command = Console.ReadLine().Split(' ');
                if (command[0] == "end")
                {
                    break;
                }

                switch (command[0])
                {
                    case "insert":
                        Insert(S, int.Parse(command[1]));
                        break;
                    case "extract":
                        int max = ExtractMax(S);
                        Console.WriteLine(max);
                        break;
                }
            }
            
            Console.ReadLine();
        }

        static void Insert(int[] heap, int k)
        {
            heap[0]++;
            int count = heap[0];

            heap[count] = k;
            BuildPartialMaxHeap(heap);
        }

        static int ExtractMax(int[] heap)
        {
            int max = heap[1];
            int count = heap[0];
            heap[1] = heap[count];
            heap[0]--;
            BuildPartialMaxHeap(heap);

            return max;
        }

        static void BuildMaxHeap(int[] A)
        {
            int h = A[0];
            for (int i = h / 2; i >= 1; i--)
            {
                MaxHeapify(A, i);
            }
        }

        static void BuildPartialMaxHeap(int[] A)
        {
            int h = A[0];
            while (h > 1)
            {
                h /= 2;
                MaxHeapify(A, h);
            }
        }

        static void MaxHeapify(int[] A, int i)
        {
            int l = i * 2;
            int r = l + 1;
            int h = A[0];
            int largest = 0;

            if (l <= h && A[l] > A[i])
            {
                largest = l;
            }
            else
            {
                largest = i;
            }

            if (r <= h && A[r] > A[largest])
            {
                largest = r;
            }

            if (largest != i)
            {
                int temp = A[i];
                A[i] = A[largest];
                A[largest] = temp;
                MaxHeapify(A, largest);
            }
        }
    }
}



Measured memory_bytes: 23428
#include <bits/stdc++.h>
 
using namespace std;
 
 
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n,w;
    cin>>n>>w;
    vector<vector<long long>> dp(n+1,vector<long long>(w+1));
    vector<pair<int,int>> data(n+1);
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        data[i+1]={a,b};
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=w;j++){
            dp[i][j]=dp[i-1][j];
            if(data[i].first<=j){
                dp[i][j]=max(dp[i][j],dp[i-1][j-data[i].first]+data[i].second);
            }
        }
    }
    cout<<dp[n][w]<<'\n';
    return 0;
}

Measured memory_bytes: 83200
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}


int main() {
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  int ans=1000000007;
  for(int i=0;i<=100000;i++){
      int sum=2*C*i+A*max(X-i,0)+B*max(Y-i,0);
      ans=min(ans,sum);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>//coded by Nurstan ^_^

#define ll long long
#define pb push_back

#define mp make_pair
#define lb lower_bound
#define ub upper_bound

#define all(x) x.begin(), x.end()
#define F first
#define S second

// fixed << setprecision
// next_permutation(a, a + n)
// set <int> :: iterator it = x.begin(); it != x.end(); it ++

using namespace std;

inline void boost(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

int main(){
	boost();
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	int l = 0, r = 0;
	for(int i = 0; i < n; i ++) {
		int k;
		cin >> k;
		if(k % 2 != 0) {
			r ++;
		}
	}
	if(r % 2 == 0) {
		cout << "YES";
		return 0;
	}
	else {
		cout << "NO";
		return 0;
	}
	exit(0);
}



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

#define int long long
//typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

int five(int N){
    int ret=0;
    while(N>0){
        ret+= N/5;
        N/=5;
    }
    return ret;
}

int two(int N){
    int ret=0;
    while(N>0){
        ret+=N/2;
        N/=2;
    }
    return ret;
}

int calc(int N){
    int ret=1;
    for(int i=N; i>0; i-=2)
        ret*=i;
    return ret;
}

signed main() {
    int N;
    cin >> N;

//    rep(N,30){
//        cerr << ":" << N << endl;
    if(N==5 || N==7 || N==9){cout<<0<<endl; return 0;}
    
//    rep(i,30){
//        cout << i << "," << calc(i) << endl;
//    }
    
    if(N%2==0){
        cout << five(N/2) << endl;
    }else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
int i=0;

int main(void)
{
    int A,B,a[3],max;
    scanf("%d\t%d",&A,&B);
    a[0]=A+B;
    a[1]=A-B;
    a[2]=A*B;
    max=a[0];
    for(i=1;i<3;i++)
    {
        if(max<a[i])
        {
            max=a[i];
        }
    }
    printf("%d",max);
    return 0;
    
}

Measured memory_bytes: 128