akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vvl = vector<vl>;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define per(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main() {
    int n, k; cin >> n >> k;
    vl have(n,0);
    rep(i,k) {
        int d; cin >> d;
        rep(j,d) {
            int id; cin >> id;
            have[id-1] = 1;
        }
    }
    int ans = n;
    rep(i,n) ans -= have[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int mod = int(1e9) + 7;
const int DIM = 2;

struct Matrix {
  int a[DIM][DIM];
  int *operator [] (int r) { return a[r]; };

  Matrix(int x = 0) {
    memset(a, 0, sizeof a);
    if (x)
    {
		for(int i = 0; i < DIM; i++) a[i][i] = x;
	}
  }
} const I(1);

Matrix operator * (Matrix A, Matrix B) {
  const ll mod2 = ll(mod) * mod;
  Matrix C;
 for(int i = 0; i < DIM; i++)
 {
	 for(int j = 0; j < DIM; j++)
	 {
		ll w = 0;
		for(int k = 0; k < DIM; k++)
		{
			w += ll(A[i][k]) * B[k][j];
			if (w >= mod2) w -= mod2;
		}
    C[i][j] = w % mod;
	}
  }
  return C;
}

Matrix operator ^ (Matrix A, ll b) 
{
  Matrix R = I;
  for (; b > 0; b /= 2) {
    if (b % 2) R = R*A;
    A = A*A;
  }
  return R;
}

Matrix M;

char a[1011][1011];

ll modpow(ll a, ll b)
{
	ll r=1;
	while(b)
	{
		if(b&1) r=(r*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return r;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m; cin>>n>>m; ll k; cin>>k;
	if(k==0)
	{
		cout<<1<<'\n';
		return 0;
	}
	ll H=0; ll W = 0;
	ll black=0;
	ll adjh=0; ll adjw=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin>>a[i][j];
			if(a[i][j]=='#') black++;
		}
	}
	for(int i=0;i<n-1;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(a[i][j]=='#'&&a[i+1][j]=='#')
			{
				adjh++;
			}
		}
	}
	for(int i=0;i<m-1;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(a[j][i]=='#'&&a[j][i+1]=='#')
			{
				adjw++;
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		if(a[i][0]=='#'&&a[i][m-1]=='#') W++;
	}
	for(int i=0;i<m;i++)
	{
		if(a[0][i]=='#'&&a[n-1][i]=='#') H++;
	}
	if(H>0&&W>0)
	{
		cout<<1<<'\n';
		return 0;
	}
	if(H==0&&W==0)
	{
		cout<<modpow(black,k-1)<<'\n';
		return 0;
	}
	if(H==0)
	{
		swap(H,W); swap(adjh,adjw);
	}
	M[0][0] = black;
	M[0][1] = (mod - adjh)%mod;
	M[1][1] = H;
	Matrix res = M^(k-1);
	ll ans = res[0][0]+res[0][1];
	while(ans>=mod) ans-=mod;
	cout<<ans<<'\n';
}


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

int main() {
  int64_t S;
  cin >> S;
  
  int64_t P,Q,R;
  P=pow(10, 9.0);
  Q=S/P; R=S%P;
  if(R!=0){
  	cout << 0 <<' '<< 0 <<' '<< 1 <<' '<< P <<' '<< Q+1 <<' '<< P-R ;
  }else{
    cout << 0 <<' '<< 0 <<' '<< 1 <<' '<< P <<' '<< Q <<' ' << 0;
  }
}


Measured memory_bytes: 256
b = [0] * 9


def hantei():
    for i in range(3):
        if b[i * 3] == 1 and b[i * 3 + 1] == 1 and b[i * 3 + 2] == 1:
            return True
    for i in range(3):
        if b[i] == 1 and b[i + 3] == 1 and b[i + 6] == 1:
            return True
    if b[0] == 1 and b[4] == 1 and b[8] == 1:
        return True
    if b[2] == 1 and b[4] == 1 and b[6] == 1:
        return True
    return False


a = [0] * 9
[a[0], a[1], a[2]] = input().split()
[a[3], a[4], a[5]] = input().split()
[a[6], a[7], a[8]] = input().split()
a = [int(i) for i in a]

n = int(input())

for i in range(n):
    c = int(input())
    for j in range(len(a)):
        if a[j] == c:
            b[j] = 1

if (hantei()):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main()
{

   string s,ss;
   cin>>s>>ss;
   int sum=0;
   if(s[0]==ss[0])
   sum+=1;
   if(s[1]==ss[1])
   sum+=1;
   if(s[2]==ss[2])
   sum+=1;

   cout<<sum<<endl;


}


Measured memory_bytes: 256
n = int(input())
p = 10 ** 9 + 7
a = 1
b = 1
c = 1
for i in range(n):
    a = (a * 10) % p
    b = (b * 9) % p
    c = (c * 8) % p
y = a - 2 * b + c
z = y % p
print(z)

Measured memory_bytes: 9184
#include <stdio.h>

int main()
{
    int n, a[10001], b[10001], i;
    long sum = 0;
    char ans[4];
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    for (i = 0; i < n; i++)
        scanf("%d", &b[i]);
    for (i = 0; i < n; i++)
    {
        if (b[i] > a[i])
        {
            if ((b[i] - a[i]) % 2 == 0)
                sum = sum + (a[i] - b[i]) / 2;
            else
                sum = sum + ((a[i]+1) - b[i]) / 2;
        }
        else
            sum = sum + (a[i] - b[i]);
    }
    if (sum <= 0)
    {
        ans[0] = 'Y';
        ans[1] = 'e';
        ans[2] = 's';
        ans[3] = '\0';
    }
    else
    {
        ans[0] = 'N';
        ans[1] = 'o';
        ans[2] = '\0';
    }
    printf("%s", ans);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int x, y;
  scanf("%d %d", &x, &y);
  
  if (y % 2 != 0) {
    // 足の数が奇数なら不可
    puts("No\n");
    return 0;
  }
  
  if (y > 4 * x) {
    // 全て鶴と仮定したときよりも足の数が多いのは不可
    puts("No\n");
    return 0;
  }
  
  if (y < 2 * x) {
    // 全て亀と仮定したときより足の数が少ないのは不可
    puts("No\n");
    return 0;
  }
  
  if (y / 4 == x) {
    // 全て鶴にすることで可
    puts("Yes\n");
    return 0;
  }
  
  // 亀がx匹いると仮定し、足の数がそれより多ければ(4 - 2)で割り切れるかどうかで判定する
  int allTortoiseLegCount = 2 * x;
  int rest = y - allTortoiseLegCount;
  
  if (rest == 0) {
    // 全て亀にすることで可
    puts("Yes\n");
    return 0;
  }
  
  int craneCount = rest / 2;
  int tortoiseCount = x - craneCount;
  
  if (craneCount * 4 + tortoiseCount * 2 == y) {
    puts("Yes\n");
    return 0;
  }
  
  // 不可
  puts("No\n");
  
  return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
const static long long int MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, h[101];
    llong ans = 0;
    cin >> n;
    int min_ele = 1000;
    rep(i, n) {
        cin >> h[i];
    }

    rep(l, n) {
        while (h[l] > 0) {
            int r;
            for (r = l + 1; r < n; ++r)  {
                if (h[r] == 0) break;
            }

            for (int x = l; x < r; ++x) --h[x];
            ++ans;
        }
    }

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

Measured memory_bytes: 256
def main():
    S = list(input())
    
    Uc = [chr(i) for i in range(65, 65 + 26)] #upper case
    Lc = [chr(i) for i in range(97, 97 + 26)] #lower case
    
    for x in range(len(S)):
        if S[x] in Uc:
            S[x] = Lc[Uc.index(S[x])]
        elif S[x] in Lc:
            S[x] = Uc[Lc.index(S[x])]
        else:
            pass

    for x in range(len(S)):
        if x != len(S) - 1:
            print(S[x], end = "")
        else:
            print(S[x])


if __name__ == "__main__":
    main()

Measured memory_bytes: 7536
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, q; cin >> n >> q;
  string s; cin >> s;
  vector<char> t(q), d(q); REP(i, q) cin >> t[i] >> d[i];
  int lb = 0, ub = n + 1;
  while (ub - lb > 1) {
    int mid = (ub + lb) / 2;
    int pos = mid - 1;
    bool ok = false;
    REP(i, q) {
      if (s[pos] == t[i]) {
        if (d[i] == 'L') --pos;
        else ++pos;
      }
      if (pos < 0) {
        ok = true;
        break;
      }
      if (pos >= n) {
        break;
      }
    }
    (ok ? lb : ub) = mid;
  }
  int ans = lb;
  lb = 0; ub = n + 1;
  while (ub - lb > 1) {
    int mid = (ub + lb) / 2;
    int pos = n - mid;
    bool ok = false;
    REP(i, q) {
      if (s[pos] == t[i]) {
        if (d[i] == 'L') --pos;
        else ++pos;
      }
      if (pos >= n) {
        ok = true;
        break;
      }
      if (pos < 0) {
        break;
      }
    }
    (ok ? lb : ub) = mid;
  }
  ans += lb;
  cout << n - min(ans, n) << '\n';
  return 0;
}


Measured memory_bytes: 976
#include <iostream>
#include <vector>
#include <algorithm>

#define INF 1'000'000'010

using namespace std;

int main()
{
	long long n, w;
	cin >> n >> w;
	long long sum = 0;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		sum += b[i];
	}
	
	vector<vector<long long>> dp(n + 1, vector<long long>(sum + 1, INF));
	dp[0][0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= sum; j++) {
			if (j < b[i]) {
				dp[i + 1][j] = dp[i][j];
			}
			else {
				dp[i + 1][j] = min(dp[i][j], dp[i][j - b[i]] + a[i]);
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= sum; i++) {
		if (dp[n][i] <= w) {
			ans = i;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ff(i, x, n, k) for(int i=x;i<n;i+=k)
#define rf(i, x, n, k) for(int i=n-1;i>=x;i+=k)
#define ef(i, x, n, k) for(int i=x;i<=n;i+=k)
#define pb push_back
#define eb emplace_back
#define pp pop_back
#define mp make_pair
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int MOD = 1e9+7;
const ll INF = pow(10, 18)+5;

int main()
{
	fast_cin();
	int n;cin>>n;
	vector<pair<string,int>> vct(n);
	int k=n;
	ff(i,0,n,1){
		string str;
		int p;
		cin>>str>>p;
		vct[i].F=str;
		vct[i].S=p;
	}
	string x;cin>>x;
	int sum=0;
	bool cond=false;
	for(int i=0;i<k;i++){
		if(cond==true) sum+=vct[i].S;
		if(vct[i].F==x) cond=true;
	}
	cout<<sum<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n+1, 0);
    int num = 1;
    for(int i = 1; i<= n; i++){
        cin >> a[i];
        if(a[i] == num) num++;
    }
    if(num == 1){
        cout << -1 << endl;
        return 0;
    }
    cout << n-num+1 << endl;    
    return 0;
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    int g = 0, mx = 0;
    for(int i = 0; i < n; i ++){
        int a;
        cin >> a;
        g = __gcd(g, a);
        mx = max(mx, a);
    }
    if(mx < k){
        cout << "IMPOSSIBLE";
        return 0;
    }
    if(k % g == 0)
        cout << "POSSIBLE";
    else
        cout << "IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = INT_MAX;
const ll LLINF = LLONG_MAX;
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cout<<"!"<<endl
#define SHOW(a,b) cout<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cout<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;
typedef tuple<int,int,int> tiii;
#define mt make_tuple

ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if(n&1==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}

int main(){
  ll n; cin >> n;
  ll ans = 0;
  while(n >= pow(2,ans,LLINF))
    ans++;
  ans--;
  cout << pow(2,ans,LLINF) << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int n, int left, int mid, int right){
    int n1 = mid-left;
    int n2 = right-mid;
    for(int i=0; i<n1; i++){
        L[i] = A[left+i];
    }
    for(int i=0; i<n2; i++){
        R[i] = A[mid+i];
    }
    L[n1] = R[n2] = SENTINEL;
    int i=0, j=0;
    for(int k=left; k<right; k++){
        cnt++;
        if(L[i] <= R[j]){
            A[k] = L[i++];
        }else{
            A[k] = R[j++];
        }
    }
}

void mergeSort(int A[], int n, int left, int right){
    if(left+1<right){
        int mid = (left+right)/2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

int main(){
    int A[MAX], n, i;
    cnt = 0;
    
    cin >> n;
    for(i=0; i<n; i++) cin >> A[i];
    
    mergeSort(A, n, 0, n);
    
    for(i=0; i<n; i++){
        if(i) cout << " ";
        cout << A[i];
    }
    
    cout << endl;
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 7040
from collections import Counter

def check(s1, s2):
	for i in range(26):
		if s1[i] != s2[i]:
			return False;
	return True

n = int(input())
stuff = []
for _ in range(n):
	d = list(input())
	cnt = [0 for x in range(26)]
	for i in range(10):
		cnt[ord(d[i])-97] += 1
	stuff.append(cnt)

stuff.sort()
span = 1
ans = 0
for i in range(n-1):
	if check(stuff[i+1], stuff[i]):
		span += 1
	else:
		ans += span*(span-1)//2	
		span = 1
ans += span*(span-1)//2
print(ans)




Measured memory_bytes: 39120
#include<stdio.h>
#include<cmath>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int N, K;
	char s[200010];
	int count = 0,mcount=0;
	scanf("%d%d%s", &N, &K, s);
	for (int i = 0; i < N - 1; i++) {
		if (s[i] == s[i + 1]) {
			count++;
		}
		else {
			mcount++;
		}
	}
	if (2 * K <= mcount) {
		printf("%d", count + 2 * K);
		return 0;
	}
	else {
			printf("%d", count + mcount);
			return 0;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    ll n,m,a,b;
    cin>>n>>m;
    vector<pair<ll,ll>> v(n);
    REP(i,n){
        cin>>a>>b;
        v[i]=make_pair(a,b);
    }
    sort(ALL(v));
    ll bottles=0, cost=0, i=0;
    while(bottles<m){
        bottles+=v[i].second;
        cost+=v[i].first*v[i].second;
        if(bottles>=m){
            break;
        }
        i++;
    }
    while(bottles>m){
        bottles--;
        cost-=v[i].first;
    }
    cout<<cost;
}


Measured memory_bytes: 4820
#include <iostream>
#include <cmath>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;

int main () {
	int n;
	cin >> n;
	long ans = 1;
	for(int i = n; i > 0; i--){
		ans *= i;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3028
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)*}
    };
}

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

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, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        s:chars,
    }
    let ans = match s[0] {
        'S' => "Cloudy",
        'C' => "Rainy",
        'R' => "Sunny",
        _ => unreachable!(),
    };
    println!("{}",ans);
}


fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


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

int main()
{
    int N, R, result;
    cin >> N >> R;

    if (N < 10)
    {
        result = 100 * (10 - N) + R;
    }
    else
    {
        result = R;
    }
    cout << result << endl;
}

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

#ifndef DEBUG
#define endl '\n'
#define debug(...)
#else
#define debug(...) __VA_ARGS__
#endif
#define debugf(...) debug(printf(__VA_ARGS__);)

const int N = 2e5 + 5;

int a[N];
map<int, int> f;



int (((((main)))))() <%
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int n; cin >> n;
    using ll = long long;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        int x; cin >> x;
        ans += f[i - x];
        f[i + x]++;
    }
    cout << ans << endl;

    return 0;
%>

Measured memory_bytes: 20552
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset>
using namespace std;
typedef long long ll;
int main(void)
{
	ll n;
	cin>>n;
	n/=200;
	n=10-n;
	cout<<n;
}

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

def solve(W, H, N, X, Y, A):
    dp = [[0]*(W) for i in range(H)]
    count = 0
    
    for i in range(N):
        x_now, y_now, a_now = X[i], Y[i], A[i]
        if(a_now == 1):
            for i in range(H):
                for j in range(x_now):
                    dp[i][j] = 1
        if(a_now == 2):
            for i in range(H):
                for j in range(x_now, W):
                    dp[i][j] = 1
        if(a_now == 3):
            for i in range(y_now):
                for j in range(W):
                    dp[i][j] = 1
        if(a_now == 4):
            for i in range(y_now, H):
                for j in range(W):
                    dp[i][j] = 1
    
    for i in range(H):
        count += dp[i].count(0)
    print(count)
    
if __name__ == '__main__':
    W, H, N = map(int, input().split())
    X, Y, A = [], [], []
    for i in range(N):
        x, y, a = map(int, input().split())
        X.append(x)
        Y.append(y)
        A.append(a)
    
    solve(W, H, N, X, Y, A)

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#include<iomanip>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

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

//階乗
ll fact(ll a) {
	int ans = 1;
	for (int i = 1; i <= a; i++) {
		ans *= i;
	}
	return ans;
}

//コンビネーション
ll combi(ll a, ll b) {
	return fact(a) / (fact(b) * fact(a - b));
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<int>a(m);
	rep(i, m) { cin >> a[i]; }

	int takes = 0;
	rep(i, a.size()) {
		takes += a[i];
	}

	if (n - takes >= 0) {
		cout << n - takes << endl;
	}
	else cout << -1 << endl;

	return 0;
}


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

#define FAST ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PER(j,n,a) for (int j=n-1;j>=a;j--)
#define REP(i,a,n) for (int i=a;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define show(x) cout<<(x)<<endl
#define UM unordered_map
#define PB push_back
#define V vector
#define EPS 1e-8
#define fi first;
#define se second;
typedef unsigned long ul;
typedef long long ll;
typedef string str;
typedef pair<int,pair<int,int> > pii;
/*FIN*/
V<int> dr{-1,0,1,0}, dc{0,1,0,-1};
int h,w,sr,sc,tr,tc,r,c,nr,nc;

bool valid(int i, int j) {
	if(i<0 or i>=h) return 0;
	if(j<0 or j>=w) return 0;
	return 1;
}

int main() {
	FAST;
	cin>>h>>w;
	cin>>sr>>sc;
	sr--;sc--;
	cin>>tr>>tc;
	tr--;tc--;
	str grid[h];
	REP(i,0,h) cin>>grid[i];

	V<V<int> > ans(h,V<int>(w,-1));
	V<V<bool> > vis(h,V<bool>(w,0));
	priority_queue<pii> q;
	pii pr;
	pair<int,int> g;

	q.push({0,{sr,sc}});
	while(!q.empty()) {
		pr = q.top();
		q.pop();
		g = pr.se;

		r = g.fi;
		c = g.se;

		if(vis[r][c])
			continue;
		vis[r][c]=1;
		ans[r][c] = -pr.fi;
		REP(i,0,4) {
			nr = r+dr[i], nc=c+dc[i];
			if(valid(nr,nc)) {
				if(grid[nr][nc]=='#') continue;
				if(!vis[nr][nc])
					q.push({-ans[r][c],{nr,nc}});
			}
		}
		REP(i,r-2,r+3) {
			REP(j,c-2,c+3) {
				if(valid(i,j)) {
					if(grid[i][j]=='#') continue;
					if(!vis[i][j])
						q.push({-1-ans[r][c],{i,j}});
				}
			}
		}
	}
	show(ans[tr][tc]);
	return 0;
}



Measured memory_bytes: 10012
#include<stdio.h>
#include<algorithm>
using namespace std;
int UF[100];
pair<int,pair<int,int> > edge[10000];
int FIND(int a){
	if(UF[a]<0)return a;
	return UF[a]=FIND(UF[a]);
}
void UNION(int a,int b){
	a=FIND(a);
	b=FIND(b);
	if(a!=b){
		if(UF[a]<UF[b]){
			int val=a;
			a=b;
			b=val;
		}
		UF[b]+=UF[a];
		UF[a]=b;
	}
	return;
}
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		for(int i=0;i<a;i++)UF[i]=-1;
		for(int i=0;i<b;i++){
			int c,d,e;
			scanf("%d%d%d",&c,&d,&e);
			edge[i]=make_pair(e,make_pair(c,d));
		}
		std::sort(edge,edge+b);
		int ret=0;
		for(int i=0;i<b;i++){
			if(FIND(edge[i].second.first)!=FIND(edge[i].second.second)){
				ret+=edge[i].first;
				UNION(edge[i].second.first,edge[i].second.second);
			}
		}
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 0
from itertools import accumulate
from sys import stdin

def main():
    N = int(input())
    A = list(map(int, input().split()))

    a = sorted(A)
    while 1:
        ans = a[0]
        a = [i % ans for i in a]
        a[0] = ans
        if len(a) == 1:
            break
        a = [i for i in a if i > 0]
        a.sort()
    print(ans)

input = lambda: stdin.readline()
main()


Measured memory_bytes: 14140
N = int(input())

def solve(N):
  fmt = '{} {}'
  ans = []
  sub = []
  if N % 2 == 1:
    ans = solve(N - 1)
    for i in range(1, N):
      ans.append(fmt.format(i, N))
  else:
    for i in range(1, N + 1):
      for j in range(i + 1, N + 1):
        if j == N - i + 1: continue
        ans.append(fmt.format(i, j))
  return ans

ans = solve(N)
print(len(ans))
[print(a) for a in ans]


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

int main()
{
  int n;
  for(;cin>>n,n;)
    {
      int data[n];
      for(int i=0;i<n;i++)
	{
	  cin>>data[i];
	}
      int s;
      cin>>s;
      int hi=0,lo=n-1;
      int cnt=0;
      while(true)
	{
	  int p = (hi+lo)/2;

	  //	  cout<<"HI:"<<hi<<" LO:"<<lo<<" "<<cnt<<endl;
	  //	  cout<<"data[p]:"<<data[p]<<" s:"<<s<<endl;
	  if(hi>lo)
	    break;
	  cnt++;
	  if(data[p]==s)
	      break;
	  else if(data[p]<s)
	    hi=p+1;
	  else
	    lo=p-1;
	}
      cout<<cnt<<endl;
    }
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a  = sc.next();
		String b  = sc.next();
	
		if(a.equals("H")) {
			if(b.equals("H")) {
				System.out.println("H");
			} else {
				System.out.println("D");
			}
		} else {
			if(b.equals("H")) {
				System.out.println("D");
			} else {
				System.out.println("H");
			}
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

ll F(ll N, ll a, ll p){

    if(a == 0)return 1;

    if(a%2 == 0 && a != 0)return (F(N, a/2, p)*F(N, a/2, p))%p;

    if(a%2 == 1)return N*F(N, a - 1, p)%p;

}

int main(){
ll N, a, b, Ans = 0;cin >> N >> a >> b;
ll prime = 1000000007;

Ans += (F(2, N, prime) - 1)%prime;

ll Xa = N%prime, Ya = 1, Xb = N%prime, Yb = 1;

rep(i, 1, a){

    Xa *= (N - i);Xa %= prime;

}

rep(i, 1, b){

    Xb *= (N - i);Xb %= prime;

}
  
rep(i, 0, a){

    Ya *= (a - i);Ya %= prime;

} 
  
rep(i, 0, b){

    Yb *= (b - i);Yb %= prime;

} 

Ans -= ( F(Ya, prime - 2, prime)*Xa )%prime; 
Ans -= ( F(Yb, prime - 2, prime)*Xb )%prime;

cout << (Ans + 2*prime)%prime;
}

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

int main(){
  ll N,M,i,t=0;
  string S;
  cin >> N >> M >>S;
  vector<ll> ans(N);
  i=N;
  while(i>0){
    if(i-M<=0){
      ans.at(t)=i;
      t++;
      break;
    }
    ll x=M;
    while(S.at(i-x)=='1'){
      x--;
      if(x==0){
        cout << -1 << endl;
        return 0;
      }
    }
    ans.at(t)=x;
    i-=x;
    t++;
  }
  rep(j,t){
    cout << ans.at(t-j-1) << " ";
  }
  cout << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

//ユークリッドの互除法 O(log a)
int gcd(int a, int b){
	if(b > a) swap(a, b);
	int tmp;
	while(b != 0){
		tmp = a % b;
		a = b;
		b = tmp;
	}
	return a;
}

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

	int N,K;
	cin >> N >> K;
	int A[100000];
	int m = 0;
	for(int i=0; i<N; i++){
		cin >> A[i];
		m = max(m, A[i]);
	}
	int tmp = A[0];
	for(int i=1; i<N; i++) tmp = gcd(tmp, A[i]);
	if(K % tmp == 0 && K <= m) cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;

	return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(vc.empty()) return "";
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}

template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}

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

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

const ld pi = 3.14159265358979323846264338327950288419716939937510582097494459;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	ld a, b, h, m;
	cin >> a >> b >> h >> m;
	h = h * 60 + m;
	ld delta = abs(h / (12 * 60) - m / 60);
	if(delta > 0.5) delta = 1 - delta;
	debug(delta);
	delta *= pi * 2;
	ld sq = a * a + b * b - 2 * a * b * cos(delta);
	ld ans = sqrt(sq);
	cout << fixed << setprecision(12) << ans << '\n';
}



Measured memory_bytes: 4180
import           Control.Applicative
import qualified Control.Monad       as Monad
import           Data.List

main :: IO ()
main = loop 1

loop :: Int -> IO ()
loop n = do
    arg <- getLine
    Monad.when (arg /= "0") $ do
        putStrLn $ "Case " ++ show n ++ ": " ++ arg
        loop $ n + 1

Measured memory_bytes: 3892
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int main(){
	int a,n;
	while(cin>>n>>a,n){
		double out=inf;
		rep(i,n+1)out=min(out,abs(a-hypot(i,n-i)));
		cout<<shosu(9)<<out<<endl;
	}
}


Measured memory_bytes: 3236
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
 
namespace Atcoder_Answer
{
    class Program
    {
        const Int32 mod = 1000000007;
 
        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            int[] Members = Enumerable.Repeat(0, N).ToArray();
 
            string[] Reader = ReadLine().Split(' ');
            foreach (string str in Reader) Members[int.Parse(str) - 1]++;
 
            foreach (int mems in Members) WriteLine(mems.ToString());
 
            ReadKey();
        }
    }
 
    public static class Extension
    {
        #region 拡張:bool
        #region キャスト関連
        public static int ToInt(this bool Bool)
        {
            if (Bool) return 1;
            else return 0;
        }
 
        public static string ToString(this bool Bool, string TrueStr, string FalseStr)
        {
            if (Bool) return TrueStr;
            else return FalseStr;
        }
        #endregion
        #endregion
 
        #region 拡張:int
        #region キャスト関連
        public static char ToAlphaBets(this int Base) => (char)Base;
        #endregion
        #endregion
 
        #region 拡張:char
        #region 変換関連
        public static char NextAlpha(this char Char) => (char)((Char) + 1); //次の文字を取得
        #endregion
        #endregion
 
        #region 拡張:int[]
        public static long Sum(this int[] Array)
        {
            int Ret = 0;
            for (int loop = 0; loop < Array.Length; loop++) Ret += Array[loop];
            return Ret;
        }
        #endregion
 
        #region 拡張: string
        public static string Multi(this string THIS, int Value)
        {
            string RetValue = "";
 
            for (int loop = 0; loop < Value; loop++) RetValue += THIS;
 
            return RetValue;
        }
        #endregion
 
        #region 拡張: List<string>
        public static string Sum(this List<string> THIS, string Split)
        {
            string RetValue = "";
 
            for (int loop = 0; loop < THIS.Count; loop++)
            {
                RetValue += THIS[loop];
            }
 
            return RetValue;
        }
        #endregion
    }
}

Measured memory_bytes: 39364
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  ll n, k;
  cin >> n >> k;
  vector<Pll> vec(n);
  rep(i,n) cin >> vec[i].first >> vec[i].second;
  sort(vec.begin(),vec.end());
  ll cnt = 0;
  rep(i,n) {
    cnt += vec[i].second;
    if(cnt>=k) {
      cout << vec[i].first << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(){

	int A,B;

	scanf("%d %d",&A,&B);

	int C;

	for(C=1;C<=3;C++){
		if((A*B*C)%2==1){
			printf("Yes\n");
			return 0;
		}
	}

	printf("No\n");

return 0;
}

Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

ans=b[a[0]-1]

for i in range(1,n):
  ans+=b[a[i]-1]
  if a[i]==a[i-1]+1 :
    ans+=c[a[i-1]-1]
print(ans)




Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,n)for(int i=0;i<n;++i)
using namespace std;
int I=1e9,n,k,s,t,a;
int main(){
	cin>>n>>k;s=2*n,t=s+1;
	atcoder::mcf_graph<int,long long>g(n*2+2);
	g.add_edge(s,t,n*k,I);
	rep(i,n){
		g.add_edge(s,i,k,0),g.add_edge(i+n,t,k,0);
		rep(j,n)cin>>a,g.add_edge(i,j+n,1,I-a);
	}
	cout<<1LL*k*n*I-g.flow(s,t,n*k).second<<endl;
	vector grid(n,string(n,'.'));
	for(auto e:g.edges())if(e.from!=s&&e.to!=t&&e.flow>0)grid[e.from][e.to-n]='X';
	for(auto s:grid)cout<<s<<endl;
}

Measured memory_bytes: 3928
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  for(int i=0; i<n; i++) cin >> p[i];
  int ans = 0;
  for(int i=0; i < n-2; i++){
    if(p[i] < p[i+1] && p[i+1] < p[i+2]) ans++;
    if(p[i] > p[i+1] && p[i+1] > p[i+2]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
using namespace std;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
//#define en cout << endl //セミコロンつけろ
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};


template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

long long pow_mod(long long n,long long k,long long m){
    if (k == 0){
        return 1;
    } else if (k % 2 == 1){
        return pow_mod(n,k-1,m)*n % m;
    } else {
        long long t = pow_mod(n,k/2,m);
        return t*t % m;
    }
}

int main(){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    vector<int> t;
    int now = 1,cnt = 0;
    for(int i = 0; i < n; i++){
        if (s[i] == (char)(now+'0')) cnt++;
        else {
            t.push_back(cnt);
            now = 1-now;
            cnt = 1;
        }
    }
    t.push_back(cnt);
    if ((int)t.size() % 2 == 0) t.push_back(0);

    int ans = 0;
    int len = t.size();
    int sum[100010] = {0};
    for(int i = 0; i < len; i++){
        sum[i+1] = sum[i]+t[i];
    }
    for(int i = 0; i < len+1; i += 2){
        int left = i;
        int right = min(i+2*k+1,len);
        int tmp = sum[right] - sum[left];
        ans = max(ans,tmp);
    }
    cout << ans << endl;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> vec(N);
    rep(i,N){
        cin >> vec[i];
    }
    int heal = 0;
    rep(i,N - 1){
        for (int j = i + 1; j < N; j++){
            heal += vec[i] * vec[j];
        }
    }
    cout << heal << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    vl x(n),y(n);
    ld res=0,cnt=0;
    rep(i,n){
        cin >> x[i] >> y[i];
    }
    rep(i,n-1){
        FOR(j,i+1,n){
            res+=sqrt(pow(x[i]-x[j],2)+pow(y[i]-y[j],2));
            cnt++;
        }
    }
    cout << fixed << setprecision(20) << res/(cnt)*(n-1) << endl;
}

Measured memory_bytes: 3848
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    if(n % 9 == 0){
        if(n / 9 < 10){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else if(n % 8 == 0){
        if(n / 8 < 10){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else if(n % 7 == 0){
        if(n / 7 < 10){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else if(n % 6 == 0){
        if(n / 6 < 10){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else if(n % 5 == 0){
        if(n / 5 < 10){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else if(n % 4 == 0){
        if(n / 4 < 10){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else if(n % 3 == 0){
        if(n / 3 < 10){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else if(n % 2 == 0){
        if(n / 2 < 10){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        if(n < 10){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return(0);
}



Measured memory_bytes: 256
import itertools

N = int(input())
P = list(map(int ,input().split()))
Q = list(map(int ,input().split()))

l = list(range(1, N+1))
p = [list(v) for v in itertools.permutations(l, len(l))]

a = p.index(P)+1
b = p.index(Q)+1

print(abs(a - b))


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

int k, tot;
long long res;

inline void dfs(int len, int resLen, long long lst) {
    if (len == resLen) {
        ++tot;

        if (tot == k) {
            res = lst;
        }

        lst /= 10;
        return;
    }

    long long lowest = lst % 10;

    for (long long i = lowest - 1; i <= lowest + 1; ++i) {
        if (i >= 0 && i <= 9) {
            dfs(len + 1, resLen, lst * 10LL + i);
        }
    }
}

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

    cin >> k;

    for (int resLen = 1; resLen <= 10; ++resLen) {
        for (int fst = 1; fst <= 9; ++fst) {
            dfs(1, resLen, fst);

            if (res) {
                cout << res << endl;

                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,gcd;
  scanf("%d%d",&a,&b);
  if(a<b){
    a=a+b;
    b=a-b;
    a=a-b;
  }
  while(b>0){
    gcd = a%b;
    a=b;
    b=gcd;
  }
  printf("%d\n",a);
  return 0;
}

Measured memory_bytes: 592
#include <cstdio>


int main(){
	unsigned n,m,l;
	unsigned A[100][100];
	unsigned B[100][100];
	unsigned long C[100][100];

	for(auto &v : C){
		for(auto &v1 : v){
			v1 = 0;
		}
	}

	scanf("%u%u%u",&n,&m,&l);
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			scanf("%u",&A[i][j]);
		}
	}

	for(int i=0;i<m;i++){
		for(int j=0;j<l;j++){
			scanf("%u",&B[i][j]);
		}
	}

	for(int i=0;i<n;i++){
		for(int j=0;j<l;j++){
			for(int k=0;k<m;k++){
				C[i][j] += A[i][k]*B[k][j];
			}
		}
	}

	for(int i=0;i<n;i++){
		for(int j=0;j<l;j++){
			if(j)putchar(' ');
			printf("%lu",C[i][j]);
		}
		putchar('\n');
	}
}

Measured memory_bytes: 1180
from collections import defaultdict, deque
import sys

sys.setrecursionlimit(100000)

MIN = -10 ** 9
MAX = 10 ** 9 + 7


def main():
    N = int(input())
    A = [
        int(input())
        for _ in range(N)
    ]
    # N, D = [int(a) for a in input().split()]
    b = sorted(A)
    l1, l2 = b[-1], b[-2]
    if l1 == l2:
        for i in range(N):
            print(l1)
        return
    for a in A:
        if a == l1:
            print(l2)
        else:
            print(l1)


if __name__ == '__main__':
    main()


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

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

int main() {
    int a, b;
    cin >> a >> b;
    cout << 6 - (a + b) << endl;
    return 0;
}


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

#define Int long long int
#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()

int main(){
    int num;
    Int r,n=0;

    cin >> num;
    vector<Int> a(num);
    int mai;
    REP(i,num){
        cin >> a[i];
        if(n<a[i])mai=i;
        n = max(n,a[i]);
    }

    Int mi=1000000000;
    REP(i,num){
        if(mi>abs(n/2-a[i])&&i!=mai){
            mi=abs(n/2-a[i]);
            r=a[i];
            //cout << i << ":" <<r<<":"<<mi<< endl;
        }else if(mi==abs(n/2-a[i])&&mai!=i){
            if((n+1)/2-r>(n+1)/2-a[i]){
                r=a[i];
            }
        }
    }

    cout << n << " " << r << endl;
}


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

using namespace std;

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<char>> s = vector<vector<char>>(h, vector<char>(w));
	for (auto &k : s) {
		for (auto &l : k) {
			cin >> l;
		}
	}

	for (auto &k : s) {
		for (int i = 0; i < 2; ++i) {
			for (auto &l : k) {
				cout << l;
			}
			cout << "\n";

		}
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <algorithm>
#include <string>

using namespace std;

void hoge(int x, int y)
{
    int counter = 0;
    string str1(y, '#'); // header and footer
    string str2(y-2, '.');
    string str3 = "#" + str2 + "#";
    while(counter < x) {
        if (counter == 0 || counter == x-1){
        cout << str1 << endl;
        }else {
            cout << str3 << endl;
        }
        
        counter += 1;
    }
    cout << endl;
    counter = 0;
}

int main()
{
    int H, W;
    while(cin >> H >> W, H+W != 0) {
        hoge(H,W);
    }
}




Measured memory_bytes: 3160
def insertion_sort(A, n):
    for i in range(n):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1], A[j] = A[j], A[j+1]
            j-=1
        A[j+1] = v
        print(*A)
    
n = int(input())
A = list(map(int, input().split()))
insertion_sort(A, n)


Measured memory_bytes: 5976
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " = " << x << ", ";
#define ll long long
#define pb push_back
using namespace std;
#define FAST_IO                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
const int INF = 1e9 + 7;

int main()
{
    FAST_IO
    int n, W;
    cin >> n >> W;
    vector<int> w(n), v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> w[i] >> v[i];
    }
    vector<vector<int>> dp(n+1, vector<int>(100010, INF));
    dp[0][0] = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= 100007; j++)
        {
            dp[i+1][j] = min(dp[i][j], (j - v[i] >= 0 ? w[i] + dp[i][j - v[i]] : INF));
        }
    }
    ll ans = 0;
    for (ll i = 0; i <= 100007; i++)
    {
        if (dp[n][i] <= W)
        {
            ans = max(ans, i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 40192
#include <stdio.h>
#include <string.h>
int main() {
	int k;
	char s[101];
	scanf("%d%s", &k, s);
	if (strlen(s) <= k) {
		printf("%s\n", s);
	} else {
		for (int i = 0; i < k; i++) {
			printf("%c", s[i]);
		}
		printf("...\n");
	}
	return 0;
}

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

int main()
{
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    printf("%lf ",(w*h*1.0)/2);
    printf("%d", ((2*x==w)&&(2*y==h))?1:0);
}


Measured memory_bytes: 256
from collections import deque

N = int(input())

A = {}
COLOR = [1] * N

for _ in range(N - 1):
  u, v, w = map(int, input().strip().split(' '))
  if u not in A: A[u] = {}
  if v not in A: A[v] = {}
  A[u][v] = w
  A[v][u] = w


def test(key, total_w=0):
  if key not in A:
    return

  COLOR[key - 1] = 0 if total_w % 2 == 0 else 1

  v = A.pop(key)
  for k, w in v.items():
    test(k, w + total_w)


queue = deque()
queue.append((1, 0))
current_key = 1

while len(queue) > 0:
  key, w = queue.popleft()
  if key not in A:
    continue

  COLOR[key - 1] = 0 if w % 2 == 0 else 1

  for child in A.pop(key).items():
    if child[0] in A:
      queue.append((child[0], w + child[1]))

for c in COLOR:
  print(c)

Measured memory_bytes: 49840
n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

cumsum = [0] * n
cumsum[0] = a[0]
for i in range(1, n):
    cumsum[i] = cumsum[i - 1] + a[i]

ans = 0
for i in range(n):
    ans += a[i] * (cumsum[-1] - cumsum[i]) % mod

print(ans % mod)


Measured memory_bytes: 31432
#include <iostream>
#define MOD 998244353
using namespace std;
typedef long long ll;
ll dp[3001][3001],n,s,a,ans;
int main(void){
    cin>>n>>s;
    dp[0][0]=1;
    for(int i=0;i<n;i++){
        cin>>a;
        for(int j=0;j<s;j++){
            dp[i+1][j]+=dp[i][j];
            dp[i+1][j]%=MOD;
            if(a+j<=s&&j==0)dp[i+1][a+j]+=i+1;
            else if(a+j<=s&&dp[i][j]>0)dp[i+1][a+j]+=dp[i][j];
            dp[i+1][a+j]%=MOD;
        }
        ans+=dp[i+1][s]*(n-i)%MOD;
        ans%=MOD;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 70656