akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }


vei printRLE(string str) { 
    int n = str.length(); 
    vei res = {0};
    for (int i = 0; i < n; i++) { 
        // Count occurrences of current character 
        int count = 1; 
        while (i < n - 1 && str[i] == str[i + 1]) { 
            count++; 
            i++; 
        } 
        // Print character and its count 
        res.pub( count );
    } 
    return res;
} 


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

    int N, K; string S; cin >> N >> K >> S;

    

    vei rle = printRLE(S); rle.pub(0);
    int l = rle.size();
    vei imos(l+1,0); 
    for(int i = 0; i <= l-1; i++) imos[i+1] += imos[i] + rle[i];

    
    int ans = 0;
    if(S[0] == '0') {
        if((l-1)/2 <= K) { cout << N << endl; return 0; }
        for(int i = 1; i <= l - 2*K; i+= 2) {
            int temp = imos[i+2*K] - imos[i-1];
            ans = max(ans, temp);
        }
        cout << ans << endl;
    }
    else {
        if((l-2)/2 <= K) { cout << N << endl; return 0; }
        for(int i = 2; i <= l - 2*K; i += 2) {
            int temp = imos[i+2*K] - imos[i-1];
            ans = max(ans, temp);
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1468
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
using ld       = long double;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, a;
    cin >> n >> a;
    lint ret = inf;
    for (lint i = 0; i < 60; ++i) {
        lint temp   = a * i;
        lint ok     = 1000000000000;
        lint ng     = 0;
        auto check1 = [&](lint mid) {
            ld lhs = ld(i + 1) * log(ld(mid));
            ld rhs = log(ld(n));
            return lhs >= rhs - 1e-15;
        };
        while (abs(ok - ng) != 1) {
            lint mid                = (ok + ng) / 2;
            (check1(mid) ? ok : ng) = mid;
        }
        lint base   = ok;
        ok          = i + 1;
        ng          = 0;
        auto check2 = [&](lint mid) {
            return ld(mid) * log(ld(base)) + ld(i + 1 - mid) * log(ld(base - 1)) >= log(ld(n)) - 1e-15;
        };
        while (abs(ok - ng) != 1) {
            lint mid                = (ok + ng) / 2;
            (check2(mid) ? ok : ng) = mid;
        }
        lint large = ok;
        temp += base * large + (base - 1) * (i + 1 - large);
        ret = min(ret, temp);
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
  {
      int ones;
      cin>>ones;
      int n=ones%10;
      if(n==1||n==0||n==6||n==8)
      cout<<"pon";
      else if(n==2||n==4||n==5||n==7||n==9)
      cout<<"hon";
      else
      cout<<"bon";
  }

Measured memory_bytes: 3672
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;

int main() {
    int N;
    cin >> N;
    int a[N];
    int minmax[2] = {intmax, intmin};
    int minmaxnum[2] = {-1, -1};
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        if (a[i] < minmax[0]) {
            minmax[0] = a[i];
            minmaxnum[0] = i;
        }
        if (a[i] > minmax[1]) {
            minmax[1] = a[i];
            minmaxnum[1] = i;
        }
    }
    int mark = 0;
    if (abs(minmax[0]) <= abs(minmax[1])) {
        mark = 1;
    }
    cout << 2 * (N - 1) << endl;
    for (int i = 0; i < N; i++) {
        if (i != minmaxnum[mark]) {
            cout << minmaxnum[mark] + 1 << " " << i + 1 << endl;
        }
    }
    if (mark == 1) {
        for (int i = 0; i < N - 1; i++) {
            cout << i + 1 << " " << i + 2 << endl;
        }
    } else {
        for (int i = N - 1; i >= 1; i--) {
            cout << i + 1 << " " << i << endl;
        }
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		int n = sc.nextInt();
		boolean[][] isWay = new boolean[m+1][m+1];//isWay[i][j] i -> j で jが根
		int[] deg = new int[m+1];//deg[i] ... 頂点iの入次数
		while(n--!=0) {
			int x = sc.nextInt(), y = sc.nextInt();
			isWay[y][x] = true;
			deg[y]++;
		}
		for(int i = 0; i < m; i++) {
			for(int j = 1; j <= m; j++) {
				if(deg[j] == 0) {
					if(i != m-1 && j == 2) continue;
					System.out.println(j);
					deg[j] = -1;
					for(int k = 1; k <= m; k++) {
						if(isWay[k][j]) deg[k]--;
					}
				}
			}
		}
	}
}


Measured memory_bytes: 26428
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
  int c=0;
  int a;
  cin>>n>>m;
  for (int i=0;i<n;i++)
  {
    cin>>a;
    if (a>=m)
      c++;
  }
  cout<<c;
}


Measured memory_bytes: 256
/*
 * 16-11-20_chu2_C.cpp
 *
 *  Created on: 2016/11/22
 *      Author: ryoma
 */

#include<iostream>
#include<algorithm>

#define int long long

using namespace std;

const int MOD = 1000000007;

int n,k;
int a[101];
int fact[101];
int dp[101][101][256];
int ans;
signed main(){
	cin >> n>> k;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	fact[0] = 1;
	for(int i=1;i<=n;i++){
		fact[i] = (i*fact[i-1])%MOD;
	}
		dp[0][0][0] = 1;
	for(int i=0;i<n;i++){
		for(int j=0;j<=i;j++){
			for(int l=0;l<256;l++){
				dp[i+1][j][l] =(dp[i+1][j][l]+ dp[i][j][l])%MOD;
				dp[i+1][j+1][l^a[i]] =(dp[i+1][j+1][l^a[i]]+ dp[i][j][l])%MOD;
			}
		}
	}
	for(int j=0;j<=n;j++){
		ans =(ans+ dp[n][j][k]*fact[j]%MOD)%MOD;
	}
	cout << ans <<endl;
	return 0;
}




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

int main(){
  int n;
  cin >> n;
  ll v = 0, e = 0;
  for (int i=1; i <= n; ++i) {
    v += ll(i)*(n-i+1);
  }
  rep(i,n-1){
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a,b);
    e += ll(a) * ll(n-b+1);
  }
  ll ans = v - e;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>

int rate(int X){
    if(400<=X && X<=599) return 8;
    else if(600<=X && X<=799) return 7;
    else if(800<=X && X<=999) return 6;
    else if(1000<=X && X<=1199) return 5;
    else if(1200<=X && X<=1399) return 4;
    else if(1400<=X && X<=1599) return 3;
    else if(1600<=X && X<=1799) return 2;
    else if(1800<=X && X<=1999) return 1;
}

int main(){
    int x;
    scanf("%d", &x);
    printf("%d", rate(x));
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
int const M=2e5+10,mod=1e9+7,inf=1e9+10;
int a[M];
main()
{
	int n,a,b;
	cin>>n>>a>>b;
	if(a%2==b%2)cout<<"Alice";
	else cout<<"Borys";
}

Measured memory_bytes: 256
#include <stdio.h>

 int main(void)
 {
     int n;
     int card[4][13];
     char suit[4] = "SHCD";
     scanf("%d", &n);
     int i,j,c;
     char s;
     for (i=0;i<4;i++)
     {
         for (j=0; j<13;j++)
         {
             card[i][j] = 0;
         }
     }
     for (i=0;i<n;i++)/* 왜 2*n 인거지?.... 오오 scanf 앞쪽에 \n 을 넣어주지 않으면 input 앞의 \n을 문자로 읽어서 오류.!*/
     {
         scanf("\n%c %d",&s,&c);
         //printf("i = %d,s = %c, c = %d ",i,s,c);
         if (s == 'S') card[0][c-1] = 1;
         else if (s == 'H') card[1][c-1] = 1;
         else if (s == 'C') card[2][c-1] = 1;
         else if (s == 'D') card[3][c-1] = 1;
     }
     for (i=0;i<4;i++)
     {
         for (j=0;j<13;j++)
         {
             if (card[i][j] == 0)
             {
                 printf("%c %d\n", suit[i],j+1);
             }
         }
     }
     return 0;
 }


Measured memory_bytes: 2068
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int A, B;
    cin >> A >> B;
    if (A >= 13) {
        cout << B << endl;
    } else if (A >= 6 && A <= 12) {
        cout << (B / 2) << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#import sys
import numpy as np
#from collections import defaultdict
#import math
#from collections import deque

#input = sys.stdin.readline
#import decimal

def main():
    x = int(input())
    l = np.zeros(x*10)
    i = 2

    while True:
        if l[i] ==0:
            l[i::i] = 1
            if i>=x:
                print(i)
                exit()

        i +=1

if __name__ == "__main__":
    main()

Measured memory_bytes: 34364
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;



const double PI=3.14159265358979323846;

int main(void){
    ll n,m;
    cin>>n>>m;
    ll sum= 0;
    for(ll i=0;i<m;i++){
        ll a;
        cin>>a;
        sum+=a;
    }
    if(sum>n)cout<<-1;
    else cout<<n-sum;
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include <set> 
#include <iterator> 
using namespace std;

int main() {
	 long x;
	 cin>>x;
	 if(x>=30){
	     cout<<"Yes"<<endl;
	 }
	 else{
	     cout<<"No"<<endl;
	 }
	 return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define ll long long
#define sc scanf
#define pr printf
using namespace std;
const int MAXN = 1e5 + 5;
ll a[MAXN], b[MAXN], c[MAXN];
auto cmp = [](ll q, ll w) {
	return q > w;
};
int main()
{
	int n, m, aa, bb, cc;
	sc("%d%d%d%d%d", &n, &m, &aa, &bb, &cc);
	for (int i = 0; i < aa; i++)
		sc("%lld", &a[i]);
	for (int i = 0; i < bb; i++)
		sc("%lld", &b[i]);
	for (int i = 0; i < cc; i++)
		sc("%lld", &c[i]);
	sort(a, a + aa, greater<int>());
	sort(b, b + bb, greater<int>());
	sort(c, c + cc, greater<int>());
	priority_queue<ll, vector<ll>, decltype(cmp)>q(cmp);
	ll ans = 0, now = 0;
	for (int i = 0; i < n; i++)
	{
		q.push(a[i]);
		now += a[i];
	}
	for (int i = 0; i < m; i++)
	{
		q.push(b[i]);
		now += b[i];
	}
	ans = now;
	for (int i = 0; i < cc; i++)
	{
		ll t1 = q.top();
		q.pop();
		now -= t1;
		if (c[i] >= t1)
		{
			q.push(c[i]);
			now += c[i];
		}
		else
		{
			break;
		}
		ans = max(ans, now);
	}
	pr("%lld\n", ans);
}

Measured memory_bytes: 4724
#include <iostream>
#include <unordered_map>
#include <cstring>
#include <vector>
using namespace std;

const int MAXN=1001, MAXMATCH = 1000*1000/2;
struct Edge {
	int to;
	Edge *next;
}*head[MAXMATCH];

int indegree[MAXMATCH];
void addedge(int a, int b) {
	head[a] = new Edge{b, head[a]};
	indegree[b]++;
}

unordered_map<int, int> mhash;
int mptr=0, n;
int match(int a, int b) {
	if (a > b)
		swap(a, b);
	int hid = a*n+b;
	if (mhash.find(hid) == mhash.end()) {
		// cout<<"Match<"<<a<<" "<<b<<"> ==> "<<mptr<<endl;
		return mhash[hid] = mptr++;
	}
	// cout<<"Match<"<<a<<" "<<b<<"> ==> "<<mhash[hid]<<endl;
	return mhash[hid];
}
int main() {
	memset(head, 0, sizeof(head));
	memset(indegree, 0, sizeof(indegree));
	cin>>n;
	for (int i=1; i<=n; i++) {
		int order[MAXN];
		for (int j=0; j<n-1; j++)
			cin>>order[j];
		for (int j=0; j+1<n-1; j++)
			addedge(match(i, order[j]), match(i, order[j+1]));
	}

	int ans = 0;
	vector<int> now, nxt;
	for (auto it: mhash)
		if (indegree[it.second] == 0)
			now.push_back(it.second);
	int nodecnt = n*(n-1)/2;
	while(now.size()) {
		// cout<<"Round "<<ans<<" : ";
		nxt.clear();
		for (auto it : now) {
			// cout<<it<<" ";
			indegree[it] = -1;
			nodecnt--;
			for (Edge *e=head[it]; e; e=e->next)
				if (--indegree[e->to] == 0)
					nxt.push_back(e->to);
		}
		// cout<<endl;
		now = nxt;
		ans++;
	}
	if (nodecnt != 0)
		cout<<-1<<endl;
	else
		cout<<ans<<endl;
	return 0;
}

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

int main()
{
    char c[5];
    int A, B, count = 0;
    cin >> A >> B;
    for (int i = A; i <= B; i++)
    {
        string s = to_string(i);
        if (s[0] == s[4] && s[1] == s[3])
        {
            count++;
        }
    }
    
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
x=str(input())
if x[0]==x[1] and x[2]==x[3] and x[0]!=x[2]:
	print('Yes')
elif x[0]==x[2] and x[1]==x[3] and x[0]!=x[1]:
	print('Yes')
elif x[0]==x[3] and x[1]==x[2] and x[0]!=x[1]:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

int main() {
	ll a, b;
	cin >> a >> b;
	if (a <= b) cout << a << endl;
	else cout << a - 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

// nCr mod を計算する O(n)
const int MAX_N = 1000010;
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX_N; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    ll N,K;
    cin>>N>>K;
    COMinit();

    for(int k=1;k<=K;k++){
        ll ans=(COM(N-K+1,k)*COM(K-1,k-1))%MOD;
        cout<<ans<<endl;
    }
}

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

int main( void ) {
    int a, b;
    cin >> a >>b;
    cout << a / b << ' ';
    cout << a % b << ' ';
    printf( "%.5lf\n", (double)a / (double)b );
    return 0;
}


Measured memory_bytes: 3232
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

const M: usize = 1_000_000_007;

fn solve(
    cur: usize,
    par: Option<usize>,
    color: usize,
    graph: &Vec<Vec<usize>>,
    dp: &mut Vec<Vec<Option<usize>>>,
) -> usize {
    if dp[cur][color].is_some() {
        return dp[cur][color].unwrap();
    }
    let mut res = 1;
    for &to in &graph[cur] {
        if par.is_some() && par.unwrap() == to {
            continue;
        }
        let mut next = 0;
        next += solve(to, Some(cur), 1, graph, dp);
        if color == 1 {
            next += solve(to, Some(cur), 0, graph, dp);
        }
        next %= M;

        res *= next;
        res %= M;
    }

    dp[cur][color] = Some(res);
    // println!("{}, {}, {}", cur, color, res);
    res
}

fn main() {
    input! {
        n: usize,
        edges: [(usize1, usize1); n - 1],
    }
    let mut graph = vec![vec![]; n];
    for &(f, t) in &edges {
        graph[f].push(t);
        graph[t].push(f);
    }
    let mut dp: Vec<Vec<Option<usize>>> = vec![vec![None; 2]; n];

    println!(
        "{}",
        (solve(0, None, 0, &graph, &mut dp) + solve(0, None, 1, &graph, &mut dp)) % M
    );
}


Measured memory_bytes: 31868
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn ceil(x: usize, y:usize) -> usize {
    (x + y - 1) / y
}


fn main() {
    input! {
        n: usize,
        k: usize,
    }
    println!("{}", ceil(n - 1, k - 1));
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>	
#include <cmath>
#include <string>
#include<math.h>//���炵���̂Œ���
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define Cout(s) cout<<s<<endl
using namespace std;
typedef long long ll;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================

int a = 1, b = 0, c, d, n, k = 0, ans = 0;
string s, t;
int mod = 1000000007;

int main()
{
	int a, b, c, d; cin >> a >> b >> c >> d;
	int turn1 = (c + b - 1) / b;
	int turn2 = (a + d - 1) / d;
	if (turn1 <= turn2)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3632
# pythonでスタック、キューを実現するためにdequeをimport
from collections import deque

N, M = map(int, input().split())

# 辺集合EとグラフGの構築
G = [[] for _ in range(N)]
E = []
for _ in range(M):
    a, b = map(int, input().split())
    # 入力は1-indexedだがこれを扱いやすいように0-indexedに変更
    a -= 1
    b -= 1
    E.append((a, b))
    G[a].append(b)
    G[b].append(a)
# print(G)

# 橋を数えるための変数cntを用意
cnt = 0
for edge_to_remove in E:
    # 橋であるか判定したい辺を取り除いてみる
    i, j = edge_to_remove
    G[i].remove(j)
    G[j].remove(i)

    # 幅優先探索
    seen = [False] * N
    todo = deque()
    # 適当な頂点から幅優先探索をスタート（ここでは頂点0をスタートに選んだ）
    todo.append(0)
    seen[0] = True
    while todo:
        # 深さ優先探索との実装上の違いはここでpopを使うかpopleftを使うかだけ
        # popならスタックなので深さ優先探索となりpopleftならキューなので幅優先探索となる
        here = todo.popleft()
        # print(here)
        for neighbor in G[here]:
            if seen[neighbor] == False:
                seen[neighbor] = True
                todo.append(neighbor)
    # print(seen)
    # もし訪問できていない頂点があれば連結でないというなので今着目している辺は橋であった！
    if False in seen:
        cnt += 1

    # 次の辺について調べるために今取り除いた辺を再びGに戻しておく
    G[i].append(j)
    G[j].append(i)
print(cnt)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
    using namespace std;
     
    int main()
    {
        int N, cnt, x;
        scanf("%d", &N);
        
        cnt = 0;
        while(N--)
        {
            scanf("%d", &x);
            if((x & 1)) cnt++;
        }
        if((cnt & 1)) cout<<"NO"<<endl;
        else cout<<"YES"<<endl;
        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

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

const int INF = 1e9;
const int MOD = 1e9+7;

int calc(int x, int y, vi &s){
    int res = 0;
    for(int i = x; i <= y; i++){
        res *= 10;
        res += s[i];
    }
    return res;
}

int main(void){
    int n;
    cin >> n;
    vi a(n);
    REP(i, n){
        cin >> a[i];   
    }
    set<int> b;
    vi c;
    REP(i, n){
        for(int j = i; j < n; j++){
            if(j - i > 8) continue;
            b.insert(calc(i, j, a));
        }
    }
    FOR(e, b) c.push_back(*e);
    int id = 0;
    while(1){
        if(c[id] != id){
            cout << id << endl;
            break;
        }
        id++;
    }
	return 0;
}

Measured memory_bytes: 1576
import java.util.Scanner;
import java.util.Set;
import java.util.HashSet;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long k = sc.nextLong();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    int count = 0;
    int x = 1;
    Set<Integer> set = new HashSet<>();
    int loopx = 1;
    while (true) {
      set.add(x);
      x = a[x-1];
      count++;
      if (set.contains(x)) {
        loopx = x;
        break;
      }
    }
    
    int loopCount = 0; 
    x = 1;
    while (true) {
      if (x == loopx) {
        break;
      }
      x = a[x-1];
      loopCount++;
    }
    int trueCount = count - loopCount;
    long trueK = k - loopCount;
    long amari = trueK % trueCount;

    x = 1;
    if ( k < loopCount) {
      for (int i = 0; i < k; i++) {
        x = a[x-1];
      }
    } else {
      for (int i = 0; i < loopCount + amari; i++) {
        x = a[x-1];
      }
    }

    System.out.println(x);

  }
}


Measured memory_bytes: 65808
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.List.Split (splitOn)
import Test.HUnit

main :: IO ()
-- main = runTestTT (TestList tests) >> return ()
main = do
  n <- getl toInt
  xs <- rgetl n $ map toDbl . splitOn ":"
  mapM_ putStrLn $ solve xs

solve :: [[Double]] -> [String]
solve = map f
  where
    f [h,m]
      | a < 30.0 = "alert"
      | a < 90.0 = "warning"
      | otherwise = "safe"
      where a = diffAng h m

lha :: Double -> Double
lha m = m * 6

sha :: Double -> Double -> Double
sha h m = h * 30 + m * 0.5

diffAng :: Double -> Double -> Double
diffAng h m = let a = abs (la - sa) in min a (360 - a)
  where
    la = lha m
    sa = sha h m

toInt :: String -> Int
toInt s = read s

toDbl :: String -> Double
toDbl s = read s

getl :: (String -> a) -> IO a
getl f = f <$> getLine

rgetl :: Int -> (String -> a) -> IO [a]
rgetl n f = map f <$> replicateM n getLine

Measured memory_bytes: 4512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[1005];
int b[1005];
int n,h;
int dp[100000005];
int main(){
	cin >> h >> n;
	int maxn=h;
	for(int i=0;i<n;i++){
		cin >> a[i] >> b[i];
		maxn=max(a[i],maxn);
	}
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	for(int i=0;i<n;i++){
		for(int j=1;j<=2*maxn;j++){
			if(a[i]>=j)
			dp[j]=min(dp[0]+b[i],dp[j]);
			else
			dp[j]=min(dp[j-a[i]]+b[i],dp[j]);
		}
	}
	int ans=0x3f3f3f3f;
	for(int i=h;i<=maxn;i++){
		ans=min(ans,dp[i]);
	}
	cout << ans << endl;
    return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	string S=in<string>();
	int N=S.size();
	int odd=0;
	REP(i,N/2){
		if(S[i]!=S[N-1-i]) odd++;
	}

	out(odd);
	return 0;
}


Measured memory_bytes: 256
# coding: utf-8
from itertools import *
import sys
import time


#################### library ####################


#################### naive ####################


#################### process ####################

def read_array():
	N = int(input())
	A = map(float, raw_input().split())
	return A


#################### main ####################

#t0 = time.clock()
vs = sorted(read_array())
print reduce(lambda x, y: (x+y)/2, vs)
#print >>sys.stderr, "%.6fsec" % (time.clock() - t0,)


Measured memory_bytes: 2692
n = gets.to_i
price = gets.chomp.split.map(&:to_i)
base = gets.to_f
cal = []
n.times{cal << gets.to_f}
cal.sort!.reverse!
calory, dollar = base, price[0]
max = calory / dollar
cal.each{|ca|
    calory += ca
    dollar += price[1]
    break if (calory / dollar) < max
    max = calory / dollar
}
puts max.to_i


Measured memory_bytes: 6880
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
    int a,b,c,x,y,tmp=0;
    scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
    int ans=a*x+b*y;
    for (int i=0; i<=x; i++){
        tmp=0;
        tmp+=i*a;
        int restx=x-i;
        tmp+=restx*2*c;
        int resty=y-restx;
        if (resty>0){
            tmp+=resty*b;
        }
        if(ans>tmp){
            ans=tmp;
        }
    }
    for (int i=0; i<=y; i++){
        tmp=0;
        tmp+=i*b;
        int resty=y-i;
        tmp+=resty*2*c;
        int restx=x-resty;
        if (restx>0){
            tmp+=restx*a;
        }
        if(ans>tmp){
            ans=tmp;
        }
    }
    printf ("%d\n",ans);
    
    return 0 ;
}

Measured memory_bytes: 128
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int x3 = x2 - (y2 - y1);
  int y3 = y2 + (x2 - x1);
  int x4 = x3 - (x2 - x1);
  int y4 = y3 - (y2 - y1);
  cout << x3 << " ";
  cout << y3 << " ";
  cout << x4 << " ";
  cout << y4 << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
vector<int> v;
int main(){
	scanf("%d%d%d",&a,&b,&c);
	v.push_back(a);
	v.push_back(b);
	v.push_back(c);
	sort(v.begin(),v.end());
	if(v[0]==5&&v[1]==5&&v[2]==7){
		printf("YES");
	}else printf("NO");
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		str = br.readLine().split(" ");
		long v[] = new long[n];

		for (int i = 0; i < n; i++) {
			v[i] = Long.parseLong(str[i]);
		}

		long ans = 0;
		for (int i = 0; i <= Math.min(n, k); i++) {
			for (int j = 0; i + j <= Math.min(n, k); j++) {
				ArrayList<Long> list = new ArrayList<>();

				long cur = 0;
				for (int h = 0; h < i; h++) {
					list.add(v[h]);
					cur += v[h];
				}
				for (int h = 0; h < j; h++) {
					list.add(v[n - 1 - h]);
					cur += v[n - 1 - h];
				}

				Collections.sort(list);

				for (int h = 0; h < Math.min(k - i - j, (int) list.size()); h++) {
					if (list.get(h) < 0)
						cur -= list.get(h);
				}
				ans = Math.max(ans, cur);
			}
		}

		System.out.println(ans);
	}
}


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

// 小数点以下桁数
// fixed << setprecision(i)

int64_t gcd(int64_t a,int64_t b){return (a%b==0?b:gcd(b, a%b));}
int64_t lcm(int64_t a,int64_t b){return a/gcd(a, b)*b;}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応
bool is_prime(int64_t a){if(a<=1)return false;for(int64_t i=2;(int64_t)i*i<=a;i++){if(a%i==0)return false;}return true;}
int get_adp(double x, int n){return (int)round((x-(int)x)*pow(10,n))%10;} // 小数点以下の指定桁の値を取得
int64_t sigma(int64_t s, int64_t n){return n*(2*s+n-1)/2;}

//順列の全列挙
// vector<int> v(N);
// iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
// do {
//	for(auto x : v) cout << x << " "; cout << "\n";     // v の要素を表示
// } while( next_permutation(v.begin(), v.end()) ); 

//bit全探索
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//	bitset<ビット数> s(tmp);
//	// (ビット列sに対する処理)
// }


int main()
{
	double a, b, x, t, s, v;

	cin >> a >> b >> x;
	t = 180 / M_PI;
	v = a * a * b;
	if (x < v / 2)
		s = a * b * b / x / 2;
	else
		s = 2 * (a * a * b - x) / (a * a * a);
	cout << fixed << setprecision(6) << atan(s) * t << endl;
}


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

typedef long long int ll;

int main(){
    ll n,W;
    cin>>n>>W;
    ll i,j;
    ll w[n+1],v[n+1];
    w[0]=0;v[0]=0;
    for(i=1;i<=n;i++){
        cin>>w[i]>>v[i];
    }
    ll dp[n+1][W+1];
    for(i=0;i<W+1;i++)
        dp[0][i]=0;
    for(i=0;i<n+1;i++)
        dp[i][0]=0;
    for(i=1;i<n+1;i++){
        for(j=1;j<W+1;j++){
            if(w[i]<=j)
                dp[i][j]=max(v[i]+dp[i-1][j-w[i]],dp[i-1][j]);
            else
                dp[i][j]=dp[i-1][j];       
        }
    }
    cout<<dp[n][W]<<endl;        
    return 0;
}

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

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

	int a; cin >> a;
	if (a % 10 == 2 || a % 10 == 4 || a % 10 == 5 || a % 10 == 7 || a % 10 == 9)
	{
		cout << "hon" << endl;
	}
	else if (a % 10 == 0 || a % 10 == 1 || a % 10 == 6 || a % 10 == 8)
	{
		cout << "pon" << endl;
	}
	else
	{
		cout << "bon" << endl;
	}
	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
  vector<int> count(5);
  for (int i = 0; i < N; i++)
  {
    if (a[i] % 2 == 1)
      count[1]++;
    else if (a[i] % 4 == 0)
      count[4]++;
    else
      count[2]++;
  }
  string ans = "No";
  if (0 < count[2])
  {
    if (count[1] <= count[4])
      ans = "Yes";
  }
  else
  {
    if (count[1] <= count[4] + 1)
      ans = "Yes";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  ll N, M;
  cin >> N >> M;
  vector<pair<int, ll>> A(0);
  REP(i, N) {
    ll a;
    cin >> a;
    A.push_back(pair<int, ll>(a, 1));
  }
  REP(i, M) {
    ll b, c;
    cin >> b >> c;
    A.push_back(pair<int, ll>(c, b));
  }
  sort(A.begin(), A.end(), greater<pair<int, ll>>());
  ll ans = 0;
  ll i = 0;
  while (N > 0) {
    if (N >= A[i].second) {
      ans += (ll)A[i].first * A[i].second;
      N -= A[i].second;
    } else {
      ans += (ll)A[i].first * N;
      N = 0;
    }
    i++;
  }
  cout << ans << endl;
}

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

typedef long long ll;
#define ABSOL(a) (a<0 ? (a*(-1)) : a)
#define rep(i, a, b) for(i = a; i < b; i++)
#define REP(i, a, b) for(i = a; i <= b; i++ )
#define scanstr(str) getline(cin, str)

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	ll n, i, j, count = 0;
	string slime;
	
	cin >> n;
	cin >> slime;
	
	for(i = 0; i < n;){
		for(j = i; j < n; j++){
			if(slime[i] != slime[j]){
				count++;
				break;
			}
		}
		i = j;
	}
	cout << count + 1 << endl;
	return 0;
}

Measured memory_bytes: 512
using System;

namespace abc101_a
{
    class Program
    {
        static void Main(string[] args)
        {
            char ch;
            int count=0;
            string array = Console.ReadLine();
            for(int i = 0; i < array.Length; i++)
            {
                ch = array[i];
                if (ch=='+')
                {
                    count++;
                }else if (ch == '-')
                {
                    count--;
                }
            }
            Console.WriteLine(count);
        }
    }
}


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

int main(){
	int n,m;
	cin>>n>>m;
	int a[m],b[m];
	int co[n]={};
	rep(i,m){
		cin>>a[i]>>b[i];
		co[a[i]-1]++;co[b[i]-1]++;
	}
	rep(i,n){
		puts(co[i]);
	}
}


Measured memory_bytes: 256
nums = []
while True:
    in_line = raw_input().split()
    h = int(in_line[0])
    w = int(in_line[1])
    if h == 0 and w == 0:
        break
    else:
        nums.append([h,w])
for num in nums:
    for i in range(0,num[0]):
        if i == 0 or i == num[0]-1:
            print "#"*num[1]
        else:
            print "#" + "."*(num[1]-2) + "#"
    print ""

Measured memory_bytes: 6328
str_num = input()
input_str = input()
input_array = list(input_str)

n = 0
int_str_num =int(str_num)

if int_str_num % 2 == 0:
    half_str_num = int_str_num/2
    int_half_str_num = int(half_str_num)
    for i in range(int_half_str_num):
        if input_array[i] == input_array[i+int_half_str_num]:
            n = n + 1
    if n == half_str_num:
        print('Yes')
    else:
        print('No')
else:
  print('No')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int a, b;
    cin >> a >> b;
    int ans = -1;
    if(a < 10 && b < 10) ans = a * b;
    cout << ans << endl;
    return 0;
}

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

int main(){
	int n,k;
	cin>>n>>k;
	int a[20];
	memset(a,0,sizeof(a));
	for(int i=0;i<k;i++){
		int x;
		cin>>x;
		a[x]++;
	}
	for(int i=n;;i++){
		int tp = i;
		while(tp){
			if(a[tp%10]){
				break;
			}
			tp/=10;
		}
		if(tp == 0){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  for(int i=1;i<(int)s.size(); i++){
    if(s[i-1] == s[i]){
      cout << "no" << endl;
      return 0;
    }
  }
  cout << "yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int N,A[20],x[20][20],y[20][20];
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>A[i];
        for(int j=0;j<A[i];j++){
            cin>>x[i][j]>>y[i][j];
        }
    }
    int ans=0;
    vec v(20);
    for(int bit=0;bit<(1<<N);bit++){
        int s=0;
        bool b=true;
        for(int i=0;i<20;i++){
            v[i]=0;
        }
        for(int i=0;i<N;i++){
            if(bit & (1<<i)){
                s++;
                v[i]=1;
            }
        }
        for(int i=0;i<N;i++){
            if(v[i]==1){
                for(int j=0;j<A[i];j++){
                    if(v[x[i][j]-1]!=y[i][j]){
                        b=false;
                    }
                }
            }
        }
        if(b){
            ans=max(ans,s);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (i = a; i < (n); i++)
#define all(in) in.begin(), in.end()

typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int32_t, int32_t> pii;
typedef vector<int32_t> vi;

int32_t dp[1001][1001];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  cout << fixed;

  rep(i, 1001) {
    rep(j, 1001) { dp[i][j] = 0; }
  }

  int32_t h, w;
  cin >> h >> w;
  rep(i, h) {
    rep(j, w) {
      char c;
      cin >> c;
      if (c == '.') {
        dp[i][j] = -1;
      }
    }
  }

  for (int i = h - 1; i >= 0; i--) {
    for (int j = w - 1; j >= 0; j--) {
      if (i == h - 1 && j == w - 1) {
        dp[i][j] = 1;
      } else if (dp[i][j] == -1) {
        dp[i][j] = (dp[i + 1][j] + dp[i][j + 1]) % 1000000007;
      }
    }
  }

	cout << dp[0][0];
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    while(true){
        int n,m;
        cin >> n >> m;
        if(n==0 and m==0) break;

        typedef tuple<int,int,int,int> edge;
        vector<vector<edge>> graph(n);
        rep(i,0,m){
            int u,v,d,c;
            cin >> u >> v >> d >> c;
            --u;
            --v;
            graph[u].emplace_back(make_tuple(u,v,c,d));
            graph[v].emplace_back(make_tuple(v,u,c,d));
        }

        int ans=0;
        vector<int> dist(n,inf);
        vector<bool> done(n);
        priority_queue<tuple<int,int,int>,vector<tuple<int,int,int>>,greater<tuple<int,int,int>>> que;
        dist[0]=0;
        que.push(make_tuple(0,0,0));
        while(!que.empty()){
            const auto t=que.top();
            const auto u=get<2>(t);
            que.pop();
            if(get<0>(t)>dist[u]) continue;
            if(!done[u]){
                ans+=get<1>(t);
                done[u]=true;
            }
            for(const auto& e:graph[u]){
                const int v=get<1>(e);
                const int tmp=get<0>(t)+get<3>(e);
                if(tmp>dist[v]) continue;
                dist[v]=tmp;
                que.push(make_tuple(dist[v],get<2>(e),v));
            }
        }
        cout << ans << endl;
    }
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(8);
    solve();
    return 0;
}

Measured memory_bytes: 4392
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>

using namespace std;



int main()
{
	string S;

	cin >> S;

	if (S == "Sunny") printf("Cloudy"); 
	if (S == "Cloudy") printf("Rainy"); 
	if (S == "Rainy") printf("Sunny"); 


	//printf("%d",ans);

	return 0;
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(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) long long(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>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

const ll maxn=1<<15;
ll dp[maxn][15];
ll mat[105][105];
ll cost[maxn][15];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m; cin>>n>>m;
  
  rep(i,m){
    ll x,y,r; cin>>x>>y>>r;
    x--,y--;
    mat[x][y]=mat[y][x]=r;
  }
  
  rep(i,1<<n){
    rep(x,n){
      dp[i][x]=1<<30;
      rep(y,n) if(i>>y&1) cost[i][x]+=mat[x][y];
    }
  }
  
  dp[1][0]=0;
  for(ll mask=0; mask<(1<<n); mask++){
    rep(x,n) if((mask&(1<<x)) && dp[mask][x]<(1<<30)){
      rep(y,n) if(mat[x][y] && ((mask>>y&1)==0)){
        ll addco=cost[mask][y]-mat[x][y];
        dp[mask|(1<<y)][y]=min(dp[mask|1<<y][y],dp[mask][x]+addco);
      }
      
      ll nmask=mask^(1<<x);
      ll left=((1<<n)-1)^mask;
      for(ll i=left; i>0; i=(i-1)&left){
        ll add=0;
        rep(y,n) if(i&(1<<y)) add+=cost[nmask][y];
        dp[mask|i][x]=min(dp[mask|i][x], dp[mask][x]+add);
      }
    }
  }
  
  cout<<dp[(1<<n)-1][n-1]<<endl;
  
}

Measured memory_bytes: 8064