akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int a,b,c;
    	a = sc.nextInt();
    	b = sc.nextInt();
    	c = sc.nextInt();
    	
    	if(a<b && b<c){
    		System.out.println("Yes");
    	}else{
    		System.out.println("No");
    	}
    	
    }
}

Measured memory_bytes: 26044
n,m,l = map(int,input().split())
c = [list(map(int,input().split())) for i in range(n)]
p = 'a'
for i in range(2**n):
    x = i
    y = [0] * m
    z = 0
    for j in range(n):
        if x % 2 != 0:
            z += c[j][0]
            for k in range(m):
                y[k] += c[j][k+1]
        x = x // 2
    if min(y) >= l:
        if p != 'a':
            p = min(p,z)
        else:
            p = z
if p != 'a':
    print(p)
else:
    print(-1)

Measured memory_bytes: 9148
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

inline double diff(double a, double b){
    double d = abs(a-b);
    return min(d,360-d);
}

int main(){
    double d1,d2;
    cin >> d1 >> d2;

    double m1 = (d1 + d2) / 2;
    double m2 = (m1 < 180) ? m1 + 180 : m1 - 180;


    if(diff(m1,d1) < diff(m2,d1)){
        cout << Double(m1) << endl;
    }else{
        cout << Double(m2) << endl;
    }
}



Measured memory_bytes: 3268
#include <stdio.h>

void Draw(int h,int w){
	int i,j;
	for(i = 0;i < h;i++){
		if(i % 2 == 0){/*??其??属???*/
			for(j = 0;j < w;j++){
				if(j % 2 == 0){
					printf("#");
				}else{
					printf(".");
				}
			}
		}else{/*?\???属???*/
			for(j = 0;j < w;j++){
				if(j % 2 == 0){
					printf(".");
				}else{
					printf("#");
				}
			}
		}
		printf("\n");
	}

	printf("\n");

	return;
}

int main(void){
	int H,W;

	while(1){
		scanf("%d %d", &H, &W);

		if(H == 0 && W == 0){
			break;
		}else if(H <= 300 && W <= 300){
			Draw( H, W);
		}
	}

	return 0;
}

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

template<class T> T &chmin(T &a,const T &b) { return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b) { return a = max(a,b); }

struct song{
	int r,a,w,t;
};

int dp[2010][4050][2] = {};

signed main(){
	int n;
	cin >> n;
	vector<song> songs;
	for(int i = 0;i < n;i++){
		int r,a,w,t;
		cin >> r >> a >> w >> t;
		songs.push_back({r,a,w,t});
	}
	sort(songs.begin(),songs.end(),[](const song &s1,const song &s2){
		return s1.r + s1.t > s2.r + s2.t;
	});
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= 4020;j++) dp[i][j][0] = dp[i][j][1] = -INF;
	}
	dp[0][4020][0] = 0;
	for(int i = 0;i <= n;i++){
		for(int j = 4020;j >= 1;j--){
			if(i && j - songs[i - 1].r >= 1) chmax(dp[i][min(j - songs[i - 1].r,songs[i - 1].t)][1],dp[i][j][1] + songs[i - 1].w);
			if(i != n && j - songs[i].r >= 1) chmax(dp[i + 1][min(j - songs[i].r,songs[i].t)][1],max(dp[i][j][0],dp[i][j][1]) + songs[i].a);
			if(i != n) chmax(dp[i + 1][j][0],max(dp[i][j][0],dp[i][j][1]));
		}
	}
	int ans = 0;
	for(int i = 1;i <= 4020;i++) chmax(ans,max(dp[n][i][0],dp[n][i][1]));
	cout << ans << endl;
}



Measured memory_bytes: 129916
a, b, k = map(int, input().split())

if k >= a:
  _a = 0
  if k-a >= b:
    _b = 0
  else:
    _b = b-(k-a)
else:
  _a = a - k
  _b = b
     
print('{} {}'.format(_a,_b))

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n,k;cin >> n >> k;
  string s;cin >> s;
  s[k-1] += 32;
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 256
/* [Template].cpp 
Example code to use when starting new code. This particular problem was problem 
977A_Wrong_Subtraction from CodeForces

Compile: g++  -o C.exe C.cpp 
Execute: ./C
*/ 

#include <cstdio>
#include <iostream>
#include <cmath> 
#include <limits> 
#include <iomanip>
#include <cstring> 
#include <bits/stdc++.h>
#include <string>  
using namespace std;

int main() { 	
	int n; 
	unsigned long long 
		sum_squares = 0ULL, 
		a, 
		a2,
		inv_2 = 500000004ULL, 
		mod = 1000000007ULL,
		sum_a = 0ULL,
		result; 
		
	cin >> n; 
	for(int i = 0; i < n; i++) {
		cin >> a; 
		
		// Calculate sum of squares 
		a2 = (a*a) % mod; 
		sum_squares += a2; 
		sum_squares %= mod; 
		
		// Calculate sum of a
		sum_a += a; 
		sum_a %= mod; 
	}
	sum_a *= sum_a; 
	sum_a %= mod; 
	result = (mod + sum_a - sum_squares) % mod; 
	result = (result * inv_2) % mod; 
	
	cout << result << endl; 
	
	return 0; 
} 


Measured memory_bytes: 3644
import math
a,b,x=map(int,input().split())
v=a**2*b
if x>v/2:
  e=v-x
  l=2*e/a**2
  print(math.degrees(math.atan(l/a)))
else:
  l=2*x/(a*b)
  print(math.degrees(math.atan(b/l)))

Measured memory_bytes: 3060
n=int(input())
mod=10**9+7

sos=[]
for i in range(2,n+1):
    for ele in sos:
        if i%ele==0:
            break
    else:
        sos.append(i)
ans=1
for ele in sos:
    cnt=1
    cha=ele
    while n>=cha:
        cnt+=n//cha
        cha*=ele
    ans*=cnt
    ans%=mod
    #print(ele,cnt)

print(ans)

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

int main(){
    string s,t,u;
    cin >>s>>t;
    int a,b;
    cin >>a>>b;
    cin >>u;

    map<string,int> mp;
    mp[s]=a;
    mp[t]=b;
    mp[u]-=1;
    cout << mp[s]<<" "<<mp[t] <<endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ull = unsigned long long;

int main() {
    string S;
    cin >> S;
    cout << S[0] << S.size() - 2 << S[S.size() - 1] << endl;
}


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

#define REP(i, n) for (ll i = 0; i < ll(n); ++i)
#define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < ll(n); ++i)
#define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
#include "bits/stdc++.h"
struct UnionFind {
  std::vector<int> par;
  std::vector<int> sizes;

  UnionFind(int n) {
    par.resize(n);
    sizes.resize(n);
    for (int i = 0; i < n; ++i) {
      par[i] = i;
      sizes[i] = 1;
    }
  }

  int root(int a) { return par[a] == a ? a : par[a] = root(par[a]); }

  bool same(int x, int y) { return root(x) == root(y); }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return;
    if (sizes[x] < sizes[y])
      std::swap(x, y);

    par[y] = x;
    sizes[x] += sizes[y];
  }
  int size(int x) { return sizes[root(x)]; }
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, m, q;
  cin >> n >> m >> q;
  UnionFind uf(n);
  vector<pii> a, b;
  REP(i, q) {
    int u, v;
    cin >> u >> v;
    int c;
    cin >> c;
    if (c == 0) {
      a.emplace_back(u, v);
    }
    else {
      b.emplace_back(u, v);
    }
  }
  REP(i, a.size()) {
    uf.unite(a[i].first, a[i].second);
  }
  bool ok = true;
  REP(i, b.size()) {
    if (uf.same(b[i].first, b[i].second))ok = false;
  }
  ll k;
  {
    set<int> st;
    REP(i, n)st.insert(uf.root(i));
    k = st.size();
  }
  if (m == n - 1) {
    if (b.size() > 0)ok = false;
  }
  else if (n - k + k * (k - 1) / 2 < m)ok = false;
  cout << (ok ? "Yes" : "No") << endl;

}


Measured memory_bytes: 6516
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
string s;
int c_num[2];
int c_pos[2][1000];
string c[2];
c[1]="apple";
c[0]="peach";
getline(cin,s);
for(c_num[0]=0;(c_num[0]<1000)&&((c_pos[0][c_num[0]]=s.find("apple"))!=string::npos);c_num[0]++){
s.replace(c_pos[0][c_num[0]],5,"aaaaa");
}
for(c_num[1]=0;(c_num[1]<1000)&&((c_pos[1][c_num[1]]=s.find("peach"))!=string::npos);c_num[1]++){
s.replace(c_pos[1][c_num[1]],5,"aaaaa");
}
for(int i=0;i<2;i++){
for(int j=0;j<c_num[i];j++){
s.replace(c_pos[i][j],5,c[i]);
}
}
cout<<s<<endl;
}

Measured memory_bytes: 1188
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
class bit{
private:
  vector<int> a;
public:
  bit(int n){
    a.assign(n,0);
  }
  int at(int p){
    int sm=0;
    for(;p;p&=p-1)
      sm+=a[p];
    return sm;
  }
  void update(int p,int q){  
    for(;p<(int)a.size();p+=p&-p)
      a[p]+=q;
  }
};
int main(){
  int i;
  int n;
  cin>>n;
  bit a(100002);
  for(i=0;i<n;++i){
    int p,q;
    cin>>p>>q;
    a.update(p,1);
    a.update(q+1,-1);
  }
  for(i=n+1;a.at(i)+1<i;--i);
  cout<<i-1<<endl;
  return 0;
}

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

int n, a;
const int MAXN = 2e5 + 10;

int cnt[MAXN];

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

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

    for(int i = 1; i <= n; ++i) cout << cnt[i] << "\n";

    return 0;
}


Measured memory_bytes: 4408
#include <iostream>
#include <vector>
using ll = long long;

int main() {
  auto max = [](auto x, auto y) { return (x > y) ? x : y; };
  int N;
  std::cin >> N;
  std::vector<int> h(N+1);
  int maxh{-1};
  for (int i = 0; i < N; i++) {
    std::cin >> h[i];
    maxh = max(maxh, h[i]);
  }
  h[N] = -1;

  int res{0};
  for(int i=1; i<=maxh; ++i){
    int cnt{0};
    bool flag{false};
    for(int j=0; j<=N; j++){
      if(h[j]>=i){
        flag = true;
      } else {
        if(flag){
          flag = false;
          ++cnt;
        }
      }
    }
    res += cnt;
  }
  std::cout << res << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
typedef unsigned long long ll;
int main(){
  ll n,t;
  cin >> n >> t;
  string s;
  cin >> s;
  ll o=0;
  bool f=true;
  while(s.find("n^")!=-1){
    ll x=s.find("n^");
    //cout << x << endl;
    ll k=s[x+2]-'0';
    //cout << k << endl;
    ll j=1;
    for(ll i=0;i<k;i++){
      j*=n;
      if(o+j>1000000000){
        f=false;
        break;
      }
    }
    if(f) o+= j;
    else break;
    //o+=pow(n,k);
    s.replace(x,3,"");
  }
  o*=t;
  //cout << o << endl;
  if(f&&o<=1000000000) cout << o << endl;  
  else cout << "TLE" << endl;
  return 0;
}

Measured memory_bytes: 1216
#include<stdio.h>

int main() {
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	if (a > b || n == 1 && a != b) {
		printf("0");
	}
	else if (n == 1 && a == b)
		printf("1");
	else {
		printf("%lld",(long long) (b - a)*(n - 2) + 1);
	}
	return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(auto i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void visit(const Graph &g, int v, vector< vector<int> >& scc,
    stack<int> &S, vector<bool> &inS,
    vector<int> &low, vector<int> &num, int& time) {
  low[v] = num[v] = ++time;
  S.push(v); inS[v] = true;
  FOR(e, g[v]) {
    int w = e->dst;
    if (num[w] == 0) {
      visit(g, w, scc, S, inS, low, num, time);
      low[v] = min(low[v], low[w]);
    } else if (inS[w])
      low[v] = min(low[v], num[w]);
  }
  if (low[v] == num[v]) {
    scc.push_back(vector<int>());
    while (1) {
      int w = S.top(); S.pop(); inS[w] = false;
      scc.back().push_back(w);
      if (v == w) break;
    }
  }
}
void stronglyConnectedComponents(const Graph& g,
    vector< vector<int> >& scc) {
  const int n = g.size();
  vector<int> num(n), low(n);
  stack<int> S;
  vector<bool> inS(n);
  int time = 0;
  REP(u, n) if (num[u] == 0)
    visit(g, u, scc, S, inS, low, num, time);
}
int main(){
	int N,M;
	cin>>N>>M;
	Graph G;
	for(int i=0;i<N;i++){
		Edges E;
		G.pb(E);
	}
	for(int i=0;i<M;i++){
		int a,b;
		cin>>a>>b;
		G[a].pb(Edge(a,b,1));
	}
	vector<vint> scc;
	stack<int> S;
	vector<bool> inS;
	stronglyConnectedComponents(G,scc);
	
	int group[SIZE]={};
	for(int i=0;i<scc.size();i++)
		for(int j=0;j<scc[i].size();j++)
			group[scc[i][j]]=i;
	int Q;
	cin>>Q;
	for(int i=0;i<Q;i++){
		int a,b;
		cin>>a>>b;
		cout<<(group[a]==group[b])<<endl;
	}
	
	return 0;
}


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

int N, K;
const int MOD = 1.0e9 + 7;

ll pow_mod(ll n, ll k, ll mod) {
    if (k == 0) return 1;
    else if (k % 2 == 1) {
        return pow_mod(n, k-1, mod) * n % mod;
    }
    else {
        ll tmp = pow_mod(n, k/2, mod);
        return tmp * tmp % mod;
    }
}

ll modinv(ll n, ll mod) {
    return pow_mod(n, mod - 2, mod);
}

ll neg_mod(ll n, ll mod)  {
    ll res = n % mod;
    if (res < 0) res += mod;
    return res;
}

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

    ll ans = 0;
    for (ll i = K; i <= N+1; i++) {
        ll mn = (i*(i-1) % MOD) * modinv(2, MOD) % MOD;
        ll mx = (neg_mod((2 * N % MOD) - i, MOD) + 1) % MOD * i % MOD * modinv(2, MOD) % MOD;
        ll tmp = neg_mod(mx - mn + 1, MOD);
        ans = (ans + tmp) % MOD;
    }

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

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    int n,time;
    cin >> n >> time;
    int t[n];
    REP(i,n)cin >> t[i];
    int ans = 0;
    FOR(i,1,n){
        ans += min(time,t[i]-t[i-1]);
    }
    ans += time;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
n = int(input())

num = 0
for x in range(16):
    if n>=10**x and n<10**(x+1):
        num=x
        break
    else:
        num=16
out=0

if (n+1)//(10**(num)) == n//(10**(num)):
    out = n//10**(num) -1 + 9*num
else:
    out = n//10**(num) + 9*num
print(out)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	int ans=1;
	rep(i,n){
		if(ans*2<ans+k) ans*=2;
		else ans+=k;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  char s[10], t[11];
  char ch=fgetc(stdin);
  int len=0;
  while(ch!='\n'){
    s[len++]=ch;
    ch=fgetc(stdin);
  }
  ch=fgetc(stdin);
  len=0;
  while(ch!='\n'){
    t[len++]=ch;
    ch=fgetc(stdin);
  }
  int stg=1;
  for(int i=0; i<len-1; i++){
    if(s[i]!=t[i])
      stg=0;
  }
  if(stg==1)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}

Measured memory_bytes: 3624
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N int

func main() {
	sc.Split(bufio.ScanWords)
	//Nは必ず偶数
	N = nextInt()

	D := make([]int, N)
	for i := 0; i < N; i++ {
		D[i] = nextInt()
	}

	sort.Ints(D)
	//fmt.Println(D)
	l := D[(N-1)/2]
	r := D[N/2]
	fmt.Println(r - l)

}


Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

int main( void ){
    string a;

    cin >> a;
    if(a == "SUN") cout << 7;
    if(a == "MON") cout << 6;
    if(a == "TUE") cout << 5;
    if(a == "WED") cout << 4;
    if(a == "THU") cout << 3;
    if(a == "FRI") cout << 2;
    if(a == "SAT") cout << 1;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
      int N=sc.nextInt();
      int X=sc.nextInt();
      int L[]=new int[N];
      int D[]=new int[N+1];
      D[0]=0;
      int m=1;
      for(int i=0;i<N;i++){
      L[i]=sc.nextInt();
      }
      for(int s=1;s<=N;s++){
      D[s]=D[s-1]+L[s-1];
       if(D[s]<=X){
        m+=1;
        }
       
      }
      System.out.println(m);
      
      
    }
}

Measured memory_bytes: 21844
/* ****TCIITB**** */

#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

#define N  200005

int main()
{
	
	io
	string x;
	cin>>x;
	ll cnt=0;
	ll n=x.length();
	std::vector<char> s(N);
	rep(i,0,n)
		s[i]=(x[i]);	
	ll ans=0;
	for(ll i=n-1;i>=0;i--)
	{
		if(s[i]=='B')
		{
			ans+=cnt;
		}
		if(s[i]=='W')
		{
			cnt++;
		}
	}
	cout<<ans;
	
}

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

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

    if (n == 0)
    {
        cout << 0 << endl;
        return 0;
    }
    string s;
    while (n)
    {
        if (n%2)
        {
            s += '1';
            --n;
        }
        else
        {
            s += '0';
        }
        n /= -2;
    }
    reverse(s.begin(), s.end());

    cout << s << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <cctype>
#include <tr1/unordered_map>

using namespace std;
using namespace tr1;

const int MOD = 1000000007;

int memo[51][51][51][51];
unordered_map<string, vector<string> > syms;
int LIMIT;

void expand(const string &name, vector<string> &out) {
    const vector<string> &v = syms[name];
    for(vector<string>::const_iterator it = v.begin(); it != v.end(); ++it) {
        const string &part = *it;
        if(isupper(part[0])) {
            out.push_back(part);
        } else {
            expand(part, out);
        }
        if(out.size() > LIMIT) throw "Over limit";
    }
}

int dfs(int A, int T, int G, int C, const vector<string> &v, int pos) {
    int &res = memo[A][T][G][C];
    if(res != -1) return res;
    if(pos == v.size()) {
        if(A+T+G+C == 0) return 1;
        else return 0;
    }
    const string &part = v[pos];
    res = 0;
    for(string::const_iterator it2 = part.begin(); it2 != part.end(); ++it2) {
        switch(*it2) {
            case 'A':
                if(A > 0) res += dfs(A-1, T, G, C, v, pos+1);
                break;
            case 'T':
                if(T > 0) res += dfs(A, T-1, G, C, v, pos+1);
                break;
            case 'G':
                if(G > 0) res += dfs(A, T, G-1, C, v, pos+1);
                break;
            case 'C':
                if(C > 0) res += dfs(A, T, G, C-1, v, pos+1);
                break;
        }
        res %= MOD;
    }
    return res;
}

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

    int A, T, G, C;
    cin >> A >> T >> G >> C;
    int M;
    cin >> M;
    cin.ignore();
    string toplevel;
    for(int i = 0; i < M; ++i) {
        string line;
        getline(cin, line);

        istringstream is(line);
        string name;
        is >> name;
        name.erase(name.end()-1);
        vector<string> parts;
        while(!is.eof()) {
            string token;
            is >> token;
            if(token[0] == '[') {
                parts.push_back(token.substr(1, (int)token.size()-2));
            } else {
                parts.push_back(token);
            }
        }
        syms[name] = parts;
        if(i == 0) toplevel = name;
    }
    for(int i = 0; i < 51; ++i)
        for(int j = 0; j < 51; ++j)
            for(int k = 0; k < 51; ++k)
                for(int l = 0; l < 51; ++l)
                    memo[i][j][k][l] = -1;
    try {
        vector<string> expanded;
        LIMIT = A+T+G+C;
        expand(toplevel, expanded);
        cout << dfs(A, T, G, C, expanded, 0) << endl;
    } catch(const char *err) {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 27744
# coding: utf-8
N=int(input())
A=list(map(int,input().split()))
F=[0]*(10**5+1)

for i in range(N):
    if A[i]==0:
        F[0]+=1
        F[1]+=1
    else:
        F[A[i]-1]+=1
        F[A[i]]+=1
        F[A[i]+1]+=1
        
print(max(F))

Measured memory_bytes: 52420
#include <iostream>
#include <string>
using namespace std;
int main() {
  string s, p;
  cin >> s >> p;
  s += s;
  for ( long long int i = 0; i < s.size(); i++ ) {
    if ( s.substr( i, p.size() ) == p ) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int sum = 0;
  
  for (int i = 0; i < 9; i++) {
    int exp = 1;
    for (int j = 0; j < i; j++) {
      exp *= 10;
    }
    // expは10のi乗
    
    sum += N % (exp * 10) / exp;
  }
  
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main() {
  int a, b, c;  std::cin >> a >> b >> c;
  
  if (a+b >= c) {
    printf("%d\n", b+c);
  } else {
    printf("%d\n", b*2 + a + 1);
  }
  return 0;
}

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

int main() {
  int ans = 0;
  int A, B, C, X; cin>>A>>B>>C>>X;
  for(int a = 0; a <= A; a++) {
    int sum = 500 * a;
    if(sum > X) break;
    for(int b = 0; b <= B; b++) {
      int sum2 = sum + b * 100;
      if(sum2 > X) break;
      int cand = (X-sum2) / 50;
      //      cout << a << " " << b << " " << X << " " << sum2 << " " << cand << endl;  
      if(cand <= C && (sum2 + cand * 50) == X) {
        //      cout << (sum2 + cand * 50) <<  " " << X << endl;                        
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
 
int main()
{
	int n; string s;
    cin >> n >> s;
    
    
	int result = 0;
    int i = 0, j = n - 1;
	while(i<=j)
	{
		if(s[i]=='W' && s[j]=='R')
		{
			swap(s[i],s[j]);
			i++;
			j--;
			result++;
		}
		if(s[i]=='R')
		{
			i++;
		}
		if(s[j]=='W')
		{
			j--;
		}
 
	}
	cout<< result << endl;
 
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL;
  typedef pair<ll,char> PLC;
  typedef pair<char,ll> PCL;

int main(void){
  int A,B;cin >> A >> B;
  cout << max(max(A+B,A-B),A*B) << endl;
  return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    vector<int> ans(N,0);
    for(int i=0; i<M; i++){
        int a;
        cin >> a;
        for(int j=0; j<N; j++){
            if(A[j]<=a){
                ans[j]++;
                break;
            }
        }
    }
    int mx = 0;
    int id;
    for(int i=0; i<N; i++){
        if(mx < ans[i]){
            mx = ans[i];
            id = i;
        }
    }
    cout << id+1 << "\n";
    return 0;

}


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

#define MAX 1000001

long long int flag[MAX] = {};
long long int flag2[MAX] = {};

int main() {

	vector< long long int > l, l2;

	for( long long int i = 1; ; i++ ) {

		long long int a = i * ( i + 1 ) * ( i + 2 ) / 6;

		if ( a >= MAX ) break;

		l.push_back( a );
		if ( ( a % 2 ) != 0 ) l2.push_back( a );

	}
	
	for ( long long int i = 1; i < MAX; i++ ) {
		flag[i] = MAX + 1;
		flag2[i] = MAX + 1;
	}

	for ( long long int i = 0; i < l.size(); i++ ) {
		for ( long long int j = 0; j + l[i] < MAX; j++ ) {
			flag[ j + l[i] ] = min( flag[ j + l[i] ], flag[ j ] + 1 );
		}
	}
	for ( long long int i = 0; i < l2.size(); i++ ) {
		for ( long long int j = 0; j + l2[i] < MAX; j++ ) {
			flag2[ j + l2[i] ] = min( flag2[ j + l2[i] ], flag2[ j ] + 1 );
		}
	}

	while( true ) {

		long long int in;
		cin >> in;
		if ( in == 0 ) break;

		cout << flag[in] << " " << flag2[in] << endl;

	}

	return 0;

}

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

typedef long long int ll;
ll r[200020];

int main(){
    int n;
    cin >> n;
    ll p;
    cin >> p;
    string s;
    cin >> s;
    if(p==2 || p==5){
        ll ans=0;
        for(int i=0;i<n;i++){
            if((s[i]-'0')%p==0) ans+=i+1;
        }
        cout << ans << endl;
        return 0;
    }

    ll x=1;
    r[n]=0;
    for(int i=n-1; i>=0; i--){
        r[i]=(r[i+1]+((s[i]-'0')*x)%p)%p;
        x*=10;
        x%=p;
    }
    ll ans=0;
    ll cnt[p]= {};
    cnt[0]++;
    for(int i=n-1; i>=0; i--){
        ans+=cnt[r[i]];
        cnt[r[i]]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2180
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1<<29;
using Graph = vector<vector<int>>;
int main() {
    ll N; cin >> N;
    set<string> st;
    for (int i=0; i<N; ++i) {
        string s; cin >> s;
        auto r = st.insert(s);
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 19204
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main(void)
{
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i=1; i<=n; i++){
        if( (i%3!=0) && (i%5!=0)) ans+=i;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;

    vector<int> counter(N, 0);
    for (int i = 0; i < M; i++) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        counter[u]++;
        counter[v]++;
    }

    for (int v = 0; v < N; v++) {
        if (counter[v] % 2 == 1) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 640
/*
AuThOr Gwj
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int n;
int a[200000+20];
vector<int> each[200000+20];
map<int,int> m;
int tree[(200000)*8];
const int TREEN=1<<18;
int res[200000+20];
void change(int index,int val){
	index+=TREEN-1;
	tree[index]=val;
	index>>=1;
	while(index){
		tree[index]=max(tree[index<<1],tree[(index<<1)+1]);
		index>>=1;
	}
}
int query(int a,int b,int now=1,int l=1,int r=TREEN+1){
	if(r<=a||l>=b){
		return 0;
	}
	if(r<=b&&l>=a){
		return tree[now];
	}
	int mid=(l+r)>>1;
	return max(query(a,b,now<<1,l,mid),query(a,b,(now<<1)+1,mid,r));
}
void dfs(int now,int prev,int las=-INF){
	int Pre=query(a[now],a[now]+1);
	int tt=query(1,a[now])+1;
	res[now]=max(tt,las);
	change(a[now],tt); 
	for(auto it:each[now]){
		if(it!=prev){
			dfs(it,now,res[now]);
		}
	}
	change(a[now],Pre);
}
int main(){
	fastio;
	cin>>n;
	int cnt=0;
	rb(i,1,n) cin>>a[i],m[a[i]]++;
	for(map<int,int> :: IT ite=m.begin();ite!=m.end();ite++){
		ite->SEC=++cnt;
	}
	rb(i,1,n) a[i]=m[a[i]];
////	change(1,10);
//	cout<<query(1,3)<<endl;
//	rb(i,1,n)
//		cout<<a[i]<<" ";cout<<endl; 
	rb(i,1,n-1){
		int u,v;
		cin>>u>>v;
		each[u].PB(v);
		each[v].PB(u);
	}
	dfs(1,0);
//	cout<<query(1,TREEN+1)<<endl;
	rb(i,1,n) cout<<res[i]<<endl;
	return 0;
}


Measured memory_bytes: 36644
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}

int MOD = pow(10, 9) + 7;

int kaijou(int n){
    if(n==0) return 1;
    else{
        return ((n%MOD)*(kaijou(n-1)%MOD))%MOD;
    }
}

bool ispow(int n){
    int rn=sqrt(n);
    if(rn*rn==n) return true;
    else return false;
}

signed main() {
    int n; cin>>n;
    vector<int> dam(n);
    for(int i=0;i<n;i++) cin>>dam[i];

    vector<int> mountain(n,0);

    int sum=accumulate(all(dam),0LL);
    vector<int> twomountain(n,0);
    int other_mountain=0;

    for(int i=0;i<n;i++){
        twomountain[i]=dam[i]*2;
    }

    int i=0;
    while((i)<(n-2)){
        other_mountain+=twomountain[i];
        i+=2;
    }
    int left=0,right=i-2;

    mountain[n-1]=sum-other_mountain;
    for(int i=n-2;i>=0;i--){
        mountain[i]=twomountain[i]-mountain[i+1];
    }
    
    /*
    for(int i=0;i<n;i++){
        //cout<<left<<" "<<right<<endl;
        if(i==0){
            mountain[n-1]=sum-other_mountain;
        }else{
            mountain[left-1]=sum-other_mountain;
        }
        other_mountain-=twomountain[left];
        left+=2;
        right+=2;
        if(left>=n) left%=n;
        if(right>=n) right%=n;
        other_mountain+=twomountain[right];
    }*/

    output_yoko(mountain);
}


Measured memory_bytes: 6444
a = int(input());b = int(input());c = int(input());x = int(input())
s = 0
n = 0
counter = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      s = 500*i + 100*j + 50*k
      if s == x:
        counter += 1

print(counter)

Measured memory_bytes: 3060
#include<stdio.h>

int main(void){

 int b=0,c1=0,c2=0,z=0;
 double x,y;
 
 scanf("%d %d",&c1,&c2);

 for(z=0;z <= c1;z++){
 b = c1 - z;
 if(2*z + 4*b == c2){
 printf("Yes");
 break;
 }
 else if(z == c1){
 printf("No"); 
 } 
 }
 return 0;
 
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
using ll = long long;
const double pi = acos(-1);

int main()
{
	double a,b,x;
	cin >> a >> b >> x;
	x /= a;
	if(a*b>=x*2.0)
	{
		printf("%.10lf\n",atan2(b,x/b*2)*180/acos(-1));
	}
	else
	{
		double c = 2.0*x/a-b;
		printf("%.10lf\n",atan2(b-c,a)*180.0/pi);
	}

}


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

using namespace std;

vector<int> dice(7, 0);
vector<int> dice2(7, 0);
vector<int> newdice(7, 0);
string str;

void dicerot() {

	for (int i = 0; i < str.size(); i++) {
		if (str[i] == 'N') {
			newdice[1] = dice[2];
			newdice[2] = dice[6];
			newdice[3] = dice[3];
			newdice[4] = dice[4];
			newdice[5] = dice[1];
			newdice[6] = dice[5];
		}
		else if (str[i] == 'S') {
			newdice[1] = dice[5];
			newdice[2] = dice[1];
			newdice[3] = dice[3];
			newdice[4] = dice[4];
			newdice[5] = dice[6];
			newdice[6] = dice[2];
		}
		else if (str[i] == 'E') {
			newdice[1] = dice[4];
			newdice[2] = dice[2];
			newdice[3] = dice[1];
			newdice[4] = dice[6];
			newdice[5] = dice[5];
			newdice[6] = dice[3];
		}
		else if (str[i] == 'W') {
			newdice[1] = dice[3];
			newdice[2] = dice[2];
			newdice[3] = dice[6];
			newdice[4] = dice[1];
			newdice[5] = dice[5];
			newdice[6] = dice[4];
		}
		else if (str[i] == 'R') {
			newdice[1] = dice[1];
			newdice[2] = dice[3];
			newdice[3] = dice[5];
			newdice[4] = dice[2];
			newdice[5] = dice[4];
			newdice[6] = dice[6];
		}
		else if (str[i] == 'L') {
			newdice[1] = dice[1];
			newdice[2] = dice[4];
			newdice[3] = dice[2];
			newdice[4] = dice[5];
			newdice[5] = dice[3];
			newdice[6] = dice[6];
		}

		for (int j = 1; j <= 6; j++) {
			dice[j] = newdice[j];
		}

	}

}

int dicecheck() {
	int counter = 0;
	for (int i = 1; i <= 6; i++) {
		if (dice[i] != dice2[i]) { counter++; }
	}
	return counter;
}


int main() {

	int n;
	cin >> n;
	vector<vector<int>> dd(n, vector<int>(7, 0));
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= 6; j++) {
			cin >> dd[i][j];
		}
	}

	for (int m1 = 0; m1 < n - 1; m1++) {
		for (int m2 = m1 + 1; m2 < n; m2++) {
			for (int i = 1; i <= 6; i++) {
				dice[i] = dd[m1][i];
				dice2[i] = dd[m2][i];
			}

			for (int k = 0; k < 4; k++) {
				for (int i = 0; i < 4; i++) {
					for (int j = 0; j < 4; j++) {
						if (dicecheck() == 0) {
							cout << "No" << endl;
							return 0;
						}
						str = "R";
						dicerot();
					}
					str = "N";
					dicerot();
				}
				str = "E";
				dicerot();
			}
			for (int i = 1; i <= 6; i++) {
				dice[i] = dd[m1][i];
				dice2[i] = dd[m2][i];
			}

		}
	}
	cout << "Yes" << endl;
}


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

int main (){
  int K, A, B, a, b;
  cin >> K >> a >> b;
  A = a / K;
  B = b / K;
  if ( B > A )cout << "OK" << endl;
  else if ( K == 1 )cout << "OK" << endl;
  else if ( a % K == 0 )cout << "OK" << endl; 
  else cout << "NG" << endl;
}

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

int main(){
	double v;
	while(cin >> v){
		double t = v / 9.8;
		double y = 4.9 * t * t;
		int i=1;
		while(1){
			double h = 5 * i - 5;
			if(y <= h) break;
			i++;
		}
		cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
# AtCoder Grand Contest 033
# https://atcoder.jp/contests/agc033
import sys
import datetime
today = datetime.datetime.today

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main_ok():
    H, W = i2nn()
    HW = H * W
    A = ii2ss(H)
    A = [[0 if s == '#' else HW for s in line] for line in A]
    for i in range(H):
        for j in range(1, W):
            if A[i][j-1]+1 < A[i][j]:
                A[i][j] = A[i][j-1]+1
        for j in range(W-2, -1, -1):
            if A[i][j+1]+1 < A[i][j]:
                A[i][j] = A[i][j+1]+1
    for j in range(W):
        for i in range(1, H):
            if A[i-1][j]+1 < A[i][j]:
                A[i][j] = A[i-1][j]+1
        for i in range(H-2, -1, -1):
            if A[i+1][j]+1 < A[i][j]:
                A[i][j] = A[i+1][j]+1
    ans = 0
    for i in range(H):
        for j in range(W):
            if A[i][j] > ans:
                ans = A[i][j]
    print(ans)

def main_lte():
    H, W = i2nn()
    A = ii2ss(H)
    A = [[True] * (W + 2)] + [[True] + [s == '#' for s in line] + [True] for line in A] + [[True] * (W + 2)]
    q = []
    for i in range(1, H+1):
        for j in range(1, W+1):
            if A[i][j] == True:
                q.append((i, j))
    rec = 0
    while len(q) > 0:
        q2 = []
        for i0, j0 in q:
            i, j = i0 - 1, j0
            if A[i][j] != True:
                A[i][j] = True
                q2.append((i, j))
            i, j = i0 + 1, j0
            if A[i][j] != True:
                A[i][j] = True
                q2.append((i, j))
            i, j = i0, j0 - 1
            if A[i][j] != True:
                A[i][j] = True
                q2.append((i, j))
            i, j = i0, j0 + 1
            if A[i][j] != True:
                A[i][j] = True
                q2.append((i, j))
        rec += 1
        q = q2
    print(rec - 1)

import numpy as np
from scipy import ndimage

def main_scipy():
    H, W = i2nn()
    A = ii2ss(H)
    A = [[0 if s == '#' else -1 for s in line] for line in A]
    B = ndimage.morphology.distance_transform_cdt(A, metric='taxicab')
    n = np.max(B)
    print(n)

def main():
    main_scipy()

main()


Measured memory_bytes: 46936
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if(A > C && B > C){
    cout << "No" << endl;
  }
  else if(A < C && B < C){
    cout << "No" << endl;
  }
  else{ cout  << "Yes" << endl; }
  
}

Measured memory_bytes: 256
n = int(input())
p = list(map(int,input().split()))

r = list(range(n))
l = list(range(n))
I = [-1] * (n+1)

for i,P in enumerate(p):
	I[P] = i
#I[1~Nまでの数字] = 0,1,...
#index を求めている
ans  = 0

for N,index in enumerate(I[1:],1):#1からスタート
	L = index -1
	if L >= 0:
		L = l[L]

	R = index + 1
	if  R < n:
		R = r[R]

	l[R-1] = L
	r[L+1] = R
#0 <= L , R < n
	if L >= 0:
		L2 = L-1
		if L2 >= 0:
			L2 = l[L2]
		ans += N * (L-L2) * (R - index)

	if R < n:
		R2 = R+1
		if R2 < n:
			R2 = r[R2]
		ans += N * (index - L ) * (R2 - R)
print(ans)


Measured memory_bytes: 19708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll N;
    cin >> N;
    map<string, ll> mp;
    rep(i, 0, N){
        string s;
        cin >> s;
        mp[s]++;
    }
    cout << mp.size() << endl;
    return 0;
}

Measured memory_bytes: 19252
//
//  banned.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <map>
int main(int argc, const char* argv[]) {
  int n;

  std::cin >> n;
  std::map<long long, long long> m;
  long long A[n];
  for (int i = 0; i < n; i++) {
    std::cin >> A[i];
    if (m.find(A[i]) == m.end()) {
      m[A[i]] = 1;
    }
    else {
      m[A[i]] += 1;
    }
  }

  long long cnt = 0;
  for (std::map<long long, long long>::iterator it = m.begin(); it != m.end(); it++) {
    cnt += (it->second-1)*(it->second)/2;
  }

  for (int i = 0; i < n; i++) {
    long long result = cnt - (m[A[i]]-1);
    std::cout << result << std::endl;
  }
}

Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
int main(){
   string S;
   cin>>S;
   for(int i=0;i<12;i++){
     cout<<S[i];
     if(i==3){
       cout<<" ";
       break;
     }
   }
    for(int i=4;i<12;i++){
      cout<<S[i];
    }
  cout<<endl;
}

Measured memory_bytes: 3560
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;

int main() {
  int n, q, t;
  string name;

  queue<pair<string, int> > Q;

  cin >> n >> q;

  for ( int i = 0; i < n; i++ ) {
    cin >> name >> t;
    Q.push(make_pair(name, t));
  }

  pair<string, int> u;
  int elaps = 0, a;

  while ( !Q.empty() ) {
    u = Q.front(); Q.pop();
    a = min(u.second, q);
    u.second -= a;
    elaps += a;
    if (u.second > 0) {
      Q.push(u);
    } else {
      cout << u.first << " " << elaps << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 6296
S = '0' + input()
K = int(input())
days = 5*(10**13)
idx1 = 1
idx2 = 0
while idx2 < K:
  ans = S[idx1]
  if int(S[idx1]) == 1:
    idx2 += 1
  else:
    tmp_idx = int(S[idx1])
    tmp_cnt = 1 
    while tmp_idx + idx2 < K and tmp_cnt <= days:
      tmp_idx *= int(S[idx1])
      tmp_cnt += 1
      #print(tmp_idx + idx2 , tmp_cnt)
    
    if tmp_cnt == days:
      print(S[idx1])
      eixt()
    else:
      idx2 += tmp_idx
  idx1 += 1
  #print(idx1,idx2)
print(ans)

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef string str;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    REP(i, b) {
        REP(k, a) {
            cout << 1;
        }
        REP(k, w - a) {
            cout << 0;
        }
        cout << "\n";
    }
    REP(i, h - b) {
        REP(k, a) {
            cout << 0;
        }
        REP(k, w - a) {
            cout << 1;
        }
        cout << "\n";
    }

    return 0;
}


Measured memory_bytes: 1280
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;
int h, w, n;

map<pair<int, int>, int> cnt;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>h>>w>>n;
    
    int a,b;
    for (int i = 0; i < n; i++){
        cin>>a>>b;
        a--,b--;
        for (int j = -1; j <= 1; j++){
            for (int k = -1; k <= 1; k++){
                if(a+j<1||a+j>=h-1)continue;
                if(b+k<1||b+k>=w-1)continue;
                cnt[{a+j, b+k}] ++;
            }
        }
    }
    
//    for (auto i : cnt) {
//        cout<<i.first.first<<' '<<i.first.second<<' '<<i.second<<endl;
//    }
    
    vector<long long> ans(10,0);
    
    for (auto i : cnt) {
        ans[i.second] ++;
    }
    
    long long sum = accumulate(ans.begin(), ans.end(), 0ll);
    
    ans[0] = (long long)(h-2)*(w-2) -sum;
    
    for (auto i : ans) {
        cout<<i<<endl;
    }
    
    
    
    
    return 0;
}



Measured memory_bytes: 56576