akhauriyash/Code-Regression huggingface dataset:
class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;
  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n){
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n){
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
}

/* [入力]
  const [H,W]=o.nn(2)
  const [N,M]=o.nn(2)
  const N=o.n()
  const S=o.s()
  const arr1=[]
  for(let i=0;i<N;i++)arr1.push(o.n())
 */

/* [BFS,DFS]
  const [H,W]=o.nn(2),map=new Array(H),save=new Array(H)
  const DH=[0,0,-1,1]
  const DW=[1,-1,0,0]
  for(let i=0;i<H;i++){
    map[i]=o.s().split('')
    save[i]=new Array(W)
    save[i].fill(-1)
  }
  // let queue=[[?,?,1]]
  // save[?][?]=0
  while(queue.length>0){
    let [h,w,c]=queue.shift()
    for(let i=0;i<4;i++){
      if(h+DH[i]<0 || h+DH[i]>=H || w+DW[i]<0 || w+DW[i]>=W){
        continue
      }
      if(map[h+DH[i]][w+DW[i]]==?){
        continue
      }
      if(save[h+DH[i]][w+DW[i]]==-1){
        queue.push([h+DH[i], w+DW[i], c+1])
        save[h+DH[i]][w+DW[i]]=c
      }
    }
  }
*/
const o = new AtCoder()

let n=o.n(),p=o.nn(n),ans=0,p2=[],min=p[0]
for(let i=0;i<n;i++){
  if(p[i]<=min){
    ans++
  }
  min=o.min(min,p[i])
}
o.o(ans)

Measured memory_bytes: 57556
import java.io.*;
import java.util.*;
 
public class Main {
 
	void submit() {
	    long N = nextLong();
	    long sum = 0;
	    for(int i=1; i<=N; i++){
    	    if(i%3==0 || i%5==0 ){
    	        continue;
    	    }
    	    sum += i;
	    }
        out.println(sum);	        
	}

	void preCalc() {
 
	}
 
	void stress() {
 
	}
 
	void test() {
 
	}
 
	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		//stress();
		//test();
		out.close();
	}
 
	static final Random rng = new Random();
 
	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}
 
	public static void main(String[] args) throws IOException {
		new Main();
	}
 
	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
 
	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}
 
	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
 
	int nextInt() {
		return Integer.parseInt(nextToken());
	}
 
	long nextLong() {
		return Long.parseLong(nextToken());
	}
 
	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 32976
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;

int main(){
   int a,b; cin >> a >> b;
   if((a*b)%2==0) cout << "No" << endl;
   else cout << "Yes" << endl; 
return 0;
}

Measured memory_bytes: 3588
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int main()
{
	int x; cin>>x;
	while(x)
	{
		int t=x%10;
		if(t==7) {puts("Yes"); return 0;}
		x=x/10;
	}
	puts("No");
	return 0;
}

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

int main()
{
    string s ;
    cin>>s;
    bool a[27]={};
    for(int i=0;i<s.size();i++)
    {
        a[s[i]-'a']=true;
    }
    for(int i=0;i<27;i++)
    {
        if (i==26)
            cout<<"None";
        else if(!a[i])
            {
                char c='a';
                c=c+i;
                cout<<c;
               break;
            }
    }
    return 0;
}



Measured memory_bytes: 3768
N,M = map(int, input().split())
L = [0]*M
R = [0]*M

for i in range (M):
  L[i],R[i] = map(int, input().split())

L_SORT = sorted(L)
R_SORT = sorted(R)

#print(L_SORT)
#print(R_SORT)

L_MAX = L_SORT[M-1]
R_MIN = R_SORT[0]

#print(L_MAX)
#print(R_MIN)


if (R_MIN - L_MAX) < 0:
  print(0)
else:
  print(R_MIN-L_MAX + 1)

Measured memory_bytes: 18748
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pli pair<ll, int> 
#define pdd pair<ld, ld> 
#define mp make_pair
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;
int solve(int h[], int s, int e){
    
    if(s > e)
    return 0;
    if(s == e){
    int y = h[s];
    h[s] = 0;
    return y;
    }
    int mn = 100, mx = 0;
    rep(i, s, e + 1){
    mn = min(mn, h[i]);
    mx = max(mx, h[i]);
    }
     if(mn == mx)
     return mn;
    int prev = s, ans = mn;
    rep(i, s, e + 1){
    h[i] -= mn;
    if(h[i] == 0){
        ans += solve(h, prev, i - 1);
        prev = i + 1;
    }
    }
    ans += solve(h, prev, e);
    //cout << s << " " << e << " : " << ans << endl;
    return ans;
}
int main(){
   FASTIO
   int n;
   cin >> n;
   int h[n];
   rep(i, 0, n)
   cin >> h[i];
   int prev = 0, ans = 0;
    rep(i, 0, n){
    if(h[i] == 0){
        ans += solve(h, prev, i - 1);
        prev = i + 1;
    }
    }
    ans += solve(h, prev, n-1);
    cout << ans;
}




Measured memory_bytes: 256
#include <iostream>
using namespace std;   
int main()  
{ 
long long x;
cin>>x;
long long sum=0;
long long a,b,m;
for(long long i=1;i<=x;i++)
{
cin>>a>>b;
if(a>=b)m=a-b+1;
if(a<b)m=b-a+1;
sum+=m;
}
cout<<sum;
system("pause");  
return 0;  
} 


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    ll a, b, n; cin >> a >> b >> n;
    ll ch = min(n, b-1);
    ll o = n / b;
    ch += o * b;
    while(ch > n){
        ch -= b;
    }
    ll c = (a * n) / b, cc = a * (n/b), d = (a *ch) / b, dd = a * (ch/b);
    cout << max(c-cc, d-dd) << endl;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;
typedef complex<double> point;

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

	ll n;cin >> n;
	vector<pair<double, P>> v(n);
	REP(i, n){
		cin >> v[i].SE.FI >> v[i].SE.SE;
		point p(v[i].SE.FI, v[i].SE.SE);
		v[i].FI = arg(p);
	}

	sort(ALL(v));
	P ans = MP(0, 0);
	REP(i, n){
		P now = MP(0, 0);
		REP(j, n){
			now = MP(now.FI + v[(i+j)%n].SE.FI, now.SE + v[(i+j)%n].SE.SE);
			if(ans.FI * ans.FI + ans.SE * ans.SE < now.FI * now.FI + now.SE * now.SE){
				ans = now;
			}
		}
	}

	cout << Decimal << sqrt(ans.FI * ans.FI + ans.SE * ans.SE) << endl;

	return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;

void Show(vector<vector<int>> Ns) {
	for (int i = 0; i < Ns.size(); i++) {
		for (int j = 0; j < Ns[i].size(); j++) {
			if (j == Ns[i].size() - 1) {
				cout << Ns[i][j] << endl;
			} else {
				cout << Ns[i][j] << ",";
			}
		}
	}
}

void Show(vector<int> N) {
	for (int i = 0; i < N.size(); i++) {
		cout << N[i];
		if (i != N.size() - 1) {
			cout << " ";
		} else {
			cout << endl;
		}
	}
}


int main() {
	int N,K;
	cin >> N >> K;
	vector<int> Counter;
	Counter.resize(N);
	int k = 0;
	int n;
	for (int i = 0; i < N; i++) {
		cin >> n;
		if (Counter[n - 1] == 0)k++;
		Counter[n - 1]++;
	}
	sort(Counter.begin(), Counter.end());
	int answer = 0;
	K = k - K;
	for (int i = 0; i < N; i++) {
		if (K <= 0) {
			break;
		}
		if (Counter[i] != 0) {
			answer += Counter[i];
			K--;
		}
	}
	cout << answer << endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var A = input[0];
            var B = input[1];
            var C = input[2];
            var max = Math.Max(A, Math.Max(B, C));
            var min = Math.Min(A, Math.Max(B, C));
            var mid = A + B + C - max - min;
            var even = new bool[] {
                max % 2 == 0 ? true : false,
                min % 2 == 0 ? true : false,
                mid % 2 == 0 ? true : false
            };
            var ans = 0;

            if (even[0] == even[1] && even[1] == even[2])
            {
                ans += (2 * max - min - mid) / 2;
            }
            else if (even[1] == even[2])
            {
                ans++;
                ans += (2 * max - min - mid - 2) / 2;
            }
            else
            {
                ans++;
                ans += (2 * max - min - mid + 1) / 2;
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*power((a*a)%mod,n/2))%mod;
    return power((a*a)%mod,n/2)%mod;
}
const int md = 998244353;
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}


signed main()
{
    showoff;
    int n,d;
    cin >> n >> d;
    vector<int>adj[n+5];
    FOR(i,0,n){
        FOR(j,0,d){
            int x;
            cin >> x;
            adj[i].pb(x);
        }
    }
    int ans = 0;
    FOR(i,0,n){
        FOR(j,i+1,n){
            int td = 0;
            FOR(k,0,d)td += (adj[i][k]-adj[j][k])*(adj[i][k]-adj[j][k]);
            FOR(k,1,1000){
                if(k*k == td){
                    ++ans;
                    break;
                }
            }
        }
    }
    cout << ans;
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...  

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 505, LIM = 20000;

int is_p[LIM];

vi divs[LIM];

vi pp;

ll diag1[2 * MAXN], diag2[2 * MAXN];

ll ans[MAXN][MAXN];

int n;

pii get_ind(int i, int j) {
	return mp((i + j) / 2, (n + i - j) / 2 + 1);
}

int di[4] = {1, 0, -1, 0};
int dj[4] = {0, 1, 0, -1};

const ll MAXVAL = 1e15;

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

void solve(){
	REP(i, 2, LIM) {
		if (!is_p[i]) {
			/*for(int j = i; j < LIM; j += i) {
				divs[j].pb(i);
				if (j > i) {
					is_p[j] = 1;
				}
			}*/
			if (i > 1000) {
				pp.pb(i);
			}
			for(int j = i * i; j < LIM; j += i) {
				is_p[j] = 1;
			}
		}
	}
	/*REP(i, 2, LIM) {
		if (SZ(divs[i]) == 1) {
			pp.pb(i);
		}
	}*/
	
	/*printf("%d\n", SZ(pp));
	REP(i, 0, SZ(pp)) {
		printf("%d\n", pp[i]);
	}*/
	
	scanf("%d", &n);
	
	if (n == 2) {
		printf("4 7\n23 10\n");
		return;
	}
	
	REPN(i, 1, 2 * n + 1) {
		diag1[i] = i;
		diag2[i] = pp[i - 1];
	}
	
	REPN(i, 1, n) {
		REPN(j, 1, n) {
			if ((i + j) % 2 == 0) {
				int ind1 = get_ind(i, j)._1;
				int ind2 = get_ind(i, j)._2;
				ans[i][j] = diag1[ind1] * diag2[ind2];
			}
		}
	}
	
	REPN(i, 1, n) {
		REPN(j, 1, n) {
			if ((i + j) % 2 == 1) {
				ans[i][j] = 1ll;
				REP(k, 0, 4) {
					int i1 = i + di[k], j1 = j + dj[k];
					if (i1 > 0 && i1 <= n && j1 > 0 && j1 <= n) {
						ans[i][j] = lcm(ans[i][j], ans[i1][j1]);
						//printf("# %d %d %d %d %lld %lld\n", i, j, i1, j1, ans[i][j], ans[i1][j1]);
					}
				}
				ans[i][j]++;
			}
		}
	}
	
	REPN(i, 1, n) {
		REPN(j, 1, n) {
			assert(ans[i][j] < MAXVAL);
			printf("%lld ", ans[i][j]);
		}
		putchar('\n');
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;


int main(){
	int a,b; cin>>a>>b;
	int cnt=0;
	while(a>0){
		a-=b;
		cnt++;
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	string s;
	cin >> s;
	int n=s.length();
	int count=0,max=0;
	
	for(int i=0;i<n;i++){
		if(s[i]=='A' ||s[i]=='C' ||s[i]=='G' ||s[i]=='T'){
			count++;
		}else{
			count=0;
		}
		if(count>max){
			max=count;
		}
	}
	cout << max << endl;
	return 0;
}


Measured memory_bytes: 256
use std::cmp::*;
use std::io::*;
fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let s: Vec<char> = itr.next().unwrap().chars().collect();
    let n = s.len();
    if n == 1 {
        println!("YES");
    } else if n == 2 {
        if s[0] == s[1] {
            println!("NO");
        } else {
            println!("YES");
        }
    } else {
        let mut na = 0;
        let mut nb = 0;
        let mut nc = 0;
        for &c in s.iter() {
            if c == 'a' {
                na += 1;
            } else if c == 'b' {
                nb += 1;
            } else {
                nc += 1;
            }
        }
        let min = min(na, min(nb, nc));
        na -= min;
        nb -= min;
        nc -= min;
        if max(na, max(nb, nc)) > 1 {
            println!("NO");
        } else {
            println!("YES");
        }
    }
}


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

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef vector<vi> vvi;
const int MOD = 998244353;

#define fastIO \
ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define mp make_pair 

#ifdef DIV_DEBUG
#define cerr(...) __cerr(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __cerr(const char *name, Arg1 &&arg1) {
    cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __cerr(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *sep = strchr(names + 1, ',');
    cerr.write(names, sep - names) << " = " << arg1 << " |";
    __cerr(sep + 1, args...);
}
#else
#define cerr(...) 
#endif


int main() {
    fastIO;
    int n, k;
    cin >> n >> k;
    vii lr(k);
    for (auto& i : lr)    cin >> i.ff >> i.ss;
    vi dp(2 * n + 2);
    dp[1] = 1, dp[2] = -1;
    for (int i = 1; i <= n; i++) {
        dp[i] += dp[i - 1];
        dp[i] %= MOD;
        for (auto j : lr) {
            dp[i + j.ff] += dp[i];
            dp[i + j.ff] %= MOD;
            dp[i + j.ss + 1] -= dp[i];
            dp[i + j.ss + 1] %= MOD;
        }
    }
    cout << (dp[n] < 0 ? dp[n] + MOD : dp[n]) << endl;
    return 0;
}


Measured memory_bytes: 6324
#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 n;
    cin>>n;
    int d;
    cin>>d;d*=d;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin>>x>>y;
        int x1=x*x+y*y;
        if(x1<=d)ans++;
    }
    cout<<ans<<endl;
}


return 0;
}





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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    int n,m;
    cin>>n>>m;
    int h[n+1];
    for(int i=1;i<=n;i++)
        cin>>h[i];

    vector<int>v[n+1];

    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        int f=0;
        for(int j=0;j<v[i].size();j++)
        {
            int x=v[i][j];
            if(h[x]>=h[i])f=1;
        }
        if(f==0)cnt++;
    }
    cout<<cnt;

}


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

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}} End

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

    size_t N; string s;
    cin >> N >> s;

    auto dp = make_v(0, N + 1, N + 1);
    for (int i = N - 1; i >= 0; --i) {
        for (int j = N - 1; j >= 0; --j) {
            if (s[i] == s[j]) {
                dp[i][j] = dp[i + 1][j + 1] + 1;
            }
        }
    }

    dump(dp);

    intmax_t maxv = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            if (i >= j) {
                continue;
            }
            intmax_t res = min(dp[i][j], j - i);
            chmax(maxv, res);
        }
    }

    cout << maxv << "\n";

    return 0;
}


Measured memory_bytes: 98176
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <cassert>

using namespace std;
typedef long long ll;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int,int>> vec;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    vec.push_back({a, i});
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < n; i++) {
    if (i) cout << " ";
    cout << vec[i].second + 1;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 4228
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;

struct Edge {
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};

int n;
vector<vector<Edge>> G;
vector<int> ans;

void dfs(int from) {
  for (auto e : G[from]) {
    if (ans[e.to] != -1)
      continue;
    if (e.weight % 2 == 0)
      ans[e.to] = ans[from];
    else
      ans[e.to] = !ans[from];
    dfs(e.to);
  }
}

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

  cin >> n;
  G.resize(n);
  ans.resize(n, -1);
  rep(i, 0, n - 1) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    G[u].emplace_back(v, w);
    G[v].emplace_back(u, w);
  }

  ans[0] = 1;
  dfs(0);

  rep(i, 0, n) cout << ans[i] << endl;
}


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

class Dice{
    public:
    int f[6];
    Dice(){}
    void roll_x(){roll(1,4,6,3);} // to E
    void roll_y(){roll(1,2,6,5);} // to N
    void roll_z(){roll(2,3,5,4);} // 上から見て時計回り
    void roll(int i,int j,int k,int l){
        int t=f[i]; f[i]=f[j]; f[j]=f[k]; f[k]=f[l]; f[l]=t;
    }
    void move(char ch){
        if(ch == 'E') roll_x();
        if(ch == 'S') for(int i=0;i<3;i++) roll_y();
        if(ch == 'W') for(int i=0;i<3;i++) roll_x();
        if(ch == 'N') roll_y();
    }
};

int main(){
    Dice d;
    string name;
    
    for(int i=1;i<=6;i++) cin >> d.f[i];
    cin >> name;
    for(int i=0;i<name.size();i++) d.move(name[i]);
    cout << d.f[1] << endl;
    return 0;
}


Measured memory_bytes: 3208
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<string, string> sP;
typedef pair<ll, pair<ll, ll>> PP;

const ll mod = 1e4;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second



int main() {
	int n;
	cin >> n;
	if (n % 2 == 0)cout << n << endl;
	else cout << n * 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
long long gcd(long long a, long long b) {
	if (a < b) swap(a, b);
	return b ? gcd(b, a % b) : a;
}

long long lcm(long long a, long long b) {
	return a * b / gcd(a, b);
}
 
int main() {
  int a, b;
  cin >> a >> b;
 
  cout << lcm(a, b) << endl;
}

Measured memory_bytes: 256
# coding: utf-8

N = int(input())
A = sorted(list(map(int,input().split())))
if A[0] == 0:
    ans = 0
else:
    ans = 1
    for i in range(N):
        ans *= A[i]
        if ans > 10**18:
            ans = -1
            break

print(ans)


Measured memory_bytes: 84728
#include <bits/stdc++.h>
#define int long long
#define INF 1e+18
#define MOD 998244353
using namespace std;

int mod_inv(int X){
	int a = X, b = MOD, u = 1, v = 0;
	while(b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	if(u < 0) u += MOD;
	return u;
}
 
vector<int> fact,factinv;
 
void nCr_init(int N){
	N = min(N,(int)MOD);
	fact.resize(N + 1);
	factinv.resize(N + 1);
	fact[0] = 1;
	for(int i = 1;i <= N;i++) fact[i] = fact[i - 1] * i % MOD;
	factinv[N] = mod_inv(fact[N]);
	for(int i = N;i >= 1;i--) factinv[i - 1] = factinv[i] * i % MOD;
}
 
int nCr(int ncr_n,int ncr_r){
	if(ncr_n >= MOD) return nCr(ncr_n % MOD, ncr_r % MOD) * nCr(ncr_n / MOD, ncr_r / MOD) % MOD;
	return ncr_r > ncr_n ? 0 : fact[ncr_n] * factinv[ncr_n - ncr_r] % MOD * factinv[ncr_r] % MOD;
}

signed main(){
	int n,a,b,k,ans = 0;
	cin >> n >> a >> b >> k;
	nCr_init(n + 5);
	for(int i = 0;i <= n;i++){
		if(k >= a * i && (k - a * i) % b == 0){
			(ans += nCr(n,i) * nCr(n,(k - a * i) / b) % MOD) %= MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int n, vis = 1, start[100005], node[100005], fin[100005];
vector <int> v[100005];

//オイラーツアー
void dfs(int nd) {
  start[nd] = vis; vis++;
  for (int i : v[nd]) {dfs(i);}
  node[nd] = vis;
  return;
}

int query(int p) {
  int re = 0;
  while (p > 0) {
    re += fin[p];
    p -= ((-p) & p);
  }
  return re;
}

void update(int p, int val) {
  while (p <= n) {
    fin[p] += val;
    p += ((-p) & p);
  }
  return;
}

int main() {
  int q,a,b,c,x,op;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    for (int j = 0; j < a; j++) {
      cin >> x;
      v[i].push_back(x);
    }
  }
  dfs(0);
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> op;
    if (op == 0) {
      cin >> a >> b;
      update(start[a], b);
      update(node[a], b*-1);
    }
    else {
      cin >> a;
      cout << query(start[a]) << endl;
    }
  }
}


Measured memory_bytes: 12856
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n,r;
	std::cin >> n >> r;
	print(r+100*std::max(0ll,10-n));
	return 0;
}


Measured memory_bytes: 764
defmodule Main do
  def main do
    n = IO.gets("") |> String.trim() |> String.to_integer()

    assign_int(n, [])
    |> Enum.reverse()
    |> Enum.reduce(fn x, acc -> x <> acc end)
    |> IO.puts()
  end

  defp assign_int(0, lst) do
    lst
  end

  defp assign_int(n, lst) do
    new_n = div(n - 1, 26)

    alp =
      case rem(n - 1, 26) do
        0 ->
          "a"

        1 ->
          "b"

        2 ->
          "c"

        3 ->
          "d"

        4 ->
          "e"

        5 ->
          "f"

        6 ->
          "g"

        7 ->
          "h"

        8 ->
          "i"

        9 ->
          "j"

        10 ->
          "k"

        11 ->
          "l"

        12 ->
          "m"

        13 ->
          "n"

        14 ->
          "o"

        15 ->
          "p"

        16 ->
          "q"

        17 ->
          "r"

        18 ->
          "s"

        19 ->
          "t"

        20 ->
          "u"

        21 ->
          "v"

        22 ->
          "w"

        23 ->
          "x"

        24 ->
          "y"

        25 ->
          "z"
      end

    assign_int(new_n, [alp | lst])
  end
end

Measured memory_bytes: 30764
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleContexts #-}

import Data.Bits
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import Data.IntMap.Strict (IntMap)
import qualified Data.IntMap.Strict as IMS
import Data.IntSet (IntSet)
import qualified Data.IntSet as IS
import qualified Data.Sequence as Seq
import Data.Sequence (Seq)
import qualified Data.Array.IArray as A
import qualified Data.Array.MArray.Safe as A
import qualified Data.Array.MArray as A
import Data.Array (Array)
import Data.Array.Unboxed (UArray)
import Data.Array.IArray (IArray)
import Data.Array.MArray.Safe (MArray)
import Data.Array.IO.Safe (IOArray, IOUArray)
import Data.Array.ST.Safe (STArray, STUArray, runSTArray, runSTUArray)
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Control.Monad
import Control.Monad.ST
-- import Control.Monad.ST.Safe
import Control.Applicative
import Data.Maybe
import Data.Tuple
import Data.Ord
import Control.Monad.State.Strict
import Data.Int
import System.IO
import Data.Function
import Control.Monad.Primitive
import qualified Data.Vector.Primitive.Mutable as VPM
import qualified Data.Vector.Generic.Mutable as VGM
import Data.STRef


rInt :: StateT BSL.ByteString Maybe Int
rInt = StateT $ BSL.readInt . BSL.dropWhile (<'!')


main :: IO ()
main = do
  [n,capacity] <- map read . words <$> getLine
  wvs <- VU.unfoldrN n (runStateT $ (,) <$> rInt <*> rInt)
         <$> BSL.getContents
  print $ query n capacity wvs

query :: Int -> Int -> VU.Vector (Int, Int) -> Int
query n capacity wvs = search capacity
  $ VU.foldl'
    (\minweights (w,v) ->
      VU.zipWith min minweights
      $ VU.replicate v large
        VU.++ VU.map (+w) minweights)
    (VU.cons 0 $ VU.replicate vsum large)
    wvs
  where
    vsum = VU.sum $ VU.map snd wvs
    large = 10^9 + 1


search :: Int -> VU.Vector Int -> Int
search capacity = fst . VU.last . VU.filter ((<=capacity) . snd) . VU.indexed


Measured memory_bytes: 4604
#include<bits/stdc++.h>
using namespace std;
const long long MAX=1e5+10;
long long dp[MAX],a[MAX],k,n;
long long sol(long long k)
{
    if (dp[k]!=-1) return dp[k];
    if (k==0) return dp[k]=0;
    long long tmp=0,i;
    for (i=1;i<=n;i++)
    {
        if (k-a[i]>=0)
        {
            if (sol(k-a[i])==0) {tmp=1;break;}
        }
    }
    return dp[k]=tmp;
}
int main()
{
    memset(dp,-1,sizeof(dp));
    long long i;
    cin>>n>>k;
    for (i=1;i<=n;i++) cin>>a[i];
    if (sol(k)) cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}


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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)

using namespace std;


int main(){
    ll n, c;
    cin >> n >> c;
    vector<ll> x(n+2, 0);
    vector<ll> v(n+2, 0);
    rep(i, n) cin >> x[i+1] >> v[i+1];
    
    x[n+1] = c;
    
    ll maxx = 0;

    vector<ll> rights(n+1, 0);
    ll rsum = 0;
    rep(i, n+1){
        rsum += v[i];
        maxx = max(maxx, rsum - x[i]);
        rights[i] = rsum - x[i];
    }

    vector<ll> lefts(n+1, 0);
    ll lsum = 0;
    rep(i, n+1){
        ll idx = n+1-i;
        lsum += v[idx];
        maxx = max(maxx, lsum - (c-x[idx]));
        lefts[i] = lsum - (c-x[idx]);
    }

    vector<ll> maxR(n+2, 0);
    rep(i, n+1) maxR[i] = max(maxR[max(0, i-1)], rights[i]-x[i]);

    vector<ll> maxL(n+2, 0);
    rep(i, n+1) maxL[i] = max(maxL[max(0, i-1)], lefts[i]-(c-x[n+1-i]));


    rep(r, n+1){
        ll sum = rights[r] + maxL[n-r];
        maxx = max(maxx, sum);
    }

    rep(l, n+1){
        ll sum = lefts[l] + maxR[n-l];
        maxx = max(maxx, sum);
    }


    cout << maxx << endl;



    return 0;
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n, k;
  cin >> n >> k;
  vector<int> xs(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }
  sort(xs.begin(), xs.end());
  reverse(xs.begin(), xs.end());
  int sum = 0;
  for (int i = 0; i < k; i++) {
    sum += xs[i];
  }
  cout << sum << endl;
}

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

int main() {
    int N;
    cin >> N;
    set<string> T;
    for (int i = 0; i < N; i++) {
        string S;
        cin >> S;
        T.insert(S);
    }
    cout << T.size() << endl;
}

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

int main(){
  int m,a,b,x,y;
  vector<int> p;
  for(int i=2;i<=50000;i++){
    bool f = true;
    for(int j=2;j*j<=i;j++){
      if(!(i%j)){
	f = false; break;
      }
    }
    if(f)p.push_back(i);
  }

  while(cin >> m >> a >> b,m+a+b){
    x = y = 0;
    for(int i=0;i<p.size();i++){
      for(int j=i;j<p.size();j++){
	if(a*p[j]>b*p[i])break;
	if(p[i]*p[j]>m)break;
	if(x*y<p[i]*p[j]){
	  x = p[i]; y = p[j];
	}
      }
    }
    cout << x << " " << y << endl;
  }
}

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

vector<int> G;

int root(int a){
    if(a == G[a]) return a;
    else return G[a] = root(G[a]);
}

int main(){
    int n, q;
    cin >> n >> q;
    G.resize(n);
    for(int i = 0; i < n; i++){
        G[i] = i;
    }

    for(int i = 0; i < q; i++){
        int com, x, y;
        cin >> com >> x >> y;
        if(com){
            if(root(G[x]) == root(G[y])){
                cout << 1 << endl;
            }else{
                cout << 0 << endl;
            }
        }else{
            int nx = root(G[x]);
            int ny = root(G[y]);
            if(nx < ny) G[nx] = root(G[ny]);
            else G[ny] = root(G[nx]);
        }
    }

    return 0;
}


Measured memory_bytes: 3148
while 1:
    n = input()
    if n == 0:
        break
    change = dict()
    for i in range(n):
        line = raw_input().split()
        change[line[0]] = line[1]

    n = input()
    s = ""
    for i in range(n):
        line = raw_input().strip()
        s += (change[line] if line in change else line)
    print s

Measured memory_bytes: 7372
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)
#define MOD (1e9+7)

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

ll beki(ll a, ll b) {
	ll tmp = 1;
	REP(i, b) tmp *= a;
	return tmp;
}

string S;
int a[100] = {};

int main() {
	cin >> S;
	for (int i = 0; i < 4; i++) {
		a[i] = S[i] - 'A';
	}
	sort(a, a + 4);
	if (a[0] == a[1] && a[2] == a[3] && a[1] != a[2]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

int main() {
  
  int N,T;
  cin >> N >> T;
  
  vector<vector<int>> pair(N, vector<int>(2));

  int min=1001;
  for(int i=0; i<N; i++){
    cin >> pair.at(i).at(0) >> pair.at(i).at(1);
    if( pair.at(i).at(1)<=T && min>pair.at(i).at(0) ){min=pair.at(i).at(0);}
  }
  
  if(min==1001){ cout << "TLE" << endl; }
  else{ cout << min << endl; }


}


Measured memory_bytes: 256
def main():
	N = int(input())
	A = list(map(int, input().split()))
	
	keta =len(bin(max(A)))-2
	A = [ '{a:0{keta}b}'.format(a=a,keta=keta) for a in A]
	sum = 0
	for i in range(keta):
		bit = [a[i] for a in A]
		sum = sum + (2**(keta-i-1) * ( bit.count('1')*bit.count('0')))
	print(sum % (10**9+7))

if __name__ == '__main__':
	main()

Measured memory_bytes: 56292
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int h,w;
    int i,j,k,l,m,n,o;
    scanf("%d %d",&h,&w);
    char board[h+1][w+1];
    for(i=0;i<h;i++){
        scanf("%s",&board[i]);
    }

    for(j=0;j<h;j++){
        for(k=0;k<w;k++){
            if(board[j][k]=='.')board[j][k]='0';
        }
    }

    for(l=0;l<h;l++){
        for(m=0;m<w;m++){
            if(board[l][m]=='#'){
                if(board[l-1][m-1]!='#')board[l-1][m-1]+=1;
                if(board[l-1][m]!='#')board[l-1][m]+=1;
                if(board[l-1][m+1]!='#')board[l-1][m+1]+=1;
                if(board[l][m-1]!='#')board[l][m-1]+=1;
                if(board[l][m+1]!='#')board[l][m+1]+=1;
                if(board[l+1][m-1]!='#')board[l+1][m-1]+=1;
                if(board[l+1][m]!='#')board[l+1][m]+=1;
                if(board[l+1][m+1]!='#')board[l+1][m+1]+=1;
            }
        }
    }

    for(n=0;n<h;n++){
        for(o=0;o<w;o++){
            printf("%c",board[n][o]);
        }
        printf("\n");
    }

    return 0;
}

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

public class Main{
  public static void main(String[] args){
    try {
      Scanner sc = new Scanner(System.in);
      int n, m, X, Y;
      n=Integer.parseInt(sc.next());
      m=Integer.parseInt(sc.next());
      X=Integer.parseInt(sc.next());
      Y=Integer.parseInt(sc.next());
      int[] x=new int[n], y=new int[m];
      for(int i=0; i<n; i++){
        x[i]=Integer.parseInt(sc.next());
      }
      for(int i=0; i<m; i++){
        y[i]=Integer.parseInt(sc.next());
      }

      Arrays.sort(x);
      Arrays.sort(y);
      if(Math.max(X, x[n-1])<Math.min(Y, y[0])){
        System.out.println("No War");
      }else{
        System.out.println("War");
      }
      
      }catch (Exception e) {
      System.out.println("out");
    }
  }
}


Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
         
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007  
const int N = 100001; 

// int fexp(int a, int b,int m){int ans = 1;while(b){if(b&1)ans=ans*a%m; b/=2;a=a*a%m;}return ans;}
// int inverse(int a, int p){return fexp(a, p-2,mod);} 

// int fac[2000001];

// int nCrModPFermat(int n, int r,int p) { 
//     if (r==0) return 1; 
//     return (fac[n]*inverse(fac[r],p)%p*inverse(fac[n-r],p)%p)%p; 
// }
 

void solve(){
    int n;cin>>n;
    if(n==0)cout<<1;
    else cout<<0;

    return;
}
         
signed main(){
        IOS;    
        

        int t=1;
        // cin>>t;
        // fac[0] = 1; 
        // for (int i=1 ; i<=2000001; i++) fac[i] = fac[i-1]*i%mod; 
        rep(i,0,t){
            // cout<<"Case #"<<i+1<<": ";
            solve();
            cout<<"\n";
        }
    //    return 0;
}

Measured memory_bytes: 3684
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    scanf("%d",&n);
    ll a[n];
    ll sum[n];
    ll ans=0;
    scanf("%lld",&a[0]);
    sum[0]=a[0];
    sum[0]=sum[0]%1000000007;
    for(int i=1;i<n;i++)
    {
        scanf("%lld",&a[i]);
        sum[i]=sum[i-1]+a[i];
        sum[i]=sum[i]%1000000007;
    }

    for(int i=0;i<n-1;i++)
    {
        ans=ans+sum[i]*a[i+1];
        ans=ans%1000000007;
    }


    printf("%lld\n",ans);

    return 0;
}

Measured memory_bytes: 4848
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define MOD 1000000009
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  vector<int > p(n);
  REP(i,n) cin >> p[i];
  int a, b,c;
  int d = 0;
  for (int i = 1; i < n -1 ;i ++){
    a = p[i -1];
    b = p[i];
    c = p[i +1];
    if(b == a + b+ c - max(a , max(b,c)) - min(a, min(b,c))) d++;
  }
  cout << d << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();
        long Y = sc.nextLong();
        int ans = 0;
        while (X <= Y){
            ans++;
            Y/=2;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 27080
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 30 01:24:22 2020

@author: liang
"""

MOD = 10**9 + 7
N = int(input())
data = [i for i in range(2,N+1)]
table = list()

#素数リスト
while data:
    tmp = data[0]
    table.append(tmp)
    data = [i for i in data if i%tmp != 0]
    
#print(table)
res = dict()
for i in range(2,N+1):
    for t in table:
        if i%t == 0:
            if t not in res:
                res[t] = 1
            tmp = i
            while tmp%t == 0:
                res[t] += 1
                tmp //= t                
                
ans = 1
for r in res.values():
    ans *= r
    ans %= MOD
#print(res)
print(ans)

Measured memory_bytes: 9168
arr = gets.split.map(&:to_i)
  arr.length.times do |i|
    (arr.length - i).times do |j|
      if arr[i] > arr[i+j]
        arr[i], arr[i+j] = arr[i+j], arr[i]
      end
    end
  end
  print arr.join(' ')
  puts

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = __INT_MAX__;               // 2^31 - 1
const long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

struct mint {
    // Preparation: MOD is already defined.
    ll value;

    mint(ll value = 0) : value((value % MOD + MOD) % MOD) {}

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint pow(mint m) const {
        return pow(m.value);
    }

    mint inv() const {
        ll a = value, b = MOD, u = 1, v = 0;
        while (b) {
            ll t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        return u;
    }

    mint &operator+=(const mint a) {
        if ((value += a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((value += MOD - a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (value *= a.value) %= MOD;
        return *this;
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    int n;
    cin >> n;
    vl a(n);
    rep(i, n) cin >> a[i];
    vl cum(n + 1, 0);
    rep(i, n) cum[i + 1] = cum[i] + a[i];
    sort(all(cum));

    ll ans = 0;
    ll cnt = 0;
    rep(i, n) {
        if (cum[i] == cum[i + 1])
            cnt++;
        else {
            ans += cnt * (cnt + 1) / 2;
            cnt = 0;
        }
    }
    if (cnt > 0)
        ans += cnt * (cnt + 1) / 2;
    out(ans);
}


Measured memory_bytes: 3328