akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int N;
pair<double,double> dots[300];
#define EPS (1e-6)


int main(){

	while(cin >> N && N != 0){
		for(int i = 0; i < N; i++){
			pair<double,double> p;
			cin >> dots[i].second >> dots[i].first;
		}
		int maxCnt = 1;
		// ~ðìé½ßÌQ_ðßé
		for(int i = 0; i < N; i++){
			for(int j = i+1; j < N; j++){
				pair<double,double> dot1,dot2;
				dot1 = dots[i];
				dot2 = dots[j];

				double v = sqrt((dot1.first - dot2.first)*(dot1.first - dot2.first)
					+(dot1.second - dot2.second)*(dot1.second - dot2.second));
				// ñ_Ô£ª2æè¨¨«¯êÎÂ­êÈ¢
				if(v > 2.0 + EPS){
					continue;
				}

				double x = sqrt(1 - (v/2)*(v/2));

				// ñgÌPÊ@üxNg
				pair<double,double> hose[2];
				hose[0].first = -1.0/(dots[i].first - dots[j].first);
				hose[0].second = 1.0/(dots[i].second - dots[j].second);
				hose[1].first = 1.0/(dots[i].first - dots[j].first);
				hose[1].second = -1.0/(dots[i].second - dots[j].second);

				double dd1 = sqrt((hose[0].second)*(hose[0].second)+(hose[0].first)*(hose[0].first));
				double dd2 = sqrt((hose[1].second)*(hose[1].second)+(hose[1].first)*(hose[1].first));
				hose[0].first /= dd1; hose[0].second /= dd1;
				hose[1].first /= dd2; hose[1].second /= dd2;

				// x{·é
				hose[0].first *= x;hose[1].first *= x;
				hose[0].second *= x;hose[1].second *= x;

				// mð«·
				hose[0].first += (dot1.first + dot2.first)/2;
				hose[0].second += (dot1.second + dot2.second)/2;
				hose[1].first += (dot1.first + dot2.first)/2;
				hose[1].second += (dot1.second + dot2.second)/2;

				// hose[0]Æhose[1]Í~ÌSÀW
				// e_ÉÖµÄ~ÌÉ¶Ý·é©Ç¤©ðßé
				for(int k = 0; k < 2; k++){
					int cnt = 0;
					for(int l = 0; l < N; l++){
						double dist = sqrt((dots[l].first -hose[k].first)*(dots[l].first -hose[k].first)
							+ (dots[l].second -hose[k].second)*(dots[l].second -hose[k].second));
						if(dist < 1.0 + EPS){
							cnt++;
						}
					}
					maxCnt = max(maxCnt,cnt);
				}
			}
		}
		cout << maxCnt << endl;
	}

	return 0;
}

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

using namespace std;

using bellman_cost = long long;
template<class V, class E>
struct Graph
{
	int sz;
	vector<V> v;
	vector<vector<E>> e;
	Graph(int n) : sz(n), v(n), e(n) {}
	template<class... Args>
	inline void assign_vertex(int pos, Args... args) {
		v[pos] = V(args...);
	}
	// from, to, cost
	template<class... Args>
	inline void add_edge(int pos, Args... args) {
		e[pos].emplace_back(args...);
	}
	inline int size() {
		return sz;
	}
};

template<class T>
struct Vertex
{
	T cost;
	bool valid = false; // 到達不能または無限にコストが減るときfalse
	Vertex(T v1) : cost(v1) {}
	Vertex() {}
};
using vertex = Vertex<bellman_cost>;

template<class T>
struct Edge
{
	int to;
	T cost;
	Edge(int t, T c) : to(t), cost(c) {}
	Edge() {}
};
using edge = Edge<bellman_cost>;
using graph = Graph<vertex, edge>;

template<class T, class V, class E>
void Bellmanford(Graph<V, E>& G, int s, T INF_COST)
{
	auto &v = G.v;
	auto &e = G.e;
	for (auto& vv : v) vv.cost = INF_COST, vv.valid = false;
	v[s].cost = 0, v[s].valid = true;
	for (int i = 0; i + 1 < (int) v.size(); i++) {
		for (int j = 0; j < (int) v.size(); j++) {
			for (auto& x: e[j]) {
				if (v[j].cost == INF_COST) continue;
				v[x.to].cost = min(v[x.to].cost, v[j].cost + x.cost);
				v[x.to].valid = true;
			}
		}
	}
	auto valid_check = [&](auto f, int pos) {
		if (!v[pos].valid) return;
		v[pos].valid = false;
		for (auto& y: e[pos]) {
			f(f, y.to);
		}
	};
	for (int i = 0; i < (int) v.size(); i++) {
		for (auto& x: e[i]) {
			if (v[i].cost == INF_COST) continue;
			if (v[x.to].cost > v[i].cost + x.cost) {
				valid_check(valid_check, x.to);
			}
		}
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	graph g(N);
	for (int i = 0; i < M; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		g.add_edge(a-1, b-1, -c);
	}
	Bellmanford(g, 0, LLONG_MAX);
	auto& v = g.v;
	if (v[N-1].valid) cout << -v[N-1].cost << endl;
	else cout << "inf" << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int C = Integer.parseInt(sc.next());
		int D = Integer.parseInt(sc.next());

		while(A >= 0 || C >=0) {
			C -= B;
			if(C <= 0)  {
				System.out.println("Yes");
				break;
			}

			A -= D;
			if(A <= 0)  {
				System.out.println("No");
				break;
			}

		}

	}
}


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

int main(){
    int A,B,C,D,sum=0;
    cin >> A >> B >> C >> D;
    if(A<B){
        sum += A;
    }else{
        sum += B;
    }
    if(C<D){
        sum += C;
    }else{
        sum += D;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

#define ma 7368795
bool b[ma];

void f(int m,int n){
  fill(b,b+ma,false);

  int c=0;
  for(int i=m;;i++){
    if(b[i]) continue;
    if(c==n){
      cout<<i<<endl;
      break;
    }
    for(int j=i;j<ma;j+=i){
      b[j]=true;
    }
    c++;
  }
}


int main(){
  while(1){
    int n,m;
    cin>>m>>n;
    if(n==0) break;
    f(m,n);
  }

  return 0;
}


Measured memory_bytes: 10276
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactice problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main() 
{ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    ll n;
    cin>>n;
    n--;
    // 0-25
    ll x=0;
    while(powl(26, x+1)<=n){
        x++;
        n=n-powl(26, x);
    }

    // string length x+1 hogi
    string ans="";
    while(x>=0){
        ll num=0;
        ll d=0;
        ll lar=0;
        for (int i = 0; i < 26; ++i)
        {
            d = i*powl(26, x);
            if(n-d>=0){
                num=i;
                lar=d;
            }
        }
        n=n-lar;
        ans.push_back('a'+num);
        x--;
    }
    cout<<ans;

    return 0;
}

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

vector<int> v;

int main(){
while(1){//start	
	int n, r;
	cin >> n >> r;
	if(n == 0 and r == 0) break;
	
	for(int i = 1; i <= n; i++) v.push_back(i);
	reverse(v.begin(), v.end());

	for(int i = 0; i < r; i++){
		stack<int> st;
		int p, c;
		cin >> p >> c;
		for(int j = 0; j < c; j++){
			st.push(v[p + j - 1]);
			//cout << "que = " << v[p + j - 1] << endl;
		}
		v.erase(v.begin() + p - 1, v.begin() + p + c - 1);
		//for(int k = 0; k < (int)v.size(); k++) cout << v[k] << endl;
		

		reverse(v.begin(), v.end());
		while(st.size()){
			int tmp = st.top();
			//cout << "tmp = " << tmp;
			st.pop();
			v.push_back(tmp);
		}
		reverse(v.begin(), v.end());

		//debug
		//cout << endl;
		//for(int k = 0; k < (int)v.size(); k++) cout << v[k] << endl;
		//cout << endl;
	}

	cout << v[0] << endl;
	v.clear();
}//end
	return 0;
}



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


int main() {

  int a,b,k;
  cin>>a>>b>>k;

  vector<int> comon_div;
  for(int i=1;i<=min(a,b);i++){
    if(a%i==0&&b%i==0){
      comon_div.push_back(i);
    }
  }

  sort(comon_div.begin(),comon_div.end(),std::greater<int>());
  
  cout<<comon_div.at(k-1)<<endl;

  return 0;

}

Measured memory_bytes: 256
// https://beta.atcoder.jp/contests/abc078
// status:

#define SUBMIT
//#define DEBUG

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <queue>
#include <numeric>
#include <limits>
#include <cmath>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    auto program_input = std::string(R"(100 5
)");
    stringstream stream(program_input);
#endif
    int N, M;
    stream >> N >> M;
    auto ans = (1900 * M + 100 * (N - M)) * pow(2, M);
    cout << ans << endl;
    return 0;
}

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

A = []

for _ in range(N):
    A.append(input())

cnt = [0,0,0,0]

for r in A:
    if r == 'AC': cnt[0] += 1
    elif r == 'WA': cnt[1] += 1
    elif r == 'TLE': cnt[2] += 1
    else: cnt[3] += 1

print('AC x ' + str(cnt[0]))
print('WA x ' + str(cnt[1]))
print('TLE x ' + str(cnt[2]))
print('RE x ' + str(cnt[3]))    

Measured memory_bytes: 16164
#include <stdio.h>
#include <math.h>
int main(void)
{
    int x[100], i, n, p, sum[100], min;
    scanf("%d", &n);
    for (i = 0; i < 100; i++)
    {
        sum[i] = 0;
    }
    for (i = 0; i < n; i++)
    {
        scanf("%d", &x[i]);
    }
    for (p = 0; p < 100; p++)
    {
        for (i = 0; i < n; i++)
        {
            sum[p] += (int)pow(x[i] - p, 2.0);
        }
    }
    min = sum[0];
    for (p = 0; p < 100; p++)
    {
        if (sum[p] < min)
        {
            min = sum[p];
        }
    }
    printf("%d\n", min);
    return 0;
}


Measured memory_bytes: 128
using System;
// using System.Collections.Generic;
// using System.Linq;
// using System.Text;

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        bool flg = false;
        for (int i = 1; i < 10; i++)
        {
            for (int j = 1; j < 10; j++)
            {
                if (i * j == N)
                {
                    flg = true;
                    break;
                }
            }
            if (flg) break;
        }
        Console.WriteLine(flg ? "Yes" : "No");
        return;
    }
}

Measured memory_bytes: 27496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1<<15;
int n,m,c[15][15];
int p[N],dp[N][15];
void init()
{
	memset(p,0,sizeof(p));
	for(int i=0;i<(1<<n);i++)
		for(int j=0;j<n;j++)
			dp[i][j]=-1;
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<n;j++)
		{
			if(((i>>j)&1)==0)
				continue;
			for(int k=j+1;k<n;k++)
			{
				if(((i>>k)&1)==0)
					continue;
				p[i]+=c[j][k];
			}
		}
	}
}
int main()
{
	while(cin>>n>>m)
	{
		int sum=0; 
		int u,v,w;
		memset(c,0,sizeof(c));
		while(m--)
		{
			scanf("%d%d%d",&u,&v,&w);
			u--,v--;
			c[u][v]=c[v][u]=w;
			sum+=w;
		}
		init();
		dp[1][0]=0;
		for(int i=0;i<(1<<n);i++)
		{
			for(int j=0;j<n;j++)
			{
				if(dp[i][j]==-1)
					continue;
				int x=(((1<<n)-1)^i)|(1<<j);	//y is some subset of x
				for(int y=x;y>=0;y--)
					y&=x,dp[i|y][j]=max(dp[i|y][j],dp[i][j]+p[y]);	
					
				for(int k=0;k<n;k++)
				{
					if((i>>k)&1)
						continue;
					if(c[j][k]==0)
						continue;
					dp[i|(1<<k)][k]=max(dp[i|(1<<k)][k],dp[i][j]+c[j][k]);
				}
			}
		}
		int ans=1e9;
		for(int i=0;i<(1<<n);i++)
			ans=min(ans,sum-dp[i][n-1]);
		cout<<ans<<endl;
	}
	return 0;
}

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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int ll
//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//chcp 65001

signed main()
{
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0, i_len = n; i < i_len; ++i) cin >> a[i];

	auto cnt = count_if(a.begin(), a.end(), [](int x){return x%2 == 1;});
	
	if(cnt%2 == 0){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
	return 0;
}

/*

odd + odd   = even
even + even = even

the num of operation is

a 1 1
res 2

a 1 1 1 1 1 1
res 2 2 2
res 4 2
res 6

1 1 1 1 1
2 2 1
4 1
cannot

if the num of odd is even, ans is true


*/

Measured memory_bytes: 640
a, b = map(int, input().split())

def gcd(a, b):
  r = a % b
  if r == 0:
    return b
  return gcd(b, r)
    
r = gcd(max(a, b), min(a, b))

def yakusuu(n, r):
  res = []
  i = 0
  while True:
    i += 1
    if i*i > n:
      break
    if (n % i) != 0:
      continue
    if i <= r:
      res.append(i)
    if (n/i) == i:
      continue
    if (n/i) <= r:
      res.append(int(n/i));
  return res;

ay = yakusuu(a, r)
by = yakusuu(b, r)
l = min(len(ay), len(by))
rlist = list(set(ay) & set(by))
rlist.sort()
ans = []
for i in range(len(rlist)):
  ok = True
  for j in ans:
    if gcd(rlist[i], j) != 1:
      ok = False
      break
  if ok:
    ans.append(rlist[i])
print(len(ans))

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

using namespace std;

int main() {
	string str;
	cin >> str;
	str.resize(13);
	for (int i = 0; i < 8; i++)
	{
		str[12 - i] = str[11 - i];
	}
	str[4] = ' ';
	cout << str << endl;
}

Measured memory_bytes: 384
#ifdef OJ_MISC_OFFLINE

#include "prolog.h"

#else
#define PRINT
#define LCERR
#endif

#include <algorithm>
#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>

namespace {

using namespace std;

class Solution {
public:
    bool fifty_fifty(const string& s) {
        array<int, 128> counts;
        fill(counts.begin(), counts.end(), 0);
        for (char ch : s) {
            counts[ch] += 1;
        }
        for (char ch : s) {
            if (counts[ch] != 2) return false;
        }
        return true;
    }
private:

};

int solve() {
    Solution solution;
    string s;
    cin >> s;
    cout << (solution.fifty_fifty(s) ? "Yes" : "No") << endl;
    return 0;
}

} // anonymous namespace

#ifdef OJ_MISC_OFFLINE

#include "epilog.h"

#else

int main() {
    return solve();
}

#endif


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n, x, i, j, k, cnt;
	
	while(1) {
	    scanf("%d%d", &n, &x);
	    
	    //どちらも0だったら処理を終了する
	    if((n == 0) && (x == 0)) {
	        break;
	    }
	    
	    cnt = 0;
	    for(i = 1; i <= n; i++){
	        for(j = i + 1; j <= n; j++) {
	             for(k = j + 1; k <= n; k++) {
	             	//3つの値の合計がxと同じ場合
	                 if(i + j + k == x) {
	                 	//i,j,kの値が全て異なる場合、カウントする
	             	    if((i != j) && (i != k) && (j != k)) {
	                    	cnt++;
	             	    }
	                }
	            }
	        }
	    }
	    printf("%d\n", cnt);
	}
	return 0;
}


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

bool f(pair<ll,ll>p1, pair<ll,ll>p2)
{
    if(p1.second==p2.second)
        return p1.first>p2.first;
    return p1.second>p2.second;
}

int main()
{
    ll n,m,i,j;
    cin>>n>>m;
    ll a[n];
    vector<pair<ll,ll>>b(m);
    for(i=0;i<n;i++)
        cin>>a[i];
    for(i=0;i<m;i++)
    {
        cin>>b[i].first>>b[i].second;
    }

    sort(a,a+n);
    sort(b.begin(),b.end(),f);

    for(i=0,j=0;i<n && j<m;i++)
    {
        if(a[i]<b[j].second)
        {
            a[i]=b[j].second;
            b[j].first--;
            if(b[j].first==0)
                j++;
        }
        else
            break;
    }
    ll sum=0;
    for(i=0;i<n;i++)
    {
        sum+=a[i];
    }
    cout<<sum<<endl;
}


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

#define endl '\n'

using namespace std;

const int mod = 1e9 + 7;
const int maxn = 2e5 + 3;

long long fast_pow(long long a, int deg)
{
    long long ans = 1, b = a;
    while (deg)
    {
        if (deg & 1)
            ans = ans * b % mod;

        deg >>= 1;

        b = b * b % mod;
    }

    return ans;
}

long long fact[maxn], inv_fact[maxn];
void precompute()
{
    fact[0] = 1;
    for (int i = 1; i < maxn; i++)
        fact[i] = fact[i-1] * i % mod;

    inv_fact[maxn-1] = fast_pow(fact[maxn-1], mod-2);
    for (int i = maxn-2; i >= 0; i--)
        inv_fact[i] = inv_fact[i+1] * (i + 1) % mod;
}

int n;
vector <int> adj[maxn];
void read()
{
    cin >> n;
    for (int i = 1; i <= n-1; i++)
    {
        int a, b;
        cin >> a >> b;

        adj[a].push_back(b);
        adj[b].push_back(a);
    }
}

long long comb(int a, int b)
{
    return fact[a] * inv_fact[b] % mod * inv_fact[a-b] % mod;
}

long long ans[maxn];
int sz[maxn];
void dfs1(int ver, int par)
{
    sz[ver] = 1;
    for (auto i: adj[ver])
        if (i != par)
    {
        dfs1(i, ver);
        sz[ver] += sz[i];
    }

    int left = sz[ver] - 1;
    for (auto i: adj[ver])
        if (i != par)
    {
        ans[1] = ans[1] * comb(left, sz[i]) % mod;
        left -= sz[i];
    }
}

void dfs2(int ver, int par)
{
    if (par != -1)
        ans[ver] = ans[par] * sz[ver] % mod * fast_pow(n-sz[ver], mod-2) % mod;

    for (auto i: adj[ver])
        if (i != par)
        dfs2(i, ver);
}

void solve()
{
    for (int i = 0; i < maxn; i++)
        ans[i] = 1;
    precompute();

    dfs1(1, -1);
    dfs2(1, -1);

    for (int i = 1; i <= n; i++)
        cout << ans[i] << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    read();
    solve();
}


Measured memory_bytes: 19444
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <map>
#include <utility>
#include <queue>
#define ull unsigned long long
#define ll long long
#define mod 998244353
using namespace std;

int n;
int h[100001];
vector <int> dp(100001, 2e9);
int k;

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

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

    cout<<dp[n-1];
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	int a;
	cin>>a;
	if (a==0) cout<<"1";
	else cout<<"0";
	return 0;
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    int x;
    cin>>x;
    int y[x];
    int sum=0;
    for (int i=0; i<x; i++)
    {
        cin>>y[i];
        sum+=y[i];
    }
    sort(y,y+x);
    if (sum%10!=0)
    {
        cout<<sum<<endl;
        return 0;
    }
    for (int i=0; i<x; i++)
    {
        sum-=y[i];
        if (sum%10!=0)
        {
            cout<<sum<<endl;
            return 0;
        }
        sum+=y[i];
    }
    cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
int a[25],n,m,b[25];
ll ans=0;
void dfs(int k,int op,ll w){
	if(!k){
		if(!op) ans+=w;
		return;
	}
	if(k+k<=m){
		int x=(op?10:0)-b[m-k+1];
		if(x!=a[k]&&x!=a[k]+1) return;
		dfs(k-1,x==a[k]+1,w);
		return;
	}
	if((m&1)&&k+k-1==m){
		if(op&&a[k]!=9) return;
		if(!op&&a[k]!=0) return;
		dfs(k-1,op,w*10);
		return;
	}
	int l=a[k],r=a[k]+9;
	if(op) l-=10,r-=10;
	r=min(r,9);l=max(l,0);
	if(k==m&&a[k]>=l&&a[k]<=r) l++;
	if(l<=r) b[k]=(op?a[k]-10:a[k]),dfs(k-1,0,w*(r-l+1));
	l=a[k]+1;r=a[k]+10;
	if(op) l-=10,r-=10;
	l=max(l,0);r=min(r,9);
	if(k==m&&a[k]+1>=l&&a[k]+1<=r) l++;
	if(l<=r) b[k]=(op?a[k]-9:a[k]+1),dfs(k-1,1,w*(r-l+1));
	/*for(int i=0,x;i<=9;i++){
		b[k]=i;x=i+(op?10:0);
		b[m-k+1]=x-a[k];
		if(b[m-k+1]<=9&&b[m-k+1]>=0) dfs(k-1,0);
		b[m-k+1]=x-a[k]-1;
		if(b[m-k+1]<=9&&b[m-k+1]>=0) dfs(k-1,1);
	}*/
}
int main(){
	int x;
	scanf("%d",&x);
	while(x) a[++n]=x%10,x/=10;
	for(int i=n;i<=20;i++) 
		m=i,dfs(i,0,1);
	printf("%lld",ans);
	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 < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

int N;
int to[200001], ne[200001], he[100001];
ll mod = 1e9 + 7;
pair<ll, ll> dfs(int A, int prev) {
	ll kuro = 1;
	ll siro = 1;
	for (int i = he[A]; i; i = ne[i]) {
		int To = to[i];
		if (To != prev) {
			auto k = dfs(To, A);
			kuro = (kuro * k.second) % mod;
			siro = (siro * k.first) % mod;
		}
	}
	return mp(kuro + siro, siro);
}

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


	cin >> N;
	int k = 1;
	rep(i, N - 1) {
		int x, y;
		cin >> x >> y;
		to[k] = y;
		ne[k] = he[x];
		he[x] = k++;
		to[k] = x;
		ne[k] = he[y];
		he[y] = k++;
	}

	auto M = dfs(1, 0);
	co(M.first % mod);

	Would you please return 0;
}

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

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define PI (3.141592653589793238462643383279502884197169399375105820974944)
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDB pair<db,db>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define VS vector<string>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const int INF = 1000000007;
const ll LINF = 1000000000000000555;
const int N = 550555;
const int L = 21;
const int M = 2155;
const int K = 555;

void solve(){
    ll a,b,c;
    cin >> a >> b >> c;

    cout << c << ' ' << a << ' ' << b;

}

int main() {
    //ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (long long)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

ll fib(ll n){
    vll a(n+1);
    a[0] = 1;
    a[1]  = 1;

    REP(i,2,n+1){
        a[i] = a[i-1] + a[i-2];
        a[i] %= mod;
    }

    return a[n-1];
}

int main()
{
    ll n,m;
    cin >> n >> m;

    priority_queue<ll> a;
    rep(i,n){
        ll tmp;
        cin >> tmp;
        a.push(tmp);
    }

    rep(i,m){
        ll tmp = a.top() / 2;
        a.pop();
        a.push(tmp);
    }

    ll ans = 0;
    rep(i,n){
        ans += a.top();
        a.pop();
    }

    cout << ans << endl;

    return 0;
}

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

int d1[6], d2[6];

bool rotateAndCheck(int s0, int s1, int s2){
	int t0 = d2[s0-1];
	int t1 = d2[s1-1];
	int t2 = d2[s2-1];
	int t3 = d2[6-s2];
	int t4 = d2[6-s1];
	int t5 = d2[6-s0];
	if(
		d1[0] == t0 &&
		d1[1] == t1 &&
		d1[2] == t2 &&
		d1[3] == t3 &&
		d1[4] == t4 &&
		d1[5] == t5
	){
		return true;
	}
	return false;
}
int main(){
	for(int i=0; i<6; i++) cin >> d1[i];
	for(int i=0; i<6; i++) cin >> d2[i];
	
	if(
		rotateAndCheck(1, 2, 3) ||
		rotateAndCheck(1, 3, 5) ||
		rotateAndCheck(1, 4, 2) ||
		rotateAndCheck(1, 5, 4) ||
		rotateAndCheck(2, 1, 4) ||
		rotateAndCheck(3, 1, 2) ||
		rotateAndCheck(4, 1, 5) ||
		rotateAndCheck(5, 1, 3) ||
		rotateAndCheck(2, 3, 1) ||
		rotateAndCheck(3, 5, 1) ||
		rotateAndCheck(4, 2, 1) ||
		rotateAndCheck(5, 4, 1) ||
		rotateAndCheck(2, 4, 6) ||
		rotateAndCheck(3, 2, 6) ||
		rotateAndCheck(4, 5, 6) ||
		rotateAndCheck(5, 3, 6) ||
		rotateAndCheck(2, 6, 3) ||
		rotateAndCheck(3, 6, 5) ||
		rotateAndCheck(4, 6, 2) ||
		rotateAndCheck(5, 6, 4) ||
		rotateAndCheck(6, 2, 4) ||
		rotateAndCheck(6, 3, 2) ||
		rotateAndCheck(6, 4, 5) ||
		rotateAndCheck(6, 5, 3)
	){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
//#include <mylib.h>
using namespace std;
//cin.sync_with_stdio(false);

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FOR_EQ(i,a,b) for(int i = (a); i <= (b); ++i)
#define FOR_RE(i,a,b) for(int i = (a); i > (b); --i)
#define rep(i,n) FOR(i,0,n)
#define rep_eq(i,n) FOR_EQ(i,0,n)
#define rep_re(i,n) FOR_RE(i,n,0)
//1個上から時計周り
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//上右下左
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
static const int NIL = -1;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;
int n;

//配列の表示
void printArray(int array[], int n){
    rep(i, n){
        if(i)   cout << " ";
        cout << array[i];
    }
    cout << endl;
}

//最大公約数(Greatest Common Divisor)
int gcd3(int a, int b){
    if(a == 0 || b == 0)    return 0;
    
    while(1){
        if(b > a)   swap(a, b);
        a = a % b;
        if(!a)  break;
    }
    return b;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, X;
    cin >> N >> X;
    int x[N + 1];
    rep(i, N)   cin >> x[i];
    x[N] = X;
    
    sort(x, x + N + 1);
    int between[N];
    FOR(i, 0, N)    between[i] = x[i + 1] - x[i];
    
    int tmp = between[0];
    FOR(i, 1, N){
        tmp = gcd3(tmp, between[i]);
    }
    
    cout << tmp << endl;
    
}

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

int main()
{
  int n;
  cin >> n;
 string s;
  cin >> s;
  
  if (n%2)
  {
    cout << "No" << endl;
    exit(0);
  }
  
  for (int i = 0;i < s.length()/2; i++)
  {
   if (s[i] != s[i+s.length()/2]) 
   {
    cout << "No" << endl;
     exit(0);
   }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
/*****************************************************

*****************************************************/

#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define pb push_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define ip pair<int, int>

#define loop(i,n) for(int i=0;i<n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1e9+7;
const ll SZ = 107;
const ll N = 2e3+7;
const ll inf = 1e17;

int pwr(int x, int y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x) % MOD;
        y >>= 1;
        x = (x * x) % MOD;
    }
    return r % MOD;
}

int inv(int x)
{
    return pow(x, MOD-2);
}

int dp[N][N], n, m, a[N], b[N];


int solve(int idx1, int idx2)
{
    if(idx1 > n or idx2 > m) return 0;

    int ans = dp[idx1][idx2];
    if(ans != -1)
        return ans;
    
    ans = 0;

    if(a[idx1]==b[idx2])
        ans += 1+solve(idx1+1, idx2)+solve(idx1, idx2+1);
    else
        ans += solve(idx1+1, idx2) + solve(idx1, idx2+1) - solve(idx1+1, idx2+1);
    
    ans += MOD;
    ans %= MOD;
    return dp[idx1][idx2]= ans;
}
void solve()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=m;i++)
        cin>>b[i];

    memset(dp, -1, sizeof(dp));
    int ans =  1+solve(1, 1);
    ans %= MOD;
    cout<<ans;
}

signed main()
{

    int t=1;
    // cin >>t;
    while(t--){
        solve();
    }
    return 0;
}

/*****************************


****************************/

Measured memory_bytes: 31872
n, m, c = map(int, input().split())
blst = list(map(int, input().split()))
cnt = 0
for i in range(n):
    judge = 0
    alst = list(map(int, input().split()))
    for j, k in zip(alst, blst):
        judge += j * k
    if judge + c > 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a,b = [0],[0]
for i in range(N):  # 累積和
    a.append(a[i]+A[i])
for i in range(M):  # 累積和
    b.append(b[i]+B[i])

ans,j = 0,M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans,i+j)
print(ans)


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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int X;
	cin >> X;
	if(X == 3 or X == 5 or X == 7) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Measured memory_bytes: 256
# import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
# import collections # queue
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def main():
    s = input()
    if len(s)%2!=0:
        print('No')
        return
    for i in range(0,len(s),2):
        if s[i]!='h' or s[i+1]!='i':
            print('No')
            return
    print('Yes')
    return

if __name__=='__main__':
    main()


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

int main() {
  int n, m;
  ll k;
  cin >> n >> m >> k;

  vector<ll> a(n);
  vector<ll> b(m);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) cin >> b[i];

  for (int i = 1; i < n; ++i) a[i] = a[i] + a[i - 1];
  for (int i = 1; i < m; ++i) b[i] = b[i] + b[i - 1];

  int ans = lower_bound(b.begin(), b.end(), k + 1) - b.begin();
  // if (b[ans] == k && ans != m) ans++;

  for (int i = 0; i < n; ++i) {
    if (a[i] > k) break;

    ll diff = k - a[i];
    int tmp = lower_bound(b.begin(), b.end(), diff + 1) - b.begin();
    // if (b[tmp] == k && tmp != m) tmp++;
    tmp += i + 1;
    ans = max(ans, tmp);
  }

  cout << ans << '\n';
  return 0;
}



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

int main(){
    ll N;
    cin >> N;
    cout << ((N-1)*N)/2 << endl;
}

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

int main(){
  int n,tmp;

  while(1){
    cin >> n;
    if(!n)break;

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

    for(int i=0;i<n;i++){
      cin >> tmp;
      b.push_back(tmp);
    }
    sort(b.begin(),b.end());

    while(a.size() || b.size()){
      bool f = false;
      while(a.size() && !a[0])a.erase(a.begin());
      while(b.size() && !b[0])b.erase(b.begin());
      if(a[(int)a.size()-1] == (int)b.size()){
	for(int i=0;i<(int)b.size();i++)b[i]--;
	a.erase(a.end()-1);
	f = true;
      }else if(b[(int)b.size()-1] == (int)a.size()){
	for(int i=0;i<(int)a.size();i++)a[i]--;
	b.erase(b.end()-1);
	f = true;
      }
      if(!f)break;
    }
 
    if(a.empty() && b.empty())cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 1020
from collections import Counter

n=int(input())
cli = list(input())

cli_count = Counter(cli)

white = cli_count['W']
red = cli_count['R']

count = 0
for c in cli:
    if red == 0:
        break

    if c == 'W':
        count += 1
        red -= 1
    else:
        red -= 1

print(count)

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

using namespace std;

int main(void) {
  int n;
  string s;
  cin >> n >> s;

  if(n % 2) {
    cout << "No" << endl;
  }
  else {
    bool flag = true;
    for(int i = 0;i < n / 2;i++){
      if(s[i] != s[i + n / 2]) {
        flag = false;
      }
    }
    if(flag) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n = I()
L = LI()
f = len([i for i in L if not i % 4])
t = len([j for j in L if not j % 2]) - f
if (t and n > t + f * 2) or (not t and n > f * 2 + 1):
    print('No')
else:
    print('Yes')



Measured memory_bytes: 60824
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K,R,W,H,P,L;
string S,T;
ll ans[101010];
ll x[101010];
ll y[101010];
ll a[101010];
ll b[101010];
ll c[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(int to, int cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;
ll outnum[101010];
ll innum[101010];


int main() {
	cin>>N>>K;
	if(K<=(N+1)/2){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main(){
	int n, m, p,x,sum,memo=0;
	while (cin >> n >> m >> p) {
		if (n == 0)break;
		sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> x; sum += x;
			if (m == i + 1)memo = x;
		}
		if (memo == 0)cout << 0 << endl;
		else cout << (100 - p)*sum / memo << endl;
	}
	return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int arr[n-1];
  for(int i=0;i<n-1;i++) cin>>arr[i];
  int sum=arr[0];
  for(int i=1;i<n-1;i++){
      if(arr[i]>=arr[i-1]) sum+=arr[i-1];
      else sum+=arr[i];
  }
  sum+=arr[n-2];
  cout<<sum<<endl;
  return 0;
}

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

using namespace std;

int main(){
  int n, m, c;
  std::cin >> n >> m >> c;
  vector<int> b(m);
  for(int i=0; i<m; i++){
    std::cin >> b[i];
  }

  vector<vector<int> > a(n, vector<int>(m));
  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
      std::cin >> a[i][j];
    }
  }

  int ans = 0;
  long long score;
  for(int i=0; i<n; i++){
    score = c;
    for(int j=0; j<m; j++){
      score += a[i][j] * b[j];
    }
    if( score > 0 ){
      ans += 1;
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <unordered_map>
#include <iterator>
#include <functional>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;
double x[21], y[21], t[21], hx, hy, sx ,sy;

double hypot(double x, double y){
	return sqrt(x*x+y*y);
}
int solve(double sx, double sy, int b, double ct){
	if(b == (1<<n)-1) return 1;
	REP(i, n)if(0 == ((b>>i)&1)){
		double nt = ct + hypot(x[i]-sx, y[i]-sy);
		if(t[i]-EPS < nt) return 0;
	}
	REP(i, n)if(0 == ((b>>i)&1)){
		double nt = ct + hypot(x[i]-sx, y[i]-sy);
		if(t[i]-EPS < nt) continue;
		if(solve(x[i], y[i], b | (1<<i), nt)) return 1;
	}
	return 0;
}


int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	while(cin >> n >> sx >> sy >> hx >> hy, n){
		REP(i, n){
			cin >> x[i] >> y[i];
			t[i] = hypot(x[i]-hx, y[i] - hy);
		}
		cout << (solve(sx, sy, 0, 0) ? "YES" : "NO") << endl;
	}
	return 0;
}

Measured memory_bytes: 1228
#include<cstdio>
#include<algorithm>
using namespace std;
const long long md=1e9+7;
int w[20];
long long pow2[401];
long long dp[1<<15];
int main(){
//	freopen("F.in","r",stdin);
	pow2[0]=1;
	for(int i=1;i<401;i++)
		pow2[i]=pow2[i-1]*2%md;
	int n,m;
	scanf("%d%d",&n,&m);
	int s,t;
	for(int i=1;i<=m;i++){
		scanf("%d%d",&s,&t);
		s--,t--;
		w[s]|=(1<<t);
	}
	dp[0]=1;
	long long st1,st2;
	for(int i=1;i<(1<<n);i++)
	{
		dp[i]=1;
		for(int j=i&(i-1);j;j=i&(j-1))
		{
			s=i^j;
			if((j&1)!=((j&2)>>1)) continue;
			st1=1,st2=1;
			for(int k=0;k<n;k++)
			{
				if(s&(1<<k)) st1=st1*pow2[__builtin_popcount(w[k]&j)]%md;
				if(j&(1<<k)) st2=st2*(pow2[__builtin_popcount(w[k]&s)]-1)%md;
			}
			dp[i]=(dp[i]+dp[j]*st1%md*st2)%md;
		}
	}
	printf("%lld\n",(pow2[m]-dp[(1<<n)-1]+md)%md);
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
	int e, y, ans;

	scanf("%d %d", &e, &y);
	if (e == 0) {
		if (y >= 1868 && y <= 1911) {
			ans = y - 1868;
			printf("M%d\n", ans + 1);
		}
		else if (y >= 1912 && y <= 1925) {
			ans = y - 1912;
			printf("T%d\n", ans + 1);
		}
		else if (y >= 1926 && y <= 1988) {
			ans = y - 1926;
			printf("S%d\n", ans + 1);
		}
		else if (y >= 1989 && y <= 2016) {
			ans = y - 1989;
			printf("H%d\n", ans + 1);
		}
	}
	else if (e == 1) {
		ans = 1868 + y;
		printf("%d\n", ans - 1);
	}
	else if (e == 2) {
		ans = 1912 + y;
		printf("%d\n", ans - 1);
	}
	else if (e == 3) {
		ans = 1926 + y;
		printf("%d\n", ans - 1);
	}
	else if (e == 4) {
		ans = 1989 + y;
		printf("%d\n", ans - 1);
	}
	return 0;
}


Measured memory_bytes: 2108
// AOJ 2116: Subdividing a Land
// 2017.10.7 bal4u@uu

#include <stdio.h>
#include <math.h>

int pellEqu(long long *x1, long long *y1, int m)
{
    long long p0, q0, p1, q1, p, q;
    int  a0, a;
    int  s, t, k;
    
    *x1 = *y1 = 0;
    p0 = 1, q0 = 0;

    /* get m^(1/2) */
    a0 = (int)sqrt(m);

    s = 0, t = 1, k = 0;
    p = a = a0, q = 1;
    while (1) {
        s = a * t - s;
        t = (m - s*s)/t;
        if (t == 1) break;
        k++;
        a = (a0 + s) / t;
        p1 = p, q1 = q;
        p = a * p + p0;
        q = a * q + q0;
		if (p < 0 || q < 0) return -1;
        p0 = p1, q0 = q1;
    }
    if (k & 1) {
        *x1 = p, *y1 = q;
        return 0;
    } else {
        *x1 = p * p + m * q * q, *y1 = 2 * p * q;
        return 1;
    }
}

int main()
{
	int t, n;
	long long a, b;

	t = 0; while (scanf("%d", &n) && n > 0) {
		n <<= 1;
		a = (long long)sqrt(n);
		if (a*a == n) b = 1;
		else pellEqu(&a, &b, n);
		printf("Case %d: %lld %lld\n", ++t, a, b);
	}
	return 0;
}

Measured memory_bytes: 1696
n,m=map(int,input().split())
AClst=[0]*n
WAlst=[0]*n
AC=0
WA=0
for i in range(m):
  res = input().rstrip().split(' ')
  no=int(res[0])
  ans=str(res[1])
  if AClst[no-1]==0 and ans=="WA":
    WAlst[no-1]+=1
  elif AClst[no-1]==0 and ans=="AC":
    AClst[no-1]=1
for j in range(n):
  if AClst[j]==0 and WAlst[j]>0:
    WAlst[j]=0
  AC+=AClst[j]
  WA+=WAlst[j]
print(AC, WA)

Measured memory_bytes: 10656
#include <cstdio>

int n;
int a[101];

int main(){
	scanf("%d", &n);
	for(int i=0; i<n; ++i) scanf("%d", &a[i]);
	int s = 1;
	for(int i=0; i<n; ++i) s *= 3;
	int t = 1;
	for(int i=0; i<n; ++i) t *= 2 - a[i] % 2;
//	printf("%d %d\n", s, t);
	printf("%d\n", s - t);
}

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

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define forn(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) forn(i, 0, n)
#define len(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rev(x) x.rbegin(), x.rend()

#define int long long
#define ld long double
#define str string
#define uset unordered_set
#define umap unordered_map
#define pq priority_queue
#define vc vector
#define pii pair<int, int>
#define vi vc<int>
#define vii vc<pii>

#define endl '\n'

inline void FASTIO(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
}

const int MAXN = 2E5+5;
int a[MAXN];

void solve(){
}

signed main(){
    FASTIO();
    int n; cin >> n;
    rep(i, n) cin >> a[i];
    map<int, int> s;
    int ans = 0;
    rep(i, n){
        int x = a[i] - i, y = -i-a[i];
        if(s.count(x)){
            ans += s[x];
        }
        if(s.count(y)){
            s[y]++;
        }else{
            s[y] = 1;
        }
    }
    cout << ans;
}


Measured memory_bytes: 17680
import java.util.Scanner;
import java.util.TreeMap;

class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt();
		TreeMap<Integer, Integer> probs = new TreeMap<Integer, Integer>();
		for(int i = 0; i < N; i++) {
			int D = sc.nextInt();
			if(probs.containsKey(D)) probs.put(D, probs.get(D) + 1);
			else probs.put(D, 1);
		}
		boolean check = true;
		int M = sc.nextInt();
		for(int i = 0; i < M; i++) {
			int T = sc.nextInt();
			if(!probs.containsKey(T)) {
				check = false;
				continue;
			}else {
				probs.put(T, probs.get(T) - 1);
				if(probs.get(T) == 0) probs.remove(T);
			}
		}
		System.out.println(check ?  "YES" : "NO");
	}
}

Measured memory_bytes: 140940