akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX_N = 9;

int n, a[MAX_N];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++){
		a[i] = i + 1;
	}
	do{
		for(int i = 0; i < n; i++){
			cout << a[i];
			if(i == n - 1) cout << endl;
			else cout << ' ';
		}
	}while(next_permutation(a, a + n));
	return 0;
}



Measured memory_bytes: 3116
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		if(N>=1000){
			System.out.println("ABD");
		}else{
			System.out.println("ABC");
		}
	}
}

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

static const int N = 100;

int main()
{
	int n, p[N + 1], m[N + 1][N + 1];
	cin >> n;

	for (int i = 1; i <= n; i++)
	{
		cin >> p[i - 1] >> p[i];
	}

	for (int i = 1; i <= n; i++) m[i][i] = 0;
	
	for (int l = 2; l <= n; l++)
	{
		for (int i = 1; i <= n - l + 1; i++)
		{
			int j = i + l - 1;
			m[i][j] = (1 << 21);
			for (int k = i; k <= j - 1; k++)
			{
				m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
			}
		}
	}

	cout << m[1][n] << endl;

	return 0;
}


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

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

    int matrice[n][3];
    int dp[n][3];

    for(int i = 0; i < n; i++)
        for(int j = 0; j < 3; j++)
           cin >> matrice[i][j];

    for(int i = 0; i < 3; i++)
        dp[0][i] = matrice[0][i];

    for(int i = 1; i < n; i++)
        for(int j = 0; j < 3; j++){
            if(j == 0)
                dp[i][j] = max(dp[i-1][1], dp[i-1][2]) + matrice[i][j];
            if(j == 1)
                dp[i][j] = max(dp[i-1][0], dp[i-1][2]) + matrice[i][j];
            if(j == 2)
                dp[i][j] = max(dp[i-1][0], dp[i-1][1]) + matrice[i][j];
            }
    cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]);

    return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>

int main(void)
{
	int num,A=0,B=0,AB=0,O=0;
	char blood[3];

	while(scanf("%d,%s",&num,blood)!=EOF)
		if(!strcmp(blood,"A"))
			A++;
		else if(!strcmp(blood,"B"))
			B++;
		else if(!strcmp(blood,"AB"))
			AB++;
		else if(!strcmp(blood,"O"))
			O++;
	printf("%d\n%d\n%d\n%d\n",A,B,AB,O);

	return 0;
}

Measured memory_bytes: 596
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
struct Node {
  int64_t to, cost;
  Node(int b, int c) {
    to   = b;
    cost = c;
  }
};
int n;
int q, k;

std::vector<Node> tree[100001];
int64_t cost[100001];
bool visited[100001];

void dfs(int64_t now, int64_t cos) {
  visited[now] = true;
  cost[now]    = cos;
  for (auto next : tree[now]) {
    if (!visited[next.to]) {
      dfs(next.to, next.cost + cost[now]);
    }
  }
  return;
}

int main(void) {
  cin >> n;

  for (int i = 0; i < n - 1; i++) {
    int m1, m2, m3;
    cin >> m1 >> m2 >> m3;
    tree[m1].push_back(Node(m2, m3));
    tree[m2].push_back(Node(m1, m3));
  }
  cin >> q >> k;
  dfs(k, 0);
  // cout << "----debug" << endl;
  // for (int i = 1; i <= n; i++) {
  //   cout << cost[i] << endl;
  // }
  // cout << "----debug" << endl;
  for (int i = 0; i < q; i++) {
    int x, y;
    cin >> x >> y;
    cout << cost[x] + cost[y] << endl;
  }
  return 0;
}


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

using namespace std;

using ll = long long;

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)

typedef pair<int, int> P;

const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

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 gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

int h, w;
int sy, sx;
int gy, gx;
char maze[55][55];

int d[55][55];

int bfs() {
	queue<P> que;
	REP(i, h)REP(j, w) d[i][j] = INF;
	que.push(P(sy, sx));
	d[sy][sx] = 0;
	
	while (que.size()) {
		P p = que.front();
		que.pop();
		if (p.first == gy && p.second == gx) break;
		
		REP(i, 4) {
			int ny = p.first + dy[i], nx = p.second + dx[i];
			if (0 <= ny && ny < h && 0 <= nx && nx < w && maze[ny][nx] != '#' && d[ny][nx] == INF) {
				que.push(P(ny, nx));
				d[ny][nx] = d[p.first][p.second] + 1;
			}
		}
	}
	
	return d[gy][gx];
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> h >> w;
	sy = 0, sx = 0;
	gy = h - 1, gx = w - 1;
	int blackCnt = 0;
	REP(i, h) {
		REP(j, w) {
			cin >> maze[i][j];
			if (maze[i][j] == '#') blackCnt++;
		}
	}
	
	if (bfs() == INF) {
		cout << -1 << endl;
	} else {
		cout << h * w - bfs() - 1 - blackCnt << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
# C - Build Stairs

N = int(input())
H = [int(h) for h in input().split()]
ans = 'Yes'
for i in range(1, N):
    if H[i - 1] <= H[i] - 1:
        H[i] -=1
    if H[i] < H[i - 1]:
        print('No')
        break
else:
    print('Yes')


Measured memory_bytes: 14224
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        int ans = 0;
        if(a >= b) ans += b;
        else ans += a;
        if(c >= d) ans += d;
        else ans += c;
        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
#include <iostream>

int main() {
    std::string s, t;
    std::cin >> s >> t;
    int m = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == t[i]) {
            m++;
        }
    }
    std::cout << m << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MAX=200050;
ll n,a[MAX],k,min_a=(1ll<<63)-1ll,cut;
priority_queue<ll> mtry;
int main(){
    scanf("%lld",&n);
    cut=n;
    for(int i=0;i<n;i++) scanf("%lld",&a[i]),min_a=min(a[i],min_a);
    for(int i=0;i<n;i++){
        ll t=(a[i]-min_a)/(n+1);
        a[i]-=t*(n+1); k+=t;
    }
    for(int i=0;i<n;i++) a[i]+=k;
    ll t=max(min_a+k-n,0ll);
    for(int i=0;i<n;i++) k+=t, a[i]-=t;
    for(int i=0;i<n;i++) mtry.push(a[i]);
    while(mtry.top()>=cut){
        ll t=mtry.top();
        mtry.pop(), t-=(n+1); mtry.push(t);
        cut--; k++;
    }
    printf("%lld\n",k);
}


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

int main(){
    int N;
    long long K;
    std::cin >> N >> K;
    std::vector< int > A(N);
    std::vector< bool > visit(N, true);
    
    for(int i=0; i<N; i++){
        std::cin >> A[i];
        A[i]--;
    }
    
    int cur = 0;
    while(visit[cur] && K != 0){
        visit[cur] = false;
        cur = A[cur];
        K--;
    }
    
    if(K == 0){
        std::cout << cur + 1 << std::endl;
        return 0;
    }
    
    visit.assign(N, true);
    long long cnt = 0;
    while(visit[cur] && K != 0){
        visit[cur] = false;
        cur = A[cur];
        cnt++;
        K--;
    }
    
    if(K == 0){
        std::cout << cur + 1 << std::endl;
        return 0;
    }
    
    K = K % cnt;
    
    while(K != 0){
        cur = A[cur];
        K--;
    }
    
    std::cout << cur + 1 << std::endl;
    return 0;
}



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

#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

signed main(){
    string s,t; cin >> s>>t;
    rep(i,s.size()){
        if(s[i]!=t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 3624
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std;

inline void solve(){ 
    string  s;
    cin>>s;
    int l=sz(s);
    bool ok=true;
    for (int i=0;i<l;i++){
        if ((i&1) and (s[i]=='R')) ok=false;
        if ((i%2==0) and (s[i]=='L')) ok=false;
    }
    cout << (ok?"Yes":"No") << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

Measured memory_bytes: 2708
while 1 :
	n, m = map(int,raw_input().split(" "))
	if (n, m) == (0,0):
		break
	Lon = [0 for _ in range(1000 * n + 1)]
	Lat = [0 for _ in range(1000 * m + 1)]
	Lon_sum = []
	Lat_sum = []
	for _ in range(0,n):
		h = int(raw_input())
		Lon_sum = [h + j for j in Lon_sum] + [h]
		for j in Lon_sum:
			Lon[j] += 1
	for _ in range(0,m):
		w = int(raw_input())
		Lat_sum = [w + j for j in Lat_sum] + [w]
		for j in Lat_sum:
			Lat[j] += 1
	max_width = min(Lon_sum[0],Lat_sum[0])
	print sum([Lon[i]*Lat[i] for i in range(1,max_width+1)])

Measured memory_bytes: 98532
#include<iostream>
using namespace std;
int main(){
    string a;
    cin>>a;
    int len=a.size();
    for(int i=0;i<len;i++){
    	if(a[i]=='C'){
    		for(int j=i+1;j<len;j++){
    			if(a[j]=='F'){
    				cout<<"Yes";
    				return 0;
				}
			}
		}
	}
	cout<<"No";
    return 0;
}

Measured memory_bytes: 256
a, b, c, d = map(lambda x: int(x), input().split())
a -= 1

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def lcm(a, b):
    return a*b // gcd(a, b)

def calc(ab, c, d):
    return ab - (ab//c + ab//d - ab//lcm(c,d))
  

num_a = calc(a, c, d)
num_b = calc(b, c, d)

print(num_b - num_a)
  

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

typedef complex<double> P;



int deg[100010];
vector<int> g[100010];

set<int> A,B;
int N;
	

void rekkyo(int x,int p){
	A.erase(x);
	B.insert(x);
	for( auto e : g[x] ){
		if( e != p ){
			rekkyo(e,x);
		}
	}
}

int subtree(int x,int p){

	int ans = 0;
	for( auto e : g[x] ){
		if( e != p ){
			int sz = subtree(e,x);
			ans += sz;
			if( N - sz == sz ){
				deg[e]--;
				deg[x]--;
				rekkyo(e,x);
			}
		}
	}
	return ans+1;
}

int u,v;
bool check(set<int> A){
	if( A.size() == 1 ) return true;
	int X;
	if( A.count(u) ) X = u;
	else X = v;

	if( deg[X] != 1 ) return false;
	
	int D[3] = {};
	for( auto a : A ){
		if( deg[a] != 1 && deg[a] != 2 ) return false;
		D[deg[a]]++;
	}
	return D[1] == 2;
}



int _main(){
	cin >> N;
	
	cin >> u >> v;
	u--,v--;
	for(int i = 0 ; i < N ; i++) A.insert(i);
	for(int i = 0 ; i < N-1 ; i++){
		int a,b;
		cin >> a >> b;
		--a,--b;
		g[a].push_back(b);
		g[b].push_back(a);
		deg[a]++;
		deg[b]++;
	}
	subtree(0,-1);
	if( A.size() != B.size() ){
		cout << "No" << endl;
		return 0;
	}

	if( A.count(u) && A.count(v) || B.count(u) && B.count(v) ) cout << "No" << endl;
	else if( check(A) && check(B) ){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

int main(){
	const int size = 256 * 1024 * 1024;
	void *p = malloc(size);
	esp_new = (long long)p + size - 1;
	__asm__("mov %rsp, esp_org");
	__asm__("mov esp_new, %rsp");
	
	_main();

	__asm__("mov esp_org, %rsp");	
}

Measured memory_bytes: 26180
#include<stdio.h>

int main(void) {

	int i = 0, n, a[10000];

	while (1) {

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

			if (a[i] == 0)
				break;

			i++;

	}

	n = i;
	for (i = 0; i < n; i++)

		printf("Case %d: %d\n", i + 1, a[i]);

	return 0;

}


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

using namespace std;
using ll = long long int;
using vec = vector<int>;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define Sort(a)    sort(a.begin(), a.end())
#define gSort(a)   sort(a.begin(), a.end())
const int INF = 2147483647;
const ll  MOD = 1000000007;

int main() {
    int k[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int n; cin >> n;

    cout << k[n-1];
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int,input().split()))

if n == 0:
    print(1 if A[0] == 1 else -1)
else:

    ans = 1
    b = 0
    L = [[0,0] for i in range(n)]
    # L[-1][0] = A[-1]
    # L[-1][1] = A[-1]
    l = A[-1]
    r = A[-1]
    for i in range(n-1,-1,-1):

        L[i][0] = (l+1)//2 + A[i]
        L[i][1] = r + A[i]
        l = L[i][0]
        r = L[i][1]

    if L[0][0] != 1:
        print(-1)
    else:
        ans = 1
        now = 1
        for i in range(1, n):
            now = min(L[i][1], now*2)
            # print(i,now)
            ans += now
            now -= A[i]
        print(ans + A[-1])

Measured memory_bytes: 90744
N,M = map(int,input().split())
bro = [int(input()) for i in range(M)]
mod = 10**9 + 7
dp = [0]*(N+1)
dp[0] = 1
if len(bro) >= 1 and bro[0] != 1:
    dp[1] = 1
elif len(bro) >= 1:
    del bro[0]
elif len(bro) == 0:
    dp[1] = 1
for i in range(2,N+1):
    if len(bro) == 0:
        dp[i]= (dp[i-1] + dp[i-2]) % mod
    elif bro[0] == i:
        del bro[0]
        continue
    else:
        dp[i]= (dp[i-1] + dp[i-2]) % mod
print(dp[-1] % mod)


Measured memory_bytes: 7848
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int k = int.Parse(Console.ReadLine());

            char targetChar = s[k - 1];

            for(int i = 0; i < n; ++i)
            {
                if(s[i] == targetChar)
                {
                    Console.Write(targetChar);
                }
                else
                {
                    Console.Write('*');
                }
            }
            Console.WriteLine();

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
N, M = map(int,input().split())
left = 1
right = N
for i in range(M):
    l,r = map(int,input().split())
    if left < l:
        left = l
    if r < right:
        right = r
if right >= left:
    print(str(right-left+1))
else:
    print("0")

Measured memory_bytes: 3060
#ABC 52, B - increment decrement
n = int(input())
s = list(input())

x = 0
max_x = 0
for i in s:
    if i == 'I':
        x += 1
    if i == 'D':
        x -= 1
    max_x = max(max_x, x)
print(max_x)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;
ll mod = pow(10,9) + 7;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}


int main(void){
    int w,h,n; cin >> w >> h >> n;
	int min_w=0, min_h = 0;
	vector<int> x(n) ,y(n), a(n);
	rep(i,n){
		cin >> x[i] >> y[i] >> a[i];
		if (a[i]==1){
			min_w = max(min_w,x[i]);
		}else if(a[i]==2){
			w = min(w,x[i]);
		}else if(a[i]==3){
			min_h = max(min_h, y[i]);
		}else{
			h = min(y[i],h);
		}
	}
	cout << ((h-min_h) < 0 || (w-min_w) < 0? 0: (h-min_h)*(w-min_w)) << endl;

}


Measured memory_bytes: 256
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
A = list(ma())
ans = 1
for a in A:
    ans*=a
    #print(ans)
    if ans>10**18:
        ans = -1
        break
mi = min(A)
if mi>0:
    print(ans)
else:
    print(0)


Measured memory_bytes: 22808
#include <stdio.h>
//prince
 int main(void){
 int a, b, c;

 scanf("%d%d%d", &a, &b, &c);

 int ispoor = 0;
 if (a == b && b != c) ispoor = 1;
 if (b == c && c != a) ispoor = 1;
 if (c == a && a != b) ispoor = 1;

 if (ispoor) {
 puts("Yes");
 } else {
 puts("No");
 }

 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#define N 100010
#define ll long long 
using namespace std;
ll n,m,a[N],b[N];
map<ll,ll> p;

ll gcd(ll x,ll y) {
	if (!y) return x;
	return gcd(y,x%y);
}

int main() {
	scanf("%lld%lld",&n,&m);
	for (ll i=1; i<=n; i++) {
		char c; cin>>c;
		a[i]=c-'a'+1;
	}
	for (ll i=1; i<=m; i++) {
		char c; cin>>c;
		b[i]=c-'a'+1;
	}
	ll g=gcd(n,m),l=n*m/g; 
	for (ll i=1; i<=n; i++) 
		p[(i-1)*(l/n)+1]=a[i];
	for (ll i=1; i<=m; i++) {
		ll val=p[(i-1)*(l/m)+1];
		if (val && val!=b[i]) {
			puts("-1");
			return 0;
		}
	}
	printf("%lld",l);
}


Measured memory_bytes: 11904
program prob6
    implicit none
    integer :: N
    logical :: b(2)
    logical :: bl, br, btmp
    logical :: c
    integer :: l, r, tmp
    integer :: i
    character(len=10) :: S
    

    read(*,*) N


    ! 1番目
    write(*,*) 0
    call flush(6)

    read(*,*) S
    if(trim(adjustl(S)) == "Vacant") then
        stop
    end if

    if(trim(adjustl(S)) == "Male") then
        b(1) = .true.
    else
        b(1) = .false.
    end if
    
    ! 2番目
    write(*,*) N/2
    call flush(6)

    read(*,*) S
    if(trim(adjustl(S)) == "Vacant") then
        stop
    end if

    if(trim(adjustl(S)) == "Male") then
        b(2) = .true.
    else
        b(2) = .false.
    end if

    if(mod(N/2, 2) == 1)then
        if(xor(b(1), b(2)) .eqv. .true.) then
            c = .false.
        else
            c = .true.
        end if
    else
        if(xor(b(1), b(2)) .eqv. .true.) then
            c = .true.
        else
            c = .false.
        end if
    end if

    if(c) then
        l = 0
        r = N/2
        bl = b(1)
        br = b(2)
    else
        l = N/2
        r = N
        bl = b(2)
        br = b(1)
    end if

    do i = 3, 20 
        ! 読み込み
        tmp = (l+r) / 2
        write(*,*) tmp
        call flush(6)
        read(*,*) S
        if(trim(adjustl(S)) == "Vacant") then
            stop
        end if
        if(trim(adjustl(S)) == "Male") then
            btmp = .true.
        else
            btmp = .false.
        end if

        if(mod(tmp - l, 2) == 1) then !間が偶数席
            if(xor(bl, btmp) .eqv. .false.) then
                r = tmp
                br = btmp
                cycle
            end if
        else
            if(xor(bl, btmp) .eqv. .true.) then
                r = tmp
                br = btmp
                cycle
            end if
        end if

        if(mod(r - tmp, 2) == 1) then !間が偶数席
            if(xor(br, btmp) .eqv. .false.) then
                l = tmp
                bl = btmp
                cycle
            end if
        else
            if(xor(br, btmp) .eqv. .true.) then
                l = tmp
                bl = btmp
                cycle
            end if
        end if
    end do



    stop
contains
end program prob6

Measured memory_bytes: 3816
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, k, a[100100], res = inf;

signed main() {
	cin >> n >> k;
	rep(i,n) cin >> a[i];
	rep(i,n-k+1) {
		int x = a[i], y = a[i+k-1];
		if ((x<0 && 0<y) || (0<x && y<0)) chmin(res, abs(x)+abs(y)*2), chmin(res, abs(x)*2+abs(y));
		else chmin(res, max(abs(x), abs(y)));
	}
	cout << res << endl;
}

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

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

const int mod = (int)1e9 + 7;
const int mod2 = 998244353;

ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
	if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}
ll mul(ll a, ll b, ll md){
	return a*b % md;
}
vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
	fact.resize(n+5);
	inv_fact.resize(n+5);
	fact[0] = inv_fact[0] = 1;
	for(int i = 1; i <= n; i++){
		fact[i] = (fact[i-1] * i) % mod;
		inv_fact[i] = exp(fact[i], mod-2, mod);
	}
}
ll komb(ll a, ll b){
	return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}
const int N = 500+5;
int h, w;
vector<vector<int>> ans;
vector<vector<int>> vec(N, vector<int>(N));
int main(){
	ios::sync_with_stdio(false); cin.tie(NULL);
	cin>>h>>w;
	for(int i = 1; i <= h; i++) for(int j = 1; j <= w; j++){
	   cin>>vec[i][j];
	}
	bool c1 = 0;
	for(int i = 1; i <= h; i++){
		for(int j = (i%2 ? 1 : w); (i%2 ? j <= w : j >= 1); (i%2 ? j++ : j--)){
			int x = vec[i][j];
			if((x & 1) && !c1){
				c1 = true;
			}
			else if(x & 1){
				c1 = false;
			}
			if(c1){
				if(i%2){
					if(j == w && i != h){
						ans.pb({i, j, i+1, j});
						//vec[i+1][j]++;
					}else if(j != w){
						ans.pb({i, j, i, j+1});
						//vec[i][j+1]++;
					}
				}else if(i%2 == 0){
					if(j == 1 && i != h){
						ans.pb({i, j, i+1, j});
						//vec[i+1][j]++;
					}
					else if(j != 1){
						ans.pb({i, j, i, j-1});
						//vec[i][j-1]++;
					}
				}
			}
		}
	}
	cout<<ans.size()<<"\n";
	for(auto x: ans) cout<<x[0]<<" "<<x[1]<<" "<<x[2]<<" "<<x[3]<<"\n";
}

Measured memory_bytes: 10032
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintStream out = new PrintStream(System.out);

        int N, T[], M, sum;

        sum = 0;
        N = sc.nextInt();
        T = new int[N];
        for (int i = 0; i < N; i++) {
            T[i] = sc.nextInt();

            sum += T[i];
        }

        M = sc.nextInt();
        for (int i = 0; i < M; i++) {
            out.println(sum - T[sc.nextInt() - 1] + sc.nextInt());
        }
        
        sc.close();
    }
}

Measured memory_bytes: 21716
# -*- coding:utf-8 -*-
# https://atcoder.jp/contests/abc150/tasks/abc150_c

def solve():
    import itertools
    import bisect

    N = int(input())
    Ps = tuple(map(int, input().split()))
    Qs = tuple(map(int, input().split()))

    lst = [i for i in range(1, N+1)]
    origins = list(itertools.permutations(lst, r=N))
    origins.sort()

    for i, p in enumerate(origins):
        if p == Ps:
            a = i
        if p == Qs:
            b = i

    print(abs(a-b))



if __name__ == "__main__":
    solve()


Measured memory_bytes: 8052
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
  boost::for_each(vc, [&os, &vc](T value) {
    os << value;
    if (value != vc.back())
      os << ' ';
    });
  return os;
}

template<class T1, class T2>
inline
std::ostream&
operator<<(std::ostream& os, const std::pair<T1, T2>& p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  string S{}; std::cin >> S;

  const std::set<char> ACGT = {'A', 'C', 'G', 'T'};
  ui ans{ 0 }, res{ 0 };
  boost::for_each(S, [&ACGT, &ans, &res](char c) {
    if (ACGT.count(c))
    {
      ++res;
    }
    else
    {
      ans = std::max(res, ans);
      res = 0;
    }
    });

  ans = std::max(res, ans);
  std::cout << ans << '\n';

  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


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

using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define double long double
#define endl '\n'

signed main() {
    fio;
    int n; cin >> n;
    vector<int> a(n) , res(n);
    for(int &it : a) {
        cin >> it;
    }
    vector<int> d;
    for(int i = 0; i + 1 < n; i++) {
        d.push_back(a[i] ^ a[i + 1]);
    }
    
    int start = 0;
    for(int i = 1; i < n; i++) {
        res[i] = d[i - 1] ^ res[i - 1];
        start ^= res[i];
    }
    start ^= a[0];
    for(int &it : res) it ^= start;
 
    for(auto it : res) {
        cout << it << " ";
    }
    cout << endl;

    return 0;
}




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

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

    int e;

    while(cin>>e,e){
        int res=10000000;
        for(int z=100;z>=0;z--){
                for(int y=1000;y>=0;y--){
                    int x=e-z*z*z-y*y;

                    if(x>=0){
                        res=min(res,x+y+z);
                    }
                }
        }

        cout << res << endl;
    }
}

Measured memory_bytes: 1192
/*
 * AOJ - ALDS_1_4_B: Binary Search
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B
 */
#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

typedef long long ll;

const int NOT_FOUND = -1;

int binarySearch(vector<int> &A, int n){
  int left  = 0;
  int right = A.size();

  while(left < right){
    int mid = (left + right) / 2;

    if(A[mid] == n){
      return mid;
    }else if(A[mid] > n){
      right = mid;
    }else{
      left = mid + 1;
    }
  }

  return NOT_FOUND;
}

int main(){
  int n, q, key;

  while(cin >> n){
    vector<int> S(n);

    for(int i = 0; i < n; i++){
      scanf("%d", &S[i]);
    }

    int findCount = 0;
    cin >> q;

    for(int i = 0; i < q; i++){
      cin >> key;
      int result = binarySearch(S, key);

      if(result != NOT_FOUND){
        findCount += 1;
      }
    }

    cout << findCount << endl;
  }

  return 0;
}

Measured memory_bytes: 1532
// 5/31
// 2-6-2. 双六
// 類題
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;

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

// ax + by = gcd(a, b)を満たすx, yを求める。
// 戻り値はgcd(a, b)
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;  // gcd。普通のユークリッド。
    }
    ll d = extGCD(b, a % b, y, x);
    y -= a/b * x;
    return d;
}

int main() {
    ll a, b;  // > 0
    cin >> a >> b;

    ll x, y;

    // dには最大公約数が格納される
    ll d = extGCD(a, b, x, y);

    // 今回はax + by = 1なので、d = 1であれば解が存在する。
    // if (d == 1) {
    //     // ll ans[4];
    //     // if (x >= 0) ans[0] = x;
    //     // else ans[0] = 0;
    //     // if (x <= 0) ans[1] = -x;
    //     // else ans[1] = 0;
    //     // if (y >= 0) ans[2] = y;
    //     // else ans[2] = 0;
    //     // if (y <= 0) ans[3] = -y;
    //     // else ans[3] = 0;

    //     // printf("%d %d %d %d\n", ans[0], ans[1], ans[2], ans[3]);
    //     cout << x << " " << y << endl;
    // }
    // else {
    //     printf("-1\n");
    // }
    cout << x << " " << y << endl;
}



Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <map>
#include <cstdio>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
 
using namespace std;
 
typedef pair<int, int> P;
 
int M;
int rest;

map<char, int> val;
vector<int> memory;

char expr(const string &s);

void error(){
	cout << "Error" << endl;
	exit(0);
}

char assign(const string &s){
	val[s[0]] = val[expr(s.substr(2))];
	return s[0];
}

char malloc(const string &s){
	int mem = atoi(s.substr(7).c_str());
	if(mem > rest) return 'n';
	rest -= mem;
	memory.push_back(mem);
	val['-'] = memory.size()-1;
	return '-';
}

char clone(const string &s){
	char c = expr(s.substr(6, s.size()-7));
	if(val[c] == 0) return c;
	if(val[c] == -1) error();
	else{
		int mem = memory[val[c]];
		if(mem > rest) return 'n';
		rest -= mem;
		memory.push_back(mem);
		val['-'] = memory.size()-1;
	}
	return '-';	
}

char expr(const string &s){
	if(s.size() == 1) return s[0];
	if(s[1] == '=') return assign(s);
	if(s[0] == '(') return expr(s.substr(1, s.size()-2));
	if(s[0] == 'm') return malloc(s);
	if(s[0] == 'c') return clone(s);
	return 'n';
}

void free(const string &s){
	char c = expr(s.substr(5, s.size()-6));
	if(val[c] == 0) return;
	if(val[c] == -1) error();
	else{
		rest += memory[val[c]];
		memory[val[c]] = 0;
		val[c] = -1;
	}
}

void line(const string &s){
	if(s[0] == 'f'){
		free(s);
	}else{
		expr(s);
	}
}

void init(){
	for(int i = 'A'; i <= 'Z'; i++){
		val[i] = -1;
	}
	val['-'] = -1;
	val['n'] = 0;
	memory.push_back(0);
	rest = M;
}

int check(){
	for(int i = 'A'; i <= 'Z'; i++){
		if(val[i] != -1){
			string s = "free";
			free(s+'('+(char)i+')');
		}
	}

	return M-rest;
}

int main(){
	cin >> M;
	init();
	string s;
	while(cin >> s) line(s);

	cout << check() << endl;

	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define For(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
typedef vector<int> vint;
typedef vector<long long> vlint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<vector<long long>> vlint2;


lint gcd(lint x, lint y){
    if (x == 0) return y;
    return gcd(y % x, x);
};

lint lcm(lint x, lint y){
    return x * y / gcd(x, y);
};

lint powint(lint x, lint y){
    int ret = 1;
    for (int i=0; i < y; i++) ret *= x;
    return ret;
};

lint powmod(lint x, lint y, lint m){
    if (y == 0) return 1;
    return ((powint(powmod(x, y>>1, m), 2) % m) * powint(x, (y & 1))) % m;
};

lint comb(lint n, lint r, lint m){
    if (n < r) return 0;

    if (n-r < r) r = n-r;
    int ret = 1; int d = 1;
    for (int i = n-r+1; i < n+1; i++) ret = (ret * i) % m;
    for (int i = 1; i < r+1; i++) d = (d * i) % m;
    ret *= powmod(d, m-2, m);
    return ret % m;
};

lint min_arr(vector<lint> x){
    lint y = x[0];
    rep(i, x.size()){
        y = min(y, x[i]);
    }
    return y;
};

int mod = 1000000007;
vector<int> dx = {1, 0, 0, -1, 1, 1, -1, -1};
vector<int> dy = {0, -1, 1, 0, 1, -1, 1, -1};

map<char, long long> counter(string s){
    map<char, long long> count;
    rep(i, s.size()){
        count[s[i]] ++;
    }
    return count;
};

int main() {
    int n, m; cin >> n >> m;
    vlint a(n);
    lint sum = 0;
    rep(i, n){
        cin >> a[i];
        sum += a[i];
    }
    sort(all(a));
    reverse(all(a));

    string ans = "Yes";
    rep(i, m){
        if (4 * a[i] * m < sum){
            ans = "No";
            break;
        }
    }
    cout << ans << endl;

}



Measured memory_bytes: 256
fun readInts() = readLine()!!.split(" ").map(String::toInt)

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val xs = readInts()
  val max = xs.max()!!
  val min = xs.min()!!
  val outputs = mutableListOf<String>()

  fun processAllPos() {
    for (i in 1..(n - 1)) {
      outputs.add("$i ${i + 1}")
    }
  }

  fun processAllNeg() {
    for (i in n downTo 2) {
      outputs.add("$i ${i - 1}")
    }
  }

  if (min >= 0) {
    processAllPos()
  } else if (max <= 0) {
    processAllNeg()
  } else {
    if (Math.abs(max) >= Math.abs(min)) {
      val maxIndex = xs.indexOf(max) + 1
      for (i in 1..n) {
        outputs.add("$maxIndex $i")
      }
      processAllPos()
    } else {
      val minIndex = xs.indexOf(min) + 1
      for (i in 1..n) {
        outputs.add("$minIndex $i")
      }
      processAllNeg()
    }
  }
  println(outputs.size)
  outputs.forEach { println(it) }
}


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

int spf[101];

map<int,int>mp;

void init() {
    int i , j;
    for(i=0;i<=100;++i) spf[i] = i;
    for(i=2;i*i<=100;++i) {
        if(spf[i]) {
            for(j=2*i;j<=100;j+=i) {
                if(spf[j] == j) 
                    spf[j] = i;
            }
        }
    }
}

void factorize(int n) {
    while(n > 1) {
        // cout << n << ' ';
        mp[spf[n]]++;
        n /= spf[n];
    }
    // cout << endl;
}

int32_t main() {
	init();
	int n , i , j , k , l , ans = 0;
    // 	for(int i=0;i<=100;++i) cout << i << " : " << spf[i] << endl;
    cin >> n;
    for(i=1;i<=n;++i) {
        // cout << i << " : ";
        factorize(i);
    }
    int c2 =0 , c4 =0 , c14 =0 , c24 =0  , c74 = 0;
    for(auto x:mp) {
    	if(x.second >= 74) c74++;
    	if(x.second >= 24) c24++;
    	if(x.second >= 14) c14++;
    	if(x.second >= 04) c4++;
    	if(x.second >= 02) c2++;
    }
    cout << c74 + (c24 * (c2-1)) + (c14 * (c4 - 1)) + (c4 * (c4-1) * (c2-2))/2 << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll INFL = 1e18+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

int N, X;
int m[100];

int main() {
	cin >> N >> X;
	REP(i, N) scanf("%d", m + i);
	
	int res = X - accumulate(m, m + N, 0);
	int ans = N + res / (*min_element(m, m + N));
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
const int MOD = 1000000007;

int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  cout << min(a+c,min(a+b,b+c)) << endl;
  
  return 0;
}



Measured memory_bytes: 256
//c++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
#include <fstream>
#include <random>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define revrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);
#define sz(x) ((int)(x).size())

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const int INF = 1 << 30;//10^9
const ll MOD = 1000000007;
//const ll MOD = 998244353;
double EPS = 1e-10;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A){printf("%.9lf\n", A);}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){
  ll res = x / gcd(x, y);
  res *= y;
  return res;
};


//コンビネーション
const int MAXcomb = 2000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

const int MAXkai = 500010;
ll kai_memo[MAXkai];
ll kai(ll N){
  if(kai_memo[N] != 0) return kai_memo[N];
  if(N <= 1) return 1;
  return kai_memo[N] = N * kai(N-1) % MOD;
}

ll disit(ll s, ll base = 10){
  ll res = 0;
  while(s){
    res++;
    s /= base;
  }
  return res;
}

void solve(){
  int a, b;
  cin >> a >> b;
  cout << a * b << endl;
}


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


Measured memory_bytes: 3624
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    string s1,s2;
    cin>>s1;
    cin>>s2;
    int l1=s1.size();
    int l2=s2.size();
    if(l2-l1!=1)
        cout<<"No"<<endl;
    else
    {
        int fal=1;
        for(int i=0,j=0;i<l1,j<l2-1;i++,j++)
    {
       if(s1[i]!=s2[j])
       {
           fal=0;
           break;
       }
    }
    if(fal)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    }
   return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define NIL -1
#define MAX 10000

struct Node{
	int parent,
		left,
		right;
};

struct Node T[MAX];
int H[MAX],D[MAX],type[MAX];

void setDepth(int u, int d){
	if(u == NIL) return; //leaf???????????????????????¨????????????????????????
	D[u] = d;
	setDepth(T[u].left, d+1);
	setDepth(T[u].right, d+1);
}

int setHight(int u){
	int h1=0,h2=0;
	if(T[u].left != NIL){
		h1 = setHight(T[u].left)+1;
	}
	if(T[u].right != NIL){
		h2 = setHight(T[u].right)+1;
	}
	return H[u]=max(h1,h2);//?????°??§?????????????????¨??¨????¨????????????????
}

int setSib(int u){
	if(T[u].parent==NIL){
		return -1;
	}else{
		if(u != T[T[u].parent].right && T[T[u].parent].right != NIL){
				return T[T[u].parent].right;
		}else if(u != T[T[u].parent].left && T[T[u].parent].left != NIL){
				return T[T[u].parent].left;
		}else{
			return -1;
		}
	}
}

void print(int u){
	
	int deg=0;
	if(T[u].left != NIL) deg++;
	if(T[u].right != NIL) deg++;
	
	cout<<"node "<<u<<": "<<"parent = "<<T[u].parent;
	cout<<", sibling = "<<setSib(u)<<", degree = "<<deg<<", depth = "<<D[u]<<", height = "<<H[u];
	
	if(T[u].parent == NIL){
		cout<<", root"<<endl;
	}else if(T[u].left==NIL && T[u].right==NIL){
		cout<<", leaf"<<endl;
	}else{
		cout<<", internal node"<<endl;
	}

}

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

	for(int i=0; i<n; i++){
		T[i].parent = NIL;
	}

	int v,l,r;
	for(int i=0; i<n; i++){
		scanf("%d %d %d",&v,&l,&r);
		T[v].left = l;
		T[v].right = r;
		if(l!=NIL) T[l].parent = v;
		if(r!=NIL) T[r].parent = v;
	}
	
	int root;
	for(int i=0; i<n; i++){
		if(T[i].parent == NIL) root=i;	
	}
	
	setHight(root);
	setDepth(root, 0);
	
	for(int i=0; i<n; i++){
		print(i);
	}

	return 0;
}

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

signed main() {
	int n, m;
	cin >> n >> m;
	vector<tuple<int, int, int>> data(m);
	for (int i = 0; i < m; ++i) {
		int p, y;
		cin >> p >> y;
		data[i] = make_tuple(y, p, i);
	}
	
	sort(data.begin(), data.end());

	map<int, int> cnt;
	vector<tuple<int, int, int, int>> data2(m);

	for (int i = 0; i < m; ++i) {
		int p, y, num, c;
		y = get<0>(data[i]);
		p = get<1>(data[i]);
		num = get<2>(data[i]);

		data2[i] = make_tuple(y, p, num, ++cnt[p]);
	}

	vector<pair<int, int>> ans(m);

	for (int i = 0; i < m; ++i) {
		int p, y, num, c;
		y = get<0>(data2[i]);
		p = get<1>(data2[i]);
		num = get<2>(data2[i]);
		c = get<3>(data2[i]);

		//cout << y << ' ' << p << ' ' << num << ' ' << c << endl;

		ans[num] = make_pair(p, c);
	} 
		
	for (auto e : ans) {
		cout << setfill('0') << right << setw(6) << e.first;
		cout << setfill('0') << right << setw(6) << e.second << endl;
	}
}



Measured memory_bytes: 9728
from itertools import chain

n = int(input())
ts = list(map(int, input().split()))
vs = list(map(int, input().split()))

va = list(chain.from_iterable([v] * (2 * t) for t, v in zip(ts, vs)))
va = [min(v1, v2) for v1, v2 in zip([0] + va, va + [0])]
lt = len(va)
va[-1] = 0

pv = 0
for ct in range(1, lt):
    va[ct] = pv = min(va[ct], pv + 0.5)

pv = 0
for ct in range(lt - 1, 0, -1):
    va[ct] = pv = min(va[ct], pv + 0.5)

print(sum((v1 + v2) / 4 for v1, v2 in zip(va, va[1:])))


Measured memory_bytes: 4384
N, K = map(int, input().split())
cnt = [0 for _ in range(100000)]

for _ in range(N):
    a, b = map(int, input().split())
    cnt[a - 1] += b

for i in range(100000):
    K -= cnt[i]
    if K <= 0:
        print(i + 1)
        break


Measured memory_bytes: 5928
#include<iostream>
#include<cmath>
#include<vector>
#include<climits>
#include<algorithm>
#include<numeric>
#include<iomanip>
#include<map>
#include<set>
#include<random>
#include<cassert>
using namespace std;
#define ll long long int
#define ld long double
const ll Mod = 1000000007;
ll CaseN=1;
const ld PI = 22/7.0;

bool mycmp(string s,string t)
{
if(s.size()<t.size())
{
return true;	
}		
return false;
}


void solve()
{
 
  ll a,b,ans=0;
  char ch;
  cin>>a>>ch>>b;
  if(ch=='+')
  {
	 ans = a+b; 
	 }
	 else
	 {
		ans = a-b; 
		}
 
 cout<<ans<<endl;
 // cout<<"Case #"<<CaseN<<": ";
   CaseN++;
	// print your ans below;
    
return ;
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--)
	{
	solve();	
	}
}


Measured memory_bytes: 256
N, K = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
mod = 10**9+7

fac = [i for i in range(N + 1)]
for i in range(2, N + 1):
    fac[i] *= fac[i - 1]
    fac[i] %= mod
fac[0] = 1

fk = pow(fac[K - 1], mod-2, mod)

ans = 0
for i in range(N - K + 1):
    f = a[-(i + 1)] - a[i]
    nCr = fac[N - i - 1]*pow(fac[N-K-i], mod-2, mod)*fk % mod
    ans += f * nCr
    ans %= mod

print(ans % mod)


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

int main(){
    string s;
    cin >> s;
    int q;
    cin >> q;
    int c_index = 0;
    int r=0;
    vector<int> vec[2];
    int left = 0;
    char c[q+1];
    for(int i=0; i<q; i++){
        int t;
        cin >> t;
        if(t==1){
            r++;
            left++;
            left %= 2;
        }
        else{
            c_index++;
            int f;
            cin >> f >> c[c_index];
            if(f==1) vec[left].push_back(c_index);
            else vec[(left+1)%2].push_back(c_index);
        }
    }
    string t;
    for(int i=vec[left].size()-1; i>=0; i--){
        t = t + c[vec[left][i]];
    }
    if(r%2){
        reverse(s.begin(),s.end());
        t = t + s;
    }
    else t = t + s;
    for(int i=0; i<vec[(left+1)%2].size(); i++){
        t = t+c[vec[(left+1)%2][i]];
    }
    cout << t << endl;
    return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



i64 a,b,c,k;
void solve(){
	cin >> a >> b >> c >> k;
	
	i64 ans = 0;
	if(k > 0) ans += min(a,k);
	k-=a;
	if(k > 0) k-=b;
	if(k > 0) ans -= k;
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3652
N = int(raw_input())
A = map(int, raw_input().split())
 
L = [ abs((N-1) - 2*i) for i in range(N)]
 
L.sort()
A.sort()
 
print (2 ** ((N-N%2)/2) ) % (10**9+7) if L == A else 0


Measured memory_bytes: 12752