akhauriyash/Code-Regression huggingface dataset:
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**6)
    #r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    r = [int(stdin.readline()) for i in range(3)]
    
    if r[0] < r[1]:
        if r[2] % r[1] == 0:
            print(r[2] // r[1])
        else:
            print(r[2] // r[1] + 1)
    else:
        if r[2] % r[0] == 0:
            print(r[2] // r[0])
        else:
            print(r[2] // r[0] + 1)
    #'Yes', 'No', 'YES', 'NO', ':(', 'Yay!'
    #res = 0
    #a, b = map(int, r.split())
    #print()

if __name__ == '__main__':
    main()



Measured memory_bytes: 38384
/*
2 つの正整数 a, b が与えられます。 a, b の平均値を x とします。 
x の小数点以下を切り上げて得られる整数を出力してください。
*/
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  cout << (a + b)/2 + (a + b)%2 << endl;
}

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

class Main{
 public static void main(String args[]){
  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  try{
   String input_str;
   while((input_str = br.readLine()) != null){
    String[] input_strs = input_str.split(" ");
    int a = Integer.parseInt(input_strs[0]);
    int b = Integer.parseInt(input_strs[1]);
    System.out.println(a + b);
   }
  }catch(Exception e){
   System.out.println("Error");
  }
 }
}

Measured memory_bytes: 16996
import fractions,sys

n,m=map(int,input().split())
a = list(map(int, input().split()))
# ans = a[0]
# for i in range(1,n):
#     ans = ans * a[i] // fractions.gcd(ans, a[i])
ff=[]
for j in  a:
    count=0
    for i in range(1,36):
        if j%(2**i)==0:
            count+=1
    ff.append(count)
ff=[i==ff[0] for i in ff]

 
b = [int(i/2) for i in a]
# b_list=[i%4==0 for i in b]
# bb=sum(b_list)
# if bb!=0 and bb!=n:
if all(ff)==False:
    print(0)
    exit()

ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

# tf=[(ans2/i)%2==0 for i in b]
# and any(tf)
if ans2>m:
    print(0)
else:
    print((m-ans2)//(ans2*2)+1)

Measured memory_bytes: 16316
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
 
int main(){
    int A;
    cin >> A;
 
    cout << 2*A*M_PI;
 
 
    return 0;
}

Measured memory_bytes: 3784
l=input().split()
list_ans=[]
A=int(l[0])*int(l[2])-int(l[1])
list_ans.append(A)
for i in range(9):
	B=int(l[0])*int(list_ans[-1])-int(l[1])
	list_ans.append(B)
for j in list_ans:
	print(j)

Measured memory_bytes: 3060
# 範囲の幅を狭めていく

n, m = map(int, input().split())

# 初期条件
left = 1
right = n

for i in range(m):
    l, r = map(int, input().split())
    left = max(left, l)
    right = min(right, r)

# leftよりrightが小さくなってしまう場合が存在
# そのときは0
print(max(right-left+1, 0))

Measured memory_bytes: 3060
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

char bufr[10];
int bufrl;

#define getchar_unlocked() bufr[bufrl++]

int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }

int main(void){
	read(STDIN_FILENO, bufr, sizeof(bufr));
	int a=nextint();
	int b=nextint();
	printf("%d\n", a*b);
}


Measured memory_bytes: 1584
#include <iostream>

using namespace std;
typedef long long ll;

int main(int argc, char const* argv[])
{
    ll D;
    ll N;
    cin >> D >> N;
    if(D == 0){
        cout << N + N/100 << endl;
    }else if(D == 1){
        cout << 100*N + (N/100)*100 << endl;
    }else if(D == 2){
        cout << 10000*N + (N/100)*10000 << endl;
    }
    return 0;
}


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

int main()
{
    ll n,x,i,j;

    scanf("%lld",&n);
    vector<pair<ll,ll>>v;

    for(i=0;i<n;i++)
    {
        scanf("%lld",&x);
        v.push_back(make_pair(x,i+1));
    }

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

    for(i=0;i<v.size();i++)
        cout<<v[i].second<<" ";
    cout<<endl;

    return 0;
}


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

int main() {
  int64_t N,Z=0;
  cin>>N;
  vector<int> p(N);
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    if(i-a>0&&i-a<N){
      Z+=p.at(i-a);
    }
    if(i+a<N){
      p.at(i+a)++;
    }
  }
  cout<<Z<<endl;


}



Measured memory_bytes: 4044
#include <stdio.h>
int main(void)
{
    int N;
    
    printf("\n");
    //scanf("%d", &N);
    
    if(scanf("%d", &N)==1)
    {
        if(1<=N&&N<=100000)
        {
            if(1<=N&&N<10)
            {
                printf("%d", N);
            }
            else if(10<=N&&N<100)
            {
                printf("%d", N-N+9);
            }
            else if(100<=N&&N<1000)
            {
                printf("%d", (N-100+1)+9);
            }
            else if(1000<=N&&N<10000)
            {
                printf("%d", N-N+909);
            }
            else if(10000<=N&&N<100000)
            {
                printf("%d", (N-10000+1)+909);
            }
            else if(N==100000)
            {
                printf("%d", N-N+90909);
            }
            }
        else
        {
        printf("error\n");
        }
    }
    else
    {
        printf("error\n");
    }
    return 0;
}


Measured memory_bytes: 128
while true
  h,w = gets.chomp.split(" ").map &:to_i
  break if w == 0 and h == 0

  h.times { |i|
   w.times { |j|
     if (i+j)%2 == 0
       print "#"
     else
       print "."
     end
   }
   puts
  }

  puts
end

Measured memory_bytes: 8700
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    int N = sc.nextInt();
	    int M = sc.nextInt();
	    
	    int Lmax=0;
	    int Rmin=1000000;
	    for(int i = 0; i < M; i++) {
	    	int Li = sc.nextInt();
	    	int Ri = sc.nextInt();
	    	
	    	if (Li>Lmax)
	    		Lmax=Li;
	    	if (Ri<Rmin)
	    		Rmin=Ri;
	    	
	    }
	    sc.close();
	    if (Lmax<=Rmin)
	    	System.out.println(Rmin-Lmax+1);
	    else
	    	System.out.println(0);
	}

}


Measured memory_bytes: 62192
#include <iostream>
#include <vector>

using namespace std;

int main() {
  
  int n, a, b;
  
  while( cin >> n >> a >> b && (n|a|b) ) {
    vector<bool> cantCount(n+1, 0);
    
    for(int i=0; i<=n; i++) {
      cantCount[i] = true;
    }
    
    for(int i=0; i<b; i++)
      for(int can=a*i; can<=n; can+=b)
	cantCount[can] = false;
    
    int sum = 0;
    for(int i=1; i<=n; i++) sum += cantCount[i];
    
    cout << sum << endl;
  }
  
  return 0;
}

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

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

    sort(b, b + n);
    int max = b[n - 1];
    int second = b[n - 2];

    for(int i = 0; i < n; i++) {
        if(a[i] == max) cout << second << endl;
        else cout << max << endl;
    }

    return 0;
}

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

const int N=2e5+100;
const int mod=1e9+7;
typedef long long ll;


typedef pair<int,int> pa;

set<string>s;

vector<string>ve;
unordered_map<string,int>mp;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    string ss;cin>>ss;
    int len=ss.size();
    for(int i=0;i<len;i++){
            string kk="";
        for(int j=i;j<min(len,i+10);j++){
             kk.push_back(ss[j]);
            if(!mp[kk]){
                mp[kk]=1;
                ve.push_back(kk);
            }
        }
    }
    sort(ve.begin(),ve.end(),less<string>());
    int k;cin>>k;
    cout<<ve[k-1]<<endl;
    return 0;
}


Measured memory_bytes: 7848
#include<stdio.h>
#define MOD 1000000007;
int N, i, j;
char S[100001], c;
long long int dp[100001][4];
int main(){
	c=getchar(); while(c!=10){S[N++]=c; c=getchar();}

	dp[N][3]=1;
	for(i=N-1; i>=0; --i){
		{
			dp[i][3] = dp[i+1][3] * (S[i] == '?' ? 3LL : 1LL);
			dp[i][3] %= MOD;
		}
		for(j=2; j>=0; --j){
			if(S[i]=='?'){
				dp[i][j] = dp[i+1][j]*3 + dp[i+1][j+1];
			}else if(S[i] == j+'A'){
				dp[i][j] = dp[i+1][j] + dp[i+1][j+1];
			}else{
				dp[i][j] = dp[i+1][j];
			}
			dp[i][j] %= MOD;
		}
	}
	printf("%lld\n", dp[0][0]);
}


Measured memory_bytes: 3328
import collections

res = str()

def make(ans,n,s):
    for i in range(2,n):
        if ans[i-1] == 'S':
            if s[i-1] == 'o':
                ans += ans[i-2]
            else:
                ans += 'S' if ans[i-2] == 'W' else 'W'
        else:
            if s[i-1] == 'o':
                ans += 'S' if ans[i-2] == 'W' else 'W'
            else:
                ans += ans[i-2]
    return ans

def check(ans,s,i):
    if ans[i] == 'S':
        if s[i] == 'o':
            return ans[i-1] == ans[i+1]
        else:
            return ans[i-1] != ans[i+1]
    else:
        if s[i] == 'o':
            return ans[i-1] != ans[i+1]
        else:
            return ans[i-1] == ans[i+1]

def solve():
    n = int(input())
    s = input()
    ans = make("SS",n,s)
    if check(ans,s,0) and check(ans,s,-1):
        print(ans)
        return
    ans = make("SW",n,s)
    if check(ans,s,0) and check(ans,s,-1):
        print(ans)
        return
    ans = make("WS",n,s)
    if check(ans,s,0) and check(ans,s,-1):
        print(ans)
        return
    ans = make("WW",n,s)
    if check(ans,s,0) and check(ans,s,-1):
        print(ans)
        return
    print(-1)
    return

if __name__ == "__main__":
    solve()


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)cin>>a[i];
int aal=0;for(int i=0;i<n;i++)aal+=a[i];
int b=0,ans=MOD*MOD;
for(int i=0;i<n-1;i++){
    b+=a[i];
    ans=min(ans,aal-2*min(b,aal-b));
}
cout<<ans;

return 0;
}


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

#define L 200005

using namespace std;

double x[L], y[L];

double dist(double x, double y) {
    double s = (double)(x * x) + (double)(y * y);
    return sqrt(s);
}

int main() {
    int N, D; cin >> N >> D;
    int cnt = 0;
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i];
    for (int i = 0; i < N; i++) {
        if (dist(x[i], y[i]) <= (double)(D)) cnt++; 
    }
    cout << cnt << "\n";
    return 0;
}

Measured memory_bytes: 6324
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
template<typename T> void chadd(T& a, T b) { a = a + b; }

namespace {  // 名前なし名前空間
	// gcd, lcm は C++17 でstdに標準入りしたので言語のバージョンに注意
	// 最大公約数
	ll gcd(ll a, ll b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

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

int main() {

	int n;
	cin >> n;

	int odd_num = 0;
	Rep(i, 1, n + 1) {
		if (i % 2 == 1) odd_num++;
	}

	cout << fixed << setprecision(10) << (double)odd_num / (double)n << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int N, nums[100000], t, cnt = 0;

int main(void)
{
	//freopen("input.txt", "r", stdin);
	scanf("%d", &N);
	for (int n = 0; n < N; ++n)
		scanf("%d", nums + n);
	for (int n = 0; n < N - 1; ++n)
	{
		if (nums[n] == n + 1)
		{
			t = nums[n];
			nums[n] = nums[n + 1];
			nums[n + 1] = t;
			++cnt;
		}
	}
	if (nums[N - 1] == N)
	{
		t = nums[N - 1];
		nums[N - 1] = nums[N - 2];
		nums[N - 2] = t;
		++cnt;
	}
	printf("%d", cnt);
	return 0;
}

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

int main(){
    ll H; cin >> H;
    ll tmp=0;
    while(1){
        if (pow(2,tmp)<=H && H<pow(2,tmp+1)) break;
        tmp++;
    }
    
    ll ans=0;
    for (int i=0; i<=tmp; i++) ans+=pow(2,i);
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//////////////////////////////
// Author: whatisit
// Date: 2020-05-23 15:55 
//////////////////////////////
#include <bits/stdc++.h>
using namespace std;

priority_queue<int, vector<int>, greater<int>> red;
priority_queue<int, vector<int>, greater<int>> blue;
priority_queue<int> colorless;
int x, y, a, b, c, d;
long long ans;

void solve() {
	cin >> x >> y >> a >> b >> c;
	for (int i = 0; i < x; ++i) {
		cin >> d;
		red.push(d);
	}
	for (int i = x; i < a; ++i) {
		cin >> d;
		if (red.top() < d) {
			red.pop();
			red.push(d);
		}
	}
	for (int i = 0; i < y; ++i) {
		cin >> d;
		blue.push(d);
	}
	for (int i = y; i < b; ++i) {
		cin >> d;
		if (blue.top() < d) {
			blue.pop();
			blue.push(d);
		}
	}
	for (int i = 0; i < c; ++i) {
		cin >> d;
		colorless.push(d);
	}
	while ((!colorless.empty()) && 
	       (((!red.empty()) && (red.top() < colorless.top())) ||
	       ((!blue.empty()) && (blue.top() < colorless.top())))) {
		if (red.empty()) {
			blue.pop();
			ans += colorless.top();
			colorless.pop();
		} else if (blue.empty()) {
			red.pop();
			ans += colorless.top();
			colorless.pop();
		} else if (red.top() < blue.top()) {
			red.pop();
			ans += colorless.top();
			colorless.pop();
		} else {
			blue.pop();
			ans += colorless.top();
			colorless.pop();
		}
	}
	while (!red.empty()) {
		ans += red.top();
		red.pop();
	}
	while (!blue.empty()) {
		ans += blue.top();
		blue.pop();
	}
	cout << ans;
}

int main() {
	//cin.tie(0); ios_base::sync_with_stdio(0);
	solve();
	return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  int s = 0;
  for(int i = 0; i < N; ++i) cin >> A[i], s += A[i];
  int cnt = 0;
  for(int i = 0; i < N; ++i){
    if(A[i]*4*M >= s) ++cnt;
  }
  puts(cnt >= M ? "Yes" : "No");
}


Measured memory_bytes: 256
a,b,q = map(int,input().split())

sl = [-float("inf")]
for _ in range(a):
    sl.append(int(input()))
sl.append(float("inf"))
tl = [-float("inf")]
for _ in range(b):
    tl.append(int(input()))
tl.append(float("inf"))
    
import bisect


for _ in range(q):
    x = int(input())
    index1 = bisect.bisect(sl, x) 
    index2 = bisect.bisect(tl, x)
    rs = abs(sl[index1] - x) 
    ls = abs(sl[index1-1] - x)
    rt = abs(tl[index2] - x)
    lt = abs(tl[index2-1] - x)
    ansl = []
    ansl.append(max(rs,rt))
    ansl.append(max(ls,lt))
    ansl.append(2*min(rs,lt)+max(rs,lt))
    ansl.append(2*min(ls,rt)+max(ls,rt))
    print(min(ansl))
    


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

int main() {
  int k;
  cin >> k;

  queue<int64_t> lunluns;
  for (int i = 1; i <= 9;  ++i) lunluns.push(i);
  for (int i = 0; i < k-1; ++i) {
    int64_t x = lunluns.front();
    lunluns.pop();

    int64_t n = x * 10 + x % 10;
    if (x % 10 != 0) lunluns.push(n-1);
    lunluns.push(n);
    if (x % 10 != 9) lunluns.push(n+1);
  }
  cout << lunluns.front() << endl;
}


Measured memory_bytes: 5068
H,W = map(int,input().split())
num = 0
for i in range(H):
    a = input()
    if "#" in a[:num]:
        print("Impossible")
        exit()
    cnt = -1
    for j in range(num, W):
        if a[j] == "#":
            cnt += 1
        else:break
    num += cnt
    if "#" in a[num+1:]:
        print("Impossible")
        exit()
print("Possible")

Measured memory_bytes: 9196
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define endl '\n'
bool i(string a){
string b=a;
reverse(b.begin(),b.end());
return (a==b);
}
int main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    string a;
    cin>>a;
    string b="";
    string c="";
    ll n=a.size();
    for(ll i=0;i<a.size()/2;i++){
        b+=a[i];
        c+=a[n-i-1];
    }
    if(i(a) && i(b) && i(c))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int H, W;

		while (true) {
			H = sc.nextInt();
			W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (i == 0 || i == H - 1 || j == 0 || j == W - 1) {
						System.out.print("#");
					} else {
						System.out.print(".");
					}
				}
				System.out.println();
			}
			System.out.println();
		}

	}
}


Measured memory_bytes: 34396
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
/*================Header Template==============*/
string s;
int cx[8005],cy[8005],cntx,cnty,cntfx,cntfy,x,y,px,py,dx,dy,allx,ally;
bool isx=1;
set<int>reachx[8005],reachy[8005];
inline bool checkx(int now) {
	reachx[0].insert(0);
	for(int i=1;i<=cntx;i++)
		for(set<int>::iterator it=reachx[i-1].begin();it!=reachx[i-1].end();it++)
			reachx[i].insert(*it+cx[i]),reachx[i].insert(*it-cx[i]);
	return reachx[cntx].count(now);
}
inline bool checky(int now) {
	reachy[0].insert(0);
	for(int i=1;i<=cnty;i++)
		for(set<int>::iterator it=reachy[i-1].begin();it!=reachy[i-1].end();it++)
			reachy[i].insert(*it+cy[i]),reachy[i].insert(*it-cy[i]);
	return reachy[cnty].count(now);
}
int main() {
	cin>>s;
	read(x);read(y);
	int pos=0;
	while(s[pos]=='F')
		px++,pos++;
	for(int i=pos;i<s.length();i++) {
		if(s[i]=='F'&&isx)
			cntfx++;
		else if(s[i]=='F'&&!isx)
			cntfy++;
		else {
			if(isx) {
				cx[++cntx]=cntfx;
				cntfx=0;
				isx=0;
			}
			else if(!isx) {
				cy[++cnty]=cntfy;
				cntfy=0;
				isx=1;
			}
		}
	}
	if(isx) {
		cx[++cntx]=cntfx;
		cntfx=0;
		isx=0;
	}
	else if(!isx) {
		cy[++cnty]=cntfy;
		cntfy=0;
		isx=1;
	}
	dx=abs(x-px);
	dy=abs(y-py);
//	cout<<dx<<" "<<dy<<" "<<allx<<" "<<ally<<endl;
	if(checkx(dx)&&checky(dy))
		puts("Yes");
	else
		puts("No");
}

Measured memory_bytes: 191360
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        n: usize,
        a_vec: [usize; n],
    }

    let mut ans = 0;

    for i in 0..n {
        if i % 2 == 1 { continue; }

        if a_vec[i] % 2 != 0 {
            ans += 1;
        }
    }

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


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

vi a;

void chmax(int &a, int b){
  if(a < b)
    a = b;
}

bool is_ok(int x, int k){
  int sum = 0;
  rep(i, 0, a.size()){
    sum += (a[i] + (x-1))/x -1;
  }
  if(k >= sum)
    return true;
  else
    return false;
}

int binary_search(int key, int amax){
  int ng = 0;
  int ok = amax;
  
  while(abs(ok-ng) > 1){
    int mid = (ok + ng)/2;
    
    if(is_ok(mid, key))
      ok = mid;
    else
      ng = mid;
  }
  
  return ok;
}

int main(){
  int n, k;
  cin >> n >> k;
  int amax = 0;
  rep(i, 0, n){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
    chmax(amax, tmp);
  }
  
  int ans = binary_search(k, amax);
  
  cout << ans << endl;
  
  return 0;
  
}

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


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

    int n;
    cin>>n;
    int w[n];
    int sum=0;
    int a=0;
    for (int i = 0; i < n; i++)
    {
        cin>>w[i];
        sum+=w[i];
    }
    int ans=sum;
    for(int i=0;i<n;i++){
        a +=w[i];
        sum-=w[i];
        ans = min(ans,abs(a-sum));
    }
    cout << ans << endl;

    
}

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

int main() {
  string s, t;
  cin >> s >> t;
  int count = 0;
  for(int i = 0; i < s.size(); i++) {
    if(s.at(i) == t.at(i)) count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan =new Scanner(System.in);
        int a=scan.nextInt();
        int b=scan.nextInt();

        if((a+b)%3==0) System.out.println("Possible");
        else if(a%3==0) System.out.println("Possible");
        else if(b%3==0) System.out.println("Possible");
        else System.out.println("Impossible");
    }
}


Measured memory_bytes: 22356
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc088.contest.atcoder.jp/tasks/arc088_a>
問題文============================================================
 高橋君は、日頃の感謝を込めて、お母さんに数列をプレゼントすることにしました。
 お母さんにプレゼントする数列 A は、以下の条件を満たす必要があります。
 
 A は X 以上 Y 以下の整数からなる
 すべての 1≤i≤|A|−1 に対し、Ai+1 は Ai の倍数であり、かつ Ai+1 は Ai より真に大きい
 
 高橋君がお母さんにプレゼントできる数列の長さの最大値を求めてください。
=================================================================

解説=============================================================

 最大の長さを得る数式は, a[0] = Xであり、
 a[1] = 2*a[0]
 a[2] = 2*a[1]
 .
 .
 .
 a[N] = 2*a[N-1]
 となるものである
 
================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll X,Y; cin >> X >> Y;
    ll ans = 0;
    while(X <= Y){
        ans++; X*=2;
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
using namespace std;
#include<string>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)

int main(void)
{


	int n;

	cin >> n;

	int p =ceil(n/ 1.08f);

	
	if (floor(p * 1.08) == n) cout << p;

	else cout << ":(" << endl;


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll int64_t 
#define f(i,s,e) for(i=s;i<e;++i)
#define endl << "\n"
#define sp << " "
#define INF INFINITY
#define mset(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI acos(-1) 
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define eb(a) emplace_back(a)
#define print(x) for(auto it:x) cout<<it<<' '; cout<<"\n";

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

int main()
{
	FAST_IO ;
	string s;
	cin >> s;
	ll ans = 0;
	for(int i = 0;i<s.size();++i)
		ans = (ans + s[i]-'0'+9)%9 ;
	if(!ans)
		cout << "Yes\n" ;
	else
		cout << "No\n" ;
	return 0;
}

/*
If u haven't come up with an approach yet ,skip this one
  Try this when feeling stuck -
  1. Int overflow, array bounds
  2. Special cases (n=1?)
  3. Prove your approach to yourself(mathematical induction,counter-intuitive or stronger test cases)
  4. Calm down and don't look at standings and stop thinking about rating and think about the question
  5. Just do it! 
*/ 

//Benq's advice - 
/* 
	And following advices are must for me -
	* do something instead of nothing and stay organized
	* WRITE STUFF DOWN 
*/

//#define _GLIBCXX_DEBUG 
// It will convert WA verdict to runtime error if that error is caused due to out of bound excess , declare it at the top
//#pragma GCC optimize "trapv" 
// It will convert WA to runtime error if WA was caused due to int overflow error,declare it anywhere

Measured memory_bytes: 3768
#include<bits/stdc++.h>
#define reg(i,a,b) for(int i=a;i<=b;++i)
typedef long long ll;
using namespace std;
const int mx=1e5+10;
ll ans;
int main(){
	int n;
	scanf("%d",&n);
	int t=(int)1e9,c=0;
	int x;
	reg(i,1,n){
		scanf("%d",&x);
		if(x<0){
			++c;
			x=abs(x);
		}
		t=min(t,x);
		ans+=x;
	}
	//cout<<ans<<endl;
	//cout<<t<<endl;
	printf("%lld\n",c&1?ans-(t<<1):ans);
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
	int n,k;
	cin>>n>>k;
	if(n==1){
		if(k==0){
			cout<<"1 1 0 0";
		}else cout<<-1;
		RE 0;
	}
	int m=(1<<n);
	if(k>=m){
		cout<<-1;RE 0;
	}
	FOR(i,0,m-1)if(i!=k)cout<<i<<' ';
	cout<<k<<' ';
	for(int i=m-1;i>=0;i--)if(i!=k)cout<<i<<' ';
	cout<<k;
	RE 0;
}




Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <functional>

using namespace std;
#define PI 3.14159265359
#define ll long long int


int main()
{
    ll N, R, ans;
    cin >> N >> R;
    if(N >= 10) ans = R;
    else ans = R + 100 * (10 - N);

    cout << ans << endl;

    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
typedef long long ll;

int main(){
  int N; cin >> N;
  vector<ll> a(N);
  rep(i,N)cin>>a[i];
  ll ans = 0;
  rep(i,N)rep(j,N){
    ans = max(ans, abs(a[i]-a[j]));
  }
  cout << ans << endl;
  return 0;
}


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

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//const int INF = 1e9;//INT_MAX=1<<31-1=2147483647
const ll INF = (ll)1e18;//1<<63-1=9223372036854775807
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline bool isnatural(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

const ll M_MAX = 10;

ll N, M;

vector<vector<ll>> s;
vector<ll> p;

void input() {
	scanf("%lld%lld", &N, &M);
	rep(i, M){
		ll K;
		cin>>K;
		vector<ll> t;
		rep(j,K){
			ll ss;
			cin>>ss;
			ss--;
			t.push_back(ss);
		}
		s.push_back(t);
	}
	rep(i,M){
		ll K;
		cin >> K;
		p.push_back(K);
	}
}

void solve() {
	ll ans = 0;

	vector<int> pattern(N+1,0);
	while(1){
		bool issuccess=true;
		[&]{
			rep(i,M){
				ll t=0;
				vector<ll> ss=s[i];
				rep(j,ss.size()){
					if(pattern[ss[j]])t++;
				}
				if(t%2!=p[i]){
					issuccess=false;
					return;
				}


			}
		}();
		if(issuccess)ans++;

		//カウントアップ 2^nを列挙できる
		pattern[0]++;
		rep(i,N){
			if(pattern[i]==2){
				pattern[i]=0;
				pattern[i+1]++;
			}
		}
		if(pattern[N]>0)break;
	}
	printf("%lld\n", ans);
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        k: usize,
        mut a: [isize; n],
    }

    let m = 1000000007;
    let max = 510000;
    a.sort();

    let com = COM::new(max, m);
    let mut max = 0;
    let mut min = 0;
    for i in 0..n {
        min = (min + (com.com(n - i - 1, k - 1) * a[i]) % m) % m;
        max = (max + (com.com(i, k - 1) * a[i]) % m) % m;
        //println!("index {} min {} max {}", i, min, max);
    }
    let ans = (max + m - min) % m;
    println!("{}", ans);
}

struct COM {
    fac: Vec<isize>,
    finv: Vec<isize>,
    inv: Vec<isize>,
    max: usize,
    m: isize,
}

impl COM {
    fn new(max: usize, m: isize) -> Self {
        let mut com = COM {
            fac: vec![0; max],
            finv: vec![0; max],
            inv: vec![0; max],
            max: max,
            m: m,
        };
        com.init();
        com
    }

    fn init(&mut self) {
        self.fac[0] = 1;
        self.fac[1] = 1;
        self.finv[0] = 1;
        self.finv[1] = 1;
        self.inv[0] = 0;
        self.inv[1] = 1;

        let mut i = 2;
        while i < self.max {
            self.fac[i] = self.fac[i - 1] * i as isize % self.m;
            self.inv[i] =
                self.m as isize - self.inv[self.m as usize % i] * (self.m / i as isize) % self.m;
            self.finv[i] = self.finv[i - 1] * self.inv[i] % self.m;
            i += 1;
        }
    }

    fn com(&self, n: usize, k: usize) -> isize {
        if n < k {
            return 0;
        }
        self.fac[n] * (self.finv[k] * self.finv[n - k] % self.m) % self.m
    }
}


Measured memory_bytes: 15864
#include <bits/stdc++.h>
#define ll  long long
#define ull unsigned long long  
using namespace std;
#define  inf 1e6+18
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod 1000000007
#define  f1(i,n) for(i=1;i<=n;i++)
#define f0(i,n)  for(i=0;i<n;i++)
#define w(x)   while(x--)
const int maxn=500001;
#define  pq priority_queue
#define  ff first
#define  ss second 
#define pb  push_back
#define lb lower_bound

ll k1=0;
bool comp(pair<ll,ll>a,pair<ll,ll>b)
{
	k1=max(k1,abs(a.ff-b.ff)+abs(a.ss-b.ss));
	if(a.ff>b.ff)
		return 1;

	if(a.ff==b.ff&&a.ss>b.ss)
		return 1;
	return 0;
}
int dx[]={1,-1};
int dy[]={1,-1};
int main()
{
	fastio;
	int t;
	ll i,j,k,n,m,l;
	cin>>n>>k>>l;
	if(k*l>=n)
		cout<<"Yes";
	else
		cout<<"No";

}
//Lordvishnu@almighty

Measured memory_bytes: 3564
def main():
  array = []
  lel = input()
  lel = lel.split()
  lel[0] = int(lel[0])
  lel[1] = int(lel[1])
  quantity = 0

  for item in range(lel[0]):
    array.append(int(input()))

  for item in array:
    lel[1] -= item
    quantity += 1
  quantity += lel[1]//min(array)

  print(quantity)

if __name__ == "__main__":
  # execute only if run as a script
  main()

Measured memory_bytes: 9004
alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet_list = list(map(str, alphabet))
s = list(input())
s_set = list(set(s))
for s in s_set:
    if s in alphabet_list:
        alphabet_list.remove(s)
if len(alphabet_list) != 0:
    print(alphabet_list[0])
else:
    print('None')

Measured memory_bytes: 3956
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <vector>
using namespace std;
typedef long long LL;

struct node{
	LL a,b;
}s[200005];
bool cmp(node x,node y){
	if(x.a == 0 && y.a == 0) return x.b < y.b;
	return y.a * (x.b + 1) < x.a * (y.b + 1);
}

LL dp[200005][35];

int main(){
	LL n,T,st,ans = 0;
	cin >> n >> T;
	for(LL i = 1;i <= n;i ++) cin >> s[i].a >> s[i].b;
	st = n + 1; sort(s + 1,s + 1 + n,cmp);
	for(LL i = n;i >= 1;i --) if(s[i].a == 0) st = i;
	
	for(LL i = 0;i <= 31;i ++) dp[0][i] = T + 1;
	dp[0][0] = 0;
	for(LL i = 1;i < st;i ++){
		dp[i][0] = dp[i - 1][0];
		for(LL j = 1;j <= 31;j ++){
			dp[i][j] = min(dp[i - 1][j],(1 + dp[i - 1][j - 1]) * (1 + s[i].a) + s[i].b);
			dp[i][j] = min(dp[i][j],T + 1);
		}
	}
	for(LL j = 0;j <= 31;j ++){
		LL tt = dp[st - 1][j];
		if(tt > T) continue;
		ans = max(ans,j);
		for(LL k = st;k <= n;k ++){
			if(tt + s[k].b + 1 > T) break;
			ans = max(ans,(k - st + j + 1));
			tt += (s[k].b + 1);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 58112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz(v) (ll((v).size()))
#define forn(i,n) for(ll i=0;i<(n);i++)
#define forr(i,n) for(ll i=(n)-1;i>=0;i--)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))

const ll W =1e5+5;
const ll N = 110;
const ll inf=1e15;
ll w[N],v[N],dp[N][W],n,k=1e5+2,wt;


int main()
{
    ios_base::sync_with_stdio(false);

	clr(dp);
	cin>>n>>wt;forn(i,n)cin>>w[i]>>v[i];
	forn(i,n)forn(j,k)dp[i][j]=inf;
	dp[0][0]=0;dp[0][v[0]]=w[0];
	for(int i=1;i<n;i++)
	{
		forn(j,k)
		{
			dp[i][j]=dp[i-1][j];
			if(j>=v[i])dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
		}
	}
	ll mx=0;
	forn(i,n)forn(j,k)if(dp[i][j]<=wt)mx=max(mx,j);
	cout<<mx<<endl;
}


Measured memory_bytes: 86272
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 1000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};

int ans;
int n,m;
int h,w;
string s[111];

int d[111][111];
int f[111][111];

int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
void bfs(){
	queue<P> que;
	que.push(P(0,0));
	while(que.size()){
		P p=que.front();que.pop();
		rep(i,4){
			int nx=p.second+dx[i],ny=p.first+dy[i];
			if(0<=nx && nx<w && 0<=ny && ny<h && s[ny][nx]=='.' && !f[ny][nx]){
				f[ny][nx]=1;
				d[ny][nx]=d[p.first][p.second]+1;
				que.push(P(ny,nx));
			}
		}
	}
}


signed main(){
	
	cin>>h>>w;
	rep(i,h)cin>>s[i];
	int extra=0;
	rep(i,h){
		rep(j,w)if(s[i][j]=='#')extra++;
	}
	bfs();
	if(d[h-1][w-1])cout<<h*w-extra-d[h-1][w-1]-1<<endl;
	else cout<<-1<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#define ll long long
using namespace std;
int main(void){
    // Your code here!
    vector<ll> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll n;
    cin>>n;
    cout<<a[n-1]<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int N;
int t[128], v[128];

int zikoku[128];

int seigen[200000];
int limit[200000];

int main(void) {
	int i;
	int mofu;
	double mareitaso = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &t[i]) != 1) return 1;
	}
	for (i = 0; i < N; i++) {
		if (scanf("%d", &v[i]) != 1) return 1;
	}
	zikoku[0] = 0;
	for (i = 1; i <= N; i++) {
		zikoku[i] = zikoku[i - 1] + t[i - 1];
	}
	mofu = 0;
	for (i = 0; i < N; i++) {
		int j;
		for (j = 0; j < t[i]; j++) {
			seigen[mofu++] = v[i];
		}
	}
	for (i = 0; i < mofu; i++) {
		int sumipe = seigen[i];
		int j;
		if (i < sumipe) sumipe = i;
		if (mofu - i < sumipe) sumipe = mofu - i;
		for (j = 0; j < N; j++) {
			int tomatu;
			if (zikoku[j] + t[j] < i) tomatu = v[j] + (i - (zikoku[j] + t[j]));
			else if (i < zikoku[j]) tomatu = v[j] + (zikoku[j] - i);
			else tomatu = v[j];
			if (tomatu < sumipe) sumipe = tomatu;
		}
		limit[i] = sumipe;
	}
	limit[mofu] = 0;
	for (i = 0; i < mofu; i++) {
		if (limit[i] != limit[i + 1]) {
			mareitaso += (limit[i] + limit[i + 1]) * 1.0 / 2.0;
		} else if (limit[i] < seigen[i]) {
			mareitaso += limit[i] * 1.0 + 0.5 * 1.0 / 2.0;
		} else {
			mareitaso += limit[i] * 1.0;
		}
	}
	printf("%.2f\n", mareitaso);
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	long long a, b, c, e;
	string s, g;
	cin >> s >> g;
	if (s.size() == g.size()) {
		for (int h = 0; h < s.size(); h++) {
			cout << s[h] << g[h];
		}
	}
	else {
		for (int j = 0; j < g.size(); j++) {
			cout << s[j] << g[j];
		}
		cout << s[s.size() - 1];
	}
	cin >> e;
}

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

int main() {

    int n, sum = 0, sum1 = 0;
    long long a[100000];

    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] % 4 == 0) sum++;
        else if(a[i] % 2 == 0) sum1++;
    }

    if(sum + sum1 / 2 >= n / 2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
using namespace std;
const int maxn=2e5+10;
int n,a[maxn];
long long ans;
map<int,int>num;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if (num.count(a[i]-i)) ans+=num[a[i]-i];
		num[-a[i]-i]++;
	}
	printf("%lld\n",ans);
return 0;
}

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

using namespace std;
typedef long long ll;
    
int main()
{
    int N;
    cin >> N;

    ll result = 0;
    for (int i = 1; i <= N; i++) {
        if (!(i%3 == 0 || i%5 == 0)) {
            result += i;
        }
    }
    cout << result;

    return 0;
}


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

typedef long long ll;

using namespace std;

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

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

ll lcm_n(vector<ll> num){
  ll l=num[0];
  for(int i=0;i<num.size();i++)l=lcm(l,num[i]);
  return l;
}

ll func(ll a, ll m){
  ll cnt=1,x=a%m;
  while(x!=1)x=(a*x)%m,cnt++;
  return cnt;
}

int main(void){

  ll m[4],a[4];

  while(true){

    int b=0;
    for(int i=1;i<4;i++){
      cin >> a[i] >> m[i];
      b|=a[i]|m[i];
    }
    if(!b)break;
    
    ll cnt=0,x=1,y=1,z=1;
    vector<ll>num;

    for(int i=1;i<4;i++)
    num.push_back(func(a[i],m[i]));

    cout << lcm_n(num) << endl;
  }

  return 0;
}

Measured memory_bytes: 1212
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author TM
 */


#include <bits/stdc++.h>

using namespace std;

class DWall {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        int h, w;
        cin >> h >> w;
        vector<vector<int>> c(10, vector<int>(10));
        for (int i = 0; i < 10; ++i) {
            for (int j = 0; j < 10; ++j) {
                cin >> c[i][j];
            }
        }
        vector<vector<int>> a_vec(h, vector<int>(w));
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                cin >> a_vec[i][j];
            }
        }
        vector<vector<int>> d(10, vector<int>(10));
        vector<int> res_d(10);
        for (int i = 0; i < 10; ++i) {
            queue<pair<int, int>> q;
            if (i == 1)continue;
            res_d[i] = c[i][1];
            for (int j = 0; j < 10; ++j) {
                if (i == j)continue;
                q.push(make_pair(j, c[i][j]));
            }
            while (!q.empty()) {
                auto p = q.front();
                q.pop();
                if (p.second >= res_d[i])continue;
                if (p.first == 1) {
                    res_d[i] = p.second;
                }
                for (int j = 0; j < 10; ++j) {
                    if (p.first == j)continue;
                    q.push(make_pair(j, p.second + c[p.first][j]));
                }
            }
        }
        int ans = 0;
        for (const auto &row : a_vec) {
            for (const auto &a : row) {
                if (a == -1)continue;
                ans += res_d[a];
            }
        }
        cout << ans << endl;
    }
};


int main() {
    DWall solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
  int n,i;
  int sum=0;
  cin >> n;
  for(i=0;i<n;i++){
    int a,b;
    cin >> a >> b;
    sum+=b-a+1;
  }
  cout << sum;
  return 0;
}
  


Measured memory_bytes: 888
#include<stdio.h>
int main()
{
	int k,s,i,j,l,n;
	scanf("%d%d",&k,&s);
	n=0;
	for(i=0;i<=k;i++)
	{
		for(j=0;j<=k;j++)
		{
		    l=s-i-j;
		    if(l<=k&&l>=0) n+=1;
		}
	}
	printf("%d",n);
	return 0;
}

Measured memory_bytes: 128
package main
import (
        "bufio"
        "fmt"
        "os"
        "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
    sc.Scan()
    return sc.Text()
}

func Atoi2(c string) int {
  tmp, _ := strconv.Atoi(c)
  return tmp
}

func main() {
	input := nextLine()
  i := Atoi2(input)

  h := i/3600
  m := i%3600/60
  s := i%3600%60

	fmt.Printf("%d:%d:%d\n",h,m,s)
}


Measured memory_bytes: 1120
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	long long a[100005],n,c,k,i,sum,h,j;
	while(scanf("%lld%lld%lld",&n,&c,&k)!=EOF)
	{
		for(i=0;i<n;i++)
		scanf("%lld",&a[i]);
		sort(a,a+n);
		//for(i=0;i<n;i++)
		//printf("%lld\n",a[i]);
		i=0;sum=0;h=0;
		while(i<n)
		{
			if(h==0)
			{
				sum++;
				j=a[i]+k;
			}
			
			if(a[i]<=j)
			h++;
			else
			{
				h=1;sum++;j=a[i]+k;
			}
			if(h==c)h=0;
			
			i++;
		//	printf("%lld %lld\n",sum,h);
		}
		printf("%lld\n",sum);
	}
	return 0;
 } 

Measured memory_bytes: 896
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str,str1;
    cin>>str>>str1;
    f=1;
    if(str.length()+1==str1.length()) {
        rep(i,str.length()) if(str[i]!=str1[i])  f=0;
    }
    else f=0;
    if(f==1) Yes;
    else No;
    //vector<vector<ll>> v(tate,vector<ll> (yoko));



    return 0;
}


Measured memory_bytes: 3636
/*
* @Author: Samson
* @Date:   2018-06-12 18:24:44
* @Last Modified by:   Samson
* @Last Modified time: 2018-06-13 12:52:45
*/
//   @URL : http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_12_A
#include<bits/stdc++.h>
#include<algorithm>
#include <cstdlib>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
const int MAXN = 1e2+10;

int p[MAXN],color[MAXN],a[MAXN][MAXN],t,n,d[MAXN];

int prim()
{
	int minv,u,v;
	memset(p,-1,sizeof p);
	memset(d,INF,sizeof d);

	d[2] = 0;
	int ans = 0;

	while(1)
	{
		minv = INF;
		u = -1;
		for(int i = 1; i <= n; ++i)
		{
			if(minv > d[i] && !color[i])
				minv = d[i],u = i;
		}
		if(u == -1)	break; //空集
		color[u] = 1; //从集合中删除
		for(int v = 1; v <= n; ++v)
		{
			if(!color[v] && a[u][v] != INF)
			{
				if(d[v] > a[u][v])
				{
					d[v] = a[u][v];
					p[v] = u;
				}
			}
		}
	}

	for(int i = 1; i <= n; ++i)
		if(p[i] != -1)
			ans += a[p[i]][i];
	return ans;
}

int main(void)
{
	ios::sync_with_stdio(false); 
	//cin.tie(0);
	cin>>n;
	for(int i = 1; i <= n; ++i)
	{
		for(int j = 1; j <= n; ++j)
		{
			cin>>t;
			a[i][j] = t==-1?INF:t;
		}
	}
	cout<<prim()<<'\n';
	return 0;
}


Measured memory_bytes: 3148
#include<cstdio>
#include<algorithm>
int main(){
	int n;
	scanf("%d",&n);
	int a[n]={};
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	std::sort(a,a+n);
	int ans=0;
	for(int i=0;i<n;i++){
		if(i%2==0)ans+=a[n-1-i];
		else ans-=a[n-1-i];
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
n = gets.to_i
s = gets.chomp.bytes
dot = '.'.ord
ns = '#'.ord
a = Array.new(n){Array.new(2, 0)}
if s[0] == dot
  a[0][0] = 1
else
  a[0][1] = 1
end
1.upto(n - 1) do |i|
  if s[i] == dot
    a[i][0] = a[i - 1][0] + 1
    a[i][1] = a[i - 1][1]
  else
    a[i][0] = a[i - 1][0]
    a[i][1] = a[i - 1][1] + 1
  end
end
min = [a[n - 1][0], a[n - 1][1]].min
n.times do |i|
  min = a[n - 1][0] - a[i][0] + a[i][1] if min > a[n - 1][0] - a[i][0] + a[i][1]
end
puts min

Measured memory_bytes: 14136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    ll N,C,K; cin >> N >> C >> K;
    vector<ll> t(N);
    for(int i=0; i<N; i++) cin >> t[i];
    sort(t.begin(), t.end());

    int ans = 0;
    int id = 0;
    while(id < N){
        ll cap = 0;
        ll dep = t[id]+K;
        while(cap+1<=C && id<N && t[id]<=dep){
            id++;
            cap++;
        }
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
n = int(input())
A = list(map(int,input().split()))
dic = {}
ans = 0
for a in A:
    if a in dic:
        dic[a] += 1
        if dic[a] == a:
            ans -= a-1
        else:
            ans += 1
    else:
        dic[a] = 1
        if a != 1:
            ans += 1
print(ans)

Measured memory_bytes: 17780