akhauriyash/Code-Regression huggingface dataset:
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int k;
	cin>>k;
	cout<<a[k-1]<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()

def calc(x):
    n = int(x * 10 ** 9 + 0.5)
    a = 0
    b = 0
    while n % 2 == 0:
        n //= 2
        a += 1
    while n % 5 == 0:
        n //= 5
        b += 1
    return (min(a, 18), min(b, 18))

ans = 0
N = int(input())
X = [[0] * 19 for _ in range(19)]
for _ in range(N):
    a, b = calc(float(input()))
    if a >= 9 and b >= 9:
        ans -= 1
    X[a][b] += 1

Y = [x[:] for x in X]

for i in range(18)[::-1]:
    for j in range(19):
        Y[i][j] += Y[i+1][j]
for i in range(19):
    for j in range(18)[::-1]:
        Y[i][j] += Y[i][j+1]

for i in range(19):
    for j in range(19):
        ans += X[i][j] * Y[18-i][18-j]
print(ans // 2)


Measured memory_bytes: 68724
#include<stdio.h>
int main(){
  int w,h,n,x,y,i,j,t;
  while(scanf("%d %d %d",&h,&w,&n),w||h||n){
    int d[1000][1000]={0};
    int p[1000][1000]={0};
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	scanf("%d",&d[i][j]);
      }
    }
    y=0;
    x=0;
    p[y][x]=n;
    for(i=0;i<w+h-1;i++){
      for(j=0;j<h;j++){
	if(i-j<0||w<=i-j)continue;
	int k,l;
	/*for(k=0;k<h;k++){
	  for(l=0;l<w;l++)printf("%d ",p[k][l]);
	  printf("\n");
	  }printf("\n");*/
	if(d[j][i-j]){
	  if(j==y&&i-j==x){
	    if(p[j][i-j]%2)x++;
	    else	         y++;
	    if(x==w||y==h)break;
	  }
	  p[j+1][i-j  ]+=t=p[j][i-j]/2;
	  p[j  ][i-j+1]+=  p[j][i-j]-t;
	}
	else{
	  if(j==y&&i-j==x){
	    if(p[j][i-j]%2)y++;
	    else	         x++;
	    if(x==w||y==h)break;
	  }
	  p[j  ][i-j+1]+=t=p[j][i-j]/2;
	  p[j+1][i-j  ]+=  p[j][i-j]-t;
	}
      }
      if(x==w||y==h)break;
    }
    printf("%d %d\n",y+1,x+1);
  }
  return 0;
}

Measured memory_bytes: 8420
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int n, t = 0;
vector<set<int>> g;
vi d, f;

void dfs(int v) {
  t++;
  d[v] = t;
  for(auto i : g[v])
    if(d[i] == 0) dfs(i);
  t++;
  f[v] = t;
}

int main() {
  cin >> n;
  d = vi(n, 0);
  f = vi(n, 0);
  g = vector<set<int>>(n);
  rep(i, n) {
    int u, k;
    cin >> u >> k;
    rep(j, k) {
      int v;
      cin >> v;
      v--;
      g[i].insert(v);
    }
  }
  rep(i, n) if(d[i] == 0) dfs(i);
  rep(i, n) printf("%d %d %d\n", i + 1, d[i], f[i]);
}


Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
const int P = 13;
const i64 MOD = 1e9 + 7;
int main() {
    string S;
    cin >> S;
    vector<i64> ans[2] = {vector<i64>(P, 0), vector<i64>(P, 0)};
    ans[0][0] = 1;
    for(int i = 0; i < S.size(); i++) {
        ans[1] = vector<i64>(P, 0);
        for(int n = 0; n < 10; n++) {
            if(isdigit(S[i]) && n != S[i] - '0') continue;
            for(int j = 0; j < P; j++) {
                int k =(j * 10 + n) % P; 
                ans[1][k] += ans[0][j];
                ans[1][k] %= MOD;
            }
        }
        swap(ans[0], ans[1]);
    }
    cout << ans[0][5] << endl;
    return 0;
}

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

template <int mod = (int)(1e9 + 7)>
struct ModInt {
  int x;
  constexpr ModInt() : x(0) {}
  constexpr ModInt(int64_t y)
      : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  constexpr ModInt &operator+=(const ModInt &p) noexcept {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt &p) noexcept {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt &p) noexcept {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  constexpr ModInt &operator/=(const ModInt &p) noexcept {
    *this *= p.inverse();
    return *this;
  }
  constexpr ModInt operator-() const { return ModInt(-x); }
  constexpr ModInt operator+(const ModInt &p) const noexcept {
    return ModInt(*this) += p;
  }
  constexpr ModInt operator-(const ModInt &p) const noexcept {
    return ModInt(*this) -= p;
  }
  constexpr ModInt operator*(const ModInt &p) const noexcept {
    return ModInt(*this) *= p;
  }
  constexpr ModInt operator/(const ModInt &p) const noexcept {
    return ModInt(*this) /= p;
  }
  constexpr bool operator==(const ModInt &p) const noexcept { return x == p.x; }
  constexpr bool operator!=(const ModInt &p) const noexcept { return x != p.x; }
  constexpr ModInt inverse() const noexcept {
    int a = x, b = mod, u = 1, v = 0, t = 0;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  constexpr ModInt pow(int64_t n) const {
    ModInt res(1), mul(x);
    while (n) {
      if (n & 1) res *= mul;
      mul *= mul;
      n >>= 1;
    }
    return res;
  }
  friend constexpr ostream &operator<<(ostream &os, const ModInt &p) noexcept {
    return os << p.x;
  }
  friend constexpr istream &operator>>(istream &is, ModInt &a) noexcept {
    int64_t t = 0;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  constexpr int get_mod() { return mod; }
};

long long n, k;
vector<ModInt<>> cnt;

ModInt<> solve();

int main() {
  cin >> n >> k;
  cout << solve() << endl;
  return 0;
}

ModInt<> solve() {
  ModInt<> res = 0;
  cnt.assign(k + 1, 0);
  for (long long i = k; i >= 1; --i) {
    cnt[i] = k / i;
    cnt[i] = cnt[i].pow(n);
    for (long long j = 2; i * j <= k; ++j) cnt[i] -= cnt[i * j];
    res += cnt[i] * i;
  }
  return res;
}

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

int main(void){
  
  int a;
  int b;
  int c;
  int d;
  
  scanf("%d %d %d %d",&a,&b,&c,&d);
  
  
  if(abs(c - a) <= d ){
    puts("Yes");
  }
  else if(abs(b - a) <= d && abs(c - b) <= d){
    puts("Yes");
  }
  else{
    puts ("No");
  }
  
  return 0;
}
  


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

#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)x.size())
template <class T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> using V = vector<T>;
using P = pair<int, int>;

/*
 *  *  */

int n, m;
V<int> es[101010];
int dp[101010];
int ans[101010];

void dfs(int v, int p){
  dp[v] = 1;
  for(int to : es[v]){
    if(to == p) continue;
    dfs(to, v);
    dp[v] *= dp[to]+1;
    dp[v] %= m;
  }
}

void dfs2(int v, int p, int pd){
  int k = sz(es[v]);
  V<int> lr(k+1, 1), rl(k+1, 1);
  int res = 1;
  rep(i, 0, k){
    int to = es[v][i];
    if(to == p){
      (res *= pd+1) %= m;
      lr[i+1] = pd+1;
      rl[i] = pd+1;
    }else{
      (res *= dp[to]+1) %= m;
      lr[i+1] = dp[to]+1;
      rl[i] = dp[to]+1;
    }
  }

  ans[v] = res;
  rep(i, 0, k) (lr[i+1] *= lr[i]) %= m;
  rep(i, 0, k) (rl[k-i-1] *= rl[k-i]) %= m;

  rep(i, 0, k){
    int to = es[v][i];
    if(to == p) continue;
    dfs2(to, v, lr[i]*rl[i+1]%m);
  }
}

signed main() {
  cin >> n >> m;
  rep(i, 0, n-1){
    int x, y;
    cin >> x >> y;
    x--; y--;
    es[x].emplace_back(y);
    es[y].emplace_back(x);
  }

  dfs(0, -1);
  dfs2(0, -1, 0);
  rep(i, 0, n) 
    cout << ans[i] << endl;

  return 0;
}


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

string s;
int a[26];

int main()
{
	cin>>s;
	int l=s.length();
	for(int i=0;i<l;i++) a[s[i]-'a']=1;
	for(int i=0;i<26;i++)
		if(a[i]==0) { cout<<(char)(i+'a')<<endl; return 0; }
	cout<<"None"<<endl;
	return 0;
}

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

int main() {
  int64_t a, b, c;
  cin >> a >> b >> c;
  int64_t l, r;
  l = 4 * a * b;
  r = (c - a - b) * (c - a - b);
  if (l < r && (c - a - b) > 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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


Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001
 
 
int main() {
    int N; cin >> N;
 
    map<int, int> M;
    bool z = true;
    for(int i=0; i<N; i++){
        int a; cin >> a;
        if(a!=0) z = false;
        M[a]++;
    }
    
    if(z){
        cout << "Yes" << endl;
        return 0;
    }
    
    if(N%3!=0){
        cout << "No" << endl;
        return 0;
    }
    
    
    if(M.size()==2){
        vector<PII> V;
        for(auto m:M){
            V.push_back({m.fs, m.sc});
        }
        
        bool z = false;
        int zidx = 0;
        for(int i=0; i<2; i++){
            if(V[i].fs==0){
                z = true;
                zidx = i;
            }
        }
        if(!z){
            cout << "No" << endl;
            return 0;
        }
        
        if(V[zidx].sc*2==V[zidx^1].sc){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
        
        return 0;
    }
    
    
    
    
    if(M.size()!=3){
        cout << "No" << endl;
        return 0;
    }
    
    vector<int> V;
    for(auto m:M){
        V.push_back(m.fs);
        if(m.sc*3 != N){
            cout << "No" << endl;
            return 0;
        }
    }
    
    if((V[0]^V[1])==V[2]){
        cout << "Yes" << endl;
        return 0;
    }
    
    cout << "No" << endl;
    return 0;
}

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

int main(){
    int n, ans=0; cin >> n;
    vector<int> v(n), c(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    for(int i = 0; i < n; i++){
        cin >> c[i];
        if(v[i] > c[i]) ans += v[i] - c[i];
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
	int n;
	cin>>n;
	vector<int> c(n,0),s(n,0),f(n,0);
	for(int i=0;i<n-1;i++){
		cin>>c[i]>>s[i]>>f[i];
	}
	for(int st=0;st<n;st++){
		int t=0;
		for(int cur=st;cur<n-1;cur++){
			if(t<s[cur]){
				t=s[cur];
			}else{
				t=s[cur] + f[cur]* ceil((double)(t-s[cur])/f[cur]);
			}
			t+=c[cur];
		}
		cout<<t<<endl;
	}
	return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<string> split_naive(const string &s, char delim) {
	vector<string> elems;
	string item;
	for(char ch:s){
		if(ch==delim){
			if(!item.empty()) elems.push_back(item);
			item.clear();
		}
		else{
			item += ch;
		}
	}
	if(!item.empty()) elems.push_back(item);
	return elems;
}

int main(){
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	
	string S;
	while(cin>>S){
		auto SS = split_naive(S,',');
		vector<int> L(10);
		for(int i=0;i<10;i++){
			sscanf(SS[i].c_str(),"%d",&L[i]);
		}
		int V1,V2;
		sscanf(SS[10].c_str(),"%d",&V1);
		sscanf(SS[11].c_str(),"%d",&V2);

		double SL = accumulate(ALL(L),0);
		double x = (SL*V1)/(V1+V2);
		int TL = 0;
		REP(i,10){
			if(TL+L[i]>=x){
				out(i+1);
				break;
			}
			TL+=L[i];
		}
	}
	return 0;
}


Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int N; cin >> N;
    vector<vector<float>> v(N,vector<float> (2)); 
    for(int i=0;i<N;i++) cin >> v[i][0] >> v[i][1];
    float ans = 0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            ans += sqrt(pow(v[i][0]-v[j][0], 2) + pow(v[i][1]-v[j][1], 2));
        }
    }
    cout << fixed << setprecision(10) << ans*2/N << endl;
}




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

int main()
{
	int N;
	vector<long long> A,B;
	cin >> N;
	A.resize(N);
	B.resize(N);
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	B[0] = A[0];
	for(int i=1;i<N;i++){
		B[i] = B[i-1] + A[i];
	}

	int ans = 1;
	for(int i=N-2; i>=0; i--){
		if(2*B[i] < A[i+1])
			break;
		ans++;
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double N=sc.nextDouble();
		double money=100;
		double count=0;
		while(money<(double)N) {
			money=money*1.01;
			count++;
			money=Math.floor(money);
		}
		System.out.println((int)count);
		sc.close();
	}
}


Measured memory_bytes: 37460
#include <iostream>
using namespace std;
int f(int x){
    int p=0;
    while(x){
        p+=x%10;
        x/=10;
    }
    return p;
}
int main(void){
    int n,a,b;
    int ans=0;
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++){
        if(f(i)>=a && f(i)<=b){
            ans+=i;
            //cout<<f(i)<<i<<endl;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int L = sc.nextInt();
    String[] s = new String[N];
    for (int i = 0; i < N; i++) {
      s[i] = sc.next();
    }
    Arrays.sort(s);
    String result = "";
    for (int i = 0; i < N; i++) {
      result += s[i];
    }
    System.out.println(result);
  }
}

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

int main(){

	int n,a[10000][3];

	cin>>n;

	for(int i=1;i<=n;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}

	for(int i=1;i<=n;i++){
		if(a[i][0]*a[i][0]==a[i][1]*a[i][1]+a[i][2]*a[i][2] || a[i][1]*a[i][1]==a[i][0]*a[i][0]+a[i][2]*a[i][2] || a[i][2]*a[i][2]==a[i][1]*a[i][1]+a[i][0]*a[i][0]){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1168
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

//https://qiita.com/keymoon/items/11fac5627672a6d6a9f6から

class Rollinghash{
    ll MASK30 = (1UL << 30) - 1;
    ll MASK31 = (1UL << 31) - 1;
    ll MD = (1UL << 61) - 1;
    ll MASK61 = MD;

    //a*b mod 2^61-1を返す関数(最後にModを取る)
    ll Mul(ll a, ll b){
        ll au = a >> 31;
        ll ad = a & MASK31;
        ll bu = b >> 31;
        ll bd = b & MASK31;
        ll mid = ad * bu + au * bd;
        ll midu = mid >> 30;
        ll midd = mid & MASK30;
        return CalcMod(au * bu * 2 + midu + (midd << 31) + ad * bd);
    }

    //mod 2^61-1を計算する関数
    ll CalcMod(ll x)
    {
        ll xu = x >> 61;
        ll xd = x & MASK61;
        ll res = xu + xd;
        if (res >= MD) res -= MD;
        return res;
    }
    ll base_(){
        mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
        uniform_int_distribution<ll> rand(2,MD-2);
        return rand(mt);
    }

    ll base/*=base_()*/=MOD;

    vl hash,power;

public:
    Rollinghash(vl &s){
        ll n=s.size();
        hash.assign(n+1,0);
        power.assign(n+1,1);
        rep(i,n){
            power[i+1]=Mul(power[i],base)%MD;
            hash[i+1]=(Mul(hash[i],base)+s[i])%MD;
        }
    }
    ll get(int l,int r){
        return (hash[r]+MD-Mul(hash[l],power[r-l])%MD)%MD;
    }
    int LCP(int l0,int r0,int l1,int r1){
        int ok=0,ng=min(r0-l0,r1-l1);
        while(abs(ok-ng)>1){
            int rh_mid=(ok+ng)/2;
            if(get(l0,l0+rh_mid)==get(l1,l1+rh_mid)) ok=rh_mid;
            else ng=rh_mid;
        }
        return ok;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N;
    cin >> N;
    vl A(N),B(N);
    rep(i,N){
        cin >> A[i];
    }
    rep(i,N){
        cin >> B[i];
    }
    vl C(2*N),D(N);
    rep(i,N){
        C[i]=C[N+i]=A[i]^A[(i+1)%N];
        D[i]=B[i]^B[(i+1)%N];
    }
    Rollinghash rh0(C);
    Rollinghash rh1(D);
    rep(K,N){
        if(rh0.get(K,K+N)==rh1.get(0,N)){
            cout << K << ' ' << (A[K]^B[0]) << endl;
        }
    }
}

Measured memory_bytes: 20884
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using static System.Math;
using Debug = System.Diagnostics.Debug;

class P
{
    static void Main()
    {
        var HWhw = Console.ReadLine().Split().Select(int.Parse).ToList();
        if (HWhw[0] % HWhw[2] == 0 && HWhw[1] % HWhw[3] == 0)
        {
            Console.WriteLine("No");
            return;
        }
        Console.WriteLine("Yes");
        Console.WriteLine(string.Join("\n", Enumerable.Repeat(0, HWhw[0]).Select((_, indh) => string.Join(" ", Enumerable.Repeat(0, HWhw[1]).Select((__, indw) => indh % HWhw[2] == 0 && indw % HWhw[3] == 0 ? 999999999 : (indh + 1) % HWhw[2] == 0 && (indw + 1) % HWhw[3] == 0 ? -1000000000 : 0)))));
    }
}



Measured memory_bytes: 46284
////////////////////////////////////
///     Please Give Me AC!!!     ///
////////////////////////////////////

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define forin(in) for(int i=0; i<(int)in.size(); i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

int main(){
    int N;
    cin>> N;
    vector<int> A(N);
    forin(A);
    sort(A.rbegin(), A.rend());

    ll ans = A[0];
    for(int i = 2; i < N; i++) ans += A[i/2];

    cout<< ans << endl;
}

Measured memory_bytes: 4024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for(int i = 0; i < n; ++i)
#define INF (2e9)

int main() {
  ll n; cin >> n;
  ll cnt[10][10];

  for(int i = 0; i <= 9; ++i) {
    for(int j = 0; j <= 9; ++j) {
      cnt[i][j] = 0;
    }
  }

  for(int k = 1; k <= n; ++k) {
    string strk = to_string(k);
    cnt[strk[0]-'0'][strk[strk.length()-1]-'0']++;
  }
  
  ll ans = 0;
  for(int i = 0; i <= 9; ++i) {
    for(int j = 0; j <= 9; ++j) {
      ans += cnt[i][j] * cnt[j][i];
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
#!/usr/bin/perl

my $s = <STDIN>;
$s =~ s/[\x00-\x20]+$//ios;

my $res = 'Yes';
while(length($s)>1){
  if( length($s)>=2 and substr($s,0,2) eq 'hi' ){
    substr($s,0,2) = '';
  } else {
    $res = 'No';
    last;
  }
}
$res = 'No' if length($s)>0;
print "$res\n";
exit(0);


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

using namespace std;

typedef long long ll;

const ll MAX = 100010;

signed main()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(m);
    vector<ll> d(m);

    vector<ll> ne_comp;

    for(ll i = 0; i < n; ++i){
        cin >> a[i] >> b[i];
        ne_comp.emplace_back(a[i]);
    }
    for(ll i = 0; i < m; ++i){
        cin >> c[i] >> d[i];
        ne_comp.emplace_back(c[i]);
    }

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

    ne_comp.erase(unique(ne_comp.begin(), ne_comp.end()), ne_comp.end());

    auto ne = [&](ll x){
        return distance(ne_comp.begin(), lower_bound(ne_comp.begin(), ne_comp.end(), x));
    };
    ll t = ne_comp.size();

    vector<ll> rui_bound(t + 1, 1e9);

    for(ll i = 0; i < m; ++i){
        ll ind = ne(c[i]);
        rui_bound[ind] = min(rui_bound[ind], d[i]);
    }

    for(ll i = 0; i <= t; ++i){
        rui_bound[i + 1] = min(rui_bound[i], rui_bound[i + 1]);
    }

    vector<vector<ll>> p(t);
    for(ll i = 0; i < n; ++i){
        ll ind = ne(a[i]);
        p[ind].push_back(b[i]);
    }

    multiset<ll> s;
    ll ret = 0;
    ll ans = 0;
    for(ll i = t - 1; i >= 0; --i){
        for(auto& x : p[i]){
            ans += x;
            s.insert(x);
        }
        while(s.size() >= rui_bound[i]){
            ans -= *s.begin();
            s.erase(s.begin());
        }

        ret = max(ret, ans);
    }
    cout << ret << endl;


}



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

public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        int n = Integer.parseInt(br.readLine());
        String s = br.readLine();
        int ans = 0;
        
        out.println(n >= 3200 ? s : "red");
        out.close();
        
    }
}

Measured memory_bytes: 32692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int N;
    cin >> N;
    if(N == 1){
        cout << "Hello World" << endl;
    }else{
        int A,B;
        cin >> A >> B;
        cout << A+B << endl;
    }
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
public static void main(String args[]) {
	int x;
	int j;
	int key;
	Scanner num = new Scanner(System.in);
	x = num.nextInt();
	int a[] = new int[x];
	for (int i=0;i<a.length;i++) {
		a[i]=num.nextInt();
	}
	
	for(int k=0;k<a.length;k++) {
		if(k<a.length-1)
			System.out.printf(a[k]+" ");
		else
			System.out.printf(a[k]+"\n");
	}
    
	for(int i=1;i<a.length;i++) {
		key = a[i];
		j = i - 1;
		while (a[j]>key && j>=0) {
			a[j+1]=a[j];
			j--;
			if (j<0) {
				break;
			}
		}
		a[j+1]= key;
		for(int k=0;k<a.length;k++) {
			if(k<a.length-1)
				System.out.printf(a[k]+" ");
			else
				System.out.printf(a[k]+"");
		}
		System.out.println("");
	}
}
}

Measured memory_bytes: 36900
#include <stdio.h>

int main()
{

    long int n,i,a,b,c ;
    scanf("%ld", &n);

    for(i=1; i<=n; i++)
    {
        scanf("%ld %ld %ld", &a, &b ,&c);
        if(((a*a)==((b*b)+(c*c))) || ((b*b)==((a*a)+(c*c))) || ((c*c)==((b*b)+(a*a))) )
        {
            printf("YES\n");
        }
        else
        {
            printf("NO\n");
        }

    }
    return 0;
}

Measured memory_bytes: 580
use v6;

my ($a, $b, $c) = get().chomp.split(' ');
if (($a != $b) and ($a != $c) and ($b != $c)) {
	say "3";
} elsif (($a == $b) and ($b == $c)) {
	say "1";
} else {
	say "2";
}

exit;

Measured memory_bytes: 53144
/*
[ ( ^ _ ^ ) ]
*/
// problem: atc/abc172/B
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000000

const int nax = 2000'10;
char in[nax];

string reads() {
    scanf("%s", in);
    return string(in);
}


int main() {
    string s = reads();
    string t = reads();
    int rs = 0;
    for(int i=0; i<(int)size(s); i++) {
        rs += s[i] != t[i];
    }
    printf("%d\n", rs);
}


Measured memory_bytes: 4088
x,y = map(int,input().split())

list1 = {1,3,5,7,8,10,12}
list2 = {4,6,9,11}
list3 = {2}
result = "No"

set_list = [list1,list2,list3]
for data in set_list:
    if x in data:
        if y in data:
            result = "Yes"

print(result)


Measured memory_bytes: 3060
#include <stdio.h>

#define LIM 1000000000000000000

long long int arr[100000];

int main(void) {
	int n;
	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%lld", &arr[i]);
		if (arr[i] == 0) {
			puts("0");
			return 0;
		}
	}

	long long int p = 1;
	for (int i = 0; i < n; i++) {
		if (p > LIM/arr[i]) {
			puts("-1");
			return 0;
		}
		p *= arr[i];
	}
	printf("%lld\n", p);
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


int main() {
    string s; cin >> s;
    int ans = 0;
    if(s=="SUN") {
        ans = 7;
    } else if(s=="MON") {
        ans = 6;
    }else if(s=="TUE") {
        ans = 5;
    }else if(s=="WED") {
        ans = 4;
    }else if(s=="THU") {
        ans = 3;
    }else if(s=="FRI") {
        ans = 2;
    }else if(s=="SAT") {
        ans = 1;
    }


    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
#define ll long long
ll n,i,j,ans1=0,ans2=0;
ll a[200005],b[200005];
int main()
{
	cin>>n;
	for (i=1;i<=n;i++)
	{
		cin>>a[i];
		b[i]=a[i];
	}
    sort(b+1,b+n+1);
    ans1=b[n];
    ans2=b[n-1];
	for (i=1;i<=n;i++)
	{
		if(a[i]!=ans1) cout<<ans1<<endl;
		else cout<<ans2<<endl;
	}
	return 0;
}

Measured memory_bytes: 4736
n = int(input())
ls = [list(map(int,input().split())) for _ in range(n-1)]
def culc(nt,p):
    if nt == 0:
        if p != n-1:
            nt = ls[p][1] + ls[p][0]
            culc(nt,p+1)
        else:
            print(0)
    else:
        if p != n-1:
            if nt >= ls[p][1]:
                m = (nt - ls[p][1])//ls[p][2]
                if (nt - ls[p][1])%ls[p][2] != 0:
                    m += 1
                nt = ls[p][1] + ls[p][2]*m + ls[p][0]
                culc(nt,p+1)
            else:
                nt = ls[p][1] + ls[p][0]
                culc(nt,p+1)
        else:
            print(nt)
for i in range(n):
    culc(0,i)



Measured memory_bytes: 76188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 1e9+7

int main() {
    ld L;
    cin >> L;
  
    cout << setprecision(20) << ((L * L * L)/27)  << endl;

    return 0;
}


Measured memory_bytes: 384
#-*-coding:utf-8-*-

import math

def calculate_length(A,B,rad):
    length=(A**2)+(B**2)-(2*A*B*math.cos(math.pi*rad/180))
    return  math.sqrt(length)

def main():
    A,B,H,M = map(int,input().split())
    rad = abs((H*60+M)*0.5-M*6)
    length=calculate_length(A,B,rad)
    print(length)

if __name__=="__main__":
    main()

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

#define ll long long
#define d long double

#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define dscf(n) scanf("%Lf",&n)
#define pri(n) printf("%d ",(int)n)
#define lpri(n) printf("%lld ",n)
#define dpri(n) printf("%Lf ",n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define dprin(n) printf("%Lf\n",n)

#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define all(x) x.begin(),x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define bitcount(n) __builtin_popcount(n)
#define tc   int tt; scf(tt); while(tt--)
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PI 3.14159265358979323846264

const ll M =1e9+7;
const int N = 1e6+7;

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

bool visited[2001][2001];

int n,m,sx,sy,ex,ey;

char a[2001][2001];

int magic[2001][2001];

bool isvalid(int x,int y)
{
    if(x<1||y<1||x>n||y>m||a[x][y]=='#')
    return false;
    return true;
}
int dxx[]={-2,-2,-2,-2,-2,-1,-1,-1,-1,0,0,1,1,1,1,2,2,2,2,2};
int dyy[]={-2,-1,0,1,2,-2,-1,1,2,-2,2,-2,-1,1,2,-2,-1,0,1,2};
int main()
{
    scf(n);scf(m);
    scf(sx);scf(sy);
    scf(ex);scf(ey);

    rep(i,1,n+1)
    {
        rep(j,1,m+1)
        cin>>a[i][j];
    }
    
    rep(i,0,2001)
    rep(j,0,2001)
    magic[i][j]=inf;

    deque<pair<int,int>>q;
    q.push_back({sx,sy});
    visited[sx][sy]=true;
    magic[sx][sy]=0;

    while(!q.empty())
    {
        int x=q.front().F;
        int y=q.front().S;
      //  cout<<x<<" "<<y<<endl;
        q.pop_front();
        rep(i,0,4)
        {
            if(isvalid(x+dx[i],y+dy[i]))
            {   
               if(magic[x+dx[i]][y+dy[i]]>magic[x][y])
               {
                   q.push_front({x+dx[i],y+dy[i]});
                   magic[x+dx[i]][y+dy[i]]=magic[x][y];
               }
                
            }
        }
        rep(i,0,20)
        {
            if(isvalid(x+dxx[i],y+dyy[i]))
            {   
              if(magic[x+dxx[i]][y+dyy[i]]>magic[x][y]+1)
              {
                  q.push_back({x+dxx[i],y+dyy[i]});
                  magic[x+dxx[i]][y+dyy[i]]=magic[x][y]+1;
              }
            }
        }
    }

    if(magic[ex][ey]==inf)
    cout<<"-1";
    else
    {
        cout<<magic[ex][ey];
    }
    
return 0;
}

Measured memory_bytes: 21276
#include<bits/stdc++.h>
using namespace std;
int x,y,A,B,C,a[100001],b[100001],c[100001],ans[300001],cnt;
long long res;
bool cmp(int x,int y){return x>y;}
int main()
{
	scanf("%d%d%d%d%d",&x,&y,&A,&B,&C);
	for(int i=1;i<=A;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=B;i++)
		scanf("%d",&b[i]);
	for(int i=1;i<=C;i++)
		scanf("%d",&c[i]);
	sort(a+1,a+A+1);
	sort(b+1,b+B+1);
	sort(c+1,c+C+1);
	for(int i=1;i<=x;i++)
		ans[++cnt]=a[A-i+1];
	for(int i=1;i<=y;i++)
		ans[++cnt]=b[B-i+1];
	for(int i=1;i<=C;i++)
		ans[++cnt]=c[i];
	sort(ans+1,ans+cnt+1,cmp);
	for(int i=1;i<=x+y;i++)
		res=res+ans[i];
	printf("%lld",res);
	return 0;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n,d,a; cin >> n >> d >> a;

  set<P<int,int>> st;
  for(int i = 0; i < n; ++i){
    int x,h; cin >> x >> h;
    st.insert({x,h});
  }
  vector<int> x(n), h(n);
  {
    int i = 0;
    for(auto&e : st)tie(x[i], h[i]) = e, i++;
  }

  ll total = 0;
  ll ans = 0;
  vector<ll> pos(n,n);
  {
    int l=0,r=0;
    while(l < n){
      while(r < n && x[r] - x[l] <= 2*d) r++;
      pos[l] = min<ll>(pos[l],r);
      l++;
    }
  }
  vector<ll> hp(n+1);
  for(int i = 0; i < n; ++i){
    total -= hp[i];
    h[i] -= total;
    ChangeMax(h[i],0);
    ll c = (h[i]+a-1)/a;
    ans += c;
    total += c*a;
    hp[pos[i]] += c*a;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll  = long long;
using v   = vector<int>;
using P   = pair<int,int>;
using vp  = vector<P>;
using vvp = vector<vp>;

int main(){
    int n;
    string s;
    cin>>n>>s;
    
    ll r=0,g=0,b=0;
    
    rep(i,n){
        if(s[i]=='R')r++;
        else if(s[i]=='G')g++;
        else b++;
    }
    
    ll del = 0;
    
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(j+(j-i)>=n)continue;
            if(s[i]==s[j])continue;
            if(s[j]==s[j+j-i])continue;
            if(s[i]==s[j+j-i])continue;
            del++;
        }
    }
    
    cout << r*g*b - del << endl;
    
    return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,W;
    cin >> n >> W;
    vector<ll> v(n);
    vector<ll> w(n);
    for(i = 0;i < n;++i){
        cin >> v.at(i) >> w.at(i);
    }
    
    vector<vector<ll>> dp(n+1,vector<ll>(W+1,0));
    for(i = 1;i <= n;++i){
        rep(j, W+1){
            if(j < w.at(i-1)) dp.at(i).at(j) = dp.at(i-1).at(j);
            else dp.at(i).at(j) = max(dp.at(i-1).at(j), dp.at(i-1).at(j - w.at(i-1)) + v.at(i-1));
        }
    }
    
    cout << dp.at(n).at(W) << endl;
    return 0;
}


Measured memory_bytes: 10808
#include<iostream>
using namespace std;
#define int long long int
int32_t main()
{
	int a,v,b,w;
	cin>>a>>v>>b>>w;
	if(a>b)
	{
		int temp=a;
		a=b;
		b=temp;
	}
	int dis=b-a;
	int t;
	cin>>t;
	int tr=t*v-t*w;
	if(tr>=dis)
	{
		cout<<"YES"<<endl;
	}
	else
	   cout<<"NO"<<endl;
}


Measured memory_bytes: 3632
@memo = {}

def try(n)
  return @memo[n] if @memo[n]
  return 0 if n == 1
  co = if n.even?
    try(n / 2)
  else
    try(n * 3 + 1)
  end
  @memo[n] = co + 1
end

until (n = $<.gets.to_i).zero?
  puts try(n)
end


Measured memory_bytes: 6880
n = int(input())
A = [list(map(int,input().split())) for _ in range(n)]
dp = [0]*(1<<n)
dp[0] = 1
mod = 10**9+7
for i in range(1,1<<n):
    cnt = 0
    for j in range(n+1): cnt += (i>>j)&1
    for j in range(n):
        if (i>>j)&1==0: continue
        dp[i] +=dp[i-(1<<j)]*A[cnt-1][j]
        dp[i] %=mod
print(dp[-1]%mod)

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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	int a;
	int b;
	cin >> a >> b;

	int tb = b;
	int tmp = 10;
	while (true) {
		if (tb < 10) {
			break;
		}
		tb /= 10;
		tmp *= 10;
	}
	int num = a * tmp + b;
//	cout << num << "\n";

	if (num == (int(sqrt(num))*int(sqrt(num)))) {
		cout << "Yes" << "\n";
	} else {
		cout << "No" << "\n";
	}


}


Measured memory_bytes: 256
#include <iostream>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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;
}


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

	ll n;
	cin >> n;
	Array d(n, 0);
	REP(i, n) cin >> d[i];

	ll ans = 0;
	REP(i, n) {
		REP(j, n) {
			if (i != j) {
				ans += d[i] * d[j];
			}
		}
	}

	cout << ans/2 << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = [input() for _ in range(n)]
s.sort()

count = {}
for s_i in s:
    if not s_i in count:
        count[s_i] = 0
    count[s_i] += 1
res = sorted(zip(count.keys(), count.values()),
             key=lambda x: x[1], reverse=True)

num = res[0][1]
res2 = []
for res_i in res:
    if res_i[1] != num:
        break
    res2.append(res_i[0])

res2.sort()
for res2_i in res2:
    print(res2_i)


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
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; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end

vector<int> x,y;
bool cmp(int a,int b){
    return atan2(y[a],x[a])<atan2(y[b],x[b]);
}

int main(){
    int n; scanf("%d",&n);
    x.resize(n); y.resize(n);
    rep(i,0,n)scanf("%d%d",&x[i],&y[i]);
    vector<int> point(n); iota(ALL(point),0);
    sort(ALL(point),cmp);
    ll ans=0;
    rep(i,0,n){
        int xs=0,ys=0;
        rep(j,0,n){
            xs+=x[point[(i+j)%n]]; ys+=y[point[(i+j)%n]];
            chmax(ans,1LL*xs*xs+1LL*ys*ys);
        }
    }
    printf("%.12f\n",sqrt(ans));
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    string a;
    bool v[2]={0};
    cin>>a;
    for(int i=0;i<a.length();i++){
        if(a[i]=='C') v[0]=1;
        if(a[i]=='F'&&v[0])  v[1]=1;
    }
    if(v[1]) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
def main():
  s = input().rstrip('\n')
  n = len(s)
  dp = [0] * (1 + n)
  for i,c in enumerate(s):
    if c == '<':
      dp[i+1] = dp[i] + 1
  for i in range(n-1, -1, -1):
    if s[i] == '>':
      dp[i] = max(dp[i], dp[i+1] + 1)
  return sum(dp)

print(main())

Measured memory_bytes: 46536
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = Long.parseLong(sc.next());
		long B = Long.parseLong(sc.next());
		long N = Long.parseLong(sc.next());
		sc.close();


		long max = 0;
		long loop = N / B;

		if(B > N) {
			long s = (A * N) /B;
			long t = N / B;
			long tmp = s - A * t;
			if(max < tmp) {
				max = tmp;
			}
		}else {
				long maxX = B * 2 - 1;
				long s = (A * maxX) / B;
				long t = maxX / B;
				long tmp = s - (A * t);
				if(max < tmp) {
					max = tmp;
				}
			}
		System.out.println(max);
		}
}

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

int main(void){
    double N, count = 0, result;
    
    cin >> N;
    
    rep(i, N){
        if((i + 1) % 2 == 1){
            count++;
        }
    }
    
    result = count / N;
    
    printf("%.7lf", result);
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
using namespace std;
int main(){
    string str1,str2,str3;
    int count,n;
    cin>>str1;
    while(1){
        str3="";
        cin>>str2;
        if(str2=="END_OF_TEXT"){
            break;
        }
        n=str2.size();
        for(int i=0;i<n;i++){
            str3+=tolower(str2[i]);
        }
        if(str3==str1){
            count++;
        }
    }
    cout<<count<<endl;
return 0;
}


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

typedef long long int llint;

int main()
{
  bool fur[100001];
  int x = sqrt(100000) + 1;
  memset(fur, true, sizeof(fur));
  fur[0] = fur[1] = false;
  
  for(int i = 2; i <= x; i++) {
    if(fur[i]) for(int j = i * 2; j <= 100000; j += i) fur[j] = false;
  }

  int sflg[100001] = {};
  for(int i = 0; i <= 100000; i++) {
    if(i % 2 == 1 && fur[i] && fur[(i + 1) / 2]) sflg[i] = 1;
  }

  for(int i = 1; i <= 100000; i++) sflg[i] += sflg[i - 1];

  int n;
  cin>> n;
  
  int l, r;
  for(int i = 0; i < n; i++) {
    cin>> l >> r;
    cout<< sflg[r] - sflg[l - 1] <<endl;
  }

  return 0;
}


Measured memory_bytes: 1152
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long a = long.Parse(input[0]);
		long b = long.Parse(input[1]);
    long x = 1;
    long y = 1;
    extGcd(a, b, ref x, ref y);
		Console.WriteLine(x + " " + y);//WriteLineをWriteとすると、改行なしで出力。
	}

  static long extGcd(long a, long b, ref long x, ref long y)
  {
    long answer = a;
    if(b == 0)
    {
      x = 1;
      y = 0;
    }else
    {
      answer = extGcd(b, a%b, ref y, ref x);
      y -= a/b*x;
    }
    return answer;
  }
  
}


Measured memory_bytes: 17980
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    double eps = 1e-10;
    double a, b, c, d, e, f, g, h;
    while(cin >> a >> b >> c >> d >> e >> f >> g >> h){
        double l1 = max(a, e), l2 = max(b, f);
        double r1 = min(c, g), r2 = min(d, h);
        if(l1 <= r1+eps && l2 <= r2+eps) puts("YES");
        else puts("NO");
    }
    return 0;
}


Measured memory_bytes: 3080
using System;

namespace AtCoderABC129C2
{
    class Program
    {
        static void Main(string[] args)
        {
            int MOD = 1000000007;

            string[] s = Console.ReadLine().Split(' ');

            int N = int.Parse(s[0]);
            int M = int.Parse(s[1]);

            int[] X = new int[N + 1];

            X[0] = 1;
            X[1] = 1;

            int[] A = new int[M+1];

            for(int i=0;i<M;i++)
            {
                A[i] = int.Parse(Console.ReadLine());
            }

            A[M] = 0;

            int counter = 0;

            if(A[counter] == 1)
            {
                X[1] = 0;
                counter++;
            }

            for (int i = 2; i < N+1; i++)
            {
                if(i == A[counter])
                {
                    X[i] = 0;
                    counter++;
                }
                else
                {
                    X[i] = (X[i - 1] + X[i - 2]) % MOD;
                }
            }

            Console.WriteLine(X[N].ToString());
        }
    }
}


Measured memory_bytes: 13536
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
def aux(n, x)
  count=0
  for i in 3..n
    for j in 2..(i-1)
      for k in 1..(j-1)
        if i+j+k == x
          count += 1
          #puts "i: #{i}, j: #{j}, k: #{k} count=#{count}"
        end
      end
    end
  end

  count
end

def main
  dat=[]
  fh=STDIN
  #fh=File.new("x.txt", "r")
  while fh.gets
    l=$_.chomp.split.map {|x| x.to_i}
    break if l[0]==0 and l[1]==0
    #puts "l0: #{l[0]}, l1: #{l[1]}"
    dat.push(l)
  end

  dat.each { |x|
    puts aux(x[0],x[1]);
  }
end

if $0 == __FILE__ then
  main
end


Measured memory_bytes: 6880
#include <iostream>
#include <cstring>
#include <fstream>
#include <string>
#include <cmath>
using namespace std;
int main()
{
    int a[100]={0};
    int n,k;
    cin>>n>>k;
    for(int i =0;i<k;i++)
    {
        int h;
        cin>>h;
        for(int j =0;j<h;j++)
        {
            int v;
            cin>>v;
            a[v]=1;
        }
    }
    int all =0;
    for(int i =1 ; i<n+1;i++)
    {
        if(a[i]==1)
            all++;
    }
    cout<<n-all;
}

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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define P pair<int, int>
struct data{
	int place;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
};
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};



int main(){
	string s;
	cin >> s;
	int ans = inf;
	for(int i = 0; i < (int)s.size()-2; i++){
		int num = stoi(s.substr(i, 3), nullptr, 10);
		// cout << num << endl;
		ans = min(ans, abs(753-num));
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
	int n, x; cin >> n >> x;
	int oldc, can; cin >> oldc >> can;
	long long ans = 0;
	if(oldc + can > x){
		ans += oldc + can - x;
		can -= oldc + can - x;
		if(can < 0) can = 0;
	}
	oldc = can;
	for(int i = 0; i < n - 2; ++i){
		cin >> can;
		if(oldc + can > x){
			ans += oldc + can - x;
			can -= oldc + can - x;
			if(can < 0) can = 0;
		}
		oldc = can;
	}
	cout << ans << endl;
	return 0;
}

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

string s;
int i;

int main(){
	ios_base::sync_with_stdio(false);

	cin>>s;
	for(i=0;i<s.length();i++){
		if(s[i]=='1')s[i]='9';
		else if(s[i]=='9')s[i]='1';
	}
	cout<<s<<"\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		int line = in.nextInt();
		int line_column = in.nextInt();
		int column = in.nextInt();

		int[][] matrixA = new int[line][line_column];
		int[][] matrixB = new int[line_column][column];

		for(int l = 0; l < line; l++){

			for(int l_c = 0; l_c < line_column; l_c++){

				matrixA[l][l_c] = in.nextInt();

			}
		}

		for(int l_c = 0; l_c < line_column; l_c++){

			for(int c = 0; c < column; c++){

				matrixB[l_c][c] = in.nextInt();

			}
		}

		long[][] ans = new long[line][column];

		for(int l = 0; l < line; l++){

			for(int l_c = 0; l_c < line_column; l_c++){

				for(int c = 0; c < column; c++){

					ans[l][c] += matrixA[l][l_c] * matrixB[l_c][c];

				}
			}
		}

		for(int l = 0; l < line; l++){

			for(int c = 0; c < column - 1; c++){


				System.out.print(ans[l][c] + " ");

			}

			System.out.println(ans[l][column - 1]);

		}
	}
}

Measured memory_bytes: 53532
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include <numeric>
#include<vector>

#define LL long long
#define MOD 1000000007

using namespace std;


/*
LL GCD(LL a, LL b) {
	if (a < b) GCD(b, a);
	LL r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}
*/

int main() {
	int A, B;


	cin >> A >> B;

	if (B%A == 0) {
		cout << A + B << endl;
	}
	else {
		cout << B-A << endl;
	}




}



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


int main() {
  int n;
  cin >> n;
  vector<int> list(n);
  for (int i=0; i<n; i++) cin >> list[i];
  sort(list.begin(),list.end());
  int ans = list[n/2]-list[n/2-1];
  cout << ans <<endl;
}

Measured memory_bytes: 640