akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) v.begin(), v.end()

int main(){
    int N; cin >> N;
    vector<int> L(N), R(N);
    for (int i = 0; i < N; i++)
    {
        ll u;cin >> u; ll j = i;
        L.at(i) = u + i + 1;
        R.at(i) = j + 1 - u;
    }
    map<ll, ll> X;ll res = 0;
    for (int i = 0; i < N; i++)
    {
        res += X[R.at(i)];
        X[L.at(i)]++;
    }
    cout << res << endl;
}
    

Measured memory_bytes: 27560
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var one = nextIntArray();
	var N = one[0];
	var K = one[1];
	var list = nextIntArray();
	var queue = [];
	var output = [];
	for(var i = 0; i < N; i++){
		if(i < K){
			queue.push(list[i]);
		}else{
			if(queue[0] < list[i]){
				output.push("Yes");
			}else{
				output.push("No");
			}
			queue.shift();
			queue.push(list[i]);
		}
	}
	myout(myconv(output, 9));
}


Measured memory_bytes: 58752
s = gets.chomp.split(//)
a = (0...(2**(s.length-1))).map{|i|
	m = i.to_s(2)
	(s.length-m.length-1).times{ m = "0" + m }
	m
}
sum = 0
a.each{|n|
	r = "";
	s.each_with_index{|x,i|
		r += x
		r += "+" if n[i] == "1"
	}
	sum += eval(r)
}
puts sum

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

int main() {
	int a,b;
	cin>>a>>b;
	int c;
	if( (a+b)%2==0 )c=(a+b)/2;
	else c=((a+b)/2)+1;
	cout<<c<<endl;
	return 0;
	}

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

using namespace std;

/*
1. traverse the graph to the end, find the max
2. positive cycle detection

*/
void solve(long long N, long long M, long long P, std::vector<long long> A, std::vector<long long> B, std::vector<long long> C)
{
    // turn path to minus so that we can find transfrom it to a shortest path problem
    for (auto &c : C)
    {
        c = -1 * c + P;
    }

    const long long inf = INT_MAX + 1LL;

    vector<long long> dist(N, inf);
    dist[0] = 0;

    bool negativeCycle = false;
    // do V-1 iterations
    for (int i = 0; i < N * 2; ++i)
    {
        // for every edge
        for (int j = 0; j < M; ++j)
        {
            if (dist[A[j] - 1] < inf)
            {
                // do relaxation
                if (dist[B[j] - 1] > dist[A[j] - 1] + C[j])
                {
                    if (i < N)
                    {
                        dist[B[j] - 1] = dist[A[j] - 1] + C[j];
                    }
                    else
                    {
                        dist[B[j] - 1] = -inf;
                    }
                }
            }
        }
    }
    if (dist[N - 1] == -inf)
    {
        cout << -1;
    }
    else
    {
        cout << max(0LL, -dist[N - 1]);
    }
}

// Generated by 1.1.4 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()
{

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

    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    long long P;
    scanf("%lld", &P);
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    std::vector<long long> C(M);
    for (int i = 0; i < M; i++)
    {
        scanf("%lld", &A[i]);
        scanf("%lld", &B[i]);
        scanf("%lld", &C[i]);
    }
    solve(N, M, P, std::move(A), std::move(B), std::move(C));
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
    bool is_prime[1000000];

    is_prime[0] = is_prime[1] = false;
    for(int i=2; i<1000000; i++){
        is_prime[i] = true;
    }

    for(int i=2; i*i<1000000; i++){
        if(is_prime[i]){
            for(int j=i*i; j<1000000; j+=i){
                is_prime[j] = false;
            }
        }
    }
    int n_prime[1000000];
    int cnt = 0;
    for(int i=0; i<1000000; i++){
        if(is_prime[i]){
            cnt++;
        }
        n_prime[i] = cnt;
    }
    while(true){
        int n;
        cin >> n;
        if(cin.eof())
            break;
        cout << n_prime[n] << endl;
    }
    return 0;
}



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

int main(){
  string s;
  cin >> s;
  rep(i,3){
    cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3596
def f(k):
    cnt=0
    left=N-1
    
    for i in range(N):
        while A[i]+A[left]<k:
            left-=1
            if left<0:
                break
        else:
            cnt+=left+1
            continue
        break
        
    if cnt>=M:
        return True
    else:
        return False

N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
S=[A[0]]
for i in range(1,N):
    S.append(S[-1]+A[i])
low=0
high=2*10**5+100
while high-low>=1:
    mid=(high+low)//2
    if f(mid):
        if low==mid:
            if f(high):
                low=high
            break
        low=mid
    else:
        high=mid
left=N-1
ans=0
cnt=M
for i in range(N):
    while A[i]+A[left]<low:
        left-=1
        if left<0:
            break
    else:
        ans+=A[i]*(left+1)+S[left]
        cnt-=left+1
        continue
    break
print(ans+cnt*low)

Measured memory_bytes: 56768
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
int N;
int ko =0;
int roop = 3;
string a[3] = {"3","5","7"};
void dfs(string A){
    if (A.size() == roop) {
        if(A.find("3") != -1&&A.find("5") != -1&&A.find("7")!=-1){
           int num = atoi(A.c_str());
           if(num <= N)ko += 1;
        }
        return;
    }

    for (int v = 0; v < 3; ++v) {
        A += a[v];
        dfs(A);
        A.erase( --A.end() );
    }
}

int main() {
    cin>>N;
    string A;
    for(int i = 0;i<10;i++){
      dfs(A);
      roop += 1;
      if(roop == 10)break;
    }
    cout<<ko;
    return 0;
}

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

int main() {

    string S;
    cin >> S;

    bool isMMYY = false;
    int a = stoi(S.substr(0, 2));
    if (1 <= a && a <= 12){
        isMMYY = true;
    }

    bool isYYMM = false;
    int b = stoi(S.substr(2, 4));
    if (1 <= b && b <= 12){
        isYYMM = true;
    }

    string ans;
    if (isYYMM && isMMYY){
        ans = "AMBIGUOUS";
    }else if (isYYMM){
        ans = "YYMM";
    }else if (isMMYY){
        ans = "MMYY";
    }else{
        ans = "NA";
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int n;
  cin >>n;
  pair<pair<string,int>,int> p[n];
  
  rep(i,n){
    string s;
    int k;
    cin >>s>>k;
    p[i] = make_pair(make_pair(s,-k),i+1);
  }
  sort(p,p+n);
  
  rep(i,n){
    cout<< p[i].second << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string S, T;
  cin >> S >> T;
  ll ans = 0;
  for (int i = 0; i < S.size(); i++)
    if (S[i] != T[i])
      ans++;
  cout << ans << endl;
  return 0;
}



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

#define long long long int
using namespace std;


#ifdef JUDGE
std::ifstream cin("input.txt");
std::ofstream cout("output.txt");
#else
using std::cin;
using std::cout;
#endif

using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(6);


    int k, l, r;
    cin >> k >> l >> r;
    for (int i = l; i <= r; ++i) {
        if (i % k == 0) {
            cout << "OK";
            return 0;
        }
    }
    cout << "NG";
    return 0;


}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n;
    cin>>n;
    ll a[n];
    ll dp[n+1][n+1][2];
    memset(dp,0,sizeof(dp));
    for(ll x=0;x<n;x++)
    {
      cin>>a[x];
      dp[x][1][0]=a[x];
      dp[x][1][1]=-a[x];
    }
    for(ll x=2;x<=n;x++)
    {for(ll y=0;y<=n-x;y++)
    {dp[y][x][0]=max(a[y]+dp[y+1][x-1][1],a[y+x-1]+dp[y][x-1][1]);
     dp[y][x][1]=min(-a[y]+dp[y+1][x-1][0],-a[y+x-1]+dp[y][x-1][0]);}}
     cout<<dp[0][n][0]<<endl;
}


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

int main() {
	int n;
	cin>>n;
	int A[n],ans[n];
	for(int i=0;i<n;i++)
		cin>>A[i];
	int a=abs(A[1]-A[0]),b=abs(A[2]-A[0]),c=abs(A[2]-A[1]);
	ans[0]=0;
	ans[1]=a;
	ans[2]=min(b,a+c);
	for(int i=3;i<n;i++)
	{
		int x=ans[i-1]+abs(A[i]-A[i-1]),y=ans[i-2]+abs(A[i]-A[i-2]);
		ans[i]=min(x,y);
	}
	cout<<ans[n-1];
	return 0;
}

Measured memory_bytes: 1024
n,m=map(int,input().split())
XYZ = [list(map(int,input().split())) for i in range(n)]

res = 0
for i in range(8):
    s = []
    t = 0
    for j in range(n):
        total = 0
        for k in range(3):
            if ((i >> k) & 1) == 1:
                total += XYZ[j][k]
            else:
                total -= XYZ[j][k]
        s.append(total)
    s.sort(reverse=True)
    for i in range(m):
        t += s[i]
    if res < t:
        res = t
print(res)

Measured memory_bytes: 43888
#ifndef bhartiya
    // #pragma GCC optimize("Ofast")
    // #pragma GCC optimize("unroll-loops")
    // #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
// not that imp
typedef pair<pll, ll> plll;
typedef vector<ll> vl;
typedef vector<pll> vll;

#define pb push_back
#define bitc  __builtin_popcountl
#define mp make_pair
#define ff first
#define ss second

#define swap(a,b) {a=a^b;b=a^b;a=a^b;}
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)

#ifdef bhartiya
#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...);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
					  cout << "\n\nTime elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
}
#else
#define endl '\n'
#define trace(...)
#define start_routine()
#define end_routine()
#endif

#define inf 200000000000000ll
#define mod 1000000007ll
#define eps 1e-7

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

ll n;
string s;
const ll maxn = 3005;
ll dp[maxn][maxn];

int main() 
{ 
    start_routine();
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.precision(10);
    cin.exceptions(cin.failbit);
    #ifdef bhartiya
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin>>t;
    while(t--){
        cin>>n>>s;
        dp[n][1] = 1;
        for(ll i=n-1;i>0;i--){
            for(ll j=1;j<=n-i+1;j++){
                if(s[i-1] == '>'){
                    dp[i][j] = (dp[i][j-1] + dp[i+1][j-1])%mod;
                }
                else{
                    dp[i][j] = (dp[i][j-1] + dp[i+1][n-i] - dp[i+1][j-1] + mod)%mod;
                }
            }
        }
        cout<<dp[1][n];
    }
    end_routine();
}

Measured memory_bytes: 70016
import sys
input=sys.stdin.readline

n,k=map(int,input().split())
xy=[tuple(map(int,input().split())) for _ in range(n)]
X=sorted(set(xy[i][0] for i in range(n)))
Y=sorted(set(xy[i][1] for i in range(n)))


from itertools import combinations

ans=10**20
for x1,x2 in combinations(X,2):
    for y1,y2 in combinations(Y,2):
        c=0
        for x,y in xy:
            if x1<=x<=x2 and y1<=y<=y2:
                c+=1
        if c>=k:
            ans=min(ans,(x2-x1)*(y2-y1))
print(ans)


Measured memory_bytes: 45676
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Main{
    public static void main(String[] args) {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }
	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		String[] splits = lines.get(i).split(" ");
		Integer H = Integer.parseInt(splits[0]);
		Integer W = Integer.parseInt(splits[1]);
		if (H==0&&W==0) {
		    System.exit(0);
		}

		for (int h = 0; h < H; h++) {
		    char[] chars = new char[W];
		    Arrays.fill(chars, '#');
		    System.out.println(new String(chars));
		}
		System.out.println("");
	    }
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    }
}

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

int main()
{

  int n;
  cin >> n;

  vector<vector<long long>> dp(n, vector<long long>(3,0));
  for(int i=0;i <n; i++)
    cin >> dp[i][0] >> dp[i][1] >> dp[i][2];

  long long mx =INT_MIN;

  for(int i=1; i<n; i++)
  {
    for(int j=0; j<3; j++)
    {
      mx =INT_MIN;
      for(int k=0; k<3; k++)
      {
        if(k!=j)
          mx = max(mx, dp[i-1][k]);
      }
      dp[i][j] += mx;
    }
  }

  cout<<max(max(dp[n-1][0] , dp[n-1][1]) , dp[n-1][2]); 
  return  0;

}


Measured memory_bytes: 5760
#include <iostream>
#include <sstream>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <queue>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ul;
typedef pair<int,int> P;
#define X first
#define Y second

const int mod = 998244353;

bool check(vector<int> &xs) {
	int s = 0;
	for(int x : xs) s += x;
	if(s%2==1) return false;
	s /= 2;
	vector<char> mask(s+1,0);
	mask[0] = 1;
	for(int x : xs) {
		for(int i = s-x; i>=0; i--) if(mask[i]) mask[i+x] = 1;
	}
	// for(int x : xs) cout << x << " "; cout << endl;
	// for(int x : mask) cout << x << " "; cout << endl;
	return mask[s];
}

void go() {
	string s; cin >> s;
	s += 'T';
	int x,y; cin >> x >> y;
	int j = 0;
	for(int i = 0; i < s.length(); i++) {
		if(s[i]=='T') {
			j = i;
			x -= i;
			break;
		}
	}
	vector<int> xs,ys;
	if(x<0) x = -x;
	if(y<0) y = -y;
	// cout << x << "," << y << endl;
	if(x) { xs.push_back(x); } 
	if(y) { ys.push_back(y); }
	x = 0; y = 0;

	int f = 0;
	for(int i = j; i < s.length(); i++) {
		if(s[i]=='T') {
			// cout << x << "-" << y << endl;
			if(x) { xs.push_back(x); } 
			if(y) { ys.push_back(y); }
			x = 0; y = 0;
			f = 1-f;
		} else {
			if(f==0) x++;
			else y++;
		}
	}
	if(x) { xs.push_back(x); } 
	if(y) { ys.push_back(y); }
	if(check(xs) && check(ys)) cout << "Yes" << endl;
	else cout << "No" << endl;
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	// int t; cin >> t; for(;t--;)
	go();
	return 0;
}




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

int main(void){

  int num1,num2;

  cin >> num1 >> num2;

  if(num1 > num2) cout << "a > b" << endl;
  else if(num1 < num2) cout << "a < b" << endl;
  else cout << "a == b" << endl;

  return 0;

}

Measured memory_bytes: 1156
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int A = sc.nextInt();
    int answer = 0;
    if(H%A==0){
      answer = H/A;
    }else{
      answer = H/A+1;
    }
    System.out.println(answer);
  }
  

  
}

Measured memory_bytes: 23892
using System;

namespace AtCoder
{
  public class Program
  {
    static void Main(string[] args)
	  {
      int target = 0;
      string[] input = Console.ReadLine().Split(' ');
      int[] nums = new int[5];
      for (int i = 0; i < 5; i++)
      {
        nums[i] = int.Parse(input[i]);
      }
      for (int i = 0; i < 5; i++)
      {
        if (nums[i] == 0)
        {
          target = i + 1;
        }
      }
      Console.WriteLine(target);
	  }
  }
}


Measured memory_bytes: 27328
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int i;
    int add = 0;
    for(i = 1;i <= n;i++){
      add = add + i;
    }
    System.out.println(add);
  }
}


Measured memory_bytes: 21844
class dice():
    def __init__(self):
        self.number = [i for i in range(6)]
        self.work = [i for i in range(6)]
    
    def setnum(self,s):
        self.number = s

    def kai(self,h):
        tmp = self.number
        if h == 'E':
            self.number = [tmp[3],tmp[1],tmp[0],tmp[5],tmp[4],tmp[2]]
        elif h == 'S':
            self.number = [tmp[4],tmp[0],tmp[2],tmp[3],tmp[5],tmp[1]]
        elif h == 'W':
            self.number = [tmp[2],tmp[1],tmp[5],tmp[0],tmp[4],tmp[3]]
        elif h == 'N':
            self.number = [tmp[1],tmp[5],tmp[2],tmp[3],tmp[0],tmp[4]]

    def Qright(self,up,flont,num):
        uf = (up,flont)
        if uf == (num[1],num[2]) or uf ==(num[2],num[4]) or uf ==(num[4],num[3]) or uf ==(num[3],num[1]):
            ans = num[0]
        elif uf == (num[0],num[3]) or uf ==(num[3],num[5]) or uf ==(num[5],num[2]) or uf ==(num[2],num[0]):
            ans = num[1]
        elif uf == (num[0],num[1]) or uf ==(num[1],num[5]) or uf ==(num[5],num[4]) or uf ==(num[4],num[0]):
            ans = num[2]
        elif uf == (num[0],num[4]) or uf ==(num[4],num[5]) or uf ==(num[5],num[1]) or uf ==(num[1],num[0]):
            ans = num[3]
        elif uf == (num[0],num[2]) or uf ==(num[2],num[5]) or uf ==(num[5],num[3]) or uf ==(num[3],num[0]):
            ans = num[4]
        elif uf == (num[1],num[3]) or uf ==(num[3],num[4]) or uf ==(num[4],num[2]) or uf ==(num[2],num[1]):
            ans = num[5]
        print(ans)


num = list(map(int,input().split()))
#kaitenn = input()
q = int(input())
dice = dice()
dice.setnum(num)
for i in range(q):
    up,flont = map(int,input().split())
    dice.Qright(up,flont,num)
#print(dice.number[0])


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


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

    int ans=0;
    rep(i,n){
        if((i+1)*a[i] % 2 == 1) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define                MXX 100005
#define                FAST_IO ios_base::sync_with_stdio(false),cin.tie(NULL)
#define                exit() return 0
#define                mpii map<int, int>
#define                mpit map<int, int>::iterator it
#define                si set<int>
#define                sit set<int>::iterator it;
#define                ll long long int
#define                endl "\n";
const                  ll INF = 2000000000000000000LL;
const                  int MOD = 10000007;
ll a[MXX], b[MXX], c[MXX], dp[MXX][5], N;
ll solve(ll i, ll j)
{
    if(i == N)
    {
        return 0;
    }
    if(dp[i][j]!=-1) return dp[i][j];
    ll mxp = -2e14;
    if(j!=0)
    {
        mxp = max(solve(i+1, 0)+a[i], mxp);
    }
    if(j!=1)
    {
        mxp = max(solve(i+1, 1)+b[i], mxp);
    }
    if(j!=2)
    {
        mxp = max(solve(i+1, 2)+c[i], mxp);
    }
    return dp[i][j] = mxp;
}
int main()
{
    FAST_IO;
    //ll N;
    cin>>N;
    memset(dp, -1, sizeof(dp));
    for(ll i = 0; i<N; i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    cout<<solve(0, 100)<<endl;
    return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <vector>
using namespace std;
int main(){
    vector<int> antenna(5);
    for(auto i = antenna.begin(); i < antenna.end(); i++){
        cin >> *i;
    }
    int k;
    cin >> k;
    for(auto i = antenna.begin(); i < antenna.end(); i++){
        for(auto j = antenna.begin() + distance(antenna.begin(), i) + 1; j < antenna.end(); j++){
            if(abs(*i - *j) > k){
            cout << ":(" << endl;
            return 0;
        }
        }
    }
    cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <math.h>
int a(void);

int main(void) {
	a();
	return 0;
}

int a(void) {
	int M1, D1, M2, D2;
	std::cin >> M1 >> D1;
	std::cin >> M2 >> D2;
	if (M1 != M2) {
		std::cout << 1;
	}
	else {
		std::cout << 0;
	}
	return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)    (x).begin(),(x).end()
# define UNIQ(c)   (c).erase(unique(ALL((c))), end((c)))
# define mp        make_pair
# define eb        emplace_back
# define REP       (i, a) for (int i = 0; i < (a); i++)
# define INIT      std::ios::sync_with_stdio(false);std::cin.tie(0);

#define int LL
int fact[222222];
const int MOD = 1000000007;

int power(int x, int n) {
	int tmp = 1;

	if (n>0) {
		tmp = power(x, n / 2);
		if (n % 2 == 0) tmp = (tmp*tmp) % MOD;
		else tmp = (((tmp*tmp) % MOD)*x) % MOD;
	}
	return tmp;
}

void f() {
	fact[0] = fact[1] = 1;
	for (int i = 2; i < 222222;i++) fact[i] = (fact[i - 1] * i) % MOD;
}

int com(int h, int w) {
	return (fact[h + w] * power((fact[h] * fact[w]) % MOD, MOD - 2)) % MOD;
}

signed main() {
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	f();

	int ans = com(h - 1, w - 1);

	int sub = 0;

	for (int i = h - a; i<h; i++) {
		sub += (com(i, b - 1) * com(h - 1 - i, w - 1 - b)) % MOD;
		sub %= MOD;
	}

	ans -= sub;

	while (ans<0) ans += MOD;

	cout << ans%MOD << endl;

}

Measured memory_bytes: 1920
n, k = [int(item) for item in input().split()]
s = input()
arr = []
c = 0
if s[0] == "0":
  cur = "0"
  arr.append(0)
else:
  cur = "1"

for i in s:
  if i == cur:
   c += 1
  else:
    cur = i
    arr.append(c)
    c = 1
arr.append(c)
if s[-1]== "0":
  arr.append(0)

nk = 2 * k + 1
cusum = sum(arr[:nk])
mnum = cusum
for i in range(nk, len(arr), 2):
  cusum += -(arr[i-nk]) + arr[i] -(arr[i-nk+1]) + arr[i+1]
  mnum = max(mnum, cusum)
print(mnum)

Measured memory_bytes: 4476
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<complex>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph=vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;


int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;

	double l;
	cin >> l;

	cout << pow(l / 3, 3) << endl;

	return 0;
}

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

int N;
long long K;
vector<long long> a;
 
int main() {
    int N;
    cin >> N;
    int x,y;
    vector<pair<int, int> > v(N);
    for (int i = 0; i < N; i++){
        cin >> x >> y;
        v[i] = make_pair(y, x);
    }
    sort(v.begin(), v.end());
    
    long long sums = 0;
    for (int i = 0; i < N; i++)
    {
        sums += v[i].second;
//        cout << sums << ":" << v[i].first << endl;
        if(sums > v[i].first){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 1792
def add_list(buf, new_lists, removals):
    l = len(buf)
    if l >= k:
        sbf = sorted(buf)
        removals.extend(sbf[:l - k + 1])
        new_lists.append(buf)


n, k, q = map(int, input().split())
aaa = list(map(int, input().split()))
srt = sorted(set(aaa))
lists = [aaa]
ans = float('inf')
for a in srt:
    new_lists = []
    removals = []
    for lst in lists:
        buf = []
        for b in lst:
            if a > b:
                add_list(buf, new_lists, removals)
                buf = []
            else:
                buf.append(b)
        add_list(buf, new_lists, removals)
    if len(removals) < q:
        break
    removals.sort()
    ans = min(ans, removals[q - 1] - a)
    lists = new_lists

print(ans)


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

const int N = 1100000;

int main() {
#ifdef Hwang_Baek_I
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	long long n; cin >> n;
	set<long long> S;
	for (int i = 1; (long long)i * i <= n; i++) {
		if (n % i) continue;
		long long m, k;
		m = i - 1, k = n / i;
		if (m > k) S.insert(m);
		m = n / i - 1, k = i;
		if (m > k) S.insert(m);
	}
	long long ans = 0;
	for (long long t : S) ans += t;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	char c[100001];
	int n=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='0'||s[i]=='1'){
			c[n]=s[i];
			n++;
		}
		if(s[i]=='B'&&n){
			s[n]='2';
			n--;
		}
	}
	for(int i=0;i<n;i++){
		if(c[i]!='2')cout<<c[i];
	}
	cout<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P =  pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

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

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

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

template <typename T>
T gcd(T a, T b) {
  if(b == 0) return a;
  else return gcd(b,a%b);
}



int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

struct UnionFind {
  vector<int> par;

  UnionFind(int n) {
    par.resize(n,-1); 
  }

  int root(int x) {
    if(par[x] < 0) return x;
    else return par[x] = root(par[x]);
  }

  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if(x == y) return false;
    if(par[x] > par[y]) swap(x,y);
    par[x] += par[y];
    par[y] = x;
    return true;
  }
  
  int size(int x) {
    return -par[root(x)];
  }
};


  


int main() {
  int N,M,K;
  cin >> N >> M >> K;
  UnionFind uf(N);
  vector<set<int>> v(N);
  
  rep(i,M) {
    int a,b;
    cin >> a >> b;
    a--;b--;
    uf.merge(a,b);
    v[a].insert(b);
    v[b].insert(a);
  }
  rep(i,K) {
    int a,b;
    cin >> a >> b;
    a--;b--;
    if(uf.issame(a,b)) {
      v[a].insert(b);
      v[b].insert(a);
    }
  }

  rep(i,N) {
    int ans = uf.size(i) - v[i].size() - 1;
    cout << ans << endl;
  }
  
  return 0;
}














Measured memory_bytes: 22272
# 36

# dp[i][j] : i-1 までの品物を使って重さw以下で押さえたときの価値の最大値
n, w = map(int, input().split())
vw_l = [[int(x) for x in input().split()] for y in range(n)]

dp = [[0] * (w+1) for y in range(n+1)]

for i in range(n):
    _v, _w = vw_l[i]
    for j in range(w+1):
        if j < _w:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i+1][j-_w] + _v, dp[i][j])

print(dp[n][w])


Measured memory_bytes: 41888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using piii = pair<int, pair<int, int>>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

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

    int N, M;
    cin >> N >> M;
    cout << N * (N - 1) / 2 + M * (M - 1) / 2 << endl;
    return 0;
}


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

int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  long long int S,n,O=0,tmp;
  cin >> S;
  n = S/3;
  long long int R[n+1];
  
  for(long long int i=0;i<n;i++){
    R[i]=Exp(i+1,1000000005,1000000007);
  }
  for(long long int i=0;i<n;i++){
    S=S-3;
    tmp=1;
    for(long long int j=0;j<i;j++){
      tmp=tmp*(S+i-j);
      tmp=tmp%1000000007;
      tmp=tmp*R[j];
      tmp=tmp%1000000007;
    }
    O=(O+tmp)%1000000007;
  }
  
  cout<<O<<endl;
}


int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}


Measured memory_bytes: 3628
// type a
//a...いけそう
//b...自信がない
//c...お試し
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
#include <array>
// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#define INF (lint)10000000000000000
#define mod = (lint)1000000007;
#pragma endregion

vector<vector<int>> d(3, vector<int>(3));
void input() {
	for (int i = 0; i < 3; i++) 
		for (int j = 0; j < 3; j++)
			cin >> d[i][j];
	return;
}
void solve() {
	int a1, a2, a3, b1, b2, b3;
	a1 = 0;
	b1 = d[0][0] - a1;
	b2 = d[0][1] - a1;
	b3 = d[0][2] - a1;
	a2 = d[1][0] - b1;
	a3 = d[2][0] - b1;
	if (a1 + b1 != d[0][0]) { puts("No"); return; }
	if (a2 + b1 != d[1][0]) { puts("No"); return; }
	if (a3 + b1 != d[2][0]) { puts("No"); return; }
	if (a1 + b2 != d[0][1]) { puts("No"); return; }
	if (a2 + b2 != d[1][1]) { puts("No"); return; }
	if (a3 + b2 != d[2][1]) { puts("No"); return; }
	if (a1 + b3 != d[0][2]) { puts("No"); return; }
	if (a2 + b3 != d[1][2]) { puts("No"); return; }
	if (a3 + b3 != d[2][2]) { puts("No"); return; }
	puts("Yes");
	return;
}

int main(void) {
	input();
	solve();

	return 0;
}

Measured memory_bytes: 3608
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int a, b, c; cin >> a >> b >> c;
    if(a <= c && c <= b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3660
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    len_s=len(s)
    i=0
    cunt_a=0
    ans=0
    while i<len_s:
        if s[i]=='A':  
            cunt_a+=1
        elif i<len_s-1 and s[i:i+2]=="BC" and cunt_a>0:
            ans+=cunt_a
            i+=1
        else:
            cunt_a=0
        i+=1
    print(ans)

if __name__=='__main__':
    main()

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

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

int k;
int countk;
string str = "";


bool listup(int keta, int ima,int a, string kari){
  
  for(int i = a-1; i<=a+1; i++){
    if(i<0 || i>=10)continue;
    
    if(ima+1==keta){
      //cout << kari + to_string(i) << endl;
      countk++;
      if(countk == k ){
        cout << kari + to_string(i) << endl;
        return true;
      }
      continue;
    }
    
    if(listup(keta,ima+1,i,kari+to_string(i))){
      return true;
    }
  
  }
  return false;
}

int main(){

  cin >> k;

  if(k<10){
    cout << k << endl;
    return 0;
  }
  countk=9;
  
  for(int keta=2; keta < 20; keta++){
    for(int i=1; i<=9 ; i++){
      string kari= to_string(i);
      bool are =  listup(keta,1,i, kari);
      if (are) return 0;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define pr(s) cout << (s) << '\n'
const ll mod = 998244353;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

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 {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=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 {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

const int NMAX = 100005;
mint dp[305][NMAX];
mint dp2[305][NMAX];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int sum = 0;
    rep(i, n) sum += a[i];
    dp[0][0] = 1;
    dp2[0][0] = 1;
    for (int i=0; i<n; i++) {
        for (int j=0; j<NMAX; j++) {
            dp[i+1][j] += dp[i][j]*2;
            dp2[i+1][j] += dp2[i][j];
            if (j+a[i]<NMAX) {
                dp[i+1][j+a[i]] += dp[i][j];
                dp2[i+1][j+a[i]] += dp2[i][j];
            }
        }
    }
    mint ans = mint(3).pow(n);
    //debug(ans);
    rep(j, NMAX) {
        if (j>=sum-j) {
            ans -= dp[n][j]*3;
            if (dp[n][j].x!=0) {
                //debug(j);
                //debug(dp[n][j]);
            }
        }
        if (j==sum-j) {
            ans += dp2[n][j]*3;
        }
    }
    //rep(j, 6) debug(dp[n][j]);
    
    pr(ans);
    return 0;
}


Measured memory_bytes: 480252
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int a, b;
    cin >> a >> b;
    if (a == 1)
        a += 13;
    if (b == 1)
        b += 13;
    if (a == b)
        cout << "Draw" << endl;
    else
        cout << (a > b ? "Alice" : "Bob") << endl;
}

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

int main(){
	ll a,b,x;
	cin >> a >> b >> x;
	cout << b/x - a/x +((a%x==0)?1:0) << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void trace(vector<int> a, int n) {
	for (int i = 0;i < n;i++) {
		cout << a[i];
		if (i < n - 1) cout << " ";
		if (i == n - 1)cout << endl;
	}
}
void insertionSort(vector<int> a, int n) {
	for (int i = 1;i < n;i++) {
		int v = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;
		trace(a, n);
	}
}
int main(void) {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0;i < n;i++)cin >> a[i];
	trace(a, n);
	insertionSort(a, n);
	return 0;
}


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

using ull = unsigned long long;
using ll = long long;
using ld = long double;

const int mod = 1e9 + 7;
const int inf = INT_MAX;

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

    string s, t;
    cin >> s >> t;

    int ans = INT_MAX;
    for (int i = 0; i < s.length() - t.length() + 1; i++) {
        int c = 0;
        for (int j = 0; j < t.length(); j++) {
            c += s[i + j] != t[j];
        }
        ans = min(ans, c);
    }
    cout << ans << "\n";
    return 0;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	string s;
	cin>>n>>s;
	for (char &c : s){
		c = 'A' + (c - 'A' + n)%26;
	}
	cout<<s<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
 
int main(){
    int n,A,B,C,xbe,xaf,cnt,flag,y;
 
    while(1){
	cnt = 0; flag = 0;
 
	cin >> n >> A >> B >> C >> xbe;
	if( n == 0 && A == 0 && B == 0 && C == 0 && xbe == 0 ) break;
 
	for( int i = 0 ; i < n ; i++ ){
	    cin >> y;
 
	    if(flag==1)continue;
	    while(1){
		if(xbe == y){
		    xaf = ( A * xbe + B ) % C;
		    xbe = xaf;
		    cnt++;
		    break;
		}
 
		xaf = ( A * xbe + B ) % C;
		xbe = xaf;
		cnt++;
 
		if( cnt > 10000 ){
		    cout << "-1" << endl;
		    flag = 1;
		    break;
		}
	    }
	}
	if( flag==0 ) cout << cnt-1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3036
#include <cassert>
#include <iostream>
using namespace std;
#define M 1000000007

int modexp(int x, long long e, int m) {
    long long ans = 1, p = x % m;
    while (e > 0) {
        if (e % 2 != 0) ans = (ans * p) % m;
        p = (p * p) % m;
        e >>= 1;
    }
    return ans;
}

class ModComb {
    long long *fact, *facti;
    const int mod;
public:
    explicit ModComb(int n, int m) : mod(m) {
        fact = new long long[n+1];
        facti = new long long[n+1];
        fact[0] = 1; facti[0] = 1;
        for (int i = 1; i <= n; i++) fact[i] = (fact[i-1] * i) % m;
        // calc 1/n!
        long long &inv = facti[n], pw = fact[n];
        inv = 1;
        for (int e = mod-2; e > 0; e /= 2) {
            if (e&1) inv = inv * pw % mod;
            pw = pw * pw % mod;
        }
        for (int i = n-1; i > 0; i--) facti[i] = (facti[i+1] * (i+1)) % m;
    }

    ~ModComb() {
        if (fact) delete[] fact;
        if (facti) delete[] facti;
    }

    long long get(int n, int k) const {
        if (n < 0 || k < 0 || k > n) return 0;
        return fact[n] * facti[k] % mod * facti[n-k] % mod;
    }
};

int main() {
    int B, W; cin >> B >> W;
    ModComb mc(B+W, M);
    long long p = 1, q = 0;
    constexpr int inv2 = 500000004;
    cout << inv2 << endl;
    for (int i = 0; i < B + W - 1; i++) {
        if (i - B + 1 >= 0) {
            p -= mc.get(i, B-1) * modexp(inv2, i+1, M) % M;
            p %= M;
        }
        if (i - W + 1 >= 0) {
            q += mc.get(i, W-1) * modexp(inv2, i+1, M) % M;
            q %= M;
        }
        cout << ((p + q) %M * inv2 % M + M) % M << endl;
    }
}


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

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ld long double
#define pb push_back
#define fe first
#define se second
#define nl "\n"
#define pp pair < ll , ll > 
#define sz(x) (ll)x.size()
#define st(x) sort(x.begin(),x.end())
#define rst(x) sort(x.rbegin(), x.rend())
#define all(x) x.begin(),x.end()
long double pi = 3.14159265358979323;
 
const double EPS = 1e-12;
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
 
 
 
 
int main()
{
    fast;  
    ll n , w;
    cin >> n >> w ;
    ll wt[n+1] , val[n+1];
    for(int i = 1 ; i <= n ;i++ ){
        cin >> wt[i] >> val[i];
    }

    ll dp[n+1][w+1] = {};
    for(int i = 1 ; i <= n ; i++ ){
        for(int j = 0 ; j <= w ; j++ ){
            if(wt[i] <= j){
                dp[i][j] = max(dp[i-1][j] , dp[i-1][j-wt[i]] + val[i]);
            }
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[n][w];



    





















    
    return 0;
    
    
}

Measured memory_bytes: 79232