akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <bitset>

using ll = long long int;
using ul = unsigned long long int;

namespace lamlib
{
	// Absolute
	template<class T> inline T abs(const T &a){ return (a>0) ? a : -a; }
	// GCD: a > b
	ul gcd(ul a,ul b) { return (!b) ? a : gcd(b,a%b); }
}

int main(int argc,char *argv[])
{
	ll a,b;
	std::cin >> a >> b;
	
	for(ll i = 1;i < 1100;++i)
	{
		if ((i*8)/100 == a && (i*10)/100 == b)
		{
			std::cout << i << std::endl;
			return 0;
		}
	}

	std::cout << -1 << std::endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	ll a,b,c,d;cin>>a>>b>>c>>d;
	ll f1;
	if(a%c!=0)f1=a+(c-a%c);
	else f1=a;
	ll l1=b-b%c;
	ll n1=(l1-f1)/c+(ll)1;
	ll f2;
	if(a%d!=0)f2=a+(d-a%d);
	else f2=a;
	ll l2=b-b%d;
	ll n2=(l2-f2)/d+(ll)1;
	ll lcm=(c*d)/gcd(c,d);
	ll fc;
	if(a%lcm!=0)fc=a+(lcm-a%lcm);
	else fc=a;
	ll lc=b-b%lcm;
	ll nc=(lc-fc)/lcm+1;
	ll res=(b-a+1)-(n1+n2-nc);
	cout<<res;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, l;
    cin >> n >> l;
    int sum = 0;
    rep(i, 1, n + 1) sum += (l + i - 1);
    int ans = 0;
    int mn = INF;
    rep(i, 1, n + 1) {
        int tmp = 0;
        rep(j, 1, n + 1) {
            if (j != i) tmp += (l + j - 1);
        }
        if (abs(sum - tmp) < mn) {
            mn = abs(sum - tmp);
            ans = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}


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

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

# 列車情報
# T[l] 都市l発の列車の目的都市
T = [[] for l in range(N + 1)]
for i in range(M):
    l, r = map(int, input().split())
    T[l].append(r)

# nt[l][q] 都市l発で都市q以前に止まる列車数
nt = [[0] * (N + 2) for l in range(N + 1)]
for i in range(1, N + 1):
    T[i].append(N + 1)  # 番兵
    T[i].sort()
    prev = 0
    for r in T[i]:
        if r != prev:
            for j in range(prev + 1, r + 1):
                nt[i][j] = nt[i][prev]
            prev = r
        nt[i][r] += 1

# nt[p][q] 都市p以降発で都市q以前に止まる列車数
for i in range(N - 1, 0, -1):
    for j in range(1, N + 1):
        nt[i][j] += nt[i + 1][j]

# 問い合わせ
for i in range(Q):
    p, q = map(int, input().split())
    print(nt[p][q])


Measured memory_bytes: 15960
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=100005;
int n,cnt[maxn];
inline void init(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		cnt[x]++; cnt[x+1]++; cnt[x-1]++;
	}
	sort(cnt,cnt+1+100000);
	printf("%d\n",cnt[100000]);
}
int main(){
	init();
	return 0;
}

Measured memory_bytes: 512
import bisect

def main():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    a_culm = [0]
    for i in range(n):
        a_culm.append(a_culm[-1] + a[i])
    b_culm = [0]
    for i in range(m):
        b_culm.append(b_culm[-1] + b[i])

    ans = 0
    for i in range(n+1):
        rem = k - a_culm[i]
        if rem < 0:
            break
        b_count = bisect.bisect(b_culm, rem) - 1
        if i + b_count > ans:
            ans = i + b_count

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 47476
function main(input) {
    var n = parseInt(input);

    var map = {};
    for (var i = 2; i <= n; i++) {
        var t = i;
        for (var j = 2; j * j <= t; j++) {
            if (t % j == 0) {
                var cnt = 0;
                while (t % j == 0) {
                    cnt++;
                    t /= j;
                }
                if (map[j]) {
                    map[j] = map[j] + cnt;
                } else {
                    map[j] = cnt;
                }
            }
        }
        if (t != 1) {
            if (map[t]) {
                map[t]++;
            } else {
                map[t] = 1;
            }
        }
    }

    var ans = 1;
    var mod = 1000000007;
    for (var x in map) {
        ans = (ans * (map[x] + 1)) % mod;
    }

    console.log(ans);
}

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

Measured memory_bytes: 6904
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

int main(){ 
  Int N,A,B,q,d;
  cin >> N >> A >> B;
  
  q = N / (A + B);
  d = N % (A + B);
  
  cout << A * q + min(A,d) << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <unordered_map>
#define Debug 0
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

//最大公約数
template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//最小公倍数
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fast_input() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}


int main(){
    string S; cin >> S;
    int cnt[2] = {0};
    int color = 1;
    for (int i = 0; i < S.length(); i++) {
        if (S[i] != (char)(color+'0')) cnt[0]++;
        color ^= 1;
    }
    color = 0;
    for (int i = 0; i < S.length(); i++) {
        if (S[i] != (char)(color+'0')) cnt[1]++;
        color ^= 1;
    }
    cout << min(cnt[0], cnt[1]) << endl;

}




Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

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

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}

void solve() {
    ll a, b, c, d; cin >> a >> b >> c >> d;
    ll ans = b - a + 1;
    ll r1 = b/c, r2 = b/d;
    ll l1 = (a-1)/c, l2 = (a-1)/d;
    ll q = lcm(c, d);
    ll r3 = b/q, l3 = (a-1)/q;
    ll m = (r1-l1)+(r2-l2)-(r3-l3);
    cout << ans - m << endl;
}

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

    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int k, n; cin >> k >> n;
	VI a(n); REP(i,n) cin >> a[i];
	ll p=0;
	REP(i,n)
		p=max(p,a[i]-(i==0?a[n-1]-k:a[i-1]));
	cout << k-p << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
   
    
    if(a < c)
    {
        if(b < c)
        {
            printf("0\n");
        }
        else
        {
            if(b < d)
            {
                printf("%d\n",b-c);
            }
            else
            {
                printf("%d\n",d-c);
            }
        }
    }
    
    else // c < a
    {
        if(d < a)
        {
            printf("0\n");
        }
        else // a < d
        {
            if(d < b)
            {
                printf("%d\n",d-a);
            }
            else
            {
                printf("%d\n",b-a);
            }
        }
    }
    
    return 0;
}


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

int main()
{
	int n,bai,shi,ge;
	cin>>n; //123
	
	bai=n/100;
	shi=(n/10)%10;
	ge=n%10;
	
	if(shi==7||ge==7||bai==7)  cout<<"Yes";
	else cout<<"No";
	
	return 0;
}

Measured memory_bytes: 3636
#!/usr/bin/env python3
#ABC87 B

a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                ans += 1
print(ans)


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

using namespace std;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
	
	int N,M; cin>>N>>M;
	vector<int> S(N), T(M);
	for (auto& s : S) cin>>s;
	for (auto& t : T) cin>>t;

	const unsigned long MOD = 1e9+7;
	vector<unsigned long> dp[2];
	dp[0].resize(M+1, 1);
	dp[1].resize(M+1, 0);
	for (int i = 1; i <= N; i++) {
        auto dpi = i%2;
        auto& cdp = dp[dpi];
        auto& pdp = dp[!dpi];
        cdp[0] = pdp[0];
	    for (int j = 1; j <= M; j++) {
	        cdp[j] = cdp[j-1] + pdp[j];
	        if (S[i-1] != T[j-1])
	            cdp[j] += MOD - pdp[j-1];
	        cdp[j] %= MOD;
	    }
	}
	cout << dp[N%2][M] << endl;
	
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
MONSTER = sum(A)
for i in range(N):
    if A[i] > B[i]:
        A[i] -= B[i]
    else:
        USED = A[i]
        A[i] = 0
        A[i+1] = max(0, A[i+1] - (B[i] - USED))

ans = MONSTER - sum(A)
print(ans)

Measured memory_bytes: 18624
#include <iostream>
using namespace std;
int gcd (int a, int b) {
	return b ? gcd (b, a % b) : a;
}
int main(){
	int k;
	cin>>k;
	int a,b,c;
	int sum=0;
	for(a=1;a<=k;a++){
		for(b=1;b<=k;b++){
			for(c=1;c<=k;c++){
				sum+=gcd(a,gcd(b,c));
			}
		}
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define   vpll   vector<pll >
#define   all(x) x.begin(),x.end()
#define   present(c,x)    ((c).find(x) != (c).end())
#define   dbg(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){
  std::cerr << name << " = " << arg1 << "\n";
}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    std::cerr.write(names, comma - names) << " = " << arg1;
    ZZ(comma, args...);
}
#define   sz(a)  a.size()
#define   vll vector<int>
#define   pll pair<int,int>
#define   ff  first
#define   ss  second
#define   br  cout<<"\n";
#define   ld  long double
#define   int  long long int
const int  INF = 1e18+7;
const int  MAX = 1234567;
const int  MOD = 1000000007;
 
 
 
void solve(){
    int N , x , y ;
    cin >> N >> x >> y ;
    map < int , int > sd ;
    for ( int start = 1 ; start < N ; start++ ){
    	for ( int end = start + 1 ; end <= N ; end++ ){
    		if ( start <= x ){
    			if ( end >= y ){
                    int mi = x - start + 1 + end - y ;
    				sd[  mi ]++ ;
    			}
                else if ( end <= x ){
                    sd[ end - start ]++;
                }
                else{
                    int mi = min ( end - x , y - end + 1 ) ;
                    sd[x-start+mi]++ ;
                }

    		}
    		else if ( start < y and start > x ){
                int mi = min ( end - start , start - x + 1 + abs ( y - end ) ) ;
    			sd[ mi] ++ ;
    		}
            else
                sd[end-start] ++ ;
    	}
    }
    for ( int i = 1 ; i < N ; i++ )
    	cout << sd[i] << "\n" ;
}
int32_t main(){
    int t;
    t=1;
    cin.sync_with_stdio(0), cin.tie(0);
    //cin>>t;
    while(t--){
        solve();
        br;
    }
    return 0;
}
 
 
 
 

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	
	priority_queue<pair<int,int> > h;
	while(a--)
	{
		int w;
		cin>>w;
		h.push(make_pair(w,1));
	}
	while(b--)
	{
		int w;
		cin>>w;
		h.push(make_pair(w,2));
	}
	while(c--)
	{
		int w;
		cin>>w;
		h.push(make_pair(w,3));
	}
	int z=x+y,ans=0;
	while(z)
	{
		pair<int,int> f=h.top();
		h.pop();
		if(f.second==3)
		{
			ans+=f.first;
			z--;
		}
		if(f.second==1 && x)
		{
			ans+=f.first;
			z--;
			x--;
		}
		if(f.second==2 && y)
		{
			ans+=f.first;
			z--;
			y--;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 10604
#include<iostream>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	char a[51][51],b[51][51];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>a[i][j];
		}
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<m;j++){
			cin>>b[i][j];
		}
	}
	for(int i=0;i<=n-m;i++){
		for(int j=0;j<=n-m;j++){
			int p=0; 
			for(int k=0;k<m;k++){
				for(int l=0;l<m;l++){
					if(a[i+k][j+l]!=b[k][l]){
						p=1;
						break;
					}
				}
				if(p==1){
					break;
				}
			}
			if(p==0){
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <cmath>

using namespace std;

const int len = 100010;
int a,b;

int main() {
	cin >> a >> b;
	if (a%3 ==0 || b%3 == 0 || (a+b)%3 == 0) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
	return 0;
} 

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

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

using Graph = vector<vector<int>>;

ll kzyou(ll a,ll k){//aのk乗を返す
    ll zyou = 1;
    for(ll i = 1;i<=k;i++){
        zyou *= a;
    }
    return zyou;
}
typedef pair<int,int> P;


int main(){
  ll A,B,K;
  cin >> A >> B >> K;
  ll a = A;
  ll b = B;
  if(A >= 1){
    if(A >= K) a -= K;
    else if(A < K){
      a= 0;//残りK-A回

      if(B >= 1){
        //cout << K -A << endl;
        if(B >= K-A) b -= K-A;
        else if(B < K -A) b = 0;
      }
    }
  }
  else if(A == 0){
    if(B >= K) b -= K;
    else if(B < K) b = 0;
  }
  cout << a << " " << b << endl;
 }

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int N = 100005;

int n, mod;
int down[N];
int up[N];
map <int, int> id[N];
vector <int> adj[N], pre[N], suf[N];

void dfs(int u, int p) {
  down[u] = 1;
  for (int v : adj[u]) {
    if (v == p) continue;
    dfs(v, u);
    id[u][v] = pre[u].size();
    down[u] = (1ll * down[u] * (down[v] + 1)) % mod;
    pre[u].push_back(down[u]);
  }
  int cur = 1;
  for (int i = adj[u].size() - 1; i >= 0; i--) {
    int v = adj[u][i];
    if (v == p) continue;
    cur = (1ll * cur * (down[v] + 1)) % mod;
    suf[u].push_back(cur);
  }
  reverse(suf[u].begin(), suf[u].end());
}

void dfs1(int u, int p) {
  up[u] = 1;
  if (p != -1) {
    up[u] = up[p];
    int pos = id[p][u];
    if (pos > 0) {
      up[u] = (1ll * up[u] * pre[p][pos - 1]) % mod;
    }
    if (pos + 1 < suf[p].size()) {
      up[u] = (1ll * up[u] * suf[p][pos + 1]) % mod;
    }
    up[u] = (up[u] + 1) % mod;
  }
  for (int v : adj[u]) {
    if (v == p) continue;
    dfs1(v, u);
  }
}

int main() {
  scanf("%d %d", &n, &mod);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(1, -1);
  dfs1(1, -1);
  for (int i = 1; i <= n; i++) {
    printf("%d\n", (1ll * up[i] * down[i]) % mod);
  }
  return 0;
}


Measured memory_bytes: 34816
#include <iostream>

using namespace std;

int main()
{
    signed int a,b;
    cin>>a>>b;
    if(a==b){
        cout<<"Draw";

    }
    else if (a>b){
        if (b==1)cout<<"Bob";
        else if(b!=1)cout<<"Alice";
    }
    else if(b>a){
        if(a==1)cout<<"Alice";
        else if (a!=1)cout<<"Bob";
    }

    return 0;
}


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

int main()
{
  string s;
  string ans;
  cin >> s;
  
  int l = s.length();

  if(s[l - 1] == 's')
    ans = s + "es";
  else
    ans = s + "s";
  
  cout << ans;
  return 0;
}

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

int main(){
    ll x,k,d;
    cin >> x >> k >> d;
    ll ans;
    if(abs(x)/d>=k) ans = abs(x)-k*d;
    else{
        ll m = abs(x)/d;
        //printf("%lld %lld",m,k);
        if((m-k)%2 == 0) ans = abs(x)%d;
        else ans = abs(abs(x)%d-d);
    }

    cout << ans << endl;
}

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

long long int gcd(long long int a,long long int b){
  if(a%b==0) return b;
  else return gcd(b,a%b);
}

int main(){
  long long int n;
  cin >> n;
  vector<pair<long long int,long long int>> pairs(n);
  for(int i=0;i<n;i++){
    long long int a,b;
    cin >> a >> b;
    pairs[i] = make_pair(b,a);
  }
  sort(pairs.begin(),pairs.end());
  long long int sum = 0;
  for(int i=0;i<n;i++){
    sum += pairs[i].second;
    if(sum>pairs[i].first) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3328
use std::str::FromStr;
use std::fmt::Debug;

fn read_line<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
}

fn main() {
    let vec: Vec<usize> = read_line();
    let k = vec[1];
    let hs: Vec<i32> = read_line();

    let mut dp: Vec<i32> = Vec::new();
    for _ in 0..hs.len() { dp.push(0); }
    dp[0] = 0;
    dp[1] = (hs[0] - hs[1]).abs();

    // calculate each dp
    for i in 2..hs.len() {
        let start_idx: usize = if (i as i32) - (k as i32) >= 0 { i - k } else { 0 };
        let mut costs: Vec<i32> = Vec::new();
        for j in start_idx..i { costs.push(dp[j] + (hs[i] - hs[j]).abs()); }
        dp[i] = *(costs.iter().min().unwrap());
    }
    println!("{}", dp.last().unwrap());
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <iostream>

#include <bits/stdc++.h>


using namespace std;

#define INPUT_INT(valName) int valName; cin >> valName
#define INPUT_LLINT(valName) long long int valName; cin >> valName;
#define INPUT_STR(valName) string valName; cin >> valName;
#define INPUT_LINE(valName) string valName; getline(cin,s);
#define INPUT_VECTOR_INT(valName, N) vector<int> valName(N); for(int i=0; i < N; ++i) { cin >> valName[i]; }
#define INPUT_VECTOR_DOUBLE(valName, N) vector<double> valName(N); for(int i=0; i < N; ++i) { cin >> valName[i]; }

#define OUTPUT(A) cout << (A) << endl;
#define OUTPUT2(A, B) cout << (A) << " " << (B) << endl;
#define OUTPUT3(A, B, C) cout << (A) << " " << (B) << " " << (C) << endl;

#define REP(valName, N) for(int valName = 0; valName < N; ++valName)

vector<string> split(const string& str, char delimiter) {
	vector<string> ret;
	string tmp = "";
	for (auto c : str) {
		if (c != delimiter) {
			tmp.push_back(c);
		} else {
			ret.push_back(tmp);
			tmp = "";
		}
	}
	ret.push_back(tmp);
	return ret;
}

template <typename T> void sortAsc(vector<T>& v) { sort(v.begin(), v.end(), less<T>()); }
template <typename T> void sortDesc(vector<T>& v) { sort(v.begin(), v.end(), greater<T>()); }

template <typename T> void insert(vector<T>& dest, const vector<T>& src) { copy(src.begin(), src.end(), back_inserter(dest)); }

template <long long int MOD> long long int mod_inv(long long int a) {
	long long b = MOD, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= MOD;
	if (u < 0) u += MOD;
	return u;
}

template <long long int MOD> long long int mod_add(long long int a, long long int b) {
	return (a + b) % MOD;
}

template <long long int MOD> long long int mod_sum(long long int a, long long int b) {
	return (a - b) % MOD;
}

template <long long int MOD> long long int mod_mul(long long int a, long long int b) {
	return (a % MOD) * (b % MOD) % MOD;
}

template <long long int MOD> long long int mod_mul(long long int a, long long int b, long long int c) {
	return mod_mul<MOD>(a, mod_mul<MOD>(b, c));
}

template <long long int MOD> long long int mod_div(long long int a, long long int b) {
	return (a % MOD) * mod_inv<MOD>(b) % MOD;
}

int sign(long long int a) {
	return a >= 0 ? 1 : -1;
}


//------------------------------------------------------------------------------------------------------------------------------



int main() {

	// TODO: streamやめる

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

	unsigned long long int H; cin >> H;
	unsigned long long int W; cin >> W;

	if (H == 1 || W == 1) {
		OUTPUT(1);
		return 0;
	}

	unsigned long long int result = 0;
	for (unsigned long long int x = 1; x <= W; ++x) {
		if (x % 2 == 1) {
			result += (H+1)/2;
		} else {
			result += H/2;
		}
	}

	OUTPUT(result);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
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 int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> A(n, 0);
    rep(i, q) {
        int a;
        cin >> a;
        A[a - 1]++;
    }
    rep(i, n) {
        if (q - A[i] >= k) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    }
}

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



Measured memory_bytes: 3656
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanInit()

	n := nextInt()

	way := 0
	for i := 1; i < n; i++ {
		way += (n - 1) / i
	}

	fmt.Println(way)

}

// ---- readfunc
var sc = bufio.NewScanner(os.Stdin)

func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1792
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1000000;
const int mod = 1000000007;
const int INF = 1 << 30;
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define fix(n) fixed<<setprecision(n)
#define itr vector<ll>::iterator
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
ll a, b, c, d, e,ans,ct,v[200010];
string s;
int main() {

	cin >> s;
	rep(i,s.size()) {
		b += s[i]-'0';
	}
	cout<< (b==1?10:b) <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int h, w; cin >> h >> w;
    vector<vi> f(h, vi(w));
    rep(i, h) rep(j, w) cin >> f[i][j], f[i][j] %= 2;

    using Elem = tuple<int, int, int, int>;
    vector<Elem> res;

    rep(i, h){
    	rep(j, w){
    		if(i == h - 1 and j == w - 1) continue;
    		if(f[i][j] == 0) continue;
    		int i2, j2; i2 = i, j2 = j;

    		if(i != h - 1) i2 = i + 1;
    		else j2 = j + 1;

    		f[i2][j2] ^= 1;

    		res.emplace_back(Elem(i+1, j+1, i2+1, j2+1));
    	}
    }

    cout << res.size() << endl;
    for(auto& e : res){
    	int y, x, y2, x2; tie(y, x, y2, x2) = e;
    	cout << y << " " << x << " " << y2 << " " << x2 << endl;
    }

    return 0;
}


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



int main() {

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


	int n;
	cin >> n;

	int arr[n];

	for (int i = 0; i < n; ++i) {
		cin >> arr[i];
	}


	int dp[n];
	dp[0] = 0;

	for (int i = 1; i < n; ++i) {
		int op1 = abs(arr[i] - arr[i - 1]) + dp[i - 1];
		int op2 = INT_MAX;
		if (i - 2 >= 0) {
			op2 = abs(arr[i] - arr[i - 2]) + dp[i - 2];
		}

		dp[i]  = min(op1, op2);
	}

	cout << dp[n - 1] << endl;


	return 0;
}

Measured memory_bytes: 4408
#include <iostream>
#include<bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include<string.h>
using namespace std;

int main()
{
    int n,a[1000],b[1000],sum=0;
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>a[i];
        b[i]=a[i];
    }
    sort(a+1,a+1+n);
    for(int i=1;i<=n;++i){
        if(a[i]!=b[i])
            sum++;
    }
    if(sum<=2) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int numberOfDigits = scanner.nextInt();
        int inputSize = scanner.nextInt();

        int answer = 0;
        int[] ints = new int[numberOfDigits];

        for (int i = 0; i < inputSize; i++) {
            int position = scanner.nextInt();
            int value = scanner.nextInt();

            if (position == 1 && value == 0) {
                if (numberOfDigits != 1) {
                    answer = -1;
                }
            }
            if (ints[position - 1] != 0 && ints[position - 1] != value) {
                answer = -1;
                break;
            } else {
                ints[position - 1] = value;
            }
        }
        if (answer == -1) {
            System.out.println(answer);
        } else {
            if (numberOfDigits == 1) {
                System.out.println(ints[0]);
            } else if (numberOfDigits == 2) {
                if (ints[0] == 0) {
                    System.out.println("1" + ints[1]);
                } else {
                    System.out.println(ints[0] + "" + ints[1]);
                }
            } else {
                if (ints[0] == 0) {
                    System.out.println("1" + ints[1] + "" + ints[2]);
                } else {
                    System.out.println(ints[0] + "" + ints[1] + "" + ints[2]);
                }
            }
        }
    }
}

Measured memory_bytes: 22356
N = int(input())
S = input()

cnt_E = [0] * (N+2)
cnt_W = [0] * (N+2)

for i in range(N):
    if S[i] == "W":
        cnt_W[i+1] = cnt_W[i] + 1
    else:
        cnt_W[i+1] = cnt_W[i]
for i in range(N-1,-1,-1):
    if S[i] == "E":
        cnt_E[i+1] = cnt_E[i+2] + 1
    else:
        cnt_E[i+1] = cnt_E[i+2]

ans = 10**7
for i in range(N):
    total = cnt_W[i] + cnt_E[i+2]
    if ans > total:
        ans = total
        
print(ans)

Measured memory_bytes: 17580
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int n,k,map[200010];
	while(scanf("%d %d",&n,&k)!=EOF)
	{
		memset(map,0,sizeof(map));
		for(int i=0;i<n;i++)
		{
			int a;
			scanf("%d",&a);
			map[a]++;
		}
		sort(map,map+n,cmp);
		int sum=0;
		for(int i=k;i<=n;i++)
		{
			sum+=map[i];
		}
		printf("%d\n",sum);
	}
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

int main() {
  ll n, k; cin >> n >> k;
  cout << (ll)(k * pow((k-1), (n-1))) << endl;

  return 0;
}




Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**5)

def find_parent(i):
    aaa=0
    while True:
        if parent[i]<0:
            aaa=i
            break
        else:
            i=parent[i]
    return aaa

def connect(A,B):
    A=find_parent(A)
    B=find_parent(B)
    if A!=B:
        p_A,p_B=parent[A],parent[B]
        if p_A<p_B:
            parent[A]+=p_B
            parent[B]=A
            child[A].append(B)
        else:
            parent[B]+=p_A
            parent[A]=B
            child[B].append(A)

n=int(input())
x_max=0
y_max=0
xy=[]
for _ in range(n):
    x,y=map(int,input().split())
    x_max=max(x_max,x)
    y_max=max(y_max,y)
    xy.append([x,y])
data=[[] for _ in range(x_max+1)]
parent=[-1]*(x_max+1)
child=[[] for i in range(x_max+1)]
lst=[0]*(y_max+1)
for x,y in xy:
    data[x].append(y)
    if lst[y]==0:
        lst[y]=x
    else:
        connect(lst[y],x)

lsls=[]
for i in range(1,x_max+1):
    if parent[i]>=0:
        continue
    if not data[i]:
        continue
    que=[i]
    h=[i]
    while que:
        u=que.pop()
        for v in child[u]:
            que.append(v)
            h.append(v)
    lsls.append(h)

ans=0
for u in lsls:
    L=len(u)
    flag=[0]*(y_max+1)
    cnt=0
    count=0
    for v in u:
        for w in data[v]:
            count+=1
            if flag[w]==0:
                flag[w]=1
                cnt+=1
    ans+=L*cnt-count

print(ans)

Measured memory_bytes: 40772
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=1e6;
const long inf=1e9;
int main(){
	int x,y; cin>>x>>y;
	rep(i,0,x+1){
		int j = x - i;
		if(2 * i + 4 * j == y){
			cout<<"Yes"<<endl;
			return 0;
		}
	}cout<<"No"<<endl;
}

Measured memory_bytes: 3612
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using uint = uint32_t;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife
	
	ll n, k, d;
	cin >> n >> k >> d;
	n = abs(n);
	ll ans = n;
	ll mn = min(n/d, k);
	ans -= d*mn;
	k-=mn;
	if(k) {
		if(abs(ans-d) < ans)
			k--, ans = abs(ans-d);
		if(k&1)
			ans = min(abs(ans+d), abs(ans-d));
	}
	cout << ans << '\n';

	return 0;
}


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

int main()
{
	string t;
	cin >> t;
	
	for (int i = 0; i < t.size(); ++i)
	{
		if (t[i] == '?')
		{
			t[i] = 'D';
		}
	}
	
	cout << t << endl;
	
	return 0;
}


Measured memory_bytes: 3724
<?php
# 入力部
// fscanf(STDIN, "%s %s", $s, $t);
// fscanf(STDIN, "%d %d", $n, $m);
// fscanf(STDIN, "%s", $u);
// fscanf(STDIN, "%d %d", $k, $x);
// $s1 = fgets(STDIN); //"\n"の2文字
// $s2 = fgets(STDIN);
// fscanf(STDIN, "%d", $a);
// fscanf(STDIN, "%d", $b);
// fscanf(STDIN, "%s", $s);
// fscanf(STDIN, "%c", $c);
// fscanf(STDIN, "%s", $s2);
fscanf(STDIN, "%d %d %d", $a, $b, $c);


# 処理部
// $arr = str_split($s);
// $arr2 = str_split($s2);
// $arr1 = explode(" ", $s1);
// $arr2 = explode(" ", $s2);
// for ($i = 0; $n > $x * $i; $i++) {
// }
// if (strpos($s, 'RRR') !== false) {
//   $r = 3;
// } elseif (strpos($s, 'RR') !== false) {
//   $r = 2;
// } elseif (strpos($s, 'R') !== false) {
//   $r = 1;
// } else {
//   $r = 0;
// }
// $s = "No";
// if ($x >= 30) {
//   $s = "Yes";
// }
// for ($i = 0; $i * 1000 < $n; $i++) {
// }
// $c = "a";
// if (ctype_upper($a)) {
//   $c = "A";
// }
// $s = "Yes";
// echo count($arr1);
// for ($i = 0; $i < strlen($s1); $i++) {
//   if ($arr1[$i] != $arr2[$i]) {
//     $s = "No";
//   }
// }
// $unit;
// switch ($n % 10) {
//   case 0:
//   case 1:
//   case 6:
//   case 8:
//     $unit = "pon";
//     break;
//   case 3:
//     $unit = "bon";
//     break;
//   default:
//     $unit = "hon";
//     break;
// }
// if ($s == "ABC") {
//   $r = "ARC";
// } else {
//   $r = "ABC";
// }
// $r = "NG";
// for ($i = $a; $i <= $b; $i++) {
//   if ($i % $k == 0) {
//     $r = "OK";
//   }
// }
// $r = "safe";
// if ($s <= $w) {
//   $r = "unsafe";
// }
// $r = "No";
// if (strpos($n, "7") !== false) {
//   $r = "Yes";
// }
// $r = "No";
// if ($arr[2] == $arr[3] && $arr[4] == $arr[5]) {
//   $r = "Yes";
// }
// $r = "Yes";
// if ($s == "AAA" || $s == "BBB") {
//   $r = "No";
// }
// if ($n % 2 == 0) {
//   $r = $n / 2;
// } else {
//   $r = ($n + 1) / 2;
// }
// if ($n < 10) {
//   $r += (10 - $n) * 100;
// }
// $arr = array($a, $b, $c);
// $arr = array_unique($arr);
// if (count($arr) == 2) {
//   $r = "Yes";
// } else {
//   $r = "No";
// }
// if ($s == $u) {
//   $a--;
// } else {
//   $b--;
// }
// for ($i = 0; $h > 0; $i++) {
//   $h -= $a;
// }
// $r = "No";
// if ($n == $m) {
//   $r = "Yes";
// }
$r = "win";
if ($a + $b + $c >= 22) {
  $r = "bust
";
}
// $arr = array(1, 2, 3);
// unset($arr[$a - 1]);
// unset($arr[$b - 1]);
// $arr = array_values($arr);

# 出力部
// echo ($n * ($n - 1) / 2) + ($m * ($m - 1) / 2) . "\n";
// echo $z . " " . $x . " " . $y . "\n";
// echo ($i * 1000) - $n . "\n";
// echo json_encode($arr) . "\n";
// echo $arr[0] . "\n";
echo $r . "\n";
// echo ++$c . "\n";
// echo $a . " " . $b . "\n";
// echo $t . $s . "\n";


Measured memory_bytes: 15812
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int c=0,mx=0;
    int x;
    cin>>x;
    int prev=x;
    for(int i=1;i<n;i++)
    {
        cin>>x;
        if(x<=prev)
            c++;
        else
        {
            mx=max(mx,c);
            c=0;
        }
        prev=x;
    }
    mx=max(mx,c);
    cout<<mx<<endl;
    return 0;
}


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

int main() {
  int A, B;
  cin >> A >>B;
  
  int Ans = 0;
  
  for (int i = 0; i < 2; i++){
    if (A > B){
      Ans += A;
      A -= 1;
    }
    else{
      Ans += B;
      B -= 1;
    }
  }
  
  cout << Ans <<endl;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	// s = input[0].split(' ').map((n) => (parseInt(n)))[1]
	// input = input[1].split(' ').map((n) => (parseInt(n)))
	// ans = input.filter((n) => (s <= n)).length
	exp = input[0].split('')
	act = input[1].split('')
	var ans = 0
	for (var i = 0; i< exp.length; i++ ) {
		if (exp[i] === act[i]) {
			ans++
		}
	}

	//出力
	console.log(ans)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require('fs').readFileSync('./input.txt', 'utf-8'));

Measured memory_bytes: 7624
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
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 pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

struct Vector2{
    double x, y;
    Vector2(){};
    Vector2(double x, double y) : x(x), y(y){};

    double cross(const Vector2& p){
        return x*p.y - y*p.x;
    }
};

int main(){
	int n, c = 0;
    while(cin>>n && n && ++c){
        vector<Vector2> v;
        rep(i, n){
            double x, y;
            cin>>x>>y;
            v.pb({x, y});
        }
        double sum = 0.0;
        v.pb(v[0]);
        rep(i, n){
            sum += v[i].cross(v[i+1]);
        }
        printf("%d %.1lf\n", c, -sum/ 2.0);
    }
}

Measured memory_bytes: 3160
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

//#define int ll

class DFlippingSigns {
public:
    int N;
    ll A[101010];
void solve(std::istream& cin, std::ostream& cout) {
    memset(A,0,sizeof(A));
    ll mi = INF, sum = 0, cnt = 0;
    cin >> N;
    _for(i,N){
        ll t;
        cin >> t;
        cnt += (t < 0);
        mi = min(mi, abs(t));
        sum += abs(t);
    }
    cout << (cnt&1?sum - 2 * mi:sum) << endl;
}
};


#undef int
int main() {
	DFlippingSigns solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int ans = 700;
   string s;
   cin >> s;
   if (s[0] == 'o') ans += 100;
   if (s[1] == 'o') ans += 100;
   if (s[2] == 'o') ans += 100;
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
//g++  5.4.0

#include <bits/stdc++.h>
using namespace std;
const long double nax = 1e15L+1;
const int MAXN = 3001;
long double dp[MAXN][1 + (MAXN+1)/2];
long double computeProb(long double *pheads,int n,int heads,int tails){
    long double &ans = dp[heads][tails];
    if(ans!=nax)
        return ans;
    if(n == 0)
        return ans = heads>tails?1:0;
    
    ans = pheads[n-1]*computeProb(pheads,n-1,heads+1,tails) + (1-pheads[n-1])*computeProb(pheads,n-1,heads,tails+1);
    return ans;
}

int main()
{
    int n;
    scanf("%d",&n);
    long double ans = 0;
    long double phead[n];//probability of getting head
   
    for(int i = 0;i<=n;i++)
        for(int j = 0;j<=(n+1)/2;j++)
                dp[i][j] = nax;
    for(int   i= 0;i<n;i++){
        scanf("%Lf",&phead[i]);
    }
    ans = computeProb(phead,n,0,0);
    /*
    int heads = (n+1)/2;
    int tails = n - heads;
    while(heads <= n){
          string p = string(heads,'h') + string((n-heads),'t');
          do{
                long double pr3 = 1;
                for(size_t i =0 ;i<p.length();i++)
                {
                    pr3 *= (p[i]=='h'?phead[i]:(1-phead[i]));
                }
                ans += pr3;
          }while(next_permutation(p.begin(),p.end()));
          ++heads;
    }
    */
    
   printf("%1.10Lf\n",ans);
    return 0;
}

Measured memory_bytes: 70912
a,b,c,d=input()
x=int(a+b)
y=int(c+d)
if 1<=x<=12 and 1<=y<=12:
  print('AMBIGUOUS')
elif 1<=x<=12 and 1<=y<=12:
  print('AMBIGUOUS')
elif 0<=x<=99 and 1<=y<=12:
  print('YYMM')
elif 1<=x<=12 and 0<=y<=99:
  print('MMYY')
else:
  print('NA')

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

int main(){
  vector<int> s(3);
  for(int i=0;i<3;i++){
    cin >> s.at(i);
  }
  
  sort(s.begin(),s.end());
  
  if(s.at(0)+s.at(1) == s.at(2)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int main() {
	ll n;
	cin>>n;
	ll l=1,r=n,ans;
	while (l<=r) {
		ll mid=l+r>>1;
		if (mid*mid<=n) ans=mid,l=mid+1;
		else r=mid-1;
	}
	cout<<ans*ans<<endl;
	return 0;
}

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

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

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

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

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

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long a, b, x;
    scan(a, b, x);
    writeln(f(b, x) - f(a - 1, x));
}

long f(long n, long x)
{
    if (n < 0)
        return 0;
    return n / x + 1;
}


Measured memory_bytes: 256
N, M = map(int, input().split())

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self):
        return len(self.roots())
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(N)

for _ in range(M):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)

print(len(uf.roots())-1)


Measured memory_bytes: 12908
#include<stdio.h>
int main(){
	int c[3][3],d[2];
	int i,j;
	for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			scanf("%d",&c[i][j]);
		}
	}
	d[0]=c[0][0]-c[0][1];
	d[1]=c[0][0]-c[0][2];
	for(i=1;i<3;i++){
		for(j=1;j<3;j++){
			if(c[0][0]-c[0][j]!=c[i][0]-c[i][j]){
				printf("No");
				return 0;
			}
		}
	}
	printf("Yes");
	
	return 0;
}

Measured memory_bytes: 128