akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;

        static void SolveA()
        {
            var o = ReadAndParseIntArr();
            int a = o[0];
            int b = o[1];
            string ans = (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) ? "Possible" : "Impossible";
            Console.WriteLine(ans);
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

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

int main()
{
	string day []  = {"SUN","MON","TUE","WED","THU","FRI","SAT"," "};
	string n; cin>>n;
	int m = 0;
	for (int i = 0; i < 7 ; i++)
	{
		if ( n == day[i] )
		{
			m = i;
			break;
		}
	}
	int yet = 7 - m;
	cout<<yet<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;
int main(){
  ll a; ld b; cin >>a >>b;
  cout <<fixed<<setprecision(0)<<floor(a*b);
return 0;}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

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

  multiset<int> ms;
  rep(i, n) {
    auto it = ms.lower_bound(a[i]);
    if (it != ms.begin()) ms.erase(--it);
    ms.insert(a[i]);
  }

  cout << sz(ms) << endl;
}


Measured memory_bytes: 5376
def ex():
    print(0)
    exit()

MOD=10**9+7
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
if N==1:
    print(1 if A[0]==B[0] else 0)
    exit()

ans=1
tmp=[-1]*N
for i in range(N):
    if i==0 or (i>0 and A[i-1]<A[i]):
        if B[i]<A[i]:
            ex()
        tmp[i]=A[i]
for i in reversed(range(N)):
    if i==N-1 or (i<N-1 and B[i]>B[i+1]):
        if tmp[i]!=-1 and tmp[i]!=B[i]:
            ex()
        if A[i]<B[i]:
            ex()
        tmp[i]=B[i]
for i in range(N):
    if tmp[i]==-1:
        ans=ans*min(A[i],B[i])%MOD
print(ans)


Measured memory_bytes: 24484
b=0
for e in iter(input,'0 0'):
 if b:print()
 b=1
 s,t=map(int,e.split())
 u=[y for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0]
 if u:
  for y in u:print(y)
 else:print('NA')


Measured memory_bytes: 5756
while True:
    n,x = map(int,input().split())
    if n+x == 0:
        break
    ans = 0
    for i in range(1,n-1):
        for j in range(i+1,n):
            for k in range(j+1,n+1):
                if i+j+k == x:
                    ans += 1
                    
    print(ans)


Measured memory_bytes: 5596
package main

import "fmt"

func calc(n int) (m int) {
	m = 1
	for {
		if t := m * 2; n >= t {
			m = t
		} else {
			break
		}
	}
	return
}

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println(calc(n))
}


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for (int i = 0; i < h; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (s[i][j] == '#') {
        bool flag = false;
        if (i - 1 >= 0 && s[i - 1][j] == '#') {
          flag = true;
        }
        if (i + 1 < h && s[i + 1][j] == '#') {
          flag = true;
        }
        if (j - 1 >= 0 && s[i][j - 1] == '#') {
          flag = true;
        }
        if (j + 1 < w && s[i][j + 1] == '#') {
          flag = true;
        }
        if (!flag) {
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<iomanip>

#define ll long long

using namespace std;

int main(void) {
	int X, XX;

	cin >> X;
	XX = X;
	int d = 0;
	while (X > 0) {
		d += X % 10;
		X /= 10;
	}
	if (XX % d == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	system("pause");
	return 0;
}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int x,ret=0;
	while(cin>>x) ret^=x;
	cout << ret << endl;
	return 0;
}


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

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

int main() {
int k,s; cin >> k >> s;
int ans = 0;
rep(x,k+1){
    rep(y,k+1){
        int z = s - x - y;
        if(0 <= z && z <= k) ans++;
    }
}
cout << ans << endl;
}

Measured memory_bytes: 256
use std::collections::HashSet;

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let _n = parse_line!(usize);
    let aa = parse_vec!(usize);

    let mut set = HashSet::new();

    for a in aa {
        if set.contains(&a) {
            println!("NO");
            return;
        }
        set.insert(a);
    }

    println!("YES");
}


Measured memory_bytes: 13996
#include<bits/stdc++.h>
using namespace std;
char c[100005];
vector<char> v;
int main(){
    scanf("%s",c);
    int Q;
    int len=strlen(c);
    for(int i=0;i<len;i++){
        v.push_back(c[i]);
    }
    scanf("%d",&Q);
    int t,f;
    char cc;
    int sum=0;
    for(int cas=1;cas<=Q;cas++){
//        printf("cas:%d\n",cas);
        scanf("%d",&t);
        if(t==1){
            sum^=1;
//            reverse(v.begin(),v.end());
        }else if(t==2){
            scanf("%d %c",&f,&cc);
            if(f==1){
                if(sum==0)v.insert(v.begin(),cc);
                else v.insert(v.end(),cc);
            }else{
                if(sum==0) v.insert(v.end(),cc);
                else v.insert(v.begin(),cc);
            }
        }
    }
    if(sum==0){
        for(vector<char>::iterator it=v.begin();it<v.end();it++){
            printf("%c",*it);
        }
    }else{
        for(vector<char>::iterator it=v.end()-1;it>=v.begin();it--){
            printf("%c",*it);
        }
    }
    return 0;
}


Measured memory_bytes: 1020
# 一番基礎点の低いものに注目
# 完全に埋める or 部分的に埋める
# 部分的に埋める場合、高位の問題は全て解いている

D,G = map(int,input().split())
P = [None]
C = [None]
full_score = [None]

for i in range(1,D+1):
  p,c = map(int,input().split())
  P.append(p)
  C.append(c)
  full_score.append(100*i*p + c)

INF = 10 ** 18
def F(i = 1, G = G):
  # i番目以上の問題だけを使う場合
  if G <= 0:
    return 0
  if i == D+1:
    return INF
  full_upper = sum(full_score[i+1:])
  # 放置する場合
  x = F(i+1, G)
  # 完全に埋める場合
  y = P[i] + F(i+1, G - full_score[i])
  # 部分的に埋める場合。このとき上位の問題は完全に埋めている
  if 100 * i * P[i] + full_upper < G:
    z = INF
  else:
    z = sum(P[i+1:]) + max(0, (G - full_upper + 100*i - 1) // (100*i))
  return min(x,y,z)

answer = F()
print(answer)

Measured memory_bytes: 3064
fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(" ").map { it.toInt() }
    println((1..2000).find {
        val divA = it * 8 / 100
        val divB = it * 10 / 100
        a == divA && b == divB
    } ?: -1)
}

Measured memory_bytes: 38028
r, c = map(int, [int(_) for _ in input().split()])

ll = []

for _ in range(r):
  l =  [int(n) for n in input().split()]
  l.append(sum(l))
  ll.append(l)

l = [sum(_) for _ in zip(*ll)]
ll.append(l)

for l in ll:
  print(" ".join([str(_) for _ in l]))

Measured memory_bytes: 7760
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

int main() {
	string s;
	cin >> s;
	int black = 0;
	int white = 0;
	FOR(i,1, s.size()) {
		if (s[i] == s[i - 1]) {

		}
		else if(s[i]=='W') {
			black++;
		}
		else if (s[i] = 'B') {
			white++;
		}
	}
	cout << white + black << endl;
}


Measured memory_bytes: 512
import math
f = math.factorial
def comb(n,k):
    return f(n)//(f(n-k) * f(k))

N, P = map(int, input().split())
a = list(map(int, input().split()))
ma = [e % 2 for e in a]
nOdd = ma.count(1)
nEven = N - nOdd

ce = 0    
for i in range(nEven + 1):
    ce += comb(nEven, i)

co = 0
for i in range(nOdd + 1):
    if i % 2 == P:
        co += comb(nOdd, i)

print(ce * co)
        


Measured memory_bytes: 3064
import java.util.Scanner;

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

    int N = scanner.nextInt();
    long[] A = new long[N];
    long[] B = new long[N];
    for (int i = 0; i < N; i++) {
      A[i] = scanner.nextInt();
      B[i] = scanner.nextInt();
    }
    long res = 0;
    for (int i = N - 1; i >= 0; i--) {
      A[i] += res;
      res += (A[i] + B[i] - 1) / B[i] * B[i] - A[i];
    }
    System.out.println(res);
  }
}


Measured memory_bytes: 91156
#include<stdio.h>

int parent(int);
int left(int);
int right(int);



int main()
{
	int H,p,r=NULL,l=NULL,i;
	scanf("%d",&H);
	int A[H+1];
	for(i=1;i<=H;i++) scanf("%d",&A[i]);	
    
    for(i=1;i<=H;i++)
    {
    
    p=parent(i);
    l=left(i);
    r=right(i);
    
    printf("node %d: key = %d, ",i,A[i]);
    if(i>1)printf("parent key = %d, ",A[p]);
    if(l<=H)printf("left key = %d, ",A[l]);
    if(r<=H)printf("right key = %d, ",A[r]);
    
    printf("\n");
    
    }
	
	return 0;

}


int parent(int i)
{
	return i/2;
}
int left(int i)
{
	return 2*i;
}
int right(int i)
{
	return 2*i+1;
}



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

int main() {
  string t = "hi";
  string s;
  cin >> s;
  bool r = s.size() % 2 == 0;
  for (int i = 0; i < s.size(); i++) r = r && s[i] == t[i % 2];
  cout << (r ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int gcd(int x,int y){
    if(y==0)return x;

    return gcd(y,x%y);
}
int lcm(int x,int y){
    return x*y/gcd(x,y);
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){

    int A,B,C,ans=0,f=0;

    cin>>A>>B>>C;

    ans = min(A+B+1,C) + B;

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>		/*V[U[Ã*/
#include <string.h>

int main(){
	char str[81];
	int i,j;
	
	while(scanf("%[^\n]%*c",str)!=EOF){
		for(i=0;i<26;i++){										/*«ª é½ßAAt@xbgÌ¾¯¹éB*/
			for(j=0;j<strlen(str);j++){
				if('a'<=str[j] && str[j]<='z'){
					str[j] = (str[j]=='z') ? 'a' : str[j] + 1;	/*'z'¾Á½ç'a'É·éB±±dvB*/
				}
			}
			/*strstr(str,key):¶ñstrðõµA¶ñkeyª©Â©Á½ç»±ÌæªÊuÖÌ|C^ªÔ³êéB*/
			if(strstr(str,"the")!=NULL || strstr(str,"this")!=NULL ||strstr(str,"that")!=NULL){
				printf(str);
				printf("\n");
			}
		}
	}
	
	return 0;
}

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

int main() {
    int a, b, x;
    bool ans = true;
    
    cin >> a >> b >> x;
    
    if (a > x) {
        ans = false;
    }
    else if ((a + b) < x) {
        ans = false;
    }
    
    cout << (ans ? "YES" : "NO") << endl; 
    return 0;
}

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

int main () {
    int N;
    cin >> N;
    vector<long long> A(90);
    A[0] = 2;
    A[1] = 1;
    for(int i = 2; i <= N; i++) {
        A[i] = A[i - 1] + A[i - 2];
    }
    cout << A[N] << endl;
    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include<cstdio>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
// #define ALLR(obj) (obj).rbegin(), (obj).rend()
#define BIT(n) (1LL << (n))

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int a, b, k;
  cin >> a;
  cin >> b;
  cin >> k;
 
  vector<int> vc; 
  for(int i=1; i<101; ++i) {
    bool isDevA = false;
    bool isDevB = false;
 
    if (a%i==0){
      isDevA = true;
    }
    
    if (b%i==0){
      isDevB = true;
    }
    
    if (isDevA && isDevB) {
      vc.push_back(i);
    }
  }
  
  int res = vc[vc.size()-1-(k-1)];
  cout << res;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

P f(int x) {
    int a = x % 10;
    int b = x;
    while (x) {
        b = x;
        x /= 10;
    }
    return P(a, b);
}

int main() {
    int n;
    cin >> n;
    map<P, int> cnt;
    rrep(i, n) {
        P p = f(i);
        cnt[p]++;
    }
    ll ans = 0;
    rrep(i, n) {
        P p = f(i);
        P q = P(p.second, p.first);
        ans += cnt[q];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)

s_top = s[0:(n-1)//2]
s_bottom = s[(n+3)//2-1:]
if s_top == s_top[::-1] and s_bottom == s_bottom[::-1] and s == s[::-1]:
    print('Yes')
else:
    print('No') 

Measured memory_bytes: 61860
#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

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

const int mod = (int)1e9 + 7;
const int mod2 = 998244353;

ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
	if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}

ll mul(ll a, ll b, ll md){
	return a*b % md;
}

vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
	fact.resize(n+5);
	inv_fact.resize(n+5);
	fact[0] = inv_fact[0] = 1;
	for(int i = 1; i <= n; i++){
		fact[i] = (fact[i-1] * i) % mod;
		inv_fact[i] = exp(fact[i], mod-2, mod);
	}
}

ll komb(ll a, ll b){
	if(a < b) return 0;
	return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}


const int N = 2e5+5;

int main(){
	ios::sync_with_stdio(false); cin.tie(NULL);
	ll h, w; cin>>h>>w;
	ll ans = h % 3 ? w : 0;
	ans = min(ans, ll(w%3 ? h : 0));
	for(int i = 1; i <= h; i++){
		ll s1 = w*i, s2 = (h-i) * (w/2), s3 = (h-i) * ((w+1)/2);
		ans = min(ans, max({s1, s2, s3}) - min({s1, s2, s3}));
	}
	for(int i = 1; i <= w; i++){
		ll s1 = h*i, s2 = (w-i) * (h/2), s3 = (w-i) * ((h+1)/2);
		ans = min(ans, max({s1, s2, s3}) - min({s1, s2, s3}));
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 256
from collections import Counter


def is_valid():
    if N % 2:
        return A[0] == 1 and all(A[2 * i + 2] == 2 for i in range(N // 2))
    else:
        return all(A[2 * i + 1] == 2 for i in range(N // 2))


N = int(input())
A = Counter(map(int, input().split()))
print(pow(2, N // 2, 10 ** 9 + 7)) if is_valid() else print(0)


Measured memory_bytes: 16616
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define frfr  freopen("input.text","r",stdin); freopen("output.text","w",stdout)
#define LL long long int
#define wh int T;cin >> T;while(T--)
#define foro(i,n) for(int i=0;i<n;i++)
#define forn(i,k,n) for(int i=k;i<n;i++)
#define PB push_back
#define mod 1000000007 
#define UMP unordered_map<int,int>

LL solveRecuseion(LL* height,LL n){ // recursion
   if(n <= 1){
    return 0;
   } 
   LL onejump = abs(height[1] - height[0]) + solveRecuseion(height+1 , n-1);
   LL twojump = INT_MAX;
   if(n > 2){
      twojump = abs(height[2] - height[0]) + solveRecuseion(height+2,n-2);
   }
   return min(onejump,twojump);


}

LL solvedp(LL* height , LL n){
  LL dp[n];
  dp[0] = 0;
  for(int i=1;i<n;i++){
    dp[i] = INT_MAX;
  }
  for(LL  i=0;i<n;i++ ){
    for(LL j=i+1;j<=i+2;j++){
      if(j < n){
        dp[j] = min(dp[j] ,dp[i] + abs(height[j] - height[i]));
      }
    }
  }
  return dp[n-1];
}


int main(){
    //frfr;
    LL n;
    cin >> n;
    LL height[n];
    for(int i=0;i<n;i++){
      cin >> height[i];
    }
     //cout << solveRecuseion(height,n) << endl;
     cout << solvedp(height,n) << endl;
   
   return 0;
}
  


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

int main(){
	int n;
	while(scanf("%d", &n), n){
		int cnt = 0;
		if(n == 6174){
			printf("0\n");
			continue;
		}
		if(n%1111 == 0){
			printf("NA\n");
			continue;
		}
		while(true){
			cnt++;
			int a[4];
			int l = 0, s = 0;
			for(int i = 0; i < 4; i++) a[i] = (n%(int)pow(10,4-i))/(int)pow(10,3-i);
			sort(a,a+4);
			for(int i = 0; i < 4; i++){
				s += a[3-i]*(int)pow(10,i);
				l += a[i]*(int)pow(10,i);
			}
			n = l-s;
			if(n == 6174){
				printf("%d\n", cnt);
				break;
			}
		}
	}
}

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

int a[301][301];
bool vis[301][301];
int cnt[301];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	int ans=1e9;
	for(int i=1;i<=m;i++){
		memset(cnt,0,sizeof cnt);
		for(int j=1;j<=n;j++){
			for(int k=1;k<=m;k++)
				if(!vis[j][k]){
					cnt[a[j][k]]++;
					break;
				}
		}
		int x,y=0;
		for(int j=1;j<=m;j++)
			if(y<cnt[j])
				x=j,y=cnt[j];
		ans=min(ans,y);
		for(int j=1;j<=n;j++){
			for(int k=1;k<=m;k++)
				if(a[j][k]==x){
					vis[j][k]=true;
					break;
				}
		}
	}
	cout<<ans<<endl;
	
}


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

long DP[500][500];
long sumarr[500];
long a[500];
long big = 1e16;

long rec(int l, int r) {
    if(DP[l][r] != big) return DP[l][r];
    if(r <= l) return 0;
    else if(r==l+1) return DP[l][r] = a[l]+a[r];
    else{
        for(int i=l;i<=r;++i){
            DP[l][r] = min(DP[l][r], sumarr[r+1] - sumarr[l] + rec(i+1, r) + rec(l, i));
        }
        return DP[l][r];
    }
}

int main() {
    for(int i=0;i<500;++i){
        for(int j=0;j<500;++j){
            DP[i][j] = big;
        }
    }
    int N;
    cin>>N;
    for(int i=0;i<N;++i){
        cin>>a[i];
    }
    sumarr[0] = 0;
    for(int i=1;i<N+1;++i){
        sumarr[i] = sumarr[i-1] + a[i-1];
    }
    cout<<rec(0, N-1)<<endl;
    /**
    for(int i=0;i<N;++i){
        for(int j=0;j<N;++j){
            cout<<DP[i][j]<<" ";
        }
        cout<<endl;
    }
    cout<<endl;
    **/
}


Measured memory_bytes: 2176
s = input()
num = 2 ** (len(s) - 1)
for i in range(num):
  x = ''
  for index, value in enumerate(s):
    x += value
    if index == (len(s) - 1):
      break
    if (i>>index) & 1:
      x += '+'
    elif ~((i>>index) & 1):
      x += '-'
      
  if eval(x) == 7:
    break
x += '=7'
print(x)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
//qsort用 降順ソート
int comp(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}
int main(void)
{
    int N;
    int a[101];
    int ret[2]={0,0}; // 0 : Alice 1:Bob
    int i;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&(a[i]));
        //printf("%d ",a[i]);
    }
    //aを降順ソート
    //printf("\n----\n");
    qsort(a,N,sizeof(int),comp);
    for(i=0;i<N;i++){
        //printf("%d ",a[i]);
        ret[i%2] += a[i];
        //printf("AorB:%d,ret:%d",(i%2),ret[i%2]);
    }
    printf("%d\n",(ret[0] - ret[1]));

    return 0;
}


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

int main(void) {
    int N;
    cin >> N;
    vector< long long > A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector< long long > count(N + 10);
    for (int i = 1; i <= N; i++) {
        count[i] = 0;
    }
    for (int i = 0; i < N; i++) {
        ++count[A[i]];
    }
    long long sum = 0;
    for (int i = 1; i <= N; i++) {
        if (count[i] > 1) {
            sum += count[i] * (count[i] - 1) / 2;
        }
    }
    long long ans;
    for (int i = 0; i < N; i++) {
        ans = sum;
        if (count[A[i]] > 1) {
            ans -= count[A[i]] * (count[A[i]] - 1) / 2;
            if (count[A[i]] > 2) {
                ans += (count[A[i]] - 1) * (count[A[i]] - 2) / 2;
            }
        }
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 5760
using System;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int[] arr = new int[] { int.Parse(input[0]), int.Parse(input[1]), int.Parse(input[2]) };
    Array.Sort(arr);
    Console.WriteLine(Math.Abs(arr[0] - arr[1]) + Math.Abs(arr[1] - arr[2]));
  }
}

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

int main() {
  int h, w;
  cin >> h >> w;
  char s[h][w];

  for (int i = 0; i < h; i++) {
    string s_input;
    cin >> s_input;
    for (int j = 0; j < w; j++) {
      s[i][j] = s_input.at(j);
    }
   }
   for (int i =0; i < h; i++) {
     for (int j =0; j < w; j++) {
       int sum = 0;
       if (s[i][j] == '.') {
         if (i != 0) {
           if (s[i-1][j] == '#') sum++;
         }
         if (j != 0) {
           if (s[i][j-1] == '#') sum++;
         }
         if (i != h-1) {
           if (s[i+1][j] == '#') sum++;
         }
         if (j != w-1) {
           if (s[i][j+1] == '#') sum++;
         }
         if (i != 0 && j != 0) {
           if (s[i-1][j-1] == '#') sum++; 
         }
         if (i != h-1 && j != 0) {
           if (s[i+1][j-1] == '#') sum++; 
         }
         if (i != 0 && j != w-1) {
           if (s[i-1][j+1] == '#') sum++;
         }
         if (i != h-1 && j != w-1) {
           if (s[i+1][j+1] == '#') sum++;
         }
         char char_sum = '0' + sum ;
         s[i][j] = char_sum;
       }
     }
   }
   for (int i = 0; i < h; i++) {
     for (int j = 0; j < w; j++) {
       cout << s[i][j];
     }
     cout << endl;
   }
  }

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <map>
using std::min; using std::max;
using std::swap; using std::sort;
using std::deque; using std::map;
typedef long long ll;
typedef std::pair<int, int> pii;

template<typename T>
void read(T &x) {
	int flag = 1; x = 0; char ch = getchar();
	while(ch < '0' || ch > '9') { if(ch == '-') flag = -flag; ch = getchar(); }
	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= flag;
}

const int _ = 4e6 + 10, __ = 5e5 + 10;
int n, m, dis[__], poi;
int cnt, from[__], to[_], nxt[_], wd[_];
inline void addEdge(int u, int v, int w) {
	to[++cnt] = v, nxt[cnt] = from[u], from[u] = cnt, wd[cnt] = w;
}
deque<int> q;
map<int, int> f[__];

void doit() {
	q.push_back(1);
	while(q.size()) {
		int u = q.front(); q.pop_front();
		for(int i = from[u]; i; i = nxt[i]) {
			int v = to[i], w = dis[u] + wd[i];
			if(w < dis[v]) {
				dis[v] = w;
				if(wd[i] == 0) q.push_front(v);
				else q.push_back(v);
			}
		}
	}
}

int main () {
	read(n), read(m), poi = n;
	for(int i = 1, u, v, c; i <= m; ++i) {
		read(u), read(v), read(c);
		if(f[v].find(c) != f[v].end()) swap(v, u);
		if(f[u].find(c) != f[u].end()) {
			if(f[v].find(c) == f[v].end()) {
				int p = f[u][c]; f[v][c] = p;
				addEdge(v, p, 1), addEdge(p, v, 0);
			} else {
				int p = f[u][c], q = f[v][c];
				addEdge(p, q, 0), addEdge(q, p, 0);
			}
		} else {
			++poi; f[u][c] = poi, f[v][c] = poi;
			addEdge(u, poi, 1), addEdge(poi, u, 0);
			addEdge(v, poi, 1), addEdge(poi, v, 0);
		}
	}
	memset(dis + 1, 63, sizeof dis[0] * poi); int Inf = dis[n];
	dis[1] = 0, doit(), printf("%d\n", dis[n] == Inf ? -1 : dis[n]);
	return 0;
} 

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

int main(){
  int n,ans;
  cin >> n;
  ans = n;
  if(ans%4 == 0 || ans%7 == 0){
    cout << "Yes" << endl;
  }else if(ans%11 == 0){
    cout << "Yes" << endl;
  }else{
    while(ans > 0){
      ans -= 4;
      if(ans%7 == 0 || ans == 0){
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(ll i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a;
	cin>>a;
	if(a<1000)cout<<"ABC"<<endl;
	else cout<<"ABD"<<endl;
}















Measured memory_bytes: 256
A, B = STDIN.gets.chomp.split(' ').map(&:to_i)

nums = B - A + 1

sets = nums / 2
if nums % 2 == 0 then # 奇数から始まる偶数個のパターンは特殊
  if A % 2 == 1 then
    sets -= 1
  end
end

if sets % 2 == 1 then
  setsXor = 1
else
  setsXor = 0
end

if nums % 2 == 1 then
  if A % 2 == 1 then # 奇数個で奇数から始まるなら先頭が残る
    nokori = A
  else               # 奇数個で偶数から始まるなら最後が残る
    nokori = B
  end
    puts setsXor ^ nokori
else
  if A % 2 == 1 then # 奇数から始まる偶数個のパターンは先頭と最後が残る
    puts setsXor ^ A ^ B
  else
    puts setsXor
  end
end

Measured memory_bytes: 3836
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
    string s;
    cin >> s;
    int w = 'a';
    vector<int> a(26);
    rep(i, s.size()) {
        a[s[i]-w] = 1;
    }

    bool flag = false;
    rep(i, 26) {
        if(a[i] != 1) {
            cout << char(w+i) << endl;
            flag = true;
            break;
        }
    }

    if(!flag) cout << "None" << endl;
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n, y;
    cin >> n >> y;

    for (int i = 0; i <= n; ++i)
    {
        for (int j = 0; i + j <= n; ++j)
        {
            int k = n - i - j;
            if (10000 * i + 5000 * j + 1000 * k == y)
            {
                cout << i << " " << j << " " << k << endl;
                return;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

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


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
Val = [0]*(10**5+1)
for a in A:
    Val[a] += 1
Sum = sum(A)
Q = int(input())
for i in range(Q):
    B, C = map(int, input().split())
    n_B = Val[B]
    Val[B] = 0
    Val[C] += n_B
    Sum += (C-B) * n_B
    print(Sum)

Measured memory_bytes: 20884
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = (1LL << 31) - 1;
const ll mod = 1e9 + 7;

ll N, K;
ll A[200011];



bool isOK(ll cur) {//最小がcur以下とすると上手くいくか？
	
	
	if (cur >= A[0])return true;

	ll cnt = 0;
	FOR(i, 0, N) {
		if (A[i] > cur) {
			cnt += (A[i] + cur - 1) / cur -1;
		}
		else break;
	}
	if (cnt <= K)return true;
	else return false;

}


ll binary_search() {

	ll left = 0, right = 1e9+10;//ここの配列名を適宜変えよう！
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid))right = mid;
		else left = mid;
	}
	return right;
}

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

	cin >> N >> K;
	FOR(i, 0, N)cin >> A[i];
	sort(A, A+N);
	reverse(A,A+N);

	ll ans = binary_search();
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 5192
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int n,d,x,y,ans=0;
	scanf("%lld%lld",&n,&d);
	for(int i=1;i<=n;i++){
		scanf("%lld%lld",&x,&y);
		if(x*x+y*y<=d*d)ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}

int main(){
	int n; cin>>n;
	vi a(n);
	for(auto&i:a)cin>>i;
	sort(all(a));
	a.erase(unique(all(a)),a.end());
	if(a.size()%2){
		cout<<a.size()<<endl;
	}else cout<<a.size()-1<<endl;
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>

using namespace std;

int main(void){
    int i,n,k,a[100100],ans;
    cin >> n >> k;
    while(n!=0 && k!=0){
        ans = 0;
        a[0] = 0;
        for(i=1; i<=n; i++){
            cin >> a[i];
            a[i] += a[i-1];
        }
        for(i=k; i<=n; i++){
            ans = max(ans,a[i]-a[i-k]);
        }
        cout << ans << endl;
        cin >> n >> k;
    }
    return 0;
}

Measured memory_bytes: 1548
// ABC129_C
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18（const int inf   = 1<<29;）
const ll MOD7 = 1000000007; // 1 000 000 007

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N, M;
    cin >> N >> M;
    vector<ll> holes(M), broken(N+1, 1);
    
    REP(i, M) {
        cin >> holes[i];
        broken[holes[i]] = 0;
        
        if (i > 0) {
            if (holes[i] - holes[i-1] == 1) {
                cout << 0 << "\n";
                return 0;
            }
        }
    }
    
    // calculation
    // dp table init
    vector<ll> dp(N+1, 0);
    dp[N] = 1;
    if (broken[N-1]) dp[N-1] = 1;
    
    // calc
    for (ll i = N-2; i >= 0; --i) {
        if (broken[i]) {
            dp[i] = dp[i+1] + dp[i+2];
            dp[i] %= MOD7;
        }
    }
    
    cout << dp[0] << "\n";
    
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  for(int i=1;i<=32;i++){
    if((1<<i)-1>n){
      cout << i-1 << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func newScanner() *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	return scanner
}

func scanInt() int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

var sc = newScanner()

func gcd(a, b int) int {
	if a > b {
		a, b = b, a
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func lcm(a, b int) int64 {
	return int64(a/gcd(a, b)) * int64(b)
}

func f(n int) int {
	res := 0
	for n%2 == 0 {
		n /= 2
		res++
	}
	return res
}

func main() {
	n, m := scanInt(), scanInt()
	a := scanInts(n)

	t := f(a[0])
	for i := 0; i < n; i++ {
		if f(a[i]) != t {
			fmt.Println(0)
			return
		}
		a[i] >>= uint(t)
	}
	m >>= uint(t - 1)

	l := int64(1)
	for i := 0; i < n; i++ {
		l = lcm(int(l), a[i])
		if l > int64(m) {
			fmt.Println(0)
			return
		}
	}

	m /= int(l)
	fmt.Println((m + 1) / 2)
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define int long
using pi=pair<int,int>;

const int mod = 2019;
int mpow(int x, int n) {
    int y = 1, r = x;
    while(n>0){
        if (n & 1) y = (y * r) % mod;
        n >>= 1;
        r = r * r % mod;
    }
    return y;
}

signed main(){
    string s;
    cin>>s;
    int n = s.size();
    if (n < 4) return cout << 0, 0;
    vector<int> v(n, 0);
    v[n - 1] = s[n - 1] - '0';
    for (int i = n - 2,p = 10; i >= 0; --i,p=p*10%mod) {
        v[i] = (p * (s[i] - '0') + v[i + 1]) % mod;
    }
    map<int,int> m;
    int r = 0;
    m[0] = 1;
    for (int i = n - 1; i >= 0; --i) {
        r += m[v[i]];
        ++m[v[i]];
    }
    cout << r;
}

Measured memory_bytes: 5244
# your code goes here

size = gets.to_i;
input = gets.split(" ").map(&:to_i).reverse;

canmove = Array.new();

for i in 0..size-2 do
	if (input[i] > input[i+1])
		canmove.push(0)
	else
		canmove.push(1)
	end
end
canmove.reverse!

maxmove = 0
move = 0
canmove.each { |i|
	if (i==1)
		move = move + 1
	else
		if move > maxmove
			maxmove = move
		end
		move = 0
	end
}

if move > maxmove
	maxmove = move
end

puts maxmove


Measured memory_bytes: 10404
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ちゃんとユニークな配列にする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
  int N;
  cin >> N;
  int maxPlayer = 0;
  int minB = INF;
  rep(i, N) {
    int A, B;
    cin >> A >> B;
    if (B < minB) {
      maxPlayer = A + B;
      minB = B;
    }
  }
  cout << maxPlayer << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
 
using namespace std;
using namespace __gnu_pbds;
 	// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inff (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
#define SPEED ios_base::sync_with_stdio(false) ;cin.tie(NULL) ;cout.tie(NULL) ;
#define fp(i,a,n) for(ll i=n-1; i>a ;i--)
#define deb(x) cout << #x << " ---> " << x << endl;
#define X first
#define Y second
#define pia 3.1415926536
#define mod 1000000007
#define N 100005
#define ml map<ll,ll>
#define mll map<pll,ll>
#define letsh(a,b) (a<<b)
#define rigsh(a,b) (a>>b)
 #define vvl vector<vl>
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count()) ;
		ll lcm(ll a, ll b){
               return a / __gcd(a, b) * b;
       }
	   bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 	   

       ll power(ll a,ll n)
	   {
        ll ans=1;
        while(n)
		{
        if(n&1) ans=(ans*a)%mod;
        a=(a*a)%mod ;
        n=n>>1;
   		 }
   		 return ans;
      }
      ll power2(ll a,ll n)
      {
      	ll ans =1 ;
      	while(n)
      	{
      		if(n&1) ans =(ans*a) ;
      		a = (a*a) ;
      		n =n>>1 ;
		  }
		  return ans ;
	  } 
	  void p1(ll x,ll y)
	  {
	  cout<<x<<" "<<y<<endl ; 	
	  }
	  void p2(ll x,ll y)
	  {
	  	cout<<x<<" "<<y<<" " ;
	  }
  vvl dir({{1, 0}, {-1, 0}, {0, 1}, {0, -1}});
  #define LSB(i) ((i) & -(i)) // zeroes all the bits except the least significant one
  void solve()
  {
  ll d,t ,s ;cin>>d>>t>>s ;
  ll ans = (d+s-1)/s ;
  if(ans <=t ) cout<<"Yes"<<endl ;
  else cout<<"No"<<endl ;
	
	
  }
  int main() 
  	{
  	ll t=1 ;
	  while(t--) solve() ;
   	}
   	

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define RevRange(container) container.rbegin(), container.rend()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(){
    Cin(string, s);
    Cin(string, t);
    
    vector<vector<int>> tables(26), tablet(26);
    For(i, (int)s.size()){
        tables[s[i] - 'a'].push_back(i);
        tablet[t[i] - 'a'].push_back(i);
    }
    sort(Range(tables));
    sort(Range(tablet));

    Cout((tables == tablet) ? "Yes" : "No");
}



Measured memory_bytes: 3080
// VU TRUONG AN
#include <bits/stdc++.h>
#define F first
#define S second
#define maxn 200005
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define pi acos(-1)
#define bit(p,x) ((x>>p) & 1)
#define Task "CF"
using namespace std;

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

const int base = 200003;
const long long MM = 1ll * MOD * MOD;

int n;

bool Count(int x){
    string s;
    while(x > 0){
        int pos = x % 10;
        s += pos + '0';
        x /= 10;
    }
    n = s.length();
    s = " " + s;
    for(int i = 1;i <= n / 2;++i){
        if(s[i] != s[n - i + 1]) return 0;
    }
    return 1;
}

void Solve(){
    int a,b;
    cin >> a >> b;
    int ans = 0;
    for(int i = a;i <= b;++i){
        ans += Count(i);
    }
    cout << ans;
}

void NumTime(){cerr << "Toi" << "\n";cerr << "Di" << "\n";cerr << "Chep" << "\n";cerr << "Code" << "\n";}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen(Task".inp", "r", stdin);
    freopen(Task".out", "w", stdout);
#endif
    int test = 1;
//    cin >> test;
    while(test--){
        NumTime();
        Solve();
    }
}


Measured memory_bytes: 3552