akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(v) for(int k=head[v];k;k=e[k].ne)
//#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef pair<int,int> pa;
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
const int N=(1<<15)+5,M=2e6+5,INF=1e9,mod=1e9+7;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("f.in","r",stdin);
	freopen("my.out","w",stdout);}
il void gen(){freopen("data.in","w",stdout);}
int n,m,bin[30]={1};
int f[N],bc[N],g[N];
#define pw(a) (1<<(a))
int main(){
	read(n,m);
	rep(i,1,pw(n))bc[i]=bc[i>>1]+(i&1);
	rep(i,1,m){int x,y;read(x,y);x--;y--;g[x]|=pw(y);}
	f[0]=1;
	re(S,1,pw(n))if((S&1)==((S>>1)&1)){
		for(int T=S;T;T=(T-1)&S)if((T&1)==((T>>1)&1)){
			ll t=1;
			re(i,0,n)if(pw(i)&S){
				if(pw(i)&T)t=t*pw(bc[g[i]&(S^T)])%mod;
				else t=t*(pw(bc[g[i]&T])-1)%mod;
			}
			(f[S]+=t*f[S^T]%mod)%=mod;
		}
	}
	cout<<(qpow(2,m,mod)-f[pw(n)-1]+mod)%mod;
}

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

using namespace std;

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

    int N, K;
    cin >> N >> K;
    int res = 0;
    for (int i = 0; i < N; ++i) {
        int h;
        cin >> h;
        res += (h >= K);
    }
    cout << res << "\n";
    
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let h = read::<usize>();
    let w = read::<usize>();
    let mut board = vec![vec![0; w]; h];
    for y in 0..h {
        for x in 0..w {
            board[y][x] = read::<usize>();
        }
    }
    let mut anss = vec![];
    for y in 0..h {
        for x in 0..w {
            if board[y][x] % 2 == 0 {
                continue;
            }
            if x != w - 1 {
                anss.push((y, x, y, x + 1));
                board[y][x] -= 1;
                board[y][x + 1] += 1;
            } else if y != h - 1 {
                anss.push((y, x, y + 1, x));
                board[y][x] -= 1;
                board[y + 1][x] += 1;
            }
        }
    }
    println!("{}", anss.len());
    for &(y, x, ny, nx) in anss.iter() {
        println!("{} {} {} {}", y + 1, x + 1, ny + 1, nx + 1);
    }
}


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

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

int main() {
    int n;cin>>n;
    int a[n];
    int ans = 0;
    
    rep(i,n){
        cin>>a[i];
        if(a[i]%2==1 && (i+1)%2==1)++ans;
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define MOD 998244353

using namespace std;
using ll = long long;

int main() {
	int k;
	string s;
	cin >> k >> s;
	if (k >= s.size()) cout << s;
	else {
		rep(i,k) cout << s[i];
		cout << "...";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3596
import std.stdio;
import std.conv;
import std.string;
import std.array;
import std.algorithm;
void main(){
  int n;
  while(n=to!int(chomp(readln())),n){
    int[] arr=[];
    for(int i=0;i<n;++i) arr~=to!int(chomp(readln()));
    sort(arr);
    int target=to!int(chomp(readln()));
    int b=0,e=n-1,ans=0;
    while(b<=e){
      ++ans;
      if(arr[(e+b)/2]==target) break;
      else{
        if(arr[(e+b)/2]<target) b=(e+b)/2+1;
        else e=(e+b)/2-1;
      }
    }
    writeln(ans);
  }
}

Measured memory_bytes: 1056
A,V = list(map(int, input().split()))
B, W = list(map(int, input().split()))
T = int(input())
 
  
if A < B:
  if (A + V*T) >= (B + W*T):
    print("YES")
  else:
    print("NO")
elif A > B:
  if (A - V*T) <= (B - W*T):
    print("YES")
  else:
    print("NO")

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

int main(){
  int N;
  long long sum=1;
  cin >> N;
  vector<long long>A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  bool a=false;
  for(int i=0;i<N;i++){
    if(A.at(i)==0){
      cout << 0 << endl;
      a=true;
      break;
    }
    else if((long long)pow(10,18)/sum>=A.at(i)){
      sum*=A.at(i);
    }
    else{
      cout << -1 << endl;
      a=true;
      break;
    }
  }
  if(!a){
    cout << sum << endl;
  }
}

Measured memory_bytes: 3972
#include <iostream>
//#include <set>
//#include <map>
#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007
#define MAX 100100
//#define NIL -1

int main() {
    double l;
    double ans;

    cin >> l;
    ans = (l/3)*(l/3)*(l/3);

    cout << setprecision(20) << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args) {       
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int k = stdIn.nextInt();
        double ans = 0;
        for(int i = 1; i <= n ; i++){
            double p = 1;
            int x = i;
            while(x < k){
                p /= 2;
                x *= 2;
            }
            ans += p/n;
        }
        System.out.println(ans);
   }
}


Measured memory_bytes: 23764
#include<cstdio>
#include<cctype>
#include<algorithm>
#include<cstring>
#include<vector>
//#include<ctime>
#define rg register
typedef long long ll;
template <typename T> inline T max(const T a,const T b){return a>b?a:b;}
template <typename T> inline T min(const T a,const T b){return a<b?a:b;}
template <typename T> inline void mind(T&a,const T b){a=a<b?a:b;}
template <typename T> inline void maxd(T&a,const T b){a=a>b?a:b;}
template <typename T> inline T abs(const T a){return a>0?a:-a;}
template <typename T> inline void swap(T&a,T&b){T c=a;a=b;b=c;}
//template <typename T> inline void swap(T*a,T*b){T c=a;a=b;b=c;}
template <typename T> inline T gcd(const T a,const T b){if(!b)return a;return gcd(b,a%b);}
template <typename T> inline T lcm(const T a,const T b){return a/gcd(a,b)*b;}
template <typename T> inline T square(const T x){return x*x;};
template <typename T> inline void read(T&x)
{
	char cu=getchar();x=0;bool fla=0;
	while(!isdigit(cu)){if(cu=='-')fla=1;cu=getchar();}
	while(isdigit(cu))x=x*10+cu-'0',cu=getchar();
	if(fla)x=-x;
}
template <typename T> inline void printe(const T x)
{
	if(x>=10)printe(x/10);
	putchar(x%10+'0');
}
template <typename T> inline void print(const T x)
{
	if(x<0)putchar('-'),printe(-x);
	else printe(x);
}
const int maxn=101,maxm=501;
int n,m;
int head[maxn],nxt[maxm],tow[maxm],tmp=1;
inline void addb(const int u,const int v)
{
	tmp++;
	nxt[tmp]=head[u];
	head[u]=tmp;
	tow[tmp]=v;
}
int limita[21],limitb[21],limit[101];
ll ans;
int fa[101],dep[101];
void dfs(const int u)
{
	for(rg int i=head[u];i;i=nxt[i])
	{
		const int v=tow[i];
		if(v==fa[u])continue;
		fa[v]=u,dep[v]=dep[u]+1;
		dfs(v);
	}
}
ll res;
void add(int u,int v)
{
	while(u!=v)
	{
		if(dep[u]<dep[v])
		{
			int c=v;v=u;u=c;
		}
		res=res+1-limit[u];
		limit[u]=1;
		u=fa[u];
	}
}
int main()
{
	read(n);
	for(rg int i=1;i<n;i++)
	{
		int u,v;read(u),read(v);
		addb(u,v),addb(v,u);
	}
	dfs(1);
	read(m);
	for(rg int i=0;i<m;i++)read(limita[i]),read(limitb[i]);
	for(rg int i=0;i<(1<<(m));i++)
	{
		int ct=0;res=0;
		for(rg int i=1;i<=n;i++)limit[i]=0; 
		for(rg int j=0;j<m;j++)
		{
			if(i&(1<<j))ct++,add(limita[j],limitb[j]);
		}
		res=1ll<<(n-1-res);
		if(ct&1)ans-=res;
		else ans+=res;
	}
	print(ans); 
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<lint>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n;
    cin >> n;
    vec a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];

    vector<P> x(n), y(n);
    rep(i, n) {
        x[i] = make_pair(b[i], a[i]);
        y[i] = make_pair(a[i], b[i]);
    }

    sort(all(x));
    sort(all(y));

    lint res = 0;

    if (n % 2 == 1) {
        int cent = n/2;
        res = x[cent].first - y[cent].first + 1;
    }
    else {
        int r = n/2;
        int l = r-1;
        int mi = y[l].first + y[r].first;
        int mx = x[l].first + x[r].first;
        res = mx - mi + 1;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 9504
<?php

fscanf(STDIN, "%s", $S);
fscanf(STDIN, "%d", $K);
$n = strlen($S);

$ss = [];

// Kが5までなので全列挙する
for ($i = 0; $i < $K; $i++) {
    // しゃくとりの幅はi+1

    $str = '';
    $r = 0;
    for ($l = 0; $l < $n; $l++) {
        while ($r < $n && $r - $l < $i + 1) {
            $str .= $S[$r];
            ++$r;
        }

        if ($r - $l < $i + 1) break;

        $ss[] = $str;

        $str = substr($str, 1);
    }
}

$ss = array_unique($ss);
sort($ss);

echo $ss[$K - 1], PHP_EOL;


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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; }

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



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,k; cin>>n>>k;
  vector<double> s(n+1);
  rep(i,n){
    ll p; cin>>p;
    double x=((1+p)*p/2)*1.0/p;
    s[i+1]=x+s[i];
  }
  double ans=0;
  rep(i,n-k+1){
    chmax(ans,s[i+k]-s[i]);
  }
  coutd(ans);
}

Measured memory_bytes: 1792
n, m, l = list(map(int, input().split()))

a = [[0 for j in range(m)] for i in range(n)]
for i in range(n):
    a[i] = list(map(int, input().split()))

b = [[0 for j in range(l)] for i in range(m)]
for i in range(m):
    b[i] = list(map(int, input().split()))

c = [[0 for j in range(l)] for i in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j] += a[i][k] * b[k][j]

for i in range(len(c)):
    print(*c[i])



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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl "\n"
#define eb emplace_back
#define pb push_back
#define mk make_pair
#define mt make_tuple
#define graph vector<vector<int>>
#define INF 1e9+5
#define N 40001


bool sortbysec(const tuple<int, int, int>& a,  
               const tuple<int, int, int>& b) 
{ 
    return (get<1>(a) < get<1>(b)); 
}
void dfs(int s, graph &g, bool vis[]){
	vis[s] = true;
	for(int i=0;i<g[s].size();i++){
		if(!vis[g[s][i]]) dfs(g[s][i],g,vis);
	}
}

string common_prefix(vector<string>& strings){
	string prefix;
	for(string s : strings){
		for(int i=0;i<s.size() && s[i]!='*';++i){
			if(i<prefix.size()){
				if(s[i]!=prefix[i]) return "*";
			}
			else prefix+=s[i];
		}
	}
	return prefix;
}

void reverse(vector<string>& strings){
	for(string& s : strings){
		reverse(s.begin(),s.end());
	}
}


void solve(){
	int n,k; cin>>n>>k;
	vector<int>h(n);
	for(int& x : h) cin>>x;

	vector<int>dp(n,INF);

	dp[0] = 0;


	for(int i=0;i<n;i++){
		for(int j=i+1;j<=i+k;j++){
			if(j<n) dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]));
		}
	}
	cout<<dp[n-1]<<endl;

}

int main() {
IOS;
	int t=1; 
	// cin>>t;
	for(int i=1;i<=t;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
}

Measured memory_bytes: 1024
n,k=map(int,input().split())
x=list(map(int,input().split()))
min_len=1e9
for i in range(n-k+1):
    min_len = min(min_len,x[i+k-1]-x[i]+min(abs(x[i]),abs(x[i+k-1])))
print(min_len)

Measured memory_bytes: 14384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
ll n,k;
static vector<ll>a((ll)3e5);
bool isOK(ll x){
    ll c=0;
    rep(0,i,n){
        c+=(a[i]+x-1)/x-1;
        if(c>k){
            return false; 
        }
        //cout<<c<<endl;
    }
    return true;
}
int main(void){
    cin>>n>>k;
    rep(0,i,n)cin>>a[i];
    //rep(0,i,n)cout<<a[i]<<endl;
    ll ng=1,ok=2e9;
    if(isOK(1)){
        cout<<1;
        return 0;
    }
    while(abs(ok-ng)>1){
        ll mid=(ng+ok)/2;
        if(isOK(mid))ok=mid;
        else ng=mid;
        //cout<<mid<<endl;
    }
    cout<<ok;
}

Measured memory_bytes: 5476
n,s=map(int,input().split())
now=[0]*(s+1)
mod1,mod2=10**9+7,998244353
mod=mod2

ans=0
for a in map(int,input().split()) :
    
    now[0]+=1
    for i in range(s,-1,-1):
        now[i]=(now[i]+(0 if i<a else now[i-a]))%mod
    ans=(ans+now[-1])%mod

print(ans)

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const int INF=1000000001;

bool cmp(int a,int b){
	if(a==1) a+=INF;
	if(b==1) b+=INF;
	return a<b;
}

int main(){
	int n; scanf("%d",&n);
	int a[100],zero=0;
	rep(i,n){
		scanf("%d",a+i);
		if(a[i]==0) zero++, i--, n--;
	}

	if(n==0){
		rep(i,zero) puts("0");
		return 0;
	}

	int mini=*min_element(a,a+n);
	int maxi=*max_element(a,a+n);
	int one=count(a,a+n,1);
	int three=count(a,a+n,3);
	if(zero%2==1){
		if(one<=1){
			int i0=find(a,a+n,mini)-a;
			swap(a[i0],a[n-1]);
			sort(a,a+n-1,cmp);
			// 2^3 < 3^2 の例外処理
			if(maxi==3 && three==1) for(int i=n-1;i>=0;i--) if(i>0 && a[i-1]==2 && a[i]==3) { swap(a[i],a[i-1]); break; }
			rep(i,n-1) printf("%d\n",a[i]);
			rep(i,zero-1) puts("0");
			printf("%d\n0\n",mini);
		}
		else{
			sort(a,a+n,cmp);
			if(maxi==3 && three==1) for(int i=n-1;i>=0;i--) if(i>0 && a[i-1]==2 && a[i]==3) { swap(a[i],a[i-1]); break; }
			rep(i,n){
				if(a[i]==1) break;
				printf("%d\n",a[i]);
			}
			rep(i,zero-1) puts("0");
			puts("1\n0");
			rep(i,one-1) puts("1");
		}
	}
	else{
		sort(a,a+n,cmp);
		if(maxi==3 && three==1) for(int i=n-1;i>=0;i--) if(i>0 && a[i-1]==2 && a[i]==3) { swap(a[i],a[i-1]); break; }
		if(one==0){
			rep(i,n) printf("%d\n",a[i]);
			rep(i,zero) puts("0");
		}
		else{
			rep(i,n){
				if(a[i]==1 && (i==0 || a[i-1]!=1)) rep(i,zero) puts("0");
				printf("%d\n",a[i]);
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1060
/*Allah Vorosha*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define n_p next_permutation
#define p_p prev_permutation
#define in insert
#define rev reverse
#define pf push_front
#define pob pop_back
#define uniq(v)         v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define all(x) (x).begin(),(x).end()
#define pof pop_front
#define ios ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define scn scanf
#define prt printf
#define rep(i, a, n) for(int i = a; i < n; i++)
#define mod 1000000007
#define yes cout << "YES\n"
#define no cout << "NO\n";
#define take for(auto &it : a) cin >> it;
#define out cout << a << "\n";
#define l_b lower_bound
#define u_b upper_bound
#define Max 100005
template<typename T> T mymax(T x, T y) {
    return (x > y ? x : y);
}

using namespace std;

const int N = 1e6 + 5;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    for(int i = 0; i < n - 2; i++) {
        if(a[i] == b[i]) {
            bool ok = 1;
            for(int j = i + 1; j <= i + 2; j++) {
                if(a[j] != b[j]) {
                    ok = 0; break;
                }
            }
            if(ok) {
                cout << "Yes\n"; return;
            }
        }
    }
    cout << "No\n";
    return;
}

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


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using ull = unsigned long long;
struct Product {
  ull w, v;
};
//bool operator<(const Product& l, const Product& r) {
//  l.v > r.v;
//}

int main(int argc, char** argv) {
  ull N, W;
  std::cin >> N >> W;
  std::vector<Product> P(N);
  for (auto i = 0;i < N;++i) std::cin >> P[i].w >> P[i].v;

  ull max_value {};
  for (auto i = 0;i < N;++i) max_value += P[i].v;

  std::vector<std::vector<ull>> dp(N, std::vector<ull>(max_value+1, W+1));
  dp[0][0] = 0;
  dp[0][P[0].v] = P[0].w;
  for (auto i = 1;i < N;++i) {
    for (auto j = 0;j <= max_value;++j) {
      dp[i][j] = dp[i-1][j];
    }
    for (auto j = 0;j <= max_value;++j) {
      if (j + P[i].v > max_value) break;
      dp[i][j+P[i].v] = std::min(dp[i-1][j+P[i].v], dp[i-1][j] + P[i].w);
    }
  }
  ull answer {};
//  for (const auto& e : dp) {
//    for (const auto& f : e) {
//      std::cout << f << ' ';
//    }
//    std::cout << '\n';
//  }
  for (auto i = 0;i <= max_value;++i) {
    if (dp[N-1][i] <= W) answer = i;
  }
  std::cout << answer << '\n';
}


Measured memory_bytes: 79488
#include<bits/stdc++.h>
using namespace std;
int a[5][105],n,b[5][105];
 
int main(){
	cin>>n;
	for(int i=1; i<=n; i++)cin>>a[1][i];
	for(int i=1; i<=n; i++)cin>>a[2][i];
	b[1][1]=a[1][1];
	
	for(int i=1; i<=2; i++){
		for(int j=1; j<=n; j++){
			if(i==1 and j==1)continue;
			b[i][j]=max(max(b[i][j],b[i-1][j]+a[i][j]),b[i][j-1]+a[i][j]);
		}
	}
	cout<<b[2][n]<<endl;
}

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



using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 998244353;



int main() {


	int a, b;
	cin >> a >> b;
	cout << 6 - a - b << endl;







}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <utility>
#include <map>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;


int main()
{
    int n;
    cin>>n;
    vector<int> b(n-1);
    for(int i=0;i<n-1;i++)
        cin>>b[i];
    vector<int> a(n);
    a[0]=b[0];
    a[n-1]=b[n-2];
    for(int i=1;i<n-1;i++)
    {
        if(b[i-1]>=b[i])
            a[i]=b[i];
        else
            a[i]=b[i-1];
    }
        //a[i]=min(b[i-1],b[i+1]);
    int sum=0;
    for(int i=0;i<n;i++)
        sum+=a[i];
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int N, A, B, C, D;
    string S;
    cin >> N >> A >> B >> C >> D >> S;
    
    S = "#" + S + "#";

    auto can_reach = [&](int start, int end) {
        for (int i = start; i + 1 <= end; i++) {
            if (S[i] == '#' && S[i + 1] == '#') return false;
        }
        return true;
    };

    if (!can_reach(A, C) || !can_reach(B, D)) {
        cout << "No" << endl;
        return 0;
    }

    if (C > D) {
        bool snuke_can_over = false;
        for (int i = B; i <= D; i++) {
            if (S[i - 1] == '.' && S[i] == '.' && S[i + 1] == '.') {
                snuke_can_over = true;
            }
        }
        if (!snuke_can_over) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


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

int alp[26]={0};
int main(){
  string w; cin>>w;

  for(int i=0;i<w.length();i++){
    alp[w[i]-'a']++;
  }
  for(int i=0;i<26;i++){
    if(alp[i]%2!=0){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
A, B, K = map(int, input().split())

S1 = [i for i in range(A, min(A + K, B + 1))]
S2 = [i for i in range(max(A, B - K + 1),B + 1)]
S = list(set(S1 + S2))
S.sort()

for i in range(len(S)):
	print(S[i])


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

int main() {
  int a,b;
  cin >> a >> b;
  if (a>b) {
    for (int i=0; i<a; i++) {
      cout << b;
    }
    cout << endl;
  }
  else {
    for (int i=0; i<b; i++) {
      cout << a;
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 1; i <= (n); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
typedef long long ll;


ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

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

  string ans = ((a == b && b != c) ||
             (b == c && c != a) ||
             (c == a && a != b)) ? "Yes" : "No";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* 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, 0> { using type = 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...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream cin("in.txt");
#endif
  int N, M, C;
  while (cin >> N >> M >> C) {
    vector<int> B(M);
    for (int& x : B) cin >> x;
    int res = 0;
    for (int i = 0; i < N; i++) {
      int sum = C;
      for (int j = 0; j < M; j++) {
        int x;
        cin >> x;
        sum += B[j] * x;
      }
      if (sum > 0) ++res;
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n, w = map(int, input().split())
vw = [[int(i) for i in input().split()] for _ in range(n)]
dp = [[-1 for _ in range(w + 1)] for _ in range(n + 1)]
for i in range(w + 1):
    dp[0][i] = 0
for i in range(n):
    for j in range(w + 1):
        if vw[i][1] > j:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - vw[i][1]] + vw[i][0])
print(dp[n][w])



Measured memory_bytes: 16144
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>

#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007

using namespace std;


void solve()
{
    int N;
    cin >> N;
    set<string> S;
    while (N--)
    {
        string s;
        cin >> s;
        S.insert(s);
    }

    cout << S.size();
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    // cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 19268
#include <bits/stdc++.h>
using namespace std;
#define F(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef long long ll;
#define mod 1000000007
int main()
{	
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int w=1;
	// cin>>w;
	while(w--){
		int n,W;
		cin>>n>>W;
		vector<pi> v;
		F(i,0,n){
			int a,b;
			cin>>a>>b;
			v.pb(make_pair(a,b));
		}
		long long arr[n+1][W+1];
		memset(arr,0,sizeof(arr));
		F(i,0,W+1)arr[0][i]=0;
		F(i,1,n+1)arr[i][0]=0;
		F(i,1,n+1){
			F(j,1,W+1){
				if(j-v[i-1].first>=0){
					arr[i][j]=max(arr[i-1][j-v[i-1].first]+v[i-1].second,arr[i-1][j]);
				}
				else {
					arr[i][j]=arr[i-1][j];
				}
			}
		}
		cout<<arr[n][W];
	}
}

Measured memory_bytes: 82380
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	long long a, b, c;
	cin >> a >> b >> c;
	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
		cout << 0 << endl;
		return 0;
	}
	cout << min(a * b, min(b * c, a * c)) << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
readlines = sys.stdin.readlines
write = sys.stdout.write
def solve():
    EPS = 1e-9
    for line in readlines():
        s, w, h = line.split(",")
        w = float(w); h = float(h)
        if w > 25*h*h - EPS:
            write("%s\n" % s)
solve()



Measured memory_bytes: 5584
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 3010
using namespace std;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n;
int a[maxn];
int head[maxn],to[maxn*2],nxt[maxn*2],tot;
void add(int u,int v)
{
    tot++;
    nxt[tot]=head[u];
    head[u]=tot;
    to[tot]=v;
}
int dfs(int x,int las)
{
    int res=0;
    for(int i=head[x];i;i=nxt[i])
    {
        if(to[i]==las)  continue;
        if(a[to[i]]>=a[x])  continue;
        res|=(dfs(to[i],x)^1);
    }    
    return res;
}
int main()
{
    n=read();
    for(int i=1;i<=n;i++)  a[i]=read();
    for(int i=1;i<n;i++)
    {
        int q=read(),w=read();
        add(q,w);
        add(w,q);
    }
    for(int i=1;i<=n;i++)
      if(dfs(i,0))  printf("%d ",i);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int count(int n)
{
    int x[5];
    int i=0;
    int sum=0;
    while(n>0){
        x[i]=n%10;
        n/=10;
        i++;
    }
    if(x[0]==x[4] && x[1]==x[3]) sum++;
    return sum;
}
int main(void)
{
    int A, B;
    int sum=0;
    scanf("%d%d", &A, &B);
    for(int i=A;i<=B;i++){
        sum+=count(i);
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);
    int N;
    cin >> N;
    vector<vector<int>> c(10,vector<int>(10));
    for(int i=1;i<=N;i++){
        string t = to_string(i);
        int left = t[0] - '0';
        int right = i%10;//iの末尾の数
        c[left][right]++;
    }
    ll ans = 0;
    for(int i=1;i<=9;i++)for(int j=1;j<=9;j++){
        ans += c[i][j]*c[j][i];
    }
    cout << ans << endl;
}

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

int main(){
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  long long kotae=a*x+b*y;
  for(int i=0;i<=max(x,y);i++){
    long long atai=a*max(0,x-i)+b*max(0,y-i)+c*max(2*i,0);
    if(kotae>atai)kotae=atai;
  }
  cout<<kotae<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Runtime.ExceptionServices;
using System.Runtime.Intrinsics.X86;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var zorome_count = 0;
            var Ans = "No";
            for (int i = 0; i < N; i++)
            {
                var D = ReadInts();
                if (D[0] == D[1]) zorome_count++;
                else zorome_count = 0;

                if (zorome_count >= 3)
                {
                    Ans = "Yes";
                }
            }
            WriteLine(Ans);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 27508
#include<iostream>
#include<algorithm>
long long i,j,n,x,m=1000000007,s[200],d[100001];
main(){std::cin>>n>>x;for(i=0;i!=n;++i)std::cin>>s[i];std::sort(s,s+n);for(i=0;i<=x;++i)d[i]=i;for(i=0;i!=n;++i){for(j=x;j;--j)d[j]=(d[j]*i+d[j%s[i]])%m;}std::cout<<d[x];}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll N, M;
vector<ll> g[MAX];
ll used[MAX];

void dfs(ll s) {
    used[s]=1;
    
    ll i, u;
    for(i=0; i<g[s].size(); i++) {
        u=g[s][i];
        if(used[u]) continue;
        dfs(u);
    }
    
}

int main(void) {
    cin >> N >> M;
    ll i, j;
    vector<ll> Lan[MAX];
    
    for(i=0; i<N; i++) {
        ll K;
        cin >> K;
        for(j=0; j<K; j++) {
            ll l;
            cin >> l;
            l--;
            Lan[l].pb(i);
        }
    }
    
    for(i=0; i<M; i++) {
        if(Lan[i].size()<=1) continue;
        
        for(j=0; j<Lan[i].size()-1; j++) {
            ll u=Lan[i][j];
            ll v=Lan[i][j+1];
            g[u].pb(v);
            g[v].pb(u);
        }
    }
    
    dfs(0);
    for(i=0; i<N; i++) {
        if(!used[i]) {
            pt("NO");
            return 0;
        }
    }
    pt("YES");
    
}





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

#define FOR(i, n) for(int i = 0; i < n; i++) 

#define pow CHANGETHENAMESTUPID

using namespace std;

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

void load() {
	int x;
	scanf("%d", &x);
	int a500 = x / 500;
	int a5 = (x % 500) / 5;
	printf("%lld\n", (ll)a500 * 1000 + (ll)a5 * 5);
}

void solve() {

}

int main() {
	load();
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int n;
  int sum=0,num;

  cin >>n;
  num=n;

  while(num>0){
    sum+=(num%10);
    num/=10;
  }
  if(n%sum==0) cout<<"Yes"<<endl;
  else cout <<"No"<<endl;

  return 0;
}


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

int main(){
    string s;
    cin >> s;
    int c = 0;
    rep(i, 0, 3){
        if(s[i] == 'A') c++;
    }
    if(c%3 != 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    for (int i = 1; ; i++) {
      int w = sc.nextInt();
      if (w == 0) {
        break;
      }
      int n = sc.nextInt();
      int[][] treasure = new int[n][2];
      for (int j = 0; j < n; j++) {
        String str = sc.next();
        String[] strArr = str.split(",");
        treasure[j][0] = Integer.parseInt(strArr[0]);
        treasure[j][1] = Integer.parseInt(strArr[1]);
      }
      int value[][] = new int[n+1][w+1];
      int weight[][] = new int[n+1][w+1];
      for (int j = 1; j < n+1; j++) {
        for (int k = 1; k < w+1; k++) {
          if (k >= treasure[j-1][1] && value[j-1][k-treasure[j-1][1]]+treasure[j-1][0] > value[j-1][k]) {
            value[j][k] = value[j-1][k-treasure[j-1][1]]+treasure[j-1][0];
            weight[j][k] = weight[j-1][k-treasure[j-1][1]]+treasure[j-1][1];
          }
          else {
            value[j][k] = value[j-1][k];
            weight[j][k] = weight[j-1][k];
          }
        }
      }
      int weightMin = weight[n][w];
      for(int j = w; j >= 0; j--) {
        if (value[n][j] == value[n][w]) {
          weightMin = weight[n][j];
        }
      }
      System.out.println("Case "+i+":");
      System.out.println(value[n][w]);
      System.out.println(weightMin);
    }
  }
}

Measured memory_bytes: 20000
n=int(input())
l = [list(map(int,input().split())) for _ in range(n)] #複数行複数入力を多重リストに

c=1
for i in range(n-2):
    if l[i][0]==l[i][1] and l[i+1][0]==l[i+1][1] and l[i+2][0]==l[i+2][1]:
        c=0
        break
            
if c==0:
    print("Yes")
if c==1:
   print("No")

Measured memory_bytes: 62516
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	int ans = 0;
	if (A + B < C * 2) {
		ans += min(X, Y) * (A + B);
	}
	else {
		ans += min(X, Y) * C * 2;
	}
	if (X > Y) {
		if (A < C * 2) {
			ans += A * (X - Y);
		}
		else {
			ans += C * 2 * (X - Y);
		}
	}
	else {
		if (B < C * 2) {
			ans += B * (Y - X);
		}
		else {
			ans += C * 2 * (Y - X);
		}
	}
	cout << ans << endl;
}

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

int main() {
  int x, y, z, cnt = 0, dist;
  cin >> x >> y >> z;
  dist = 0;
  while (1) {
    cnt++;
    dist += y + z;
    if ( (x - dist) < (y + 2 * z) ) break;
  }

  cout << cnt << endl;

  return 0;

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int a,b,c;
  int flg=0;

  scanf("%d %d %d", &a, &b, &c);
  
  if(a == b && b == c) flg = 1;

  if(flg==1) printf("Yes");
  else       printf("No");
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repA(i, a, n) for (int i = a; i <= (n); ++i)
#define repD(i, a, n) for (int i = a; i >= (n); --i)
#define tr(a, x) for (auto &a : x)
#define all(c) c.begin(), c.end()

#define lld long long
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define f first
#define s second
#define sz(a) int((a).size())
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c), x) != c.end())

#define vi vector<lld>
#define si set<lld>
#define endl "\n"
#define int long long
#define pii pair<int, int>
#define minq priority_queue<int, vector<int>, greater<int>>
#define mem(a, val) memset(a, val, sizeof(a))
#define scani(x) scanf("%lld", &x)
#define scani2(x, y) scanf("%lld %lld", &x, &y)
#define scani3(x, y, z) scanf("%lld %lld %lld", &x, &y, &z);
#define print(x) printf("%lld ", x)
#define println(x) printf("%lld\n", x)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MOD 1000000009

using namespace std;

const int N = 1e5 + 11;
int n, w;
int dp[100][N];
vector<pii> values;

int target(int i, int weight){
     if(weight == 0)
          return 0;
     
     if(i == n-1){
          if(weight < values[i].f)
               return 0;
          else
               return values[i].s;
     }

     if(dp[i][weight] != -1)
          return dp[i][weight];
     
     int a = INT_MIN, b = INT_MIN;
     if(values[i].f <= weight)
          a = values[i].s + target(i+1,weight-values[i].f);

     b = target(i+1,weight);
     dp[i][weight] = max(a,b);
     return dp[i][weight];
}

int32_t main()
{
     // #ifndef ONLINE_JUDGE
     //      freopen("input.txt", "r", stdin);
     //      freopen("output.txt", "w", stdout);
     // #endif

     SpeedForce;
     cin >> n >> w;
     memset(dp,-1,sizeof(dp[0][0])*100*N);
     values.assign(n,{0,0});
     tr(a,values){
          cin >> a.f >> a.s;
     }

     cout << target(0,w) << endl;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<int> brg(n);
    int a,b;
    REP(i,m){
        cin >> a >> b;
        brg[a-1]++;
        brg[b-1]++;
    }
    REP(i,n)cout << brg[i] << endl;
}


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

#define mp make_pair
#define pb push_back

#define int int64_t
#define ld long double

const int MOD = 1e9+7;
const int N = 1e5+5;

int n,k;
int dp[N];
int arr[105];

int solve(int k) {
	if(dp[k]>=0) {
		return dp[k];
	}
	if(k<arr[0]) {
		return dp[k]=0;
	}
	for(int i=0;i<n;i++) {
		if(k-arr[i]>=0)
		if(solve(k-arr[i])==0) {
			return dp[k]=1;
		}
	}
	return dp[k]=0;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>n>>k;
	memset(dp, -1, sizeof(dp));
	for(int i=0;i<n;i++) {
		cin>>arr[i];
	}

	if(solve(k)) {
		cout<<"First";
	}
	else {
		cout<<"Second";
	}

	return 0;
}

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

int main(){
  int N;
  cin >> N;
  if(N == 1){
    cout << "Hello World" << endl;
  }else{
    int A, B;
    cin >> A >> B;
    cout << A+B << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
x = int(input())
"""
最初に1と6以外を上面にし、次に6を向くように操作、以降5656
"""
if x <= 6:
    print(1)
else:
    total = 1
    x -= 6
    total += (x // 11)*2
    amari = x % 11
    if amari == 0:
        print(total)
    elif amari <= 5:
        print(total+1)
    else:
        print(total+2)

Measured memory_bytes: 3060
#Good question
import sys
S = input()
if not S.islower(): sys.exit()
if not ( 1 <= len(S) <= 100 ):sys.exit()

pos = int(len(S)/2)

count = 0
for I in range(pos):
    if S[I] != S[-I-1]:
        count += 1
print(count)

Measured memory_bytes: 9116
S = input()
K = int(input())
l = [1]
for i in range(len(S) - 1):
  if S[i] == S[i+1]:
    l[-1] += 1
  else:
    l.append(1)
if len(l) == 1:
  ans = len(S) * K // 2
else:
  l_2 = []
  for i in range(len(l)):
    l_2.append(l[i] // 2)
  if S[-1] == S[0]:
    LtoF = (l[0] + l[-1]) // 2
    ans = l_2.pop(0)
    ans += l_2.pop(-1)
    ans += sum(l_2) * K
    ans += LtoF * (K - 1)
  else:
    ans = sum(l_2) * K
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#define fio freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define dsc [](int a,int b)->bool {return a>b;}
#define pb push_back
#define test int t; cin>>t;
#define MOD 1000000007LL
#define all(x) (x).begin(),(x).end()

using namespace std;

ll nxt() { ll x; cin>>x; return x; }

int main()
{
    #ifndef ONLINE_JUDGE
        fio
    #endif
    IOS

    ll n = nxt();
    vector<ll>coins;
    for(ll i = 3; i<=n; i++){
        coins.pb(i);
    }
    ll count[n+1];
    memset(count,0,sizeof count);
    count[0] = 1;
    for(ll x = 1; x<=n; x++){
        for(auto c: coins){
            if(x-c>=0){
                count[x]=((count[x]%MOD) + (count[x-c]%MOD))%MOD;
            }
        }
    }

    cout<<count[n]<<endl;

    return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 1; i < n; i ++) cin >> a[i];

    int res = 0;
    for(int i = 2; i < n; i ++) res += min(a[i - 1], a[i]);

    cout << a[1] + res + a[n - 1] << "\n";
}


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

int main(){
	vector<int> card(9);
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> card.at(i * 3 + j);
		}
	}
	int n;
	cin >> n;
	set<int> call;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		call.insert(a);
	}
	vector<int> hit(9,0);
	for (int i = 0; i < 9; i++) {
		if (call.count(card.at(i))) {
			hit.at(i)++;
		}
	}
	if ((hit.at(0) == 1 && hit.at(1) == 1 && hit.at(2) == 1) ||
		(hit.at(3) == 1 && hit.at(4) == 1 && hit.at(5) == 1) ||
		(hit.at(6) == 1 && hit.at(7) == 1 && hit.at(8) == 1) ||
		(hit.at(0) == 1 && hit.at(3) == 1 && hit.at(6) == 1) ||
		(hit.at(1) == 1 && hit.at(4) == 1 && hit.at(7) == 1) ||
		(hit.at(2) == 1 && hit.at(5) == 1 && hit.at(8) == 1) ||
		(hit.at(0) == 1 && hit.at(4) == 1 && hit.at(8) == 1) ||
		(hit.at(2) == 1 && hit.at(4) == 1 && hit.at(6) == 1)) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;


}


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

int main(){

    int a1,a2,a3;
    int b1,b2,b3;
    vector<vector<int>> num(5,vector<int>(5));
    vector<int> cjg(5);
    vector<int> b(5);

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> num[i][j];
        }
    }
    int num2;
    int jg1=-5;
    cjg[0]=num[0][0]-num[0][1],cjg[1]=num[0][1]-num[0][2],cjg[2]=num[0][2]-num[0][0];

    for(int i=1;i<3;i++){
        for(int j=0;j<3;j++){
            if(j==2){
                num2=num[i][0];
            }
            else num2=num[i][j+1];
            if(cjg[j]==num[i][j]-num2) jg1++;
            else {
                jg1=-5;
                break;
            }
            if(jg1==1){
                cout << "Yes" << endl;
                return 0;
            }
        }if(jg1==-5)break;
    }
    
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REPP(i,j,n) for(int i=(j);i<(int)(n);i++)

using namespace std;
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-5, pi = acos(-1.0);
ld dot(Point a, Point b){return real(conj(a)*b);}
ld cross(Point a, Point b){ return imag(conj(a)*b);}

Point p[310];
int n;

void solve(){
  int result=1;
  REP(i,n){
    REPP(j,i+1,n){
      Point ab=p[j]-p[i];
      if(norm(ab)>4)continue;
      Point q=(p[i]+p[j])/2.L;
      Point aq=q-p[j];
      Point normal=Point{imag(aq),-real(aq)}*sqrt(1-norm(aq))/abs(aq);
      Point c=q+normal;
      Point d=q-normal;
      int cntc=0,cntd=0;
      REP(k,n){
	if(norm(p[k]-c)<=1.0001L)cntc++;
	if(norm(p[k]-d)<=1.0001L)cntd++;
      }
      result=max({result,2,cntc,cntd});
    }
  }
  cout<<result<<endl;
}

int main(){ _;
  ld r,i;
  while(cin>>n,n!=0){
    REP(j,n){
      cin>>r>>i;
      p[j]=Point{r,i};
    }
    solve();
  }
}

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

int main()
{
  string s;
  cin >> s;
  int c = 1000, f = -1;
  for (int i = 0; i < s.size(); i++)
  {
    if (s.at(i) == 'C')
      c = min(c, i);
    if (s.at(i) == 'F')
      f = max(f, i);
  }
  if (c != 1000 && f != -1 && c < f)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3584
/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (Windows, macOS, Linux)
 * Author: alireza_kaviani
 * Time: 2020-05-22 10:17:29
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

int n , m , q , psS[2][MAXN] , psT[2][MAXN];
string s , t;

int main() {
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    
    cin >> s >> t >> q; 
    n = SZ(s) , m = SZ(t);
    s = "." + s , t = "." + t;
    for(int i = 1 ; i <= n ; i++){
        int ind = s[i] - 'A';
        psS[ind][i] = psS[ind][i - 1] + 1;
        psS[1 - ind][i] = psS[1 - ind][i - 1];
    }
    for(int i = 1 ; i <= m ; i++){
        int ind = t[i] - 'A';
        psT[ind][i] = psT[ind][i - 1] + 1;
        psT[1 - ind][i] = psT[1 - ind][i - 1];
    }

    while(q--){
        int l1 , r1 , l2 , r2 , A , B;
        cin >> l1 >> r1 >> l2 >> r2; l1--; l2--;
        A = psS[0][r1] - psS[0][l1] - psS[1][r1] + psS[1][l1]; A = (A % 3 + 3) % 3;
        B = psT[0][r2] - psT[0][l2] - psT[1][r2] + psT[1][l2]; B = (B % 3 + 3) % 3;
        cout << (A == B ? "YES" : "NO") << endl;
    }

    return 0;
}
/*

*/


Measured memory_bytes: 11628