akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
#include <string>
using namespace std;

typedef long long ll;

int main()
{
	int n, x, y;
	cin >> n >> x >> y;
	
	vector <ll> v(n, 0);
	for (int i = 1; i <= n - 1; ++i)
		for (int j = i + 1; j <= n; ++j)
			v[min(abs(i - x) + abs(j - y) + 1, j - i)]++;

	for (int i = 1; i <= n - 1; ++i)
		cout << v[i] << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define lP pair<ll,ll>
#define iP pair<int,int>

typedef long long ll;
using namespace std;
const int mod = 1e9 + 7;

int N, M, A[100000], B[100000];
ll sa, sb;
int main(){
	cin >> N >> M;
	for (int i = 0; i != N; ++i) {
		cin >> A[i];
		sa += A[i];
	}
	for (int i = 0; i != M; ++i) {
		cin >> B[i];
		sb += B[i];
	}
	cout << sa * sb << endl;
	return 0;
}



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

int main() {
    int N, X, T;
    std::cin >> N >> X >> T;

    int c = N/X;
    if(N%X>0) 
        c++;

    int ans = c*T;
    
    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 3580
import numpy as np

r90=np.array([
  [0, -1],
  [1, 0]
])

r270=np.array([
  [0, 1],
  [-1, 0]
])

x1, y1, x2, y2=map(int, input().split())
xy3=np.array([x2, y2])+np.dot(r90, np.array([x2-x1, y2-y1]))
xy4=np.array([x1, y1])+np.dot(r270, np.array([x1-x2, y1-y2]))

print(' '.join(map(str, xy3.tolist())), end=' ')
print(' '.join(map(str, xy4.tolist())))

Measured memory_bytes: 12476
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=200005,mod=1e9+7;
int inv2=(mod+1)/2;
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
int n,S=1;
int a[N],b[N],p[N];
namespace bit{
	int c[N];
	void add(int x,int d){
		for (;x<=n;x+=x&-x)
			Add(c[x],d);
	}
	int Ask(int x){
		int ans=0;
		for (;x;x-=x&-x)
			Add(ans,c[x]);
		return ans;
	}
}
bool cmp1(int x,int y){
	return a[x]<a[y];
}
bool cmp2(int x,int y){
	return x<y;
}
int pre[N];
int main(){
	n=read();
	For(i,1,n){
		a[i]=read();
		b[a[i]]++;
	}
	Fod(i,n,1)
		b[i]+=b[i+1];
	For(i,1,n)
		b[i]-=n-i;
	For(i,1,n){
		if (b[i]<=0)
			return puts("0"),0;
		S=(LL)S*b[i]%mod;
	}
	For(i,1,n)
		p[i]=i;
	sort(p+1,p+n+1,cmp1);
	int ans=0;
//	outarr(b,1,n);
//	outarr(p,1,n);
	for (int i=1,j;i<=n;i=j){
		for (j=i+1;j<=n;j++){
			int flag=0;
			For(k,a[p[j-1]]+1,a[p[j]])
				if (b[k]==1){
					flag=1;
					break;
				}
			if (flag)
				break;
		}
//		outval(i),outval(j);
		int mi=a[p[i]],mx=a[p[j-1]];
		pre[mi]=1;
		For(k,mi+1,mx)
			pre[k]=(LL)pre[k-1]*(b[k]-1)%mod*Pow(b[k],mod-2)%mod;
		sort(p+i,p+j,cmp2);
		For(k,i,j-1){
			int x=p[k];
			if (k>i){
				int t=(LL)bit::Ask(a[x])*pre[a[x]]%mod;
				Add(ans,(LL)t*S%mod*inv2%mod);
			}
			bit::add(a[x],Pow(pre[a[x]],mod-2));
		}
		For(k,i,j-1)
			bit::add(a[p[k]],Del(-Pow(pre[a[p[k]]],mod-2)));
		For(k,i,j-1){
			int x=p[k];
			if (k>i){
				int t=Del(bit::Ask(n)-bit::Ask(a[x]));
				t=(LL)t*Pow(pre[a[x]],mod-2)%mod;
				Del(ans,(LL)t*S%mod*inv2%mod);
			}
			bit::add(a[x],pre[a[x]]);
		}
		For(k,i,j-1)
			bit::add(a[p[k]],Del(-pre[a[p[k]]]));
	}
	For(i,1,n){
		int t=bit::Ask(n)-bit::Ask(a[i]);
		bit::add(a[i],1);
		Add(ans,(LL)S*t%mod);
	}
	cout<<ans<<endl;
	return 0;
}

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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 50);

void solve(long long X) {
    int ans = X / 500 * 1000;
    X %= 500;
    cout << ans + X / 5 * 5 << endl;
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    long long X;
    scanf("%lld", &X);
    solve(X);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define len(x) ((int)(x).size())
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;

const ll LINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9+7;

/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){

	fastio;
	int n;
	cin >> n;
	vector<int> b(n+1);
	int k;
	cin >> k;
	vector<int> a;
	a.pb(k), a.pb(k);
	for(int i = 1; i < n-1; i++){
		cin >> b[i];
	}
	for(int i = 1; i < n-1; i++){
		if(b[i] < a[i]) a[i] = b[i];
		a.pb(b[i]);
	}
	int ans = 0;
	for(int x : a) ans += x;
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{

  public static void main(String[] args){

    Scanner stdIn = new Scanner(System.in);

    int x = stdIn.nextInt();
    int y = stdIn.nextInt();
    if(y > x){
      int tmp = x;
      x = y;
      y = tmp;
    }
    System.out.println(gcd(x, y));
  }


  static int gcd(int x, int y){
    if(x % y == 0){
		  return(y);
    }
	  else{
		  return(gcd(y, x % y));
    }
  }
}



Measured memory_bytes: 26284
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//for(int i = ; i < ; i++){}

int main(){
    int n;
    cin>>n;
    int a[n];
    int sum = 0;
    for(int i = 0; i<n; i++){
        cin>>a[i];
        while(a[i]>0&&a[i]%2==0){
                sum++;
                a[i]/=2;
            }
        }
    cout<<sum<<endl;
    return 0;
}


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

int main()
{
    int N;
    std::cin >> N;
    double rate = 380000.0;
    double otoshidama = 0;
    for (int i = 0; i < N; i++) {
        double x;
        std::string u;
        std::cin >> x >> u;
        if (u == "JPY") {
            otoshidama += x;
        } else {
            otoshidama += (x * rate);
        }
    }
    std::cout << otoshidama << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

typedef long long ll;

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

	ll ans = 0;
	ans += (x / 500) * 1000;
	x -= (x / 500) * 500;
	ans += (x / 5) * 5;
	cout << ans << endl;
	return 0;
}

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

int main() {
  string a, b;
  cin >> a >> b;
  if (a.at(0) == b.at(2) && a.at(1) == b.at(1) && a.at(2) == b.at(0)) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int dp[3001][3001];
int main()
{
	string s,t;
	cin>>s>>t;
	for(int i=1;i<=s.length();i++)
	{
		for(int j=1;j<=t.length();j++)
		{
			if(s[i-1]==t[j-1])
			dp[i][j]=dp[i-1][j-1]+1;
			else
			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	int i=s.length();
	int j=t.length();
	vector<char>ans;
	while(i!=0&&j!=0)
	{
		if(dp[i][j]==dp[i-1][j])
		i--;
		else if(dp[i][j]==dp[i][j-1])
		j--;
		else
		{
			ans.push_back(s[i-1]);
			i--;
			j--;
		}
	}
	for(i=ans.size()-1;i>=0;i--)
	cout<<ans[i];
	return 0;
}

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

int main()
{
	string a, b, c;
	cin >> a >> b >> c;
	if (a[a.length()-1] == b[0] && b[b.length()-1] == c[0])
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


Measured memory_bytes: 256
X,Y = (int(x) for x in input().split())

A = []

for x in range(0,X+1,1):
    legs = 2 * x + 4 * (X-x)
    if legs == Y:
        A.append([x,X-x])

if len(A) == 0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 9180
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
using namespace std;
const int MAXN = (int) 1e5 + 10;
const int INF = (int) 0x3f3f3f3f;
typedef long long LL;

int n,k;
int a[MAXN];

bool is_judge(int x){
    int l=1,r=n;
    while(l<=r){
        int mid=(l+r)>>1;
        if(a[mid]==x) return true;
        if(a[mid]<x) l=mid+1;
        else r=mid-1;
    }
    return false;
}

void work(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    int q; scanf("%d",&q);
    int ans=0;
    for(int i=1;i<=q;i++){
        int x; scanf("%d",&x);
        if(is_judge(x)) ans++;
    }
    printf("%d\n",ans);
}

int main(){
    work();
    return 0;
}





Measured memory_bytes: 2812
def m():
    a, b = map(int, input().split())
    # 0は白，1は黒
    grid = [[0]*100 for _ in range(100)]
    k = 50
    for i in range(k):
        for j in range(k*2):
            grid[i][j] = 1

    for i in range(k-1):
        if i % 2 == 0:ind = 0
        else:continue

        while ind < 100 and a-1 > 0:
            grid[i][ind] = 0
            ind += 2
            a -= 1
        if a-1 <= 0:
            break

    for i in range(k*2-1, k,-1):
        if i % 2 == 1:ind = 1
        else:continue

        while ind < 100 and b-1 > 0:
            grid[i][ind] = 1
            ind += 2
            b -= 1
        if b-1 <= 0:
            break

    print("100 100")
    for i in range(k*2):
        for j in range(k*2):
            if grid[i][j] == 0:
                print(".", end="")
            else:
                print("#", end="")
        print("")
m()

Measured memory_bytes: 4596
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int a[214514],b[214514];
int main()
{
	int n;
	cin>>n;
	int x=0,y=n-1;
	rep(i,n) cin>>a[i];
	for(int i=n-1;i>=0;i--){
		if(i%2==n%2){
			b[y]=a[i];y--;
		}
		else{
			b[x]=a[i];x++;
		}
	}
	rep(i,n){
		cout<<b[i];
		if(i<n-1) cout<<' ';else cout<<endl;
	}
}


Measured memory_bytes: 3840
program a
  implicit none
  integer :: N,i,M
  integer,allocatable :: W(:),st(:),bro(:)

  read(*,*) N,M
  allocate(W(N))
  W=1
  allocate(bro(M))
  allocate(st(N))
 
  if(M.gt.0) then
 	 read(*,*) bro 
     do i=1,M
          W(bro(i))=0
     enddo
  endif
  do i=1,N
     if(i.eq.1) then
        st(i)=W(1)
     elseif(i.eq.2) then
        st(i)=W(2)*(W(1)+1)
     else
        st(i)=mod((st(i-2)+st(i-1)),1000000007)*W(i)
     endif
  enddo

  write(*,'(i0)') st(n)

                                                                    
  deallocate(st)
  deallocate(W)
end program a


Measured memory_bytes: 1920
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    cout<<(1-n)<<endl;
    return 0;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
template<class T> inline void fix(T &x) {if(x >= mod | x <= -mod) {x %= mod;} if(x < 0) {x += mod;}}

ll sum(ll x) {
    return (x * x + x) / 2ll;
}

ll sum(ll l, ll r) {
    if(l == 0) {return sum(r);}
    return sum(r) - sum(l - 1);
}

signed main() {
    //ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    for(int i = k; i <= n + 1; i ++) {
        ll small = sum(0, i - 1) % mod;
        ll big = sum(n - i + 1, n) % mod;
        ans += big - small + 1;
        //cout << i << " " << small << " " << big << endl;
        ans %= mod;
        if(ans < 0) {ans += mod;}
    }
    cout << ans << endl;
    return 0;
}




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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int po[22];

int dfs(int i,int dif,int L){
    if(i==L/2){
        return dif==0;
    }

    int u=po[L-1-i]-po[i];

    int x;
    if(dif>=0){
        x=(dif+u-1)/u;
    }
    else{
        x=dif/u;
    }

    int ret=0;
    for(int uku=0;uku<2;uku++,x--){
        if(x<-9||9<x)continue;
        int tmp=dfs(i+1,dif-u*x,L);

        int k=10-abs(x);
        if(i==0&&x>=0)k--;
        ret+=tmp*k;
    }

    return ret;
}

signed main(){
    po[0]=1;
    for(int i=1;i<22;i++)po[i]=po[i-1]*10;
    int D;cin>>D;
    int ans=0;
    for(int i=2;i<=18;i++){
        int w;
        if(i&1)w=10;
        else w=1;

        ans+=w*dfs(0,D,i);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
int main() {
  int N; cin >> N;
  vi bar(N);
  int count = 0;
  rep(i,N){int a; cin >> a; bar[i]=a;}
  rep(i,N-2){
    rep2(j,i+1,N-1){
      rep2(k,j+1, N){
        if (bar[k] == bar[i] || bar[k] == bar[j] || bar[i] == bar[j]){
        }
        else if(0 < bar[i] + bar[j] + bar[k] - ( max(max(bar[i],bar[j]),bar[k]))*2 ){
          count++;
        }
      }
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3624
'use strict'

function Main(input) {
    input = input.split("\n")
    const values = input[1].split(' ').map(str => parseInt(str, 10))
    const costs = input[2].split(' ').map(str => parseInt(str, 10))

    const mouke = values.map((v, index) => {
      return v - costs[index]
    }).filter(m => {
      return m > 0
    })

     const result = mouke.reduce((a, b) => {
      return a + b
    }, 0)
    
    console.log(result)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 21192
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N; cin >> N;
  vector<int> MY(N+1);
  for (int i=0;i<N;i++){
    cin >> MY.at(i);
  }
  sort(MY.begin(), MY.end());
  reverse(MY.begin(), MY.end());
  int Alice=0;
  int Bob=0;
  for (int j=0;j<N;j+=2){
    Alice +=MY.at(j);
    Bob +=MY.at(j+1);
  }
  cout << Alice-Bob << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define va first
#define vb second
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;

bool cmp(pll u, pll v){
    return u.va * v.vb == v.va * u.vb ?
                          u.va < v.va :
            u.va * v.vb < v.va * u.vb ;
}
ll S(ll n){
    ll ans = 0;
    for(;n;n/=10LL){
        ans += n % 10;
    }
    return ans;
}
ll f(ll N){
    vector<pll> V({pll(N, S(N))});
    for(ll ten = 10; 10LL * N >= ten; ten *= 10LL){
        ll X = N / ten * ten + ten - 1LL;
        V.emplace_back(X, S(X));
    }
    sort(V.begin(), V.end(), cmp);
    /*
    for(pll &p : V){
        cout << p.va << ' ' << p.vb << '\n';
    }
    cout << '\n';
    */
    return V[0].va;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int K;
    cin >> K;
    ll s = 1;
    for(int i = 0; i < K; i++){
        cout << s << '\n';
        s = f(s+1LL);
    }
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        int year = scn.nextInt();
        int cost = scn.nextInt();
        if(6<=year&&year<=12){
            System.out.println(cost/2);
        }else if(year<6){
            System.out.println(0);
        }else{
            System.out.println(cost);
        }
    }
}

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

int main()
{
	string Card;
	int n = 0, t = 0;

	cin >> Card;

	while (Card != "-") {

		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> t;
			Card = Card.substr(t, Card.size() - t) + Card.substr(0, t);
		}

		cout << Card << endl;

		cin >> Card;
	}

    return 0;
}

Measured memory_bytes: 3144
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int a,b,c,x;
	cin>>a>>b>>c;
	x=a-b;
	x=c-x;
	if(x<0) x=0;
	cout<<x<<endl;
	return 0;
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

int main(){
  int N;
  string A, B, C;
  cin >> N;
  cin >> A >> B >> C;
  int cnt = 0;
  REP(i, N){
    if(A[i] != B[i] && B[i] != C[i] && C[i] != A[i]){
      cnt+= 2;
    }
    else if(A[i] != B[i] || B[i] != C[i] || C[i] != A[i]){
      cnt += 1;
    }
  }
  cout << cnt << endl;
  return 0;
}


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

int main() {
  int n,oc = 0,dc = 0,fo,fd;
  cin >> n;
  rep(i,n){
    int a;
    cin >> a;
    if(a%2 == 0) dc++;
    else oc++;
  }
  fo = oc%2;
  if(fo == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int x, a, b, d = -1, d2 = -1;
    scanf("%d %d %d", &x, &a, &b);
    d = x - a;
    d2 = x - b;
    if (d < 0) {
        d = a - x;
    }
    if (d2 < 0) {
        d2 = b - x;
    }
    d < d2 ? printf("A") : printf("B");
}

Measured memory_bytes: 1608
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	ll n; cin>>n;
	vector<ll> a(n);
	REP(i,n) cin>>a[i];
	vector<ll> V(n);
	REP(i,n){
		V[i]=a[i]+i+1;
	}
	vector<pair<ll,ll>> v(n);
	REP(i,n){
		v[i].first=a[i]-i-1;
		v[i].second=i;
	}
	sort(v.begin(),v.end());
	ll ans=0;
	REP(i,n){
		auto it1=lower_bound(v.begin(),v.end(),pair<ll,ll> (-V[i],-1));
		if(it1==v.end())continue;
		if(it1->first==-V[i]){
			auto it2=upper_bound(v.begin(),v.end(),pair<ll,ll> (-V[i],n+10));
			ans+=it2-it1;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 9596
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	vector<int> h(N + K);
	for (int i = 0; i < N; i++) cin >> h[i];

	vector<int> dp(N + K, INF);
	dp[0] = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 1; j <= K; j++) {

			dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
		}
	}

	cout << dp[N - 1];

	return 0;
}

Measured memory_bytes: 1024
# Panasonic2020 A

k = int(input())

List = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(List[k-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
int main() 
{
    long long h;
    long long ans=1,x=1;
  	cin >> h;
    while(h){
      	h/=2;
        if(h>0){
            x*=2;
            ans+=x;
        }
    }

    cout << ans << endl;
}

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

int main(){
    vector<char> s(3);
    vector<char> t(3);

    for(int i=0;i<3;i++){
        cin >> s.at(i);
    }

    for(int i=0;i<3;i++){
        cin >> t.at(i);
    }

    int res=0;
    for(int i=0;i<3;i++){
        if(s.at(i)==t.at(i))
            res++;
    }
    cout <<res;

    return 0;
}

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

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))


N,M,Q = input_multiple_number()

lists = []

for i in range(Q):
	lis = input_multiple_number_as_list()
	lists.append(lis)

ans = 0
import itertools
for a in itertools.combinations_with_replacement(range(1,M+1),N):
	score = 0
	for _q in lists:
		#a = [i,i2,i3,i4,i5,i6,i7,i8,i9,i10]
		if (a[_q[1]-1]-a[_q[0]-1]) == _q[2]:
			score += _q[3]
	ans = max(ans,score)
										
print(ans)






Measured memory_bytes: 9100
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y= sc.nextInt();
		int r = sc.nextInt();
		if(x<0 || y<0){
			System.out.println("No");
		}else if((x+r)<=W && (y+r)<=H){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 26400
integer N
integer,allocatable,dimension(:)::A
integer cnt4,cnt2,cntodd
read*,N
allocate(A(N))
read*,A
cnt4=0;cnt2=0;cntodd=0
do i=1,N
  select case(mod(A(i),4))
    case(0)
      cnt4=cnt4+1
    case(2)
      cnt2=cnt2+1
    case default 
      cntodd=cntodd+1
  end select
end do
if(cnt2>0)cntodd=cntodd+1
print"(A)",trim(merge("Yes","No ",cntodd<=cnt4+1))
end

Measured memory_bytes: 1152
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  string S;
  int w;
  while (cin >> S >> w) {
    string res = "";
    for (int i = 0; i < S.size(); i += w) {
      res += S[i];
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define pb push_back
#define pu push
#define mp make_pair
#define fi first
#define sc second

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

    int N; cin >> N;
    vi C(N), S(N), F(N);
    rep (i, N - 1) cin >> C[i] >> S[i] >> F[i];

    rep (i, N) {
        int total = 0;
        REP(j, i, N - 1) {
            total = max(total, S[j]);
            if (total % F[j] == 0) total += C[j];
            else total = total + F[j] - total % F[j] + C[j];
        }
        COUT(total);
    }
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    bool ans = false;
    for (int i=0; i<a; i++){
        if ((i*b+c)%a == 0){
            ans = true;
        }
    }
    if (ans){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <queue>
#include<iomanip>
#include <cmath>
#include <set>

#define ABS(x) ((x)>0?(x):-(x))
#define MIN(x,y) ((x)>(y)?(y):(x))

using namespace std;
typedef long long ll;

ll newton(long long int a, long long int  b)
{
	if(a==b)
		return a;
	while(a != 0 && b != 0)
	{
		if(a > b)
		{
			b += a;
			a = b-a;
			b -= a;
		}
		b %= a;
	}
	return a;
}

struct UnionFind {
	vector<int> p;
	UnionFind(int N):p(N)
	{
		for(int i=0; i< N; i++)
		{
			p[i] = i;
		}
	}
	int root(int x)
	{
		if(p[x] == x)
			return x;
		return p[x] = root(p[x]);
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return;
		p[rx] = ry;
	}
	bool issame(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

//大きな数に対する割り算をするとき、MODを指定することで掛け算の値に変換できる

ll div2mul_calc(ll a, ll b, ll m)
{
	if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll d = div2mul_calc(a, b / 2, m);
        return (d * d) % m;
    } else {
        return (a * div2mul_calc(a, b - 1, m)) % m;
    }
}
ll div2mul(ll n, ll mod)
{
	return div2mul_calc(n, mod-2, mod);
}

ll twoRow(ll a, ll b, ll mod)
{
	ll ret = 1;
	for(ll i = 1 ;i <= a+b;++i)
	{
		ret *= i;
		ret %= mod;
	}
	for(ll i = 1 ;i <= a;++i)
	{
		ret *= div2mul(i,mod);
		ret %= mod;
	}
	for(ll i = 1 ;i <= b;++i)
	{
		ret *= div2mul(i,mod);
		ret %= mod;
	}
	return ret;
}



int main()
{
	ll N,M;
	ll i,j,k,p,p2,sz1,sz2;
	vector<int> r[100010];
	int mp[100010] = {0};
	int ed[100010] = {0};
	cin >> N >> M;
	for(i=0;i<N-1;++i)
	{
		cin>>j>>k;
		r[j].push_back(k);
		r[k].push_back(j);
	}
	ll total = 1;
	ll mod   = 1000000007;
	queue<int> q;
	q.push(1);
	while(!q.empty())
	{
		p=q.front();
		q.pop();
		mp[p] = 1;
		k = M;
		//何色選べるかを取得する
		sz1 = r[p].size();
		for(i=0;i<sz1;++i)
		{
			p2 = r[p][i];
			if(mp[p2])
			{
				--k;
			}
			else
			{
				q.push(p2);
			}
			sz2 = r[p2].size();
			k-=ed[p2];
			ed[p2]++;
			/*
			sz2 = r[p2].size();
			for(j=0;j<sz2;++j)
			{
				if(r[p2][j] != p && mp[r[p2][j]])
					--k;
			}
			*/
		}
		if(k <= 0)
		{
			total = 0;
			break;
		}
		total *= k;
		total %= mod;
	}
	cout << total << endl;
	return 0;
}



























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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(int _##i = (t), i = (f); i <  _##i; i++)
#define downto(f, t, i)  for(int _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(int _##i = (t), i = (f); i >  _##i; i--)
typedef long double ld;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
    #define debug true
    #define ln << endl
#else
    #define debug false
    #define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '

using P = pair<int, int>;

int H, W, K;
int dy[] = {0, 1, 0, -1}, dx[] = {1, 0, -1, 0};

bool on_stage(int y, int x) {
    return 0 <= y && y < H && 0 <= x && x < W;
}

signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    cin >> H >> W >> K;
    vector<string> A(H);
    times(H, i) cin >> A[i];

    queue<P> p, q;
    times(H, i) times(W, j) if(A[i][j] == 'S') q.push({i, j});

    int min_goal = 1000;

    map<P, bool> visited;
    times(K+1, i) {
        while(!q.empty()) {
            P z = q.front(); q.pop();
            int y, x; tie(y, x) = z;

            if(visited[z] || A[y][x] == '#') continue;
            visited[z] = true;

            min_goal = min(min_goal, y);
            min_goal = min(min_goal, H-1-y);
            min_goal = min(min_goal, x);
            min_goal = min(min_goal, W-1-x);

            times(4, i) {
                int y0 = y + dy[i], x0 = x + dx[i];
                P z0 = {y0, x0};
                if(on_stage(y0, x0) && !visited[z0]) p.push(z0);
            }
        }
        q = p;
        p = queue<P>();
    }

    if(debug) cout << min_goal ln;
    cout << 1 + (min_goal + K - 1) / K ln;

    return 0;
}


Measured memory_bytes: 41472
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
int main()
{
    long long n;
    char s[4];
    scanf("%s",s);
    if(!strcmp(s,"SSS"))
        cout<<"0"<<endl;
    else if(!strcmp(s,"RRR"))
        cout<<"3"<<endl;
    else if(!strcmp(s,"SRR") || !strcmp(s,"RRS"))
        cout<<"2"<<endl;
    else
        cout<<"1"<<endl;
    return 0;
}

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

int main() {
    vector<char> S(3);
    vector<char> T(3);

    for (int i = 0;i<3;i++) {
        cin >> S.at(i);
    }
    for (int i = 0; i<3; i++) {
        cin >> T.at(i);
    }
    int ans=0;
    if (S.at(0) == T.at(0)) ans++;
    if (S.at(1) == T.at(1)) ans++;
    if (S.at(2) == T.at(2)) ans++;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define foru(i, l, r) for (int i = l; i <= r; i++)
#define ford(i, r, l) for (int i = r; i >= l; i--)

int mod = 1;
void Inc(int &x, int y) { x += y, x -= x >= mod ? mod : 0; }
void Dec(int &x, int y) { x -= y, x += x < 0 ? mod : 0; }
int inc(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
int dec(int x, int y) { return x < y ? x - y + mod : x - y; }
int mul(int x, int y) { return 1LL * x * y % mod; }
int fastpow(int base, int x) {
  int res = 1;
  while (x) {
    if (x & 1) res = mul(res, base);
    base = mul(base, base), x >>= 1;
  }
  return res;
}

const int maxn = 155;
int N, M;

namespace work_1 {
int f[maxn];
void solve() {
  M >>= 1, f[0] = 1;
  foru(i, 1, N) foru(j, max(0, i - M - 1), i - 1) Inc(f[i], f[j]);
  int Ans_1 = 0, Ans_2 = 0;
  foru(i, max(0, (N >> 1) - M), (N >> 1)) Inc(Ans_1, f[i]);
  foru(i, max(0, ((N + 1) >> 1) - M), ((N + 1) >> 1)) Inc(Ans_2, f[i]);
  printf("%d\n", mul(Ans_1, Ans_2));
}
}  // namespace work_1

namespace work_2 {
int f[maxn][maxn][maxn];
void solve() {
  f[0][0][0] = 1;
  foru(i, 1, ((N + M) >> 1)) {
    foru(j, 0, M + 1) foru(k, 0, N) Inc(f[i][0][0], f[i - 1][j][k]);
    if (i + i <= N)
      foru(j, 0, M + 1) foru(k, 0, N) Inc(f[i][0][k + 1], f[i - 1][j][k]);
    if (i + i - M >= 1)
      foru(j, 0, M) foru(k, 0, N) Inc(f[i][j + (j > 0)][0], f[i - 1][j][k]);
    int tmp = 0;
    if (i + i <= N && i + i - M >= 1)
      foru(j, 0, M) foru(k, 0, N) if ((tmp = max(j + 1, k + 2)) <= M + 1)
          Inc(f[i][tmp][k + 1], f[i - 1][j][k]);
  }
  int Ans = 0;
  foru(j, 0, M + 1) foru(k, 0, N) Inc(Ans, f[(N + M) >> 1][j][k]);
  printf("%d\n", Ans);
}
}  // namespace work_2

int main() {
  scanf("%d%d%d", &N, &M, &mod);
  if(M & 1) work_2::solve();
  else work_1::solve();
  return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 2000005
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define vi vector<ll>
#define vp vector<pii>
#define all(v) v.begin(),v.end()
#define lb(v,x) lower_bound(all(v),x)
#define ub(v,x) upper_bound(all(v),x)
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

ll mexp(ll a, ll b){
    ll ans=1;
    a%=MOD;
    while(b){
        if(b&1) ans=ans*a%MOD;
        b>>=1;
        a=a*a%MOD;
    }
    return ans;
}

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

const int N = 3005;

ll dp[N][N];
int dir[N][N];

int main(){
    IOS
    
    string s,t;
    cin>>s>>t;
    int n,m;
    n=sz(s);
    m=sz(t);
    FOR(i,1,n+1){
        FOR(j,1,m+1){
            if(s[i-1]==t[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
                dir[i][j]=3;
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]); 
                if(dp[i-1][j]>dp[i][j-1]){
                    dir[i][j]=2;
                }
                else{
                    dir[i][j]=1;
                }
            }
            
        }
    }
    int i=n,j=m;
    
    string ans="";
    while(i>0 && j>0){
        while(dir[i][j]==1){
            j--;
        }
        while(dir[i][j]==2){
            i--;
        }
        if(dir[i][j]==3){
            ans.pb(s[i-1]);
            i--;
            j--;
        }
    }
    reverse(all(ans));
    cout<<ans;
    cerr<<1.0/CLOCKS_PER_SEC<<endl;
    return 0;
}

Measured memory_bytes: 105984
import java.util.*;
 
 
class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long p = 1;
        long mod = (int)Math.pow(10,9) + 7;

        for(int i=1; i<=n; i++){
            p *= i;
            p = p%mod;
        }
        System.out.println(p);
    }
}

Measured memory_bytes: 21716
#pragma GCC optimize("O3") 

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

typedef long long int           ll;
typedef unsigned long long int  ull;
typedef long double             ld;

typedef pair<int, int>          pii;
typedef pair<ll,ll>             pll;
typedef vector<int>             vi;
typedef vector<ll>              vll;
typedef vector<pii>             vpii;
typedef vector<pll>             vpll;

#define test(t)		        int t; cin >> t; while(t--)
#define f(i, a, b)	        for(int (i) = (a); (i) < (b); ++(i))
#define all(a)		        (a).begin(), (a).end()
#define endl 		        "\n"
#define maxvec(vec)             *max_element(all(vec))
#define minvec(vec)             *min_element(all(vec))
#define maxarr(arr)             *max_element(arr, arr + n)
#define minarr(arr)             *min_element(arr, arr + n)
#define deb(x)		        cout << #x << ": " << x << endl;
#define deb2(x,y)	        cout << #x << ": " << x << " ~ " <<  #y << ": " << y << endl;
#define deba(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n << " "; cout << "]" << endl;
#define debap(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n.first << "-" << n.second << " "; cout << "]" << endl;
#define fast 		        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define mx9		1000000007
#define mx7		10000007
#define mx6		1000006
#define mx5		200005
#define inf		1<<30                                 
#define eps		1e-9
#define mod		1000000007
#define PI		3.141592653589793238462643383279502884L

void solve()
{
    ll n, x, t;
    cin >> n >> x >> t;
    cout << t * ((n / x) + (n % x != 0)) << endl;
}

int main()
{
    fast;
    // test(t)
        solve();
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
using namespace std;
int main() {
	int N, M, rinnji;
	int c[5];
	int s[5];
	int ans[5];
	ans[0] = -1;
	ans[1] = -1;
	ans[2] = -1;
	ans[3] = -1;
	ans[4] = -1;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> s[i] >> c[i];
	}
	for (int j = 0; j < M; j++) {
		rinnji = ans[s[j] - 1];
		ans[s[j] - 1] = c[j];
		if ((rinnji != -1) && (ans[s[j] - 1] != rinnji)) {
			cout << -1 << endl;
			return 0;
		}
	}
	if (ans[0] == -1) {
		if (N == 1) {
			ans[0] = 0;
		}
		else {
			ans[0] = 1;
		}
	}
	if (ans[1] == -1) {
		ans[1] = 0;
	}
	if (ans[2] == -1) {
		ans[2] = 0;
	}
	if (ans[3] == -1) {
		ans[3] = 0;
	}
	if (ans[4] == -1) {
		ans[4] = 0;
	}
	if ((ans[0] == 0)&&(N!=1)) {
		cout << -1 << endl;
		return 0;
	}
	for (int k = 0; k < N; k++) {
		cout << ans[k];
	}
	cout << endl;
}

Measured memory_bytes: 256
L = list(input())
dp = [[0, 0] for _ in range(len(L))]
dp[0][0] = 2
dp[0][1] = 1

for i in range(len(L)-1):
  if L[i+1] == "1":
    dp[i+1][0] = dp[i][0] * 2
    dp[i+1][1] = dp[i][0] + dp[i][1] * 3
  else:
    dp[i+1][0] = dp[i][0]
    dp[i+1][1] = dp[i][1] * 3
  if i%1000 == 0:
    dp[i+1][0] %= 1000000007
    dp[i+1][1] %= 1000000007
print((dp[len(L)-1][0]+dp[len(L)-1][1])%1000000007)

Measured memory_bytes: 38436
#include <iostream>

using namespace std;

int main(void)
{
    int a, b, c;
    int tmp;
    
    cin >> a >> b >> c;
    
    if (a > b)
    {
        tmp = a;
        a = b;
        b = tmp;
    }
    if (b > c)
    {
        tmp = b;
        b = c;
        c = tmp;
    }
    if (a > b)
    {
        tmp = a;
        a = b;
        b = tmp;
    }
    
    cout << a << " " << b << " " << c << endl;
    
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, D;
	cin >> N >> D;
	vector<pair<int,int> > A(N);
	vector<vector<int> > C(D, vector<int>(D, 0));
	for (int i = 0; i < N; i++) {
		cin >> A[i].first >> A[i].second;
		C[A[i].first % D][A[i].second % D]++;
	}
	int ok = 1e7;
	int ng = 0;
	int m;
	vector<vector<int> > X(2 * D + 1, vector<int>(2 * D + 1, 0));
	int vcnt = 0;
	int t;
	while (ok - ng > 1) {
		m = (ok + ng) / 2;
		bool f = false;
		int div = (m + 1) / D;
		int bd = (m + 1) % D;
		for (int i = 0; i < X.size(); i++) {
			for (int j = 0; j < X.size(); j++) {
				X[i][j] = 0;
			}
		}
		bool bk = false;
		for (int i = 0; i < D; i++) {
			for (int j = 0; j < D; j++) {
				if (C[i][j] <= div*div) {

				}
				else if (C[i][j] <= (div + 1) * div) {
					X[i + bd][j + bd]++;
					X[i + D][j + bd]--;
					X[i + bd][j + D]--;
					X[i + D][j + D]++;
				}
				else if (C[i][j] <= (div + 1) * (div + 1)) {
					X[i][j]++;
					X[i + D][j]--;
					X[i][j + D]--;
					X[i + D][j + D]++;

					X[i][j]--;
					X[i + bd][j]++;
					X[i][j + bd]++;
					X[i + bd][j + bd]--;
				}
				else {
					bk = true;
					break;
				}
			}
			if (bk)break;
		}
		if (!bk) {
			for (int i = 0; i < 2 * D; i++) {
				for (int j = 0; j < 2 * D; j++) {
					if (i > 0)X[i][j] += X[i - 1][j];
					if (j > 0)X[i][j] += X[i][j - 1];
					if (i > 0 && j > 0)X[i][j] -= X[i - 1][j - 1];
				}
			}
			//t = 0;
			for (int i = 0; i < D; i++) {
				for (int j = 0; j < D; j++) {
					if (X[i][j] + X[i + D][j] + X[i][j + D] + X[i + D][j + D] == 0) {
						f = true;
						//t++;
					}
				}
			}
		}
		if (f) {
			ok = m;
			//vcnt = t;
		}
		else {
			ng = m;
		}
	}
	//cerr << vcnt << endl;
	cout << ok << endl;
}

Measured memory_bytes: 41088
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }




int a, b, h;
int main() {
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
}
































Measured memory_bytes: 256
def main2():
    x = int(input())
    r, m = divmod(x, 100)
    x -= r * 100

    count = 0

    while(x > 0):
        if x >= 5:
            x -= 5
            count += 1
        elif x >= 4:
            x -= 4
            count += 1
        elif x >= 3:
            x -= 3
            count += 1
        elif x >= 2:
            x -= 2
            count += 1
        elif x >= 1:
            x -= 1
            count += 1

    if r >= count:
        print(1)
    else:
        print(0)

if __name__ == "__main__":
    main2()

Measured memory_bytes: 9156
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	counter := make(map[rune]int)

	for _, c := range s {
		counter[c] += 1
	}

	if counter['a'] == 1 && counter['b'] == 1 && counter['c'] == 1 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#!/usr/bin/env python3

def main():
    (N, M) = map(int, input().split())
    if N >= M:
        (N, M) = (M, N)
    if N == 1:
        if M == 1:
            print(1)
        else:
            print(M-2)
    else:
        print((N-2) * (M-2))
    

main()


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

int main(void){
    int n;
    cin >> n;
    vector<int> a;
    for(int i = 0; i < n; ++i){
        int num;
        cin >> num;
        a.push_back(num);
    }
    sort(a.begin(), a.end());

    int maxnum = 0;
    for(int x = 0; x < 100000; ++x){
        int left = 0, right = n;
        while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] < x-1) left = mid + 1;
            else right = mid;
        }
        int lleft = left;
        left = lleft;
        right = n;
        while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] > x+1) right = mid;
            else left = mid + 1;
        }
        int res = left - lleft;
        maxnum = max(res, maxnum);
    }
    cout << maxnum << endl;
    return 0;
}

Measured memory_bytes: 892
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let s: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

    let mut i = 0;
    let mut j = s.len() - 1;
    let mut res = 0;
    while i < j && (s[i] == s[j] || s[i] == 'x' || s[j] == 'x') {
        if s[i] == s[j] {
            i += 1;
            j -= 1;
        } else if s[i] == 'x' {
            i += 1;
            res += 1;
        } else if s[j] == 'x' {
            j -= 1;
            res += 1;
        }
    }
    let ans = if i < j { -1 } else { res };

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

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

#include <math.h>
#include <stdlib.h>


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

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int k; cin >> k;
    set<ll> st;
    set<ll> stcp;
    int cnt = 0;

    for(ll i = 1; i < 10;i++) {
        st.insert(i);
        cnt++;
    }

    stcp = st;
    while(cnt < 100000){
        set<ll> stcp2;
        for(ll l : stcp){
            ll r = l%10;
            st.insert(l*10 +r);
            stcp2.insert(l*10+r);
            cnt++;
            if(r!=0) {
                st.insert(l*10+r-1);
                stcp2.insert(l*10+r-1);
                cnt++;
            }
            if(r!=9) {
                st.insert(l*10+r+1);
                stcp2.insert(l*10+r+1);
                cnt++;
            }
        }
        stcp = stcp2;
    }

    auto itr = st.begin();
    for(ll i = 0; i< k-1; i++) itr++;
    cout << *itr << endl;
    return 0;
}


Measured memory_bytes: 21888
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
#define EN cout<<endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;

ll gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
    string n;bool f=1;
    cin>>n;
    if(n[0]!='7'&&n[1]!='7'&&n[2]!='7')cout<<"No";
    else cout<<"Yes";
    EN;
    
}


Measured memory_bytes: 3628