akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
// 木の直径の端点までの距離の大きい方？
class dijkstra{ 
//0indexed 
public: 
	int v,startv; 
	vector<int> d; 
	vector<vector<pair<int,int> > >e; 
	dijkstra(int n0){
		initsize(n0);
	}
	void initsize(int n0){ 
		d.resize(n0); 
		for(int i=0;i<n0;i++)d[i]=INT_MAX; 
		vector<pair<int,int> > ep; 
		for(int i=0;i<n0;i++)e.push_back(ep); 
		v=n0; 
	} 
	void initstart(int s){ 
		startv=s;
		d[s]=0;
	}
	void make_edge(int x,int y,int cost){ 
		e[x].push_back(make_pair(y,cost)); 
		e[y].push_back(make_pair(x,cost)); 
	}
	void make_edgedir(int x,int y,int cost){ 
		e[x].push_back(make_pair(y,cost)); 
	}
	void calcdistance(int st){
		initstart(st); 
		// <-cost,x> 
		//cost startv->x 
		priority_queue<pair<int,int> > q; 
		pair<int,int> p; 
		vector<bool> did; 
		for(int i=0;i<v;i++)did.push_back(false); 
		did[startv]=true; 
		for(int i=0;i<int(e[startv].size());i++){ 
			p.first=-e[startv][i].second; 
			p.second=e[startv][i].first; 
			q.push(p); 
		}
		while(q.size()!=0){
			pair<int,int> p;
			p=q.top();
			q.pop();
			int x,costsx;
			x=p.second;
			costsx=-p.first;
			if(did[x]==true)continue;
			did[x]=true;
			d[x]=costsx;
			for(int i=0;i<int(e[x].size());i++){
				p.first=-(d[x]+e[x][i].second);
				p.second=e[x][i].first;
				if(did[p.second]==false)q.push(p);
			}
		}
	}
};

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

	int n,a,b,w;
	cin >> n;
	if(n==1){
	    cout << 0 << endl;
	    return 0;
	}
	dijkstra d1(n),d2(n);
	FOR(i,0,n-1){
		cin >> a >> b >> w;
		d1.make_edge(a,b,w);
		d2.make_edge(a,b,w);
	}
	int v1,v2,len1=-1,len2=-1;
	d1.calcdistance(0);
	FOR(i,1,n){
		if(d1.d[i]>len1){
			len1 = d1.d[i];
			v1 = i;
		}
	}
	d1.calcdistance(v1);
	FOR(i,0,n){
		if(d1.d[i]>len2){
			len2 = d1.d[i];
			v2 = i;
		}
	}
	d2.calcdistance(v2);
	FOR(i,0,n){
		cout << max(d1.d[i],d2.d[i]) << endl;
	}
}



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

int gcd(int a, int b){
  int tmp;
  if(b>a){
    tmp=a;
    a=b;
    b=tmp;
  }
    if(b==0) return a;
  else gcd(b, a%b);
}
int gcd(vector<int> A){
  int ans = A[0];
  rep(i, A.size()){
    ans=gcd(ans, A[i]);
  }
  return ans;
}
int main(){
int  N;
cin >> N;
vector<int> C(N);
rep(i, N){
  cin >> C[i];
}
 cout << gcd(C) << endl;
 }

Measured memory_bytes: 1024
import java.util.*;

public class Main{
	
	public static void main (String[] args) {
		
		Scanner scanner = new Scanner (System.in);
		
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		
		int number = N/2;
		
		if ((N%2)==1) {
			number++;
		}
		if(number>=K) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

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

void Main()
{
  int X,Y,Z;
  cin >> X >> Y >> Z;
  cout << Z << " " <<  X << " " << Y << endl;
}

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

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] grid = new char[h][w];
		for(int i = 0; i < h; i++){
		    grid[i] = sc.next().toCharArray();
		}
		
		// 計算
		int result = 0;
		ArrayDeque<Point> q = new ArrayDeque<Point>();
		int[] dx = {-1, 1, 0, 0};
		int[] dy = {0, 0, -1, 1};
		for(int i = 0; i < h; i++){
		    for(int j = 0; j < w; j++){
		        if(grid[i][j] == '#') continue;
		        q.add(new Point(i, j, 0));
		        int[][] visited = new int[h][w];
		        while(!q.isEmpty()){
		            Point now = q.poll();
		            int x = now.x;
		            int y = now.y;
		            int d = now.d;
		            if(visited[x][y] == 1) continue;
		            visited[x][y] = 1;
		            for(int k = 0; k < 4; k++){
		                if(x+dx[k] >= 0 && x+dx[k] < h && y+dy[k] >= 0 && y+dy[k] < w && grid[x+dx[k]][y+dy[k]] == '.' && visited[x+dx[k]][y+dy[k]] == 0){
		                    q.add(new Point(x+dx[k], y+dy[k], d+1));
		                    result = max(result, d+1);
		                }
		            }
		        }
		    }
		}
		
		// 出力
		System.out.println(result);
	}
}

class Point {
    int x;
    int y;
	int d;
    
    Point(int x, int y, int d){
        this.x = x;
        this.y = y;
        this.d = d;
    }

    public String toString(){
        return "(" + x + ", " + y + "):" + d;
    }
}



Measured memory_bytes: 28508
N=int(input())
S1=input()
S2=input()
mod=10**9+7
dp=[]
a=0
for i in range(N):
  if i!=N-1:
    if a==1:
      a=0
      continue
    else:
      if S1[i]==S1[i+1]:
        dp.append(2)
        a=1
      else:
        dp.append(1)
  else: 
    if a==0:
      dp.append(1)
ans=1
if len(dp)==1:
  if dp[0]==1:
    print(3)
  else:
    print(6)
  exit()
for i in range(len(dp)):
  if i==0:
    if dp[i]==1:
      ans*=3
    else:
      ans*=6
  else:
    if dp[i-1]==2:
      if dp[i]==1:
        continue
      else:
        ans*=3
    else:
      if dp[i]==1:
        ans*=2
      else:
        ans*=2
  ans%=mod
print(ans%mod)

Measured memory_bytes: 9180
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main()
{
	int n,m;
	cin>>n;
	map<string,int> blue;
	for(int i = 0 ; i < n ; i++){
		string str;
		cin>>str;
		if( blue.count(str) == 0){
			blue[str] = 1;
		}else{
			blue[str]++;
		}
	}
	cin>>m;
	map<string,int> red;
	for(int i = 0; i < m ; i++){
		string str;
		cin>>str;
		if( red.count(str) == 0){
			red[str] = 1;
		}else{
			red[str]++;
		}
	}
	int	ans = 0;
	for(auto iter = blue.begin(); iter != blue.end(); iter++){
		int b,r;
		b = iter->second;
		r = 0;
		if( red.count(iter->first) != 0) r = red[iter->first];
		ans = max(ans, b - r);
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define ll long long
#define _ ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
using namespace std;

int main() { _
    ll n; cin >> n;
    string s;
    while(n != 0){
        n--;
        ll temp = n % 26;
        s += 'a' + temp;
        n /= 26;
    }
    for(ll i = s.size() - 1; i >= 0 ; i--){
        cout << s[i];
    }
}

Measured memory_bytes: 3656
coordinate=[]
for i in range(5):
  coordinate.append(int(input()))
k=int(input())
status=True
for i in range(5):
  for j in range(i):
    if (coordinate[i]-coordinate[j])>k:
      status=False
      
if status:
  print("Yay!")
else:
  print(":(")

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

void gcd(int x, int y) {
    int a = y % x;
    if (a == 0) {
        cout << x << endl;
    } else {
        gcd(a, x);
    }
}

int main() {

    int x, y;
    cin >> x >> y;

    x < y ? gcd(x, y) : gcd(y, x);

    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 100005
#define endl "\n"
#define mod 1000000007
ll n; vector<ll> vc[N]; ll dp[N][3];
ll maxval(ll i,ll flg,ll par){
	if(dp[i][flg]!=-1){
		return dp[i][flg];
	}
	
	if(flg==1){
		ll c1=1,c2=1;
		for(auto it:vc[i]){
			if(it==par) continue;
			c1=(c1*maxval(it,1,i))%mod;
		}
		for(auto it:vc[i]){
			if(it==par) continue;
			c2=(c2*maxval(it,0,i))%mod;
		}
		return dp[i][flg]=(c1+c2)%mod;
	}
	else{
		ll c=1;
		for(auto it:vc[i]){
			if(it==par) continue;
			c=(c*maxval(it,1,i))%mod;
		}
		return dp[i][flg]=c%mod;
	}
}
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;
	memset(dp,-1,sizeof(dp));
	for(i=1;i<n;i++){
		cin>>k>>l;
		vc[k].ps(l);
		vc[l].ps(k);
	}
	ll an=maxval(1,1,-1)%mod;
	cout<<an;
	return 0;
}

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


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

namespace mp = boost::multiprecision;

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

int main() {
	ll n, m;
	cin >> n >> m;
	ll count = 0;
	if (n * 2 <= m) {
		m -= n * 2;
		count += n + m / 4;
	}
	else {	
		count += m / 2;
	}	
	cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
int f[101][4],n,k;
char s[101];
int dfs(int len,int ans,bool ff) {
	if(ans>k) return 0;
	int tot=0;
	if(!len) return ans==k;
	if(!ff&&~f[len][ans]) return f[len][ans];
	int end=ff?s[len]-'0':9;
	for(res i=0;i<=end;++i) tot+=dfs(len-1,ans+(i>0),ff&&i==end);
	if(!ff) f[len][ans]=tot;
	return tot;
}
int main()
{
	memset(f,255,sizeof(f)),scanf("%s",s+1),n=strlen(s+1),reverse(s+1,s+1+n),read(k),print(dfs(n,0,true),'\n');
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 

Measured memory_bytes: 256
#include <bits/stdc++.h> 
 
#define INF (1<<31) - 1 //INT_MAX/2
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using P = std::pair<int, int>;

int main(int argc, char *argv[])
{
    int H, W;
    std::cin >> H >> W;

    std::vector<std::string> S(H+2);
    for (int i = 0; i < H+2; i++) {
        for (int j = 0; j < W+2; j++) {
            S[i].push_back('#');
        }
    }
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            std::cin >> S[i][j];
        }
    }

    for (int i = 0; i < H+2; i++) {
        for (int j = 0; j < W+2; j++) {
            std::cout << S[i][j];
        }
        std::cout << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int Z = sc.nextInt();
    int width = Y + 2*Z;
    int people = 1;
    while (width+Y+Z <= X) { 
      width += Y+Z;
      people++;
    }
    System.out.println(people);
  }
}

Measured memory_bytes: 23764
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    sc.close();

    String[] S = s.split("");

    // 0101...にした場合
    int count1 = 0;

    // 1010...にした場合
    int count2 = 0;

    for (int i = 0; i < S.length; i++) {
      if (i % 2 == 0) {
        if (S[i].equals("1")) {
          count1++;
        } else {
          count2++;
        }
      } else { 
        if (S[i].equals("0")) {
          count1++;
        } else {
          count2++;
        }
      }
    }

    System.out.println(Math.min(count1, count2));

  }

}

Measured memory_bytes: 32920
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
      	int Student;
      	int[] OnSchool=new int[N];
      for (int i = 0 ; i < N; i ++){
          Student = sc.nextInt();
          OnSchool[Student-1]=i+1;
        }     
        System.out.println(Arrays.toString(OnSchool).replace("[","").replace("]","").replace(",",""));
      }
	}


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

// editorial解
// 青い点をx座標の小さい順に見て
// ペアになれる赤点の内、もっともy座標が大きいペアを探しペアにする
// なかったらなにもしない

const int MAX_N = 200;
bool visited[MAX_N];
pair<int,int> red[MAX_N], blue[MAX_N];
int N;

int main()
{
    cin >> N;
    for(int i = 0; i < N; ++i) cin >> red[i].first >> red[i].second;
    for(int i = 0; i < N; ++i) cin >> blue[i].first >> blue[i].second;

    sort(blue, blue + N);
    sort(red, red + N);
    int res = 0;
    for(int i = 0; i < N; ++i) {
        int candidate = -1, y = -1;
        for(int j = 0; red[j].first < blue[i].first && j < N; ++j) {
            if(red[j].second < blue[i].second && y < red[j].second) 
                if(!visited[j]) candidate = j, y = red[j].second;
        }
        if(candidate != -1 ) visited[candidate] = true, ++res;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	int[] a = new int[n];
	int[] b = new int[n];
	int[] c = new int[n];
	for (int i = 0; i < n; i++)
	{
	    var tmp = ReadIntArray();
	    a[i] = tmp[0]; b[i] = tmp[1]; c[i] = tmp[2];
	}

	int[,] dp = new int[n,3];
	dp[0,0] = a[0]; dp[0,1] = b[0]; dp[0,2] = c[0];

	for (int i = 1; i < n; i++)
	{
	    dp[i,0] = Math.Max(dp[i-1, 1], dp[i-1, 2]) + a[i];
	    dp[i,1] = Math.Max(dp[i-1, 2], dp[i-1, 0]) + b[i];
	    dp[i,2] = Math.Max(dp[i-1, 0], dp[i-1, 1]) + c[i];
	}

	int ans = Math.Max(dp[n-1,0], Math.Max(dp[n-1,1], dp[n-1,2]));
	WriteLine(ans);
    }
}


Measured memory_bytes: 19512
#include <stdio.h>
 
int main(void){
  int i,j,n,taro_p=0,hana_p=0;
  char taro[101], hana[101];
 
  scanf("%d", &n);
 
  for(i=0;i<n;i++){
    scanf("%s %s", taro, hana);
 
    for(j=0;;j++){
      if(taro[j] > hana[j]){
        taro_p += 3;
        break;
      }else if(taro[j] < hana[j]){
        hana_p += 3;
        break;
      }else if(taro[j] + hana[j] == 0){
        hana_p++;
        taro_p++;
        break;
      }
    }
  }
 
  printf("%d %d\n", taro_p , hana_p);
  return 0;
}


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

int main(){
	int a[4],b[4];
	while(cin>>a[0]){
		int hit=0,blow=0;
		rep(i,1,4) cin>>a[i];
		rep(i,0,4) cin>>b[i];
		rep(i,0,4){
			rep(j,0,4){
				if(a[i]==b[j]){
					if(i==j) hit++;
					else blow++;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
}

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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

vector<vector<int>> mat(51, vector<int>(51));
vector<vector<int>> mat2(51, vector<int>(51));

class CRemainderGame {
public:


    void floyd() {
      rep(i, 51) {
        rep(j, 51) {
          if (mat[i][j] > 0) {
            mat2[i][j] = 0;
          } else {
            mat2[i][j] = INT_MAX/2;
          }
        }
      }

      rep(k, 51) {
        rep(i, 51) {
          rep(j, 51) {
            chmin(mat2[i][j], mat2[i][k] + mat2[k][j]);
          }
        }
      }
    }

    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<int> a(n);
      vector<int> b(n);
      rep(i, n) cin >> a[i];
      rep(i, n) cin >> b[i];

      rep(i, 51) rep(j, 51) {
        mat[i][j] = 0;
        mat2[i][j] = 0;
      }

      for(int i=0; i<=50; i++) {
        mat[i][i]++;
      }

      for(int i=0; i<=50; i++) {
        for(int j=1; j<=50; j++) {
          mat[i][i%j]++;
        }
      }
      floyd();
      rep(i, n) {
        if (mat2[a[i]][b[i]] != 0) {
          cout << -1 << endl;
          return;
        }
      }
      ll ans = 0;

      for(int k=50; k>=1; k--) {
        for(int i=0; i<=50; i++) {
          mat[i][i%k]--;
        }

        floyd();
        bool flag = true;
        rep(i, n) {
          if (mat2[a[i]][b[i]] != 0) {
            flag = false;
            break;
          }
        }
        if (!flag) {
          ans += 1LL<<k;
          for(int i=0; i<=50; i++) {
            mat[i][i%k]++;
          }
        }
      }
      cout << ans << endl;
    }
};

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProgramMNS {
	class Program {
		static void Main (string[] args) {
			string S, T;
			S = Console.ReadLine ();
			T = Console.ReadLine ();
			if (T.StartsWith (S)) {
				System.Console.WriteLine("Yes");
			} else
			{
				System.Console.WriteLine("No");
			}
		}
	}
}

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

int a[30],n;

int solve(int i, int b)
{
	if (b == 0)return 1;
	if (i >= n)return 0;
	int res = solve(i + 1, b) || solve(i + 1, b - a[i]);
	return res;
}

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

	cin >> q;
	while (q--)
	{
		cin >> o;
		if (solve(0,o))cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}


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

int main(){
  int k,n;
  cin >> n >> k;
  int a[200100];
  vector<int> num(200100);
  for(int i = 0;i < 200050;i++){
    num.at(i) = 1000000;
  }
  for(int i = 0;i < n;i++){
    cin >> a[i];
    num.at(a[i])++;
  }
  int syurui = 0;
  for(int i = 0;i < 200050;i++){
    if(num.at(i) != 0 && num.at(i) != 1000000){
      num.at(i) -= 1000000;
      syurui++;
    }
  }
  int kekka = 0;
  sort(num.begin(),num.end());
  for(int i = 0;i < 200050;i++){
    if(syurui <= k){
      break;
    }
    if(num.at(i) != 0 && num.at(i) != 1000000){
      kekka += num.at(i);
      syurui--;
    }
  }
  cout << kekka << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define ll long long
using namespace std;

ll i,j,k;
const ll MOD = 1000000000 + 7;

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

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

int main(){
    int n,k;
    cin>>n>>k;
    int ans=0;
    int d[k];
    int tmp;
    int child[n];
    REP(i,n)child[i]=0;

    REP(i,k){
        cin>>d[i];
        REP(j,d[i]){
            cin>>tmp;
            child[tmp-1]++;
        }
    }
    REP(i,n){
        if(child[i]==0){
            ans++;
        }
    }

    
    cout<<ans<<'\n';

    return 0;
}



Measured memory_bytes: 3632
#include <stdio.h>

int main(void){

int i=0, j, x;
int data[10000];

do{
scanf("%d", &x);
data[i]=x;
i++;
}while(x);

for(j=0;j<i-1;j++){
printf("Case %d: %d\n", j+1, data[j]);
}

return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define RREP(i, n) for(int i = (n)-1; i >= 0; --i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.1415926
#define coutdb cout<<fixed<<setprecision(15)

const int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef int_fast64_t ll;
#define int int_fast64_t

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

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

  int N; cin >> N; INTV A(N), toIDX(N+1);
  REP(i, N){
    cin >> A[i];
    toIDX[A[i]] = i;
  }
  set<int> S;
  S.insert(-1); S.insert(N);
  int ans = 0;
  for(int i = 1; i <= N; i++){
    int idx = toIDX[i];
    auto itr = S.lower_bound(idx);
    int big = *itr--;
    int small = *itr;
    ans += i*(big-idx)*(idx-small);
    S.insert(idx);
  }
  cout << ans << endl;
}

Measured memory_bytes: 12800
#include <stdio.h>

int main(void)
{
	int i, j;
	int n, m;
	int a[1024];
	int ak[1024];
	int b;
	int max;
	
	scanf("%d %d", &n, &m);
	for (i = 0; i < n; i++){
		scanf("%d", &a[i]);
		ak[i] = 0;
	}
	for (i = 0; i < m; i++){
		scanf("%d", &b);
		for (j = 0; j < n; j++){
			if (a[j] <= b){
				ak[j]++;
				break;
			}
		}
	}
	max = 0;
	for (i = 0; i < n; i++){
		if (ak[max] < ak[i]){
			max = i;
		}
	}
	printf("%d\n", max + 1);
	
	return (0);
}

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

int main() {
    int N, x; cin >> N >> x;
    vector<long long> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    long long ans = 0, his = 0;
    for (int i = 0; i < N; i++) {
        his = min(x - his, a[i]);
        ans += a[i] - his;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int N = sc.nextInt();
        int K = sc.nextInt();
        ArrayList<Integer> trees = new ArrayList<Integer>();
        for(int i =0; i< N; ++i) {
            trees.add(sc.nextInt());
        }
        Collections.sort(trees);
        //WRONG
        int h_min = trees.get(0);
        int h_max = trees.get(K-1);
        /*
        System.out.println(h_min);
        System.out.println(h_max);
        System.out.println(h_max - h_min);
        */
        int min_diff = Integer.MAX_VALUE;
        for(int i =0 ; i <= N - K; ++i) {
            h_min = trees.get(i);
            h_max = trees.get(i + K-1);
            int diff = h_max - h_min;
          //System.out.println(h_min);
          //System.out.println(h_max);
            //System.out.println(diff);
            if(diff< min_diff) {
                min_diff = diff;
            }
        }
        System.out.println(min_diff);
    }

}


Measured memory_bytes: 52176
n = gets.to_i
as = gets.split.map(&:to_i)
nec = as.count { |a| a < 0 }
if nec.even?
  puts as.map { |a| a.abs }.inject(:+)
else
  aaa = as.map { |a| a.abs }
  puts aaa.inject(:+) - aaa.min * 2
end


Measured memory_bytes: 9476
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
using P = pair<ld,ld>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<v<<"\n";
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=998244353;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> F(N,0);
    for(ll i=0;i<N;++i){
        for(ll j=0;j<10;++j){
            ll f;
            cin >> f;
            F[i]+=f<<j;
        }
    }
    vector<vector<ll>> P(N, vector<ll>(11));
    for(ll i=0;i<N;++i)
        for(ll j=0;j<=10;++j){
            cin>>P[i][j];
        }
    ll ans=-INF;
    for(ll i=1;i<(1LL<<10);++i){
        ll benefit=0;
        for(ll j=0;j<N;++j)benefit+=P[j][__builtin_popcountll(i&F[j])];
        chmax(ans,benefit);
    }
    prt(ans)
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func scanStrs(h, w int) (strs [][]rune) {
	strs = make([][]rune, h)
	var s string
	for i := range strs {
		fmt.Scan(&s)
		strs[i] = []rune(s)
	}
	return
}

func countUp(a [][]rune, x, y int) int {
	if x < 0 || x > len(a)-1 || y < 0 || y > len(a[0])-1 {
		return 0
	} else if a[x][y] == '#' {
		return 1
	}
	return 0
}

func main() {
	var h, w int
	fmt.Scan(&h, &w)
	a := scanStrs(h, w)

	var count int
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			count = 0
			if a[i][j] == '.' {
				count += countUp(a, i-1, j-1)
				count += countUp(a, i-1, j)
				count += countUp(a, i-1, j+1)
				count += countUp(a, i, j-1)
				count += countUp(a, i, j+1)
				count += countUp(a, i+1, j-1)
				count += countUp(a, i+1, j)
				count += countUp(a, i+1, j+1)
				fmt.Print(count)
			} else {
				fmt.Print(string(a[i][j]))
			}
		}
		fmt.Println()
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
using namespace std;
string s,t;
int dp[310][310][310] = {};
int main(){
	int i,j,l,n,k;
	cin >> s >> k; n = s.size();
	for(i=0;i<n;i++){
		t.push_back(s[n - 1 - i]);
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			for(l=0;l<=k;l++){
				if(s[i - 1]==t[j - 1]){
					dp[i][j][l] = dp[i - 1][j - 1][l] + 1;
				}else{
					int x = max(dp[i - 1][j][l],dp[i][j - 1][l]);
					if(l>0) x = max(x,dp[i - 1][j - 1][l - 1] + 1);
					dp[i][j][l] = x;
				}
			}
		}
	}
	int ans = 0;
	for(i=0;i<n;i++){
		ans = max(ans,2*dp[i][n - i][k]);
		ans = max(ans,2*dp[i][n - 1 - i][k] + 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 114560
import math

N = int(input())
a_list = [-1] + list(map(int, input().split()))

b_list = [None] * (N + 1)
for i in range(N, 0, -1):
	b = a_list[i]
	for j in range(i * 2, N + 1, i):
		b = b ^ b_list[j]
	b_list[i] = b

count = 0
b_list2 = []
for i in range(1, N + 1):
	if b_list[i] == 1:
		count += 1
		b_list2.append(str(i))

print(count)
print(" ".join(b_list2))


Measured memory_bytes: 17196
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin >> H >> W;
  
  vector<string> s;
  
  for(int i = 0;i < H;i++){
	string t;
    cin >> t;
    bool flag = false;
    for(int j = 0;j < W;j++){
      if(t[j] == '#'){
		flag = true;
      }
    }
    if(flag)s.push_back(t);
  }
  
  vector<int> a(W);
  
  for(int i = 0;i < s.size();i++){
    for(int j = 0;j < W;j++){
      if(s[i][j] == '#') a[j] = 1;
    }
  }
  
  for(int i = 0;i < s.size();i++){
    for(int j = 0;j < W;j++){
      if(a[j]) cout << s[i][j];
    }
    cout << endl;
  }
  
}
    
    

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

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

s = input()
t = input()
n = len(s)
s*=2

i = ans = 0
for c in t:
    d = s[i:].find(c)
    if d == -1:
        print(-1)
        exit()
    ans += d+1
    i += d+1
    if i >= n: i -= n
print(ans)


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

template<class T>
void print_vec(vector<T>& v) {
	for (T n: v) cout << n << " ";
	cout << "\n";
}

int main() {
	// freopen("./input.txt", "r", stdin);
	int N, T;
	cin >> N >> T;
	vector<int> c, t;
	for (int i = 0; i < N; i++) {
		int cc, tt;
		cin >> cc >> tt;
		c.push_back(cc);
		t.push_back(tt);
	}
	int ans = -1;
	for (int i = 0; i < N; i++) {
		if (t[i] <= T) {
			if (ans == -1 || c[i] < ans)
				ans = c[i];
		}
	}
	if (ans == -1) cout << "TLE\n";
	else cout << ans << "\n";	
	
	return 0;
}


Measured memory_bytes: 256
import java.lang.reflect.Array;
import java.util.*;


public class Main {

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

        int tmp = a;
        a = b;
        b = tmp;
        tmp = a;
        a = c;
        c = tmp;

        System.out.println(a+" "+b+" "+c);
    }

}


Measured memory_bytes: 23124
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS=1e-9;



int main(void){
	ll a, b;
cin >> a >> b;
if (a <= 0 && 0 <= b) {
cout << "Zero" << endl;
return 0;
}
if (b < 0) {
cout << ((b - a) % 2 ? "Positive" : "Negative") << endl;
return 0;
}
cout << "Positive" << endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
   lli n,k;
   cin>>n>>k;
   n=n%k;
   if(n==0)
   {
       cout<<0;
   }
   else
   {
       cout<<min(abs(k-n),n);
   }
   return 0;
}



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

typedef long long int ll;

int main(){
    int N, Count=0;
    cin >> N;
    vector<char> S(N);
    for(int i=0; i<N; i++){
        cin >> S[i];
        }
    char NowChar = S[0];
    for(int i=1; i<N;i++){
        if(NowChar != S[i]){
            Count++;
            NowChar = S[i];
            }
        }

    cout << Count+1;
}

Measured memory_bytes: 384
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfInt()
    val C = IntArray(N)
    for (i in N downTo 1) {
        var sum = 0
        for (n in i + i .. N step i) sum = sum xor C[n - 1]
        C[i - 1] = sum xor A[i - 1]
    }
    var ans = C.mapIndexed { index, v -> if (v == 0) 0 else index + 1 }.filter { it != 0 }
    println(ans.size)
    println(ans.joinToString(separator = " "))
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }

Measured memory_bytes: 77420
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
    string S;
    cin >> S;
    long long ans = 0;
    int count = 0;
    for (int i = S.size() - 1; i > 0; i--) {
        if (S[i] == 'B') {
            count++;
        }
        if (S[i] == 'W' && S[i - 1] == 'B') {
            ans += (S.size() - i) - count;
            S[i] = 'B', S[i - 1] = 'W';
            count++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
n, k = map(int, input().split())
S = input()

memo = []
for i, s in enumerate(S):
    if i == 0:
        now = s
        cnt = 1
        continue
    if s == now:
        cnt += 1
    else:
        memo.append(cnt)
        now = s
        cnt = 1
memo.append(cnt)

if S[-1] == "0":
    memo += [0]
if S[0] == "0":
    memo = [0]+memo

if len(S) <= 2 * k + 1:
    ans = sum(memo)
else:
    k = 2*k+1
    stand = sum(memo[0:k])
    cnt = (len(memo) - k) // 2

    ans = stand
    for i in range(cnt):
        stand -= memo[i * 2]
        stand -= memo[i * 2 + 1]
        stand += memo[k + i * 2]
        stand += memo[k + i * 2 + 1]
        ans = max(ans, stand)

print(ans)


Measured memory_bytes: 4852
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;

int read(){
    int x=0;bool f=0;char c=getchar();
    while(c<'0'||c>'9') f|=(c=='-'),c=getchar();
    while(c>='0'&&c<='9') x=x*10+(c^48),c=getchar();
    return f?-x:x;
}

int main(){
    int M=read(),D=read(),Ans=0;
    for(int i=1;i<=M;i++)
        for(int j=22;j<=D;j++)
            Ans+=(j%10>=2&&(j/10*(j%10)==i));
    printf("%d",Ans);
}


Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

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

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

    int k = 0;
    string bef = "";
    int nowcur = 0;
    int befcur = 0;
    while(nowcur<s.size()){
        if(s.substr(befcur,nowcur-befcur+1) != bef){
            bef = s.substr(befcur,nowcur-befcur+1);
            befcur = nowcur + 1;
            nowcur = nowcur + 1;
            k++;
        } else {
            befcur = nowcur;
            nowcur = nowcur + 1;
        }

    }
    cout << k << endl;

    // cout << ans << endl;
    return 0;
}

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

using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
// vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int n;
    cin >> n;
    int ans = 0;
    rep1 (i, n) {
        int x;
        cin >> x;
        if (i % 2 == 1 and x % 2 == 1) ans++;
    }
    cout << ans << endl;
}

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

int main() {
  int x, s1, s2, s3;
  cin >> x;
  s1 = x / 100;
  s2 = (x - s1 * 100) / 10;
  s3 = x - s1 * 100 - s2 * 10;
  cout << s1 + s2 + s3 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin>>n;
  ll a,b;
  cin>>a>>b;
  cout<<(n/(a+b))*a+min(a,n%(a+b))<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100000
 
int partition(int[],int,int);
 
int main(){
  int i,j,n,p;
  int A[N];
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
 
  p=partition(A,0,n-1);
 
  for(i=0;i<n;i++){
    if(i!=0){
      printf(" ");
    }
    if(i==p){ 
      printf("[");
    }
      printf("%d",A[i]);
    if(i==p){
      printf("]");
    }
  }

  printf("\n"); 
  return 0;
}
 
int partition(int A[],int p,int r){
  int i,j,x,t;

  x = A[r];
  i = p-1;
  
  for(j=p;j<=r-1;j++){
    if(A[j] <= x ){
      t=A[j];
      A[j]=A[i+1];
      A[i+1]=t;
      i++;
    }
  }
  
  t=A[i+1];
  A[i+1]=A[r];
  A[r]=t;
   
     
  return i+1;
}

Measured memory_bytes: 992
import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] s = S.toCharArray();
        int k = 0;
        for (int i = 0; i < 3; i++) {
            if (s[i] == 'o') {
                k++;
            }
        }
        System.out.println(700 + 100 * k);
    }
}


Measured memory_bytes: 21716
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N, A, B, C, D; string s; cin >> N >> A >> B >> C >> D >> s;
    s = "#" + s + "#";
    auto can_reach = [&](ll st, ll te){
        FOR(i, st, te-1){
            if(s[i] == '#' && s[i+1] == '#') return false;
        }
        return true;
    };
    
    if(!can_reach(A,C) || !can_reach(B, D)){
        cout << "No" << endl; return 0;
    }
    
    if(C > D){
        bool can_over = false;
        FOR(i, B, D+1){
            if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.'){
                can_over = true; break;
            }
        }
        if(!can_over){
            cout << "No" << endl; return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

int main(void){
  int N;
  cin >> N;
  
  long result = 0;
  for (int i = 1; i < N+1; i++){
    if (i%3 != 0 && i%5 != 0){
      result = result + i;
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <numeric>
#define _for(i,n) for(int i = 0; i < n; i++)

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

template <typename T>
vector<size_t> sort_indexes(const vector<T> &v) {
  vector<size_t> idx(v.size());
  iota(idx.begin(), idx.end(), 0);
  sort(idx.begin(), idx.end(), [&v](size_t i1, size_t i2) {return v[i1] < v[i2];});
  return idx;
}

int main() {
  int n;
  cin >>n;
  ll a[n];
  _for(i,n) cin >> a[i];
  int minuscount = 0;
  int zeroexists = 0;
  _for(i,n) if (a[i]<0) minuscount ++;
  ll absmin = abs(a[0]);
  _for(i,n) absmin = min(absmin,abs(a[i]));
  _for(i,n) if(a[i]==0) zeroexists = true;
  ll sum = 0;
  _for(i,n) sum+=abs(a[i]);
  if(zeroexists) {
    cout<<sum<<endl;
  } 
  else if(minuscount%2==0) {
    cout<<sum<<endl;
  }
  else cout<<sum-absmin*2<<endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
int main() {
    int n,x;
    while (scanf("%d%d", &n, &x)) {
        if (n == 0 && x == 0) break;
        int c=0;
        for (int i=n; i>x/3; i--) {
            for (int j=i-1; j>(x-i)/2; j--) {
                if (x-i-j>0 && x-i-j<j) c++;
            }
        }
        printf("%d\n", c);
    }
    return 0;
}

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

#define V vector
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef V<int> vi;
typedef V<ll> vll;
typedef V<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define prec(x) cout<<fixed<<setprecision(x)
#define f(i,a) for(int i = 0 ; i < a ; i++)
#define ff first
#define ss second
#define all(x) (x).begin() ,(x).end()

#define pb push_back
#define mp make_pair
#define numberofdigits(x) floor(log10(x)) + 1

ll binpow(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}

void solve()
{
	string s;
	cin >> s;

	int i = 0;
	int cnt = 0 , mx = 0;

	while (i < 3)
	{
		if (s[i] == 'R')
		{
			int j = i;
			while (j < 3 and s[j] == s[i])
				j++;

			mx = max(mx , j - i);
			i = j;
		}
		else
			i++;
	}

	cout << mx << "\n";
}

int main() {


	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);


	int t = 1;
	//cin >> t;

	while (t--)
	{
		solve();
	}

	return 0;
}





Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
    long long n,w;
    cin >> n >> w;
    
    long long dp[n+1][w+1] = {};
    vector<long long> weight(n),value(n);

    for(int i = 0; i < n; i++) cin >> weight[i] >> value[i]; 

    for(int i = 0; i < n; i++){
        for(int j = 0; j <= w; j++){
            if(weight[i] <= j)
                dp[i+1][j] = max(dp[i+1][j],dp[i][j-weight[i]]+value[i]);
            dp[i+1][j] = max(dp[i][j],dp[i+1][j]);
        }
    }

    long long ans = dp[n][w];

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 82516
#include<stdio.h>

int main(){
	int N, i, j, a, count=0;
	scanf("%d", &N);
	int d[N];
	for(i=0; i<N; i++){
		scanf("%d", &d[i]);
	}
	
	for(j=0; j<N; j++){
		for(i=0; i<N; i++){
			if(d[i]>d[i+1]){
				a = d[i];
				d[i] = d[i+1];
				d[i+1] = a;
			}
		}
	}
	
	for(i=0; i<N; i++){
		if(d[i]<d[i+1])	count++;
	}
	
	printf("%d\n", count);
	
	return 0;
}


Measured memory_bytes: 128
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n = input()
t = ""
for i in range(len(n)-1,-1,-1):
    t+=n[i]
if t == n:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3316