akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

int solve(vector<vector<int>>& A, vector<int>& cost, int theta) {
    int n = A.size();
    int m = A[0].size();
    vector<int> B;
    int min_val = 1e9;
    /*
    for (int i = 0; i < n; i++)
        cout << "A[" << i << "]: " << A[i] << endl;
    cout << "cost: " << cost << endl;
    cout << "theta: " << theta << endl;
    */
    for (int i = 0; i < (1<<n); i++) {
        int val = 0;
        B.assign(m, 0);
        for (int j = 0; j < n; j++) {
            if (i & (1<<j)) {
                for (int k = 0; k < m; k++) {
                    B[k] += A[j][k];
                }
                val += cost[j];
            }
        }
        bool ok = true;
        for (int j = 0; j < m; j++) {
            if (B[j] < theta) {
                ok = false;
                break;
            }
        }
        if (ok) {
            min_val = min(min_val, val);
        }
        // cout << bitset<5>(i) << ", val: " << val << ", B: " << B << ", ok: " << ok << endl;
    }
    if (min_val == 1e9)
        return -1;
    return min_val;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, m, k;
    vector<int> cost;
    vector<vector<int>> A;
    cin >> n >> m >> k;
    cost.resize(n);
    A.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> cost[i];
        A[i].resize(m);
        for (int j = 0; j < m; j++)
            cin >> A[i][j];
    }
    cout << solve(A, cost, k) << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
pair<int,int> a[200000];
set<int> s;
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i=1; i<=m; i++) s.insert(i);
	for (int i=0; i<n; i++) 
		scanf("%d%d", &a[i].second, &a[i].first);
	int ans=0;
	sort(a, a+n);
	set<int>::iterator it;
	for (int i=n-1; i>=0 && s.size()>0; i--) {
		int v=a[i].first, t=m-a[i].second+1;
		it=s.upper_bound( t);
		if (it==s.begin()) continue;
		ans+=v;
		s.erase(--it);
	}
	cout<<ans<<endl;
	return 0;
}

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

char w[1024];

int main()
{
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++)
        w[s[i]]=true;
    if((w['N']^w['S'])||(w['E']^w['W']))cout<<"No";
    else cout<<"Yes";
}


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

bool solve(int ball[10]){
  stack<int> b, c;
  b.push(ball[0]);
  c.push(0);
  for(int i = 1; i < 10; i++){
    if(ball[i] < b.top() && ball[i] < c.top()) return false;
    if(b.top() > c.top()){
      if(ball[i] > b.top()) b.push(ball[i]);
      else c.push(ball[i]);
    }
    else{
      if(ball[i] > c.top()) c.push(ball[i]);
      else b.push(ball[i]);
    }
  }
  return true;
}

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

  int ball[10];
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 10; j++){
      cin >> ball[j];
    }
    if(solve(ball)) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 1192
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 10**9
for i in range(N-K+1):
  if A[i]*A[i+K-1] <= 0:
    ans = min(ans, A[i+K-1]-A[i]+min(abs(A[i]), A[i+K-1]))
  else:
    ans = min(ans, max(abs(A[i]), abs(A[i+K-1])))
print(ans)


Measured memory_bytes: 62576
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cmath>
#include<cstdlib>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    char c;
    cin>>c;
    if('A'<=c&&c<='Z') cout<<"A\n";
    else cout<<"a\n";
    return 0;
}


Measured memory_bytes: 3604
import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	private static final long MOD = 1000000007;
	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	void solve() throws Exception {

		long res = solution(nextInt(), nextInt());
//		Helper.tr(freq);
		out.println(res);
	}

	private long solution(int N, int k) {
		long ans = 0;
		if (k % 2 == 0) {
			k /= 2;
			long cnt = N / k;
//			cnt = (cnt + 1) / 2;
			ans = f((cnt + 1) / 2) + f((cnt) / 2);
		} else {

			ans = f(N / k);
		}
		return ans;
	}

	private long f(long cnt) {
		if (cnt <= 0)
			return 0;
		return cnt * cnt * cnt;
	}

	private int[][] nextInts(int r, int c) throws IOException {
		int[] a[];
		a = new int[r][c];
		for (int i = 0; i < r; i++)
			for (int j = 0; j < c; j++)
				a[i][j] = nextInt();
		return a;
	}

	private int[] nextTuple(int n) throws IOException {
		int[] a;
		a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	private int[] nextInts(int n) throws IOException {
		return nextTuple(n);
	}

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

	static long nextLong() throws IOException {
		return parseLong(next());
	}

	static double nextDouble() throws IOException {
		return parseDouble(next());
	}

	static String next() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public static void main(String[] args) {
		new Thread(null, null, "Main", 0x4000000) {
			public void run() {
				try {
					in = new BufferedReader(new InputStreamReader(System.in));
					out = new PrintWriter(new OutputStreamWriter(System.out));
					new Main().solve();
					in.close();
					out.close();
				} catch (Throwable e) {
					e.printStackTrace();
					exit(1);
				}
			}
		}.start();
	}
}


Measured memory_bytes: 23380
package main

import "fmt"

const inf = 1 << 60

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

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	g := make([][]int, n)
	for i := range g {
		g[i] = make([]int, n)
		for j := range g[i] {
			if i == j {
				g[i][j] = 0
			} else {
				g[i][j] = inf
			}
		}
	}
	type edge struct{ a, b, c int }
	edges := make([]edge, m)
	for i := 0; i < m; i++ {
		var a, b, c int
		fmt.Scan(&a, &b, &c)
		a--
		b--
		edges[i] = edge{a, b, c}
		g[a][b] = c
		g[b][a] = c
	}
	for k := 0; k < n; k++ {
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				chmin(&g[i][j], g[i][k]+g[k][j])
			}
		}
	}
	ct := 0
	for _, e := range edges {
		if g[e.a][e.b] < e.c {
			ct++
		}
	}
	fmt.Println(ct)
}


Measured memory_bytes: 768
/*input
5 4
12433242 42343 1233 1234 123234
*/
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define watch(x) cout << (#x) << " is " << (x) << endl
#define N 100002
 
using namespace std;
int main()
{
	fastio
	ll T=1,n,m;string str;
	// cin>>T;
	// cin.ignore(); put after cin, just b4 a getline(cin, s) to avoid getline() directly getting \n
	while(T--)
	{
		ll p=0,q=0,tmp=0,sum=0,count=0; //tmp variable
		int flag=0;
		
		cin>>n>>m;
		ll a[n];
		for (int i = 0; i < n; ++i)
		{
			cin >> a[i];
		}
		sort(a,a+n);
		if(m>=n)
		{
			cout << 0 << endl;
			return 0;
		}
 
		int i=0;
		while(m--)
		{
 			
			a[n-i-1]=0;
			i++;
		}
		// for (int i = 0; i < n; ++i)
		// {
		// 	cout << a[i] << " ";	
		// }
 
		for (int i = 0; i < n; ++i)
		{
			sum+=a[i];	
		}
		cout << sum << endl;
		
 
	}
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
   string s;
   cin>>s;
   int i,k=0,j;
  for(i=0;i<4;i++)
  {
      for(j=i+1;j<4;j++)
      {
          if(s[i]==s[j])
          {
              k++;
              
          }
      }
  }


if(k==2)
    cout<<"Yes"<<endl;
else
    cout<<"No"<<endl;


    return 0;
}


Measured memory_bytes: 256
from sys import stdin
from itertools import accumulate
n,k = map(int,stdin.readline().rstrip().split())
li = list(map(int,stdin.readline().rstrip().split()))
ma = 0
lin = []
for i in li:
    lin.append((i+1)/2)
lis = [0]+list(accumulate(lin))
ma = 0
for i in range(n-k+1):
    if i+k > n:
        break
    l = lis[i+k]-lis[i]
    ma = max(ma,l)
print(ma)

Measured memory_bytes: 26372
sx, sy, tx, ty = gets.split.map(&:to_i)

dx = tx - sx
dy = ty - sy

puts "R" * dx + "U" * dy + "L" * dx + "D" * dy +
     "D" + "R" * (dx + 1) + "U" * (dy + 1) + "L" + 
     "U" + "L" * (dx + 1) + "D" * (dy + 1) + "R"


Measured memory_bytes: 14340
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=1e5+5;
ll a[N],b[N],sum,res,ret;int st[N],top,n;
inline void ins(R ll x){
	fp(i,0,59)if(x>>st[i]&1){
		if(!b[i]){b[i]=x;break;}
		x^=b[i];
	}
}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d",&n);
	fp(i,1,n)scanf("%lld",&a[i]),sum^=a[i];
	fd(i,59,0)if(sum>>i&1^1)st[top++]=i;
	fd(i,59,0)if(sum>>i&1)st[top++]=i;
	fp(i,1,n)ins(a[i]);
	fp(i,0,59)if(res>>st[i]&1^1)res^=b[i];
	printf("%lld\n",res+(sum^res));
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		double x[]=new double[4];
		double y[]=new double[4];
		double xab,yab,xcd,ycd,ns;
		int i;
		while(sc.hasNext()){
			for(i=0;i<4;i++){
				x[i]=sc.nextDouble();
				y[i]=sc.nextDouble();
			}
			xab=x[1]-x[0];
			yab=y[1]-y[0];
			xcd=x[3]-x[2];
			ycd=y[3]-y[2];
			ns=(xab*xcd)+(yab*ycd);
			if(ns==0){
				System.out.println("YES");
			}
			else{
				System.out.println("NO");
			}
		}//while
	}
}

Measured memory_bytes: 12000
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

def main():
    n = II()
    aa = MII()
    aa = [0] + aa + [0]
    g = [abs(aa[i+1]-aa[i]) for i in range(n+1)]
    sumv = sum(g)
    g = dict(zip(range(n+1), g))
    ng = [abs(aa[i+2]-aa[i]) for i in range(n)]
    ng = dict(zip(range(n), ng))
    for i in range(n): print(sumv - (g[i] + g[i+1]) + ng[i])

if __name__ == '__main__':
    main()


Measured memory_bytes: 38944
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int a, b, c, d;
long long int fact[1001];
long long int comb[1001][1001];
long long int powrev[1001];
vector<vector<long long int> > result(1001, vector<long long int>(1001, -1));
// result[i][j] : i人でグループを作る。最大のグループの人数がj人のとき、グループ分けが何通りあるか

long long int getpow(long long int n, long long int k)
{
	if(k == 0) return 1;
	long long int tmp = getpow(n, k / 2);
	if(k % 2 == 0) return (tmp * tmp) % mod;
	else return (((tmp * tmp) % mod) * n) % mod;
}
long long int solve(int n, int k)
{
	if(result[n][k] >= 0) return result[n][k];
	if(n == 0) return result[n][k] = 1;
	if(k < a) return result[n][k] = 0;
	result[n][k] = solve(n, k - 1);
	long long int tmp = 1;
	for(int i = 1; i <= c - 1; i++){
		if((i - 1) * k > n) return result[n][k];
		tmp *= (comb[n - (i - 1) * k][k] * powrev[i]) % mod;
		tmp %= mod;
	}
	for(int i = c; i <= d; i++){
		if(k * i > n) break;
		tmp *= (comb[n - (i - 1) * k][k] * powrev[i]) % mod;
		tmp %= mod;
		result[n][k] += (tmp * solve(n - k * i, k - 1)) % mod;
		result[n][k] %= mod;
	}
	// cout << n << " " << k << " " << result[n][k] << endl;
	return result[n][k];
}



int main()
{
	int n;
	cin >> n >> a >> b >> c >> d;
	comb[0][0] = 1;
	comb[1][0] = 1;
	comb[1][1] = 1;
	fact[0] = 1;
	fact[1] = 1;
	powrev[0] = 1;
	powrev[1] = 1;
	for(int i = 2; i <= n; i++){
		fact[i] = (fact[i - 1] * i) % mod;
		powrev[i] = getpow(i, mod - 2);
		for(int j = 0; j <= i; j++){
			comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % mod;
		}
	}
	cout << solve(n, b) << endl;
}

Measured memory_bytes: 15360
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<math.h>
#include <bits/stdc++.h>
#include<fstream>
using namespace std;
int f[100];

int main(){
   int x;
   cin>>x;
   if(x>=30) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   return 0;
}

Measured memory_bytes: 3628
#include <cstdio>

int N,M,x,y,a[12][12],sum[2][12],vis[12][12];
int qx[110],qy[110],DEP;

int dfs (int dep) {
    if(dep > DEP)
		return 1;

	int re = 0;

	sum[0][qx[dep]]++;
	sum[1][qy[dep]]++;
	if(sum[0][qx[dep]] <= N / 2 && sum[1][qy[dep]] <= N / 2)
        re += dfs(dep + 1);
	sum[0][qx[dep]]--;
	sum[1][qy[dep]]--;

	sum[1][qx[dep]]++;
	sum[0][qy[dep]]++;
	if(sum[1][qx[dep]] <= N / 2 && sum[0][qy[dep]] <= N / 2)
        re += dfs(dep + 1);
	sum[1][qx[dep]]--;
	sum[0][qy[dep]]--;

	return re;
}

int main () {
	while(1) {
			DEP = 0;
		scanf("%d",&N);
		if(N == 0) break;
		scanf("%d",&M);

		for(int i = 1;i <= N;++i) {
			sum[0][i] = sum[1][i] = 0;
			for(int j = i;j <= N;++j)
				vis[i][j] = vis[j][i] = 0;
		}

		for(int i = 1;i <= M;++i) {
			scanf("%d%d",&x,&y);
			vis[x][y] = vis[y][x] = 1;
			a[x][y] = 1;
			a[y][x] = 0;
			sum[1][x]++;
			sum[0][y]++;
		}
		bool f = 0;
		for(int i = 1;i <= N;++i) {
			if(sum[0][i] > N / 2 || sum[1][i] > N / 2) {
				printf("0\n");
				f = 1;
				break;
			}
		}
		if(f) continue;

		for(int i = 1;i <= N;++i) {
			for(int j = i + 1;j <= N;++j) {
				if(!vis[i][j]) {
					qx[++DEP] = i;
					qy[DEP] = j;
				}
			}
		}

		printf("%d\n",dfs(1));
	}
}





Measured memory_bytes: 2592
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   for(int i=0;i<(n);++i)
#define SORT(c)    sort((c).begin(),(c).end())
const double EPS = 1e-10;//sample:if((double)>=(double)+EPS)
#define CLR(a) memset((&a), 0 ,sizeof(a))//clear memory
#define dump(x)  cerr << #x << " = " << (x) << endl;//debug
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//cin,cout release
//std::cin.tie(0);
//ios::sync_with_stdio(false);

using namespace std;
int n, A[20], q, m;
bool conta[2000][200000]={};

bool solve(int i, int m){
  if(conta[i][m])return true;
  if(m==0)return conta[i][m]=true;
  if(i>=n)return conta[i][m]=false;
  return conta[i][m]=(solve(i+1,m) || solve(i+1,m-A[i]));
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++) cin>>A[i];
  cin>>q;
    for(int i=0;i<q;i++){
    cin>>m;
    if(solve(0,m))cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}



Measured memory_bytes: 3220
IDENTIFICATION DIVISION.
        PROGRAM-ID. AtCoder.
      
        ENVIRONMENT DIVISION.
      
        DATA DIVISION.
        WORKING-STORAGE SECTION.
        01 INP PIC X(100).
        01 A PIC 9(15).
        01 B PIC 9(15).
        01 C PIC 9(15).
      	01 D PIC 9(15).
      	01 E PIC 9(15).
        01 F PIC 9(15).
      	01 t PIC 9(15).
	    01 temp1 PIC 9(15).
        01 temp2 PIC 9(15).
        01 N PIC 9(15).
      
        PROCEDURE DIVISION.
      	MAIN.
			ACCEPT INP.
      		IF INP(1:3) = "SUN"
      			DISPLAY "7"
      		END-IF.
      		IF INP(1:3) = "MON"
      			DISPLAY "6"
      		END-IF.
      		IF INP(1:3) = "TUE"
      			DISPLAY "5"
      		END-IF.
      		IF INP(1:3) = "WED"
      			DISPLAY "4"
      		END-IF.
      		IF INP(1:3) = "THU"
      			DISPLAY "3"
      		END-IF.
      		IF INP(1:3) = "FRI"
      			DISPLAY "2"
      		END-IF.
      		IF INP(1:3) = "SAT"
      			DISPLAY "1"
      		END-IF.
		STOP RUN.

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define pd(x) printf("%lf\n", x)
#define ps(x) printf("%s\n", x)
 
#define INF 1000000000000000000
#define MOD 1000000007
 
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
 
long N, C, K;
long T[300001];
long ans;
 
int compare_long(const void *a, const void *b) {
	return *(long*)a - *(long*)b;
}
 
int main() {
	int k;
	int i, j;
	
	sl(N); sl(C); sl(K);
	for(i=0;i<N;i++) sl(T[i]);
	qsort(T, N, sizeof(long), compare_long);
	
	for(i=0;i<N;i++) {
		ans++;
		for(j=i;j<MIN(N, i+C);j++) {
			if(T[i] + K < T[j]) {
				break;
			}
		}
		i = j - 1;
	}
	
	pl(ans);
	
	return 0;
}

Measured memory_bytes: 1788
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s = str(readline().rstrip().decode('utf-8'))
    b = True
    for i in range(len(s)):
        if i % 2 == 0:
            if s[i] not in list("RUD"):
                b = False
                break
        else:
            if s[i] not in list("LUD"):
                b = False
                break
    print("Yes" if b else "No")



if __name__ == '__main__':
    solve()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define ll long long
#define MAX 5000005
#define P ((ll)1e9+7)
using namespace std;

ll qpow(ll a, ll n){
    ll res = 1;
    while(n){
        if(n&1) res = res*a%P;
        a = a*a%P, n >>= 1;
    }
    return res;
}

int n, m;
ll f[MAX];

int main()
{
    cin >> n >> m;
    ll ans = 0;
    for(int i = m; i >= 1; i--){
        f[i] = qpow(m/i, n);
        ans = (ans + f[i]*i%P)%P;
        for(int j = 2; i*j <= m; j++){
            ans = (ans-f[i*j]*i%P+P)%P;
            f[i] -= f[i*j];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4360
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <queue>
using namespace std;
typedef long long ll;
#define PI 3.14159265359

int main() {
  ll A, B;
  cin >> A >> B;
  cout << A*B << endl;
  return 0;
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.D_Challenge
{
    class ABC_076
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            var tList = new List<int>();
            tList.AddRange(ReadInts());
            tList.Add(1);
            int[] ts = tList.ToArray();

            var vList = new List<int>();
            vList.AddRange(ReadInts());
            vList.Add(0);
            int[] vs = vList.ToArray();
            int totalTime = 0;
            for (int i = 0; i <= n; i++)
            {
                totalTime += tList[i];
            }
            totalTime++;
            var goVals = new double[totalTime];
            var endVals = new double[totalTime];
            int time = 0;
            for (int i = 0; i < n; i++)
            {
                for (int j = 1; j <= ts[i]; j++)
                {
                    goVals[time + j]
                        = Math.Min(goVals[time + j - 1] + 1, vs[i]);
                }
                time += ts[i];
            }
            time = totalTime - 1;
            for (int i = n; i >= 0; i--)
            {
                time -= ts[i];
                for (int j = ts[i] - 1; j >= 0; j--)
                {
                    endVals[time + j]
                        = Math.Min(endVals[time + j + 1] + 1, vs[i]);
                }
            }
            for (int i = 0; i < totalTime; i++)
            {
                //Console.WriteLine(goVals[i]+" "+endVals[i]);
            }
            var vals = new double[totalTime];
            for(int i = 0; i < totalTime; i++)
            {
                vals[i] = Math.Min(goVals[i], endVals[i]);
                //Console.WriteLine(vals[i]);
            }
            double area = 0;
            time = 0;
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < ts[i]; j++)
                {
                    area += (vals[time+j] + vals[time+j + 1]) * 0.5;
                    if (vals[time+j] == vals[time+j + 1]
                        && vals[time+j] < vs[i])
                    {
                        area += 0.25;
                    }
                }
                time += ts[i];
            }
            Console.WriteLine(area);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

int main()
{
  int a,b;
  cin >> a>> b;
  b = b + a*3;
  cout << b / 2 << endl;
  return 0;
}


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

public class Main{
	public static void main(String[] args){
    	Scanner s = new Scanner(System.in);
      	char c = s.next().charAt(0);
      	if (Character.isUpperCase(c)){
          	System.out.println('A');
        }else{
          System.out.println('a');
        }}}


Measured memory_bytes: 35624
#include<bits/stdc++.h>
#include<vector>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<map>
#define ll long long
#define INF 2000000000
#define NINF -2000000000
#define MOD 1000000007
#define br '\n'
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int x;
	cin>>x;
	if(x<1200)
		cout<<"ABC"<<br;
	else
		cout<<"ARC"<<br;
	return 0;
}


Measured memory_bytes: 256
N,M,C=map(int,input().split())
B = list(map(int, input().split()))
A = []
for i in range(N):
  A.append(list(map(int, input().split())))
count=0
for i in range(N):
  ans=C+sum((A[i][j])*B[j] for j in range(M))
  if ans>0:
    count+=1
print(count)

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

#define pb push_back
#define ppb pop_back
#define ins insert

#define sz(x) (int)(x).size()
#define all(x) x + 1 , x + n + 1
#define them(x) x.begin() , x.end()

using namespace std;

typedef long double ld;
typedef long long ll;
typedef double db;

void speed() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(0);
}

int main() {
    speed();
    int n;
    cin >> n;
    int mx = -1 , predlast = 0;
    vector<int>a(n);
    vector<int>v;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        v.pb(a[i]);
    }
    sort(v.begin() , v.end());
    mx = v[sz(v) - 1];
    predlast = v[sz(v) - 2];
    for(int i = 1; i <= n; i++) {
        if(a[i] == mx) {
            cout << predlast << " ";
            continue;
        }
        else {
            cout << mx << " ";
        }
    }
    return 0;
}


Measured memory_bytes: 3316
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.IO;

class Solve
{
	const int mod = 1000000007;
	static void Main(string[] args)
	{
		var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
		Console.SetOut(sw);

		int K = int.Parse(Console.ReadLine());
		int e = K / 2;
		Console.WriteLine(e * (K - e));

		Console.Out.Flush();
	}
}


Measured memory_bytes: 13140
import java.util.*;

public class Main {
    public static void main(String[] args) {
        int N;
        int[] Ai;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            Ai = new int[N];
            for (int i = 1; i < N; i++) {
                Ai[i] = sc.nextInt();
            }
        }
        Map<Integer, Integer> map = new TreeMap<>();
        for (int i = 1; i < N; i++) {
            int js = Ai[i];
            int cnt = map.getOrDefault(js,0);
            map.put(js,++cnt);
        }
        for (int i = 1; i <= N; i++) {
            int cnt = map.getOrDefault(i,0);
            System.out.println(cnt);
        }

    }
}


Measured memory_bytes: 73460
#include<stdio.h>
int a[200000]={0};
int main(){
	int n,num,i;
	scanf("%d",&n);
	for(i=0;i<n-1;i++){
		scanf("%d",&num);
		a[num]++;
	}
	for(i=1;i<=n;i++){
		printf("%d\n",a[i]);
	}
}

Measured memory_bytes: 2508
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
using namespace std;

//グラフのlowlinkを取得する他、関節点と橋を列挙する
//計算量 O(|V|+|E|)
void lowlink(vector<int>graph[], int n, vector<int>& low, vector<pair<int, int>>& br, vector<int>& jnt) {
	low.resize(n);
	vector<int>ord(n);//DFSの順番
	vector<bool>vis(n);//訪れたかどうか
	//再帰ラムダ式
	function<void(int, int, int&)>dfs = [&](int v, int p, int& k) {
		vis[v] = true;
		ord[v] = k++;
		low[v] = ord[v];
		bool joint = false;
		int cnt = 0;
		for (auto nxt : graph[v]) {
			if (!vis[nxt]) {
				cnt++;
				dfs(nxt, v, k);
				low[v] = min(low[v], low[nxt]);
				if (p >= 0 && ord[v] <= low[nxt]) joint = true;
				if (ord[v] < low[nxt])br.push_back({ min(v,nxt),max(v,nxt) });
			}
			else if (nxt != p) {
				low[v] = min(low[v], ord[nxt]);
			}
		}
		if (p < 0 && cnt > 1) joint = true;
		if (joint) jnt.push_back(v);
	};
	int k = 0;
	for (int i = 0; i < n; ++i)
		if (!vis[i])dfs(i, -1, k);
}

int V, E;
vector<int>G[123456];

int main() {
	cin >> V >> E;
	for (int i = 0; i < E; ++i) {
		int u, v;
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	vector<int>low, jnt;
	vector<pair<int, int>>br;
	lowlink(G, V, low, br, jnt);
	sort(br.begin(), br.end());
	for (auto p : br) {
		cout << p.first << " " << p.second << endl;
	}
	return 0;
}


Measured memory_bytes: 7692
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long N;
    cin >> N;
    vector<long long> A(N);
    for(int i=0;i<N;i++) cin >> A.at(i);
    long long count = 0;

    for(int i=1;i<N;i++){
        long long delta = A.at(i-1) - A.at(i);
        if(delta > 0){
            A.at(i) += delta;
            count += delta; 
        }
    }
    cout << count << endl;
    return 0;
}


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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
typedef long long ll;


int main(){
  int N; cin >> N;
  vector<vector<vector<int>>> data(4, vector<vector<int>>(3, vector<int>(10)));
  rep(i,N) {
    // b棟f階のr番目の部屋にv人
    int b,f,r,v;
    cin >> b >> f >> r >> v;
    data[b-1][f-1][r-1] += v;
  }
  
  rep(i,data.size()) {
    rep(j,3) {
      rep(k,10) {
        cout << " " << data[i][j][k];
      }
      cout << endl;
    }
    if(i+1 == data.size()) continue;
    cout << "####################" << endl;
  }
}



Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define    For(i,n) for(int i=0;i<n;i++)
#define    fors(i,s) for(int i=0;i<s.size();i++)
#define    forn(i,n) for(int i=1;i<=n;i++)
#define    nl     "\n"
#define    test   int t;cin>>t;for(int l=0;l<t;l++)
#define    End    return 0
#define    gt     greater<int>()
#define    ll     long long int

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

    //test
    {
        int a,b,c;
        cin>>a>>b>>c;
        if(a<=(b*c))cout<<"Yes";
        else cout<<"No";
    }
}


Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <ios>
#include <algorithm>
using namespace std;

int main(void){
    int N, M, h[100]={}, m[100]={}, g[100]={}, k[100]={}, a[100]={}, b[100]={}, start=0;
    cin >> N;
    
    for(int i=0; i<N; i++){
        cin >> h[i] >> m[i];
        a[i]=100*h[i]+m[i];
    }
    sort(a, a+N);
    
    cin >> M;
    for(int i=0; i<M; i++){
        cin >> g[i] >> k[i];
        b[i]=100*g[i]+k[i];
    }
    sort(b, b+M);
    
    int i=0, j=0;
    while(1){
        if(i==N){
            for(;j<M;j++){
                if(start == 1) cout << " ";
                cout << b[j]/100 << ":" << setfill('0') << right << setw(2) << b[j]%100;
                start=1;
            }
            break;
        }
        else if(j==M){
            for(;i<N; i++){
                if(start == 1) cout << " ";
                cout << a[i]/100 << ":" <<setfill('0') << right << setw(2) <<  a[i]%100;
                start=1;
            }
            break;
        }
        else if(a[i]<b[j]){
            if(start == 1) cout << " ";
            cout << a[i]/100 << ":" << setfill('0') << right << setw(2) << a[i]%100;
            start=1;
            i++;
        }
        else if(b[j]<a[i]){
            if(start == 1) cout << " ";
            cout << b[j]/100 << ":" << setfill('0') << right << setw(2) << b[j]%100;
            start=1;
            j++;
        }
        else if(a[i] == b[j]){
            if(start == 1) cout << " ";
            cout << a[i]/100 << ":" << setfill('0') << right << setw(2) << a[i]%100;
            start=1;
            i++;
            j++;
        }
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3152
import sys
bbn=1000000007
	
#+++++

def is_p(v):
	for i in range(2, int(v**0.5)+1):
		if v % i == 0:
			return False
	return True
						
def main():
	x = int(input())
	x=x-1
	while True:
		x+=1
		if is_p(x):
			return x
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 3064
package main

import "fmt"

const Mod = int64(1e9) + 7

var f []int64

func main() {
	var n, k int
	fmt.Scanf("%d %d\n", &n, &k)

	f = make([]int64, n+1)
	f[0] = 1
	for i := 1; i <= n; i++ {
		f[i] = (f[i-1] * int64(i)) % Mod
	}

	if k >= n-1 {
		k = n - 1
	}

	tot := int64(0)
	for i := 0; i <= k; i++ {
		tot += (nChooseK(n, i) * nChooseK(n-1, n-i-1)) % Mod
		tot %= Mod
	}

	fmt.Println(tot)
}

func nChooseK(n, k int) int64 {
	return (((f[n] * Inv(f[k])) % Mod) * Inv(f[n-k])) % Mod
}

func Inv(e int64) int64 {
	return Power(e, Mod-2)
}

func Power(a, b int64) int64 {
	ret := int64(1)
	for b > 0 {
		if b%2 != 0 {
			ret = (ret * a) % Mod
		}
		b /= 2
		a = (a * a) % Mod
	}
	return ret
}


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

int main()
{
    int n, s;
    cin >> n >> s;
    bool flag[n+1];
    string ac = "AC", wa = "WA";
    int a=0, w=0;
    int arr[n+1];
    memset(flag, false, sizeof(flag));
    memset(arr, 0, sizeof(arr));
    while(s--){
        int t;
        string temp;
        cin >> t >> temp;
        if(temp==ac and flag[t]==false){
            a += arr[t];
            flag[t] = true;
            w++;
        }
        else if(temp==wa and flag[t]==false){
            arr[t]++;
        }
    }
    cout << w << " " << a << endl;
    return 0;
}


Measured memory_bytes: 768
#include "bits/stdc++.h"
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define debug(var) std::cout << #var << " : " << var;

int main() {

	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);

	std::string S; std::cin >> S;
	bool flag = true;
	rep(i, 3) {
		if (S[i] == S[i + 1]) {
			flag = false;
		}
	}

	if (flag)std::cout << "Good";
	else std::cout << "Bad";

	return 0;

}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int w;cin>>w;
  cout<<32*w<<endl;
}


Measured memory_bytes: 3196
//Subhash Suman
//Description :

#include <bits/stdc++.h>
#define ll long long int
#define pll pair<ll, ll>
#define pii pair<int, int>

using namespace std;
const int N = 1e5 + 5;
vector<vector<int>> v(N);
ll dp[N], m, ans[N], pre[N], suf[N];
bool visited[N];

inline ll add(ll a, ll b)
{
    ll x = a + b;
    if (x >= m)
    {
        x -= m;
    }
    return x;
}

ll dfs(int i)
{
    if (v[i].size() == 1 && i != 1)
    {
        dp[i] = 1;
        return 1LL;
    }
    visited[i] = 1;
    ll s = 1;
    for (auto ch : v[i])
    {
        if (!visited[ch])
        {
            ll x = add(1, dfs(ch));
            s = (s * x) % m;
        }
    }
    ll a = 1, b = 1;
    for (int j = 0; j < v[i].size(); j++)
    {
        int ch = v[i][j];
        if (!visited[ch])
        {
            pre[ch] = a;
            ll x = add(1, dp[ch]);
            a = (a * x) % m;
        }
    }
    for (int j = v[i].size() - 1; j >= 0; j--)
    {
        int ch = v[i][j];
        if (!visited[ch])
        {
            suf[ch] = b;
            ll x = add(1, dp[ch]);
            b = (b * x) % m;
        }
    }
    dp[i] = s;
    visited[i] = 0;
    return s;
}

void dfs2(int i = 1, ll val = 1)
{
    visited[i] = 1;
    ans[i] = (val * dp[i]) % m;
    for (auto ch : v[i])
    {
        if (!visited[ch])
        {
            ll z = (pre[ch] * suf[ch]) % m;
            z = (val * z) % m;
            z = add(z, 1);
            dfs2(ch, z);
        }
    }
    visited[i] = 0;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n >> m;
    for (int i = 0; i < n - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    dfs(1);
    pre[1] = 1;
    suf[1] = 1;
    dfs2();
    for (int i = 1; i <= n; i++)
    {
        cout << add(ans[i], m) << '\n';
    }
    return 0;
}

Measured memory_bytes: 13184
//Author- VMAX


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_multiset tree<long long , null_type,less_equal<long long >, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_set tree<long long , null_type,less<long long >, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define ll long long int
#define YES cout<<"YES"<<"\n";
#define NO cout<<"NO"<<"\n";
#define ld     long double 
#define yes cout<<"yes"<<"\n";
#define no cout<<"no"<<"\n";
#define No cout<<"No"<<"\n";
#define Yes cout<<"Yes"<<"\n";
#define f(i,a) for(i=0;i<a;i++)
#define fo(i,a) for(i=1;i<=a;i++)
#define fa(i,a) for(auto i:a)
#define r(i,a) for(auto i=a.rbegin();i!=a.rend();i++)
#define en cout<<"\n";
#define ull unsigned long long int
#define o(x) cout<<x<<"\n";
#define o1(x) cout<<x<<" ";
#define pb push_back
#define F first
#define in insert
#define mp make_pair
#define S second
#define pre(n) cout<<fixed<<setprecision(n);
#define      gcd(a,b)    __gcd(a,b)
#define bs            binary_search
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test ll t;cin>>t;while(t-->0)
const ll Mod = 998244353;
#define mod 1000000007
#define pi 3.14159265358979323846
#define all(x) x.begin(),x.end()
#define re return 0;
// *#######################################################################################*


int main()
{
    fast
    
  
    ll n,x;
    cin>>n>>x;
    
    ll a[n],i;
    
    fo(i,n)
    {
        cin>>a[i];
    }
    ll b[n+5]={0};
    b[0]=0;
    fo(i,n)
    {
        b[i]=b[i-1]+a[i];
    }
    
    ll c=0;
    f(i,n+1)
    {
        if(b[i]<=x)
        {
            c++;
        }
    }
    o(c)
    
    
    
    
    
        
    
    re
}

Measured memory_bytes: 3620
N,x = list(map(int,input().split()))
a =  list(map(int,input().split()))
counter = 0
for i in range(N-1):
    sum_a = a[i] + a[i+1] 
    if sum_a > x:
        if sum_a - x > a[i+1]:
            counter += sum_a -x
            a[i] = a[i] -(sum_a-x-a[i+1]) #この行はなくてもいい
            a[i+1] = 0
        else:
            counter += sum_a-x
            a[i+1] = a[i+1] - (sum_a -x)
print(counter)


Measured memory_bytes: 20088
#include <iostream>
#include <algorithm>

using namespace std;

static const int MAX = 200000;

int main()
{
  int R[MAX], n;

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

  int maxv = -2000000000;
  int minv = R[0];

  for (int i = 1; i < n; i++)
  {
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }

  cout << maxv << endl;

  return 0;
}


Measured memory_bytes: 3888
import java.util.*;

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

        BitSet master = new BitSet(m);
        master.set(1, m + 1);
        for (int i = 0; i < n; ++i) {
            int k = scan.nextInt();

            BitSet bitset = new BitSet(m);
            for (int j = 0; j < k; ++j) {
                bitset.set(scan.nextInt());
            }
            master.and(bitset);
        }
        System.out.println(master.cardinality());
    }
}

Measured memory_bytes: 23636
R, G, B, N = gets.chomp.split(" ").map(&:to_i)

def max_times(total, unit)
  [ total / unit, total % unit ]
end

combination_count = 0

r, mod = max_times(N, R)
combination_count += 1 if mod == 0
r.downto(0) do |r|
  next if N - R*r == 0
  g, mod = max_times(N - R*r, G)
  combination_count += 1 if mod == 0
  g.downto(0) do |g|
    next if N - R*r - G*g == 0
    b, mod = max_times(N - R*r - G*g, B)
    next combination_count += 1 if mod == 0
  end
end

puts combination_count


Measured memory_bytes: 1788
n = int(input())
x = [0]*n
y = [0]*n
for i in range(n):
  x1,y1 = map(int, input().split())
  x[i] = x1
  y[i] = y1

a = 0
b = 0
for i in range(n):
  t = list(range(n))
  t.remove(i)
  for j in t:
    a += ((x[i]-x[j])**2 + (y[i]-y[j])**2)**0.5
    b += 1
    
print(a*(n-1)/b)
  

Measured memory_bytes: 3188
import scipy.misc as scm

def aCb(n, r):
    ans = 1
    for x in range(1, n + 1):
        ans *= x
    for x in range(1, n - r + 1):
        ans //= x
    for x in range(1, r + 1):
        ans //= x
    return ans

N, A, B = list(map(int, input().split(" ")))
v = list(map(int, input().split(" ")))

sorted_v = sorted(v)[::-1]

ans= sum(sorted_v[:A])/A

print(ans)


n = sorted_v.count(sorted_v[A-1]) 


if ans != sorted_v[A-1]:
    r = sorted_v[:A].count(sorted_v[A-1])
    print(int(aCb(n, r)))
    
else:
    C = 0
    for num in range(A, B+1):
#         print(num)
        if num <= n:
            C += (aCb(n, num))
        else :
            break
    print(int(C))
    

Measured memory_bytes: 15752
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
int main() {
	char s[51], t[51];
	scanf("%s%s", s, t);
	int lenS = strlen(s);
	int lenT = strlen(t);
	bool isOK;
	bool isExsit = false;
	for (int i = lenS - lenT; i >= 0; i--) {
		isOK = true;
		for (int j = 0; j < lenT; j++) {
			if (s[i + j] != t[j] && s[i + j] != '?') {
				isOK = false;
				break;
			}
		}
		if (isOK && !isExsit) {
			for (int j = 0; j < lenT; j++) {
				s[i + j] = t[j];
			}
			isExsit = true;
		}
	}
	for (int i = 0; i < lenS; i++) {
		if (s[i] == '?') s[i] = 'a';
	}
	if (isExsit)
		printf("%s\n", s);
	else
		printf("UNRESTORABLE\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream> 
#include<bits/stdc++.h> 
using namespace std;
int main(){ 
	ios::sync_with_stdio(false); 
	cin.tie(0); 
	int N;
	cin>>N;
	vector<int> h(N); 
	for(int i=0;i<N;i++){ 
		cin>>h[i];
	}
	vector<int> dp(N,0);
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]); 
	for(int i=2;i<N;i++){ 
		dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));\
	} 
	cout<<dp[N-1]; 
		

		
	
	return 0;
} 



Measured memory_bytes: 1024
n = gets.chomp.to_i
l = gets.chomp.split(" ").map(&:to_i)
if l.include?(0)
  p 0
  return
end
m = 10**18
r = 1
n.times do |i|
  r = r * l[i]
  if r > m
    r = -1
    break
  end
end
p r


Measured memory_bytes: 23516
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>

using namespace std;
#define REP(i,a,n) for(int i = a; i < (int)n; ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;
#endif
int sx, sy, tx, ty;

string F(int sx, int sy, int tx, int ty) {
	string s;
	REP(i, 0, ty - sy) {
		s += 'U';
	}
	REP(i, 0, tx - sx) {
		s += 'R';
	}
	return s;
}

string G(int sx, int sy, int tx, int ty) {
	string s;
	s += 'L';
	REP(i, 0, ty - sy + 1) {
		s += 'U';
	}
	REP(i, 0, tx - sx + 1) {
		s += 'R';
	}
	s += 'D';
	return s;
}

string R(const string& s) {
	string ret;
	REP(i, 0, s.size()) {
		switch(s[i]) {
		case 'U': ret += 'D'; break;
		case 'D': ret += 'U'; break;
		case 'L': ret += 'R'; break;
		case 'R': ret += 'L'; break;
		}
	}
	return ret;
}

int main() {
	cin >> sx >> sy >> tx >> ty;
	cout << F(sx, sy, tx, ty)
		<< R(F(sx, sy, tx, ty))
		<< G(sx, sy, tx, ty)
		<< R(G(sx, sy, tx, ty)) << endl;


	return 0;
}


Measured memory_bytes: 256
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (chunk) {
  var lines = chunk.split('\n');
  var nums = lines[0].split(' ');
  var a = Number(nums[0]),
      b = Number(nums[1]),
      c = Number(nums[2]),
      k = Number(lines[1]),
      max = 0,
      sum = 0;

  if (a < b) {
    sum += a;
    max = b;
  } else {
    sum += b;
    max = a;
  }

  if (max < c) {
    sum += max;
    max = c;
  } else {
    sum += c;
  }

  for(var i=0; i<k; i++) {
    max *= 2;
  }
  sum += max;

  console.log(sum);
});


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

int A[100000], n;

int Partition(int p, int r){
	int x = A[r - 1], j = 0;
	for(int i = 0;i < n;i++){
		if(A[i] <= x) {
			int tmp = A[j];
			A[j++] = A[i];
			A[i] = tmp;
		}
	}
	return j - 1;
}

main(){
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
	int j = Partition(0, n);
	for(int i = 0;i < n - 1;i++){
		if(i)printf(" ");
		if(i == j)printf("[");
		printf("%d", A[i]);
		if(i == j)printf("]");
	}
	printf(" %d\n", A[n - 1]);
}

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

using namespace std;

int main(){
  using ll = int64_t;
  ll n;
  cin >> n;
  vector<ll> a(n);
  int neg = 0;
  for(auto&& x:a){
    cin >> x;
    if(x < 0){
      neg++;
      x = -x;
    }
  }
  sort(a.begin(),a.end());
  ll ans = accumulate(a.begin(), a.end(), 0LL);
  if(neg&1)ans -= a[0]*2;
  cout << ans << endl;
}

Measured memory_bytes: 1024
s = str(input())
#condition a
if len(s) % 2 == 0:
    a = 1
else:
    a = 0
    
if s[0] == s[-1]:
    b = 1
else:
    b = 0

ans = bin(a^b)

if ans == bin(0b0):
    print("First")
elif ans == bin(0b1):
    print("Second")
else:
    print("Error!")

Measured memory_bytes: 3316
#include <stdio.h>

int main(int argc, char *argv[])
{
  int a, b, tmp;
  int mod = 1;
  scanf("%d", &a);
  scanf("%d", &b);
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (mod > 0) {
    mod = a % b;
    a = b;
    b= mod;
  }
  printf("%d\n", a);
  return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
int main(){
	long n; cin>>n;
	vector<long> a(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	long x=a[0],s=a[0];
	long b=0,r=1;
	for(int i=1;i<n;i++){
		x^=a[i],s+=a[i];
		while(x!=s){
			x^=a[b],s-=a[b];
			b++;
		}
		r+=i-b+1;
	}
	cout<<r;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<algorithm>

using namespace std;

int main()
{ int N; cin >> N;
 
 map<int,int> mp;
 
 
 for(int i = 0; i < N; i++){
 int a; cin >> a; mp[a]++;}
 
 int cnt = 0;
 
 for(auto p: mp){
   int s = p.first;
   int t = p.second;
   if( t >= s){ cnt += t - s;}
   else{ cnt += t;}}
 
 cout << cnt << endl; return 0;}
   

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<=(int)(n); i++)
#define reprange(i, a) for(int i : vector<int>a)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
typedef vector<ll> vl;
const ll inf=1LL << 60;
const ll mod=1e9+7;

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

  string s;
  int ans=1000;
  cin >> s;
  int n=s.size();
  rep(i, n-2){
    int m=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
    ans=min(ans, abs(m-753));
  }

  cout << ans << endl;

  return 0;
}

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int x, y;
    cin >> x >> y;

    int b = (y - 2 * x) / 2;
    cout << ((y - 2 * x) % 2 || b < 0 || b > x ? "No" : "Yes") << "\n";

    return 0;
}


Measured memory_bytes: 3624