akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
using namespace std;
typedef vector<int> ans_t;
void dfs(int &n,int k,int memo,ans_t ans){
    if(k == n){
        for(int i = 0;i < ans.size();i++){
            cout << ans[i];
            if(i < ans.size()-1)cout << " ";
        }
        cout <<endl;
        return;
    }
    for(int i = memo;i < memo + 2;i++){
        //cout << "*" << i <<" " <<k ;
        int a , b;
        if(i == 0){
            a = 0;
            b = 1;
        }
        else{
            if(ans.size() < i + 1)a = 0;
            else{
                a = ans[i];
            }
            b = ans[i - 1];
        }
        //cout <<" " << a << " " << b<<endl;
        if(a < b){
            int memo_next = i;
            ans_t ans_next;
            for(int j = 0;j < ans.size();j++){
                ans_next.push_back(ans[j]);
            }
            if(ans.size() < i + 1)ans_next.push_back(1);
            else ans_next[i]++;
            dfs(n,k + 1,memo_next,ans_next);
        }
    }
    return;

}
int main(){
    vector<int> n;
    int l = 0;
    while(1){
        int v;
        cin >> v;
        if(v == 0)break;
        n.push_back(v);
        l++; 
    }
    for(int i = 0;i < l;i++){
        int k = 1;
        int memo = 0;
        ans_t ans;
        ans.push_back(1);
        dfs(n[i],k,memo,ans);
    }
    return 0;
}


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

int main() {
  int W,a,b;
  cin >> W >> a >> b;
  if (a<=b && b<=a+W) cout << 0 << endl;
  else if (a<=b+W && b+W<=a+W) cout << 0 << endl;
  else cout << max(b-a-W,a-b-W) << endl;
}

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

#define ll long long
#define p_q priority_queue
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)


int main(){
    ll h,a;
    cin>>h>>a;

    for(int i=1;i<=100000;i++){
        if(h<=a*i){
            cout<<i<<endl;
            break;
        }
    }
}





Measured memory_bytes: 256
n, k = (int(x) for x in input().split())
c = {} 
t = 0
MOD = 1000000007
for x in range(k, 0, -1):
    q = k // x
    c[x] = pow(q, n, MOD) - sum(c[x * y] for y in range(2, q + 1))
    t += c[x] * x
    t = t % 1000000007
print(t)


Measured memory_bytes: 20656
#include <bits/stdc++.h>
using namespace std;
#define __ <<' '<<
#define ___ <<' '
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define int long long

struct IoSetup {IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout <<fixed<<setprecision(12);
    cerr <<fixed<<setprecision(12);
}}IoSetup;

using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,1,0,-1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a<b?a=b,true:false);}
template<class T>bool chmin(T &a, const T &b){return(a>b?a=b,true:false);}
inline int qp(int a,ll b,int mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int n;
ll k;

int a[200200];

int d[200200];
int id[200200];
int st, en, l, mx;
bool dfs(int v) {
    auto u = a[v];
    if(d[u] == -1) {
        d[u] = d[v] + 1;
        id[d[u]] = u;
        return dfs(u);
    }
    else {
        st = u;
        en = v;
        l = d[en] - d[st] + 1;
        return true;
    }
    return false;
}

signed main() {


    cin >> n >> k;

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

    memset(d, -1, sizeof(d));

    d[1] = 0;
    id[0] = 1;

    bool f = dfs(1);
    
    if(k < d[en])
        cout << id[k] << endl;
    else {
        k -= d[st];
        ll t = k % l;
        cout << id[t + d[st]] << endl;
    }
    return 0;
}



Measured memory_bytes: 8280
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353


n = I()
s = S()
now = 0
ans = 0
for i in range(n - 1, -1, -1):
    if now >= i:
        print(ans)
        exit()
    if s[i] == "R":
        while s[now] != "W":
            now += 1
            if now >= i:
                print(ans)
                exit()
        now += 1
        ans += 1


Measured memory_bytes: 78156
//
//  main.cpp
//  backToProblemSolving
//
//  Created by Khaled Abdelfattah on 6/27/17.
//  Copyright © 2017 Khaled Abdelfattah. All rights reserved.
//

#include <bits/stdc++.h>
// #include <iostream>
using namespace std;
//#include "stdc++.h"

typedef long long ll;
#define MAX 1000000000
#define BASE1 23
#define BASE2 31
#define MOD1 1000000007
#define MOD2 217645177
#define eps 1e-6

int main() {
    int n;
    cin >> n;
    int arr[n];
    int occ[100005];
    memset(occ, 0, sizeof occ);
    for (int i = 0; i < n; i ++)
        cin >> arr[i], occ[arr[i]] ++;
    int res = INT_MIN;
    res = max(res, max(occ[0], occ[10004]));
    for (int i = 1; i < 100004; i ++)
        res = max(res, occ[i] + occ[i - 1] + occ[i + 1]);
    cout << res << endl;
    return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ld a, b;
  cin >> a >> b;
  ld ans = a * b + 1e-15;
  cout << (ll)floor(ans) << endl;

  return 0;
}


Measured memory_bytes: 3780
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  ll n,d,x,a;cin>>n>>d>>x;
  rep(i,n){
  	cin>>a;
  	x+=d/a+(d%a?1:0);
  }
  cout<<x<<endl;
  return 0;
}

Measured memory_bytes: 256
N, x = map(int, input().split())
a = list(map(int, input().split()))
sort_a = sorted(a)
count = 0
for y in range(len(sort_a)):
    if y != len(sort_a) - 1:
        if sort_a[y] <= x:
            x -= sort_a[y]
            count += 1
        else:
            break
    else:
        if sort_a[y] == x:
            count += 1

print(count)


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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    string s1, s2;
    while(true){
        cin >> s1;
        if(s1 == ".") break;
        cin >> s2;
        vector<string> st[2];
        string s_other[2] = {"", ""};
        string str = "";
        size_t addr = 0;
        while(addr < s1.size()){
            if(s1[addr] != '\"') s_other[0].push_back(s1[addr]);
            else{
                for(++addr;s1[addr]!='\"';++addr){
                    str.push_back(s1[addr]);
                }
                st[0].push_back(str);
                str = "";
                s_other[0].push_back('\"');
            }
            ++addr;
        }
        addr = 0;
        while(addr < s2.size()){
            if(s2[addr] != '\"') s_other[1].push_back(s2[addr]);
            else{
                for(++addr;s2[addr]!='\"';++addr){
                    str.push_back(s2[addr]);
                }
                st[1].push_back(str);
                str = "";
                s_other[1].push_back('\"');
            }
            ++addr;
        }
        //cerr << "-------------" << s_other[0] << "  " << s_other[1] << endl;
        if(s_other[0] == s_other[1]){
            int cnt = 0;
            for(int i=0;i<st[0].size();i++){
                if(st[0][i] != st[1][i]) cnt++;
                if(cnt > 1) break;
            }
            if(cnt == 0) printf("IDENTICAL\n");
            else if(cnt == 1) printf("CLOSE\n");
            else printf("DIFFERENT\n");
        }else{
            printf("DIFFERENT\n");
        }
    }
    
    return 0;
}


Measured memory_bytes: 3156
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        if (str.length() == 2)
            System.out.println(str);
        else
            for(int i=0; i<=2; i++){
            	System.out.print(str.charAt(2-i));
            }
            
    }
}

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

#define ll long long int
#define ld long double
#define pb push_back

ll mod = 1000000007;

using namespace std;

int main()
{

	 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	 int n,m;
	 cin>>n>>m;
	 std::map<ll, ll,greater<int>> map;
	 for (int i = 0; i < n; ++i)
	 {	
	 	int k ;
	 	cin>>k;

	 	map[k]++;
	 }

	 for (int i = 0; i < m; ++i)
	 {
	 	int b,c;
	 	cin>>b>>c;
	 	map[c] += b;
	 }

	 ll ans = 0;

	 for (auto i = map.begin(); i != map.end(); ++i)
	 {
	 	if(i->second <= n)
	 	{
	 		ans += i->first*i->second;
	 		n -= i->second;
	 	}
	 	else
	 	{
	 		ans += i->first*n;
	 		 n = 0;
	 	}


	 	if(n == 0)
	 		break;
	 }

	 cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 12800
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
#define int long long
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}
#define maxn 1000005
int n;
struct edge{
	int to,nxt;
}e[maxn<<1];
int tot,head[maxn];
inline void adde(int u,int v){
	e[++tot]=(edge){v,head[u]};
	head[u]=tot;
}
stack<int>s1,s2;
bool d[maxn],vis[maxn];
int res[maxn];
void dfs(int u,int pa)
{
	d[u]=d[pa]^1;
	(d[u]?s1:s2).push(u);
	for(int i=head[u];i;i=e[i].nxt)
		if(e[i].to!=pa)dfs(e[i].to,u);
}
signed main()
{
	n=read();
	For(i,2,n){
		int u=read(),v=read();
		adde(u,v);adde(v,u);
	}dfs(1,0);
	if(s1.size()>s2.size())swap(s1,s2);
	int c1=(n+2)/3,c2=(n+1)/3,c3=n/3;
	if(s1.size()<=c3){
		int x=0;
		while(!s1.empty()){
			x+=3;res[s1.top()]=x;
			s1.pop();vis[x]=1;
		}x=1;
		For(i,1,n)
			if(!res[i]){
				while(vis[x])x++;
				res[i]=x;x++;
			}
	}else{
		int x=-2;
		while(!s1.empty()){
			x+=3;res[s1.top()]=x;
			s1.pop();
		}
		x=-1;
		while(!s2.empty()){
			x+=3;res[s2.top()]=x;
			s2.pop();
		}
		x=0;
		For(i,1,n)
			if(res[i]>n)x+=3,res[i]=x;
	}
	For(i,1,n)cout<<res[i]<<' ';puts("");
    return 0;
}

Measured memory_bytes: 20788
use std::io::*;
use std::collections::BTreeSet;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn abc(x: i32, y: i32, mut X: Vec<i32>, mut Y: Vec<i32>) -> String {
    X.push(x);
    Y.push(y);
    X.sort();
    Y.sort();

    return if X.pop().unwrap() < *Y.first().unwrap() {"No War".to_string()} else {"War".to_string()}
}

fn main() {
    /*
    assert_eq!(abc(), "Yes");
    assert_eq!(abc(101), "No");
    assert_eq!(abc(999999999), "Yes");
    */
    input!{
        n: usize,
        m: usize,
        x: i32,
        y: i32,
        X: [i32; n],
        Y: [i32; m],
    }
    let result = abc(x, y, X, Y);
    println!("{}", result)
}

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

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

  int N, X;
  cin >> N >> X;

  int ans = 0;

  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    ans = __gcd(ans, X - x);
    X = x;
  }

  cout << abs(ans) << "\n";
}

Measured memory_bytes: 256
#i!/usr/bin/env python
# coding: utf-8

import sys
input = sys.stdin.readline

N, X = list(map(int, input().split()))
layers = [1]
patties = [1]
l = 1
p = 1
for _ in range(N):
    l = 2 * l + 3
    layers.append(l)
    p = 2 * p + 1
    patties.append(p)


def dfs(n, x):
    if n == 0:
        return patties[0]
    p = layers[n-1]
    if x == 1:
        return 0
    if x <= 1 + p:
        return dfs(n-1, x-1)
    if x == 1 + p + 1:
        return patties[n-1] + 1
    if x <= 1 + p + 1 + p:
        return patties[n-1] + 1 + dfs(n-1, x-(1+p+1))
    return patties[n]


def main():
    print(dfs(N, X))


if __name__ == '__main__':
    main()


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

int main(){
	int n; cin >> n;
	vector<int> a(n,0);
	for(int i=0;i<n;++i) cin >> a[i];
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	int alice=0;int bob=0;
	for(int i=0;i<n;++i){
		if(i==0 || i%2==0 ) alice+=a[i];
		else bob+=a[i];
	}
	cout << alice-bob << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main() {
  int a, b, t;
  cin >> a >> b >> t;
  cout << t / a * b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int calc(vector<int> a) {
    int n = a.size();
    int cnt = 0;
    rep(i, n-1) {
        if(a[i] == i+1) {
            swap(a[i], a[i+1]);
            cnt++;
        }
    }
    if(a.back() == n) cnt++;
    return cnt;
}

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    int ans = calc(a);
    reverse(all(a));
    rep(i, n) {
        a[i] = n - a[i] + 1;
    }
    ans = min(ans, calc(a));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
int64 ret[N];
int a[N];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int64 sum = 0;
  for (int i = 1; i < n; ++i) {
    if (a[i] > a[i - 1]) {
      sum += a[i] - a[i - 1];
    } else {
      sum += a[i] + m - a[i - 1];
    }
  }
  for (int i = 1; i <= m; ++i) ret[i] = sum;
  // trace(sum);
  vector<ii> A;
  for (int i = 1; i < n; ++i) {
    if (a[i - 1] < a[i]) {
      A.push_back({a[i - 1], 1});
      A.push_back({a[i], -a[i - 1]});
    } else {
      A.push_back({a[i - 1], 1});
      A.push_back({a[i] + m, -a[i - 1]});
    }
  }
  sort(A.begin(), A.end());
  int64 cnt = 0, acc = 0;
  for (int i = 1, j = 0; i <= m * 2; ++i) {
    for (; j < A.size() && A[j].first < i; ++j) {
      if (A[j].second > 0) {
        acc += A[j].first;
        ++cnt;
      } else {
        acc += A[j].second;
        --cnt;
      }
    }
    // trace(i, acc, cnt, cnt * i - acc - cnt);
    if (i > m) {
      ret[i - m] -= cnt * i - acc - cnt;
    } else {
      ret[i] -= cnt * i - acc - cnt;
    }
  }
  printf("%lld\n", *min_element(ret + 1, ret + m + 1));
  return 0;
}


Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <vector>

using namespace std;

void rotation_N(int* dise){
   int tmp[6];

   tmp[0] = dise[1];
   tmp[1] = dise[5];
   tmp[2] = dise[2];
   tmp[3] = dise[3];
   tmp[4] = dise[0];
   tmp[5] = dise[4];

   for(int i = 0; i < 6; i++){
      dise[i] = tmp[i];
   }
}
void rotation_E(int* dise){
   int tmp[6];

   tmp[0] = dise[3];
   tmp[1] = dise[1];
   tmp[2] = dise[0];
   tmp[3] = dise[5];
   tmp[4] = dise[4];
   tmp[5] = dise[2];

   for(int i = 0; i < 6; i++){
      dise[i] = tmp[i];
   }
}
void rotation_S(int* dise){
   int tmp[6];

   tmp[0] = dise[4];
   tmp[1] = dise[0];
   tmp[2] = dise[2];
   tmp[3] = dise[3];
   tmp[4] = dise[5];
   tmp[5] = dise[1];

   for(int i = 0; i < 6; i++){
      dise[i] = tmp[i];
   }
}
void rotation_W(int* dise){
   int tmp[6];

   tmp[0] = dise[2];
   tmp[1] = dise[1];
   tmp[2] = dise[5];
   tmp[3] = dise[0];
   tmp[4] = dise[4];
   tmp[5] = dise[3];

   for(int i = 0; i < 6; i++){
      dise[i] = tmp[i];
   }
}

void rotation_spin(int* dise){
   int tmp[6];

   tmp[0] = dise[0];
   tmp[1] = dise[2];
   tmp[2] = dise[4];
   tmp[3] = dise[1];
   tmp[4] = dise[3];
   tmp[5] = dise[5];

   for(int i = 0; i < 6; i++){
      dise[i] = tmp[i];
   }
}

int main(){
   int dise_a[6];
   int dise_b[6];
   int f_diff = 0;

   for(int i = 0; i < 6; i++){
      cin >> dise_a[i];
   }
   for(int i = 0; i < 6; i++){
      cin >> dise_b[i];
   }

   int cnt_cmd = 0;

   if(dise_a[0] == dise_b[1]){
      rotation_N(dise_b);
   }
   else if(dise_a[0] == dise_b[4]){
      rotation_S(dise_b);
   }

   while(dise_a[0] != dise_b[0]){
      rotation_E(dise_b);

      if(cnt_cmd > 4){
         cout << "No" << endl;
         return 0;
      }

      cnt_cmd++;
   }

   cnt_cmd = 0;

   while(dise_a[1] != dise_b[1]){
      rotation_spin(dise_b);

      if(cnt_cmd > 4){
         cout << "No" << endl;
         return 0;
      }

      cnt_cmd++;
   }

   for(int i = 0; i < 6; i++){
      if(dise_a[i] != dise_b[i]){
         cout << "No" << endl;
         return 0;
      }
   }

   cout << "Yes" << endl;

   return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	if (s.length() > t.length()) {
		cout << "GREATER" << endl;
	}
	else if (s.length() < t.length()) {
		cout << "LESS" << endl;
	}else if (s > t) {
		cout << "GREATER" << endl;
	}
	else if (s < t) {
		cout << "LESS" << endl;
	}
	else {
		cout << "EQUAL" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    edges = []
    M = N*(N-1)//2 - N//2
    
    if N%2 == 1:
        for i in range(1, N):
            for j in range(i+1, N+1):
                if i + j != N:
                    edges.append((i, j))
    else:
        for i in range(1, N):
            for j in range(i+1, N+1):
                if i + j != N + 1:
                    edges.append((i, j))
    print(M)
    for a, b in edges:
        print(a, b)
if __name__ == "__main__":
    main()

Measured memory_bytes: 3956
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<string>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,n) for(int i=1;i<=n;i++)

int main(){
	while(1){
	int n;
	scanf("%d",&n);
	if(n==0)break;
	int a=0,b=0;
	rep(i,n){
		int f,g;
		scanf("%d%d",&f,&g);
		
		if(f<g){
			a+=f+g;
		}
		if(f>g){
			b+=f+g;
		}
		if(f==g){
			a+=f;
			b+=g;
		}
	}
	printf("%d %d\n",b,a);
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long j = 1;
		for (int i = 1; i <= n; i++) {
			j *= i;
			j %= (1000000000 + 7);
		}
		System.out.println(j);	
	}
}


Measured memory_bytes: 21844
#[allow(unused_macros, dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
#[allow(unused_macros, dead_code)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
#[allow(unused_macros, dead_code)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        h: usize,
        w: usize,
        mut a: [[usize; w]; h]
    }

    let mut ans = vec![];

    for i in 0..h {
        for j in 0..(w - 1) {
            if (a[i][j]) % 2 == 1 {
                a[i][j + 1] += 1;
                ans.push((i, j, i, j + 1));
            }
        }
        if i + 1 < h {
            if a[i][w - 1] % 2 == 1 {
                a[i + 1][w - 1] += 1;
                ans.push((i, w - 1, i + 1, w - 1));
            }
        }
    }

    println!("{}", ans.len());
    for (i, j, k, l) in ans {
        println!("{} {} {} {}", i + 1, j + 1, k + 1, l + 1);
    }
}


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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<long long>
#define inf 1000000100

int main()
{
    int n;
    cin >> n;
    vi data;
    while(n--)
    {
        int a;
        cin >> a;
        data.pb(a);
    }
    ll sum1 = 0, sum2 = 0;
    ll ans1 = 0, ans2 = 0;
    for(int i = 0; i < data.size(); i++)
    {
        sum1 += data[i], sum2 += data[i];
        if(i%2 == 0)
        {
            if(sum1 <= 0)
            {
                ans1 += 1 - sum1;
                sum1 = 1;
            }
            if(sum2 >= 0)
            {
                ans2 += sum2 - (-1);
                sum2 = -1;
            }
        }
        else
        {
            if(sum1 >= 0)
            {
                ans1 += sum1 - (-1);
                sum1 = -1;
            }
            if(sum2 <= 0)
            {
                ans2 += 1 - sum2;
                sum2 = 1;
            }
        }
    }

    cout << min(ans1, ans2) << endl;
}


Measured memory_bytes: 892
import java.util.*;
import java.math.*;
public class Main {
	static int x;
	static int ans;
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long k = in.nextLong();
		int[] tp = new int[n + 1];
		int[] check = new int[n + 1];
		boolean[] check2 = new boolean[n + 1];
		for(int i = 1; i < n + 1; i++) tp[i] = in.nextInt();
		int cnt = 0;
		int cur = 1;
		int interval = 0;
		boolean flag = true;
		while(cnt < k) {
			if(cnt > 0) {
				if(check2[cur] == true) {
					interval = cnt - check[cur];
					flag = false;
					break;
				}
			}
			check[cur] = cnt;
			check2[cur] = true;
			cur = tp[cur];
			cnt += 1;
		}
		if(flag == true) {
			System.out.println(cur);
		}else {
			k -= cnt;
			k = k % interval;
			while(k > 0) {
				cur = tp[cur];
				k -= 1;
			}
			System.out.println(cur);
		}
	}
} 


Measured memory_bytes: 61340
n = int(input())
A = [int(a) for a in input().split()]
ans1,ans2 = 0,0
total1,total2 = 0,0

for i in range(n):
    total1 += A[i]
    if i % 2== 0 and total1 <= 0:
        diff = abs(total1) + 1
        total1 += diff
        ans1 += diff
    elif i % 2 == 1 and total1 >= 0:
        diff = abs(total1) + 1
        total1 -= diff
        ans1 += diff
        
for i in range(n):
    total2 += A[i]
    if i % 2== 1 and total2 <= 0:
        diff = abs(total2) + 1
        total2 += diff
        ans2 += diff
    elif i % 2 == 0 and total2 >= 0:
        diff = abs(total2) + 1
        total2 -= diff
        ans2 += diff
        
print(min(ans1,ans2))

Measured memory_bytes: 14468
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;long long k;
	cin>>s>>k;
	if(k == 1){
		cout<<s[0]<<endl;
		return 0;
	}
	else{
		for(int i = 0; i < s.size() && i < k; ++i){
			if(s[i] != '1'){
				cout<<s[i]<<endl;
				return 0;
			}
		}
		cout<<1<<endl;
	}
	return 0;
}

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

int main(void) {
  set<int> st;
  int a, b, c;
  cin >> a >> b >> c;
  st.insert(a); st.insert(b), st.insert(c);

  cout << st.size() << endl;
  return 0;
}

Measured memory_bytes: 256
N, K = gets.split.map!(&:to_i)
S = gets.chomp!.codepoints

L = 76
R = 82

SW = case [S[0], S[N-1]]
       when [L, R] then [R, L]
       when [L, L] then [R, L]
       when [R, L] then [L, R]
       when [R, R] then [L, R]
     end

ans = 0
0.upto(N-2) do |i|
  ans += 1 if S[i] == S[i+1]
end

k = K
1.upto(N-2) do |i|
  break if k <= 0

  if S[i] == SW[0] && S[i+1] == SW[1]
    ans += 2
    k -= 1
  end
end

if k > 0 && S[0] == SW[0]
  ans += 1
  k -= 1
end

if k > 0 && S[N-1] == SW[0]
  ans += 1
  k -= 1
end

puts ans


Measured memory_bytes: 2684
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
const double PI  = 3.1415926535897932384626433832795028841971;
const int    INF = 1000000007;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

int n;
int a[500000];
int cnt[3];

int main(){
    cin >> n;
    bool ok = false;
    rep(i,n){
        cin >> a[i];
        cnt[a[i]%3]++;
    }
    if(cnt[1] == 0 && cnt[2] == 0){
        cout << 1 << endl;
        return 0;
    }
    int ans = 0;
    ans += cnt[0];
    ans += min(cnt[1],cnt[2])*2+min(abs(cnt[1]-cnt[2]),3);
    cout << ans << endl;
}

Measured memory_bytes: 3116
#include<bits/stdc++.h>
#define int long long
#define v(T) vector<T>
#define vb vector<bool>
#define pi pair<int,int>
#define ppi pair<pair,int,int>, int>
#define vpi vector<pair<int,int>>
#define w(t) int t; cin>>t; while(t--)
#define FIO  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
void init() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int power(int x, unsigned int y)
{
	int res = 1;
	while (y > 0) {
		if (y & 1)
			res = res * x;

		y = y >> 1;
		x = x * x;
	}
	return res;
}
int gcd(int a, int b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
int32_t main() {
	FIO;
	int n, k; cin >> n >> k;
	bool f = 0;
	for (int i = 0; i <= n; i++) {
		if (((i * 2 + (n - i) * 2) == k)) {
			f = 1; break;
		}
		if (((i * 4 + (n - i) * 4) == k)) {
			f = 1; break;
		}
		if (((i * 2 + (n - i) * 4) == k)) {
			f = 1; break;
		}
		if (((i * 4 + (n - i) * 2) == k)) {
			f = 1; break;
		}
	}
	if (f) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main() {
    
    int n;
    int d1[110];
    int d2[110];
    int i, j;
    int count = 0;
    string ans = "No";

    cin >> n;
    for(i=0; i<n; i++){
    	cin >> d1[i] >> d2[i];
    }

    for(i=0; i<n; i++){
    	if(d1[i] == d2[i]){
    		count++;
    	} else{
    		count = 0;
    	}

    	if(count == 3){
    		ans = "Yes";
    		break;
    	}
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;



int main() {
  ll s;
  cin>>s;
  ll x1 = 1e9, x2 = 1;
  ll y2 = dup(s,x1), y1 = x1*y2-s;
  vl ans;
  ans.pb(0); ans.pb(0);
  ans.pb(x1); ans.pb(y1);
  ans.pb(x2); ans.pb(y2);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = [1]*(n+1)
    ans = 1
    for i in range(2, n+1):
        a[i] += 1
        ans += a[i]*i
        for j in range(i*2, n+1, i):
            a[j] += 1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 145904
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int N[1001]={0},M[1001]={0},N1,M1,point[1001]={0},o1=0,max=0;
	scanf("%d %d",&N1,&M1);
	for(int i=0;i<N1;i++){
		scanf("%d",&N[i]);
	}
	for(int i=0;i<M1;i++){
		scanf("%d",&M[i]);
		for(int i1=0;i1<N1;i1++){
			if(M[i]>=N[i1]){
				point[i1]++;
				break;
			}
		}
	}
	for(int i=0;i<N1;i++){
		if(max<=point[i]){
			max=point[i];
			o1=i+1;
		}
	}
	printf("%d\n",o1);
	return 0;
}

Measured memory_bytes: 1036
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

from collections import deque

def main():
	n=II()
	G=[[] for _ in range(n+1)]

	for _ in range(n-1):
		a,b=MI()
		G[a].append(b)
		G[b].append(a)
	#print(G)


	B=[-1]*(n+1)
	W=[-1]*(n+1)
	B[1]=0
	W[n]=0

	Q=deque([1])
	while Q:
		now=Q.popleft()
		for i in G[now]:
			if B[i]==-1:
				B[i]=B[now]+1
				Q.append(i)
	#print(B)

	Q=deque([n])
	while Q:
		now=Q.popleft()
		for i in G[now]:
			if W[i]==-1:
				W[i]=W[now]+1
				Q.append(i)
	#print(W)

	s=0
	f=0
	for i,j in zip(B[1:],W[1:]):
		if i<=j:
			f+=1
		else:
			s+=1
	#print(f,s)

	print("Fennec" if f>s else "Snuke")






if __name__ == "__main__":
	main()


Measured memory_bytes: 89704
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N;cin >> N;
    string S;cin >> S;

    stack<int> st;
    int ct = 0;
    rep(i,S.size()){
        if(S[i] == '('){
            st.push(0);
        }
        else{
            if(st.empty()){
                ct++;
            }
            else{
                st.pop();
            }
        }
    }
    rep(i,ct){
        cout << '('; 
    }
    rep(i,S.size()){
        cout << S[i];
    }
    rep(i,st.size()){
        cout << ')';
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string x;
	while(cin>>x){
		int sum;
		if(x[0]!='0'){	
		int l=x.length();
		sum=0;
			for(int i=0; i<l; i++){
			sum+=x[i]-'0';
			}
		}
		else{
			break;
			}
		cout<<sum<<endl;
		}
	}



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

pair<int,int> hikizan(pair<int,int> a,pair<int,int> b){
  pair<int,int> are;
  are.first=a.first-b.first;
  are.second=a.second-b.second;
  return are;
}

int main(){
  int n;cin>>n;
  vector<pair<int,int> > c(n);
  for(int i=0;i<n;i++){
    cin>>c.at(i).first>>c.at(i).second;
	}//definition
  if(n==1){
    cout<<1<<endl;return 0;
  }

  vector<pair<int,int> > sub;
  int cost=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i!=j){
        sub.push_back(hikizan(c.at(i),c.at(j)));
      }
    }
  }
sort(sub.begin(),sub.end());
pair<int,int> freq,bef(0,0);
int coun=0,counmax=1;
for(int i=0;i<int(sub.size());i++){
	if(bef!=sub.at(i)){
		bef=sub.at(i);
		coun=1;
	}else{
		++coun;
		if(counmax<coun){
			counmax=coun;
		}
	}
}
cout<<n-counmax<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main()
{
	/*int s, w;
	cin >> s >> w;
	if (w >= s)puts("unsafe");
	else puts("safe");*/


	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if ((c + b - 1) / b <= (a + d - 1) / d)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    string s; cin >> s;
    string t; cin >> t;
    cout << t << s << endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> P(N), Q(N), R(N);
  for (int i = 0; i < N; i++) cin >> P.at(i);
  for (int i = 0; i < N; i++) cin >> Q.at(i);
  iota(R.begin(), R.end(), 1);
  
  int a, b, j = 0, cnt_a = 0, cnt_b = 0;
  do {
    int k = 0;
    cnt_a = 0; cnt_b = 0;
    for(auto x : R) {
      if (x != P.at(k) && x != Q.at(k)) break;
      if (x == P.at(k)) cnt_a++;
      if (x == Q.at(k)) cnt_b++;
      k++;
    }
    if (cnt_a == N) a = j;
    if (cnt_b == N) b = j;
    j++;
  } while(next_permutation(R.begin(), R.end())); 
  
  cout << abs(a - b);
  return 0;
}


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

int main(){
	int W, H, x, y, r;
	string s;

	cin >> W >> H >> x >> y >> r;

	if (r <= x && r <= y && x <= (W - r) && y <= (H - r))
		s = "Yes";
	else
		s = "No";

	cout << s << endl;
	return 0;
}

Measured memory_bytes: 1196
// https://atcoder.jp/contests/abc074/tasks/abc074_b

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        ans += min(x, k - x);
    }
    ans *= 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    private static Scanner sc=new Scanner(System.in);
    private static final int MINF=-1000000000;
    public static void main(String[] args){
        int n=sc.nextInt();
        int[] r=new int[n];
        for(int i=0;i<n;i++) r[i]=sc.nextInt();
        int max=MINF;
        int maxp=MINF;
        for(int i=n-2;i>=0;i--){
            max=Math.max(max,r[i+1]);
            maxp=Math.max(maxp,max-r[i]);
        }
        System.out.println(maxp);
    }
}

Measured memory_bytes: 102240
#include <stdio.h>
int main() {
    int n, a1, a2;
    long long ans = 0;
    scanf("%i%i", &n, &a1);
    while (--n) {
        scanf("%i", &a2);
        if (a2 < a1) {
            ans += a1 - a2;
        }
        else a1 = a2;
    }
    printf("%lli", ans);
}


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

typedef long long ll;
const ll MOD = ll(1e9) + 7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  srand(1223);
  string str;
  cin >> str;
  cout << str.substr(0,4) + " " << str.substr(4) << endl;
  return 0;
};

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

using namespace std;

int n;
double a[1010];
double b[1010];
double ans1, ans2, ans3, ans4;
int main()
{
    cin >> n;
    double max = -1;
    for (int i = 0; i < n; i++)
        scanf("%lf", &a[i]);
    for (int i = 0; i < n; i++)
        scanf("%lf", &b[i]);
    for (int i = 0; i < n; i++)
    {
        double tmp = abs(a[i] - b[i]);
        ans1 += tmp;
        if (tmp > max)
        {
            max = tmp;
        }
    }
    for (int i = 0; i < n; i++)
    {
        ans2 += (a[i] - b[i]) * (a[i] - b[i]);
    }
    ans2 = sqrt(ans2);
    for (int i = 0; i < n; i++)
    {
        ans3 += abs((a[i] - b[i]) * (a[i] - b[i]) * (a[i] - b[i]));
    }
    ans3 = pow(ans3, (double)1 / 3);
    ans4 = max;
    printf("%.6f\n", ans1);
    printf("%.6f\n", ans2);
    printf("%.6f\n", ans3);
    printf("%.6f\n", ans4);
}


Measured memory_bytes: 3416
#include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<vector>
 
using namespace std;
  
int main(){
    double n, x, y;cin >> n;
    vector<double> xi;
    vector<double> yi;
    double D = 0.0;
    for(int i = 0; i < n; i++){
        cin >> x;
        xi.push_back(x);
    }
    for(int i = 0; i < n; i++){
        cin >> y;
        yi.push_back(y);
    }
    //p=1
    for(int i = 0; i < n; i++){
    D = abs(xi[i] - yi[i]) + D;
    }
    cout << fixed << D << endl;
    //p=2
    D=0.0;
    for(int i = 0; i < n; i++){
    D = pow(abs(xi[i] - yi[i]), 2.0) + D;
    }
    cout << fixed << sqrt(D) << endl;
    //p=3
    D = 0.0;
    for(int i = 0; i < n; i++){
    D = pow(abs(xi[i] - yi[i]), 3.0) + D;
    }
    cout << fixed << pow(D, 1.0 / 3.0) << endl;
    //p=mugen
    D = 0.0;
    for(int i = 0; i < n; i++){
        D = max(D, abs(xi[i] - yi[i]));
    }
    cout << fixed << D << endl;
    return 0;
}
         
     


Measured memory_bytes: 3468
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#define eps 1.0e-9
using namespace std;
int n,m;
double r[2333],w[20];
bool vis[555],g[20][555];
struct point
{
    double x,y,z;
}p[2333],q[20],e;
double sgn(double f)
{
    if(fabs(f)<eps) return 0;
    else return f<0?-1:1;
}
double dis(point a,point b) {return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z);}
int check(point p,point c,double r)
{
    int d=dis(p,c);
    if(d<r*r) return -1;
    else if(d==r*r) return 0;
         else return 1;
}
bool cal(double a,double b,double c)
{
    double delt=b*b-4*a*c;
    if(delt<=0) return false;
    else
    {
        delt=sqrt(delt);
        double x1=(-b+delt)/(2*a),x2=(-b-delt)/(2*a);
        if((sgn(x1)>0&&sgn(x1-1)<0)||(sgn(x2)>0&&sgn(x2-1)<0)) return true;
        else return false;
    }
}
void init()
{
    memset(g,0,sizeof(g));
    for(int i=0;i<m;i++)
    {
        if(e.x==q[i].x&&e.y==q[i].y&&e.z==q[i].z) continue;
        for(int j=0;j<n;j++)
        {
            int a=check(e,p[j],r[j]),b=check(q[i],p[j],r[j]);
            //if(a==0||b==0) continue;
            double ka,kb,kc;
            ka=dis(e,q[i]);
            kb=2*((e.x-p[j].x)*(q[i].x-e.x)+(e.y-p[j].y)*(q[i].y-e.y)+(e.z-p[j].z)*(q[i].z-e.z));
            kc=dis(e,p[j])-r[j]*r[j];
            if(cal(ka,kb,kc)) g[i][j]=1;
        }
    }
}
int main()
{
    int N;
    while(scanf("%d%d%d",&n,&m,&N)==3)
    {
        if(n==0&&m==0&&N==0) break;
        for(int i=0;i<n;i++) scanf("%lf%lf%lf%lf",&p[i].x,&p[i].y,&p[i].z,&r[i]);
        for(int i=0;i<m;i++) scanf("%lf%lf%lf%lf",&q[i].x,&q[i].y,&q[i].z,&w[i]);
        scanf("%lf%lf%lf",&e.x,&e.y,&e.z);
        init();
        int M=1<<m;
        double ans=0,tb[20];
        for(int i=0;i<m;i++) tb[i]=w[i]/dis(e,q[i]);
        for(int i=1;i<M;i++)
        {
            memset(vis,0,sizeof(vis));
            int cnt=0;
            bool ok=true;
            double tp=0;
            for(int j=0;j<m;j++)
            {
                if((i&(1<<j))==0) continue;
                for(int k=0;k<n;k++)
                {
                    if(vis[k]) continue;
                    if(g[j][k])
                    {
                        vis[k]=true;
                        cnt++;
                        if(cnt>N)
                        {
                            ok=false;
                            break;
                        }
                    }
                }
                if(!ok) break;
                tp+=tb[j];
            }
            if(ok) ans=max(ans,tp);
        }
        printf("%.10f\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1332
#include <stdio.h>
int main(){
	int earn = 0, x, y, ganha[] = {400000, 300000, 200000, 100000};
	scanf("%d%d", &x, &y);
	if(x < 4)
		earn += ganha[x];
	if(y < 4)
		earn += ganha[y];
	if(x == y && x == 1)
		earn += ganha[0];
	printf("%d\n", earn);
}

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

#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define ALL(obj) (obj).begin(),(obj).end()
#define space <<" "<<
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
#define FIX <<fixed<<setprecision(10)<<
using namespace std;

using ll = long long; using ull = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;

const ll MOD = 1e9+7;

int n;

double D(double x[],double y[],double p){
double d=0;
if(p==4){
vector<double> di(n);
REP(i,n)di[i]=abs(x[i]-y[i]);
double res = di.at(0); 
REP(i,n)if(res<=di.at(i))res=di.at(i);
return res;
}else{
REP(i,n)d+=pow(abs(x[i]-y[i]),p);
return pow(d,1/p);
}
}


int main(){
cin>>n;
double x[n],y[n];
REP(i,n)cin>>x[i];
REP(i,n)cin>>y[i];
cout FIX D(x,y,1) <<endl<< D(x,y,2) <<endl<< D(x,y,3) <<endl<< D(x,y,4)<<endl; 
}



Measured memory_bytes: 3436
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int n;
bool vis[10];

vector<vector<int>> all;

void solve(int cur, vector<int> &v){
	if(cur == n){
		all.push_back(v);
		return;
	}
	for(int i = 1; i <= n; i++){
		if(!vis[i]){
			v[cur] = i;
			vis[i] = 1;
			solve(cur+1,v);
			vis[i] = 0;
		}
	}
}



int32_t main(){
	cin >> n;
	vector<int> a(n), b(n);
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++)
		cin >> b[i];
	vector<int> v(n,0);
	solve(0,v);
	int l = -1, r = -1;
	for(int i = 0; i < all.size(); i++){
		if(a == all[i])
			l = i;
		if(b == all[i])
			r	 = i;
		
	}
	cout << abs(l-r) << endl;

	return 0;
}



Measured memory_bytes: 4404