akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
long long int n,m,r;

int main(){
    
    scanf("%d %d",&n,&m);
    if(n==1 and m==1){
        r=1;
    }
    else if(n==1 or m==1){
        r=m*n-2;
    }
    else{
        r=(n-2)*(m-2);
    }
    
    printf("%lld\n",r);
    return 0;
}

Measured memory_bytes: 128
//BISMILLAHIR RAHMANIR RAHIM
                                               //BY THE NAME OF ALLAH
                                               //FAISAL AHAMMED SHAWON
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<set>
#include<map>
#include<iterator>
#include<numeric>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define SQ(a) (a)*(a)
#define pi acos(-1.0)
const int MAX=100001;
const int MOD=1e9+7;
int ara[MAX];
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
void fast()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    else
    gcd(b,a%b);
}
ll lcd(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}

bool f(ll a,ll b)
{
    return a>b;
}
ll max_sum_subarrays(ll ara[],ll n)
{
    ll ans=0,sum=0;
    for(ll k=0;k<n;k++){
        sum=max(ara[k],sum+ara[k]);
        ans=max(ans,sum);
    }
    return ans;
}
ll num_divisors(ll n)
{
    long long cnt=0;
    for(int i=1;i*i<=n;i++)
    {
        if(n%i==0 && i*i==n)
            cnt+=1;
        if(n%i==0 && i*i!=n)
                cnt+=2;
    }
    return cnt;
}
ll comb(ll m, ll n)
{
    ll x = max(m-n,n),ans = 1,i=1;
    for(ll k=m;k>=x+1;k--){
        ans*=k;
        ans/=i;
        i++;
    }
    return ans;
}
ll binsearch(ll low,ll high,ll target)
{
    while(low<=high)
    {
        ll mid=(low+high)/2;
        if(ara[mid]>target)
            high=mid-1;
        else if(ara[mid]<target)
            low=mid+1;
        else return mid;
    }
    return -1;
}
bool visited[10];
bool check(int x)
{
    while(1)
    {
        int rem=x%10;
        if(visited[rem])
            return false;
        x/=10;
        if(x==0)
            break;
    }
    return true;
}
int main()
{
    fast();
    int n,k;
    cin>>n>>k;
    memset(visited,0,sizeof(visited));
    for(int i=0;i<k;i++)
    {
        int a;
        cin>>a;
        visited[a]=1;
    }
    for(int i=n; ;i++)
    {
        if(check(i))
        {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


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

int main(void) {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  for (int i = 0; i < n - 1; ++i) cin >> c[i];
  
  int manzokudo = 0;
  for (int i = 0; i < n; ++i) {
    manzokudo += b[a[i] - 1];
    if (i + 1 != n && a[i + 1] == a[i] + 1) manzokudo += c[a[i] - 1];
  }  
  cout << manzokudo << endl;

  return 0;
}


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

int main(){
	string s;
	cin>>s;
	for(int i=0;i<4;i++)cout<<s[i];
	cout<<" ";
	for(int i=4;i<12;i++)cout<<s[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from bisect import bisect_left
def main(N,a,tr):
  ans=[0]*N
  dp=[float('inf')]*(N+1)
  dp[0]=0
  maxa=max(a)+1
  def dfs(p,v,dp):
    i=bisect_left(dp,a[v])
    tmp=dp[i]
    dp[i]=a[v]
    ans[v]=bisect_left(dp,maxa)-1
    for nv in tr[v]:
      if nv!=p:
        dfs(v,nv,dp)
    dp[i]=tmp
  dfs(-1,0,dp)
  print(*ans,sep='\n')
if __name__=='__main__':
  N=int(input())
  a=list(map(int,input().split()))
  tr=[[] for _ in range(N)]
  for _ in range(N-1):
    u,v=map(int,input().split())
    u,v=u-1,v-1
    tr[u].append(v)
    tr[v].append(u)
  main(N,a,tr)


Measured memory_bytes: 284012
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 100005;
char s[MAXN];
int n,k;
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%d",&k);
	for(int i=1;i<=n;++i){
		int o=('a'-s[i]+26)%26;
		if(o<=k)s[i]='a',k-=o;
	}
	if(k){
		int o=(s[n]-'a'+k)%26+'a';
		s[n]=o;
	}
	printf("%s\n",s+1);
	return 0;
}

Measured memory_bytes: 384
n=int(input())

x=[]
s=[]
for i in range(n):
    p,q=map(int,input().split())
    x.append(p)
    s.append(q)
r=[0]
for i in range(n):
    r.append(r[-1]+s[i])
b=[]
for i in range(n):
    b.append(r[i+1]-x[i])
a=[-10**30]*n
a[-1]=b[-1]
for i in range(n-1):
    a[n-i-2]=max(a[n-i-1],b[n-i-2])

ans=0
for i in range(n):
    ans=max(ans,a[i]-(r[i]-x[i]))
print(ans)

Measured memory_bytes: 91732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}

const ll MaxN=1e5;
const ll MOD=1000000007;
const ll INF=ll(1e15);

bool prime[MaxN+5];
ll ans[MaxN+5];

int main(){
	IOS();
	ll t;
	cin>>t;
	for(int i=2;i<=MaxN;i++){
		if(!prime[i]){
			for(int j=2*i;j<=MaxN;j+=i){
				prime[j]=true;
			}
		}
	}
	for(int i=3;i<=MaxN;i+=2) if(!prime[i]&&!prime[(i+1)/2]) ans[i]++;
	for(int i=3;i<MaxN;i++) ans[i+1]+=ans[i];
	while(t--){
		ll l,r;
		cin>>l>>r;
		cout<<ans[r]-ans[l-1]<<endl;
	}
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
#define pb push_back
int main(void){
    ll n;
    cin>>n;
    vector<ll>a(n);
    ll sum=0;
    rep(0,i,n){
        cin>>a[i];
        sum^=a[i];
    }
    rep(0,i,n){
        ll ans=sum^a[i];
        cout<<ans<<" ";
    }
}



Measured memory_bytes: 4784
#include "bits/stdc++.h"
using namespace std;

long long h,w,num,sum=0;
long long dist[10][10];
map<long long, long long> m;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>h>>w;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			cin>>num;
			dist[i][j]=num;
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>num;
			m[num]++;
		}
	}

	for(int k=0;k<10;k++){
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				if(dist[i][j]>dist[i][k]+dist[k][j])
					dist[i][j]=dist[i][k]+dist[k][j];
			}
		}
	}

	for(auto it=m.begin();it!=m.end();++it){
		if(it->first!=-1)
			sum+=(dist[it->first][1]*it->second);
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
	vector<int> par;
	vector<int> rank;
	vector<int> sizes;

	UnionFind(int n) : par(n), rank(n, 0), sizes(n, 1)
	{
		for (int i = 0; i < n; i++)
			par[i] = i;
	}
	int find(int x)
	{
		if (par[x] == x) {
			return x;
		} else {
			return (par[x] = find(par[x]));
		}
	}
	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);
		if (x == y)
			return;

		if (rank[x] < rank[y]) {
			par[x] = y;
			sizes[y] += sizes[x];
		} else {
			par[y] = x;
			sizes[x] += sizes[y];
			if (rank[x] == rank[y])
				rank[x]++;
		}
	}
	bool same(int x, int y)
	{
		return (find(x) == find(y));
	}
	int size(int x)
	{
		return sizes[find(x)];
	}
};
int main(void)
{
	int n, m;
	cin >> n >> m;
	UnionFind uf(n);
	for (int i = 0; i < m; i++) {
		int x, y, z;
		cin >> x >> y >> z;
		x--;
		y--;
		uf.unite(x, y);
	}
	set<int> s;
	for (int i = 0; i < n; i++) {
		s.insert(uf.find(i));
	}
	cout << s.size() << endl;
	return 0;
}

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

using namespace std;

int main(){

    int A, B;
    cin >> A >> B;
    
    int a = 1;
    int ans = 0;
    
    while (a < B) {
        a += A;
        a -= 1;
        ans += 1;
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 256
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 D = sc.nextInt();
   int  s=A*B;
   int r=C*D;
   if(s>r) {
	   System.out.println(s);
   }
   else {
	   System.out.println(r);
   }
  }
}
		

Measured memory_bytes: 21844
a=input()
list_1=list(a)
b=(len(list_1)-1)//2
c=(len(list_1)+3)//2
list_2=list_1[:b]
list_3=list_1[c-1:]
list_1r=list(reversed(list_1))
list_2r=list(reversed(list_2))
list_3r=list(reversed(list_3))
if list_1==list_1r:
  if list_2==list_2r:
    if list_3==list_3r:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")


Measured memory_bytes: 3064
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
alias route = Tuple!(long, "From", long, "To");
long bignum = 1_000_000_007;

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long x, a;
    scan(x, a);
    if(x < a)
        writeln(0);
    else
        writeln(10);
}

Measured memory_bytes: 256
import sys
import math
import functools
from collections import deque
sin = sys.stdin

nk = sin.readline().split()
n = int(nk[0])
k = int(nk[1])
heights = [int(i) for i in sin.readline().split()]
lowestCost = [0 for i in range(n)]

lowestCost[0] = 0
lowestCost[1] = abs(heights[1] - heights[0])

for i in range(2, n):
    m = float('inf')
    for j in range(i-k, i):
        if j >= 0:
            m = min(m, lowestCost[j] + abs(heights[j] - heights[i]))
    lowestCost[i] = m

print(lowestCost[n-1])


Measured memory_bytes: 56028
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N, M;cin >> N;
	vector<ll> P(N), Q(N),p(N);
	for (int i = 0;i < N;i++) cin >> P[i];
	for (int i = 0;i < N;i++) cin >> Q[i];
	for (int i = 0;i < N;i++) p[i] = i+1;
	map<vector<ll>, ll> sum; ll num = 0;
	do{
		sum[p] = num++;
	} while (next_permutation(all(p)));
	cout << abs(sum[P]-sum[Q]) << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define REP(i,n) for(int i=1;i<=(n);++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;

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

int main(){
  int H,W,K;
  cin>>H>>W>>K;
  vector<string> s(H);
  for (int i(0);i<H;i++){
    cin>>s[i];
  }
  int ans(1e9);
  int cnt_h[10][1001]={0};
  for (int h(0);h<H;h++){
    for (int w(0);w<W;w++){
      if(s[h][w] == '1'){
        cnt_h[h][w+1] = cnt_h[h][w] + 1;
      }else{
        cnt_h[h][w+1] = cnt_h[h][w];
      }
    }
  }
  for (int bit = 0; bit < (1<<(H-1)); ++bit){
    int tmp(0);
    int cnt[10][1001] = {0};
    for (int w(0);w<W;w++){
      int cnti(0);
      for (int i(0);i<(H-1);i++){
        cnt[cnti][w+1] += cnt_h[i][w+1];
        if (bit & (1<<i)){
          cnti++;
        }
      }
      cnt[cnti][w+1] += cnt_h[H-1][w+1];
      tmp = cnti;
    }
    int tmpi(0),tmpk(0);
    bool whale_flag(true);
    for(int w(0);w<W;w++){
      bool flag = true;
      for(int h(0);h<=tmp;h++){
        if(cnt[h][w+1] - cnt[h][w] > K)whale_flag = false;
        if(cnt[h][w+1] - cnt[h][tmpi] > K){
          flag = false;
        }
      }
      if (flag == false){
        tmpi = w;
        tmpk++;
      }
    }
    tmp += tmpk;
    //cout << tmp << endl;
    if(whale_flag) ans = min(ans,tmp);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  ll N, M;
  cin >> N >> M;
  ll ans = 0;
  ans = max((ll)0, (N - 2) * (M - 2));
  if (N == 1) {
    ans = M - 2;
  }
  if (M == 1) {
    ans = N - 2;
  }
  if(N==1&&M==1){
    ans = 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3612
#include <stdio.h>

#define swap( x, y ) do { double tmp; tmp = x; x = y; y = tmp; } while ( 0 )

int rel_l_l( double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, double *x, double *y ) {
	double a, b, c, d;
	int rel;

	if ( x1 < x0 ) {
		swap( x0, x1 );
		swap( y0, y1 );
	}
	if ( x3 < x2 ) {
		swap( x2, x3 );
		swap( y2, y3 );
	}

	if ( x0 != x1 ) {
		a = ( y0 - y1 ) / ( x0 - x1 );
		b = ( x0 * y1 - x1 * y0 ) / ( x0 - x1 );
	}
	if ( x2 != x3 ) {
		c = ( y2 - y3 ) / ( x2 - x3 );
		d = ( x2 * y3 - x3 * y2 ) / ( x2 - x3 );
	}

	rel = 1;
	if ( x0 == x1 ) {
		*x = x0;
		if ( x2 == x3 )
			if ( x0 == x2 ) {
				if ( y1 < y0 )
					swap( y0, y1 );
				if ( y3 < y2 )
					swap( y2, y3 );

				if ( y3 < y0 || y1 < y2 )
					rel = 3;
				else if ( y3 == y0 || y1 == y2 ) {
					*y = y3 == y0 ? y0 : y1;
					rel = 4;
				} else
					rel = 5;
			} else
				rel = 2;
		else {
			*y = c * *x + d;
			if ( *x < x2 || x3 < *x || *y < ( y0 < y1 ? y0 : y1 ) || ( y0 < y1 ? y1 : y0 ) < *y )
				rel = 0;
		}
	} else {
		if ( x2 == x3 ) {
			*x = x2;
			*y = a * *x + b;
			if ( *x < x0 || x1 < *x || *y < ( y2 < y3 ? y2 : y3 ) || ( y2 < y3 ? y3 : y2 ) < *y )
				rel = 0;
		} else {
			if ( a == c ) {
				if ( b == d )
					if ( x3 < x0 || x1 < x2 )
						rel = 3;
					else if ( x3 == x0 || x1 == x2 ) {
						*x = x3 == x0 ? x0 : x1;
						rel = 4;
					} else
						rel = 5;
				else
					rel = 2;
			} else {
				*x = ( -b + d ) / ( a - c );
				if ( *x < x0 || x1 < *x || *x < x2 || x3 < *x )
					rel = 0;
			}
			*y = a * *x + b;
		}
	}

	return rel;
}


int main( void ) {
	int q;

	scanf( "%d", &q );
	while ( q-- ) {
		int rel;
		double x0, y0, x1, y1, x2, y2, x3, y3, x, y;

		scanf( "%lf %lf %lf %lf %lf %lf %lf %lf", &x0, &y0, &x1, &y1, &x2, &y2, &x3, &y3 );

		rel_l_l( x0, y0, x1, y1, x2, y2, x3, y3, &x, &y );

		printf( "%.8f %.8f\n", x, y );
	}

	return 0;
}

Measured memory_bytes: 668
# -*- coding: utf-8 -*-
from math import gcd
a, b, c, d = map(int, input().split())

x = b - b//c - b//d + b//(int(c*d/gcd(c, d)))
y = (a-1) - (a-1)//c - (a-1)//d + (a-1)//(int(c*d/gcd(c, d)))
print(int(x-y))


Measured memory_bytes: 9132
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a>=c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(LL &a,LL &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(LL &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

int fbc[200000];

int fb(int a)
{
	if(fbc[a]>0)
	return fbc[a];
	
	
	if(a<2)
	return 1;
	
	fbc[a]=fb(a-1)+fb(a-2);
	return fbc[a];
	
}

int main()
{
	iniarr(fbc,200000);
	int a;
	scd(a);
	printf("%d\n",fb(a));	
	return 0;
}

Measured memory_bytes: 3948
import heapq

N,M = map(int, input().split())
a_b_list = []
for i in range(N):
    a,b = map(int, input().split())
    a_b_list.append([a,b])

a_b_list.sort()
task_list = [0] * (M+1)

heap = []
index = 0
for day in range(1, M+1):
    while index < N:
        if a_b_list[index][0] == day:
            heapq.heappush(heap, a_b_list[index][1] * -1)
            index += 1
        else:
            break
    if len(heap) != 0:
        task_list[day] = heapq.heappop(heap)

#print(task_list)
print(sum(task_list) * -1)


# for a,b in a_b_list:
# #    print(a, b)
#     if task_list[a] == 0:
# #        print("append")
#         task_list[a] = b
#     else:
# #        print("NOT append")
#         index = a + 1
#         while index <= M:
#             if task_list[index] == 0:
#                 task_list[index] = b
#                 break
#             index += 1
# print(sum(task_list))
# #print(task_list)

Measured memory_bytes: 24648
#include <cstdio>
#include <vector>
#include <cassert>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i))
using ll = long long;
using namespace std;
template <class T> inline void setmax(T & a, T const & b) { a = max(a, b); }
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }
constexpr ll inf = ll(1e18)+9;
int main() {
    int n, total_w; scanf("%d%d", &n, &total_w);
    vector<int> w(n), v(n); repeat (i,n) scanf("%d%d", &w[i], &v[i]);
    int base = w[0];
    vector<int> delta(n);
    repeat (i,n) {
        delta[i] = w[i] - base;
        assert (0 <= delta[i] and delta[i] <= 3);
    }
    ll result = 0;
    for (int cnt = total_w / (base + 3); cnt <= n; ++ cnt) {
        int total = min<ll>(3*n, total_w - cnt*(ll)base);
        if (total < 0) break;
        auto dp = vectors<ll>(cnt+1, total+1, - inf);
        dp[0][0] = 0;
        repeat (i,n) {
            repeat_reverse (j,cnt) {
                repeat_reverse (k,total+1) if (k+delta[i] <= total) {
                    setmax(dp[j+1][k+delta[i]], dp[j][k] + v[i]);
                }
            }
        }
        repeat (k,total+1) {
            setmax(result, dp[cnt][k]);
        }
    }
    printf("%lld\n", result);
    return 0;
}


Measured memory_bytes: 512
#pragma region noncode
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SORT(v) sort(all(v))
#define TROS(v) sort(all(v), std::greater<Type>());
#pragma endregion

int main() {
    // template
    int a,b,c;cin>>a>>b>>c;
    if(a+b >= c) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3580
def A():
    temp = [int(i) for i in input().split()]
    ans = 0
    for n in temp:
        if n<4:
            ans += (4-n)*100000
    if temp[0] == 1 and temp[1] == 1:
        ans += 400000
    print(ans)

def B():
    N = int(input())
    lengths = [int(i) for i in input().split()]
    total = sum(lengths)
    temp_sum = lengths[0]
    ans = float('inf')
    for i in range(1, N):
        ans = min(ans, abs(total-2*temp_sum))
        temp_sum += lengths[i]
    
    print(ans)

def C():
    temp = [int(i) for i in input().split()]
    H = temp[0]
    W = temp[1]
    K = temp[2]
    matrix = []
    for i in range(H):
        matrix.append(list(input()))
    ans = [[0 for i in range(W)] for j in range(H)]
    # def check(i, j):
    #     if i >= 0 and i < H and j >= 0 and j < H and matrix[i][j]!='d' and matrix[i][j]!="#":
    #         return True
    # def expand(i, j, num):
    #     horizontal = [(0, -1), (0, 1)]
    #     vertical = [(1, 0), (-1, 0)]
    #     diagonals = [(-1, -1), (1, 1)]
    #     ans[i][j] = num
    #     matrix[i][j] = 'd'
    #     horizontal_flag = False
    #     for d in horizontal:
    #         if check(i+d[0], j+d[1]):
    counter = 1
    first_not_wait = 0
    for i in range(H):
        if '#' not in matrix[i]:
            if i==0 or ans[i-1] == 'wait':
                ans[i] = 'wait'
                first_not_wait += 1
            else:
                ans[i] = ans[i-1]
        else:
            for j in range(W):
                ans[i][j] = str(counter)
                if matrix[i][j] == '#' and '#' in matrix[i][j+1:]:
                    counter += 1
            counter += 1

    for i in range(H):
        if ans[i] == 'wait':
            ans[i] = ans[first_not_wait]
        print(' '.join(ans[i]))

C()

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef string ss;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n,max=0;
    cin >> n;
    ll a[2][n];
    rep(i,2){
        rep(j,n)cin >> a[i][j];
    }
    rep(i,n){
        ll tmp=0;
        rep(j,i+1)tmp+=a[0][j];
        for(ll j=i;j<n;j++)tmp+=a[1][j];
        if(tmp >= max)max=tmp;
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    S=input()
    C=[[0,0] for _ in range(n)] #i以下の#の数，i以上の.の数
    cunt=0
    for i,s in enumerate(S):
        if s=='#':
            cunt+=1
        C[i][0]=cunt
    cunt=0
    for i in range(n-1,-1,-1):
        if S[i]=='.':
            cunt+=1
        C[i][1]=cunt  
    ans=C[0][1]
    for i in range(n-1):#.#をとる位置
        ans=min(ans,C[i][0]+C[i+1][1])
    ans=min(ans,C[n-1][0])
    print(ans)

if __name__=='__main__':
    main()

Measured memory_bytes: 30056
/*
 * FILE: ABC 127A.cpp
 *
 * @author: Piyush Kanti Das <piyush123kantidas[at]gmail[dot]com>
 *
 * LINK:
 *
 * DATE CREATED: 04.06.2019 01:39:41 +06
 *
 * DESCRIPTION:
 *
 * DEVELOPMENT HISTORY:
 * Date         Version     Description
 * --------------------------------------------------------------
 * 04-06-2019	1.0         File Created
 *
 */


/*
// _______________________________________________________________/\\\_________
//  ______________________________________________________________\/\\\_________
//   ___/\\\\\\\\\___/\\\____/\\\__/\\\____________________________\/\\\_________
//    __/\\\/////\\\_\///____\//\\\/\\\___/\\\____/\\\__/\\\\\\\\\\_\/\\\_________
//     _\/\\\\\\\\\\___/\\\____\//\\\\\___\/\\\___\/\\\_\/\\\//////__\/\\\\\\\\\\__
//      _\/\\\//////___\/\\\_____\//\\\____\/\\\___\/\\\_\/\\\\\\\\\\_\/\\\/////\\\_
//       _\/\\\_________\/\\\__/\\_/\\\_____\/\\\___\/\\\_\////////\\\_\/\\\___\/\\\_
//        _\/\\\_________\/\\\_\//\\\\/______\//\\\\\\\\\___/\\\\\\\\\\_\/\\\___\/\\\_
//         _\///__________\///___\////_________\/////////___\//////////__\///____\///__
//
*/

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

typedef long long           ll;
typedef double              lf;
typedef unsigned long long  ull;
typedef pair<int, int>      pii;
typedef vector<pii>         vpii;
typedef vector<int>         vi;
typedef vector<long long>   vll;

#define __FastIO        ios_base::sync_with_stdio(false); cin.tie(0)

#define forr(i, a, b)   for (__typeof (a) i=a; i<=b; i++)
#define rof(i, b, a)    for (__typeof (a) i=b; i>=a; i--)
#define rep(i, n)       for (__typeof (n) i=0; i<n; i++)
#define forit(i, s)     for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
#define all(ar)         ar.begin(), ar.end()

#define fill(ar)   		memset(ar, -1, sizeof(ar))
#define clr(a)          memset(a, 0, sizeof(a))

#define nl              cout << '\n';
#define sp              cout << ' ';
#define ckk             cout << "##########\n"

#define pb              push_back
#define MP 				make_pair

#define debug1(x)       cerr << #x << ": " << x << endl
#define debug2(x, y)    cerr << #x << ": " << x << '\t' << #y << ": " << y << endl
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z << endl

#define gama 0.57721566490
#define PI              acos(-1.0)
#define INF             0x7fffffff
#define MOD             1000000007
#define EPS             1e-7
#define MAX             100005

int Set(int N,int pos){return N=N | (1<<pos);}
int Reset(int N,int pos){return N= N & ~(1<<pos);}
bool Check(int N,int pos){return (bool)(N & (1<<pos));}


ll BM( ll a , ll b , ll m )
{
    if ( b == 0 ) return 1 ;
    ll x = BM(a,b/2,m);
    x = (( x % m) * (x % m))%m;
    
    if( b % 2 ) x = (( x % m) * (a %m)) % m ;
    return x ;
}

//Auto-format --> ctrl+shift+a
/********************* Code starts here ************************/

int main() {
    __FastIO;   //Be aware to use it!
    int A, B;
    cin >> A >> B;
    
    if(A <= 5){
		cout << 0 << endl;
	}else if(A < 13){
		cout << B/2 << endl;
	}
	else{
		cout << B << endl;
	}
    
    return 0;
}


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

# AtCoder Beginner Contest
# Problem B


def is_harshad_number(number):
    if number % sum_digit(number) == 0:
        return "Yes"
    else:
        return "No"


def sum_digit(number):
    return sum(list(map(int, list(str(number)))))


if __name__ == '__main__':
    number = int(input())

    result = is_harshad_number(number)
    print(result)


Measured memory_bytes: 2940
#include<iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iterator>
#include <queue>
#define int long long
#define INF 1e18
using namespace std;
typedef pair<int, int> P;
signed main() {
	int n, d, ans = 0, sum[31] = {}, sum2[31] = {};
	int x[31], y[31];
	vector<P> d1, d2, dp[16];
	cin >> n >> d;
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
		sum[i] = x[i] + sum[i - 1];
	}
	dp[0].push_back(make_pair(0, 0));
	for (int i = 1; i <= 15; i++) {
		for (int j = 0; j < i; j++) {
			for (vector<P>::iterator itr = dp[j].begin(); itr != dp[j].end(); itr++) {
				P p = *itr;
					dp[i].push_back(make_pair(p.first + x[i],  p.second + y[i]));
				if (n <= 15 || p.first - x[i] + sum[15] - sum[i] > 0) {
					dp[i].push_back(make_pair(p.first - x[i], p.second - y[i]));
				}
			}
		}
		if (n <= i) {
			for (int j = 0; j <= i; j++) {
				for (vector<P>::iterator itr = dp[j].begin(); itr != dp[j].end(); itr++) {
					P p = *itr;
					if (p.first >= -d && p.first <= d) {
						ans = max(p.second, ans);
					}
					if (-1 * p.first >= -d && -1 * p.first <= d) {
						ans = max(-1 * p.second, ans);
					}
				}
			}
			cout << ans << endl;
			return 0;
		}
	}
	for (int i = 0; i <= 15; i++) {
		for (vector<P>::iterator itr = dp[i].begin(); itr != dp[i].end(); itr++) {
			P p = *itr;
			d1.push_back(make_pair(p.first, p.second));
			d1.push_back(make_pair(-p.first, -p.second));
		}
		dp[i].clear();
	}
	dp[0].push_back(make_pair(0, 0));
	for (int i = 16; i <= n; i++) {
		for (int j = 0; j < i - 15; j++) {
			for (vector<P>::iterator itr = dp[j].begin(); itr != dp[j].end(); itr++) {
				dp[i - 15].push_back(make_pair(itr->first + x[i] , itr->second + y[i]));
				if (itr->first - x[i] + sum[n] - sum[i] >= 0)
					dp[i - 15].push_back(make_pair(itr->first - x[i], itr->second - y[i]));
			}
		}
	}
	for (int j = 0; j <= 15; j++) {
		for (vector<P>::iterator itr = dp[j].begin(); itr != dp[j].end(); itr++) {
			d2.push_back(make_pair(itr->first, itr->second));
			d2.push_back(make_pair(-itr->first, -itr->second));
		}
		dp[j].clear();
	}

	sort(d1.begin(), d1.end());
	sort(d2.begin(), d2.end());

	int a = 0, b = 0;
	deque<int> c;
	for ( int i = d1.size() - 1; i >= 0; i--) {
		while (a < d2.size() && d1[i].first + d2[a].first <= d) {
			while (!c.empty() && d2[c.back()].second <= d2[a].second) c.pop_back();
			c.push_back(a);
			a++;
		}
		while (b < d2.size() &&  d2[b].first + d1[i].first < -d) {
			if (!c.empty() && c.front() == b) c.pop_front();
			b++;
		}
		if(!c.empty()) ans = max(ans, d1[i].second + d2[c.front()].second);
	}
	cout << ans << endl;
	return 0;
}

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

int main(void){
  while(1){
    int stone[50];
    for(int k = 0 ; k < 50 ; k++){stone[k] = 0;}

    int bowl;
    int n, p;  // n：候補者人数，p：小石の総数
    cin >> n;
    cin >> p;

    if(n == 0 && p == 0){return 0;}

    bowl = p;

    bool flg = true;
    int ans;

    for(int i = 0 ; flg ; i = (i+1) % n){

      if(bowl == 0){
        bowl = bowl + stone[i];
        stone[i] = 0;
      }else{
        stone[i]++;
        bowl--;
        if(bowl == 0 && stone[i] == p){ans = i; flg = false;}
      }
    }

    cout << ans << endl;
  }
}



Measured memory_bytes: 3096
{-# LANGUAGE BangPatterns #-}
import Data.List
import Data.Maybe
import Control.Monad
import Data.Function (fix)
import Data.Array (Array, array, (!))
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
 
getInts :: IO [Int]
getInts = (map parseInt . BS8.words) <$> BS.getLine 
    where parseInt = fst . fromJust . BS8.readInt

data Tree a = Tree (Tree a) a (Tree a)

instance Functor Tree where
    fmap f (Tree l m r) = Tree (fmap f l) (f m) (fmap f r)

index :: Tree a -> Int -> a
index (Tree _ m _) 0 = m
index (Tree l _ r) n = case (n - 1) `divMod` 2 of
    (q,0) -> index l q
    (q,1) -> index r q

nats :: Tree Int
nats = go 0 1
    where go !n !s = Tree (go l s') n (go r s')
            where l = n + s
                  r = l + s
                  s' = s * 2

memo :: (Int -> a) -> (Int -> a)
memo f = index cached
    where cached = fmap f nats

memo2 :: (Int -> Int -> a) -> (Int -> Int -> a)
memo2 f = memo (\x -> memo (f x))

memo3 :: (Int -> Int -> Int -> a) -> (Int -> Int -> Int -> a)
memo3 f = memo (\x -> memo2 (f x))

solve :: Int -> [Int] -> Int
solve t = fst . foldl (\(a,b) x -> (a + min t (x+t-b), x+t)) (0,0)

main :: IO ()
main = do
    [_, t] <- getInts
    arr <- getInts
    print $ solve t arr

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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

ll tri(ll N)
{
    ll answer = N*(N-1)/2;
    return answer;
}

/*
    5
    1   2~5   4
    2   3~5   3
    3   4~5   2
    4     5   1
*/

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

    map<string,ll> Map;

    string s;

    for(int i=0;i<N;i++)
    {

        cin >> s;
        sort(ALL(s));
        if(Map.count(s)==0)
        {
            Map.insert(make_pair(s,1));
        }
        else
        {
            Map.at(s)++;
        }
    }

    ll answer = 0;

    for(auto x:Map)
    {
        answer += tri(x.second);
    }

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 11136
s = input()

ans = 0
for i in range(len(s)+1):
    for j in range(len(s)+1):
        ss = s[i:j]
        acgt = ['A', 'C', 'G', 'T']
        fl = 1
        for si in ss:
            if si not in acgt:
                fl = 0
                break
        if fl == 1 and len(ss) > 0:
            ans = max(ans, j - i)

print(ans)


Measured memory_bytes: 3060
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 1000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*4
#define REP(a,b) for(long long a = 0;a < b;++a)
int saisyou[300000] = {};
int saidai[300000] = {};
int bad[300000] = {};
int main() {
	int n, k;
	cin >> n >> k;
	int ans = 0;
	vector<int> hoge;
	REP(i, n) {
		int a;
		cin >> a;
		hoge.push_back(a);
	}
	priority_queue<int> next;
	REP(i, n) {
		next.push(hoge[i]);
		if (i >= k) {
			bad[hoge[i - k]] = 1;
			while (next.empty() == false && bad[next.top()] == true) {
				next.pop();
			}
		}
		saidai[i] = next.top();
	}
	while (next.empty() == false) {
		next.pop();
	}
	REP(q, 300000) {
		bad[q] = 0;
	}
	REP(i, n) {
		int itr = n - i - 1;
		next.push(-hoge[itr]);
		if(i >= k){
			bad[hoge[itr + k]] = 1;
			while (next.empty() == false && bad[-next.top()] == true) {
				next.pop();
			}
		}
		saisyou[itr] = -next.top();
	}
	int cnt = 0;
	int tea = 0;
	for (int i = 0; i < n; ++i) {
		if (i-1>=0&&hoge[i-1] > hoge[i]) {
			cnt++;
		}
		if (i >= k) {
			if (hoge[i - k] > hoge[i - k + 1]) {
				cnt--;
			}
		}
		if (i >= k) {
			if (saisyou[i - k] != hoge[i - k] || saidai[i] != hoge[i]) {
				ans++;
				if (cnt == 0) {
					tea++;
				}
			}
		}
		else if (i + 1 == k) {
			ans++;
			if (cnt == 0) {
				tea++;
			}
		}
	}
	ans -= max(tea - 1, 0);
	cout << ans << endl;
}

Measured memory_bytes: 4724
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

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);
};
//fixed << setprecision(2)
int main() {
	int N;
	int ans=0;
	cin >> N;
	vector<int>a(N);
	rep(i, N) {
		cin >> a[i];
	}
	rep(i, N) {
		if ((i + 1) % 2 == 1&&a[i]%2==1) {
			ans++;

		}

	}
	cout << ans;
}
	


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

int main()
{
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int a, b;
    cin >> a >> b;

    if (a + b == 15) {
        cout << '+' << endl;
        ret();
    }
    if (a * b == 15) {
        cout << '*' << endl;
        ret();
    }
    cout << 'x' << endl;
}


Measured memory_bytes: 3656
#ABC064C
N=int(input())
a=list(map(int, input().split()))
count=[0]*9
for i in range(N):
    if a[i]//400>=8:
        count[8]+=1
    elif count[a[i]//400]==0:
        count[a[i]//400]+=1
if count[8]==sum(count):
    print(1, sum(count))
else:
    print(sum(count)-count[8], sum(count))


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

int main() {
	int n;
	string str;
	cin >> str;
	n = str.size();
	int a[10];
	for (int i = 0; i < n; i++) {
		a[i] = str[i] - '0';
	}
	long long w = 0;
	for (long long b = 0; b < ((long long)1 << (n - 1));b++) {
		long long c = a[0];
		for (int i = 1; i < n;i++) {
			if (b >> (i - 1) & 1) {
				w += c;
				c = a[i];
			}
			else {
				c = c * 10 + a[i];
			}
		}
		w += c;
	}
	cout << w;
}

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

using namespace std;

int main()
{
    int N;
    scanf("%d", &N);

    if (N == 0)
    {
        printf("2");
    }
    else if (N == 1)
    {
        printf("1");
    }
    else
    {
        int64_t tmp1 = 2LL, tmp2 = 1LL, answer = 0LL;
        for (int count = 0; count < N - 1; count++)
        {
            answer = tmp1 + tmp2;
            tmp1 = tmp2;
            tmp2 = answer;
        }
        printf("%lld", answer);
    }
}

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 1e6+5;
string s;
ll n , m , cnt[N] , x[N] , y[N] , mod=1e9+7;

int mul(int a, int b)
{
    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return (1ll * a * b) % mod;
}

int add(int a, int b)
{
    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return (a + b) % mod;
}

int main()
{

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

    cin >> n >> m;
    for(int i=1; i<=n; i++)
        cin >> x[i];
    for(int i=1; i<=m; i++)
        cin >> y[i];

    sort(x+1 , x+n+1);
    sort(y+1 , y+m+1);

    vector<ll> v,v2;
    for(int i=1; i<n; i++)
        v.push_back(add(x[i+1],-x[i]));
    for(int i=1; i<m; i++)
        v2.push_back(add(y[i+1],-y[i]));

    ll sum=0 , sum2=0 , p=(int)v.size() , st=(int)v.size();

    for(int i=0; i<v.size(); i++)
    {
        sum = add(sum , mul(v[i] , st));
        p = add(p , -2);
        st = add(st , p);
    }

    p=(int)v2.size() , st=(int)v2.size();
    for(int i=0; i<v2.size(); i++)
    {
        sum2 = add(sum2 , mul(v2[i] , st));
        p = add(p , -2);
        st = add(st , p);
    }

    cout << mul(sum,sum2) << '\n';

    return 0;
}

Measured memory_bytes: 7412
#include <bits/stdc++.h>
#define M 104
using namespace std;

int main()
{
    char s[M],t[M];
    cin>>s>>t;
    int len=strlen(s);
    int b,e,st,f=0;
    for(e=b=st=0;t[e]!='\0';)
    if(s[st]==t[e])
    {
        st++;e++;
    }
    else
    {
        st=0;
        b++;
        e=b;
    }
    //cout<<"b"<<" "<<b<<endl;
    int i,j=b;
    for(i=0;i<len-b;i++,j++)
        if(s[i]!=t[j])f=1;
    j=0;
    for(i=len-b;s[i]!='\0';i++,j++)
        if(s[i]!=t[j])f=1;
    if(f)cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
r, g, b, n = map(int, input().split())

counter = 0
for i in range(int(n/r) + 1):
  for j  in range(int((n - r * i) / g) + 1):
    if (n - r * i - g * j) % b == 0:
      counter +=1

print(counter)


Measured memory_bytes: 2940
#include <cstdio>
#include <algorithm>

using namespace std;

int a[200'009];

int main() {
  int m, n;
  scanf("%d%d", &m, &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  int mx = 0;
  for (int i = 0; i < n - 1; ++i) {
    mx = max(mx, a[i + 1] - a[i]);
  }
  mx = max(mx, m - a[n - 1] + a[0]);
  printf("%d\n", m - mx);
}


Measured memory_bytes: 896
void main()
{
    int n = readln.chomp.to!int;
    writeln(readln.split.to!(int[]).sum - n);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 2300