akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> p(N), a(N), b(N);

  for (int i=0; i<N; i++) {
    cin >> p[i];
    a[i] = (i+1) * N;
    b[i] = N * (N-i);
  }

  for (int i=0; i<N; i++) {
    b[p[i]-1] += i;
  }

  for (int i=0; i<N; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  for (int i=0; i<N; i++) {
    cout << b[i] << " ";
  }
  cout << endl;
  return 0;
}


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

using namespace std;

int main()
{
	priority_queue<int>q;
	int n = 0, m = 0, i = 0, a = 0;
	long long sum = 0;
	scanf("%d %d", &n, &m);
	for(i = 1; i <= n; i++)
    {
		scanf("%d",&a);
		q.push(a);
	}
	for(i = 1;i <= m; i++){
		a = q.top();
		q.pop();
		a /= 2;
		q.push(a);
	}
	while(!q.empty())
    {
		a=q.top();
		q.pop();
		sum += a;
	}
	printf("%lld\n", sum);
	return 0;
}


Measured memory_bytes: 892
h, w, h0, w0 = map(int, input().split())
if h0 == w0 == 1:
    print("No")
    exit()
x, y = h // h0, w // w0
a1cnt = h0 * w0 - 1
a1sum, a2sum = h * w - x * y, x * y
a1 = ((pow(10, 9) - 1) // a1cnt)
a2 = -(a1 * a1cnt + 1)
asum = a1 * a1sum + a2 * a2sum
print("Yes" if asum > 0 else "No")
if asum > 0:
    for i in range(1, h + 1):
        a = [0] * w
        for j in range(1, w + 1):
            a[j - 1] = a2 if i % h0 == j % w0 == 0 else a1
        print(*a)

Measured memory_bytes: 9288
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MOD 1000000007LL
#define MAX 10000
#define NIL -1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
typedef pair<double, double> doup;


int main(void) {
    ll n, m;
    cin >> n >> m;
    ll t, a, s[100001]={0};
    ll i, ans=0;
    map<ll, ll> map;
    set<ll> set;
    vector<ll> vec;
    map[0]=1;
    for(i=1; i<=n; i++) {
        cin >> a;
        s[i]=s[i-1]+a;
        map[s[i]%m]++;
        set.insert(s[i]%m);
    }
    
    for(auto itr=set.begin(); itr!=set.end(); itr++) {
        t=map[*itr];
        ans+=t*(t-1)/2;
    }
    
    cout << ans << endl;
}


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

bool ok(int n, set<int>& s) {
	while(n) {
		if(s.count(n % 10)) return false;
		n /= 10;
	}
	return true;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	set<int> s;
	for(int i = 0; i < k; i++) {
		int a;
		cin >> a;
		s.insert(a);
	}
	for(;;n++) {
		if(ok(n, s)) {
			cout << n << endl;
			return 0;
		}
	}
	return 0;
}

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

int main() {
	//cout<<"GfG!";
	unsigned long long int n, i, sq, s;
	cin>>n;
	i = 1;  sq = i;
	while(sq <= n)
	{
	    s = i * i;
	    if (s > n)
	        break;
	    sq = i*i;
	    i++;
	}
	cout<<sq;
	return 0;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    double answer = 0;
    const double BTC = 380000.0;
    for (int i = 0; i < N; i++)
    {
        float x;
        string u;
        cin >> x >> u;
        if(u == "BTC")
        {
            x *= BTC;
        }
        answer += x;
    }
    cout << fixed << setprecision(6) << answer << endl;
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(void){
    int a,b,N,i,ren = 0;
    scanf("%d",&N);
    if(N < 3 || N > 100) return 0;
    for(i = 0;i < N;i ++){
        scanf("%d %d",&a,&b);
        if((a < 1 || a > 6) || (b < 1 || a > 6)) return 0;
        if(a == b){
            ren ++;
        }else{
            ren = 0;
        }
        if(ren == 3){
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


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



int main() {
  int a,b;
  cin >> a>>b;
  if(a>=13){cout << b << endl; return 0;}
  if(a<=12 && a>=6){cout << b/2 << endl; return 0;}
  if(a<=5){cout << 0 << endl;}
}

Measured memory_bytes: 256
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <queue>
#include <iostream>
#include <cmath>

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
typedef long long ll;
using namespace std;


void solve(long long N, long long K, std::vector<long long> p){
    sort(p.begin(), p.end());
    int res = 0;
    REP(i, K) { 
        res += p[i];
    }
    cout << res << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    solve(N, K, std::move(p));
    return 0;
}


Measured memory_bytes: 3668
const calculateSquare = (r) => {
  return 3 * r * r;
}

const main = (standardInput) => {
  const  lengthList: string[] = standardInput.split(' ');
  const r: number = Number.parseInt(lengthList[0]);
  
  console.log(calculateSquare(r));
  	
}
 
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));

Measured memory_bytes: 7372
import math

h,w=map(int,input().split())

R=[]

def func(h,w):
    for i in range(1,h+1):
        s1=i*w
        s2=(h-i)*(math.ceil(w/2))
        s3=(h-i)*(w//2)
        R.append(max(s1,s2,s3)-min(s1,s2,s3))
        
        s2=(math.ceil((h-i)/2))*w
        s3=((h-i)//2)*w
        R.append(max(s1,s2,s3)-min(s1,s2,s3))
    return min(R)

print(min(func(h,w),func(w,h)))

Measured memory_bytes: 18904
#include <iostream>
using namespace std;
int main(){
int H,W;

for (;;){
    cin >> H >> W;
    if (H == 0&&W == 0)break;
    for (int a = 1;a <= W;a++){
        if (W == 0||H == 0)break;
        cout << "#";
    } 
    cout << endl;

    for (int b = 1;b <= H - 2;b++){
        if (W == 0 || H == 0)break;
        cout << "#";
        for (int c = 1;c <= W - 2;c++){
        cout << ".";
        }
        cout << "#" << endl;
    }

    for (int c = 1;c <= W;c++){
        if (W <= 1|| H <= 1)break;
        cout << "#";
    }
    cout << endl;
    cout << endl;
    }
    return 0;

}

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

int main() {
  int N;
  cin >> N;
  
  int D[110];
  for (int i; i < N; i++) cin >> D[i];

  set<int> values;
  
  for (int i; i < N; i++) values.insert(D[i]);
  
  cout << values.size() << endl;
}
      
  
    

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(void){
    // Here your code !
    int n;cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    sort(v.begin(),v.end());
    cout<<v[n-1] - v[0]<<endl;
}


Measured memory_bytes: 256
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

s = input()
s1 = s[0:2]
s2 = s[2:4]
#どちらかが00になっているとき
if (s1[0]=="0" and s1[1]=="0") or(s2[0]=="0" and s2[1]=="0"):
    if  0<int(s1[0])*10+int(s1[1]) <12:
        print("MMYY")
    elif 0 < int(s2[0])*10+int(s2[1]) <12:
        print("YYMM")
    else:
        print("NA")
else:
    #最初が0Xのとき
    if s1[0]=="0":
        if s2[0]=="0":
            print("AMBIGUOUS")
        else:
            if eval(s2)>12:
                print("MMYY")
            else:
                print("AMBIGUOUS")
    else:
        #最初がYXのかたちY>=1のとき
        if eval(s1)>12:
            if s2[0]=="0" or eval(s2) <= 12:
                print("YYMM")
            else:
                print("NA")
        else:
            if s2[0]=="0":
                print("AMBIGUOUS")
            else:
                if eval(s2)>12:
                    print("MMYY")
                else:
                    print("AMBIGUOUS")

Measured memory_bytes: 38384
N = int(input())
S = input()
mod = 1e9 + 7
dic =  { i:0  for i in [chr(i) for i in range(97, 97+26)] }
for i in range(N):
    dic[S[i]] += 1

ans = 1
for value in dic.values():
    ans *= (value+1)
    ans %=  mod
print(int((ans-1) %mod))

Measured memory_bytes: 39920
X,K,D = map(int, input().split())

k = abs(X // D)
r = X % D

if k <= K:
    K -= k
    X = r
    if K % 2 == 0:
        print(r)
    else:
        print(abs(r - D))
else:
    print(abs(X) - K * D)
            


Measured memory_bytes: 9168
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn solve(n: usize) -> String {
    for i in 1..10 {
        if n % i == 0 && n / i < 10 {
            return String::from("Yes")
        }
    }
    return String::from("No")
}

fn main() {
    input!{
        n: usize,
    }
    println!("{}", solve(n))
}

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

typedef long long ll;

const int MAXN = 2e5 + 5;

int N;
int a[MAXN];

int main() {
	scanf("%d", &N);
	a[0] = -1;
	for (int i = 1; i <= N; i++)
		scanf("%d", a + i);
	
	ll sol = 0;
	for (int i = 1; i <= N; i++) {
		if (a[i] - a[i - 1] > 1) {
			puts("-1");
			return 0;
		}
		sol += a[i];
		if (a[i] > a[i + 1])
			sol -= (ll)a[i] * (a[i] - 1) / 2 - (ll)a[i + 1] * (a[i + 1] - 1) / 2;
	}
	
	printf("%lld\n", sol);
	
	return 0;
}

Measured memory_bytes: 1024
a, b = map(int, input().split())
 
def devide_ok(x, y):
  if y / x == y // x:
    return True
  else:
    return False
  
for i in range(1, b + 1):
  if a * i >= b and devide_ok(b, a * i):
    print(a * i)
    break

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;


int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll a, b; cin >> a >> b;
  if (b < a) swap(a, b);
  for (ll i = 0; i < b; i++) {
    cout << a;
  }
  cout << endl;

  return 0;
}



Measured memory_bytes: 256
N=int(input())
*A,=map(int, input().split())
*B,=map(int, input().split())
*C,=map(int, input().split())

A.sort()
B.sort()
C.sort()

ans = 0
from bisect import bisect_left, bisect_right
for b in B:
    ac = bisect_left(A,b)
    cc = N - bisect_right(C,b)
    ans += ac * cc
print(ans)

Measured memory_bytes: 23168
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main(){
    ll n;
    cin >> n;
    vll a(n + 2);
    a[0] = a[n + 1] = 0;
    REP(i, n) cin >> a[i + 1];
    ll sum = 0;
    REP(i, n + 1) sum += abs(a[i + 1] - a[i]);
    ll res;
    REP(i, n){
        res = sum + abs(a[i + 2] - a[i]) - (abs(a[i + 1] - a[i]) + abs(a[i + 2] - a[i + 1]));
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N;cin>>N;
    priority_queue<int>pq;
    int sum=0;
    rep(i,N){
        int a;
        cin>>a;
        pq.push(a);
        sum+=a;
    }
    int ans=0;
    ans=sum;
    ans-=pq.top()/2;
    cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <string.h>
using namespace std;

typedef pair<int,int> P;
int N;
vector<int> G[202];
bool used[202];
int match[202];

bool dfs(int v){
	used[v] = true;
	for(int i=0;i<G[v].size();i++){
		int u = G[v][i],w = match[u];
		if(w<0 || !used[w] && dfs(w)){
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

int mat(){
	int ans = 0;
	memset(match,-1,sizeof(match));
	for(int v=1;v<=2*N;v++){
		if(match[v]<0){
			memset(used,0,sizeof(used));
			if(dfs(v)){
				ans++;
			}
		}
	}
	return ans;
}

int main(){
	cin >> N;
	vector<P> R(N+1),B(N+1);
	for(int i=1;i<=N;i++){
		int a,b;
		cin >> a >> b;
		R[i] = P(a,b);
	}
	for(int i=1;i<=N;i++){
		int a,b;
		cin >> a >> b;
		B[i] = P(a,b);
	}
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){
			if(R[i].first < B[j].first && R[i].second < B[j].second){
				G[i].push_back(j+N);
				G[j+N].push_back(i);
			}
		}
	}
	cout << mat() << endl;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int L = sc.nextInt();
    int R = sc.nextInt();
    int d = sc.nextInt();
    int cnt = 0;
    
    for(int i = L; i<=R; i++){
      if(i%d==0){
        cnt++;
      }
    }
    System.out.println(cnt);
  }
}
    

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

const int mod = 1e9+7;
template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }


  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< mod >;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int r1,c1,r2,c2;
  cin >> r1 >> c1 >> r2 >> c2;
  //  r1++;c1++;r2++;c2++;
  
  vector<modint> fact(r2+c2+4);
  vector<modint> inv(r2+c2+4);
  fact[0] = 1;
  rep1(i,r2+c2+3) fact[i] = fact[i-1]*((modint)i);
  rep(i,r2+c2+4){
    inv[i] = 1;
    inv[i] /=fact[i];
  }

  modint ans = 0;

  ans = (fact[r2+c2+2]*inv[r2+1]*inv[c2+1] +
	 fact[r1+c1]*inv[r1]*inv[c1] -
	 fact[r2+c1+1]*inv[r2+1]*inv[c1] -
	 fact[r1+c2+1]*inv[r1]*inv[c2+1]); 
  
  cout << ans << endl;


  
  //  cout << endl << endl;
  //  cout << static_cast<double>(clock()) / CLOCKS_PER_SEC << "s"<<endl;
  return 0;
    

}


Measured memory_bytes: 15872
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define mod 998244353
#define SYOU(x) fixed<<setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii=pair<int, int > ;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  lol n,m,k;
  string s,w;
  int R[5000]={},G[5000]={},B[5000]={};
  int r[5000]={},g[5000]={},b[5000]={};
  cin >>n;
  cin >>s;
  for(int i=n-1;i>=0;i--){
    R[i]=R[i+1];
    G[i]=G[i+1];
    B[i]=B[i+1];
    if(s[i]=='R') R[i]++;
    else if(s[i]=='G') G[i]++;
    else B[i]++;
  }
  if(s[0]=='R') r[0]++;
  else if(s[0]=='G') g[0]++;
  else b[0]++;
  for(int i=1;i<n;i++){
    r[i]=r[i-1];
    g[i]=g[i-1];
    b[i]=b[i-1];
    if(s[i]=='R') r[i]++;
    else if(s[i]=='G') g[i]++;
    else b[i]++;
  }
  lol ans=0;
  for(int i=1;i<n-1;i++){
    if(s[i]=='R'){
      ans+=g[i-1]*B[i+1];
      ans+=b[i-1]*G[i+1];
    }
    if(s[i]=='G'){
      ans+=r[i-1]*B[i+1];
      ans+=b[i-1]*R[i+1];
    }
    if(s[i]=='B'){
      ans+=r[i-1]*G[i+1];
      ans+=g[i-1]*R[i+1];
    }
  }
  for(int i=n-1;i>=2;i--){
    for(int j=i-1;j>=1;j--){
      int h=j+j-i;
      if(h>=0){
        if(s[i]!=s[j]&&s[i]!=s[h]&&s[j]!=s[h]) ans--;
      }
    }
  }
  cout <<ans<<'\n';
  return (0);
}


Measured memory_bytes: 3764
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI():return list(map(int,sys.stdin.readline().rstrip().split()))
def LS():return list(sys.stdin.readline().rstrip().split())

def main():
  X,Y = LI()[:]
  #print(X,Y)

  if ((Y-2*X) % 2) == 0:
    a = (Y-2*X) / 2
    if a<=X and a>=0:
      print('Yes')
      exit()
  
  print('No')

if __name__ == '__main__':
	main()


Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   string s;
           cin>>s;
           int ans=0;
           int cnt=0;
           rep(i,0,3){
            if(s[i]=='R'){
             cnt++;
              chmax(ans,cnt);
            }
             else{
              cnt=0; 
             }
           }
           cout<<ans<<endl;
}

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

int main()
{
    char c;
    cin >> c;
    bool flg = (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o');
    cout << (flg ? "vowel" : "consonant") << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val sMax = 1000000000L
    val (n, k, s) = readLine()!!.split(' ').map(String::toLong)
    if (s == sMax) {
        val ans = LongArray(n.toInt()) { 1L }
        (0 until k).forEach { ans[it.toInt()] = s }
        println(ans.joinToString(" "))
    } else {
        val ans = LongArray(n.toInt()) { s + 1 }
        (0 until k).forEach { ans[it.toInt()] = s }
        println(ans.joinToString(" "))
    }
}

Measured memory_bytes: 46552
import sys
import collections
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

class Run:
    def build(gv):
        
        gv.X, gv.Y, gv.A, gv.B, gv.C = map(int, input().split())
        gv.p = sorted(map(int, input().split()), reverse=True)
        gv.q = sorted(map(int, input().split()), reverse=True)
        gv.r = sorted(map(int, input().split()), reverse=True)

    def solve(gv):
        
        #new vars
        pCnt = 0; qCnt = 0; rCnt = 0
        ans = 0
        cntDown = gv.X + gv.Y
        
        while True:
            if cntDown <= 0: break
            cntDown -= 1
            
            #new vars
            pNow = gv.p[pCnt] if pCnt < gv.X else -1
            qNow = gv.q[qCnt] if qCnt < gv.Y else -1
            rNow = gv.r[rCnt] if rCnt < len(gv.r) else -1
            
            if rNow >= pNow and rNow >= qNow:
                ans += rNow
                rCnt += 1
            elif pNow >= qNow:
                ans += pNow
                pCnt += 1
            else:
                ans += qNow
                qCnt +=1
        
        print(ans)
            
        
if __name__ == '__main__':
    run = Run()
    run.build()
    run.solve()


Measured memory_bytes: 22968
a = gets.to_i
aa = []
ar = []
for num in 1..a do
  aa << num
end
b = gets.split.map(&:to_i)
c = gets.split.map(&:to_i)
aa.permutation do |x|
  ar << x
end

bn = ar.index(b) + 1
cn = ar.index(c) + 1
p (bn - cn).abs 

Measured memory_bytes: 6780
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long
int main()
{ 
    cool;
    ll int n,k,i,h,g=0;
    cin>>n>>k;
    ll int a[n],b[n];
    for(i=0;i<n;i++){
    	cin>>a[i];
    	b[i]=a[i];
	}
    vector<ll int> v;
    while(1){
    	if(a[g]!=0){
    		v.push_back(a[g]);
    		h=a[g]-1;
    		a[g]=0;
    		g=h;
		}
		else if(a[g]==0)
		break;
	}
	ll int l=v.size();
	ll int a1=v[l-1];
	ll int a2=b[a1-1];
	ll int f;
	for(i=0;i<l;i++){
		if(v[i]==a2){
			f=i;
			break;
		}
	}
	if(k<=l)
	{
		cout<<v[k-1];
	}
	else{
		ll int y=(k-(f+1))%(l-f);
		cout<<v[(y+f)];
	}
	//cout<<"\n";
	//for(i=0;i<v.size();i++)
	//cout<<v[i]<<" ";
    return 0;
}


Measured memory_bytes: 8456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll x,n;
	cin>>x>>n;
	vector<ll> v;
	for(ll i=0;i<n;i++){
		ll d;cin>>d;
		v.push_back(d);
	}
	vector<ll>::iterator it;
	it=find(v.begin(),v.end(),x);
	if(it==v.end()){
		cout<<x;
	}
	else{
		ll a=x,b=x;
		while(true){
			a=a-1; b=b+1;
			vector<ll> ::iterator it1;
			it1=find(v.begin(),v.end(),a);
			if(it1==v.end()){
				cout<<a;break;
			}
			
			
			vector<ll> ::iterator it2;
			it2=find(v.begin(),v.end(),b);
			if(it2==v.end()){
				cout<<b;break;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long,long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int N,A,B;
    cin >> N >> A >> B;
    cout << min(A*N,B)<< endl;
}


Measured memory_bytes: 3656
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = set(range(1, n + 1))

for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] >= h[b - 1]:
        ans.discard(b)
    if h[a - 1] <= h[b - 1]:
        ans.discard(a)

print(len(ans))


Measured memory_bytes: 91128
N = int(input())
ans = []
A = ['z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y']

while N > 0:
  ans.append(A[N % 26])
  if N % 26 == 0:
    N = N // 26 - 1
  else:
    N = N // 26

  

ans = ans[::-1]
ans = ''.join(ans)
print(ans)

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

namespace ABC139A
{
    class Program
    {
        public static void Main()
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();

            var n = s.Zip(t, (i1, i2) => i1 == i2 ? true : false)
                     .Count(x => x);
            Console.WriteLine(n);
        }
    }
}


Measured memory_bytes: 13268
# prd_xxx様のコードを参考: https://atcoder.jp/contests/tenka1-2017/submissions/1640474
N, K = map(int, input().split())
Items = [list(map(int, input().split())) for i in range(N)]


bs = bin(K)[2:].zfill(31)
masks = [bs]
for k in range(31):
    # Kのk-bit目が1ならば、k-bit目を0にして、そこより下を全て1にできる
    if bs[k] == '1':
        mask = bs[:k] + '0' + '1' * (30 - k)
        masks.append(mask)


ans = 0
for mask in masks:
    mask = int(mask, base=2)
    tmp = 0
    for a, b in Items:
        # orしても変わらない → aはmaskの部分集合
        if mask | a == mask:
            tmp += b
    ans = max(ans, tmp)

print(ans)


Measured memory_bytes: 29428
c = [list(map(int, input().split())) for i in range(3)]

def validation(lol):
    ans = True
    for i in range(len(lis)):
        for j in range(len(lis)):
            if i == j:
                break
            x = list(map(lambda x, y: x-y, c[i], c[j]))
            if len(set(x)) != 1:
              ans = False
            
    return ans

lis = []

for i in range(3):
    temp = []
    for j in range(3):
        temp.append(c[j][i])
    lis.append(temp)

if validation(c) and validation(lis):
    print("Yes")
else:
    print("No")

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

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

    if (N < abs(K - N)) {
        cout << N << endl;
        return 0;
    }

    int64_t n = N % K;
    int64_t n2 = abs(n - K);
    cout << (n < n2 ? n : n2) << endl;
}

Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
bitset<2000010> f;
int a[2010],n,sum;

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;++i)scanf("%d",a+i),sum+=a[i];
    f[0]=1;
    for(int i=n;i>=1;--i)f|=f<<a[i];
    for(int i=(sum+1)>>1;i<=sum;++i)
        if(f[i])
        {
            printf("%d\n",i);
            return 0;
        }
}

Measured memory_bytes: 1152
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int main(){
	int a,b,x;
	cin>>x>>a>>b;
	cout<<(x-a)%b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <map>
#include <deque>
#include <algorithm>
#include <set>
#include <string>
#include <math.h>
#include <stdio.h>
#include<iomanip>



#define ll long long
using namespace std;


ll factorial(ll n)
{
    if (n == 1 || n == 0)
        return 1;

    return n * factorial(n - 1);
}


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

    int n, k;
    cin >> n >> k;
    int arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];

    int dp[n];
    dp[0] = 0;
    for (int i = 1; i < n; i++)
    {
        dp[i] = 10e8 + 1051;
        for (int j = 1; j <= k; j++)
        {
            if (i - j >=0)
                dp[i] = min(dp[i], dp[i - j] + abs(arr[i] - arr[i - j]));
        }
    }


    cout << dp[n - 1];

    return 0;
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#define ll long long
#define oku7 1000000007
#define MAXN (int)1e+5 + 2
using namespace std;

ll rightmap[MAXN];
ll leftmap[MAXN];
ll war[MAXN];
ll wal[MAXN];
ll maxr[MAXN];
ll maxl[MAXN];


int main() {
	ll N, C;
	cin >> N >> C;
	vector<bool> exist;
	vector<pair<ll, ll>> sushis,revSushis;
	for (ll i = 0; i < N; i++) {
		ll tx, tv;
		cin >> tx >> tv;
		pair<ll, ll> p = make_pair(tx, tv);
		sushis.push_back(p);
	}
	sort(sushis.begin(), sushis.end());
	revSushis = sushis;
	reverse(revSushis.begin(), revSushis.end());
	for (int i = 0; i < N; i++) {
		revSushis[i].first = C - revSushis[i].first;
	}
	sushis.insert(sushis.begin(), make_pair(0, 0));
	revSushis.insert(revSushis.begin(), make_pair(0, 0));
	N++;
	war[0] = 0;
	wal[0] = 0;
	//累積和を計算
	for (int i = 1; i < N; i++) {
		war[i] = sushis[i].second - sushis[i].first + sushis[i-1].first  + war[i-1];
		wal[i] = revSushis[i].second - (revSushis[i].first)+ (revSushis[i-1].first) + wal[i - 1];
	}
	//累積最大値を計算
	ll nowr = war[0], nowl = wal[0];
	maxr[0] = war[0];
	maxl[0] = wal[0];
	for (ll i = 1; i < N; i++) {
		if (nowr < war[i]) nowr = war[i];
		if (nowl < wal[i]) nowl = wal[i];
		ll calcr = war[i - 1] + rightmap[i] - 1;
		ll calcl = wal[i - 1] + leftmap[i] - 1;
		maxr[i] = max(calcr, nowr);
		maxl[i] = max(calcl, nowl);
	}
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		ll mini = min(sushis[i].first,revSushis[N-i-1].first);
		ll calc = maxr[i] + maxl[N - i - 1] - mini;
		if (calc > ans) ans = calc;
	}
	if (ans < 0) return -1;
	cout << ans << "\n";
	return 0;
}

//

Measured memory_bytes: 8916
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <bitset>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#endif

#define ITER(c)             __typeof__((c).begin())
#define FOREACH(it, c)      for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)            __typeof__((c).rbegin())
#define RFOREACH(it, c)     for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)           REPEAT(i, 0, n)
#define RREP(i, n)          RREPEAT(i, 0, n);
#define REPEAT(i, k, n)     for(int i = (k); i < (k+n); ++i)
#define RREPEAT(i, k, n)    for(int i = (k)+(n)-1; i >= (k); ++i)
#define ALL(c)              (c).begin(), (c).end()
#define LLPOW(p1,p2)        ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)          (sizeof(A)/sizeof((A)[0]))
#define MIN(p1,p2)          (((p1)<(p2))?(p1):(p2))
#define MAX(p1,p2)          (((p1)>(p2))?(p1):(p2))
#define CIN_NO_SYNC         do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)           fgets((p), sizeof(p), stdin)
#define CHOMP(p)            do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n' || *_q == '\r') *_q = 0; } while(0)
#define mp                  make_pair

typedef long long ll;
typedef unsigned long long ull;

#define X real()
#define Y imag()
typedef double D;
typedef complex<D> P;
#define EPS (1e-9)

#ifdef _DEBUG
#define pf printf
#define pr(n) do { cout << #n " = " << (n) << endl; } while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#endif

void solve(string s){
    FOREACH(it, s){
        char c = *it;
        int n = 1;
        if(c == '@'){
            ++it; n = *it-'0';
            ++it; c = *it;
        }
        REP(i,n) cout << c;
    }
    cout << endl;
}

int main(){
    string s;
    while(cin >> s) solve(s);
    return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <string>
#include <vector>
#include <utility>
using namespace std;

int N,M,L,R,D;
bool judge = true;
int X[100010] = {0};
long long inf = 1000000;
vector< vector< pair<int,int> > > v(100001);	
int V[100010] = {0};

void dfs(int n){
	V[n] = 1;
	for(int i=0;i<v[n].size();i++){
		if(X[v[n][i].first] == inf) X[v[n][i].first] = X[n] + v[n][i].second;
		else if(X[v[n][i].first] != X[n] + v[n][i].second) judge = false;
		if(V[v[n][i].first] == 0) dfs(v[n][i].first);
	}
}

int main(){
	cin >> N >> M;
	for(int i=1;i<=N;i++){
		X[i] = inf;
	}
	for(int i=1;i<=M;i++){
		cin >> L >> R >> D;
		v[L].push_back(make_pair(R,D));
		v[R].push_back(make_pair(L,-D));
	}
	for(int i=1;i<=N;i++){
		if(V[i] == 0){
			X[i] = 0;
			dfs(i);
		}
	}
	if(judge) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 11392
# -*- coding: utf-8 -*-
"""
Dictionary - Map: Search
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_8_A&lang=jp

"""
d = dict()
for _ in range(int(input())):
    op, key, x = (input() + ' 1').split()[:3]
    if op == '0':
        d[key] = x
    else:
        print(d[key])
        


Measured memory_bytes: 41856
#include <stdio.h>
#include <ctype.h>

int getValue(char TopCh);

int main(void)
{
	int  Stack[100];  /* operand(100) */
	int  StackPoint;
	int  Value;
	char ch;
	
	StackPoint = 0;
	while(scanf("%c", &ch) != EOF)
	{
		if(ch == '-') /* minus */
		{
			Value = Stack[StackPoint-2] - Stack[StackPoint-1]; /* Caluculation */
			Stack[StackPoint-2] = Value;
			StackPoint--;
		}
		else if(ch == '+') /* plus */
		{
			Value = Stack[StackPoint-2] + Stack[StackPoint-1]; /* Caluculation */
			Stack[StackPoint-2] = Value;
			StackPoint--;
		}
		else if(ch == '*') /* multiply */
		{
			Value = Stack[StackPoint-2] * Stack[StackPoint-1]; /* Caluculation */
			Stack[StackPoint-2] = Value;
			StackPoint--;
		}
		else if(isdigit((unsigned char)ch) != 0)	/* judge operand */
		{
			Value = getValue(ch);
			Stack[StackPoint] = Value;
			StackPoint++;
		}
		else	/* Space or Bad Charactor*/
		{
		}
		
	}
	
	printf("%d\n", Stack[0]);
	
	return 0;
}

/* suuti hennkan */
int getValue(char TopCh)
{
	char ToAtoi[7] = {0};
	int  ValueDigits;
	char ch;
	
	ToAtoi[0] = TopCh;
	ValueDigits=1;
	do{
		scanf("%c", &ch);
		ToAtoi[ValueDigits] = ch;
		ValueDigits++;
	}while(isdigit(ch) != 0);
	
	return atoi(ToAtoi);
}

Measured memory_bytes: 1772
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#include<cstdlib>
#include<cctype>
#include<ctime>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 1e5 + 5;
const ll maxm = 1e3 + 5;
template<class T>
inline T qread(T &IEE){
	register T x = 0, f = 1;
	register char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-'){
			f = -f;
		}
		ch = getchar();
	}
	while(isdigit(ch)){
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return IEE = x * f;
}
template<class T>
inline void qwrite(T a){
	if(!a){
		putchar('0');
		return ;
	}
 	if(a < 0){
		putchar('-');
		a = -a;
	}
	if(a > 9) qwrite(a / 10);
	putchar(a % 10 + 48);
	return ;
}
template<class T>
inline T ab(T a){
	return (a > 0) ? a : -a;
}
template<class T>
inline void swa(T &a, T &b){
	a ^= b ^= a ^= b;
	return ;
}
ll cnt, a, b, n;
int main(){
//	freopen("1.in", "r", stdin);
//	freopen("1.out", "w", stdout);
	cin >> n >> a >> b;
	for(int i = 1;i <= n;i++){
		ll sum = 0, tmp = i;
		while(tmp){
			sum += tmp % 10;
			tmp /= 10;
		}
		if(a <= sum && sum <= b){
			cnt += i;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
from itertools import permutations, combinations
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
r = [r[i]-1 for i in range(R)]
vve = [list(map(int,input().split())) for i in range(M)]
v1,v2,edge = zip(*vve)
v1 = list(v1)
v2 = list(v2)
for i in range(M):
  v1[i] -= 1
  v2[i] -= 1
csr = csr_matrix((edge,(v1,v2)),shape = (N,N))
dist = [[0 for j in range(R)] for i in range(R)]
for i,j in combinations(range(R),2):
  r1,r2=r[i],r[j]
  dist[i][j] = int(dijkstra(csr, directed = False,indices = r1)[r2])
  dist[j][i] = dist[i][j]
ans = 10**18
for x in permutations(range(R)):
  distsum = 0
  for i in range(1,R):
    distsum += dist[x[i]][x[i-1]]
  ans = min(ans,distsum)
print(ans)

Measured memory_bytes: 23476
S = int(input())
if S < 3:
    print(0)
    exit()

MOD = 10**9 + 7
fact = [1] * (S+1)
for i in range(2, S+1):
    fact[i] = i * fact[i-1]

def nCr(n, r):
    return fact[n] // (fact[r] * fact[n-r])

boxes = S//3
ans = 0
for box in range(2, boxes+1):
    balls = S - box*3
    ans += nCr(balls + box - 1, balls) % MOD
    ans %= MOD

ans += 1
ans = ans % MOD

print(ans)


Measured memory_bytes: 80316
let N =
    stdin.ReadLine()
    |> int
let a =
    stdin.ReadLine().Split()
    |> Array.map int

a
|> Array.sortDescending
|> Array.mapi (fun i x ->
    match i%2 with
    | 1 -> -x
    | 0 -> x)
|> Array.sum
|> stdout.WriteLine

Measured memory_bytes: 28344
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define NDEBUG
// for DEBUG {{{
#ifdef NDEBUG
#define DEBUG_PRINT(fmt, ...) ((void)0)
#else
#define DEBUG_PRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
#endif
#define ASSERT_RANGE(min,x,max) assert(((x)>=(min)) && ((x)<=(max)))
// }}}

int sort_int(int *a, int N) {// {{{
	int i;
	for (i = 0; i < N-1; i++) {
		int j;
		for (j = i + 1; j < N; j++) {
			if (a[i] > a[j]) {
				int tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
	}
	return 0;
}// }}}
void merge_int(int *a, int *b, int lower, int sep, int upper) {// {{{
	int i_lower = lower;
	int i_upper = sep;
	int i_b = 0;
	while ((i_lower < sep) && (i_upper < upper)) {
		if (a[i_lower] < a[i_upper]) {
			b[i_b++] = a[i_lower++];
		} else {
			b[i_b++] = a[i_upper++];
		}
	}
	if (i_lower >= sep) {
		while (i_upper < upper) {
			b[i_b++] = a[i_upper++];
		}
	} else {
		while (i_lower < sep) {
			b[i_b++] = a[i_lower++];
		}
	}
	for (i_lower = 0; i_lower < i_b; i_lower++) {
		a[i_lower+lower] = b[i_lower];
	}
}// }}}
void merge_sort_int(int *a, int *b, int lower, int upper) {// {{{
	int sep;
	if ((lower == upper) || (lower + 1 == upper)) {
		return;
	}
	sep = (lower + upper) / 2;
	merge_sort_int(a,b,lower,sep);
	merge_sort_int(a,b,sep,upper);
	merge_int(a,b,lower,sep,upper);
}// }}}

int count(int *gremain, int *gn, int unit) {
	int remain = *gremain;
	int n = *gn;

	int n_cur = remain / unit;
	if (n_cur > n) {
		fprintf(stdout,"0\n");
		return 1;
	}
	if (n_cur == n) {
		if ((remain % unit) == 0) {
			fprintf(stdout,"1\n");
			return 1;
		} else {
			fprintf(stdout,"0\n");
			return 1;
		}
	}
	*gremain = remain - n_cur * unit;
	*gn = n - n_cur;
	return 0;
}
	
int main(int argc, char **argv) {
	int x;
	fscanf(stdin,"%d",&x) > 0;

	int n = x / 100;
	int remain = x - 100 * n;

	if (count(&remain, &n, 5)) {
		return 0;
	}
	if (count(&remain, &n, 4)) {
		return 0;
	}
	if (count(&remain, &n, 3)) {
		return 0;
	}
	if (count(&remain, &n, 2)) {
		return 0;
	}
	if (count(&remain, &n, 1)) {
		return 0;
	}
	fprintf(stdout,"1\n");
	return 0;
}



Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	int a=sc.nextInt();
	int b=sc.nextInt();
	int c=sc.nextInt();
	int x=sc.nextInt();
	int count = 0;
	
	for(int i=0;i<=a;i++) {
		for(int j=0;j<=b;j++) {
			for(int k=0;k<=c;k++) {
				if(x==500*i+100*j+50*k) {
					count++;
				}
			}
		}
	}
			System.out.println(count); 	
	}
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li x, n;
set<li> p;

int main() {
	cin >> x >> n;
	rin{
		li tmp;
		cin >> tmp;
		p.insert(tmp);
	}
	rep(i, 111) {
		if (p.count(x - i) == 0) {
			cout << x - i << endl;
			return 0;
		}
		if (p.count(x + i) == 0) {
			cout << x + i << endl;
			return 0;
		}
	}

	return 0;
}

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

int main(){
  int N;
  cin>>N;
  vector<long> high(N);
  bool finished=false;
  long H=0;
  for(int i=0;i<N;i++){
    cin>>high.at(i);
    H=max(H,high.at(i));
      if(H-high.at(i)>1){
        finished=true;
        cout<<"No"<<endl;
        break;
      }
  }
  if(finished==false)
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
)

// Gate Data
type Gate struct {
	left, right int
}

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

func solve(cardNum, gateNum int, gates []Gate) int {
	left := 1
	right := cardNum
	for _, g := range gates {
		left = maxInt(left, g.left)
		right = minInt(right, g.right)
	}
	if left > right {
		return 0
	}
	return right - left + 1
}

func main() {
	var n, m int
	var gates []Gate
	fmt.Scanln(&n, &m)
	for i := 0; i < m; i++ {
		var l, r int
		fmt.Scanln(&l, &r)
		gates = append(gates, Gate{l, r})
	}
	ans := solve(n, m, gates)
	fmt.Println(ans)
}


Measured memory_bytes: 7424
import math
cos = math.cos
pi = 3.14159265358979323846264338
A, B, H, W = map(int, input().split())
tA = (H * 60 + W) / 2
tB = W * 6
theta = abs(tA - tB)
c = cos(theta*pi/180)
X = (A*A+B*B-2*A*B*c)
print(X**0.5)

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  char dif = 'A' - 'a';
  cout << (char)(a[0] + dif) << (char)(b[0] + dif) << (char)(c[0] + dif) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <tuple>
#include <set>
#include <functional> 
#include <string.h>

#define X first
#define Y second
#define MP make_pair
#define MT make_tuple
#define FOR(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define REP(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll > pll;
using namespace std;
const int MAX = 101;
const double PI = 3.1415926535897932384;

template<class T, class U>
void convert(T &t, U &u){
	stringstream ss;
	ss << t;
	ss >> u;
}

double cross(pair<double, double> &a, pair<double, double> &b, pair<double, double> &o){
	return (a.first - o.first) * (b.second - o.second) - (b.first - o.first) * (a.second - o.second);
}

int main(){
	int n;
	while (cin >> n && n != 0){
		vector<pair<double, double> > tb;
		FOR(i, n){
			char c;
			double x, y; 
			cin >> x >> c >> y;
			tb.push_back(MP(x, y));
		}
		sort(tb.begin(), tb.end());

		vector<pair<double, double> > ans(n * 2, MP(0, 0));
		int k = 0; //使ってる三点
		//常に2点目が使えるかどうかを判定してる
		//3点が凹になってる場合は、答えに入れた2点目を外して、次の3点を選択し直す
		for (int i = 0; i < tb.size(); ans[k++] = tb[i++]){
			while (k >= 2 && cross(ans[k - 2], ans[k - 1], tb[i]) <= 0){ k--; }
		}

		for (int i = n - 2, t = k + 1; i >= 0; ans[k++] = tb[i--]){
			while (k >= t && cross(ans[k - 2], ans[k - 1], tb[i]) <= 0){ k--; }
		}

		ans.resize(k - 1);
		cout << n - ans.size() << endl;
	}
}

Measured memory_bytes: 1248
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	x := getNextInt(scanner)
	dp := make([]int, x+1)

	dp[0] = 1
	for i := 0; i < 6; i++ {
		for j := 0; j+100+i <= x; j++ {
			if dp[j] > 0 {
				dp[j+100+i] = dp[j]
			}
		}
	}

	fmt.Fprintln(writer, dp[x])
	writer.Flush()
}


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

int main(){
    int N;
    string S;
    cin >> N >> S;
    if (N%2){
        cout << "No" << endl;
        return 0;
    }
    for (int i=0;i<N/2;i++){
        if (S[i] != S[i+N/2]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int a, b;
	scanf("%d %d", &a, &b);
	if(a < b){
		printf("a < b\n");
	} else if(a > b){
		printf("a > b\n");
	} else {
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 1756