akhauriyash/Code-Regression huggingface dataset:
program balance
  implicit none
  integer :: n, w(100), s1, s2, m, i
  w = 0
  read(*,*) n
  read(*,*) w(1:n)
  s1 = 0
  s2 = sum(w(1:n))
  m = 10000000
  do i = 1, n
    s1 = s1+w(i)
    s2 = s2-w(i)
    m = min(m,abs(s2-s1))
  end do
  write(*,'(i0)') m
  stop
end program balance

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  vector<vector<int>> v1(N,vector<int>(2));
  vector<vector<int>> v2(M,vector<int>(2));
  for (int i=0;i<N;i++){
    cin >> v1.at(i).at(0) >> v1.at(i).at(1);
  }
  for (int j=0;j<M;j++){
    cin >> v2.at(j).at(0) >> v2.at(j).at(1);
  }
  for (int i=0;i<N;i++){
    int ans,count=1000000000;
    for (int j=0;j<M;j++){
      int count2;
      int x=v1.at(i).at(0)-v2.at(j).at(0),y=v1.at(i).at(1)-v2.at(j).at(1);
      if (x<0){
        x*=-1;
      }
      if (y<0){
        y*=-1;
      }
      count2=x+y;
      if (count2<count){
        count=count2;
        ans=j+1;
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
	int a, b;

	std::cin >> a >> b;

	if (a < b) {
		std::cout << "a < b" << std::endl;
	}
	else if (a == b) {
		std::cout << "a == b" << std::endl;
	}
	else {
		std::cout << "a > b" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3084
A = [0 for _ in range(9)]
A[0],A[1],A[2] = map(int,input().split())
A[3],A[4],A[5] = map(int,input().split())
A[6],A[7],A[8] = map(int,input().split())
N = int(input())
b = []
h = [ 0 for _ in range(9) ]
for i in range(N):
  b = int(input())
  for j in range(9):
    if A[j] == b:
      h[j] = 1
ans = 0
for i in range(3):
  if h[i*3] == h[i*3+1] == h[i*3+2] == 1:
    ans = 1
    break
  if h[i] == h[3+i] == h[6+i] == 1:
    ans = 1
    break
if h[0] == h[4] == h[8] == 1:
    ans = 1
if h[2] == h[4] == h[6] == 1:
    ans = 1
if ans == 0:
  print("No")
else:
  print("Yes")


Measured memory_bytes: 3064
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		int x=Integer.valueOf(cmd[0]);
		int n=Integer.valueOf(cmd[1]);
		int[] arr=new int[200];
		cmd=br.readLine().split(" ");
		for(int i=0;i<n;i++)
		{
			arr[Integer.valueOf(cmd[i])]=1;
		}
		int len=0;
		int ans=-1;
		while(true)
		{
			int a=x-len;
			int b=x+len;
			if(arr[a]==0)
			{
				ans=a;
				break;
			}
			if(arr[b]==0)
			{
				ans=b;
				break;
			}
			len++;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 32716
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a, b, c, d;
    
    scanf("%d%d%d%d", &a, &b, &c, &d);
    
    if (a*b<=c*d) {
        printf("%d", c*d);
    } else {
        printf("%d", a*b);
    }
    
    return 0;
}



Measured memory_bytes: 1708
#include <iostream>
using namespace std;
int main(void){
    int x,y;
    while(true){
        cin >> x >> y;
        if(x == 0 && y == 0){
            break;
        }
        if(x>y){
            cout << y << " " << x << endl;
        }
        else {
            cout << x << " " << y << endl;
        }
    }
}



Measured memory_bytes: 2980
#include<cstdio>
using namespace std;
int T,a,b,l,r;
int solve(int l,int r){int s1=(l-1)/(r+1)+1,s2=(r-1)/(l+1)+1;if(s1<s2)s1=s2;return s1?s1:1;}
int main()
{
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d%d%d%d",&a,&b,&l,&r);
		int as=solve(a,b);
		int lb=0,rb=1e9,as1=0;
		while(lb<=rb)
		{
			int mid=(lb+rb)>>1,fg=1;
			if(1ll*as*mid>a||mid>b)fg=0;
			if(fg&&solve(a-as*mid,b-mid+1)>as)fg=0;
			if(fg)as1=mid,lb=mid+1;
			else rb=mid-1;
		}
		int tp=as1*(as+1);
		if(l<=tp)for(int i=l;i<=r&&i<=tp;i++)printf("%c",i%(as+1)?'A':'B');
		a-=as*as1,b-=as1;
		l-=tp,r-=tp;if(l<1)l=1;
		lb=0,rb=as,as1=0;
		while(lb<=rb)
		{
			int mid=(lb+rb)>>1,fg=1;
			if(mid>a)fg=0;
			if(fg&&solve(a-mid,b)>as)fg=0;
			if(fg)as1=mid,lb=mid+1;
			else rb=mid-1;
		}
		if(l<=as1)for(int i=l;i<=r&&i<=as1;i++)printf("A");
		a-=as1;l-=as1,r-=as1;if(l<1)l=1;
		lb=0,rb=as,as1=0;
		while(lb<=rb)
		{
			int mid=(lb+rb)>>1,fg=1;
			if(mid>b)fg=0;
			if(fg&&solve(a,b-mid)>as)fg=0;
			if(fg)as1=mid,rb=mid-1;
			else lb=mid+1;
		}
		if(l<=as1)for(int i=l;i<=r&&i<=as1;i++)printf("B");
		b-=as1;l-=as1,r-=as1;if(l<1)l=1;
		int las=b-a*as;
		for(int i=l;i<=las&&i<=r;i++)printf("B");
		r-=las;l-=las;if(l<1)l=1;
		for(int i=l;i<=r;i++)printf("%c",i%(as+1)==1?'A':'B');
		printf("\n");
	}
}

Measured memory_bytes: 256
#include <stdio.h>
const int N=110;
const int INF=1<<30;
int min(int a,int b){
    return a>b?b:a;
}
int main(){
    int n,dp[N][N],a[N];
    scanf("%d%d%d",&n,&a[0],&a[1]);
    for(int i=1;i<n;i++)scanf("%d%d",&a[i],&a[i+1]);
    for(int k=1;k<n;k++){
        for(int i=0;i<n-k;i++){
            dp[i][i+k]=INF;
            for(int j=i;j<i+k;j++)dp[i][i+k]=min(dp[i][i+k],dp[i][j]+dp[j+1][i+k]+a[i]*a[j+1]*a[i+k+1]);
        }
    }
    printf("%d\n",dp[0][n-1]);
}


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



int main() {
 	long long a,b,c ;
   long double x;
  cin >> a >> b >>c;
  x=sqrtl(a*b);
   
  if(a+b+2*x<c){
  cout << "Yes" << endl;
  }
  else {
    cout << "No"<< endl;
  }
}
  
 

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

int main() {
	// your code goes here
	long double a, b, c;
	cin >> a >> b >> c;
	long double epsilon = 1e-14;
	if(sqrt(a) + sqrt(b) + epsilon < sqrt(c)){
	    cout << "Yes" << endl;
	}
	else{
	    cout << "No" << endl;
	}
	return 0;
}


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

const int INF = 1e9 + 5;

int main(){
  int n,k;
  cin >> n >> k;
  
  vector<int> a(n);
  
  for(int i=0; i < n; i++){
    cin >> a[i];
  }
  vector<int> dp(n, INF);
  
  dp[0] = 0;
  
  for(int i=0; i < n; i++){
    for(int j=i+1; j <= i+k; j++){
      if(j < n){
        dp[j] = min(dp[j], dp[i] + abs(a[i] - a[j]));
      }      
    }
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
n = int(input())
XY = []
for i in range(n):
    x, y = map(int, input().split())
    XY.append((x, y))

if n == 1:
    print(1)
    exit()
    
D = {}
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        a = XY[i][0]
        b = XY[i][1]
        c = XY[j][0]
        d = XY[j][1]
        p = c-a
        q = d-b
        if (p, q) in D:
            D[(p, q)] += 1
        else:
            D[(p,q)] = 1

D = list(D.items())
D.sort(key = lambda x: -x[1])
print(n-D[0][1])


Measured memory_bytes: 39664
MOD = 10 ** 9 + 7
n = int(input())
dp = [[[1] * 4 for _ in [0] * 4] for _ in [0] * 4]
dp[0][2][1] = 0
dp[0][1][2] = 0
dp[2][0][1] = 0
for _ in range(n - 3):
    ndp = [[[0] * 4 for _ in [0] * 4] for _ in [0] * 4]
    for i in range(4):
        for j in range(4):
            for k in range(4):
                for l in range(4):
                    if (i, k, l) == (0, 2, 1) or (i, j, l) == (0, 2, 1):
                        pass
                    else:
                        ndp[j][k][l] += dp[i][j][k]
    dp = ndp
    dp[0][2][1] = 0
    dp[0][1][2] = 0
    dp[2][0][1] = 0
    for j in range(4):
        for k in range(4):
            for l in range(4):
                dp[j][k][l] %= MOD
print(sum(z for x in dp for y in x for z in y) % MOD)


Measured memory_bytes: 3064
/*DPを用いて実装してみる、解説は結構難しい問題なので気にしない方が良いかもです。
DPを思いついたけど、使わなかった理由の一つは、 DPを使うときに、1000000ぐらいの個数の最小値を出さないといけないと思ったから。
この辺りがしっかり実装できるのかを確認しよう
*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1009991
vector<ll> memo;
ll dp(int n)
{
    if (n < 0)
    {
        return INF;
    }
    if (n == 0)
    {
        return 0;
    }
    if (memo[n] != -1)
    {
        return memo[n];
    }
    ll res = INF;
    ll k = 1;
    while (k <= n)
    {
        res = min(res, dp(n - k) + 1); //最も小さいもの、
        k *= 6;
    }
    ll j = 1;
    while (j <= n)
    {
        res = min(res, dp(n - j) + 1); //最も小さいもの、
        j *= 9;
    }
    memo[n] = res;
    return res;
}

int main()
{

    ll N;
    cin >> N;
    memo.resize(N + 10);
    rep(i, N + 10)
    {
        memo[i] = -1;
    }
    cout << dp(N);
    // cout << memo[1];
}

Measured memory_bytes: 5760
#include <stdio.h>
#include <stdlib.h>
int main(){
  int n,m,i;
  long result=1;
  
  scanf("%d %d",&n,&m);
  if(abs(n-m)>1){
    printf("0");
    return 0;
  }
  
  if(n!=m){
    for(i=1;i<=n;i++){
      result=result*i%1000000007;
    }
    for(i=1;i<=m;i++){
      result=result*i%1000000007;
    }
  } else {
    for(i=1;i<=n;i++){
      result=result*i%1000000007;
    }
    for(i=1;i<=m;i++){
      result=result*i%1000000007;
    }
    result=(result*2)%1000000007;
  }
  
  printf("%ld",result);
}

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

int main(void){

	int n; 
	while (cin >> n, n){
		vector<int> dp(n + 5);

		dp[0] = 1;
		dp[1] = 1;
		dp[2] = 2;
		dp[3] = 4;
		for (int i = 4; i <= n; i++){
			dp[i] = dp[i - 3] + dp[i - 2] + dp[i - 1];
		}


		cout << (((dp[n] + 9) / 10) + 364) / 365 << endl;

	}


	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(){
    int n;cin>>n;
    int t,a,memo;cin>>t>>a;
    double best=1000000;
    for(int i=1;i<=n;i++){
        int x;cin>>x;
        double tmp=t-x*0.006;
        if(abs(tmp-a)<best){
            best=abs(tmp-a);
            memo=i;
        }
    }
    cout<<memo<<endl;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001

int32_t main()
{   
    string s,t;
    cin>>s;
    cin>>t;

    int cnt=0;
    for(int i=0;s[i];i++){
        if(s[i]!=t[i])
            cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3860
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl

using namespace std;

template<typename S,typename T>auto&operator<<(auto&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(auto&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(auto&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(auto&o,map<K,T>&m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(auto&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}
template<typename S,typename T,typename U>
struct TRI{S fi;T se;U th;TRI(){}TRI(S f,T s,U t):fi(f),se(s),th(t){}};
template<typename S,typename T,typename U>
auto& operator<<(auto& o,TRI<S,T,U>& t){return o<<"{"<<t.fi<<","<<t.se<<","<<t.th<<"}";}

typedef pair<int, int> P;
typedef pair<ll, ll> pll;
typedef TRI<int, int, int> tri;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 100005;

vector<int> G[MAX_N];
int c[MAX_N], d[MAX_N];

void dfs(int u, int col, int dep, int mx)
{
    if(dep > mx) return;
    if(d[u] >= mx-dep) return;
    if(!c[u]) c[u] = col;
    d[u] = mx-dep;
    each(v,G[u]){
        dfs(v, col, dep+1, mx);
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        --a, --b;
        G[a].pb(b), G[b].pb(a);
    }
    rep(i,n) d[i] = -1;
    int q;
    cin >> q;
    vector<tri> vec(q);
    rep(i,q){
        int v,d,c;
        cin >> v >> d >> c;
        vec[i] = (tri){v-1,d,c};
    }
    rrep(i,q){
        dfs(vec[i].fi, vec[i].th, 0, vec[i].se);
    }
    rep(i,n){
        cout << c[i] << "\n";
    }
    return 0;
}


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

int selectionSort(int A[], int N) {
  int counter = 0;
  for (int i=0; i<N; i++) {
    int minj = i;
    for (int j=i; j<N; j++) {
      if (A[j]<A[minj]) {
        minj = j;
      }
    }
    swap(A[i], A[minj]);
    if (i != minj) counter++;
  }
  return counter;
}

int main() {
  int N, A[100];
  cin >> N;

  for (int i=0; i<N; i++) cin >> A[i];

  int counter = selectionSort(A, N);
  
  for (int i=0; i<N; i++) {
    if (i>0) cout << " ";
    cout << A[i];
  }
  cout << endl;

  cout << counter << endl;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(n*a,b)<<endl;
    return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    res = set()
    n_order = int(input())
    for i in range(n_order):
        order = input().split()
        if 'insert' == order[0]: 
            res.add(order[1])
        elif 'find' == order[0]:
            if order[1] in res: print('yes')
            else : print('no')


Measured memory_bytes: 30988
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<vector>
#include<tgmath.h>
using namespace std;

#define lld long long

int main(){
    long double L;
    cin >> L;
    L /= 3;
    printf("%.12Lf\n",L*L*L);
}

Measured memory_bytes: 256
import copy
import heapq
import math

def j(n):
    if n:print("Yes")
    else:print("No")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)

n = ip()
s = input()

let = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(s)):
    p = let.index(s[i])
    p+=n
    print(let[p%26],end='')
print()

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

int main() {
    int m , f , r;
    while (cin >> m >> f >> r) {
        if ( m == -1 && f == -1 && r == -1) {
            break;
        } else if ( m == -1 || f == -1 || m + f < 30) {
            cout << "F" << endl;
        } else if ( m + f >= 80 ) {
            cout << "A" << endl;
        } else if ( m + f < 80 && m + f >= 65 ) {
            cout << "B" << endl;
        } else if ( m + f < 65 && m + f >= 50 ) {
            cout << "C" << endl;
        } else if ( m + f < 50 && m + f >= 30 && r < 50 ) {
            cout << "D" << endl;
        } else if ( m + f < 50 && m + f >= 30 && r >= 50 ) {
            cout << "C" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3088
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    long d, t, s;
    scan(d, t, s);
    double tmp = double(d) / double(s);
    // writeln(tmp);
    if (tmp <= t)
    {
        writeln("Yes");
    }
    else
    {
        writeln("No");
    }
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


Measured memory_bytes: 3668
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#define rep(i, a, b) for (long long i = (a); i < (b); i++)
#define rep2(r, aa, bb) for (long long r = (aa)-1; r >= (bb); r--)
 
using namespace std;
 
 int main(){
     char a;
     cin >> a;
     a++;
     cout << a << endl;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main() {
    ll x, k, d, r;
    cin >> x >> k >> d;
    ll l = abs(x / d);
    if (l > k) {
        if (x < 0)
            r = x + k * d;
        else
            r = x - k * d;
    }
    else {
        r = x % d;
        k -= l;
        if (k % 2) {
            if (r > 0)
                r -= d;
            else
                r += d;
        }
    }
    cout << abs(r);
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		// 単一行の入力
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String str = null;
		try {
			str = in.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}

		String[] tmp = str.split(" ");
		int a = Integer.parseInt(tmp[0]);
		int b = Integer.parseInt(tmp[1]);
		int c = Integer.parseInt(tmp[2]);

		if ((a + b) == c || a == (b + c) || b == (a + c)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}


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

int main()
{
	string S;
	cin >> S;
	const int n = S.size();
	bool ng = false;
	for (int i = 0; i < n; i++) {
		if (i & 1) {
			if (S[i] == 'R') {
				ng = true;
				break;
			}
		}
		else {
			if (S[i] == 'L') {
				ng = true;
				break;
			}
		}
	}
	puts(!ng ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    ll N;
    cin >> N;
    vl A(N), B;
    for (auto &x : A) cin >> x;
    for (auto x : A) B.push_back(x);
    sort(ALL(B));
    FOR(i, 0, N) {
        cout << (A[i] == B[N - 1] ? B[N - 2] : B[N - 1]) << endl;
    }
}

Measured memory_bytes: 4848
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;
const int INF = 1e9;

vector<bool> colors, visited;
bool is_bipartite_dfs(vector<vector<int>> &g, int v, bool color) {
    visited[v] = true;
    colors[v] = color;
    for (auto u: g[v]) {
        if (visited[u]) {
            if (colors[u] == colors[v]) return false;
        } else if (!is_bipartite_dfs(g, u, !color)) {
            return false;
        }
    }
    return true;
}
bool is_bipartite(vector<vector<int>> &g) {
    int n = g.size();
    colors.resize(n);
    visited.resize(n, false);
    for (int i = 0; i < n; ++i) {
        if (!visited[i] && !is_bipartite_dfs(g, i, true)) return false;
    }
    return true;
}

int main() {
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    vector<vector<int>> dist(n, vector<int>(n));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            char c;
            cin >> c;
            if (c == '0') {
                dist[i][j] = i == j ? 0 : INF;
            } else {
                g[i].push_back(j);
                dist[i][j] = 1;
            }
        }
    }

    if (!is_bipartite(g)) {
        cout << -1 << endl;
        return 0;
    }

    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            ans = max(ans, dist[i][j]+1);
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 640
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		String t = stdIn.next();
		
		boolean ans = false;
		
		
		for(int i = 0; i < s.length(); i++) {
			if(s.equals(t)) {
				ans = true;
				break;
			}
			s = s.substring(s.length()-1)+s.substring(0,s.length()-1);
		}
		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}

}


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

int main() {
  int n, inn, max;
  cin >> n;
  int h[n];
  for ( int i = 0; i < n; i++ ) {
    cin >> h[i];
  }
  inn = 1;
  max = h[0];
  for ( int i = 1; i < n; i++ ) {
    max = ( h[i] > max ) ? h[i] : max;
    inn += ( h[i] >= max ) ? 1 : 0;
  }

  cout << inn << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions
from operator import itemgetter

import sys
def input():
	return sys.stdin.readline().strip()

xs, ys, xt, yt = list(map(int, input().split()))
N = int(input())
circle = [(xs, ys, 0)]
for i in range(N):
	circle.append(tuple(map(int, input().split())))
circle.append((xt, yt, 0))

graph = [[0]*(N + 2) for _ in range(N + 2)]

for i in range(N + 2):
	for j in range(i):
		dist = ((circle[i][0] - circle[j][0])**2 + (circle[i][1] - circle[j][1])**2)**0.5 - circle[i][2] - circle[j][2]
		dist = max(0, dist)
		graph[i][j] = dist
		graph[j][i] = dist

dist = [10**13]*(N + 2)
dist[0] = 0

node_list = []
heapq.heappush(node_list, (0, 0))
while len(node_list) > 0:
	node = heapq.heappop(node_list)
	if dist[node[1]] == node[0]:
		for i in range(N + 2):
			if i != node[1] and dist[i] > node[0] + graph[node[1]][i]:
				dist[i] = node[0] + graph[node[1]][i]
				heapq.heappush(node_list, (dist[i], i))

print(dist[-1])

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;

  if(A==B){
    cout << C << endl;
  }
  else if(A==C){
    cout << B << endl;
  }
  else if(B==C){
    cout << A << endl;
  }

return 0;  
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;

const int N = 100010;
struct Edge{
	int data, next;
}e[N * 2];
struct Node{
	int id; ll num;
}p[N];
int n, size[N], eu[N], ev[N], head[N], place, cnt;
ll num[N], dis;
void build(int u, int v){
	e[++place].data = v; e[place].next = head[u]; head[u] = place;
}
void dfs(int x, int fa, int di){
	dis += di;
	for (int ed = head[x]; ed != 0; ed = e[ed].next)
		if (e[ed].data != fa)
			dfs(e[ed].data, x, di + 1);
}
void error(){
	printf("-1\n");
	exit(0);
}
bool cmp(Node x, Node y){
	return x.num < y.num;
}
int main(){
	read(n);
	for (int i = 1; i <= n; i++){
		read(num[i]), size[i]++;
		p[i].num = num[i];
		p[i].id = i;
	}
	sort(num + 1, num + n + 1);
	sort(p + 1, p + n + 1, cmp);
	for (int i = n; i >= 1; i--){
		ll tmp = num[i] - (n - 2 * size[i]);
		if (tmp >= num[i]) continue;
		ll id = lower_bound(num + 1, num + n + 1, tmp) - num;
		if (num[id] == tmp){
			build(id, i); build(i, id);
			eu[++cnt] = id, ev[cnt] = i;
			size[id] += size[i];
		}
		else error();
	}
	dfs(1, 0, 0);
	if (dis != num[1]) error();
	for (int i = 1; i < n; i++)
		printf("%d %d\n", p[eu[i]].id, p[ev[i]].id);
	return 0;
}



Measured memory_bytes: 9216
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
const ll inf = 1LL << 50;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
///////////////////////////////////////

//移動されない整数を考える
int p[200100];
int Q[200100];
int main() {
	int N; cin >> N;
	REP(i, N) {
		cin >> p[i];
		p[i]--;
	}
	for (int i = 0; i < N; ++i) {
		Q[p[i]] = i;
	}
	ll ans = 0;
	ll key = 1;
	for (int i = 0; i < N-1; ++i) {
		if (Q[i] < Q[i + 1]) {
			key++;
		}
		else {
			ans = max(ans, key);
			key = 1;
		}
	}
	ans = max(ans, key);
	cout << N - ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, p ;
  cin >> a >> p;
  if(a > 12){
    cout << p;
  }
  else if ( a < 6){
    cout << "0";
  }
  else{
    cout << p/2;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,ans=0;
    cin>>n;
    int a=0,b=0,c=0;
    a=n/100;
    b=(n-a*100)/10;
    c=n-a*100-b*10;
    if(a==1)a=9;
    else a=1;
    if(b==1)b=9;
    else b=1;
    if(c==1)c=9;
    else c=1;
    ans=a*100+b*10+c;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

val sc = Scanner(System.`in`)

fun main(args : Array<String>) {
    val (a, b) = listOfInt(2)

    println(if (a <= b * 2) 0 else a - b*2)
}

fun listOfInt(n: Int) = (1..n).map { sc.nextInt() }.toList()

Measured memory_bytes: 31524
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
using namespace std;
map<int,int> vis;
int main(){
    vis.clear();
    int n,i,j,m;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&j);
        ++vis[j];
    }
    bool flag = true;
    scanf("%d",&m);
    for(i=1;i<=m;i++){
        scanf("%d",&j);
        if(vis[j]>0){
            --vis[j];
        }else{
            flag = false;
        }
    }
    if(flag){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    
    return 0;
}

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

#define ll long long
#define v vector 

const ll mod = 1e9 + 7;
const ll invtwo = 500000004;
const ll maxN = 5001;

ll dp[maxN][maxN]; //n, m;

ll fastpow(ll x, ll n) {
    ll res = 1;
    while (n != 0) {
        if(n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n = (n >> 1);
    }
    return res;
}

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

    ll n, m;
    string s;
    cin >> n >> s;
    m = s.size();

    dp[0][0] = 1; // base case;

    for(ll i = 1; i <= n; i ++) {
        for(ll j = 0; j <= n; j ++) {
            ll val = 0;
            if(j == 0) val += dp[i-1][j];
            if(j-1 >= 0) {
                val = (val + dp[i-1][j-1] * 2) % mod;
            }
            if(j+1 < maxN) {
                val = (val + dp[i-1][j+1]) % mod;
            }
            dp[i][j] = val;
        }
    }
    ll ans = dp[n][m];
    for(ll i = 0; i < m; i ++) {
        ans = (ans * invtwo) % mod;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 195584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    int f[10001]{};
    for (int x = 1; x <= 100; x++) {
        for (int y = 1; y <= 100; y++) {
            for (int z = 1; z <= 100; z++) {
                int t = x*x + y*y + z*z + x*y + y*z + z*x;
                if (t > 10001) break;
                f[t]++;
            }
        }
    }
    for (int i = 1; i <= N; i++) {
        cout << f[i] << "\n";
    }
    return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
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<int,P> 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 n,m;

int main(){
	cin>>n>>m;
	int S=(2*m+n-1)*n/2;
	if(m+n-1<0) cout<<S-m-n+1<<endl;
	else if(m>0) cout<<S-m<<endl;
	else cout<<S<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstring>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
#define all(v) v.begin(), v.end()
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> P;

const int INF = 1<<29;

int popcnt(int x){
	int cnt = 0;
	while(x){
		x &= x-1;
		cnt++;
	}
	return cnt;
}

int main(){
    int n, k;
	while(cin >> n >> k, n|k){
		vector<string> v(n);
		set<string> s;
		rep(i, n) cin >> v[i];
		for(int i = 0; i < (1<<n); i++){
			if(popcnt(i) != k) continue;
			vector<string> sub;
			rep(j, n){
				if((i>>j)&1) sub.push_back(v[j]);
			}
			sort(all(sub));
			do{
				string x;
				rep(j, k){
					x += sub[j];
				}
				s.insert(x);
			}while(next_permutation(all(sub)));
		}
		cout << s.size() << endl;
	}
    return 0;
}

Measured memory_bytes: 1460
#include<stdio.h>

static const int N = 100;

int min(int a, int b){
  return a < b ? a : b;
}

int main(){
  int N1[N+1],N2[N+1][N+1];
  int i,j,k,l,n;
 
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d %d",&N1[i-1],&N1[i]);
  }

  for(i=1;i<=n;i++)N2[i][i] = 0;
  for(l=2;l<=n;l++){
    for(i=0;i<=n-l+1;i++){
      j = i+l-1;
      N2[i][j] = (1<<21);
      for(k = i;k <= j-1;k++){
	N2[i][j] = min(N2[i][j],N2[i][k] + N2[k+1][j] + N1[i-1]*N1[k]*N1[j]);
      }
    }
  }

  printf("%d\n",N2[1][n]);
  
  return 0;
}



Measured memory_bytes: 2108
#include <iostream>

using namespace std;

int n;
int a[100005];

int partition() {
    int j = -1;
    int x = a[n - 1];
    for (int i = 0; i < n - 1; i++) {
        if (a[i] <= x) {
            j++;
            int tmp = a[j];
            a[j] = a[i];
            a[i] = tmp;
        }
    }
    a[n-1]=a[++j];
    a[j]=x;
    return j;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int p=partition();
    for(int i=0;i<p;i++){
        cout<<a[i]<<" ";
    }
    cout<<"["<<a[p]<<"] ";
    for(int i=p+1;i<n-1;i++){
        cout<<a[i]<<" ";
    }
    cout<<a[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 3464
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll isPrime(int n) 
{ 
	// Corner cases 
	if (n <= 1) 
		return 1; 
	if (n <= 3) 
		return 2; 

	// This is checked so that we can skip 
	// middle five numbers in below loop 
	if (n % 2 == 0 || n % 3 == 0) 
		return 1; 

	for (int i = 5; i * i <= n; i = i + 6) 
		if (n % i == 0 || n % (i + 2) == 0) 
			return 1; 

	return 2; 
} 

ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007; 
    return res; } 
 
 int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
  
 
ll findlcm(ll arr[], int n) 
{ 
   
    ll ans = arr[0]; 
  
    
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
 
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
       ll a,p;
       cin>>a>>p;
       a=3*a;
       ll ans=a+p;
       cout<<ans/2;
    } 
    return 0;
}


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n, d, x;
    cin >> n >> d >> x;
    vec a = ivec(n);
    int su = 0;
    rep (i, n)
        su += (d - 1) / a[i] + 1;
    print(su + x);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
//#include <bits/stdc++.h>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "Yes" : "No";
}


int main(){
    int n,h,w;
    cin >> n >> h >> w;

    int cnt = 0;
    rep(i,n){
        int a,b; cin >> a >> b;
        if(a >= h and b >= w) cnt++;
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
const int mod = 1e9+7;
using namespace std;
int main()
{
	int n,m;
	cin >> n >> m;
	char a[n+1][m+1];
	int dp[n][m];
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			cin >> a[i][j];
		}
	}
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			dp[i][j] = 0;
		}
	}
	dp[0][0] = 1;
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			if(i == 0 && j == 0)
			continue;
			else
			{
				if(a[i][j] == '#')
				dp[i][j] = 0;
				else
				{
					if(i-1 >= 0)
					dp[i][j] += (dp[i-1][j]%mod);
					if(j-1 >= 0)
					dp[i][j] += (dp[i][j-1]%mod);
				}
			}
		}
	}
	cout << dp[n-1][m-1]%mod << '\n';
	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define double long double
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{//cout<<"Case #"<<T1<<": ";
 int a;
 cin>>a;
 int x=a+a*a+a*a*a;
 cout<<x<<endl;
}


return 0;
}





Measured memory_bytes: 3604
import numpy as np 
n=int(input())
a=np.array(list(map(int, input().split())))
sum=0
i=0
while a.any():
  x= np.count_nonzero(a & 1)
  sum+=x*(n-x)<<i
  a>>=1
  i+=1

print(sum%(10**9+7))

Measured memory_bytes: 49948
#include<iostream>
#include<cstdio>
using namespace std;
int main(void) {
	int x, y;
	while (cin>>y>>x && (x!=0 || y!=0))
	{
		for (int i = 0; i < y; i++) {
			for (int j = 0; j < x; j++) {
				if ((i + j) % 2 == 0) {
					cout << "#";
				}
				else {
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3092
N, M = map(int, input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]
flag = False

for i in range(N - M + 1):
    for j in range(N - M + 1):

        if B[0] == A[i][0+j:M+j]:
            for k in range(M):
                temp1 = B[k]
                temp2 = A[i + k][0+j:M+j]
                if B[k] != A[i + k][0+j:M+j]:
                    break
            else:
                flag = True
                break
    if flag:
        break

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

Measured memory_bytes: 3064
#include <string>
#include <iostream>
#include <vector>
#define range(i, r) for(int i=0;i<r;i++)
using namespace std;
int main(int argc, char const *argv[]) {
  double T, X;
  std::cin >> T >> X;
  std::cout << (double)T/X << '\n';
  return 0;
}

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

public class Main{
    public static void main(String[] args) {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }
	    //lines.add("3 4");
	    //lines.add("5 6");
	    //lines.add("3 3");
	    //lines.add("2 2");
	    //lines.add("1 1");
	    //lines.add("0 0");
	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		String[] splits = lines.get(i).split(" ");
		Integer H = Integer.parseInt(splits[0]);
		Integer W = Integer.parseInt(splits[1]);

		if (H==0&&W==0) {
		    System.exit(0);
		}

		for (int h = 0; h < H; h++) {
		    char[] chars = new char[W];
		    Arrays.fill(chars, '#');

		    StringBuilder sb = new StringBuilder(new String(chars));
		    for (int j=0; j<chars.length;j++) {
			if (h%2==0 && j%2==1) {
			    sb.setCharAt(j,'.');
			} else if (h%2==1 && j%2==0) {
			    sb.setCharAt(j,'.');
			}
		    }

		    System.out.println(sb.toString());
		}

		System.out.println("");
	    }
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    }
}

Measured memory_bytes: 26768
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1

template<typename T>
constexpr T manhattan(T x1, T y1, T x2, T y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int K, X, Y;
  cin >> K >> X >> Y;

  int x = 0, y = 0;

  if (manhattan(x, y, X, Y) == K) {
    cout << 1 << newl;
    cout << X << ' ' << Y << newl;
    return 0;
  }

  bool even = !(K & 1);
  bool goalEven = !((X ^ Y) & 1);

  if (even & !goalEven) {
    cout << -1;
    return 0;
  }

  vector<pair<int, int>> rs;

  int rem = manhattan(x, y, X, Y);

  while (rem > 2 * K ||
    (!even && (rem != K && (rem & 1)))) {

    if (abs(Y - y) < K) {
      int k = K - abs(Y - y);
      //debug(k);
      y = Y;
      x = X > x ? x + k : x - k;
      //debug(x);
    }
    else {
      y = Y > y ? y + K : y - K;
    }

    rs.emplace_back(x, y);

    rem = manhattan(x, y, X, Y);

    //debug(x);
    //debug(y);
  }
  //debug('A');

  if (rem == K) {
  }
  else {
    // |x-a|+|y-b|=|X-a|+|Y-b|=K

    // 1回の移動で、残り距離をKにしたい

    int l;
      // K - rem だけ遠ざかる
      // A = K - rem
      // l + rem = K = A + rem + rem = K

      rem = rem / 2;
      l = K - rem;
    //debug(rem);
    //debug(l);
    // 遠ざかる方向に l 進み、近づく方向に rem 進む
    if (abs(X - x) > abs(Y - y)) {
      x = X > x ? x + rem : x - rem;
      y = Y > y ? y - l : y + l;
    }
    else {
      y = Y > y ? y + rem : y - rem;
      x = X > x ? x - l : x + l;
    }
    rs.emplace_back(x, y);
  }
  rs.emplace_back(X, Y);

  cout << rs.size() << newl;
  F0R(i, rs.size()) {
    cout << rs[i].first << ' ' << rs[i].second << newl;
  }
}
#endif


Measured memory_bytes: 5272
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    string s;

    cin >> s;

    for (size_t i = 0; i < s.length(); i++) {
        cout << "x";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256