akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	int n,m;
	vector<int> sides;
	cin>>n;
	for(vector<int>::size_type i=0;i!=n;++i){
		cin>>m;
		sides.push_back(m);
	}
	sort(sides.begin(),sides.end());
	int sum=0;
	for(vector<int>::size_type i=0;i!=n-1;++i){
		sum+=sides[i];
	}
	if(sum>sides[n-1])
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
		
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define vll vector<ll>
#define vlll vector<vll>
#define all(x) x.begin(),x.end()
int main()
{
    Imposter
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        ll a[n+1];ll c=0;
        for(ll i=1;i<=n;i++)
        {
            cin>>a[i];
            if(a[i]%2!=0 and i%2!=0)
            c++;
            
        }
        cout<<c<<endl;
    }
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
  string s, t;
  cin >> s >> t;
  
  string sn, tn;
  cin >> sn >> tn;
  
  int s_num = stoi(sn);
  int t_num = stoi(tn);
  
  string u;
  cin >> u;
  
  if (u == s){
    --s_num;
  }
  else if (u == t){
    --t_num;
  }
  
  cout << s_num << " " << t_num;

  return 0;
}


Measured memory_bytes: 384
import java.io.*;

class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int it = Integer.parseInt(br.readLine());
        
        String str2 = br.readLine();
        String[] strarr = str2.split(" ");
        
        int[] array = new int[it];
        for(int i=0; i<it; i++) {
            array[i] = Integer.parseInt(strarr[i]);
        }
        
        trace(array, it);
        insertSort(array, it);
    }
    
    public static void trace(int[] A, int N) {
        for(int i=0; i<N-1; i++) {
            System.out.printf("%d ", A[i]);
        }
        System.out.println(A[N-1]);
    }
    
    public static void insertSort(int[] A, int N) {
        for(int i=1; i<N; i++) { 
            int v = A[i]; 
            int j = i - 1;
            while((j>=0) && (A[j]>v)) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = v;
            trace(A, N);
        }
    
    }
}



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

#define rep2(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) rep2(i,0,n)
#define sz(x) ((int)(x).size())

const int INF = 1070000000;

int N, H;
string S[111];
int T[111];

bool same(char a, char b){
	a = tolower(a);
	b = tolower(b);
	return a==b;
}

int main(){
	scanf("%d %d",&N,&H);
	rep(i,N){
		char str1[20];
		scanf("%s %d",str1,T+i);
		S[i] = str1;
	}
	int curS = 0;
	int curP = 0;
	int life = H;
	int miss = 0;
	int correct = 0;
	int total = 0;
	while(curS < N){
		char str[20] = {};
		string s = S[curS];
		rep(i,sz(s)){
			str[i] = i < curP ? '_' : s[i];
		}
		printf("? %s\n", str); fflush(stdout);
		char c[2];
		scanf("%s", c);
		if(same(c[0], s[curP])){
			curP++;
			correct++;
			total++;
			if(curP == sz(s)){
				curS++;
				curP = 0;
				miss = 0;
			}
		}else{
			miss++;
			total++;
			if(miss > T[curS]){
				life--;
				if(life == 0){
					printf("! Game Over\n"); fflush(stdout);
					return 0;
				}
				curS++;
				curP = 0;
				miss = 0;
			}
		}
	}
	int rate = (int)(1000.0 * correct / total);

	printf("! Game Clear %.1lf\n", rate/10.); fflush(stdout);
}

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

int main() {
    long N, K;
    cin >> N >> K;

    int A[N+1];
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }

    long memo[N+1];
    for (int i = 1; i <= N; i++) {
        memo[i]=0;
    }

    int idx = 1;
	long count = 0;
    long restMove = -1;
    while(count < K && count < N){
        count++;
        if (memo[idx] > 0) {
            long loopCount = count - memo[idx];
            restMove = (K - count + 1)%loopCount;
          	          
            break;
        }
      	memo[idx] = count; 
        idx = A[idx];
    }

    if (restMove==-1){
        cout << idx << endl;
        return 0;
    }

    for (long i = restMove; i > 0 ; i--) {
        idx = A[idx];
    }
    cout << idx << endl;

    return 0;
}


Measured memory_bytes: 5980
n = input()
a = input()
a = a.split()
x = 0;
mul = 1;

for num in a:
    if(int(num) == 0):
    	mul = 0;
    	break;
    	
for num in a:
	mul *= int(num)
	if(mul > 1000000000000000000):
		mul = -1;
		break;
    
print(mul);


Measured memory_bytes: 19228
import math
import copy

n = int(input())
#n, k = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for j in range(n)]
#table = [list(input()) for n in range(h)]
num = [int(i) for i in input().split()]
#num = [int(i) for i in range(n)]
# s = [input() for i in range(n)]
#s = input()
# list = list(s)
# dp = [[0 for _ in range(2)] for _ in range(13)]
#s = [input() for i in range(n)]

#a = [[0 for _ in range(n+1)] for _ in range(n+1)]
#b = [[0 for _ in range(n+1)] for _ in range(n+1)]

kotae = 0
temp = 0
a = {}
b = {}

for i in range(n):
    temp = i - num[i]
    if (temp in a):
        a[temp] += 1
    else:
        a[temp] = 1

for i in range(n):
    temp = i + num[i]
    if (temp in b):
        b[temp] += 1
    else:
        b[temp] = 1

for i in range(200000):
    if ((i in a) and (i in b)):
        kotae += a[i] * b[i]

print(kotae)

Measured memory_bytes: 59560
H, W = list(map(int, input().split()))
s = []
s.append(['.']*(W+2))
for i in range(H):
    #二次元配列に入力を入れる
    array =['.']
    array.extend(list(input()))
    array.extend(['.'])
    s.append(array)
s.append(['.']*(W+2))
#print(s)
count = 0
for i in range(1,H+1):
    for j in range(1,W+1):
        if(s[i][j] == '#' and s[i][j-1] != '#' and s[i][j+1] != '#' and s[i-1][j] != '#' and s[i+1][j] != '#'):
            count = count+1

if (count==0):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3188
#include<cstdio>
#include<map>
#include<algorithm>
using namespace std;
#define LL long long
#define MAXN 400
LL F(LL a,LL b,LL c,LL d)
{
	return a<<30|b<<20|c<<10|d;
}
map<LL,int> G;
void A(LL a,int v)
{
	for(int i=0;i<4;i++)
	{
		G[a]+=v;
		a=(a>>10)|((a&1023)<<30);
	}
}
int a[MAXN][8],n;
LL r,ans,u[4];
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<4;j++)
		{
			scanf("%d",&a[i][j]);
			a[i][j+4]=a[i][j];
		}
		A(F(a[i][0],a[i][1],a[i][2],a[i][3]),1);
	}
	for(int i=0;i<n;i++)
	{
		A(F(a[i][0],a[i][1],a[i][2],a[i][3]),-1);
		for(int j=i+1;j<n;j++)
		{
			A(F(a[j][0],a[j][1],a[j][2],a[j][3]),-1);
			for(int k=0;k<4;k++)
			{
				r=1;
				u[0]=F(a[j][k+1],a[j][k+0],a[i][1],a[i][0]);
				u[1]=F(a[j][k+0],a[j][k+3],a[i][2],a[i][1]);
				u[2]=F(a[j][k+3],a[j][k+2],a[i][3],a[i][2]);
				u[3]=F(a[j][k+2],a[j][k+1],a[i][4],a[i][3]);
				if(G[u[0]]&&G[u[1]]&&G[u[2]]&&G[u[3]])
				{
					r*=G[u[0]];
					A(u[0],-1);
					r*=G[u[1]];
					A(u[1],-1);
					r*=G[u[2]];
					A(u[2],-1);
					r*=G[u[3]];
					ans+=r;
					A(u[0],1);
					A(u[1],1);
					A(u[2],1);
				}
			}
			A(F(a[j][0],a[j][1],a[j][2],a[j][3]),1);
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 20352
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
#include <random>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;
using pis = std::pair<int, std::string>;

const long long INF = 1000000000000000001;
const long long _MOD_ = 1000000000000000009;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

void warshallFloyd(int** graph, int n) noexcept {
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			for (int k = 0; k < n; ++k) {
				graph[j][k] = min(graph[j][k], graph[j][i] + graph[i][k]);
			}
		}
	}
}

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

	int n, k;
	cin >> n >> k;

	set<pii> m;
	REP(i, 1, n) m.insert(pii(0, i));
	
	int sum = ((n - 1)*(n - 2)) / 2;
	if (sum < k) {
		cout << "-1" << "\n";
		return 0;
	}
	REP(i, 1, n) {
		bool flag = false;

		REP(j, i + 1, n) {
			if (sum > k) {
				m.insert(pii(i, j));
				--sum;
			}
			else {
				flag = true;
				break;
			}
		}
		if (flag) break;
	}

	cout << m.size() << "\n";
	for (auto p = m.begin(); p != m.end(); ++p) cout << (*p).first + 1 << " " << (*p).second + 1 << "\n";

	return 0;
}


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

int main(){
  long long n,m,ans=0;
  cin >> n >> m;
  
 if(n ==1 && m ==1){
    cout << 0 << endl;
    return 0;
  }
  
  if(n*2 >m){
  ans += m/2;
    cout << ans << endl;
    return 0;
  }
  
  if(n*2<=m){
    ans += n;
    m -= n*2;
    ans += m/4;
    cout << ans << endl;
    return 0;
  }
  
  
}


Measured memory_bytes: 256
#define s(X,Y,Z) (t=X,X=Y,Y=t,f(Z?&X:&Y))
f(int*a){*a=(*a&7)<<4|*a>>4;}k,m,a,b,c,t,r;main(n){while(scanf("%d",&n),n){for(r=1,a=97,b=82,c=67;n;n--)scanf(" %c%*s",&k),m=k-76,t=m%6==0?s(c,b,m):1<m&&m<8?s(b,a,m^7):s(c,a,m>0),r+=a&7;printf("%d\n",r);}}

Measured memory_bytes: 0
n = int(input())
#h, w, k = list(map(int, input().split()))
# A = list(map(int, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# q = int(input())
p = list(map(int, input().split()))
# b = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
# ab = [list(map(int, input().split())) for i in range(n)]
# print(min(15*n, 100*(n//10+1), 100*(n//10)+15*(n % 10)))
p.sort()
a = p[n//2]
b = p[n//2-1]
if a == b:
    print(0)
else:
    print(a-b)


Measured memory_bytes: 20752
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		char[] s=sc.next().toCharArray();
		char[] t=sc.next().toCharArray();
		int[] start=new int[26];
		int[] goal=new int[26];
		Arrays.fill(start,-1);
		Arrays.fill(goal,-1);
		for(int i=0; i<s.length; i++){
			int a=s[i]-'a';
			int b=t[i]-'a';
			if(start[a]!=-1 || goal[b]!=-1){
				if(start[a]!=b || goal[b]!=a){
					System.out.println("No");
					return;
				}
			}
			start[a]=b;
			goal[b]=a;
		}
		System.out.println("Yes");
	}
}


Measured memory_bytes: 29092
#include <stdio.h>
#include <string.h>

int main(void)
{
    int n,i,ta=0,ha=0;
    char taro[110],hana[110];
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf("%s %s",taro,hana);
        if(strcmp(taro,hana)==0){
            ta+=1;
            ha+=1;
        }else if(strcmp(taro,hana)>0){
            ta+=3;
        }else{
            ha+=3;
        }
    }
    printf("%d %d\n",ta,ha);
    return 0;
}


Measured memory_bytes: 2148
import std.algorithm;
import std.conv;
import std.stdio;
import std.string;

void main()
{
	auto abcxy = readln.split.map!( to!int );
	writeln( solve( abcxy[ 0 ], abcxy[ 1 ], abcxy[ 2 ], abcxy[ 3 ], abcxy[ 4 ] ) );
}

int solve( in int a, in int b, in int c, in int x, in int y )
{
	auto cc = c * 2;
	
	if( a + b < cc ) return ( a * x ) + ( b * y );
	
	if( x < y )
	{
		if( b < cc ) return ( cc * x ) + ( b  * ( y - x ) );
		else         return ( cc * x ) + ( cc * ( y - x ) );
	}
	else
	{
		if( a < cc ) return ( cc * y ) + ( a  * ( x - y ) );
		else         return ( cc * y ) + ( cc * ( x - y ) );
	}
}

unittest
{
	assert( solve( 1500, 2000, 1600, 3, 2 ) == 7900 );
	assert( solve( 1500, 2000, 1900, 3, 2 ) == 8500 );
	assert( solve( 1500, 2000, 500, 90000, 100000 ) == 100000000 );
}


Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] and l[j] != l[k] and l[i] + l[j] > l[k]:
                ans += 1
print(ans)


Measured memory_bytes: 68028
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int f(vl a){
	int n=a.size();
	sort(a.begin(),a.end());
	if(n%2==1) return a[n/2];
	return (a[n/2-1]+a[n/2])/2;
}

ll n;
vl a,b;

int main(){
	cin>>n;
	a=b=vl(n);
	for(int i=0;i<n;i++) cin>>a[i]>>b[i];
	if(n%2==0) for(int i=0;i<n;i++) a[i]*=2,b[i]*=2;
	int l=f(a),r=f(b);
	cout<<r-l+1<<endl;
}

Measured memory_bytes: 8012
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& vec) {
    out << "[";
    for (int x : vec) out << x << ", ";
    out << "]";
    return out;
}

#if DEBUG && !ONLINE_JUDGE
    #define dbg_var(x) cerr << #x << ": " << x << endl;
#endif

int N;
int P[500*500];
int cinema[500*500+1];
int q[500*500+1];

void compute(){
    int x = 0;
    vector<int> curr;
    vector<int> pross;
    vector<bool> inserito(N*N+1, false);
    
    for(int i=1; i<=N; i++) if(cinema[i]) pross.push_back(i); else curr.push_back(i);
    for(int i=N*N-N+1; i<=N*N; i++) if(cinema[i]) pross.push_back(i); else curr.push_back(i);
    for(int i=N+1; i<N*N-N; i+=N) if(cinema[i]) pross.push_back(i); else curr.push_back(i);
    for(int i=2*N; i<N*N; i+=N) if(cinema[i]) pross.push_back(i); else curr.push_back(i);
    
    for(int p:curr) inserito[p] = true;
    for(int p:pross) inserito[p] = true;
    
    for(int i=0; i<N*N; i++){
        if(curr.empty()){
            x++;
            curr = pross;
            pross.clear();
        }
        int p = curr.back();
        curr.pop_back();
        q[p] = x;
        
        if(p > N and not inserito[p-N]){
            inserito[p-N] = true;
            if(cinema[p-N]) pross.push_back(p-N); else curr.push_back(p-N);
        }
        if(p <= (N-1)*N and not inserito[p+N]){
            inserito[p+N] = true;
            if(cinema[p+N]) pross.push_back(p+N); else curr.push_back(p+N);
        }
        if((p % N != 0) and not inserito[p+1]){
            inserito[p+1] = true;
            if(cinema[p+1]) pross.push_back(p+1); else curr.push_back(p+1);
        }
        if((p % N != 1) and not inserito[p-1]){
            inserito[p-1] = true;
            if(cinema[p-1]) pross.push_back(p-1); else curr.push_back(p-1);
        }
    }
}

void aggiorna(int pos){
    cinema[pos] = 0;
    vector<int> curr = {pos};
    vector<bool> aggiornato(N*N+1, false);
    
    while(not curr.empty()){
        int p = curr.back();
        curr.pop_back();
        if(aggiornato[p]) continue;
        q[p]--;
        aggiornato[p] = true;
        
        if(p > N and q[p-N] > q[p]+cinema[p-N]) curr.push_back(p-N);
        if(p <= (N-1)*N and q[p+N] > q[p]+cinema[p+N]) curr.push_back(p+N);
        if((p % N != 0) and q[p+1] > q[p]+cinema[p+1]) curr.push_back(p+1);
        if((p % N != 1) and q[p-1] > q[p]+cinema[p-1]) curr.push_back(p-1);
    }
}

void print(){
    for(int i=0; i<N; i++){
        for(int j=1; j<=N; j++){
            cerr << q[N*i+j] << ' ';
        }
        cerr << endl;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> N;
    for(int i=0; i<N*N; i++){
        cin >> P[i];
        cinema[i+1] = 1;
    }
    compute();
    //~ print();
    int ans = 0;
    for(int i=0; i<N*N; i++){
        aggiorna(P[i]);
        //~ cerr << "AGG " << P[i] << endl;
        //~ print();
        //~ cerr << P[i] << ' ' << q[P[i]] << endl;
        ans += q[P[i]];
    }
    cout << ans << '\n';
    
    return 0;
}


Measured memory_bytes: 8196
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int main(){
	int n;
	int x;
	cin >> n;

	for (int i = 1; i <= n; i++){
		if (i % 3 == 0){
			cout << " " << i;
		}
		else{
			x = i;
			while (x>0){
				if (x % 10 == 3){
					cout << " " << i;
					break;
				}
				x /= 10;
			}
		}
	}

	cout << endl;

	return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 4e3 + 11;
int n, a[N];
int S[3][N];
char s[N];
int main(){
    cin>>n>>s + 1;
    LL ans = 0;
    for(int i = 1;i <= n; i++){
        if(s[i] == 'R')a[i] = 0;
        else if(s[i] == 'G')a[i] = 1;
        else a[i] = 2;
        S[a[i]][i]++;
        S[0][i] += S[0][i-1];
        S[1][i] += S[1][i-1];
        S[2][i] += S[2][i-1];
    }
    for(int i = 1;i <= n; i++){
        for(int j = i + 1;j <= n; j++){
            if(a[i] != a[j]){
                int len = j - i;
                ans += S[3^a[i]^a[j]][n] - S[3^a[i]^a[j]][j];
                if(j + len > n)continue;
                ans -= a[j+len] == (3 ^ a[i] ^ a[j]);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3700
#include<iostream>
#include<algorithm>
#include <vector>
#include <cmath>
#include<string>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    string n;
    int a,b;
    int ans=10000;
    const int CO=753;
    cin>>n;
    REP(i,n.size()-2){
        a=(n[i]-'0')*100+(n[i+1]-'0')*10+(n[i+2]-'0');
        ans=min(ans,abs(CO-a));
    };
    cout<<ans<<endl;
    
    
    return 0;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int main() {
  int n = 10005;
  repn(i,n){
    int x;
    cin >> x;
    if (x == 0){break;}
    cout << "Case " << i << ": " << x << endl;
  }

 
}


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



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

    ll i,j,k,l,m,n;

    string s;

    cin >> s;

    n = s.size();
    if(s[n-1] != 's')
    {
        s += "s";
    }
    else
    {
        s += "es";
    }

    cout << s << '\n';



}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

long long n, zero = 0;
vector<long long> a, po, ne;
vector<pair<long long, long long> > ans;

long long solve();

int main() {
  cin >> n;
  a.resize(n);
  for(int i = 0; i < n; ++i) cin >> a[i];
  for(int i = 0; i < n; ++i)
    if(a[i] > 0)
      po.push_back(a[i]);
    else if(a[i] < 0)
      ne.push_back(a[i]);
    else
      ++zero;
  sort(ne.begin(), ne.end());
  sort(po.begin(), po.end());
  cout << solve() << endl;
  assert(ans.size() == n - 1);
  for(int i = 0; i < ans.size(); ++i)
    cout << ans[i].fi << " " << ans[i].se << endl;
  return 0;
}

long long solve() {
  if(n == zero) {
    for(int i = 0; i < n - 1; ++i) ans.push_back({0, 0});
    return 0;
  }
  if(n == 2) {
    ans.push_back({max(a[0], a[1]), min(a[0], a[1])});
    return max(a[0] - a[1], a[1] - a[0]);
  }
  if(po.size() == 0) {
    if(zero != 0) {
      ans.push_back({0, ne[0]});
      po.push_back(-ne[0]);
      ne.erase(ne.begin());
      --zero;
    }
    else {
      long long idx = 0, idy = 0, num = 1000000000;
      for(int i = 1; i < ne.size(); ++i)
        if(num > abs(-ne[i] - ne[i - 1] -
                     abs(ne[i] - ne[i - 1]))) {
          idx = i - 1;
          idy = i;
          num = abs(-ne[i] - ne[i - 1] -
                    abs(ne[i] - ne[i - 1]));
        }
      ans.push_back({ne[idy], ne[idx]});
      po.push_back(abs(ne[idx] - ne[idy]));
      ne.erase(ne.begin() + idy);
      ne.erase(ne.begin() + idx);
    }
  }
  if(ne.size() == 0) {
    if(zero != 0) {
      ans.push_back({0, po[0]});
      ne.push_back(-po[0]);
      po.erase(po.begin());
      --zero;
    }
    else {
      long long idx = 0, idy = 0, num = 1000000000;
      for(int i = 1; i < po.size(); ++i)
        if(num > abs(po[i] + po[i - 1] -
                     abs(po[i] - po[i - 1]))) {
          idx = i - 1;
          idy = i;
          num = abs(po[i] + po[i - 1] -
                    abs(po[i] - po[i - 1]));
        }
      ans.push_back({po[idx], po[idy]});
      ne.push_back(-abs(po[idy] - po[idx]));
      po.erase(po.begin() + idy);
      po.erase(po.begin() + idx);
    }
  }
  for(int i = 0; i < zero; ++i) ans.push_back({po[0], 0});
  for(int i = 1; i < po.size(); ++i) {
    ans.push_back({ne[0], po[i]});
    ne[0] -= po[i];
  }
  for(int i = 0; i < ne.size(); ++i) {
    ans.push_back({po[0], ne[i]});
    po[0] -= ne[i];
  }
  return po[0];
}

Measured memory_bytes: 7024
//abc166_b.cpp
//Sun May  3 20:54:14 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int kasi[n];
	fill(kasi,kasi+n,0);
	for (int i=0;i<k;i++){
		int d;
		cin >> d;
		for (int j=0;j<d;j++){
			int a;
			cin >> a;
			a--;
			kasi[a]++;
		}
	}

	int ans = 0;
	for (int i=0;i<n;i++){
		if (kasi[i]==0){
			ans++;
		}
	}

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 3652
import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	double a = sc.nextInt();
	double  b = sc.nextInt();
	double  d = a / b;
	double r = a % b;

	System.out.print((int)d+" "+(int)r+" ");
	System.out.printf("%f\n", d );
	
	}

}

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

std::string has_win(int bingo[3][3], std::vector<int> selections)
{
  // row
  int count = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int si = 0; si < selections.size(); si++) {
        if (selections[si] == bingo[i][j]) {
          count++;
          break;
        }
      }
    }
    if (count == 3) return "Yes";
    count = 0;
  }

  // column
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int si = 0; si < selections.size(); si++) {
        if (selections[si] == bingo[j][i]) {
          count++;
          break;
        }
      }
    }
    if (count == 3) return "Yes";
    count = 0;
  }

  // r->l diagonal
  for (int i = 0; i < 3; i++) {
    for (int si = 0; si < selections.size(); si++) {
      if (selections[si] == bingo[i][i]) {
        count++;
        break;
      }
    }
  }
  if (count == 3) return "Yes";
  count = 0;

  // l->rdiagonal
  for (int i = 0; i < 3; i++) {
    for (int si = 0; si < selections.size(); si++) {
      if (selections[si] == bingo[i][2 - i]) {
        count++;
        break;
      }
    }
  }
  if (count == 3) return "Yes";
  return "No";
}

int main()
{
  int bingo[3][3];
  int n;

  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      std::cin >> bingo[i][j];
    }
  }
  std::cin >> n;
  std::vector<int> b(n);
  int input;
  for (int i = 0; i < n; i++) {
    std::cin >> input;
    b.push_back(input);
  }

  std::cout << has_win(bingo, b) << std::endl;
}



Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        int N = sc.nextInt();
        int M = sc.nextInt();
        int C = sc.nextInt();
        var B = sc.ArrayInt(M);
        var A = new int[N][];
        for (int i = 0; i < N; i++) {
            A[i] = sc.ArrayInt(M);
        }
        int ans = 0;
        for (int i = 0; i < N; i++) {
            int sum = 0;
            for (int j = 0; j < M; j++) {
                sum += A[i][j] * B[j];
            }
            if (sum + C > 0) ans++;
        }
        WriteLine(ans);

    }
}


class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 13268
N=int(input())
task=[list(map(int,input().split())) for _ in range(N)]
time=0
flag=1
task.sort(lambda x:x[1])
#print(task)
for i in range(N):
    time=time+task[i][0]
    if not(time<=task[i][1]):
        flag=0
        break
if flag==1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 88024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int ans=0;
    string s,t;
    cin >> s >> t;
    for(int i=0; i<s.length(); i++){
        if(s.at(i)!=t.at(i)) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3824
#include <iostream>
#include <string>

using namespace std;

int main()
{
 int array[10001];
 int i = 0;
 while (cin>>array[++i]){}
 i = 0;
 while (array[++i])
 {
  cout << "Case " << i << ": " << array[i] << endl;
 }
 return 0;
}



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

using namespace std;

using ll = long double;

constexpr char newl = '\n';
constexpr ll PI = 3.14159265358979;

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

    ll a, b;
    cin >> a >> b;

    int h, m;
    cin >> h >> m;

    ll deg = (h * 60 + m) * (ll)5.5 * PI / 180;
    cout << fixed << setprecision(15) << sqrt(a * a + b * b - 2 * a * b * cos(deg)) << newl;

    return 0;
}

Measured memory_bytes: 4120
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << 48-n << endl;

    return 0;
}

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

int keta(int n){
  int a=10;
  int ans=1;
  while(1){
    if (a > n) break;
    a *= 10;
    ans ++;
  }
  return ans;
}

int main(){
  int N;
  cin >> N;
  
  int ans = 0;
  
  for (int i=1;i<=N;i++){
    if(keta(i) % 2 == 1) ans ++;
  }
  
  cout << ans << endl;
}

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

std::vector<std::vector<int>> vec;
std::vector<int> dp;

int dfs(int node)
{
	if (vec[node].empty())
		return 0;
	if (dp[node] != -1)
		return dp[node];
	int max = 0;
	for (int i : vec[node])
	{
		int temp = dfs(i);
		dp[i] = temp;
		max = std::max(max, temp);
	}
	return max + 1;
}

int main()
{
	int n, m;
	std::cin >> n >> m;
	vec = std::vector<std::vector<int>>(n + 1);
	dp = std::vector<int>(n + 1, -1);
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		std::cin >> x >> y;
		vec[x].push_back(y);
	}
	int max = 0;
	for (int i = 1; i <= n; ++i)
		max = std::max(max, dfs(i));
	std::cout << max << '\n';
	return 0;
}

Measured memory_bytes: 8192
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define LL long long
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
  string S;
  FOR(i,0,3){
    cin>>S;
    cout<<S[i];
  }
  cout<<endl;
  return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 58) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


struct UnionFind {
  vector< int > data;

  UnionFind(int sz) {
    data.assign(sz, -1);
  }

  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k) {
    return (-data[find(k)]);
  }
};


int main() {
  int N, M, K;
  cin >> N >> M >> K;
  UnionFind uf(N);
  vector< int > A(M), B(M), deg(N);
  for(int i = 0; i < M; i++) {
    cin >> A[i] >> B[i];
    --A[i], --B[i];
    uf.unite(A[i], B[i]);
    deg[A[i]]++;
    deg[B[i]]++;
  }
  for(int i = 0; i < K; i++) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    if(uf.find(a) == uf.find(b)) {
      deg[a]++;
      deg[b]++;
    }
  }

  for(int i = 0; i < N; i++) {
    int cand = uf.size(i);
    cand -= deg[i];
    cout << cand - 1 << " ";
  }
  cout << endl;
}

Measured memory_bytes: 2432
n,x=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
for i in range(n-1):
    if a[i]+a[i+1]>x:
            cnt+=a[i]+a[i+1]-x
            a[i+1]-=a[i]+a[i+1]-x
    if a[i+1]<0:
        a[i+1]=0
print(cnt)

Measured memory_bytes: 63856
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

string s,t;

int main()
{
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>> s >> t;
    int ls = s.length(),lt = t.length(),mn = 9999999;
    if(ls==lt){
        int cnt=0;
        for(int i=0;i<ls;i++){
            if(s[i]!=t[i]){
                cnt++;
            }
        }
        cout<< cnt << endl;
        return 0;
    }
    for(int i=0;i<ls-lt;i++){
        int cnt = 0;
        for(int j=i,k=0;j<i+lt;j++,k++){
            if(s[j]!=t[k]){
                cnt++;
            }
        }
        mn = min(cnt,mn);
    }
    cout<< mn << endl;

    return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>
int main(){
    int A,B,C;
    scanf("%d%d%d",&A,&B,&C);
    if(((A<C)&&(C<B))||((B<C)&&(C<A))){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}

Measured memory_bytes: 128
import numpy as np
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
act = np.array(list(t.replace('r','P').replace('s','R').replace('p','S')))
for a in range(k, len(act)):
    if act[a] == act[a-k]:
        act[a] = 'Z'
score_dict = {'R':r, 'S':s, 'P':p, 'Z':0}
score = np.array([score_dict[i] for i in act])
print(score.sum())

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


int main(){ 
  string s; cin >> s;
  ll n = s.size(); bool flag = true;
  
  rep(i,n){
    if(s.at(i) != s.at(n-i-1)){
      flag = false;
      break;
    }
  }
  
  rep(i,(n-1)/2){
    if(s.at(i) != s.at((n-3)/2-i)){
      flag = false;
      break;
    }
  }
  
  for(ll i = (n+1)/2; i < n; i++){
    if(s.at(i) != s.at((3*n-1)/2-i)){
      flag = false;
      break;
    }
  }
  
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import Control.Monad
import Data.List
main = getLine >>= main' . fmap read . words
    where
        main' [n, m] = replicateM 2 getLine >>= print . solve n m . fmap (fmap read . words)

solve :: Integer -> Integer -> [[Integer]] -> Integer
solve n m [xs, ys] = sumf n xs * sumf m ys `mod` modm
    where
        sumf c = foldl' (\acc (i, x) -> (acc + x * (2 * i - c - 1)) `mod` modm) 0 . zip [1..]

modm :: Integer
modm = 7 + 10 ^ 9


Measured memory_bytes: 88828
#include <bits/stdc++.h>
using namespace std;
int main(){
  int s,n,m,p[12]={31,29,31,30,31,30,31,31,30,31,30,31},i;
  string d[] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  while(cin>>n>>m,n){
    for(s=i=0;i<n-1;i++)s+=p[i];
      cout<<d[(s+m)%7]<<endl;
  }
}

Measured memory_bytes: 3012
#include<iostream>
#include<string>

using namespace std;
bool checkPali(string s) {
	for (int i = 0; i <= s.length()/2; i++) {
		if (s[i] != s[s.length() - 1 - i]) {
			return false;
		}
	}
	return true;
}
int main() {
	string s;
	int count = 0;
	cin >> s;
	while (checkPali(s) == false)
	{
		for (int i = 0; i <= s.length()/2; i++) {
			if (s[i] != s[s.length() - i - 1]) {
				s[i] = s[s.length() - i - 1];
				count++;
			}
		}
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 256
local s=io.read()

if #s==26 then
    for i=#s,2,-1 do
        if s:sub(i,i)>s:sub(i-1,i-1) then
            s=s:sub(1,i-1)
            break
        end
    end
    if #s==26 then
        print(-1)
        return
    else
        for i=97,122 do
            local c=string.char(i)
            if not s:find(c) and s:sub(#s,#s)<c then
                print(s:sub(1,#s-1)..c)
                break
            end
        end
    end
elseif #s==1 then
    for i=97,122 do
        local c=string.char(i)
        if not s:find(c) and s:sub(#s,#s)<c then
            print(s:sub(1,#s-1)..c)
            break
        end
    end
else
    for i=97,122 do
        local c=string.char(i)
        if not s:find(c) then
            print(s..c)
            break
        end
    end
end

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

int main(){
    int n;
    cin>>n;
    vector<ll> a(n);
    vector<ll> b(n);
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    ll ans=0;
    for(int i=n-1;i>=0;i--){
        a[i]+=ans;
        ll now=0;
        if(a[i]%b[i]!=0){
            now=b[i]-a[i]%b[i];
        }
        ans+=now;
    }
    cout<<ans<<endl;
}

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

#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define OUT(a) cout << (a) << "\n"
#define ll long long
#define uint unsigned int
#define ushort unsigned short
#define ulong unsigned long

ll MOD = 10e9 + 7;

int main() {
    ll L,R;
    cin >> L >> R;
    // r - l 2019以上
    ll mins = 2019;
    if ((R - L) >= 2019) mins = 0;
    else {
        for(ll i=L; i<R; i++) {
            for(ll j=i+1; j<R+1; j++) {
                mins = min(mins, (i*j)%2019);
            }
        }
    }
    cout << mins << endl;
    return 0;
}


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

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	int n; cin >> n;
	vector<int> v;
	for(int i=0;i<n;i++){
		int b; cin >> b;
		b--;
		v.push_back(b);
	}
	vector<int> ans;
	for(int i=0;i<n;i++){
		for(int j=n-i-1;j>=0;j--){
			if(j<v[j]){
				cout << -1 << endl;
				return 0;
			}
			else if(j==v[j]){
				ans.push_back(v[j]);
				v.erase(v.begin()+j);
				break;
			}
		}
	}
	for(int i=n-1;i>=0;i--){
		cout << ans[i]+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
  long long int X, Y;
  long int N, D;
  int ans = 0;
  
  std::cin >> N >> D;
  
  for(int i = 0; i < N; ++ i){
    std::cin >> X >> Y;
    
    if(X*X + Y*Y <= D*D)++ ans;
  }
  
  std::cout << ans;
  
  return 0;
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define EPS 1e-9
 
using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(n) cin >> a[i];
    sort(rall(a));

    int alice = 0, bob = 0;
    rep(n){
        if(i%2) bob += a[i];
        else alice += a[i];
    }
    cout << alice - bob << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

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

    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout << (a-c)*(b-d)<<endl;
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<vector<int>> A(N, vector<int>(N,0));
    vector<vector<int>> v(N*N);
    vector<int> cnt(N*N, 0);

    auto id = [&](int x, int y){
        return x*N+y;
    };
    for(int i=0;i<N;i++){
        for(int j=0;j<N-1;j++){
            cin >> A[i][j];
            A[i][j]--;
            if(j == 0) continue;
            
            int a = (i < A[i][j-1] ? id(i, A[i][j-1]) : id(A[i][j-1], i));
            int b = (i < A[i][j]? id (i, A[i][j]) : id(A[i][j], i));
            v[a].push_back(b);
            cnt[b]++;
        }
    }

    vector<int> vis(N*N);
    function<bool(int)> dfs = [&](int n){
        bool ok = true;
        vis[n] = -1;
        for(auto x:v[n]){
            //未訪問　=> 再帰
            if(vis[x] == 0) ok &= dfs(x);
            //閉路検出 => false
            else if(vis[x] == -1) return false;
        }
        vis[n] = 1;
        return ok;
    };

    for(int i=0;i<N*N;i++){
        if(!dfs(i)){
            cout << -1 << endl;
            return 0;
        }
    }

    for(int i=0;i<N*N;i++) vis[i] = 0;
    vector<int> u;
    function<void(int)> dfs2 = [&](int n){
        vis[n] = 1;
        for(auto x:v[n]) if(vis[x] == 0) dfs2(x);
        u.push_back(n);
    };
    for(int i=0;i<N*N;i++) if(cnt[i] == 0 && vis[i] == 0) dfs2(i);
    reverse(u.begin(), u.end());
    vector<int> dp(N*N);
    for(int i=0;i<u.size();i++){
        for(auto x:v[u[i]]){
            dp[x] = max(dp[x], dp[u[i]] + 1);
        }
    }
    int ans = 0;
    for(int i=0;i<N*N;i++) ans = max(ans, dp[i]);
    cout << ans+1 << endl;
}

Measured memory_bytes: 59120
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
typedef long long ll;
using namespace std;
int n,a;
ll dp[52][52][2550];
int num[55];
int main(){
	scanf("%d%d",&n,&a);
	for(int i=1;i<=n;i++) scanf("%d",&num[i]);
	dp[1][1][num[1]]=1;
	for(int i=2;i<=n;i++){
		dp[i][1][num[i]]=1;
		for(int f=1;f<=i;f++){
			for(int j=1;j<i;j++){
				for(int k=1;k<=(j*50);k++){
					dp[i][f][num[i]+k]+=dp[j][f-1][k];
				}
			}
		}
	}
	ll ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++){
			ans+=dp[i][j][j*a];
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 51456
// Abhinav -- organize and stay in moment
#include <bits/stdc++.h>
using namespace std; 
#define ff first
#define ss second
using namespace std;
#define MP make_pair
#define pb push_back
#define ll long long
#define int long long
#define f(i,x,n) for(int i=x;i<n;i++)
#define ld long double
#define mod 1000000007
int x,y,d;
void gcd(int a,int b){
	if(b==0){
		d=a;
		x=1;
		y=0;
		return ;
	}
	gcd(b,a%b);
	int X,Y;
	X=y;
	Y=x-(a/b)*y;
	x=X;  y=Y;
}
int a,b,c,m; 
int exp(int a,int b){
	m=b+1;
	int res=1;
	while(b!=0){
		if(b&1){
			res*=a;
			res%=m;
		}
		b/=2;
		a*=a; a%=m;
	}
	return res;
}
void prime(){
	int n; cin>>n;
	if(n<2){
		cout<<"composite\n";
		return ;
	}else if(n==2){
		cout<<"prime\n";
		return ;
	}else if(n%2==0){
		cout<<"composite\n";
		return ;
	}else {
		for(int i=3;i*i<=n;i+=2){
			if(n%i==0){
				cout<<"composite\n";
				return ;
			}
		}
		cout<<"prime\n";
	}
}
void toutient(int n) {
    vector<int> phi(n + 1);
    phi[0] = 0;
    phi[1] = 1;
    for (int i = 2; i <= n; i++)
        phi[i] = i - 1;

    for (int i = 2; i <= n; i++)
        for (int j = 2 * i; j <= n; j += i)
              phi[j] -= phi[i];
	cout<<phi[n];
}
int pr[1000005];
int dig(int a){
	int s=0;
	while(a!=0){
		s+=(a%10);
		a/=10;
	}
	return s;
}
int ans[1000005];
vector<int> vp;
void seive(){
	pr[0]=pr[1]=1;
	for(int i=2;i<1000005;++i){
		if(pr[i]==0){
			vp.pb(i);
			for(int j=2*i;j<1000005;j+=i){
				pr[j]=1;
			}
		}
	}
}
int fpp(int a){
	int r=0;
	while(a%2==0){
		a/=2; ++r;
	}
	return r;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m; cin>>n>>m;
	int a[n]; int t=0;
	int cp=4*m;
	for(int i=0;i<n;++i){
		cin>>a[i];
		t+=a[i];
	}
	int sp=0;
	f(i,0,n){
		if(cp*a[i]>=t){
			++sp;
		}
	}
	if(sp>=m)
	cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

#define rep(i,a,b) for(int i=int(a),nn=int(b);i<=nn;++i)
#define vep(i,a,b) for(int i=int(a),nn=int(b);i>=nn;--i)
#define xep(i,b) for(int i=0,nn=int(b);i<nn;++i)
#define x first
#define y second
#define mp make_pair

typedef double ff;
typedef pair<int,ff> two;

const int N = 500100;

two q[N];

int hd, tl, n, L;
ff sm;

inline void in(int &x) {
  	char c=getchar(); int f=1;
	for (;c<'0'||c>'9';c=getchar()) f=(c=='-'?-1:f);
	for (x=0; c>='0'&&c<='9';c=getchar()) x=x*10+c-48;
	x *= f;
}
int main() {
  	in(n), in(L);
	hd = tl = 0, q[tl++]=mp(L, 0);

	int v, vv, tt, c; ff t;
	rep(i, 1, n) {
	  	in(tt), in(v), vv=v, t=tt;
		while (hd < tl && vv) {
		  	c = min(q[hd].x, vv);
			q[hd].x -= c, sm-=q[hd].y*c,vv -= c;
			if (!q[hd].x) ++hd;
		}
		sm += (ff)v*t;
		while (hd < tl && q[tl-1].y>=t) {
		 	--tl, t=((ff)v*t+(ff)q[tl].x*q[tl].y)/(v+q[tl].x);
			v += q[tl].x;
		}
		q[tl++] = mp(v,t);
		printf("%.10lf\n", sm/L);
	}
	return 0;
}


Measured memory_bytes: 18304
defmodule Main do
  def main do
    _ = IO.gets("")
    a = IO.gets("")
        |> String.trim()
        |> String.split(" ")
        |> Enum.map(&String.to_integer/1)

    a
    |> calc(0)
    |> IO.puts()

  end

  def calc([], acc), do: acc
  def calc([x, y | tail], acc) when x > y do
    calc([x | tail], acc + x-y)
  end
  def calc([_ | tail], acc) do
    calc(tail, acc)
  end

end


Measured memory_bytes: 80196
K, N = map(int, input().split())
A = list(map(int, input().split()))

shiftA = A[1:] + [K+A[0]]

subA = [shiftA[i] - A[i] for i in range(N)]
maxA = max(subA)
subA.remove(maxA)

print(sum(subA))


Measured memory_bytes: 26420