akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long       ll;
#define pb                emplace_back
#define mp              make_pair
#define sz(a)           a.size()
#define mods(a, m)          ((a % m + m) % m)   
#define md(a)               mods(a, MOD)
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define f first
#define s second
#define fore(i, b, e)     for (int i = b; i < e; i++)
#define forr(i, b, e)     for (int  i = b; i < e; i++)
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;
typedef long double       ld;

typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int INF = int(1e7 + 7);
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1);
#define tam 220000
ll lazy[tam];
ii v[tam];
int n,d,a;
ll answer=0;
void add(int li,int ri,int cuanto)
{
    answer+=cuanto;
    ll restar=cuanto*a;
    //cout<<"add a range "<<li<<' '<<ri<<' '<<restar<<endl;
    lazy[li]+=restar;
    lazy[ri+1]-=restar;
}
int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    
    cin>>n>>d>>a;
    forr(i,0,n)
    {
        cin>>v[i].F>>v[i].S;
    }
    sort(v,v+n);
    int li,ri;
    li=0,ri=0;
    ll actresta=0;
    while(li<n)
    {
        //cout<<"begin query "<<li<<' ';
        int ini=li;
        while(ri<n && v[ri].F-v[li].F<=2*d)
            ri++;
        //cout<<" shega a "<<ri<<endl;
        ll deuda=v[li].S-(actresta+lazy[li]);
        //cout<<deuda<<' ';
        add(li,ri-1,(deuda)/a+(deuda%a!=0));
        //cout<<actresta<<" hasta aca\n";
        //cout<<lazy[li]<<" add\n";
        while(li<n&& v[li].S-(actresta+lazy[li])<=0)
        {
            actresta+=lazy[li];
            li++;
        }
        //ri=max(li,ri);
        assert(li<=ri);
        //cout<<"avanza "<<li<<" "<<ri<<endl;
        
    }
    cout<<answer<<endl;
}
// PLUS ULTRA!


Measured memory_bytes: 3328
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
int main()
{
    string s;
    cin >> s;
    int k;
    cin >> k;
    set<string> se;
    rep(i, s.size())
    {
        repi(j, i, s.size())
        {
            if (j - i >= k)
            {
                continue;
            }
            string t = s.substr(i, j - i + 1);
            se.insert(t);
        }
    }
    auto ite = se.begin();
    rep(i, k - 1)
    {
        ite++;
    }
    cout << *ite << endl;
    return 0;
}

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

int main(){
  int n;
  while(cin >> n, n){
    vector<int> a(n);
    for(int i=0;i<n;i++)cin >> a[i];
    int start = a[0], prv = a[0];
    for(int i=1;i<n;i++){
      if(prv+1 != a[i]){
        if(start == prv)cout << start << " ";
        else cout << start << "-" << prv << " ";
        start = prv = a[i];
      }else{
        prv++;
      }
    }
    if(start == prv)cout << start << endl;
    else cout << start << "-" << prv << endl;
  }
}

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

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    vector<vector<int>> a(n, vector<int>(m));
    vector<int> c(n);
    for(int i = 0; i < n; i++){
        cin >> c[i];
        for(int j = 0; j < m; j++)cin >> a[i][j];
    }
    int ans = 12345678;
    int all = 1<<n;
    for(int mask = 0; mask < all; mask++){
        vector<int> level(m);
        int cost = 0;
        for(int i = 0; i < n; i++){
            if((mask>>i)&1){
                cost += c[i];
                for(int j = 0; j < m; j++){
                    level[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        for(int j = 0; j < m; j++){
            if(level[j] < x) ok = false;
        }
        if(ok) ans = min(ans,cost);
    }
    if(ans == 12345678) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC return 0;
using namespace std;
const int N(1e5 + 5);
int n, a[N], b[N], c[N], da[N], db[N], dc[N];
int main() {
    DAU
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> a[i] >> b[i] >> c[i];
    for (int i = 1; i <= n; ++i) {
        da[i] = max(db[i-1], dc[i-1]) + a[i];
        db[i] = max(da[i-1], dc[i-1]) + b[i];
        dc[i] = max(da[i-1], db[i-1]) + c[i];
    }
    cout << max(da[n], max(db[n], dc[n]));
    PLEC
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
string s;
int c,t;
bool a,f;
int main()
{
	cin>>s;
	for (int i=0;i<s.size();i++)
	{
		if (s[i]=='A')
		{
			if (i==0) a=true;
			if (i!=0) a=false;
		}
		if (s[i]=='C') c++,t=i+1;
		if (s[i]!='A' && s[i]!='C' && s[i]>='A' && s[i]<='Z') f=true;
	}
	if (c!=1 || !a || f) cout<<"WA";
	else if (t>=3 && t<=s.size()-1) cout<<"AC";
	else cout<<"WA";
    return 0;
}

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

int main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n), b(n);
	for (int &e : a) std::cin >> e;
	for (int &e : b) std::cin >> e;
	
	auto check = [&] () {
		bool ret = true;
		for (int i = 0; i < n; i++) ret &= (a[i] != b[i]);
		return ret;
	};
	
	std::reverse(b.begin(), b.end());
	
	if (check()) {
		std::cout << "Yes" << '\n';
		for (int e : b) std::cout << e << '\n';
	} else {
		std::reverse(b.begin(), b.end());
		std::rotate(b.begin(), b.begin() + (n / 2), b.end());
		if (check()) {
			std::cout << "Yes" << '\n';
			for (int e : b) std::cout << e << '\n';
		} else {
			std::cout << "No" << '\n';
		}
	}
	
	return 0;
}

Measured memory_bytes: 4832
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	int T1,T2;
	int A1,A2;
	int B1,B2;
	cin>>T1>>T2>>A1>>A2>>B1>>B2;

	A1*=T1,A2*=T2,B1*=T1,B2*=T2;

	if(A1+A2==B1+B2)
	{
		cout<<"infinity"<<endl;
		return 0;
	}
	if(A1+A2<B1+B2)
	{
		swap(A1,B1);
		swap(A2,B2);
	}
	if(B1-A1<0)cout<<0<<endl;
	else
	{
		int D=A1+A2-B1-B2;
		int T=(B1-A1)/D+1;
		T*=2;
		T--;
		if((B1-A1)%D==0)T--;
		cout<<T<<endl;
	}
	

	return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())

l = list()
la = [0] * (n+1)
ln = [0] * (n+1)

for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        la[b] = 1
    elif b == 1:
        la[a] = 1
    if a == n:
        ln[b] = 1
    elif b == n:
        ln[a] = 1

for i in range(n+1):
    if la[i]*ln[i] == 1:
        print("POSSIBLE") 
        exit()

print("IMPOSSIBLE")

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

using namespace std;

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

    int n;
    cin >> n;

    vector<int> a(n);
    long long cum = 0;
    for (int i = 0 ;i < n ;i++) {
        cin >> a[i];
        if (i&1)
            cum -= a[i];
        else
            cum += a[i];
    }

    for (int i = 0 ;i < n ;i++) {
        cout << cum << ' ';
        cum = (a[i] - cum / 2) * 2;
    }
}

Measured memory_bytes: 1792
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a, b = na()
for i in range(1, 100000):
    if i*8//100 == a and i*10//100 == b:
        print(i)
        sys.exit(0)
print(-1)


Measured memory_bytes: 39024
#include<stdio.h>
#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
int main(void){
  int x,y,a,b,i,num[30],t;

  scanf("%d %d",&y,&x);
  rep(i,y)num[i]=i+1;

  rep(i,x){
      scanf("%d,%d",&a,&b);
      t=num[a-1];
      num[a-1]=num[b-1];
      num[b-1]=t;
    }  
  rep(i,y)printf("%d\n",num[i]);
  
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int A[3];
    rep(i,3) cin >>A[i];
    sort(A,A+3);
    int b[3]={5,5,7};
    string ans="YES";
    rep(i,3){
        if(A[i]!=b[i]) ans="NO";
    }
    cout << ans << endl;


}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;

int n,i,j,k,Ans;
int pre[100005],ans[100005];
char s[100005];

int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	for(i=1;i<=300;++i)ans[i]=-1;
	for(i=1;i<=n;++i)
	{
		k=i-pre[s[i]];
		if(k>ans[s[i]])ans[s[i]]=k;
		pre[s[i]]=i;
	}
	Ans=10000;
	for(i='a';i<='z';++i)
	{
		k=n+1-pre[i];
		if(k>ans[i])ans[i]=k;
		if(ans[i]<Ans)Ans=ans[i];
	}
	printf("%d\n",Ans-1);
}

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

#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define eb emplace_back

typedef long long ll;
typedef pair<int,int> ii;
typedef vector< pair<int,int> > vii;
const int INF = 0x3f3f3f3f;
 
int main() {
    ios_base::sync_with_stdio(false);
    map<string,string> f;
    f["Sunny"] = "Cloudy";
    f["Cloudy"] = "Rainy";
    f["Rainy"] = "Sunny";
    string s; cin >> s; cout << f[s] << endl;
    return 0;
}



Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var k = int.Parse(Console.ReadLine().Split(' ')[1]);
        var hps = Console.ReadLine().Split(' ');
        if (hps.Length <= k)
        {
            Console.Write("0");
        }
        else
        {
            Console.Write(hps.Select(x => long.Parse(x)).OrderBy(x => x).Take(hps.Length - k).Sum());
        }
    }
}


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

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  
  if(A % K == 0 || B % K == 0) cout << "OK" << endl;
  
  else {
    if((A / K + 1) * K <= B) cout << "OK" << endl;
    else cout << "NG" << endl;
  }
}

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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> a(2,vector<int>(n));
  vector<int> ans(n);
  rep(i,2)rep(j,n){
    cin >> a[i][j];
  }
  rep(i,n) {
    for(int j = 0; j <= i; j++) {
      ans[i] += a[0][j]; 
    }
    for(int j = i; j < n; j++) {
      ans[i] += a[1][j]; 
    }
  }
  sort(ans.begin(),ans.end());
  cout << ans[n-1] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
using namespace std;

int main() {
	string str; cin >> str;
	str[3] = '8';
	cout << str << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String v = scan.next();
        if(v.charAt(2) == v.charAt(3) && v.charAt(4) == v.charAt(5)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


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

using namespace std;

const string X = "keyence";

int main(){
 string S; cin >> S;
 int N = (int) S.size();
  for(int i = 0; i <= N; i++){
    for(int j = i; j <= N; j++){
      
      if( (i==0 && j==0) || (i==N && j==N)){
        if( S == X){ cout << "YES" << endl; return 0;}}
   
      string T = S.substr(0,i) + S.substr(j,N-j);
      
      if( T == X){ cout << "YES" << endl; return 0;}
      
    }
  }
  
  cout << "NO" << endl; return 0;}
  
  

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(){
    int a[5],n;
    cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>n;
    int ma=-1,mi=124;
    for(int i=0;i<5;i++){
    	if(ma<a[i]) ma=a[i];
    	if(mi>a[i]) mi=a[i];
	}
	if(ma-mi>n) cout<<":("<<endl;
	else cout<<"Yay!"<<endl;
} 

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a, b;
	int ans;
	int aa, bb;
	cin >> a >> b;
	for (ans = 1; ans <=100000; ans++) {
		aa = ans * 0.08;
		bb = ans * 0.1;
		if (a == aa && b == bb) {
			cout << ans << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#create date: 2020-04-04 21:05

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    a, b, c = na()
    a, b = b, a
    a, c = c, a
    print(a, b, c)

if __name__ == "__main__":
    main()

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

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int Min, Max;
    Max = min(a, b);
    if(a+b-n < 0)
        Min = 0;
    else
        Min = a+b-n;
    cout << Max << " " << Min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    int n;
    cin >> n;
    int v[n];
    for(int i=0; i<n; i++){
        cin >> v[i];
    }
    int maxOdd=0, maxEven=0, secondOdd=0, secondEven=0;
    int o1=0,e1=0;
    int memoOdd[100009]={}, memoEven[100009]={};
    for(int i=0; i<n; i++){
        if(i%2) memoOdd[v[i]]++;
        else memoEven[v[i]]++;
    }
    for(int i=0; i<100001; i++){
        if(maxOdd < memoOdd[i]){
            maxOdd = memoOdd[i];
            o1 = i;
        }
        if(maxEven < memoEven[i]){
            maxEven = memoEven[i];
            e1 = i;
        }
    }
    for(int i=0; i<100001; i++){
        if(secondOdd < memoOdd[i] && o1 != i){
            secondOdd = memoOdd[i];
        }
        if(secondEven < memoEven[i] && e1 != i){
            secondEven = memoEven[i];
        }
    }
    int ans=0;
    if(o1 == e1){
        ans = min( (n-secondOdd-maxEven), (n-maxOdd-secondEven) );
    }else{
        ans = n-maxOdd-maxEven;
    }
    cout << ans << endl;

}


Measured memory_bytes: 1408
import java.util.*;

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    
    int[] b = new int[a];    
    for (int i = 0; i < a; i++) {
      b[i] = sc.nextInt();
    }
    
    int min = 2147483647;
    for (int i = 0; i < a-1; i++) {
      int c = 0;
      int d = 0;
      for (int j = 0; j <= i; j++) {
        c += b[j];
      }
      for (int j = i + 1 ; j < a ; j++) {
        d += b[j];
      }
      if (c < d) {
        if (min > d - c) {
          min = d -c ;
        }
      } else {
        if ( min > c - d) {
          min = c - d;
        }
      }
    }
    
    System.out.println(min);
   
  }
}

Measured memory_bytes: 22996
#include <iostream>
#include <cmath>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;

int main(){
  int N;
  cin >> N;
  int a[N];
  rep(i, N)
    cin >> a[i];
  //ここまで入力

  //上からi枚のカードを取ったときの総和
  long long cum[N];
  cum[0] = a[0];
  rep(i, N)
    cum[i+1] = cum[i] + a[i+1];

  //10^18
  long long min = 1000000000000000000;
  long long sunuke, bear;
  rep(i, N-1){
    //すぬけとアライグマの和を計算
    sunuke = cum[i];
    bear = cum[N-1] - sunuke;
    //最小値の更新
    if(abs(sunuke - bear) < min)
      min = abs(sunuke - bear);
  }

  //解答
  cout << min << endl;

  return 0;
}


Measured memory_bytes: 2560
mod = pow(10,9)+7
n,k = map(int,input().split())
inv = [0,1]
fact = [1,1]
ifact = [1,1]
for i in range(2,n+1):
    inv.append(inv[mod%i]*(mod-mod//i)%mod)
    fact.append(i*fact[-1]%mod)
    ifact.append(ifact[-1]*inv[i]%mod)

def combi(a,b):
    if a >= b:
        return fact[a]*ifact[b]*ifact[a-b]%mod
    else:
        return 0

for i in range(1,k+1):
    print(combi(n-k+1,i)*combi(k-1,i-1)%mod)

Measured memory_bytes: 9388
N = int(input())
c = list(input())

rcount =0
wcount =0
for i in range(N):
    if c[i]=="R":
        rcount+=1
    else:
        wcount+=1

ans = 0
for i in range(rcount):
    if c[i]=="W":
        ans+=1

print(ans)

Measured memory_bytes: 81288
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define MAX 1000000
bool sosu[MAX];
int main(){
	memset(sosu,1,MAX);
	for(int i=4;i<MAX;i+=2)sosu[i]=false;
	for(int i=3;i<MAX;i+=2)
	if(sosu[i])
	for(int j=i*3;j<MAX;j+=2*i)sosu[j]=false;
	vector<int>S;
	loop(i,2,MAX)if(sosu[i])S.pb(i);
	loop(i,1,S.size())S[i]+=S[i-1];
	int n;
	while(cin>>n,n)cout<<S[n-1]<<endl;	
}

Measured memory_bytes: 2568
using System;
using System.Linq;
using System.Text;

class Program
{
    static void Main()
    {
        int[] l = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int r = l[0], c = l[1];
        int[] cans = new int[c + 1];
        StringBuilder ans = new StringBuilder();

        for (int i = 0; i < r; i++)
        {
            string[] o = Console.ReadLine().Split(' ');
            int a = 0;

            for (int j = 0; j < c; j++)
            {
                cans[j] += int.Parse(o[j]);
                ans.Append(o[j] + " ");
                a += int.Parse(o[j]);
            }

            cans[c] += a;
            ans.Append(a);
            ans.AppendLine();
        }
        for (int i = 0; i < c; i++)
        {
            ans.Append(cans[i] + " ");
        }
        ans.Append(cans[c]);
        ans.AppendLine();

        Console.Write(ans);
    }
}

Measured memory_bytes: 9856
INF = 10**8


def main():
    N, M, X = (int(i) for i in input().split())
    T = [[int(i) for i in input().split()] for j in range(N)]

    answer = INF
    for bit in range(1, 1 << N):
        intelligibility = [0]*M
        current_money = 0
        for i in range(N):
            if bit & 1 << i:
                current_money += T[i][0]
                for j, a in enumerate(T[i][1:]):
                    intelligibility[j] += a
        if all(X <= intelligence for intelligence in intelligibility):
            answer = min(answer, current_money)
    print(answer if answer != INF else -1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 91444
#include <stdio.h>

#define MIN(X,Y) ((X)<(Y)?(X):(Y))
#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
    int n,x,max;
    char c;
    
    max = x = 0;
    scanf("%d",&n);c=getchar();
    while (c=getchar(),c=='I'||c=='D'){
        switch(c){
        case 'I':
            x++;
            break;
        case 'D':
            x--;
            break;
        }
        max = MAX(max,x);
    }
    printf("%d\n",max);
    return 0;
}

Measured memory_bytes: 128
#!/usr/bin/ruby
def z(h,w)
	[h,w,H-1-h,W-1-w].min
end
D=[[-1,0],[0,-1],[1,0],[0,1]]
H,W,K=gets.split.map(&:to_i)
i=j=nil
m=[]
$<.each_with_index{|l,_|
	l.chomp!
	z=W.times.find{|w|l[w]==?S}
	if z
		i=_
		j=z
	end
	m<<l.chars
}
r=z(i,j)
q=[[i,j]]
m[i][j]=0
while !q.empty?
	h,w=q.shift
	next if m[h][w]+1>K
	D.each{|dy,dx|
		y=h+dy
		x=w+dx
		if 0<=y&&y<H && 0<=x&&x<W && m[y][x]==?.
			m[y][x]=m[h][w]+1
			r=[r,z(y,x)].min
			q<<[y,x]
		end
	}
end
p (r+K-1)/K+1

Measured memory_bytes: 77948
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <tuple>
#include <time.h>
using namespace std;
typedef long long ll;


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

    ll m[s.size() + 5][15] = {};
    m[0][0] = 1;
    for (int i = 0; i < s.size(); i++) {
        if (char(s[i]) == '?') {
            for (int j = 0; j < 13; j++) {
                for (int k = 0; k < 10; k++) {
                    m[i + 1][(10 * j + k) % 13] += m[i][j];
                }
            }
        }
        else {
            for (int j = 0; j < 13; j++) {
                m[i + 1][(10 * j + int(s[i] - '0')) % 13] += m[i][j];
            }
        }
        for (int j = 0; j < 13; j++) m[i + 1][j] %= 1000000007;
        //cout << endl;
    }
    cout << m[s.size()][5] << endl;
}


Measured memory_bytes: 12160
def main():
    import sys
    mod = 998244353
    def input(): return sys.stdin.readline().rstrip()
    n,s = map(int, input().split())
    a = list(map(int, input().split()))
    dp = [0]*(s+1)
    dp[0] = 1
    import numpy as np
    dp = np.array(dp)
    for i in range(n):
        dp[a[i]:] = (2*dp[a[i]:]%mod + dp[:-a[i]])%mod
        dp[:a[i]] *= 2
        dp[:a[i]] %= mod
    print(dp[-1])


if __name__ == '__main__':
    main()

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

using namespace std;

/* http://drken1215.hatenablog.com/entry/2018/06/08/210000 */
const int MAX = 2000003;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/* end */

long long sumCOM(int n, int k) { // (1, 1) start.
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return COM(n+2, k+1) - 1;
}

int main(void) {
  int r_1, c_1, r_2, c_2;
  cin >> r_1 >> c_1 >> r_2 >> c_2;
  r_1--; c_1--;
  
  COMinit();
  
  long long ans = sumCOM(r_2+c_2, c_2) + sumCOM(r_1+c_1, c_1) - sumCOM(r_1+c_2, c_2) - sumCOM(r_2+c_1, c_1);
  while (ans < (long long)0) {
    ans += MOD;
  }
  ans %= MOD;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 47104
#include<iostream>
#include<stdio.h>
#include<string>
#include<queue>

using namespace std;

#define CHAR_SIZE 256
#define NODE_SIZE 512
#define TOLEFT '0'
#define TORIGHT '1'

long length = 0;


class Node{
public:
    // char番号も兼ねる
    int id;
    int weight;
    int left;
    int right;
    Node(){ weight = 0; }
    Node( int id, int w, int l, int r ): id(id), weight(w), left(l), right(r){}
    
    bool operator < ( const Node &n ) const{
        return weight > n.weight;
    }
};

Node nodes[NODE_SIZE];
int newRootId;

void recursive( int id, string code){
    if ( id < CHAR_SIZE ){
        length += code.size() * nodes[id].weight;
        return;
    }
    recursive( nodes[id].left, code + TOLEFT );
    recursive( nodes[id].right, code + TORIGHT );
}

void encoding( string text ){
    // それぞれの文字の出現回数を加算する
    int w[CHAR_SIZE] = {};
    // 出現回数を代入する
    for ( int i = 0; i < text.size(); i++ ) w[text[i]]++;
    
    // 優先度付きqueを使う
    priority_queue<Node> PQ;
    for ( int i = 0; i < CHAR_SIZE; i++ ) {
        // 重みが入っていた場合
        if ( w[i] > 0 ){
            // ノード作成
            Node node = Node( i, w[i], -1, -1 );
            PQ.push( node );
            // global配列にも入れる
            nodes[ node.id ] = node;
        }
    }
    
    if(PQ.size() == 1){
        length = text.size();
    }
    // Construct the binary tree
    newRootId = CHAR_SIZE;
    // 木を構築しているのか
    while ( PQ.size() > 1 ){
        Node left = PQ.top();
        PQ.pop();
        
        Node right = PQ.top();
        PQ.pop();
        
        int weight = left.weight + right.weight;
        // 新しくrootを作成する
        Node newRoot = Node( newRootId, weight, left.id, right.id );
        PQ.push( newRoot );
        nodes[ newRootId++ ] = newRoot;
    }
}

void decoding(){
    recursive( newRootId - 1, "");
}

int main(){
    string text;
    cin >> text;
    encoding( text );
    if(length == 0){
        decoding();
    }
    cout << length << endl;
}


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

#define EPSILON 1e-6
#define ll long long
#define pii pair<int, int>

int* parent;

int root(int v) {
	return (parent[v] < 0) ? v : (parent[v] = root(parent[v]));
}

void merge(int x, int y) {
	if ((x = root(x)) == (y = root(y))) return;
	if (parent[y] < parent[x]) {
		register int z = y;
		y = x;
		x = z;
	}
	parent[x] += parent[y];
	parent[y] = x;
}

int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, m;
  cin >> n >> m;

  parent = new int[n];
	for (int i=0; i<n; i++) {
		parent[i] = -1;
	}

  for (int i=0; i<m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    merge(x-1, y-1);
  }

  set<int> dis;
  for (int i=0; i<n; i++) {
    dis.insert(root(i));
  }

  cout << dis.size() << "\n";
  return 0;
}


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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

// dp[i][smaller][j] = i桁目までで0以外の数字の個数がjのときの求める整数の個数
// ただしsmallerがtrueのときはNより小さい場合を考え、smallerがfalseならNと同じ場合を考える
ll dp[110][2][4] = {};

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

  string s;
  int k;
  cin >> s >> k;
  int n = sz(s);
  dp[0][false][1] = 1;
  dp[0][true][0] = 1;
  dp[0][true][1] = (s[0]-'0')-1;
  rep(i,n-1) {
    int ne = s[i+1] - '0';
    rep(j,k+1) {
      rep(x,10) {
        int nj = j;
        if(x) nj++;
        if(nj > k) continue;
        if(x < ne) dp[i+1][true][nj] += dp[i][false][j];
        if(x == ne) dp[i+1][false][nj] += dp[i][false][j];
        dp[i+1][true][nj] += dp[i][true][j];
      }
    }
  }
  cout << dp[n-1][false][k] + dp[n-1][true][k] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};
constexpr char BR = '\n';

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())


template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



lli n, x;

lli f(lli a, lli b){
  lli amari = b % a, sho = b / a;
  if(amari == 0) return (2 * sho - 1) * a;
  return f(b - sho * a, a) + 2 * sho * a;
}

int main(void){
  scanf("%lld %lld", &n, &x);
  printf("%lld\n", n + f(x, n-x));
  return 0;
}

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

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

const int MAX = 5000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
    long long X,Y;
    cin>>X>>Y;

    if((X+Y)%3 != 0){
        ANS(0);
        return 0;
    }
    if((2*X-Y) %3 !=0 || (2*Y-X)%3 !=0){
        ANS(0);
        return 0;
    }

    long long x = (2*X-Y)/3;
    long long y = (2*Y-X)/3;

    COMinit();


    ANS(COM(x+y,x));

    return 0;
}


Measured memory_bytes: 117376
#include <iostream>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;


int main() {

	double R;
	cin >> R;
	cout << 2*R * M_PI << endl;



}


Measured memory_bytes: 3788
N=input()
Num = len(N)
if Num == 5:
		Ans = (int(N)-9999) + 900 + 9
elif Num == 4:
		Ans = 900 + 9
elif Num == 3:
		Ans = (int(N)-99) + 9
elif Num == 2:
		Ans = 9
elif Num == 1:
		Ans = N
elif Num == 6:
  Ans = 90000 + 900 + 9
print(Ans)

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

typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007

#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

void f()
{
  ll n,k,i;
  cin>>n>>k;
  cout<<min(n%k,k-(n%k))<<nl;
}

int main()
{
    su;
    f();
    return 0;
}


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

int main() {

int a,b,c; cin >> a >> b >>c;
int d,e,f;

d = min (a,b);
d = min (d,c);

f = max (a,b);
f = max (f,c);

if (d == b && f ==c || d == c && f == b)
    e = a;
else if (d == a && f == c || d == c && f == a)
    e = b;
else
    e = c;

cout << d << " "<< e << " " << f << endl; 
}


Measured memory_bytes: 3092
#define _USE_MATH_DEFINES // for C++  
#include <cmath> 
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <iterator>
#include <utility>
#include <set>
#include <random>
#include <map>
#include <stack>
#include <queue>
#include <list>
#include <functional>
#include <bitset>
#define LL long long

using namespace std;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin);i>(end);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" <<; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}

#define ll long long
#define f first
#define s second
#define pb push_back
#define INF 1000000000000000000
using namespace std;

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;

int main()
{
	ll P, Q, R;
	cin >> P >> Q >> R;

	cout << min(min(P + Q, Q + R), P + R) << endl;

	return 0;
}

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

signed main() {
    int a, b, t;
    cin >> a >> b >> t;
    t += 0.5;
    cout << (t / a) * b << endl;
    return 0;
}


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

int numofdigits(long long x) {
  int cnt = 0;
  while (x > 0) {
    x /= 10;
    cnt++;
  }
  return cnt;
}

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

  int ans = 10000;
  for (long long i = 1; i * i <= N; i++) {
    if (N % i != 0) continue;
    long long j = N / i;
    int tmp = max(numofdigits(i), numofdigits(j));
    ans = min(ans, tmp);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,x,ans=1,s=0;
  scanf("%d%d",&n,&x);
  int a[n+1],i;
  for(i=1;i<n+1;i++){
    scanf("%d",&a[i]);
    s+=a[i];
    if(s<=x) ans++;
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
# coding: utf-8
# Your code here!

def pow(x, n):
    if n == 0:
        return 1
    res = pow(x * x % A, n // 2)
    if n % 2 == 1:
        res = res * x % A
    return res

nums=list(map(int,input().split()))
M  = nums[0]
N = nums[1]
A = 1000000007
print(pow(M, N))



Measured memory_bytes: 5604
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
       
using namespace std;
       
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
 
// #define MAX 100010
 
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    // #endif
    long long int n;
    cin>>n;
    long long int a[n];
    long long int sum = 0;
    long long int d[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    for(int i=0;i<n;i++)
    {
        d[i] = a[(i+1)%n]-a[i];
        //cout<<d[i]<<" ";
    }
    long long int temp = (n*(n+1))/2;
    if(sum%temp!=0)
        cout<<"NO";
    else
    {
        long long int k = sum/temp;
        bool fl = true;
        for(int i=0;i<n;i++)
        {
            long long int temp = k - d[i];
            if(temp%n||temp<0)
                fl = false;
        }
        if(fl==true)
            cout<<"YES";
        else
            cout<<"NO";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    int n;
    cin >> n;
    Vi a(n);
    rp(i,n) cin >> a.at(i);
    int ctr=0;
    rp(i,n){
        if(i%2==0&&a.at(i)&1) ctr++;
    }
    print(ctr);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
using namespace std;

const ll N = 7005;
const ll MOD = 1e9+7;
ll grid[3][3];
int main()
{

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	for(int i =0;i<3;i++){
		for(int j = 0;j<3;j++){
			cin >> grid[i][j];
		}
	}
	ll n;cin>>n;
	ll a[n];
	for(int i =0;i<n;i++) {
		cin >> a[i];
		for(int j = 0;j<3;j++){
			for(int k =0;k<3;k++){
				if(grid[j][k] == a[i]){
					grid[j][k] = -1;
				}
			}
		}
	}
	bool poss=false;
	
	
	for(int i =0;i<3;i++){
		bool pp = true;
		for(int j =0;j<3;j++){
			if(grid[i][j] != -1) pp=false; 
		}
		if(pp) return cout << "Yes\n",0;
	}

	for(int i =0;i<3;i++){
		bool pp = true;
		for(int j =0;j<3;j++){
			if(grid[j][i] != -1) pp=false; 
		}
		if(pp) return cout << "Yes\n",0;
	}
	bool pp=true;
	for(int i = 0;i<3;i++){
		if(grid[i][i] != -1)
			pp = false;
	}
	if(pp) return cout << "Yes\n",0;
	pp=true;
	for(int i = 0;i<3;i++){
		if(grid[i][3-i-1] != -1) pp =false;
	}

	if(pp) return cout << "Yes\n",0;

	cout << "No\n";
	return 0;	
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int  min(int x,int y)
{   if(x>y)return y;
    else   return x;
}
int  min1(int a,int b,int c)
{   return min(min(a,b),c);
}

int main()
{ int a1,a2,a3,s1,s2,s3;
  while(scanf("%d %d %d",&a1,&a2,&a3)!=EOF)
  {
 s1=fabs(a2-a1)+fabs(a3-a1);
  s2=fabs(a3-a2)+fabs(a1-a2);	
  s3=fabs(a1-a3)+fabs(a2-a3);
 
  printf("%d\n",min1(s1,s2,s3));
 }return 0; 
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int a, b; cin >> a >> b;
  REP(c, 1, 4) {
    if (a * b * c % 2) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
}


Measured memory_bytes: 256
n,m,l  = map(int, input().split())
a = []
for i in range(n):
  a.append(list(map(int,input().split())))
b = []
for i in range(m):
  b.append(list(map(int,input().split())))
for i in range(n):
  x = []
  for j in range(l):
    s = 0
    for k in range(m):
      s += a[i][k] * b[k][j]
    x.append(s)
  print(" ".join(list(map(str, x))))


Measured memory_bytes: 6248
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
typedef long double db;
#define pb push_back
#define mp make_pair
#define np(str) next_permutation(str.begin(),str.end())
#define ub(v,val) upper_bound(v.begin(),v.end(),val)
#define lb(v,val) lower_bound(v.begin(),v.end(),val)
#define sortv(vec) sort(vec.begin(),vec.end())
#define rev(p) reverse(p.begin(),p.end());
#define v vector
#define PI 3.1415926535
#define len length()
#define repc(i,s,e) for(ll i=s;i<e;i++)
#define fi first
#define se second
#define mset(a,val) memset(a,val,sizeof(a));
#define mt make_tuple
#define repr(i,n) for( i=n-1;i>=0;i--)
#define rep(i,n) for( i=0;i<n;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int M = 1e8 ;
ll INF = 1e12;

ll n, m;

int main() {
	// your code goes here
	IOS;

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll i, j, t, k, x, y, z,  N;
	cin >> x;
	if (x >= 30)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>

int main(void)
{
	char A[101], B[101];
	scanf("%s\n",A);
	scanf("%s\n",B);
	int dA,dB;
	dA = strlen(A);
	dB = strlen(B);
	int ret=0;
	if (dA>dB){
		ret = 1;
		goto done;
	}
	if (dA<dB){
		ret = -1;
		goto done;
	}
	int i;
	for (i=0;i<dA;i++){
		if (A[i]>B[i]){
			ret = 1;
			goto done;
		}
		if (A[i]<B[i]){
			ret = -1;
			goto done;
		}
	}
done:;
	if (ret>0){
		printf("GREATER\n");
	}
	else if (ret<0){
		printf("LESS\n");
	}
	else {
		printf("EQUAL\n");
	}
	return 0;
}


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

int main() {
  int l, r, d;
  cin >> l >> r >> d;
  cout << (r / d) - ((l-1) / d) << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
int main()
{
    char c;
    int sum = 3;
    int done = 0;
    while(sum--)
        {scanf("%c",&c);if(c=='7')done = 1;}
        if(done)
            printf("Yes\n");
        else printf("No\n");
    return 0;
}


Measured memory_bytes: 1588
#include<iostream>
#include<string>
using namespace std;
int cnt[30];
int main()
{
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
		cnt[(int)s[i] - 'A']++;
	bool check = true;
	for (int i = 0; i < 30; i++)
	{
		if (cnt[i] != 0 && cnt[i] != 2)
			check = false;
	}
	if (check)
		cout << "Yes" << '\n';
	else
		cout << "No" << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<string.h> 

int main(void){

  char str_S[10],str_T[10];
  scanf("%s %s",str_S,str_T);
  int a, b;
  scanf("%d %d",&a,&b);
  char str_U[10];
   scanf("%s" ,str_U);
   if(strcmp(str_S,str_U)==0){
    printf("%d %d",a-1,b);
  }
  else{
    printf("%d %d",a,b-1);
  }

  return 0;
}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-

def bc(x):
    return bin(x).count("1")

S = input()
N = len(S)

# 0101...か1010...に変更するときの塗り替え数を見ればいい=XOR
B = "".join(["0" if i%2==0 else "1" for i in range(N)])
R = int(S, 2) ^ int(B, 2)
C = bc(R)
r = min(C, N-C)
print(r)


Measured memory_bytes: 3956
function Main(input) {
  input = input.trim().slice('');
  var flag = 'Yes';
  for(var i = 0, len = input.length; i < len; i++) {
    if(i % 2 == 0) {
      if(input[i] == 'L') flag = 'No';
    } else {
      if(input[i] == 'R') flag = 'No';
    }
    if(flag == 'No') {
      break;
    }
  }
  console.log(flag);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf-8'));


Measured memory_bytes: 7372
#include <stdio.h>


int main()
{

    int prime,flag = 0;
    scanf("%d", &prime);
    while(flag != 1)
    {
        int count = 0;
        for(int i = 2; i<=prime/2; i++)
        {
            if(prime%i == 0)
                count++;
        }
        if(count == 0)
        {
            printf("%d", prime);
            flag = 1;
        }
        else
            prime++;




    }
    return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;

class Program
{

    public static void Main(string[] args)
    {
        Program pg = new Program();
        pg.Exe();
    }

    public void Exe()
    {
        int n = int.Parse(Console.ReadLine());

        Dictionary<string, int> dic = new Dictionary<string,int>() 
        {
            {"AC",0},
            {"WA", 0},
            {"TLE", 0},
            {"RE", 0}
        };
        for(int i = 0; i < n; i++)
        {
            string str = Console.ReadLine();
            dic[str] += 1;
        }
        foreach (KeyValuePair<string, int> kvp in dic)
        {
            Console.WriteLine($"{kvp.Key} x {kvp.Value}");
        }
    }

}



Measured memory_bytes: 31104