akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b;
	string s;
	cin >> s;
	a = (s[0] - '0') * 10 + s[1] - '0';
	b = (s[2] - '0') * 10 + s[3] - '0';
	int flag1 = a >= 1 && a <= 12;
	int flag2 = b >= 1 && b <= 12;
	if (flag1 && flag2) puts("AMBIGUOUS");
	else if (flag2) puts("YYMM");
	else if (flag1) puts("MMYY");
	else puts("NA");
	return 0;
}

Measured memory_bytes: 256
S = input()
w = input()

S_len = len(S)

n = int(S_len)//int(w)
n_sub = int(S_len)%int(w)

if n_sub != 0:
    n += 1

S_ans = []
temp = 0
for i in range(n):
    S_ans.append(S[(i)*(int(w))])
    temp += 1
    if temp == n:
        break

mojiretu = ''
for x in S_ans:
    mojiretu += x

print(mojiretu)

Measured memory_bytes: 3064
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
using namespace std;
#define _GLIBCXX_DEBUG
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vit vector<lint>::iterator
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define mod 1000000007
#define graph_set(n) struct edge{int to,int cost;} vector<edge> G((n))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define range(x,y) ((x) >= 0 && (x) < h && (y) >= 0 && (y) < w)
#define pyes cout << "Yes" << endl
#define pno cout << "No" << endl
typedef vector<long long> vi;
typedef vector<pair<long long, long long>> vp;
typedef vector<vector<long long>> vvi;
typedef pair<long long, long long> pi;
typedef long long lint;
typedef long long ll;
lint qp(int a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
lint qp(int a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
lint gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
long long INF = 1e14;


int main() {
	ll n; cin >> n;
	map<int,int> p; rep(n) { int x; cin >> x; p[--x] = i; }
	vi a(n), b(n),c(n);
	rep(n) a[i] = 1 + i*(20005);
	int amax = a[n - 1];
	rep(n) b[i] = 1 + (amax + p[i]) - a[i];

	rep(n) cout << a[i] << " ";
	cout << endl;
	rep(n) cout << b[i] << " ";
	cout << endl;
	return 0;
}

Measured memory_bytes: 2048
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>

#define rep(i,n,m) for(int i=n;i<(int)(m);i++)

using namespace std;

int main() {

	int m,tmp;
	
	string str;
	cin >> str;
	cin >> m;

	vector<int>num(10);
	rep(i, 0, 10) {
		num[i] = i;
	}

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

	rep(i, 0, m) {
		cin >> tmp;
		num[tmp] = 9;
	}

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

	char numb[10] ;
	rep(i, 0, 10 - m) {
		string tmps = to_string(num[i]);
		numb[i] = tmps[0];
	}
	
	int res = 0;

	rep(i, 0, str.size()) {
		bool ch = false;	
		int k = 0;
		if (stoi(str) <= res) {
			rep(v, 0, str.size() - i) {
				int tnp = (int)(numb[0] - '0');
				res += tnp * pow(10, str.size() - i - 1-v);
			}
			break;
		}
		while (ch!=true&&k<10-m){

			if (str[i] <= numb[k]) {
				int tnp = (int)(numb[k] - '0');
				res += tnp * pow(10,str.size()-i-1);
				ch = true;
			}

			k++;
		}

	}


	if (res < stoi(str)) {
		int tnp = (int)(numb[0] - '0');
		if (tnp != 0) {
			res = tnp * pow(10, str.size());
		}
		else {
			tnp = (int)(numb[1] - '0');
			res = tnp * pow(10, str.size());
		}

		rep(v, 0, str.size()) {
			int tnp = (int)(numb[0] - '0');
			res += tnp * pow(10, str.size() - 1 - v);
		}



	}


	

		cout<<res<<endl;
		

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);
 
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;
 
constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;
 
template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
	ll H,W; cin >> H >> W;
	corner(H==1 || W==1,1);
	if(H%2 && W%2) cout << (H*W)/2 + 1 << endl;
	else cout << (H*W)/2 << endl;
    return 0;
}


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

int main(int argc, const char * argv[]) {
    string s;
    int a[3] = {};
    cin >> s;
    for (int i = 0; i < 3; i++) {
        if (s[i] == 'a') {
            a[0] = 1;
        }else if (s[i] == 'b') {
            a[1] = 1;
        }else if (s[i] == 'c') {
            a[2] = 1;
        }
    }
    bool flag = true;
    for (int i = 0; i < 3; i++) {
        if (a[i] != 1) {
            flag = false;
        }
    }
    if (flag) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		String s = sc.next();
		if(a >= 3200) {
			System.out.println(s);
		}else {
			System.out.println("red");
		}
		sc.close();
	}
}

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

int main() {
    int max = 0;
    cin >> max;

    char list[4];
    list[0] = 'P';
    list[1] = 'W';
    list[2] = 'G';
    list[3] = 'Y';
    bool ans[4];
    for (int n = 0; n < 4; n++) {
        ans[n] = false;
    }

    for (int n = 0; n < max; n++) {
        char w;
        cin >> w;
        for (int n = 0; n < 4; n++) {
            if (ans[n]) continue;
            if (w == list[n]) {
                ans[n] = true;
                break;
            }
        }
    }

    int count = 0;
    for (int n = 0; n < 4; n++) {
        if (ans[n]) count++;
    }

    if (count == 3) cout << "Three" << endl;
    if (count == 4) cout << "Four" << endl;
}


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

int main(){
    string s;
    char s1, s2;
    int c=0;
    bool answer=false;

    cin >> s;
    for(int i = 0; i < 4; i++){
        s1 = s.at(i);
        for(int j = i + 1; j < 4; j++){
            s2 = s.at(j);
            if(s1 == s2){
                c++;
            }
        }
    }
    if(c==2){
        answer = true;
    }

    if(answer == true)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

typedef struct {
	int N;
	int *u;
	int *u_rank;
}union_find;

union_find *make_union_find(int N){
	int i;
	union_find *uf = (union_find *)malloc(sizeof(union_find));
	uf->N = N;
	uf->u = (int *)malloc(sizeof(int) * N);
	uf->u_rank = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		(uf->u)[i] = i;
		(uf->u_rank)[i] = 1;
	}
	return uf;
}

int root_uf(int x, union_find *uf){
	int *u = uf->u;
	if(u[x] == x){
		return x;
	}
	else{
		u[x] = root_uf(u[x], uf);
		return u[x];
	}
}

void combine_uf(int x, int y, union_find *uf){
	int x_root = root_uf(x, uf);
	int y_root = root_uf(y, uf);
	int *u = uf->u;
	int *u_rank = uf->u_rank;
	if(x_root == y_root){
		return;
	}
	else if(u_rank[x_root] < u_rank[y_root]){
		u[x_root] = y_root;
		u_rank[y_root] += u_rank[x_root];
		u_rank[x_root] = 0;
	}
	else{
		u[y_root] = x_root;
		u_rank[x_root] += u_rank[y_root];
		u_rank[y_root] = 0;
	}
}

//xとyが同じ集合に属していれば1を,そうでなければ0を返す
int is_same_union_uf(int x, int y, union_find *uf){
	if(root_uf(x, uf) == root_uf(y, uf)){
		return 1;
	}
	else{
		return 0;
	}
}

//xが属する集合の要素数を返す
int rank_uf(int x, union_find *uf){
	return (uf->u_rank)[root_uf(x, uf)];
}

int main(){
	int N, M, x, y, i, ans = 0;
	scanf("%d%d", &N, &M);
	int *p = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &p[i]);
		p[i]--;
	}
	union_find *uf = make_union_find(N);
	for(i = 0; i < M; i++){
		scanf("%d%d", &x, &y);
		combine_uf(x - 1, y - 1, uf);
	}
	for(i = 0; i < N; i++){
		if(root_uf(i, uf) == root_uf(p[i], uf)){
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>

using namespace std;

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


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

using namespace std;
using ll=long long;

#define PRI(n) cout << n <<endl;
#define PRI2(n, m) cout << n << " " << m << endl;
#define PRI3(n, m, o) cout << n << " " << m<< " " << o << endl;

#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define REPInv(i, n)  for(int i = n-1; i >= 0; --i)

#define FOR(i, t, n)  for(int i = t; i <= (int)n; ++i)
#define FORInv(i, t, n)  for(int i = t; i >= (int)n; --i)

const char alphabet[26] = {'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', 'z'};
const ll MOD = 1e9 + 7;

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

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

ll nCr(int n, int r) {
    vector<ll> C(r + 1);
    C[0] = 1;
    FOR(i, 1, n) FORInv (j, min(i, r), 1)C[j] = (C[j] + C[j - 1]) % MOD;
    return C[r];
}

int N;
string S;

int main() {
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];
    sort(A.begin(), A.end());
    int cnt = N;
    while (cnt != 1) {
        cnt = 1;
        FOR(i, 1, A.size() - 1) {
            if (A[i] == 10000000000)break;
            if (A[i] % A[0] != 0) A[i] = A[i] % A[0];
            else A[i] = 10000000000;
            cnt++;
        }
        sort(A.begin(), A.end());
    }
    cout << A[0] << endl;
    return 0;
}

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

using namespace std;

int main(){
    long long w, h, x, y;
    scanf("%lld %lld %lld %lld", &w, &h, &x, &y);
    printf("%.10lf %d\n", (w * h)/2.0, x == (w / 2.0) && y == (h / 2.0)? 1 : 0);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int dp[2][10010][2];
int cost[10010];
int main()
{
	int n;
	cin >> n;
	for(int i=1;i<=n-1;i++)
	{
		cin >> cost[i];
	}
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<10010;j++)
		{
			for(int k=0;k<2;k++)
			{
				dp[i][j][k]=INF;
			}
		}
	}
	dp[1][1][0]=dp[1][0][1]=0;
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			dp[(i+1)%2][j+1][0]=min(dp[i%2][j][0],dp[i%2][j][1]+cost[i]);
			dp[(i+1)%2][j][1]=min(dp[i%2][j][1],dp[i%2][j][0]+cost[i]);
		}
	}
	cout << min(dp[(n-2)%2][n/2][0],dp[(n-2)%2][n/2][1]) << endl;
	return 0;
}

Measured memory_bytes: 1356
#include <iostream>
using namespace std;
int main(){
    long long N;

    cin >> N;

    long long total = N*(N+1)/2;

    long long N3 = N/3;
    long long N5 =N/5;
    long long N15 = N/15;

    long long total3 = 3*N3*(N3 + 1)/2;  
    long long total5 = 5*N5*(N5+1)/2;
    long long total15 = 15*N15*(N15 + 1)/2;

    total = total -total3 -total5 + total15;

    cout << total <<endl;

    return 0;

}

Measured memory_bytes: 3612
/**
 *      ABC 57 C
 *      author  : kyomukyomupurin
 *      created : 2018-09-08 00:49:19
**/

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

bool isPrime(long long x){      // 素数判定
    long long square = sqrt(x);
    if (x == 2) return true;
    else if (x % 2 == 0) return false;
    for (long long i = 3; i <= square; i += 2) {
        if (x % i == 0){
            return false;
        }
    }
    return true;
}

long long nearSquare(long long x){      // xの最も平方根に近くて小さいほうの約数を返す
    long long nearSquare = floor(sqrt(x));
    return nearSquare;
}

long long digits(long long x){      // 桁数を返す
    long long digits = 1;
    while (x / 10 > 0){
        x /= 10;
        ++digits;
    }
    return digits;
}

int digits2(long long x){
    string s = to_string(x);
    int sizes = s.size();
    return sizes; 
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    long long N; cin >> N;
    if (isPrime(N)){
        cout << digits2(N) << endl; return 0;
    }

    long long start = nearSquare(N);
    for (long long i = start; i >= 1; --i) {
        if (N % i == 0){
            cout << digits2(N / i) << endl; return 0;
        }    
    }
    
}

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

int main()
{
	int n, k;
	cin >> n;
	long long ti, ai, lastti, lastai;
	cin >> ti >> ai;
	long long mincur = ti + ai;
	lastti = ti;
	lastai = ai;
	for (int i = 1; i < n; ++i)
	{
		cin >> ti >> ai;
		if (ti >= lastti && ai >= lastai)
		{
			mincur = ti + ai;
			lastti = ti;
			lastai = ai;
		}
		else
		{
			long long nt = lastti / ti, na = lastai / ai;
			if (lastti % ti)
				nt += 1;
			if (lastai % ai)
				na += 1;
			long long nmax = max(nt, na);
			mincur = (ti + ai) * nmax;
			lastti = ti * nmax;
			lastai = ai * nmax;
		}
	}
	cout << mincur << endl;
	//system("pause");
	return 0;
}

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

int main(){
  int N,W,H;
  int S,T;
  int x,y;
  int i,j,k;
  int count;
  int kaki_x[501];
  int kaki_y[501];
  int max;

  while(1){
    cin >> N;
    if(N ==0){
      break;
    }

    cin >> W >> H;

    for(i = 1 ; i <= N ; i++){
      cin >> x >> y;
      kaki_x[i]=x;
      kaki_y[i]=y;
    }

    cin >> S >> T;

    max = -1000000;

    for(i = 1 ; i <= H ; i++){
      for(j = 1 ; j <= W ; j++){
	count = 0;
	for(k = 1 ; k <= N ; k++){
	  if(kaki_y[k] >= i && kaki_y[k] < T+i && kaki_x[k] >= j && kaki_x[k] < S+j){
	    count++;
	  }
	  if(max < count){
	    max = count;
	  }
	}
      }
    }
    cout << max << endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<string>
#include<math.h>
#include<map>
using namespace std;
int main()
{
	int N;
	int a_1 = 0;
	int a_2 = pow(10, 9) + 1;
	int kari_a_1;
	int kari_a_2;
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> kari_a_1 >> kari_a_2;
		if (kari_a_2 < a_2) {
			a_1 = kari_a_1;
			a_2 = kari_a_2;
		}
	}
	cout << a_1 + a_2 << endl;
}

Measured memory_bytes: 256
import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
  [n, a, b] <- map read . words <$> getLine
  let as = [map (\a -> read [a] :: Integer) (show x) | x <- [0, 1 .. n]]
  print
    $ sum . map (read . concatMap show)
    $ filter (\l -> sum l >= a && sum l <= b) as

Measured memory_bytes: 1020
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b)
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

int main()
{
	int n;
	cin >> n;
	int min = n + 1;
	int r = 0;
	for (int i = 0; i < n; i++)
	{
		int in;
		cin >> in;
		if (in < min)
			min = in;
		if (in <= min)
			r++;
	}

	printf("%d", r);
	return 0;
}


Measured memory_bytes: 256
{
  const Main = input => {
    const n: number = parseInt(input.trim());
    const mod: number = 10 ** 9 + 7

    let power: number = 1
    for (let i = 1; i <= n; i++) {
      power = power * i % mod
    }

    console.log(power)
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}


Measured memory_bytes: 33064
a,b,c,d=map(int,input().split())
B=b
A=a-1
def gcd(x,y):
    while y!=0:
        x,y=y,x%y
    return x
def mm(x,y):
    return int(x*y/gcd(x,y))
m_B=B-B//c-B//d+B//mm(c,d)
m_A=A-A//c-A//d+A//mm(c,d)
print(m_B-m_A)

Measured memory_bytes: 3064
#include<stdio.h> 
int main()
{
	int a[105],i,n;
	scanf("%d",&n);

	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(i=n;i>1;i--)
		printf("%d ",a[i]);
	printf("%d\n",a[1]);
	
	return 0;
}


Measured memory_bytes: 2120
n = int(input())
A_list = list(map(int, input().split()))
for i in range(n):
    A_list[i] -= i
A_list.sort()

def sadness(a, mid):
    sad = 0
    for i in range(mid):
        sad += a[mid] - a[i]
    for i in range(mid+1,len(a)):
        sad += a[i] - a[mid]
    return sad

if n % 2 != 0:
    print(sadness(A_list, n//2))
else:
    print(min(sadness(A_list, n//2), sadness(A_list, n//2+1)))


Measured memory_bytes: 26180
#include<stdio.h>
#include <iomanip>
#include <iostream>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include <random>
#include <chrono>

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

using namespace std;
int main() {
	long long n;
	
	cin >> n;
	long long ans;
	ans = n * (n - 1) / 2;
	cout << ans;

}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    cout << (N - 1) * (M - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, start, stop) for (int i = start; i < stop; i++)
#define FORR(i, start, stop) for (int i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<int>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<ll>());
#define REMOVE(v,n) remove(vector<int> v,v+v.size(),int n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }

//vector< vector<int> > v (size1, vector<int>(size2) );
// Combination Table
ll Com[51][51]; // C[n][k] -> nCk
void comb_table(ll N){
    for(int i=0;i<=N;++i){
        for(int j=0;j<=i;++j){
            if(j==0 or j==i){
                Com[i][j]=1LL;
            }else{
                Com[i][j]=(Com[i-1][j-1]+Com[i-1][j]);
            }
        }
    }
}

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

    ll N,A,B,C;
    cin>>N>>A>>B;
    C=B-A;
    comb_table(N);
    vector<ll> v(N);
    FOR(i,0,N) cin>>v[i];
    VSORTR(v);
    ll cnt=1;
    vector<LP> Set={};
    LP lp;
    FOR(i,0,N-1){
        if(v[i]==v[i+1]) cnt++;
        else {
            lp=make_pair(v[i],cnt);
            Set.pb(lp);
            cnt=1;
        }
    }
    lp=make_pair(v[N-1],cnt);
    Set.pb(lp);
    double max_average=0.0;
	for(int i=0;i<A;++i){	
		max_average+=v[i];
	}
	max_average/=A;
    

    ll sa,al;
    
    //float sum=0.0f;
    
    /*FOR(i,0,Set.size()){
        cout<<Set[i].first<<' '<<Set[i].second<<endl;
    }
    cout<<endl;*/
    
    bool f=true;

    if(Set[0].second>=A) f=false;
    FOR(i,0,Set.size()){
        if(Set[i].second<=A){
            A-=Set[i].second;
            //sum+=Set[i].second*Set[i].first;
        }
        else{
            sa=A;
            al=Set[i].second;
            //sum+=Set[i].first*sa;
            break;
        }
    }

    ll ans=0;
    if(f)ans+=Com[al][sa];
    else{
        FOR(i,sa,min(al,sa+C)+1){
            //cout<<al<<' '<<i<<' '<<Com[al][i]<<endl;
            if(i!=0)ans+=Com[al][i];
        }
    }
    cout.precision(20);
    cout<<fixed<<max_average<<endl;
    cout<<ans<<endl;
}
//109,110行目注意

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstdio>
using namespace std;
char N[5];
int main(){
    cin >> N;
    for(int i =0;i<4;i++){
        if(N[i]==N[i+1]){
            printf("Bad\n");
            return 0;
        }
    }
    printf("Good\n");
    return 0;
}

Measured memory_bytes: 3488
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
class Combination {
    int powmod(int a, int p) {
        int ans = 1;
        int mul = a;

        for (; p > 0; p >>= 1, mul = (mul * mul) % mod) {
            if ((p & 1) == 1) ans = (ans * mul) % mod;
        }

        return ans;
    }
public:
    int N;
    int mod;
    vector<int> fact;
    vector<int> revFact;

    Combination(int n, int m) : N(n), mod(m), fact(n+1), revFact(n+1) {
        fact[0] = 1;
        for (int i = 1; i <= N; i++) {
            fact[i] = fact[i-1] * i;
            fact[i] %= mod;
        }

        // Fermat's little theorem
        revFact[N] = powmod(fact[N], mod - 2);

        for (int i = N-1; i >= 0; i--) {
            revFact[i] = revFact[i+1] * (i+1);
            revFact[i] %= mod;
        }
    }

    int get(int a, int b) {
        if (a < 0 || b < 0) return 0;
        if (b > a) return 0;
        return (((fact[a] * revFact[b]) % mod) * revFact[a-b]) % mod;
    }
};

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

    int A[n+1];
    map<int, int> m;
    int dup = -1;
    for (int i = 0; i < n + 1; i++) {
        cin >> A[i];
        m[A[i]]++;
        if (m[A[i]] == 2) dup = A[i];
    }

    int left_idx = -1;
    int right_idx = -1;
    for (int i = 0; i < n + 1; i++) {
        if (A[i] == dup) {
            if (left_idx == -1) {
                left_idx = i;
            } else {
                right_idx = i;
            }
        }
    }

    int mid = right_idx - left_idx - 1;
    int right = n - right_idx;
    int left = left_idx;
    int side = right + left;
    Combination comb = Combination(n, MOD);

    for (int k = 1; k <= n + 1; k++) {
        int ret = 0;

        if (n - 1 >= k) {
            ret += comb.get(n - 1, k);
            ret %= MOD;
        }

        if (n >= k) {
            ret += 2 * comb.get(n - 1, k - 1);
            ret %= MOD;
        }


        if (side >= k - 1) {
            ret -= comb.get(side, k - 1);
            ret += MOD;
            ret %= MOD;
        }

        if (k >= 2) {
            ret += comb.get(n - 1, k - 2);
            ret %= MOD;
        }

        cout << ret << endl;
    }

    return 0;
}

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

ll n,p,a[55],o[55],e[55];

int main(){
	cin>>n>>p;
	for (int i = 0; i < n; i++){
		cin>>a[i];
	}
	e[0]=1;
	for (int i = 0; i < n; i++){
		if(a[i]%2){
			o[i+1]=o[i]+e[i];
			e[i+1]=e[i]+o[i];
		}
		else {
			o[i+1]=2*o[i];
			e[i+1]=2*e[i];
		}
	}
	if(p==0)cout<<e[n]<<endl;
	else cout<<o[n]<<endl;
	return 0;
}


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

int  main(void) {
	int a, b;
	string s;
	cin >> a>>b>>s;
	b = b - 1;
	if (s[b] == 'A') {
		s[b] = 'a';
	}
	else if (s[b] == 'B') {
		s[b] = 'b';
	}
	else if (s[b] == 'C') {
		s[b] = 'c';
	}
	cout << s << endl;
	

}


Measured memory_bytes: 256
/* Manish Pant - insider_pants, hello_my_friend */
    
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define endl "\n"
#define pb push_back

typedef long long ll;
typedef long double ldob;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T> ostream& operator << (ostream &os, const multiset<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.F << ' ' << v.S; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.F << " => " << i.S << ')' << ' '; return os; } 

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

int main()
{
    fast();
    int k, a, b; cin >> k; cin >> a >> b;

    if(a % k == 0)
    {
        cout << "OK\n";
        return 0;
    }

    int mx = k * (a / k + 1);
    if(mx <= b) cout << "OK\n";
    else cout <<"NG\n";
}

Measured memory_bytes: 3652
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//do {
//    print(v);
//  } while (std::next_permutation(v.begin(), v.end()));

vector<VI> tree(100010);
int N;
int dis[100010] = { 0 };
int memo[100010] = { 0 };
bool ch[100010] = { 0 };



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N;
	eFOR(i,1, N)dis[i] = INF;
	dis[1] = 0;
	REP(i, N - 1) {
		int a, b;
		cin >> a >> b;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	queue<int> q, qfs[2];
	int cnt[2] = { 0 };
	q.push(1);
	while (!q.empty()) {
		int now = q.front();
		q.pop();
		REP(i, tree[now].size()) {
			int next = tree[now][i];
			if (dis[now] + 1 < dis[next]) {
				q.push(next);
				memo[next] = now;
				dis[next] = dis[now] + 1;
			}
		}
	}
	int half = (dis[N] - 1) / 2, from = N, to = memo[N];
	REP(i, half) {
		from = to;
		to = memo[from];
	}
	if (from > to)swap(from, to);
	qfs[0].push(1);
	qfs[1].push(N);
	ch[1] = 1;
	ch[N] = 1;
	REP(i, 2) {
		while (!qfs[i].empty()) {
			int now = qfs[i].front();
			qfs[i].pop();
			REP(j, tree[now].size()) {
				int next = tree[now][j];
				if (min(now, next) == from && max(now, next) == to) continue;
				if (!ch[next]) {
					ch[next] = 1;
					qfs[i].push(next);
					cnt[i]++;
				}
			}
		}

	}

	if (cnt[0] > cnt[1])
		cout << "Fennec" << endl;
	else
		cout << "Snuke" << endl;
	return 0;
}



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

using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)

typedef long long ll;
typedef long long int64;

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

  int ret = a - (b * 2);
  if(ret > 0) cout << ret << endl;
  else cout << "0" << endl;

  return 0;
}


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

int big1, big2;
int A[200005], sorted[200005];
int main()
{
	int n; cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
		sorted[i] = A[i];
	}
	sort(sorted, sorted + n, greater<int>());
	big1 = sorted[0];
	big2 = sorted[1];
	for (int i = 0; i < n; i++)
	{
		if (A[i] == big1) cout << big2;
		else cout << big1;
		cout << '\n';
	}
	return 0;
}

Measured memory_bytes: 3200
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MN 2100
using namespace std;

int read_p,read_ca;
inline int read(){
	read_p=0;read_ca=getchar();
	while(read_ca<'0'||read_ca>'9') read_ca=getchar();
	while(read_ca>='0'&&read_ca<='9') read_p=read_p*10+read_ca-48,read_ca=getchar();
	return read_p;
}
int n,m,Q,q[MN][MN],w[MN][MN],d[MN][MN],map[MN][MN],x,y,X,Y;
char s[MN];
int main(){
	int i,j;
	n=read();m=read();Q=read();
	for (i=1;i<=n;i++){
		scanf("%s",s+1);
		for (j=1;j<=m;j++)
		map[i][j]=s[j]=='1',q[i][j]=q[i-1][j]+q[i][j-1]-q[i-1][j-1]+map[i][j];
	}
	
	for (i=1;i<=n;i++)
	for (j=1;j<=m;j++)
	w[i][j]=w[i-1][j]+w[i][j-1]-w[i-1][j-1]+(map[i][j]&&map[i][j-1]),
	d[i][j]=d[i-1][j]+d[i][j-1]-d[i-1][j-1]+(map[i][j]&&map[i-1][j]);
	
	while (Q--){
		x=read();y=read();X=read();Y=read();
		printf("%d\n",q[X][Y]-q[x-1][Y]-q[X][y-1]+q[x-1][y-1]-(w[X][Y]-w[X][y]-w[x-1][Y]+w[x-1][y])-(d[X][Y]-d[X][y-1]-d[x][Y]+d[x][y-1]));
	}
}

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

int main() {
	int N;
	cin >> N;
	vector<int> A(N-1);
	for(int i = 0; i < N-1; i++) {
		cin >> A.at(i);
	}
	int num[N] = {};
	for(int i = 0; i < N-1; i++) {
		num[A.at(i)-1]++;
	}
	for(int i = 0; i < N; i++) {
		cout << num[i] << endl;
	}
}

Measured memory_bytes: 4784
N=int(input())
A=list(map(int,input().split()))

count_m=0
sum=0

for i in range(N):
    if A[i]<0:
        count_m+=1
        A[i]*=-1
    sum+=A[i]
B=sorted(A)
if count_m%2==0:
    print(sum)
else:
    print(sum-B[0]*2)

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

int main(void){

    int iroha, unko;
    iroha = 0;
    unko = 0;
    for(int i = 0; i < 3; i++){
        int input; cin >> input;
        if(input == 5) iroha++;
        if(input == 7) unko++;
    }
    if(iroha == 2 && unko == 1) cout << "YES" << endl;
    else cout << "NO" << endl;


    return 0;
}


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

int main()
{
  int a, b;
  for (int i = 0; i < 10000; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) break;
    for (int j = 0; j < a; j++) {
      for (int k = 0; k < b; k++) {
        if ((j+k) % 2 == 0) cout << "#";
        else cout << ".";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3096
#include <stdio.h>
#include <string.h>
#include <ctype.h>
 
int sutexia_ai_konnpu(const char* a, const char* b) {
    for (;;) {
        int aa = tolower((unsigned char)*a);
        int bb = tolower((unsigned char)*b);
        if (aa > bb) return 1;
        if (aa < bb) return -1;
        if (aa == 0 && bb == 0) return 0;
        a++;
        b++;
    }
}
 
int main(void) {
    char W[16];
    char T[1024];
    int count = 0;
    if (scanf("%15s", W) != 1) return 1;
    while (scanf("%1023s", T) == 1 && strcmp(T, "END_OF_TEXT") != 0) {
        if (sutexia_ai_konnpu(W, T) == 0) count++;
    }
    printf("%d\n", count);
    return 0;
}


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

int N;
int A[210];

int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> A[i];

  int res = 0;

  while(true) {
    bool exist_odd = false;
    for (int i = 0; i < N; ++i) {
      if (A[i] % 2 != 0) exist_odd = true;
    }

    if (exist_odd) break;

    for (int i = 0; i < N; ++i) {
      A[i] /= 2;
    }
    ++res;
  }

  cout << res << endl;

  return 0;
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

#define int long long

int w, h;
vector< vector<string> > s;
vector< vector< P > > v(2500);
int sy, sx, gy, gx;
int maxi;
int memo[2525][2525];

int solve(int i, int j){
    if(i == maxi + 1){
        return 0;
    }
    if(memo[i][j] >= 0){
        return memo[i][j];
    }

    int res = LLINF;
    rep(k, v[i + 1].size()){
        res = min(res, solve(i + 1, k) + abs(v[i][j].first - v[i + 1][k].first) + abs(v[i][j].second - v[i + 1][k].second));
    }
    return memo[i][j] = res;
}

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

    while(cin >> w >> h, w){

        rep(i, 2500){
            v[i].clear();
        }

        maxi = 0;

        fill(memo[0], memo[2525], -1);

        s.resize(h);
        rep(i, h){
            s[i].resize(w);
            rep(j, w){
                cin >> s[i][j];
                if(s[i][j] == "S"){
                    sy = i;
                    sx = j;
                }else if(s[i][j] == "G"){
                    gy = i;
                    gx = j;
                }else if(s[i][j] != "."){
                    int num = 0;
                    for(auto x : s[i][j]){
                        num *= 10;
                        num += x - '0';
                    }
                    maxi = max(maxi, num);
                    v[num].push_back({i, j});
                }
            }
        }

        v[0].push_back({sy, sx});
        v[maxi + 1].push_back({gy, gx});

        int ans = solve(0, 0);
        cout << ans << endl;
        
    }

    return 0;
}


Measured memory_bytes: 53460
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
#define pi 3.14159265358979323846264338
#define pb push_back
#define mp make_pair
#define inf 10000
using ll = long long;
using P = pair<int,int>;
using Pll = pair<ll,ll>;

ll divisor=1000000007;

int main(){
	int n;
	cin>>n;
	int h[n];
	rep(i,n)cin>>h[i];
	int dp[n];
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
	}
	puts(dp[n-1]);
}


Measured memory_bytes: 4400
def f(K, S):
    num=0
    for a in range(K+1):
      if S-a>=0 and S-a<=2*K:
        if S-a<=K:
          num+=S-a+1
        else:
          num+=(K-((S-a)-K))+1
    return num

  
K,S=(int(x) for x in input().split())
print(f(K,S))



Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int[] dice = { scanner.nextInt(), scanner.nextInt(), scanner.nextInt(), scanner.nextInt(), scanner.nextInt(),
				scanner.nextInt() };
		int oki=0;
		String shiji = scanner.next();
		char[] muki=new char[shiji.length()];
		for(int i=0;i<shiji.length();i++) {
			muki[i]=shiji.charAt(i);
		}
		for(int i=0;i<shiji.length();i++) {
			if(muki[i]=='E') {
				oki=dice[0];
				dice[0]=dice[3];
				dice[3]=dice[5];
				dice[5]=dice[2];
				dice[2]=oki;
			}else if(muki[i]=='N') {
				oki=dice[0];
				dice[0]=dice[1];
				dice[1]=dice[5];
				dice[5]=dice[4];
				dice[4]=oki;
			}else if(muki[i]=='S') {
				oki=dice[0];
				dice[0]=dice[4];
				dice[4]=dice[5];
				dice[5]=dice[1];
				dice[1]=oki;
			}else if(muki[i]=='W') {
				oki=dice[0];
				dice[0]=dice[2];
				dice[2]=dice[5];
				dice[5]=dice[3];
				dice[3]=oki;
			}
		}
		System.out.println(dice[0]);

	}
}


Measured memory_bytes: 26312
from sys import stdin
moji=(stdin.readline().rstrip())
N=int(stdin.readline().rstrip())
ans=moji[0]
ite=len(moji)
for i in range(1,ite+1):
    if i*N > len(moji)-1:
        break
    ans=ans+moji[i*N]
print(ans)

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

int main(){
  char c;
  cin >> c;
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" <<endl;
  else cout << "consonant" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    int x = a + b;
    if (x % 2 == 0) cout << x / 2 << endl;
    else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int a = sc.nextInt();
    
    	int a2 = a * a;
    	int a3 = a * a * a;
    	System.out.println(a + a2 + a3);
    }
}

Measured memory_bytes: 35772
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    vector<int> r(n);
    for (int i = 0; i < n - 1; i++) {
        int c, s, f;
        cin >> c >> s >> f;

        for (int j = 0; j <= i; j++) {
            r[j] = max(r[j], s);
            r[j] = (r[j] + f - 1) / f * f;
            r[j] += c;
        }
    }

    for (int i = 0; i < n; i++) {
        cout << r[i] << '\n';
    }


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>

using namespace std;

int main(){
    string str,buf;
    int m,h;
    while(cin >> str && (str != "-")){
        scanf("%d",&m);
        for(int i = 1;i <= m;i++){
            scanf("%d",&h);
            buf = str.substr(0,h);
            str.erase(0,h);
            str += buf;
        }
        cout << str << endl;
    }
    return 0;
}



Measured memory_bytes: 3280
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <iostream>
#include <vector>]
#include <cmath>
using namespace std;

int main()
{
	char w[10] = {};
	cin >> w;

	int count = 0;
	int max = 0;
	char acgt[] = {'A', 'C', 'G', 'T'};
	for (int i = 0; i < 10; i++)
	{
		if (std::find(std::begin(acgt), std::end(acgt), w[i]) != std::end(acgt))
		{
			count++;
			if (count > max)
			{
				max = count;
			}
		}
		else
		{
			count = 0;
		}
	}
	cout << max;
}

const int mod = 1000000007;
struct mint {
	long long x; // typedef long long ll;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(long long t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#define maxn 5000
using namespace std;
char s[maxn];
char t[maxn];
int n,m;
int main() {
    scanf("%s",s);
    n=strlen(s);
    scanf("%s",t);
    m=strlen(t);
    int ans=m;
    for(int i=0;i+m<=n;i++) {
        int cans=0;
        for(int j=0;j<m;j++) {
            if(s[i+j]!=t[j]) cans++;
        }
        ans=min(ans,cans);
    }
    printf("%d",ans);
	return 0;
}


Measured memory_bytes: 3812
input()
c1, c2, c4 = 0, 0, 0
for a in map(int, input().split()):
    if a & 1:
        c1 += 1
    elif a & 2:
        c2 += 1
    else:
        c4 += 1

if c2:
    print('Yes' if c4 >= c1 else 'No')
else:
    print('Yes' if c4 and c4 + 1 >= c1 else 'No')


Measured memory_bytes: 11096
#include <iostream>
#include <string.h>

using namespace std;
int main() {
	char S[20];
	 cin >> S;

	 if(strncmp(S, "Sunny", 7) == 0)
	 {
		 printf("Cloudy");
	 }
	
   if(strncmp(S, "Cloudy", 7) == 0)
	 {
		 printf("Rainy");
	 }

		if(strncmp(S, "Rainy", 7) == 0)
	 {
		 printf("Sunny");
	 }

}

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

int main() {
  int N;
  cin >> N;
  if(N % 10==3){
    cout << "bon" << endl;
  }
  else if(N % 10==0 || N % 10==1 || N % 10==6 || N % 10==8){
    cout << "pon" << endl;
  }
  else
    cout << "hon" << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int main() {
  ios::sync_with_stdio(false);
  string a;
  cin>>a;
  if(a=="ABC")cout<<"ARC";
  else cout<<"ABC";
  return 0;
}

Measured memory_bytes: 3612
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc131/tasks/abc131_a>
 問題文============================================================
 =================================================================
 解説=============================================================
 隣り合う文字を比較するだけ
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    string S; cin >> S;
    for(int i = 1; i < 4;i++){
        if(S[i-1]==S[i]) return "Bad";
    }
    return "Good";
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  bool easy = true;
  for (int i = 0; i < (int)s.size(); i++) {
    if (i % 2 == 0) {
      if (s[i] == 'L') easy = false;
    } else {
      if (s[i] == 'R') easy = false;
    }
  }
  if (easy) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
}


Measured memory_bytes: 256