akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
from itertools import count, cycle, repeat     # count(start[,step]), cycle(iter), repeat(elm[,n])
from itertools import groupby                  # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
from itertools import starmap                  # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    L = [True, True, True]
    L[ii()-1] = False
    L[ii()-1] = False
    for i in range(3):
        if L[i]:
            print(i+1)
          

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
p = [int(i) for i in input().split (' ')]
x1 = p[0]
y1 = p[1]
x2 = p[2]
y2 = p[3]


if x2-x1 > 0 and y2-y1 > 0:
    lx, ly = x2 - x1, y2 - y1
    x3, y3 = x2 - ly, y2 + lx
    x4, y4 = x3 - lx, y3 - ly
    
elif x2-x1 > 0 and y2-y1 < 0:
    lx, ly = x2 - x1, y1 - y2
    x3, y3 = x2 + ly, y2 + lx
    x4, y4 = x3 - lx, y3 + ly
    
elif x2-x1 < 0 and y2-y1 > 0:
    lx, ly = x1 - x2, y2 - y1
    x3, y3 = x2 - ly, y2 - lx
    x4, y4 = x3 + lx, y3 - ly
else:
    lx, ly = x1 - x2, y1 - y2
    x3, y3 = x2 + ly, y2 - lx
    x4, y4 = x3 + lx, y3 + ly
print(x3,y3,x4,y4)

    

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
using ll = long long;
using namespace std;

ll GCD(ll a, ll b) {
	return b ? GCD(b, a%b) : a;
}

//sort(a, a + N, greater<int>())   // descend
//sort(a, a+N)                    //  ascend

int main() {
	string s;
	cin >> s;
	bool pp = true;
	rep(i,0,3){
		if (s[i] == s[i + 1]) pp = false;
	}
	if (pp) cout << "Good";
	else cout << "Bad";
}

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 b = sc.nextInt();
		int c = sc.nextInt();
		if (a == b) {
			System.out.println(c);
		}else if (a == c) {
			System.out.println(b);
		}else if (b == c) {
			System.out.println(a);
		}
	}
}


Measured memory_bytes: 35656
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>

using namespace std;
char field[20][20];

void bomb(int x,int y){
	field[x][y]='0';
	for(int i=-3;i<=3;i++){
		if(field[x+i][y]=='1'){
			field[x+i][y]='0';
			bomb(x+i,y);
		}
		if(field[x][y+i]=='1'){
			field[x][y+i]='0';
			bomb(x,y+i);
		}
	}
	return;
}

int main(void){
	int n;
	int x,y;
	scanf("%d",&n);
	for(int a=1;a<=n;a++){
		memset(field,'0',sizeof(field));
		for(int i=0;i<8;i++){
			scanf("%s",field[i]);
		}
		scanf("%d",&x);
		scanf("%d",&y);
		bomb(y-1,x-1);
		printf("Data %d:\n",a);
		for(int i=0;i<8;i++){
			printf("%s\n",field[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 0
n,m,l = map(int,input().split())
A = [[int(i) for i in input().split()] for i in range(n)]
B = [[int(i) for i in input().split()] for i in range(m)]
result = [[0 for i in range(l)] for i in range(n)]

for i in range(n):
    for j in range(m):
        for k in range(l):
            result[i][k] += A[i][j] * B[j][k]

for i in range(n):
        print(" ".join(map(str,result[i])))

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

namespace ABC_Training
{

    class Program
    {
        static void Main(string[] args)
        {
            var nkq = Console.ReadLine().Split(' ');
            var n = int.Parse(nkq[0]);
            var k = int.Parse(nkq[1]);
            var q = int.Parse(nkq[2]);
            int[] p = new int[n];
            for(int i = 0; i < q; i++)
            {
                var a = int.Parse(Console.ReadLine());
                p[a - 1]++;
            }
            var result = p.Select(x => x + k- q);
            foreach(var a in result)
            {
                Console.WriteLine(a <= 0 ? "No" : "Yes");
            }
            
        }
    }
}


Measured memory_bytes: 17884
def getX(a, b, c, d, e, f)
  denominator = a * e - b * d
  numerator = c * e - b * f
  x = numerator / denominator
  x = 0.0 if x == -0.0
  return x
end

def getY(a, b, c, d, e, f)
  denominator = b * d - a * e
  numerator = c * d - a * f
  y = numerator / denominator
  y = 0.0 if y == -0.0
  return y
end

f = Array.new(6)

while input = gets
  value = input.split(/\s* \s*/)
  for i in 0...value.size
    f[i] = value[i].to_f
  end
  puts sprintf("%.3f %.3f",
    getX(f[0], f[1], f[2], f[3], f[4], f[5]),
    getY(f[0], f[1], f[2], f[3], f[4], f[5]))
end

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

int digit_sum(int n) {
    int ans = 0;
    while (n > 0) {
        ans += n % 10;
        n /= 10;
    }
    return ans;
}

int main() {
    int n,a;
    cin >> n;
    a = digit_sum(n);
    if (a==1) cout << 10 << endl;
    else cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))

vector<string> split(string,string);

//template<typename T>
//void swap(T*,T*);
//char ToUpper (char cX) { return toupper(cX); }

int main()
{
    int m; 
    cin >> m;
    cout << 24 - m + 24;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <algorithm>
#include <cstdlib>
using namespace std;
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}

int main() {
	int N;
	cin >> N;
	vector<int> F(50);
	F.at(0) = F.at(1) = 1;
	for (int i = 2; i <= N; i++) {
		F.at(i) = F.at(i - 1) + F.at(i - 2);
	}
	cout << F.at(N) << endl;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n,m,k;
  cin >> n >> m >> k;
  rep(i,m+1)rep(j,n+1){
    if(i*n+j*m-i*j*2 == k){
      cout << "Yes" << ln; return 0;
    }
  }
  cout << "No" << ln;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
//#include <algorithm>
#define endl "\n"
typedef long long ll;

using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

int  frq[200];
int main(){
	Lancer();
	//cout << fixed << setprecision(12);

	ll sz, n,res=0,r;
	cin >> sz >> n;
	vector<int > vec(n);
	for (int i = 0; i < n; i++)
		cin >> vec[i];
	//sort(vec.begin(), vec.end());
	res = vec[n - 1] - vec[0];
	for (int i = 1; i < n; i++){
		r = abs(vec[i] - (vec[i - 1] + sz));
		res = min(res, r);
	}
	cout << res;
	cout << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#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, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e15;
using namespace std;
typedef long long ll;
int main() {
  ll n;
  cin >> n;
  vector<double> x(n), y(n);
  REP(i, n) { cin >> x[i] >> y[i]; }
  double sum = 0, cnt = 0;
  REP(i, n) REP(j, n) {
    if (i == j) continue;
    ++cnt;
    sum += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
  }
  printf("%.10f\n", sum / n);
  return 0;
}

Measured memory_bytes: 256
N=int(input())
A=[int(i) for i in input().split()]
B=[]
endflag=False
ans=1
if N>2:
	for i in range(N-1):
		if A[i]<A[i+1]:
			B.append(1)
		elif A[i]==A[i+1]:
			B.append(0)
		else:
			B.append(-1)
	count=0
	while B[count]==0:
		count+=1
		if count>N-1:
			endflag=True
			break
	#print(A)
	#print(B)
	if not endflag:
		mode=B[count]
		
		while count<N-1:
			if B[count]+mode==0:
				#print(count,mode)
				ans+=1
				if count==N-2:
					break
				while B[count+1]==0:
					count+=1
					if count>N-1:
						endflag=True
						break
				mode=B[count+1]
			count+=1
			if endflag:
				break
print(ans)

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

int main(){
    
    
    int N,K;
    string S;
    
    cin >> N;
    cin >> S;
    cin >> K;
    
    char w = S[K-1];
    
    for(int i=0; i<N; i++){
        if(S[i] != w){
            S[i] = '*';
        }
    }
    
    cout << S << endl;
    
    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define For(i,n) for(ll i=0; i<n; ++i)
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define deb(x) cout<<"For debug : "<<x<<endl;
typedef long long ll;
#define ld long double

void solve()
{
    ll n;
    cin>>n;
    string s;
    map<int,char> mp;
    mp[0]='z';
    for(int i=0; i<25; i++)
    {
        char c = 'a'+i;
        mp[i+1] = c;
    }

    while(n>0)
    {
        int r=n%26;
        s+= mp[r];
        if(n%26==0) n--;
        n/=26;
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
}

int main(){
    optimize();
    ll T=1;
    //cin>>T;
    while(T--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3604
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
#define fi first
#define se second
using pii = pair<int,int>;
using ll = long long;

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

   int a, b, c, k;
   cin >> a >> b >> c >> k;


   int hoge = max({a,b,c});

   int ans = 0;
   if (hoge == a) {
         ans = b+c;
   }
   else if (hoge == b) {
      ans = a+c;
   }
   else {
      ans = a +b;
   }

   ans += hoge << k;
   
   outl(ans);

}



Measured memory_bytes: 256
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr

N=int(input())
if N==1:
    print(0)
    exit()
arr=factorization(N)
ans=0
for i in range(len(arr)):
    if arr[i][0]==1:
        continue
    cnt=1
    while arr[i][1]>0:
        if arr[i][1]>=cnt:
            arr[i][1]-=cnt
            ans+=1
            cnt+=1
        else:
            break
print(ans)

Measured memory_bytes: 9504
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n,m;cin >> n >>m;
    vl v(m);
    rep(i,m)cin >> v[i];
    ll dp[m+1][n+1];
    rep(i,m+1)rep(j,n+1)dp[i][j]=inf;
    rep(i,m+1)dp[i][0]=0;
    rep(i,m){
        rep(j,n+1){
            if(j+v[i]<n+1){
                chmin(dp[i][j+v[i]],dp[i][j]+1);
            }
            chmin(dp[i+1][j],dp[i][j]);
        }
    }
    cout << dp[m][n] <<endl;
}


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

int main() {
	vector<int> a(3);
  for(int i = 0; i < 3; ++i) cin >> a[i];
  sort(begin(a), end(a));
  int ans = a[2] * 10 + a[1] + a[0];
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int h, w;
int c[51][51];
int memo[51][51];
int count = 1;

void calc_r(int y, int x)
{
  if ( y < 0 || y >= h || x < 0 || x >= w ) { return; }
  if ( memo[y][x] ) { return; }
  if ( !c[y][x] ) { return; }
  memo[y][x] = count;

  calc_r(y-1, x-1);
  calc_r(y-1, x);
  calc_r(y-1, x+1);
  calc_r(y, x-1);
  calc_r(y, x+1);
  calc_r(y+1, x-1);
  calc_r(y+1, x);
  calc_r(y+1, x+1);
}

void calc()
{
  int k1, k2;

  for ( k1 = 0; k1 < h; k1++ ) {
    for ( k2 = 0; k2 < w; k2++ ) {
      if ( c[k1][k2] && !memo[k1][k2] ) { calc_r(k1, k2); count++; }
    }
  }
}



int main(void)
{
  int k1, k2;

  while ( 1 ) {
    scanf("%d %d", &w, &h);
    if ( (w|h) == 0 ) { break; }
    for ( k1 = 0; k1 < h; k1++ ) {
      for ( k2 = 0; k2 < w; k2++ ) { scanf("%d", &c[k1][k2]); }
    }
    count = 1;


    for ( k1 = 0; k1 < 51; k1++ ) {
      for ( k2 = 0; k2 < 51; k2++ ) { memo[k1][k2] = 0; }
    }

    calc();
    printf("%d\n", count-1);

  }




  return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
#define MAX_N 100
using namespace std;

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

  int n;
  cin >> n;
  string s[MAX_N];
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }
  int m;
  cin >> m;
  string t[MAX_N];
  for(int i = 0; i < m; i++){
    cin >> t[i];
  }

  bool exist[n];
  fill(exist, exist + n, true);
  for(int i = 0; i < m; i++){
    for(int j = 0; j < n; j++){
      if(exist[j] && s[j] == t[i]){
        exist[j] = false;
        break;
      }
    }
  }

  int ans = 0;
  for(int i = 0; i < n; i++){
    int count = 0;
    for(int j = 0; j < n; j++){
      if(exist[i] && exist[j] && 
        s[i] == s[j]) ++count;
    }
    ans = max(ans, count);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo (1LL<<63-1)
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define Matrix vector< vector < long long > >

using namespace std;

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

const long double Pi=acos(-1),e=2.718;
const int N=2e5+10,mod=1e9+7;
char s[N];
ll n,dp[2][2020],temp[2][2020];

int main ()
{
    scanf("%s",s);
    int n=0;
    while(1){
        if(s[n]=='\0')break;
        n++;
    }
    for(int i=n-1;i>=0;i--){
        for(int k=2018;k>=0;k--){
            for(int j=1;j>=0;j--){
                dp[j][k]=0;
                if(j==0){
                    dp[j][k] += temp[0][0];
                    dp[j][k] += temp[1][(k*10+s[i]-'0')%2019] + ((k*10+s[i]-'0')%2019==0);
                }
                if(j==1){
                    dp[j][k] += temp[1][(k*10+s[i]-'0')%2019] + ((k*10+s[i]-'0')%2019==0);
                }
            }
        }
        for(int k=2018;k>=0;k--){
            for(int j=1;j>=0;j--){
                temp[j][k] = dp[j][k];
            }
        }
    }
    printf("%lld",dp[0][0]);
    return 0;
}
/**

*/


Measured memory_bytes: 3980
#include<stdio.h>
int main(void)
{
	int max=0,min=1000,n,i;

	scanf("%d",&n);
	int a[n];

	for (i=0;i<n;i++){
		scanf("%d",&a[i]);
	 if(max<a[i])
		 max=a[i];

	 if(min>a[i])
		 min=a[i];
		 }

	printf("%d",max-min);

	return 0;

}



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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 int main(){
 
 int x; cin >> x;
 if(1200 > x) print("ABC");
 else print("ARC");
 
 }

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

#define MOD 998244353


long long n,a,b,k;

long long fakt[300005], inv[300005];

long long komb(int a,int b){
	long long ret;
	//if(b > a) return 0;
	ret = fakt[a];
	ret = (ret * inv[b]) % MOD;
	ret = (ret * inv[a - b]) % MOD;
	return ret; 
}

long long pang(long long a,int b){
	if(b == 0) return 1;
	long long now = pang(a, b / 2);
	now = (now * now) % MOD;
	if(b % 2 == 1) now = (now * a) % MOD;
	return now;
}

int main(){
	cin >> n >> a >> b >> k;

	fakt[0] = 1;
	inv[0] = 1;
	fakt[1] = 1;
	inv[1] = 1;
	for(int i = 2; i <= 300000; i++){
		fakt[i] = (fakt[i - 1] * i) % MOD;
		inv[i] = pang(fakt[i], MOD - 2);
	}

	long long jaw = 0;
	for(long long i = 0; i <= 300000; i++){
		if(i > n) break;
		long long sisa = k - a * i;
		if(sisa % b != 0 || sisa < 0) continue;
		long long pake = sisa / b;
		if(pake > n) continue;

		long long tamb = (komb(n, i) * komb(n, pake)) % MOD;
	//	cout << i << " " << tamb << " here\n";
		jaw = (jaw + tamb) % MOD;
	}
	cout << jaw << "\n";
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    for(int i=0;i<S.length();i++){
        if(S[i]+N>'Z'){
            S[i] = 'A' + S[i] + N - 'Z' -1;
        }else{
            S[i]+=N;        
        }
    }
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007; // 998244353;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const ld PI = acos((ld)-1);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template <typename T> V<T> prefix_sum(const V<T>& v) {
  int n = v.size();
  V<T> ret(n + 1);
  rep(i, 0, n) ret[i + 1] = ret[i] + v[i];
  return ret;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(auto&& x: vec) is >> x;
  return is;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}

template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}

template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}

template <typename T> vector<T> eratosthenes(T N) {
  vector<T> v(N + 1, 1);
  iota(all(v), 0);
  for(int i = 2; i * i < N + 1; i++) {
    for(int j = i * i; j < N + 1; j += i)  // i^2からスタートしてよい
    {
      if(v.at(j) == j) v.at(j) = i;
    }
  }
  return v;
}
//その数を割り切る(最小の)素数を入れる
// 1以外、1が入っているならば素数
//→素因数分解が対数時間で可能
// now→now/v[now]として1まで遷移していく

template <typename T> map<T,T> factor(T n, const vector<T>& s) {
  map<T,T> ret;
  while(n > 1) {
    ret[s.at(n)]++;
    n /= s.at(n);
  }
  return ret;
}

signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,ans=0;
  cin>>n;

  V<ll> er=eratosthenes(n);
  rep(i,1,n){
    auto ma=factor(i,er);
    ll tmp=1;
    for(auto&& j:ma){
      tmp*=1+j.sc;
    }

    ans+=tmp;
  }

  cout<<ans<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 11076
while True:
    
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    ans = 0
    if op == "?":
        break
    elif op == "+":
        print(a+b) 
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    elif op == "/":
        print(a//b)



Measured memory_bytes: 5596
N = int(input())
S = [input() for _ in range(N)]

L = ["0"]*N
for i in range(N):
    temp = ["0"]*10
    for j in range(10):
        temp[j] = S[i][j]
    temp.sort()
    L[i] = temp
        
L.sort()
ans = 0
cnt = 1
temp = L[0]
for i in range(1, N):
    if temp == L[i]:
        cnt += 1
    else:
        ans += cnt*(cnt-1)//2
        cnt = 1
        temp = L[i]
        
ans += cnt*(cnt-1)//2
print(ans)

Measured memory_bytes: 109016
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)

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

int main() {
  ll n, a, b, c; cin >> n >> a >> b >> c;
  vll l(n); REP(i, n) cin >> l.at(i);
  vll use(n, 0);
  ll ans = HIGHINF;
  for (ll i=1; i<(1LL<<(2*n)); i++) {
    ll j = 0;
    ll tmpi = i;
    while (tmpi > 0) {
      use.at(j++) = tmpi % 4;
      tmpi /= 4;
    }
    ll tmpa=0, tmpb=0, tmpc=0;
    ll tmpans = 0;
    REP(j, n) {
      if (use.at(j) == 1) {
        if (tmpa > 0) tmpans += 10;
        tmpa += l.at(j);
      } else if (use.at(j) == 2) {
        if (tmpb > 0) tmpans += 10;
        tmpb += l.at(j);
      } else if (use.at(j) == 3)  {
        if (tmpc > 0) tmpans += 10;
        tmpc += l.at(j);
      }
    }
    if (tmpa==0&&a>0 || tmpb==0&&b>0 || tmpc==0&&c>0) continue;
    tmpans += abs(a - tmpa) + abs(b - tmpb) + abs(c - tmpc);
    ans = min(ans, tmpans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>

using namespace std;
typedef long long ll;

int main() {
  string s;
  ll k;
  cin >> s >> k;
  
  ll maxc = min(k, (ll)s.size());
  for (int i = 0; i < maxc; i++) {
    if (s[i] > '1') {
      cout << s[i] << endl;
      return 0;
    }
  }
  cout << 1 << endl;  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long

int n;
int ac,wa,tle,re;

int main(){
  scanf("%d",&n);
  char tmp[5];
  for(int i=0;i<n;i++){
    scanf("%s",tmp);
    if(strcmp(tmp,"AC")==0) ac++;
    if(strcmp(tmp,"WA")==0) wa++;
    if(strcmp(tmp,"TLE")==0) tle++;
    if(strcmp(tmp,"RE")==0) re++;}

  
  printf("AC x %d\n",ac);
  printf("WA x %d\n",wa);
  printf("TLE x %d\n",tle);
  printf("RE x %d\n",re);
  
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (auto& e : a) cin >> e;
  sort(a.rbegin(), a.rend());

  ll r = 0;
  queue<ll> q;
  for (auto e : a) {
    if (!q.empty()) {
      r += q.front();
      q.pop();
      q.push(e);
    }
    q.push(e);
  }
  cout << r << endl;
}


Measured memory_bytes: 6424
import scala.io.StdIn.readInt

object Main {
  val c = Math.cos(Math.PI/3)
  val s = Math.sin(Math.PI/3)

  def main(args:Array[String]) = {
    val n = readInt
    var list = IndexedSeq((0D,0D),(100D,0D))
    (1 to n).foreach { _=>
      list = for{
        k<-0 until list.length-1; i = list(k); j = list(k+1)
        p1 = ((i._1*2+j._1)/3,(i._2*2+j._2)/3)
        p2 = ((i._1+j._1*2)/3,(i._2+j._2*2)/3)
        x = (p2._1-p1._1)*c-(p2._2-p1._2)*s+p1._1
        y = (p2._1-p1._1)*s+(p2._2-p1._2)*c+p1._2
        list2 = if(k==0) Iterator(i,p1,(x,y),p2,j) else Iterator(p1,(x,y),p2,j)
        q<-list2
      } yield q
    }

    for((i,j)<-list) printf("%.8f %.8f\n",i,j)
  }
}

Measured memory_bytes: 58212
// ProblemURL : https://atcoder.jp/contests/abc129/tasks/abc129_d
// ---------------------------------------------
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1e7), 1e7)
}

func ri() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func rs() string {
	sc.Scan()
	return sc.Text()
}

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

func main() {
	h, w := ri(), ri()
	s := make([]string, h)
	for i := range s {
		s[i] = rs()
	}

	l := make([][]int, h)
	r := make([][]int, h)
	for i := range l {
		l[i] = make([]int, w)
		r[i] = make([]int, w)
	}
	for i := range l {
		ctL := 0
		ctR := 0
		for j := range l[i] {
			if s[i][j] == '#' {
				ctL = 0
				l[i][j] = 0
			} else {
				ctL++
				l[i][j] = ctL
			}
			if s[i][w-1-j] == '#' {
				ctR = 0
				r[i][w-1-j] = 0
			} else {
				ctR++
				r[i][w-1-j] = ctR
			}
		}
	}

	u := make([][]int, h)
	d := make([][]int, h)
	for i := range u {
		u[i] = make([]int, w)
		d[i] = make([]int, w)
	}
	for i := 0; i < w; i++ {
		ctU := 0
		ctD := 0
		for j := 0; j < h; j++ {
			if s[j][i] == '#' {
				ctU = 0
				u[j][i] = 0
			} else {
				ctU++
				u[j][i] = ctU
			}
			if s[h-1-j][i] == '#' {
				ctD = 0
				d[h-1-j][i] = 0
			} else {
				ctD++
				d[h-1-j][i] = ctD
			}
		}
	}

	ans := 0
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if s[i][j] == '#' {
				continue
			}
			score := 0
			score += l[i][j]
			score += r[i][j]
			score += u[i][j]
			score += d[i][j]
			score -= 3
			chmax(&ans, score)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 146304
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=4e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const long double PI = acos(-1),eps=1.0e-14;
void solve(){
    int a,b;
    cin>>a>>b;
    cout<<(a%2==0||b%2==0?"No":"Yes")<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3624
#include <stdio.h>

int main(){
        unsigned long long int N,count=0,i=1;
        unsigned long long int f[90];
        f[0] = 2;
        f[1] = 1;
        scanf("%llu",&N);
        if (N==0){
                printf("2");
        }
        if(N==1){
                printf("1");
        }

        while(i<=N){
                count=count +1;
                i = i+1;
                f[i] = f[i-1]+f[i-2];
        }
        if(N>=2){
                printf("%llu\n",f[i-1]);
        }

        return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  int a;
  cin >> a;
  string b = to_string(a);
  int size = b.size();
  int last = stoi(b.substr(size - 1));

  if (last == 2 || last == 4 || last == 5 || last == 7 || last == 9) {
    cout << "hon" << endl;
  } else if (last == 0 || last == 1 || last == 6 || last == 8) {
    cout << "pon" << endl;
  } else if (last == 3) {
    cout << "bon" << endl;
  }
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

int fa[100005], vis[100005];
int Find(int x) { return x == fa[x] ? x : fa[x] = Find(fa[x]); }

int main() {
	int n, m; scanf("%d %d", &n, &m);
	for (RI i = 1; i <= n; ++i) fa[i] = i;
	for (RI i = 1, x, y, z; i <= m; ++i)
		scanf("%d %d %d", &x, &y, &z), fa[Find(x)] = Find(y);
	int ans = 0;
	for (RI i = 1; i <= n; ++i)
		if (!vis[Find(i)]) ++ans, vis[Find(i)] = 1;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
#define k_p make_pair


int main()
{
    char s[10];
    while(cin>>s+1)
    {
        if(s[3]==s[4] and s[5]==s[6])
            cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

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

	if (N % 2 == 0)
	{
		cout << N << endl;
	}
	else
	{
		cout << 2 * N << endl;
	}

	return 0;
}


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

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)
#define PM(a) ((a)?1:-1)

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 1100

int x[MAX], y[MAX], z[MAX], temp[MAX];
int N, m;

int hoge(int c){
	bool fx = (c>>2)&1, fy = (c>>1)&1, fz = c&1;
	int re = 0;
	
	for(int i = 0; i < N; i++){
		temp[i] = x[i]*PM(fx)+y[i]*PM(fy)+z[i]*PM(fz);
	}
	
	sort(temp,temp+N);
	
	for(int i = 0; i < m; i++){
		re += temp[N-i-1]; 
	}
	
	return re;
}

signed main(){
	cout<<fixed<<setprecision(7);
	
	int ans = 0;
	
	cin>>N>>m;
	
	for(int i = 0; i < N; i++){
		cin>>x[i]>>y[i]>>z[i];
	}
	
	for(int i = 0; i < 8; i++){
		ans = max(ans,hoge(i));
	}
	
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <cstring>
#include <list>  
#include <cassert>
#include <climits>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
std::mt19937 rnd((int)std::chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

const int MAXN = 200000;

int n, nop;
int a[MAXN];
int ans[MAXN];

int cur[MAXN];
int nxt[MAXN + 1];

void solve() {
	REP(i, n) cur[i] = a[i];
	REP(op, nop) {
		bool done = true; REP(i, n) if (cur[i] != n) done = false; if (done) break;
		REPE(i, n) nxt[i] = 0;
		REP(i, n) {
			int d = cur[i], l = max(0, i - d), r = min(n - 1, i + d);
			++nxt[l], --nxt[r + 1];
		}
		REP(i, n) nxt[i + 1] += nxt[i];
		REP(i, n) cur[i] = nxt[i];
	}
	REP(i, n) ans[i] = cur[i];
}

void run() {
	scanf("%d%d", &n, &nop);
	REP(i, n) scanf("%d", &a[i]);
	solve();
	REP(i, n) { if (i != 0) printf(" "); printf("%d", ans[i]); } puts("");
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 6940
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    string str,ans;
    cin>>str;
    ans=str.substr(0,3);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define finish(x) return cout << x << endl, 0

typedef long long ll;
typedef long double ldb;
const int md = 1e9 + 7;
const ll inf = 1e18;
const int OO = 1;
const int OOO = 0;
using namespace std;
 
struct wavelet {
	int n, mn, mx;
	vector<int> b[20];
	wavelet() {}
	wavelet(vector<int> a) {
		mn = *min_element(a.begin(), a.end());
		mx = *max_element(a.begin(), a.end());
		n = a.size();
		for (int i = 0; i < 20; i++) b[i].resize(n);
		construct(a, 0, 0, n, mn, mx);
		for (int lv = 0; lv < 20; lv++)
			for (int i = 1; i < n; i++) b[lv][i] += b[lv][i - 1];
	}
	void construct(vector<int> &a, int lv, int l, int r, int lo, int hi) {
		if (l >= r) return;
		int mid = (lo + hi) >> 1;
		for (int i = l; i < r; i++) b[lv][i] = (a[i] <= mid ? 1 : 0);
		if (lo == hi) return;
		int m = stable_partition(a.begin() + l, a.begin() + r, [mid](int x) {
			return x <= mid;
		}) - a.begin();
		construct(a, lv + 1, l, m, lo, mid);
		construct(a, lv + 1, m, r, mid + 1, hi);
	}
	int clt(int l, int r, int x) {
		return clt(l, r, x, 0, 0, n - 1, mn, mx);
	}
	int clt(int l, int r, int x, int lv, int nl, int nr, int lo, int hi) {
		if (l > r || x <= lo) return 0;
		if (hi < x) return r - l + 1;
		int mid = (lo + hi) >> 1;
		int cl = (l ? b[lv][l - 1] : 0) - (nl ? b[lv][nl - 1] : 0);
		int cr = b[lv][r] - (nl ? b[lv][nl - 1] : 0);
		int m = nl + b[lv][nr] - (nl ? b[lv][nl - 1] : 0);
		return
			clt(nl + cl, nl + cr - 1, x, lv + 1, nl, m - 1, lo, mid) +
			clt(m + l - nl - cl, m + r - nl - cr, x, lv + 1, m, nr, mid + 1, hi);
	}
};
 
int n, q;
vector<int> a;
 
int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	cin >> n >> q;
	a.resize(n);
	map<int, int> lst;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		a[i - 1] = lst[x];
		lst[x] = i;
	}
	wavelet w = wavelet(a);
	while (q--) {
		int x, y;
		cin >> x >> y;
		cout << w.clt(x - 1, y - 1, x) << '\n';
	}
}

Measured memory_bytes: 69588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e9;

int main(){
  string s;cin>>s;
  REP(i,0,s.size()){
    if(((i%2==0)&&!(s.at(i)=='R'||s.at(i)=='U'||s.at(i)=='D'))||
    ((i%2==1)&&!(s.at(i)=='L'||s.at(i)=='U'||s.at(i)=='D'))){
      print("No")
      return 0;
    }
  }
  print("Yes")
  return 0;
}


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

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl

int main(void){
    int T;
    cin >> T;
    rep(t,T){
        ll n, a, b, c, d;
        cin >> n >> a >> b >> c >> d;
        map<ll,ll> dp;
        using P = pair<ll, ll>;
        priority_queue<P,vector<P>,greater<P>> qu;
        qu.push({0,n});
        dp[n] = 0;
        ll size = 0;
        while(qu.size()) {
            P top = qu.top(); qu.pop();
            ll cost = top.first;
            ll x = top.second;
            if (x == 0) break;
            if (dp[x] < cost) continue;
            auto update = [&](ll nx, ll nc) {
                if (dp.count(nx) == 0 || dp[nx] > nc) {
                    qu.push({dp[nx] = nc, nx});
                }
            };

            if (x <= (INF - cost)/d) {
                update(0, cost + x*d);
            }

            if (x % 2 == 0) {
                update(x/2, cost + a);
            } else {
                update(x/2, cost + a + d);
                update(x/2 + 1, cost + a + d);
            }

            if (x % 3 <= 1) {
                update(x/3, cost + b + d*(x%3));
            } else {
                assert(x % 3 == 2);
                update(x/3 + 1, cost + b + d);
            }

            if (x % 5 <= 2) {
                update(x/5, cost + c + d*(x%5));
            } else {
                update(x/5 + 1, cost + c + d*(5-x%5));
            }
            size = max((ll)dp.size(), size);
        }
        cout << dp[0] << endl;
        debug(size);
    }
    return 0;
}


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

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

use std::iter::Iterator;

fn main() {

    input!{
       S:chars,
    }

    if S[0] != 'A'{
        println!("WA");
        return;
    }
    
    if S.iter()
        .skip(2)
        .rev()
        .skip(1)
        .filter(|c| **c == 'C')
        .count()
        != 1
        {
            println!("WA");
            return;
        }
    
        if S.iter()
        .filter(|c| match **c{
            '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' => true,
            _ => false,
        })
        .count()
        !=2
        {
            println!("WA");
            return;
        }
        println!("AC");

}


Measured memory_bytes: 4352
import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        init();
        int n = nextInt();
        ArrayList<Pair> pairs = new ArrayList<>();

        for (int i = 0; i < n; i++) {
            int x = nextInt(), l = nextInt();
            pairs.add(new Pair(x - l, x + l));
        }

        pairs.sort(Pair::compareTo);

        int currMin = Integer.MIN_VALUE;
        int keep = 0;

        for (Pair pair: pairs) {
            if (pair.first >= currMin) {
                keep++;
                currMin = pair.second;
            }
        }

        System.out.println(keep);
    }

    private static class Pair implements Comparable<Pair> {
        int first;
        int second;

        Pair(int first, int second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public int compareTo(Pair pair) {
            return second - pair.second;
        }
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
}


Measured memory_bytes: 45424
import java.util.Scanner;

public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        int i, j, k;
        double a, b, c, S, L, h;
         
        a = sc.nextDouble();
        b = sc.nextDouble();
        c = sc.nextDouble();
         
        S = a * b * Math.sin(Math.toRadians(c)) / 2;
        L = a + b + Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(Math.toRadians(c)));
        h = 2 * S / a;
         
        System.out.printf("%f\n%f\n%f", S, L, h);
    }
}



Measured memory_bytes: 28088
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pi 3.14159265358979323846264
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define vi vector <int>
#define vl vector <long long>
#define vpii vector <pair <int, int> >
#define ll long long
#define fi first
#define se second
#define FOR(i, x, y) for (int i=x; i<=y; i++)
#define FORI(i, x, y) for (int i=y; i>=x; i--)
#define debug printf("OK\n")
ll n, a[100005], ans[100005];
int main() {
    cin >> n;
    FOR(i, 0, n-1) cin >> a[i];
    ll sum = 0;
    for (int i=1; i<n-1; i+=2) sum += a[i]-a[i+1];
    ans[0] = a[0] - sum;
    FOR(i, 1, n-1) ans[i] = a[i-1]*2 - ans[i-1];
    FOR(i, 0, n-1) printf("%d%c", ans[i], i==n-1?'\n':' ');
    return 0;
}

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

using namespace std;

int Person[5], Judge[4];


void show() {
	for (int i = 0; i < 5; ++i) {
		cout << Person[i] << endl;
	}
}

bool isDraw() {
	
	if (Judge[1] == 5 || Judge[2] == 5 || Judge[3] == 5) {
		return true;
	}
	if (Judge[1] != 0 && Judge[2] != 0 && Judge[3] != 0) {
		return true;
	}
	return false;
}

void judge() {
	int i, a, b;

	a = Person[0];
	for (i = 1; i < 5; ++i) {
		if (Person[i] != a) {
			b = Person[i];
			break;
		}
	}
	//cout << a << " " << b << endl;
	if ( (a == 1 && b == 2) || (a == 2 && b == 3) || (a == 3 && b == 1) ) {
		Person[0] = 1;
	}
	if ( (a == 1 && b == 3) || (a == 2 && b == 1) || (a == 3 && b == 2) ) {
		Person[0] = 2;
	}
	for (int j = 1; j < 5; ++j) {
		if (Person[j] == a) {
			Person[j] = Person[0];
		} else{
			Person[j] = (Person[0] == 1) ? 2 : 1;
		}
	}
}

int main() {

	while (cin >> Person[0], Person[0]) {
		memset(Judge, 0, sizeof(Judge));
		++Judge[Person[0]];
		for (int i = 1; i < 5; ++i) {
			cin >> Person[i];
			++Judge[Person[i]];
		}
		if (isDraw()) {
			fill(Person, Person + 5, 3);
			show();
			continue;
		}
		judge();
		show();
	}

	return 0;
}


Measured memory_bytes: 3028