akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_V 555555


//// Dijkstra
struct edge{int to,cost;};
struct Dijkstra{
	int V;
	vector<edge> G[MAX_V];
	int d[MAX_V];
	void init(int v){V=v;}
	void add_edge(int from,int to,int cost){
		G[from].push_back((edge){to,cost});
	}
	void shortpath(int s){
		fill(d,d+V,INF);
		priority_queue<P, vector<P>, greater<P> > que;
		que.push(P(0,s));
		while(!que.empty()){
			P np=que.top(); que.pop();
			int v=np.second;
			if(d[v]!=INF)continue;
			d[v]=np.first;
			for(int i=0;i<G[v].size();i++){
				que.push(P(d[v]+G[v][i].cost,G[v][i].to));
			}
		}
	}
};

Dijkstra dj;

int idlast;
map<P,int> id;
int getid(int stat,int comp){
	if(id.count(P(stat,comp)))return id[P(stat,comp)];
	int res=idlast++;
	dj.add_edge(res,stat,0);
	dj.add_edge(stat,res,1);
	return id[P(stat,comp)]=res;
}

int n,m;

int main(){
	cin.sync_with_stdio(false);
	cin>>n>>m;
	idlast=n;
	rep(i,m){
		int p,q,c;
		cin>>p>>q>>c;
		p--; q--;
		int pid=getid(p,c);
		int qid=getid(q,c);
		dj.add_edge(pid,qid,0);
		dj.add_edge(qid,pid,0);
	}
	dj.init(idlast);
	dj.shortpath(0);
	int res=dj.d[n-1];
	if(res==INF)cout<<-1<<endl;
	else cout<<res<<endl;
	return 0;
}


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

using namespace std;

static const int INF = 1e9 + 7;

void hawawa()
{
  int n;
  while (cin >> n && n) {
    vector<int> a(n);
    for (auto&& i : a) {
      cin >> i;
    }
    sort(begin(a), end(a));
    int ans = INF;
    for (int i = 1; i < n; i++) {
      ans = min(ans, a[i] - a[i - 1]);
    }
    cout << ans << "\n";
  }
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  hawawa();
}

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

using namespace std;

int main()
{
    int mx,i,j,m,n;
    string s;
    cin >> n >> s;
    m=0;
    mx=0;
    for(i=0;i<n;i++)
    {
        if(s[i]=='I')
        {
            m++;
        }
        else
        {
            m--;
        }
        mx=max(m,mx);
    }
    cout << mx << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
typedef long long _int;
const int maxn = 310;

_int dis[maxn][maxn];
int ans[maxn][maxn];


int main() {
  memset(dis, 0x3f, sizeof dis);
  memset(ans, 0x3f, sizeof ans);
  int n, m, l, u, v, w, q;
  scanf("%d%d%d", &n, &m, &l);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d%d", &u, &v, &w);
    dis[u][v] = std::min(dis[u][v], 1ll * w);
    dis[v][u] = std::min(dis[v][u], 1ll * w);
  }
  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        dis[i][j] = std::min(dis[i][j], dis[i][k] + dis[k][j]);
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) if (i ^ j) {
      if (dis[i][j] <= l) ans[i][j] = 1;
    }
  }
  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        ans[i][j] = std::min(ans[i][j], ans[i][k] + ans[k][j]);
      }
    }
  }
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d", &u, &v);
    if (ans[u][v] == 0x3f3f3f3f) puts("-1");
    else printf("%d\n", ans[u][v] - 1);
  }
  return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007LL
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  150
#define tmod             998244353LL
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll SUMD(ll n);
ll BS(vector<pair< ll ,ll > > &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
//bool P[N+1];
void Sieve(int n=N);
ll Powb(ll b,ll n,ll m);

vector<vector<int> > G(200005);
vector<ll> A(200005),ans(200005,1);

void DFS(ll s,ll p,ll &l,vector<ll> &V)
{
    ll ol = l,ov;
    auto it = lower_bound(V.begin(),(V.begin()+l),A[s]);
    if(it==V.begin()+l) V[l++] = A[s];
    else {ov = (*it); *it = A[s];}
    ans[s] = l;
    for(auto it:G[s]) if(it!=p) DFS(it,s,l,V);
    if(ol==l) *it = ov;
    else l--;
}

int main()
{
fast;
ll q=1,t;
//cin >> q;
while(q--)
{
    ll i,j,n,m,k,l,r,a,b,c=0,d=0,e,g,p,q,u,v,w,x,y,flag=1;
    //n=m=k=i=j=l=r=a=b=c=d=u=v=w=p=x=y=0;
    cin >> n;
    for(i=1;i<=n;i++) cin >> A[i];
    for(i=0;i<n-1;i++)
    {
        cin >> u >> v;
        G[u].pb(v); G[v].pb(u);
    }
    vector<ll> V(n+5);
    l = 0;
    DFS(1,1,l,V);
    for(i=1;i<=n;i++) cout << ans[i] << endl;
}
    return 0;
}

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

ll Powb(ll b,ll n,ll m)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2,m);
    if(n%2==0){return (temp*temp)%m;}
    else{return (b*((temp*temp)%m))%m;}
}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;

}
ll BS(vector<pair<ll,ll> > &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid].F==ser)
    {
        return mid;
    }
    else if(PS[mid].F > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}
/*
void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}

*/


Measured memory_bytes: 36096
use std::io;


fn main() {
    let n = read_one::<usize>();
    let vn = read::<isize>();
    let cn = read::<isize>();
    let mut ans = 0;
    for i in 0..n {
        if vn[i] > cn[i] { ans += vn[i] - cn[i]; }
    }
    println!("{}", ans);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█
 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long lo;
typedef pair< lo,lo > PII;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
 
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
 
int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;
 
int main(void){
	scanf("%d %d",&n,&m);
	k=1;
	while(k<m){k+=n-1;cev++;}
	printf("%d\n",cev);
	return 0;
}


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

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

using Graph = vector<vector<int>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}

typedef pair<int,int> P;

bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}
int factorial(int a){
  int res = 1;
  while(a){
    res *= a;
    a--;
  }
  return res;
}

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(C <= B && C >= A) cout << "Yes" <<endl;
  else cout << "No" << endl;
 }

Measured memory_bytes: 256
import java.io.*;

class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br=
				new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int m=Integer.parseInt(br.readLine());
		int[] line=new int[n];
		for(int i=0;i<n;i++){
			line[i]=i+1;
		}
		for(int i=0;i<m;i++){
			String buf2=br.readLine();
			String[] buf=buf2.split(",");
			int[] data=new int[2];
			for(int j=0;j<2;j++)	data[j]=(Integer.parseInt(buf[j])-1);
		int temp=line[data[0]];
		line[data[0]]=line[data[1]];
		line[data[1]]=temp;
		}
		for(int i=0;i<n;i++){
			System.out.println(line[i]);
		}
	}
}

Measured memory_bytes: 9136
# 2020/01/25
# AtCoder Beginner Contest 065 - C

import math

# Input
n, m = map(int,input().split())

# Calc
sub = abs(n - m)

if sub >= 2:
    ans = 0
elif sub == 1:
    ans = (math.factorial(n) * math.factorial(m)) % (10 ** 9 + 7)  
else:
    ans = (math.factorial(n) * math.factorial(m) * 2) % (10 ** 9 + 7)

# Output
print(ans)

Measured memory_bytes: 5184
from collections import deque
n = int(input())
s = lambda i: i * (i+1) // 2
ans = deque()
for i in range(1, 10**7):
    ans.append(i)
    if s(i) >= n:
        ans = list(ans)
        if s(i) > n:
            ans.pop(s(i) - n - 1)
        break
print(*ans, sep="\n")

Measured memory_bytes: 3956
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <bitset>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <time.h>
#include <limits>
#include <math.h>
#include <climits>
#include <numeric>
#include <utility>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <functional>
#include<unordered_map>

using namespace std;
const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;

#define 	boost  		ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); // don't use if small inpts
#define 	endl 		'\n'
#define 	sl(n) 		scanf("%lld",&n)
#define		mp 			make_pair
#define 	pb 			push_back
#define 	ppb 		pop_back
#define 	fi 			first
#define 	se 			second
#define 	ll 			long long
#define 	ull 		unsigned long long
#define 	pii 		pair<int, int>
#define 	f(i,a,b) 	for(ll i = (ll)(a); i < (ll)(b); i++)
#define 	rf(i,a,b) 	for(ll i = (ll)(a); i > (ll)(b); i--)
#define 	ms(a,b) 	memset((a),(b),sizeof(a))
#define 	max(a,b) 	((a>b)?(a):(b))
#define 	min(a,b) 	((a<b)?(a):(b))
#define 	vec(g1) 	int temp;cin>>temp;g1,push_back(temp);
#define 	abs(x) 		((x<0)?(-(x)):(x))
#define 	MAX 		1000005
#define 	inf 		LLONG_MAX
#define 	MIN 		INT_MIN

//typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;


int mod = 1e9 + 7 ;
ll gcd(ll a , ll b){return b==0?a:gcd(b,a%b);}
ll powmod(ll a,ll b) {ll res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
// ll fac[200005];
// ll inverse(ll n){return powmod(n, mod-2);}
// ll nCr(ll n, ll r){return (fac[n] * inverse(fac[r]) % mod * inverse(fac[n-r]) % mod) % mod;}
////****************************************************************************************************************************************************************************************************************////

int main(){
    string s1,s2,s3;
    cin>>s1>>s2>>s3;
    int n1=stoi(s1);
    int n2=stoi(s3);
     if(s2 =="+")cout<<n1+n2<<endl;
     else cout<<n1-n2<<endl;
	return 0;

}

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

typedef long long int ll;

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

	string s;
	cin >> s;
	vector<int> v(2019,0);
	v[0]++;
	ll sum = 0, r = 1, ans = 0;
	reverse(s.begin(),s.end());
	for (char c: s) {
		sum += (c - '0') * r;
		sum %= 2019;
		ans += v[sum]++;
		r*=10;
		r%=2019;
	}
	cout << ans;
}



Measured memory_bytes: 3728
#include <algorithm>
#include <cmath>
#include <iostream>
#include <deque>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

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

	std::vector<int> points(n);

	for (int i = 0; i < q; ++i)
	{
		int a;
		cin >> a;
		++points.at(a - 1);
	}

	for (int i : points)
	{
		if (i > q - k)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <unordered_set>
#include <map>
#include <random>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
typedef long long ll;
typedef pair<int,int> pii;
const int M = 1e9 + 7;
int main() {
    int n;
    cin >> n;
    vector<int>t(n),a(n);
    rep(i,n){
        cin >> t[i];
    }
    rep(i,n){
        cin >> a[i];
    }
    ll ans = 1;
    bool check = true;
    rep(i,n){
        if(i==0){
            check = (t[i]<=a[i]);
            if(!check){
                cout << 0 << endl;
                return 0;
            }
            
        }
        else if(i==n-1){
            check = (t[i]>=a[i]);
            if(!check){
                cout << 0 << endl;
                return 0;
            }
        }
        else{
            if(t[i-1] < t[i]){
                //cout << "t" << i << endl;
                check = (t[i]<=a[i]);
                if(!check){
                    cout << 0 << endl;
                    return 0;
                }
            }
            else if(a[i] > a[i+1]){
                //cout << a[i] << " " << a[i+1] << endl;
                //cout << "a" << i << endl;
                check = (t[i]>=a[i]);
                if(!check){
                    cout << 0 << endl;
                    return 0;
                }
            }
            else{
                ans *= min(a[i],t[i]);
                //cout << i << " " <<ans << endl;
                ans%=M;
            }
        }
    }
    cout << ans << endl;
}

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

vector< vector<int> > point(26, vector<int>());

int main(){
  string s,t;
  cin >> s >> t;
  for(int i = 0; i < s.length() ; i++){
    point[s[i] - 'a'].push_back(i);
  }
  for(int i = 0; i < t.length(); i++){
    if(!point[t[i] - 'a'].size()){
      cout << -1 << endl;
      return 0;
    }
  }
  int now = -1;
  long long ans = 0;
  for(int i = 0; i < t.length(); i++){
    auto it = lower_bound(point[t[i]-'a'].begin(), point[t[i]-'a'].end(), now+1);
    if(it != point[t[i]-'a'].end()){
      ans += *it - now;
      now = *it;
    }
    else{
      ans += s.length() - 1 - now +point[t[i]-'a'][0] + 1;
      now = point[t[i]-'a'][0];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1216
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	renga := make([]int, N)
	for i, _ := range renga {
		fmt.Scan(&renga[i])
	}
	var count int
	ff := false
	a := 1
	for _, v := range renga {
		if v == a {
			a++
			ff = true
		} else {
			count++
		}
	}

	if !ff {
		fmt.Println(-1)
	} else {
		fmt.Println(count)
	}
}

Measured memory_bytes: 5760
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    x = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    if x ==1:
        print(0)
    else:
        print(1)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9172
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double a = sc.nextDouble();
    double b = sc.nextDouble();
    int h = sc.nextInt();
    int m = sc.nextInt();
    int D = (60 * h) + m;
    double dd = (double)D;
    double a1 = dd / (double)2;
    double a2 = dd * ((double)6);
    a1 = (a1 % 360);
    a2 = (a2 % 360);
    double a3 = Math.abs(a1 - a2);
    double a3r = Math.toRadians(a3);
    double cos = Math.cos(a3r);
    double ans = (a * a) + (b * b) - (2 * a * b * cos);
    ans = Math.sqrt(ans); 
    System.out.println(ans);
  }
}


Measured memory_bytes: 37420
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}


#[allow(unused_imports)]
use input::*;

fn search(n: u64) -> (u64,u64) {
    let s=(n as f64).sqrt().round() as u64 -1;
    for z in 0..10{
        if n<=(s+z)*(s+z){
            return (s+z,(s+z)*(s+z)-n);
        }
    }
    (0,0)
}

fn main() {
    let s: u64;
    input!(s);

    let z = search(s);
    println!("{} {} {} {} {} {}",0,0,z.0,1,z.1,z.0);


}

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

using namespace std;
#define ll  long long
#define PI  acos(-1)
#define pb  push_back
#define ins insert
#define INF 5000000000000000007 //1e18+7
#define mk  make_pair
#define ff  first
#define ss  second
//#define endl "\n"
#define max3(x,y,z)  max(x,max(y,z))
#define min3(x,y,z)  min(x,min(y,z))
#define sz(a) (ll)a.size()
#define double long double
#define coud(a,b) cout << fixed << setprecision((b)) << (a)
#define mset(x,y)  memset(x,y,sizeof(x))
#define all(x)   (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bp(n)  __builtin_popcountll(n)
#define mxt(a)  *(max_element(a.begin(),a.end()))
#define mnt(a)  *(min_element(a.begin(),a.end()))
#define unique_sort(c) (sort(all(c)), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define trav(a, x) for(auto &a : x)

const double eps=1e-7;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int d8x[8] = {+1, +1, +1, 0, 0, -1, -1, -1};
int d8y[8] = {+1, 0, -1, +1, -1, +1, 0, -1};
int d4x[4] = {1, 0, 0, -1};
int d4y[4] = {0, -1, 1, 0};
ll power(ll x,ll y){ll fk=1;x=x;while(y>0){if(y&1)fk=(fk*x);y=y>>1;x=(x*x);}return fk;}
ll sqr(ll x) { return x * x;}

template <typename T> T gcd(T a,T b){ if(a==0) return b; return gcd(b%a,a); }
template <class T> inline void chmax(T &x,T y){ x = max((x), (y));}
template <class T> inline void chmin(T &x,T y){ x = min((x), (y));}
template <class T> T abs(T x) { return x>0 ? x : -x;}
template <typename T> T powm(T a,T b, ll m){T cnt=1; while(b>0) { if(b%2==1) cnt=(cnt*a)%m; b/=2; a=(a*a)%m; }return cnt%m;}
typedef pair<int,int>  pii;
typedef pair<ll,ll>  pll;
typedef vector<pll>  vpll;
typedef vector<pii>  vpii;
typedef vector<ll>   vll;
typedef vector<int>  vii;
#define minpq priority_queue<T,vector<T>,greater<T> >;
// #define T int
// #define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
//*X.find_by_order(k) returns the kth largest element (0-based).
//X.order_of_key(val) returns the no. of values less than val.
ll ncr(ll n,ll r) {ll fk=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){fk*=(n-i);fk/=(i+1);}return fk;}
const int MOD = 998244353;   
const int N = 102;
// 🎲

void solve() {
  string s;
  cin >> s;
  if(s.back() == 's') s += "es";
  else s += 's';
  cout << s;
}

int32_t main() {
  cin.sync_with_stdio(0);cin.tie(0);
  cin.exceptions(cin.failbit);
  
  int tc = 1;
  //cin >> tc;
  for (int i=1; i<=tc; ++i) {
    solve();
  }
  return 0; 
}
/* stuff you should look for
    * int overflow,array bounds.
    * special cases (n=1?).
    * N,MOD value.
*/

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

import static java.lang.System.in;

public class Main {
    public static void main(String[] args)throws IOException{
        Scanner sc = new Scanner(System.in);
        int n= sc.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++) a[i]=sc.nextInt();
        int ans =solve(a,n);
        System.out.println(ans);

    }
    static int solve(int[] a, int n){
        Arrays.sort(a);
        if(n==1) return a[0];
        int ans = gcd(a[0],a[1]);
        for(int i=2;i<n;i++) ans = gcd(ans,a[i]);
        return ans;
    }
    static int gcd(int a, int b){
        if(a<b){
            int c = a;
            a = b;
            b = c;
        }
        while(a%b!=0){
            int c = a%b;
            a = b;
            b = c;
        }
        return b;
    }
}


Measured memory_bytes: 50248
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    if S <= '2019/04/30':
        print('Heisei')
    else:
        print('TBD')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9072
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		if(x < a){
			System.out.print(0);
		}else{
			System.out.print(10);
		}
	}
}


Measured memory_bytes: 23124
n = int(input())
a = list(map(int,input().split()))
a=sorted(a,reverse = True)
if a[-1]==0:
    print(0)
    exit()
else:
    
    number = a[0]
    for i in range(1,n):
        number = number * a[i]
        if number > 10**18:
            print(-1)
            exit()

print(number)

Measured memory_bytes: 21712
#include<bits/stdc++.h>
#define tr(xx,yy) (xx+=yy)>=M?xx-=M:0
const int N=3003,M=1000000007,I2=M+1>>1;
using namespace std;
int n,m,a[N],f[N][N],l,r,
g0[N],g1[N],h0[N],h1[N],ans;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	scanf("%d",a+i);
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	if(a[j]<a[i])f[j][i]=1;
	for(int al=0;al<m;al++){
		scanf("%d%d",&l,&r);
		for(int i=1;i<=n;i++)
		if(i!=r)
		f[l][i]=1ll*f[l][i]*I2%M,
		f[i][l]=1ll*f[i][l]*I2%M;
		for(int i=1;i<=n;i++)
		f[r][i]=1ll*f[r][i]*I2%M,
		f[i][r]=1ll*f[i][r]*I2%M;
		for(int i=1;i<=n;i++)
		g0[i]=f[l][i],g1[i]=f[i][l],
		h0[i]=f[r][i],h1[i]=f[i][r];
		for(int i=1;i<=n;i++){
			if(i!=r)tr(f[r][i],g0[i]),tr(f[i][r],g1[i]);
			else tr(f[r][l],g0[i]),tr(f[l][r],g1[i]);
			if(i!=l)tr(f[l][i],h0[i]),tr(f[i][l],h1[i]);
		}
	}
	for(int i=1;i<=n;i++)
	for(int j=1;j<i;j++)tr(ans,f[i][j]);
	for(int i=0;i<m;i++)tr(ans,ans);
	printf("%d",ans);
}

Measured memory_bytes: 35456
import numpy as np
import scipy as sp

def main():
    # parse
    N, A, B = parse(get_stdin())
    # compute
    result = compute(N, A, B)
    # show result
    print(result)

def compute(N, A, B):
    if N == 0:
        return 0
    if N == 1:
        if A == B:
            return 1
        else:
            return 0
    if A > B:
        return 0
    x = B - A
    n = N - 2
    return x * n + 1

def get_stdin():
    return input()

def split_stdin(stdin_val, delimiter = ' '):
    return [x for x in stdin_val.split(delimiter) if x != '']

def parse(stdin_vars):
    vars = split_stdin(stdin_vars)
    return int(vars[0]), int(vars[1]), int(vars[2])

if __name__ == "__main__":
    main()

Measured memory_bytes: 12984
N = int(input())
AB = []
low = []
up = []
for i in range(N):
    A, B = map(int, input().split())
    AB.append([A, B])
    low.append(A)
    up.append(B)
    
low = sorted(low)
up = sorted(up)
    
if N%2 == 1:
    m_up = up[N//2]
    m_low = low[N//2]
    ans = m_up-m_low+1
    print(ans)
else:
    m_up = up[N//2] + up[N//2-1]
    m_low = low[N//2-1] + low[N//2]
    ans = m_up-m_low+1
    print(ans)


Measured memory_bytes: 44620
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    s = input().rstrip()

    r = s.count("R")
    b = s.count("B")
    print("Yes" if r > b else "No")


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3060
n = int(input())
s = input()
cnt = 0
flag = 0
for i in range(n):
  if s[i] == "A":
    flag = 1
  elif s[i] == "B" and flag == 1:
    flag = 2
  elif s[i] == "C" and flag == 2:
    cnt += 1
    flag = 0
  else:
    flag = 0
print(cnt)

Measured memory_bytes: 3060
/* You are being watched. */


//~ while (clock() <= 69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

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

using namespace std;

//~ #include <ext/pb_ds/assoc_container.hpp>
//~ #include <ext/pb_ds/tree_policy.hpp>
//~ using namespace __gnu_pbds;
//~ template <typename T>
//~ using ordered_set =
  //~ tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) (x).begin(), (x).end()
#define show(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
//using li = __int128;
//using uli = unsigned __int128;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int get(int x, int k) {
  return x / k;
}

void solve() {
  ll x; cin >> x;
  ll cur = 100;
  ll ans = 0;
  while(cur < x) {
    cur += cur / 100;
    ans++;
  }
  print(ans);
}

int main() {
  int t; t = 1;
  while(t--) solve();
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
const int N=500010;
int n,sd,d[N],a[N],b[N],qt,q;
int main(){
	scanf("%d%d",&n,&sd);
	a[0]=sd;
	for(int i=1;i<=n;i++){
		scanf("%d",&d[i]);
		a[i]=min(a[i-1],abs(a[i-1]-d[i]));
	}
	b[n]=1;
	for(int i=n-1;i>=1;i--){
		if(abs(d[i+1]-b[i+1])<b[i+1]) b[i]=b[i+1]+d[i+1]; // "<" 而不是 "<=" 
		else b[i]=b[i+1];
	}
//	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
//	cout<<endl;
//	for(int i=1;i<=n;i++) cout<<b[i]<<" ";
//	cout<<endl;
	scanf("%d",&q);
	for(int i=1;i<=q;i++){
		scanf("%d",&qt);
		if(a[qt-1]>=b[qt]) puts("YES\n");
		else puts("NO\n");
	}
	return 0;
}

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

#define H 250

int main(){
  int x,a,b,c,i,A[H+1];

  scanf("%d",&x);

  for(i=1;i<=x;i++){
    scanf("%d",&A[i]);
  }


  for(i=1;i<=x;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i==1) {
      if(x==2) printf("left key = %d, ",A[2*i]);
      else printf("left key = %d, right key = %d, ",A[2*i],A[2*i+1]);
    }
    else
      {
	printf("parent key = %d, ",A[i/2]);
	if(x>=2*i) printf("left key = %d, ",A[2*i]);
 	if(x>=2*i+1) printf("right key = %d, ",A[2*i+1]);
	
			    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2104
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

const (
	SCANNER_BUF_SIZE = 2 << 20

	INF = int64(math.MaxInt64)
	MOD = 1e9 + 7
)

var (
	writer  *bufio.Writer
	scanner *bufio.Scanner
)

func init() {
	writer = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, SCANNER_BUF_SIZE), SCANNER_BUF_SIZE)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func sint64() int64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func suint64() uint64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func sstring() string {
	scanner.Scan()
	return scanner.Text()
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

func main() {
	defer writer.Flush()
	n := sint64()
	out := []rune{}
	for n > 0 {
		offset := (n-1) % 26
		out = append(out, 'a' + rune(offset))
		n -= ((n-1) % 26 + 1)
		n /= 26
	}
	l := 0
	r := len(out) - 1
	for l < r {
		out[l], out[r] = out[r], out[l]
		l++
		r--
	}
	printf("%s\n", string(out))
}


Measured memory_bytes: 1844
#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
const ll mod=1e9+7;

/*ll powmod(ll x,ll y){     //指数乗の計算　MODありver
  ll ans=1;
  rep(i,y){
    ans=ans*x%mod;
  }
  return ans;
}*/
vector<int> divisors(int N) {
    vector<int> res;
    for (int i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    return res;
}

int main()
{
  int N;
   cin >> N;
   ll ans=0;
   for(int i=N-1;i>0;i--){
     vector<int> v(0);
     //cout <<v.size()<< endl;
     v = divisors(i);
     //cout <<v.size()<< endl;
     ans+=((v.size()));

   }

   cout <<ans<< endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#include <limits>
#define ll long long
using namespace std;
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;

int main()
{
    ll n,sum=0;
    cin >> n;
    vector<ll>a(n+2,0),sa(n+1,0),sa2(n,0);
    for (ll i = 1; i < n+1;i++){
        cin >> a[i];
    }
    for (ll i = 0; i < n+1;i++){
        sum += abs(a[i + 1] - a[i]);
    }
    for (ll i = 0; i < n; i++)
    {
        ll sa = (abs(a[i + 1] - a[i]) + abs(a[i + 2] - a[i + 1])) - abs(a[i + 2] - a[i]);
        cout << sum - sa << endl;
    }
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;

#define fbo find_by_order
#define ook order_of_key
#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef pair<ii,ii> iiii;
typedef vector<int> vi;
typedef vector<ii> vii;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// mt19937_64 rng(std::chrono::system_clock::now().time_since_epoch().count());

// /mnt/c/Users/vince/Desktop/POST-IOI/

const int INF = 1e9;
set<iiii> str, stc;
bool bc[200003], br[200003];

int main()
{
	// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// freopen("input.in", "r", stdin);

	int n, q; scanf("%d %d", &n, &q);
	str.insert({{2,n-1},{2,(n-1)}});
	stc.insert({{2,n-1},{2,(n-1)}});
	long res = 0;
	while(q--)
	{
		int t, x;
		scanf("%d %d", &t, &x);
		if(t == 1)
		{
			if(bc[x]) continue;
			auto it = stc.upper_bound({{x, INF},{INF,INF}});
			it--;
			iiii curr = *it;
			int a, b, c, d;
			a = curr.fi.fi;
			b = curr.fi.se;
			c = curr.se.fi;
			d = curr.se.se;
			res += (d-c+1);
			// printf("%d %d\n", c, d);

			stc.erase(it);
			if(str.find({{c,d},{a,b}}) != str.end())
			{
				str.erase(str.find({{c,d},{a,b}}));
				str.insert({{c,d},{a,x-1}});
			}
			
			if(a <= x-1)
				stc.insert({{a,x-1},{c,d}});
			if(x+1 <= b)
				stc.insert({{x+1,b},{c,d}});
				
			if(x == 2)
			{
				for(int j = c; j <= d; j++)
					br[j] = 1;
			}
		}
		else
		{
			if(br[x]) continue;
			auto it = str.upper_bound({{x, INF},{INF,INF}});
			it--;
			iiii curr = *it;
			int a, b, c, d;
			a = curr.fi.fi;
			b = curr.fi.se;
			c = curr.se.fi;
			d = curr.se.se;
			res += (d-c+1);
			// printf("%d %d\n", c, d);

			str.erase(it);
			// if(q == 0) return 0;
			if(stc.find({{c,d},{a,b}}) != stc.end())
			{
				stc.erase(stc.find({{c,d},{a,b}}));
				stc.insert({{c,d},{a,x-1}});
			}

			if(a <= x-1)
				str.insert({{a,x-1},{c,d}});
			if(x+1 <= b)
				str.insert({{x+1,b},{c,d}});
			if(x == 2)
			{
				for(int j = c; j <= d; j++)
					bc[j] = 1;
			}
		}

		// printf("%d %d\n", t, x);
		// for(auto it : stc) printf("%d %d %d %d\n", it.fi.fi, it.fi.se, it.se.fi, it.se.se);
		// for(auto it : str) printf("%d %d %d %d\n", it.fi.fi, it.fi.se, it.se.fi, it.se.se);
		// printf("\n");
	}
	printf("%lld\n", 1LL*(n-2)*(n-2)-res);
}




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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T>
constexpr T INF = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 2;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()

template<typename T>
istream& operator>>(istream& in, vector<T>& a) { for (T& x : a) in >> x; }

void LOG(int x) { cerr << x << "\n"; }
void LOG(vector<int>& a) { for (int x : a) cerr << x << " "; cerr << "\n"; }

int ceil(int a, int b) { return (a - 1) / b + 1; }

class UnionFind {
private:
  vector<int> par;
  vector<int> rnk;
  int find(int x) {
    return par[x] == x ? x : par[x] = find(par[x]);
  }
public:
  UnionFind(int size) {
    par.resize(size);
    rnk.resize(size);
    REP(i, size) par[i] = i, rnk[i] = 0;
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rnk[x] < rnk[y]) {
      par[x] = y;
    } else {
      par[y] = x;
      if (rnk[x] == rnk[y]) rnk[x]++;
    }
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
};

struct InitCpp { InitCpp() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
} } initCpp;

signed main() {
  string s, t;
  cin >> s >> t;
  RREP(i, s.size() - t.size() + 1) {
    bool m = true;
    REP(j, t.size()) {
      if (s[i + j] == '?' || s[i + j] == t[j]) {
        //
      } else {
        m = false;
        break;
      }
    }
    if (m) {
      REP(j, s.size()) {
        if (i <= j && j < i + t.size()) cout << t[j - i];
        else if (s[j] == '?') cout << 'a';
        else cout << s[j];
      }
      cout << endl;
      return 0;
    }
  }
  cout << "UNRESTORABLE" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
int A=0;
int n;
while(cin>>n&&n!=0)
{
int a[n];
int R=-100000;
for(int h=0;h<n;h++)
{
	cin>>a[h];
}
for(int i=0;i<n;i++)
{
	for(int j=i;j<n;j++)
	{		
		A=A+a[j];
	if(R<A)
	{
		R=A;
	}	
	}	
	
	A=0;
}
cout<<R<<endl;
}
return 0;
}

Measured memory_bytes: 3100
#include<iostream>
using namespace std;
bool vis[110][110],na[110][110];
int dx[]={0,1,0,-1},dy[]={-1,0,1,0};
int ex[]={-1,1,0,0},ey[]={0,0,-1,1};
int n;
void DFS(int y,int x,int k){
  vis[y][x]=true;
  na[y][x]=true;
  int xx,yy;
  bool done=false;
  for(int i=0;i<4;i++){
    xx=x+dx[k],yy=y+dy[k];
    bool ok=false;
    if(0<=xx&&xx<n&&0<=yy&&yy<n){
      if(na[yy][xx]==false){
	ok=true;
      }
    }
    if(ok){done=true;break;}
    k=(k+1)%4;
  }
  if(!done)return;
  for(int i=0;i<2;i++){
    int r=i+(k%2)*2;
    int nx=x+ex[r],ny=y+ey[r];
    if(0<=nx&&nx<n&&0<=ny&&ny<n){
      na[ny][nx]=true;
    }
  }
  DFS(yy,xx,k);
}
int main(){
  int q;cin>>q;
  for(int u=0;u<q;u++){
    if(u)cout<<endl;
    cin>>n;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	vis[i][j]=false;
	na[i][j]=false;
      }
    }
    DFS(n-1,0,0);
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++)cout<<(vis[i][j]?"#":" ");
      cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3104
require 'bigdecimal'

x = gets
until x.nil?
 y = x.split(",")
 s = y[0].to_i
 w = y[1].to_f
 h = y[2].to_f

 height = BigDecimal(h.to_s) * BigDecimal(h.to_s)
 h = height.to_f
 bmi = BigDecimal(w.to_s) / BigDecimal(h.to_s)
 bmi1 = bmi.to_f
 if bmi1 >= 25
  puts s
 end

 x = gets
end


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

for h in range(1, 3501):
    for n in range(1, 3501):
        if (4 * h * n - N * n - N * h) != 0 and (N * h * n) % (
            4 * h * n - N * n - N * h
        ) == 0:
            w = (N * h * n) // (4 * h * n - N * n - N * h)
            if w > 0:
                print(h, n, w)
                exit(0)



Measured memory_bytes: 70220
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MAX = 2147483647;

ll N,Q,c,x,y;
int n = 1;
vector<int> st;

void update(int i, int x){
    i += n - 1;
    st[i] = x;
    while(i > 0){
        i = (i-1) / 2;
        st[i] = min(st[i*2+1], st[i*2+2]);
    }
}

int find(int a, int b, int i, int l, int r){
    if(b <= l || r <= a) return MAX;
    if(a <= l && r <= b) return st[i];
    int vl = find(a,b,i*2+1,l,(l+r)/2);
    int vr = find(a,b,i*2+2,(l+r)/2,r);
    return min(vl,vr);
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> N >> Q;
    // init //
    while(n < N) n *= 2;
    st.assign(n*2-1,MAX);
    // init //

    REP(i,Q){
        cin >> c >> x >> y;
        if(c==0){
            update(x,y);
        } else {
            cout << find(x,y+1,0,0,n) << '\n';
        }
    }
    return 0;
}


Measured memory_bytes: 3876
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let s = read::<String>();
    if s == "ABC" {
        println!("ARC");
    } else {
        println!("ABC");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

int main(){
    int N;

    cin >> N;

    int counter = 0;
    int max_counter = 0;
    int ans = 1;
    int j;

    for (int i = 1; i < N + 1; i++) {
        j = i;
        
        while (j % 2 == 0){
            counter++;
            j = j / 2;
        }

        max_counter = max(max_counter, counter);

        if (max_counter == counter){
            ans = max(i, ans);
        }

        counter = 0;
    }

    cout << ans << endl;
}

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

map< int64_t, int > res;
void prime_factor(int64_t n) {
  //map< int64_t, int > res;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n]++;
  //return res;
}

int main(){
    int n; cin>>n;
    
    for(int i = 1; i <= n ;i++){
        prime_factor(i);
    }
    
    int64_t ans = 1;
    for(auto p : res){
        ans = (ans*(p.second+1))%mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/* author   : mpily :-()
title : Competing.cpp
time :Thu Oct 31 18:40:17 2019

*/
#include<bits/stdc++.h>
using namespace std;
bool isValid(long long K, vector<pair<long long,long long>>& player, long long ans){
	long long steps = 0;
	for(int i = 0 ; i < player.size(); i++){
		if(player[i].first * player[i].second  > ans){
			long long topass = ans/player[i].second;
			long long toadd = player[i].first - topass;
			steps+=toadd;
		}
	}
	if(steps > K){
		return 0;
	}
	return 1;
}
int main(){
	long long N,K;
	cin>>N>>K;
	vector<long long>A(N);
	vector<long long>F(N);
	vector<pair<long long ,long long>>player(N);
	for(auto i = 0; i < N; i++)cin>>A[i];
	for(int j = 0; j < N; j++)cin>>F[j];
	sort(A.begin(),A.end());
	sort(F.begin(),F.end());
	reverse(A.begin(),A.end());
	long long  mx = 0;
	for(int i = 0; i < N; i++){
		if(A[i]*F[i] > mx)mx = A[i]*F[i];
		player[i].first = A[i];
		player[i].second = F[i];
	}
	long long high = mx;
	long long low = 0;
	long long mid = (low + high )/2;
	while(high > low){
		//cout<<low<<" "<<mid<<high<<"\n";
		if(isValid(K,player,mid)){
			high = mid;
			mid = (low+high )/2;
		}
		else{
			low = mid+1;
			mid = (low+high)/2;
		}
	}	
	cout<<mid<<"\n";
	return 0;
}


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

using namespace std;
typedef long long ll;

vector<int> divisor(int n)
{
    vector<int> ret;
    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}

int main()
{

    int N;

    cin >> N;
    vector<int> P(N);
    for (int i = 0; i < N; i++)
    {

        cin >> P[i];
    }

    int count = 0;

    sort(P.begin(), P.end());

    for (int i = 0; i < N; i++)
    {

        vector<int> Kas = divisor(P[i]);

        bool ahoflag = 0;

        for (int j = 0; j < Kas.size() - 1; j++)
        {

            if (binary_search(P.begin(), P.end(), Kas[j]))
            {

                ahoflag = 1;
            }
        }

        int nums =upper_bound(P.begin(),P.end(),P[i]) - lower_bound(P.begin(),P.end(),P[i]);


        if(nums>1){

            ahoflag=1;
        }

        if (ahoflag == 0)
        {

            count++;
        }
    }


    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3984
#include <iostream>
#include <cstring>
#include <map>
#include <algorithm>
#include <functional>
#define fi first
#define sec second
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> PP;

int t,p,r;
int team[50][10];
PP point[50];

int main(){
	int t, p, r;
	while(cin >> t >> p >> r,t||p||r){
		for(int i = 0; i < t; i++){
			for(int j = 0; j < p; j++) team[i][j] = 0;
			point[i].fi.fi = 0;
			point[i].fi.sec = 0;
			point[i].sec = -i-1;
		}
		for(int i = 0; i < r; i++){
			int tl, pl, ti;
			string m;
			cin >> tl >> pl >> ti >> m;
			tl--; pl--;
			if(team[tl][pl] < 0) continue;
			if(m[0] == 'W'){
				team[tl][pl]++;
			} else{
				point[tl].fi.fi++;
				point[tl].fi.sec -= 1200*team[tl][pl]+ti;
				team[tl][pl] = -1;
			}
		}
		sort(point,point+t,greater<PP>());
		for(int i = 0; i < t; i++){
			cout << point[i].sec*-1 << " " << point[i].fi.fi << " " << point[i].fi.sec*-1 << endl;
		}
	}
}

Measured memory_bytes: 1208
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#define re register
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define MAXN 4000007
#define mo 19930726
using namespace std;
typedef unsigned long long ull;
#define ms(arr) memset(arr, 0, sizeof(arr))
const int inf = 0x3f3f3f3f;
inline int read()
{
    int x=0,c=1;
    char ch=' ';
    while((ch>'9'||ch<'0')&&ch!='-')ch=getchar();
    while(ch=='-')c*=-1,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-'0',ch=getchar();
    return x*c;
}
int n,m,a[4001],f[2005][2005],cw[4001][2002],cb[4002][2001],pos[2][2001],col[4001];
char s[2];
int main()
{
	n=read();
	for(re int i=1;i<=n<<1;i++){
		scanf("%s",s); a[i]=read();
		col[i]=(s[0]=='B');
		pos[col[i]][a[i]]=i;
	}
	memset(f,100,sizeof(f));
	f[0][0]=0;
	for(re int i=1;i<=n<<1;i++)
		for(re int j=0;j<=n;j++){
			cw[i][j]=cw[i-1][j];
			cb[i][j]=cb[i-1][j];
			if(a[i-1]>j) col[i-1]?cb[i][j]++:cw[i][j]++;
		}
	for(re int i=0;i<=n;i++){
		for(re int j=0;j<=n;j++){
			int x=pos[0][i+1],y=pos[1][j+1];
			f[i+1][j]=min(f[i+1][j],f[i][j]+cw[x][i+1]+cb[x][j]);
			f[i][j+1]=min(f[i][j+1],f[i][j]+cw[y][i]+cb[y][j+1]);
		}
	}
	cout<<f[n][n];
}

Measured memory_bytes: 78592