akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

constexpr ll MOD = (ll)(1e9 + 7);
constexpr ll MAX = 5000;

ll N, dp[MAX + 1][MAX + 1][2], dp2[MAX + 1][2];
vector<vector<ll>> e;
vector<ll> g, sz;

void rec(ll v, ll p) {
    sz[v] = 1;
    dp[v][1][0] = 1;
    for(ll i : e[v]) if (i != p) {
        rec(i, v);
        memset(dp2, 0, sizeof(dp2));
        for (ll x = 1; x <= sz[v]; x++) for (ll y = 1; y <= sz[i]; y++) {
            // v-i間の辺を取り除く場合
            (dp2[x][0] += dp[v][x][0] * dp[i][y][1] % MOD*g[y] + dp[v][x][1] * dp[i][y][0] % MOD*g[y]) %= MOD;
            (dp2[x][1] += dp[v][x][0] * dp[i][y][0] % MOD*g[y] + dp[v][x][1] * dp[i][y][1] % MOD*g[y]) %= MOD;
            // 取り除かない場合
            (dp2[x + y][0] += dp[v][x][0] * dp[i][y][0] + dp[v][x][1] * dp[i][y][1]) %= MOD;
            (dp2[x + y][1] += dp[v][x][0] * dp[i][y][1] + dp[v][x][1] * dp[i][y][0]) %= MOD;
        }
        swap(dp[v], dp2);
        sz[v] += sz[i];
    }
}

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

    cin >> N;

    sz.resize(N, 0);

    g.resize(N + 1, 0);
    g[2] = 1;
    for (ll i = 4; i <= N; i++) {
        g[i] = g[i - 2] * (i - 1) % MOD;
    }

    e.resize(N + 1);
    for (ll i = 0; i < N - 1; i++) {
        ll x, y;
        cin >> x >> y;
        x--, y--;
        e[x].push_back(y), e[y].push_back(x);
    }
    
    rec(0, -1);

    ll ans = 0;
    for (ll i = 1; i <= N; i++) {
        (ans += (dp[0][i][0] - dp[0][i][1] + MOD) % MOD * g[i]) %= MOD;
    }
    cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> lp(n);
  for (int i = 0; i < n; ++i) {
    int p;
    cin >> p;--p;
    lp[i] = p;
  }
  int ans = 0;
  for (int i = 0; i < n-1; ++i) {
    if (lp[i] != i) continue;
    swap(lp[i], lp[i+1]);
    ++ans;
  }
  if (lp[n-1] == n-1) ++ans;
  cout << ans << endl;
}



Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
   int a ,b;
   while (cin >> a >> b)
   {
       int q=a+b;
       int w=a-b;
       int e=a*b;
       cout << max(q,max(w,e))<<endl;
   }
    return 0;
}



Measured memory_bytes: 256
let n, k = Scanf.scanf "%d %d\n" (fun x y -> (x, y))

let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun x -> x))

let () =
  Array.fast_sort (fun a b -> b - a) a ;
  Array.sub a 0 k |> Array.fold_left (+) 0
  |> Printf.printf "%d\n"

Measured memory_bytes: 384
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N,M,L = MI()
	to = [[] for _ in range(N)]
	dist = [[float("inf") for _ in range(N)] for _ in range(N)]

	def warshall_floyd(N):
		for mid in range(N):
			for s in range(N):
				for g in range(s+1,N):
					dist[s][g] = min(dist[s][g], dist[s][mid]+dist[mid][g])
					dist[g][s] = dist[s][g]


	for _ in range(M):
		a,b,c = MI()
		dist[a-1][b-1],dist[b-1][a-1]=c,c
	for i in range(N):
		dist[i][i] = 0

	warshall_floyd(N)

	for i in range(N):
		for j in range(i+1,N):
			if dist[i][j]<=L :
				dist[i][j],dist[j][i]=1,1
			else:
				dist[i][j],dist[j][i]=float("inf"),float("inf")

	warshall_floyd(N)

	Q = II()
	for _ in range(Q):
		s,t = MI()
		ans = dist[s-1][t-1]-1
		if(ans == float("inf")):
			print(-1)
		else:
			print(ans)

main()

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()


int main(int argc, char **argv)
{
	ll a, b; cin >> a >> b;
	std::cout << a*b<< std::endl;
}


Measured memory_bytes: 3624
s = list(input())
n = int(input())
head = []
tail = []

cnt = 0
for _ in range(n):
    li = list(input().split())
    if li[0] == '1':
        head, tail = tail, head
        cnt += 1
    else:
        if li[1] == '1':
            head += li[2]
        else:
            tail += li[2]

if cnt % 2 != 0:
    s = s[::-1]

ans = head[::-1] + s + tail
print(*ans , sep='')

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


int main()
{


    int n;
    cin>>n;

    vector<int> A(n);
    int max_wk=0;
    for(int i=0;i<n;i++){
        cin>>A.at(i);
        max_wk = max(max_wk,A.at(i));
    }

    int max_wk2=0;
    int cnt=0;
    for(int i=0;i<n;i++){
        if(A.at(i)==max_wk)
            cnt++;
        if(A.at(i)!=max_wk)
           max_wk2 = max(max_wk2,A.at(i));
    }

    for(int i=0;i<n;i++){
        if(cnt>1)
            cout<<max_wk<<endl;
        else if(max_wk!=A.at(i))
            cout<<max_wk<<endl;
        else
            cout<<max_wk2<<endl;
    }

    return 0;
}   

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

min_list = [0 for i in range(N)]
max_list = [0 for i in range(N)]
min_list[0] = A[0]
max_list[N-1] = A[N-1]
for i in range(1, N):
	min_list[i] = min(min_list[i-1], A[i])
	max_list[N-i-1] = max(max_list[N-i], A[N-i-1])
prof = max([max_list[i+1]-min_list[i] for i in range(N-1)])
count = 0
for i in range(N-1):
	if max_list[i+1]-min_list[i]==prof:
		if count==0:
			pair = (min_list[i], max_list[i+1])
			count = count+1
		elif pair!=(min_list[i], max_list[i+1]):
			pair = (min_list[i], max_list[i+1])
			count = count+1
print(count)


Measured memory_bytes: 15060
#include <stdio.h>
#include <stdlib.h>
#define M 100

void selectionSort(int *A,int N);

int main(){
  int N;
  int i;
  int A[M];
  scanf("%d",&N);
  if(N<1 || N>M) exit(1);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
    if(A[i]< 0 || A[i]>M) exit(2);
  }
  selectionSort(A,N);
  return 0;
}

void selectionSort(int *A,int N){
  int i,j;
  int minj;
  int temp;
  int c=0;
  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(A[j] < A[minj]){
	minj = j;
      }
    }
    temp = A[i];
	A[i] = A[minj];
	A[minj] = temp;
	if(A[minj] != A[i]) c++;
  }
  for(i=0;i<N;i++){
    if(i)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n%d\n",c);
  
}



Measured memory_bytes: 2104
#include <iostream>
#include <set>
#include <vector>
#include <iomanip>

#include <cfenv>
#include <cmath>
typedef long long int ll;

using namespace std;

int main()
{


    int K, A,B;

    cin >> K;

    cin >> A >> B;


    int l = A/K;


    if (l*K ==A  || K*(l+1)<=B){


        cout <<"OK" << endl;
    }
    else{


        cout << "NG" << endl;
    }





    

    

    
    return 0;
}

Measured memory_bytes: 3632
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    pos = -100
    sm = 0 
    for i in range(N):
        sm += B[i]
        if i < N-1:
            if A[i] + 1 == A[i+1]:
                sm += C[A[i]-1]
    print(sm)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    B = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    C = [int(next(tokens)) for _ in range(N - 1)]  # type: "List[int]"
    solve(N, A, B, C)

if __name__ == '__main__':
    main()


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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

typedef pair <int, int> pii; 
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
const int N = 12;

int n, m;
               
string s[13];

//# define int short

struct matching { 
  vec<int> g[N];
  int n;
  bool used[N];
  void add_edge (int a, int b) {
    g[a].pb (b); g[b].pb (a);
  }
  bool solve (int p = 0, bool mid = 0) {      
    if (p == n) {
      return 1;
    }   
    if (used[p])  return solve (p + 1, mid);
    
    if ((n & 1) && !mid) {
      used[p] = 1;
      if (solve (p + 1, 1)) 
        return 1;
      used[p] = 0;
    }   

    for (auto to : g[p]) {
      if (!used[to]) {
        used[to] = used[p] = 1;
        if (solve (p + 1, mid))
          return 1;
        used[to] = used[p] = 0;
      }
    }
    return 0;
  }     
} M[(int)2e5];
  
int cnt = 0;
int getId (vec<int> &a) { 
  static map <vec<int>, int> id;
  int &x = id[a];
  cnt = sz(id);
  if (!x) 
    return x = sz(id);
  else
    return x;
}
vec<int> mt;
    
void getcol (int x, int y, int p = 0, bool mid = 0) {     

  if (~mt[p]) {
    getcol (x, y, p + 1, mid);
    return;
  }
  if (p == m) {
    int a; 
    M[a = getId (mt)].add_edge (x, y);
    return;
  }
  if ((m & 1) && !mid && s[x][p] == s[y][p]) {
    mt[p] = p;              
    getcol (x, y, p + 1, 1);
    mt[p] = -1;
  }                         
  for (int i = p+1; i < m; i++) {
    if (mt[i] == -1 && s[x][p] == s[y][i] && s[x][i] == s[y][p]) {       
      mt[p] = i;
      mt[i] = p; 
      getcol (x, y, p + 1, mid);
      mt[i] = mt[p] = -1;
    }
  }
}                               
main()
{
  # ifdef Local
    //localInput();
  # endif                                      
  Read_rap();   
  cin >> n >> m;
  for (int i = 0; i < n; i++)   
    cin >> s[i];   
  
  mt.resize (m + 1, -1);
           
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      getcol (i, j);
    }
  }                 
  assert (cnt <= int(sizeof(M)/sizeof(M[0]) - 1));

  for (int i = 1; i <= 2000; i++) {
    M[i].n = n;
    if (M[i].solve()) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";


  return 0;
}






// Coded by Z..



Measured memory_bytes: 71936
N=int(input())

A=[]
for i in range(N):
    x,y,h=map(int,input().split())
    A.append([h,x,y])
A.sort(reverse=True)
#print(A)



for h in range(101):
    for w in range(101):
        H=A[0][0]+abs(A[0][1]-(w))+abs(A[0][2]-(h))
        cnt=0
        for t in range(1,N):
            if A[t][0]==max(0,H-abs(A[t][1]-(w))-abs(A[t][2]-(h))):
                cnt+=1
            else:
                break
        if cnt==N-1:
            print(w,h,H)
            exit()
        

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>

//#define PI 3.141592653589

using namespace std;



int main()
{
	int n;
	string indication[10000];
	
	while (1)
	{
		cin >> n;
		if (n == 0) break;
		for (int i=0; i<n; i++)
		{
			cin >> indication[i];
		}
		/*
		for (int i=0; i<n; i++)
		{
			//cin >> indication[i];
			cout << indication[i];
		}
		*/
		
		int dice[6] = {1, 2, 3, 5, 4, 6};
		int temp;
		
		int sum = 1;
		for (int i=0; i<n; i++)
		{
			if (indication[i] == "North")
			{
				temp = dice[0];
				dice[0] = dice[1];
				dice[1] = dice[5];
				dice[5] = dice[3];
				dice[3] = temp;
			} else if (indication[i] == "East") {
				temp = dice[0];
				dice[0] = dice[4];
				dice[4] = dice[5];
				dice[5] = dice[2];
				dice[2] = temp;
			} else if (indication[i] == "West") {
				temp = dice[0];
				dice[0] = dice[2];
				dice[2] = dice[5];
				dice[5] = dice[4];
				dice[4] = temp;
			} else if (indication[i] == "South") {
				temp = dice[0];
				dice[0] = dice[3];
				dice[3] = dice[5];
				dice[5] = dice[1];
				dice[1] = temp;
			} else if (indication[i] == "Right") {
				temp = dice[1];
				dice[1] = dice[2];
				dice[2] = dice[3];
				dice[3] = dice[4];
				dice[4] = temp;
			} else if (indication[i] == "Left") {
				temp = dice[1];
				dice[1] = dice[4];
				dice[4] = dice[3];
				dice[3] = dice[2];
				dice[2] = temp;
			}
			sum += dice[0];
			//cout << "sum = " << sum << endl;
		}
		
		//cout << "sum = " << sum << endl;
		cout << sum << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1524
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<deque>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n); i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const int MOD = 1000000007;

int main(){
  ll N;  cin >> N;
  ll ans = (N-1) * N / 2;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
const ll INF = 1e10;
int main()
{
    int h,n;
    cin >> h >> n;
    vector<int> a(n),b(n);
    vector<ll> dp(h+1,INF);
    dp[0] = 0;
    rep(i,n){
        cin >> a[i] >> b[i];
    }
    rep(i,n){
        rep(j,h+1){
            int nj = min(j+a[i],h);
            dp[nj] = min(dp[nj],dp[j]+b[i]);

        }
    }
    cout << dp[h] << endl;
    return 0;
}

Measured memory_bytes: 384
using System;

public class CircleCrossStamps {
    public static void Main(){
        int N = int.Parse(Console.ReadLine());
        char[] S = Console.ReadLine().ToCharArray();
        int count = 0;
        for (int i=0;i<S.Length-1;i++)
        {
            if (S[i] == 'O' && S[i+1] == 'X')
            {
                CountUp(ref count, ref i);
            }
            else if (S[i] == 'X' && S[i+1] == 'O')
            {
                CountUp(ref count, ref i);
            }
            //Console.WriteLine(i+":"+count);
        }
        Console.WriteLine(count);
    }
    
    private static void CountUp(ref int count, ref int i)
    {
        count++;
        i++;
    }
}



Measured memory_bytes: 19992
h,w,d=map(int,input().split())
a=[list(map(int,input().split())) for i in range(h)]
dic={}
for i in range(h):
  for j in range(w):
    dic[a[i][j]]=(i,j)
cnt=[0]*(h*w+1)
for j in range(1,d+1):
  for i in range(j,h*w-d+1,d):
    y1,x1=dic[i+d]
    y2,x2=dic[i]
    cnt[i+d]=cnt[i]+abs(x2-x1)+abs(y2-y1)
q=int(input())
for _ in range(q):
  l,r=map(int,input().split())
  print(cnt[r]-cnt[l])

Measured memory_bytes: 23392
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main(void)
{
	int w, a, b;
	cin >> w >> a >> b;
	if (fabs(b - a) - w < 0)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << fabs(b - a) - w << endl;
	}
	return 0;
}

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

int main() {

    int c[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }

    vector<int> a(3);
    vector<int> b(3);

    bool flag = false;
    for (int i = 0; i < 101; i++) {
        for (int j = 0; j < 101; j++) {
            for (int k = 0; k < 101; k++) {

                if (c[0][0] - i == c[1][0] - j && c[1][0] - j == c[2][0] - k) {
                    if (c[0][1] - i == c[1][1] - j &&
                        c[1][1] - j == c[2][1] - k) {
                        if (c[0][2] - i == c[1][2] - j &&
                            c[1][2] - j == c[2][2] - k) {
                            flag = true;
                        }
                    }
                }
            }
        }
    }

    if (flag) {
        cout << "Yes" << endl;
    }

    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool a[1000005],b[1000005];//row column
const int mod=1e9+7;//1000000007
int main()
{
	int n,m;
	cin>>n>>m;
	long long sum=1;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		if(a[x])
		{
			cout<<"0";
			return 0;
		}
		a[x]=1;
	}
	for(int i=0;i<m;i++)
	{
		int y;
		cin>>y;	
		if(b[y])
		{
			cout<<"0";
			return 0;
		}
		b[y]=1;
	}
	int k1=0,t1=0;
	for(int i=n*m;i>0;i--)
	{
		int k2=k1,t2=t1;
		if(b[i])
		{
			k2=1;
			k1++;
		}
		if(a[i])
		{
			t2=1;
			t1++;
		}
		if(a[i]||b[i])
			sum*=(k2*t2)%mod;
		else
			sum*=(k2*t2-(n*m-i))%mod;
		sum%=mod;
	}
	cout<<sum%mod;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

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

int main() {
	int N;
	cin >> N;
	VI c(100000, 0);
	REP(i, N) {
		int a;
		cin >> a;
		c[a]++;
	}
	int X = 0;
	FOR(i, 1, 100000 - 1) X = max(X, c[i - 1] + c[i] + c[i + 1]);
	cout << X << endl;
	return 0;
}


Measured memory_bytes: 768
//Menagerie
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// ÉÏ ×ó ÏÂ ÓÒ
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
// 1 ÏàÍ¬ 0 ²»Í¬ 
// 1 Ñò 0 ÀÇ 
// 1 ÏàÍ¬ 0 ²»Í¬ 
int n;
bool talk[N],ani[N];
void make(void)
{
	for(int i=2;i<n;i++)
	{
		bool op=1^(ani[i]^talk[i]);
		if(op==true)
			ani[i+1]=ani[i-1];
		else
			ani[i+1]=ani[i-1]^1;
	}
}
bool check(void)
{
	int op1=1^(ani[1]^talk[1]),op2=1^(ani[n]^talk[n]);
	if(op1!=(1^(ani[n]^ani[2])))
		return false;
	if(op2!=(1^(ani[1]^ani[n-1])))
		return false;
	return true;
}
void print(void)
{
	for(int i=1;i<=n;i++)
		cout<<((ani[i]==1)?'S':'W');
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		char ch;
		cin>>ch;
		if(ch=='o')
			talk[i]=true;
		else
			talk[i]=false;
	}
	for(int i=0;i<=1;i++)
		for(int j=0;j<=1;j++)
		{
			ani[1]=i,ani[2]=j;
			make();
			if(check())
			{
				print();
				return 0;
			}
		}
	cout<<-1;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){

    int n;
    cin >> n;

    for (int i = 1; i <= 9; i++){
        for (int j = 1; j <= 9; j++){
            if (i * j == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int a[10010];

int main() {
    ios_base::sync_with_stdio(0);
    int n; cin >> n;
    for (int i=0;i<n;i++) cin >> a[i];

    int ans = 0;
    for (int i=0;i<n;i++) {
        while (a[i]%2==0) a[i] /= 2, ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#define N 100005
#define F first
#define S second
using namespace std;

int n, m, s;
pair<int, int> a[N];
priority_queue<int> qu;
int main()
{
	int i, j, t;
	cin >> n >> m;
	for (i = 0; i < n; i++) {
		scanf ("%d %d", &a[i].F, &a[i].S);
	}
	sort(a, a + n);
	j = 0;
	for (i = m - 1; i >= 0; i--) {
		for (; j < n; j++) {
			if (i + a[j].F > m) break;
			qu.push(a[j].S);
		}
		if (!qu.empty()) {
			t = qu.top(); qu.pop();
			s += t;
		}
	}
	cout << s;
    return 0;
}


Measured memory_bytes: 1660
#include <iostream>

using namespace std;

int comp(int,int,int);

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

    if(comp(a,b,c) == 1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

int comp(int a,int b,int c){
    if(a<b && b<c) return 1;
    else return 0;
}



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

struct I{I(){ios::sync_with_stdio(false);cin.tie(0);}}init;

typedef long long LL;
typedef __int128 Int;
const LL MOD=1e9+7;
const LL INF=1e16;


typedef vector<int> V;
typedef vector<V> VV;
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto &it:v)is>>it;return is;}
#define SPACE " "
template<typename T> ostream& operator<<(ostream& os,vector<T>& v){for(int i=0,sz=v.size();i<sz;i++)os<<(!i)+SPACE<<v[i];return os;}
LL f(LL n,LL b){
    if(n<b)return n;
    else return f(n/b,b)+n%b;
}
int main(){
    LL res=INF;
    LL n,s;cin>>n>>s;
    if(s>n){cout<<-1<<endl;return 0;}
    if(s==n)res=n+1;
    if(s==1&&n!=1)res=n;
    for(LL i=2;i*i<=n;i++){
        if(f(n,i)==s)res=min(res,i);
        if((n-s)/(i-1)+1>=2)
        if(f(n,(n-s)/(i-1)+1)==s)res=min(res,(n-s)/(i-1)+1);
    }
    if(res==INF)res=-1;
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	int seki = a * b;
	if (seki % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}
	
	return 0;
}

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

#define EACH(i, a) for (auto &&i : a)
#define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RFOR(i, a, b) for (int i = (int)b - 1; i >= (int)a; --i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREPS(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(x) (x).begin(), (x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define debug(x) cout << #x << ": " << x << endl

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

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF (1L << 30)
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

template <class T>
void pv(T a, T b) {
  for (T i = a; i != b; ++i) cout << *i << " ";
  cout << endl;
}
template <class T>
void pvp(T a, T b) {
  for (T i = a; i != b; ++i)
    cout << "(" << i->first << ", " << i->second << ") ";
  cout << endl;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int in() {
  int x;
  scanf("%d", &x);
  return x;
}

using ll = long long;
#define int ll

//**********

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

  string n;
  cin >> n;
  if (n == "AAA" | n== "BBB"){
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  // cout << pow(n, 2) << endl;

  return 0;
};


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

int main() {
  int n;
  cin >>n;
  vector<int> vec(n);
  for (int i = 0; i< n;i++){
    cin >> vec.at(i);
  }
  
  int a, b=0,sum;
  
  for(int i =0;i<n;i++){
    sum += vec.at(i);
  }
  int c=sum;
  for (int i=0;i<n;i++){
    b += vec.at(i);
    a= abs(sum - b);
    c=min(abs(a-b),c);
  }
  cout <<c<< endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	for(int i=1;i<b;i++){
		if(a*i%b==c){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#D
N,K=map(int,input().split())
A=[0]+[int(x) for x in input().split()]

log=[0 for i in range(N+1)]
log[1]=1
re=0
p=1
while True:
    p=A[p]
    log[p]+=1
    re+=1
    if log[p]==2:
        break

if K<re:
    p=1
    for i in range(K):
        p=A[p]
    print(p)
    
else:
    K=K-re
    log=[0 for i in range(N+1)]
    log[p]=1
    re=0
    while True:
        p=A[p]
        log[p]+=1
        re+=1
        if log[p]==2:
            break

    K=K%re
    for i in range(K):
        p=A[p]
    print(p)

Measured memory_bytes: 109136
import java.util.Scanner;

public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);

                double A = scan.nextInt();
                double B = scan.nextInt();
                double H = scan.nextInt();
                double M = scan.nextInt();

                System.out.println(
                		Math.sqrt(
                		Math.pow(
                				B*Math.cos(Math.toRadians((180-11*M+60*H)/2))
                				, 2) +
                		Math.pow(
                				B*Math.sin(Math.toRadians((180-11*M+60*H)/2)) - A
                				, 2)
                		)
                	);
        }
}

Measured memory_bytes: 36152
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;int ans=0;
	for(int i=0;i<s.size()/2;i++){
		if(s[i]!=s[s.size()-i-1])ans++;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
N=int(input())

W=set()
s="*"
F=True
for _ in range(N):
    H=input()
    if s=="*" or (s==H[0] and H not in W):
        W.add(H)
        s=H[-1]
    else:
        F=False
if F:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 62296
a, b, c = gets.split.map &:to_i
x = 0
hash = {x => 0}
t = 0

loop {
    if (c + x) % (a + b) <= a
        puts 60 * t + c
        break
    end

    x = (x + 60) % (a + b)
    if hash[x]
        puts -1
        break
    end
    hash[x] = 0

    t += 1
}

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

int main(){
	int n;
	int pm,pe,pj;
	while(1){
		cin >> n;
		if(n == 0) break;
		for(int i=0;i<n;i++){
			cin >> pm >> pe >> pj;
			if((pm == 100 || pe == 100 || pj == 100) || ((pm+pe)/2 >= 90) || ((pm+pe+pj)/3 >= 80)){
				cout << "A" << endl;
			}
			else if(((pm+pe+pj)/3 >= 70) || (((pm+pe+pj)/3 >= 50) && (pm >= 80 || pe >= 80))){
				cout << "B" << endl;
			}
			else {
				cout << "C" << endl;
			}
		}
	}
}

Measured memory_bytes: 1152
H, W = map(int, input().split())
a = []
for i in range(H):
  a.append(list(map(int, input().split())))
  
tmp = []
for i in range(H):
  if (sum(a[i])%2==1) and (i<H-1):
    for j in range(W):
      if a[i][j] % 2 == 1:
        n = j
        a[i][j] -= 1
        a[i+1][0] += 1
        break
    for j in range(n):
      tmp.append([i+1, n-j+1, i+1, n-j])
    tmp.append([i+1, 1, i+2, 1])
  for j in range(W):
    if (a[i][j]%2==1) and (j<W-1):
      a[i][j] -= 1
      a[i][j+1] += 1
      tmp.append([i+1, j+1, i+1, j+2])
print(len(tmp))
for i in range(len(tmp)):
  print(*tmp[i])

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

#define ll long long
#define inf 0x3f3f3f3f
#define il inline

namespace io {

    #define in(a) a=read()
    #define out(a) write(a)
    #define outn(a) out(a),putchar('\n')

    #define I_int int
    inline I_int read() {
        I_int x = 0 , f = 1 ; char c = getchar() ;
        while( c < '0' || c > '9' ) { if( c == '-' ) f = -1 ; c = getchar() ; }
        while( c >= '0' && c <= '9' ) { x = x * 10 + c - '0' ; c = getchar() ; }
        return x * f ;
    }
    char F[ 200 ] ;
    inline void write( I_int x ) {
        if( x == 0 ) { putchar( '0' ) ; return ; }
        I_int tmp = x > 0 ? x : -x ;
        if( x < 0 ) putchar( '-' ) ;
        int cnt = 0 ;
        while( tmp > 0 ) {
            F[ cnt ++ ] = tmp % 10 + '0' ;
            tmp /= 10 ;
        }
        while( cnt > 0 ) putchar( F[ -- cnt ] ) ;
    }
    #undef I_int

}
using namespace io ;

using namespace std ;

#define N 100010

int main() {
	int x = read() ;
	if(x == 3 || x == 5 || x == 7) puts("YES") ;
	else puts("NO");
}


Measured memory_bytes: 256
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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        p: usize,
        v: chars
    }
    let v: Vec<usize> = v.iter().map(|&c| (c as u8 - '0' as u8) as usize).collect();
    if p == 2 || p == 5 {
        let mut ans = 0;
        for i in 0..n {
            if v[i] % p == 0 {
                ans += i + 1;
            }
        }
        println!("{}", ans);
        return;
    }
    let mut ac = vec![0; n + 1];
    for i in 0..n {
        ac[i + 1] = (ac[i] + v[i] * pow_m(10, n - i, p)) % p;
    }
    let mut cs = vec![0; p];
    cs[0] = 1;
    let mut ans: usize = 0;
    for i in 1..n + 1 {
        ans += cs[ac[i]];
        cs[ac[i]] += 1;
    }
    println!("{}", ans);
}

fn pow_m(n: usize, mut p: usize, d: usize) -> usize {
    let mut r = n;
    let mut ret = 1;
    while p > 0 {
        if p % 2 == 0 {
            r = r * r % d;
            p /= 2;
        } else {
            ret = ret * r % d;
            p -= 1;
        }
    }
    ret
}


Measured memory_bytes: 8444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    
    int a, b, x;
    cin >> a >> b >> x;
    
    cout << fixed << setprecision(8);
    if (x >= 1.0 * a * a * b / 2) {
        double ans = atan(2.0 / a / a / a * (a * a * b - x));
        cout << ans / 2 / M_PI * 360 << endl;
        return 0;
    }
    double ans = atan(2.0 * x / a / b / b);
    // cout << ans << endl;
    ans -= M_PI / 2;
    ans = -ans;
    // cout << ans << endl;
    ans /= 2 * M_PI;
    ans *= 360;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#define pb push_back
#define mp make_pair
#define PF first
#define PS second
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
#define OUT(x) cout << x << endl;
#define OUTD(x) cout << fixed << x << endl;
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 100000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};

ll dp[30000];

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  IN(ll,N);
  IN(ll,D);
  ll count = 0;
  while(N > 0){
    N -= 2*D + 1;
    count++;
  }
  OUT(count);
}



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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main()
{
	int a[4], b[4];
	int check[4];
	memset(check, 0, sizeof(check));
	for(int i=0;i<3;i++)
	{
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		check[a[i]]++;
		check[b[i]]++;
	}
	bool ans = true;
	for(int i=0;i<4;i++)
	{
		if(check[i] > 2 || check[i] == 0)
		{
			ans = false;
			break;
		}
	}
	if(ans == false)
	{
		cout << "NO\n";
	}
	else
		cout << "YES\n";
	return 0;
}

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

namespace Beg123D
{
    class Program
    {
        static void Main(string[] args)
        {
            var no = ":(";
            var yes = "Yay!";

            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            var c = int.Parse(Console.ReadLine());
            var d = int.Parse(Console.ReadLine());
            var e = int.Parse(Console.ReadLine());
            var k = int.Parse(Console.ReadLine());

            if (e - a > k)
                Console.WriteLine(no);
            else
                Console.WriteLine(yes);
        }
    }
}


Measured memory_bytes: 11092
w, h, n = map(int, input().split())
p, q = 0, 0
for _ in range(n) :
    x, y, a = map(int, input().split())
    if a == 1 :
        p = max(p, x)
    elif a == 2 :
        w = min(w, x)
    elif a == 3 :
        q = max(q, y)
    else :
        h = min(h, y)
print(max(0, w-p)*max(0, h-q))

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

typedef long long ll;

#define FOR(i, s, e)   for(int i = (s); i < (e); i++)
#define FOR64(i, s, e) for(ll  i = (s); i < (e); i++)
#define ALL(x)         (x).begin(), (x).end()
#define SORT(v)        sort((v).begin(), (v).end())
#define pb(a)          push_back(a)
#define INF            999999999

int main()
{
	char S[200004];

	scanf("%s", S);

	int N = strlen(S);

	ll count = 0;

	int Bs = 0;

	FOR(i, 0, N){
		if(S[i] == 'B'){
			Bs++;
		}
		else{ // 'W'
			count += Bs;
		}
	}

	printf("%lld\n", count);

	return 0;
}



Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
	"unicode"
)

func main() {
	a := readString()

	r := rune(a[0])
	if unicode.IsUpper(r) {
		fmt.Println("A")
	} else {
		fmt.Println("a")
	}
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return (a * b) / gcd(a, b)
}

func permutations(arr []int) [][]int {
	var helper func([]int, int)
	res := [][]int{}

	helper = func(arr []int, n int) {
		if n == 1 {
			tmp := make([]int, len(arr))
			copy(tmp, arr)
			res = append(res, tmp)
		} else {
			for i := 0; i < n; i++ {
				helper(arr, n-1)
				if n%2 == 1 {
					tmp := arr[i]
					arr[i] = arr[n-1]
					arr[n-1] = tmp
				} else {
					tmp := arr[0]
					arr[0] = arr[n-1]
					arr[n-1] = tmp
				}
			}
		}
	}
	helper(arr, len(arr))
	return res
}

func isPrime(n int) bool {
	if n == 1 {
		return false
	}
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return true
}

func divisor(n int) (res []int) {
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i*i != n {
				res = append(res, n/i)
			}
		}
	}
	sort.Ints(res)
	return
}

// func searchInts(a []int, k int) int {
// 	return binarySearch(len(a), func(i int) bool {
// 		return a[i] >= k
// 	})
// }

func binarySearch(n int, f func(int) bool) int {
	i, j := 0, n
	for i < j {
		h := int(uint(i+j) >> 1)
		if !f(h) {
			i = h + 1
		} else {
			j = h
		}
	}
	return i
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7
)

var (
	readString func() string
)

func init() {
	readString = newReadString(os.Stdin)
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


Measured memory_bytes: 1772
//--- pA ---//
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Scanner scanner;
	public Solution() {
		scanner = new Scanner(System.in);

		// scanner.nextLine();
		while (scanner.hasNext()) {
			run_case();
		}
	}
	private void run_case() {
		// scanner.nextLine();
		String line = scanner.nextLine();

		int N = Integer.parseInt(line.split("\\s+")[0]);
		int M = Integer.parseInt(line.split("\\s+")[1]);

		if (N == M) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23892
def main():
    O = input()
    E = input()

    ans = ''
    for i in range(len(O)):
        if len(O) == len(E):
            ans += O[i] + E[i]
        elif i < len(O)-1:
            ans += O[i] + E[i]
        else:
            ans += O[i]

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
class Simple {
    int sx, sy, tx, ty;
    void Solve() {
        //input
        sx = io.Int;
        sy = io.Int;
        tx = io.Int;
        ty = io.Int;
        //cal
        int dx = tx - sx;
        int dy = ty - sy;
        //res
        //一周目
        for (int i = 0; i < dy; ++i) Console.Write("U");
        for (int i = 0; i < dx; ++i) Console.Write("R");
        for (int i = 0; i < dy; ++i) Console.Write("D");
        for (int i = 0; i < dx; ++i) Console.Write("L");
        //二週目
        dy++;
        dx++;
        Console.Write("L");
        for (int i = 0; i < dy; ++i) Console.Write("U");
        for (int i = 0; i < dx; ++i) Console.Write("R");
        Console.Write("D");
        Console.Write("R");
        for (int i = 0; i < dy; ++i) Console.Write("D");
        for (int i = 0; i < dx; ++i) Console.Write("L");
        Console.WriteLine("U");
    }

    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) { new Simple().Stream(); }
    void Stream() {
        Solve();
        io.writeFlush();
    }
}

class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length)
            return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while (st == "")
            st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


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

using namespace std;

int main(){
    int N, K;
    string S;

    cin >> N >> K;
    cin >> S;

    if(S[K-1] == 'A'){
        S[K-1] = 'a';
    }
    if(S[K-1] == 'B'){
        S[K-1] = 'b';
    }
    if(S[K-1] == 'C'){
        S[K-1] = 'c';
    }

    cout << S << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <cmath>
#include <iomanip>
using namespace std;
#define mod (long)(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<long> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } long C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

int main(){
    int T, X;
    cin >> T >> X;
    fcout << T / double(X) << endl;
}


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

int main() {
   int V,E;
   cin >> V >> E;
   vector<vector<pair<int,int>>> G(V);
   for (int i=0; i<E; i++) {
       int s,t,d;
       cin >> s >> t >> d;
       G[s].push_back({t,d});
   }


   long long dp[V][V];
   for (int i=0; i<V; i++) {
       for (int j=0; j<V; j++) {
           dp[i][j]=100000000000;
           if (i==j) dp[i][j]=0;
       }
   }
   for (int i=0; i<V; i++) {
       for (auto a:G[i]) {
           dp[i][a.first]=a.second;
       }
   }
   for (int k=0; k<V; k++) {
       for (int i=0; i<V; i++) {
           for (int j=0; j<V; j++) {
               dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
               //cout << k << " " << i << " " << j << " " << dp[i][j] << endl;
           }
       }
   }
   bool a=true;

   for (int i=0; i<V; i++) {
       if (dp[i][i]<0) {
           cout << "NEGATIVE CYCLE" << endl;a=false;break;
       }
   }
   if (a){
   for (int i=0; i<V; i++) {
       for (int j=0; j<V; j++) {
           if (j!=V-1) {
               if (dp[i][j]>=10000000000) cout << "INF" << " ";
               else cout << dp[i][j] << " ";
           }
           else if (dp[i][j]<10000000000) cout << dp[i][j] << endl;
           else cout << "INF" << endl;
       }
   }
   }
}


Measured memory_bytes: 3272