akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		System.out.println(lcm(a, b));
		
		saori.close();
	}
	private static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}
	private static long gcd(long m, long n) {
		if(m < n) return gcd(n, m);
		if(n == 0) return m;
		return gcd(n, m % n);
	}
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 23124
/*
長方形の中の円
*/

#include<stdio.h>

int main(void){
  int W,H;/*長方形の頂点の座標(x,y)*/
  int x,y,r;/*円の中心の座標、半径*/

  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

  if(0 <= x-r && x+r <= W && 0 <= y-r && y+r <=H)
      printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
    


Measured memory_bytes: 2080
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int L, R, d;
	cin >> L >> R >> d;

	int count = 0;
	for (int i = L; i <= R; i++) {
		if (i % d == 0) {
			count++;
		}
	}
	cout << count << endl;
}


Measured memory_bytes: 3624
//Radhe Radhe
#include<bits/stdc++.h>//157B
#define ll long long
#define fixed cout.setf(ios::fixed);
#define rep1    for( i=0; i<n; i++)
#define Precise cout.precision(7);
using namespace std;

int main()
{
    ll n,a[3][3],i,j;
    for(i=0; i<3; i++)
        for(j=0; j<3; j++)
            cin>>a[i][j];
    ll x;
    cin>>n;
    while(n--)
    {
        cin>>x;
        for(i=0; i<3; i++)
        {
            for(j=0; j<3; j++)
            {
                if(a[i][j]==x){
                    a[i][j]=1;
                    //break;
                }
            }
        }
    }
    if(a[0][0]==1&&a[1][1]==1&&a[2][2]==1)
       return cout<<"Yes"<<endl,0;
    else if(a[0][2]==1&&a[1][1]==1&&a[2][0]==1)
       return cout<<"Yes"<<endl,0;
        for(i=0; i<3; i++)
     if(a[i][0]==1&&a[i][1]==1&&a[i][2]==1)
       return cout<<"Yes"<<endl,0;
        for(i=0; i<3; i++)
     if(a[0][i]==1&&a[1][i]==1&&a[2][i]==1)
       return cout<<"Yes"<<endl,0;


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

    return 0;
}





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

int main()
{
    int n;
    cin>>n;
    int t[n+1], x[n+1], y[n+1],a,b; t[0]=0; x[0]=0; y[0]=0;
    bool ok=true;
    for (int i=1; i<=n; i++) cin>>t[i]>>x[i]>>y[i];
    for (int i=1; i<=n; i++)
    {
        a=t[i]-t[i-1];
        b=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
        if (b>a || (a-b)%2==1) ok=false;
        if (!ok) break;
    }
    if (ok) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 1408
/*
AUTHOR : Chandan Agrawal
College : Poornima College of Engg. jaipur, Raj
Mail : chandanagrawal23@gmail.com
*/

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX 100050

#define ll long long
#define ld long double
#define lli long long int

#define pb emplace_back
#define INF 1000000000
#define mod 1000000007

// trignometric function always give value in Radians only
#define PI acos(-1) //3.1415926535897932384626433832795028
#define dsin(degree) sin(degree*(PI/180.0))
#define dcos(degree) cos(degree*(PI/180.0))
#define dtan(degree) tan(degree*(PI/180.0))

#define rsin(radian) sin(radian)
#define rcos(radian) cos(radian)
#define rtan(radian) tan(radian)

#define loop(i,n) for (lli i = 0; i < n; i++)
#define loopitr(xt,vec) for (auto xt : vec)
#define FOR(i,a,b) for (lli i = a; i < b; i+=1)
#define loop_rev(i,n) for (lli i = n-1; i >= 0; i--)
#define FOR_REV(i,a,b) for (lli i = a; i >= b; i--)
#define itr :: iterator it
#define WL(t) while(t --)

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(x) int(x.size())
#define F first
#define S second

#define mii map<lli,lli>
#define vi vector<lli>
#define vbool vector<bool>
#define seti set<lli>
#define pii pair<lli,lli>
#define pcc pair<char , char>

#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a/gcd(a,b))*b
#define abs(x) ((x < 0)?-(x):x)

#define endl '\n'

template <typename T>
void print(T x){cout<<x<<endl;}
template <typename T1, typename T2>
void print2(T1 x,T2 y){cout<<x<<" "<<y<<endl;}
template <typename T1, typename T2,typename T3>
void print3(T1 x, T2 y,T3 z){cout<<x<<" "<<y<<" "<<z<<endl;}

#define scanarr(a,n) for(lli i=0;i<n;i++)    cin>>a[i];
#define scanvector(a,n) for(lli i=0;i<n;i++){ lli x ; cin>>x; a.pb(x);}

#define printarr(a,n) for(lli i=0;i<n;i++)   cout<<a[i]<<" "; cout<<endl;
#define printvector(vec) for(auto xt : vec) cout<<xt<<" ";    cout<<"\n";

#define FD(N) fixed<<setprecision(N)

#define deb(x) cout<<#x<<" "<<x<<endl;

// chandan1,2
void chandan1(){int y=1;return;}
void chandan2(){
        loop(i,10){
        lli x=1;
    }
    return(chandan1());
}



int main(){
fastio
lli t=1;
//cin>>t;
chandan2();
while(t--) {
    lli n,k;
    cin>>n>>k;
    lli a[n];
    scanarr(a,n);
    FOR(i,k,n)
    {
        if(a[i]>a[i-k])
            print("Yes");
        else
            print("No");
    }
  }
return 0;
}


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


int main() {
  int a , b ;
  cin >> a >> b ;
  
  if(a==b){
    cout << "a == b" << endl;
  }
  
  if(a>b){
    cout << "a > b" << endl;
  }
  
  if(a<b){
    cout << "a < b" << endl;
  }
}


Measured memory_bytes: 3116
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (c - b <= 0)cout << "delicious" << endl;
	else if (c - b > a)cout << "dangerous" << endl;
	else cout << "safe" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	public static void main(String[] args){

		Scanner sc =new Scanner(System.in);

		int a=sc.nextInt();
		int b=sc.nextInt();
		int C=sc.nextInt();

		System.out.printf("%f\n",Size(a,b,C));
		System.out.printf("%f\n",Length(a,b,C));
		System.out.printf("%f",height(b,C));

	}

	private static double Size(int a,int b,int C) {
		return a*b*Math.sin(Math.toRadians(C))/2;
	}

	private static double Length(int a,int b,int C) {
		double c=0;
		c=Math.sqrt(a*a+b*b-2*a*b*Math.cos(Math.toRadians(C)));
		return a+b+c;
	}

	private static double height(int b,int C) {
		return b*Math.sin(Math.toRadians(C));
	}

}


Measured memory_bytes: 26504
#include <bits/stdc++.h>
 
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define debug cout << "Ok" << endl;

using namespace std;

void solve(){

	return;
}
 
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	

	long long int n, resp=0;

	cin >> n;

	resp+= (n/500)*1000;
	n%=500;
	resp+= (n/5)*5;
	
	cout << resp << endl;
	
	return 0;
}

Measured memory_bytes: 3564
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int A=stdIn.nextInt();
		int B=stdIn.nextInt();
		if(A>=13)
			System.out.println(B);
		else
			if(A>=6)
				System.out.println(B/2);
			else
				System.out.println(0);
	}
}


Measured memory_bytes: 21844
fun main(args:Array<String>) {
	val n = readLine()!!.toInt()
	val (t,a) = readLine()!!.split(" ").map{ it.toInt() }
	readLine()!!.split(" ").map{ it.toInt() }
			.mapIndexed{ i,it-> Pair(i+1, Math.abs(t-it*0.006-a) )}
			.minBy{ it.second }!!
			.let{ println(it.first) }
}

Measured memory_bytes: 35956
#include<bits/stdc++.h>
#define int long long
using namespace std;
int Size = 1e14;
 
int check(int a,int b,int c){
 
      if(a+b>c) return 1;
      else return 0;
}
 
int32_t main()
{
 
    int x,k,d;
    cin>>x>>k>>d;
 
    x = abs(x);
 
    int can  = x/d;
 
    //cout<<can<<endl;
 
    int left = 0;
    int update = 0;
 
    if(can<=k){
 
    left=k-can;
    update = x%d;
 
    if(left%2!=0 and left!=0){
        int a = (d-update);
        int b = (update+d);
 
        int c = min(a,b);
 
        update=c;
    }
 
 
    }
    else{
        update = x - (d*k);
    }
 
    cout<<update<<endl;
 
 
	return 0;
}

Measured memory_bytes: 3640
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[]A;
		A = new int[N];
		int len1 =0;
		int len2 =0;

		for (int i=0; i<N; i++){
			A[i] = sc.nextInt();
		}
		Arrays.sort(A);
		for (int i=N-2; i>=0 ;i--){
			if (A[i] == A[i+1]){
				if (len1 == 0){
					len1 = A[i];
					if (i-2 >= 0 && A[i-1]==len1 && A[i-2]==len1){
						len2 = len1;
						break;
					}
				} else {
					if (len1 != A[i]){
						len2 = A[i];
						break;
					}
				}
			}
		}
		System.out.println((long)len1 * (long)len2);
	}
}



Measured memory_bytes: 50592
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}


const int INF = 1e9+7;
struct Edge{
    int to;
    int cost;
};

bool canattain(vector<vector<Edge>> &edges, int from, int to, vector<vector<int>> &cangoal, vector<bool> &used){
    if(cangoal[from][to] != 0){
        return (cangoal[from][to]==1?true:false);
    }

    used[from] = true;
    if(from == to){
        return true;
    }

    for(auto t: edges[from]){
        if(used[t.to])
            continue;
        if(canattain(edges, t.to, to, cangoal, used)){
            cangoal[from][to] = 1;
            return true;
        }
    }
    cangoal[from][to] = -1;
    return false;
}

bool bellman_ford(vector<vector<Edge>> &edges, vector<int> &mini, int src) {
    int n = edges.size();
    vector<vector<int>> cangoal(n, vector<int>(n, 0));
    mini[src] = 0;
    FOR(i, 0, n) {
        FOR(node, 0, n) {
            for (auto edge : edges[node]) {
                if (mini[node] != INF && mini[node] + edge.cost < mini[edge.to]) {
                    vector<bool> tmp(n, false);
                    vector<bool> tmp2(n, false);
                    if (i == n - 1){
                        if(canattain(edges, node, n-1, cangoal, tmp) && canattain(edges, 0, node, cangoal, tmp2))
                            return true;
                    }
                    else
                        mini[edge.to] = mini[node] + edge.cost;
                }
            }
        }
    }
    return false;
}

      
int main() {
    int n, m, p;
    cin >> n >> m >> p;

    vector<vector<Edge>> edges(n);
    REP(i, m){
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        edges[a].push_back({b, p-c});
    }
    
    vector<int> mini(n, INF);



    bool ret = bellman_ford(edges, mini, 0);
    if(ret){
        cout << -1 << endl;
    }
    else {
        cout << max(0, -1 * mini[n-1]) << endl;
    }



    return 0;
}

Measured memory_bytes: 27008
using System;
using System.Collections.Generic;
using System.Linq;

class C
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var r = new int[n].Select(_ => Read()).ToArray();
		var b = new int[n].Select(_ => Read()).ToArray();

		int sv = 2 * n, ev = sv + 1;
		var dag = new List<long[]>();
		dag.AddRange(Enumerable.Range(0, n).Select(i => new[] { sv, i, 1L }));
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				if (r[i][0] < b[j][0] && r[i][1] < b[j][1])
					dag.Add(new[] { i, n + j, 1L });
		dag.AddRange(Enumerable.Range(n, n).Select(j => new[] { j, ev, 1L }));

		Console.WriteLine(MaxFlow(ev, sv, ev, dag.ToArray()));
	}

	static long MaxFlow(int n, int sv, int ev, long[][] dag)
	{
		var map = Array.ConvertAll(new int[n + 1], _ => new List<long[]>());
		foreach (var e in dag)
		{
			map[e[0]].Add(new[] { e[1], e[2], map[e[1]].Count });
			map[e[1]].Add(new[] { e[0], 0, map[e[0]].Count - 1 });
		}

		long Bfs()
		{
			var from = new long[n + 1][];
			var u = new bool[n + 1];
			var minFlow = Enumerable.Repeat(long.MaxValue, n + 1).ToArray();
			var q = new Queue<long>();
			q.Enqueue(sv);

			while (q.TryDequeue(out var v))
			{
				if (v == ev) break;
				foreach (var e in map[v])
				{
					if (u[e[0]] || e[1] == 0) continue;
					from[e[0]] = e;
					u[e[0]] = true;
					minFlow[e[0]] = Math.Min(minFlow[v], e[1]);
					q.Enqueue(e[0]);
				}
			}

			if (from[ev] == null) return 0;
			long tv = ev;
			while (true)
			{
				from[tv][1] -= minFlow[ev];
				var rev = map[from[tv][0]][(int)from[tv][2]];
				rev[1] += minFlow[ev];
				if ((tv = rev[0]) == sv) break;
			}
			return minFlow[ev];
		}

		long M = 0, t;
		while ((t = Bfs()) > 0) M += t;
		return M;
	}
}


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

int main()
{
	char s;
	int cnt1=0, cnt2=0;
	int num=0;
	while ((scanf ("%c", &s),s)!='\n')
	{
		if ((num%2 && s=='0') || (!(num%2) && s=='1'))	cnt1++;
		if ((num%2 && s=='1') || (!(num%2) && s=='0'))	cnt2++;
		num++;
	}
	//printf("%d %d\n", cnt1, cnt2);
	int cnt = std::min(cnt1,cnt2);
	printf("%d\n", std::min(cnt, num-cnt));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h)cin >> s[i];
    int cnt = 0;
    rep(i, h)rep(j, w)if(s[i][j] == '#')cnt++;
    if(cnt == h+w-1)cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    
}

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

int main(void)
{
    int x,hurui[100006]={0};

    scanf("%d",&x);

    for (int i = 2; i <= 100005; i++)
    {
        if(hurui[i]==0)
        {
            for ( int j = 2; i*j<=100005; j++)
            {
                hurui[j*i]=1;
            }
        }
    }

    int i;
    for ( i = x; i <= 100005; i++)
    {
        if(hurui[i]==0) break;
    }

    printf("%d",i);

    return 0;
}

Measured memory_bytes: 512
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}



int main() {
    ll count[4];
    Fill(count,0);
    
    for (int i = 0; i < 3; i++) {
        ll ta,tb;
        std::cin >> ta>>tb;
        
        count[ta-1 ]++;
        count[tb-1 ]++;
    }
    
    
    sort(count,count+4);
    
    if(count[0] == 1 && count[1] == 1 && count[2] == 2 && count[3] == 2){
        std::cout << "YES" << std::endl;
    }else{
        std::cout << "NO" << std::endl;
    }
    
    
    
}


Measured memory_bytes: 256
n=int(input())
a=[]
for i in range(n):
    a.append(input())
if len(a)!=len(set(a)):
    print('No')
    exit()
for i in range(n-1):
    if a[i][-1]!=a[i+1][0]:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 3060
//love yjl forever
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const ll mo=1e9+7,N=2e5+5;
int n,m;
ll sz[N],ps[N];
ll wow[N],ny[N];
ll ans[N],wai[N],dp[N];
vector<int> v[N];
ll ksm(ll x,ll y)
{
	if(y==0) return 1;
	ll tmp=ksm(x,y/2);
	
	if(y&1)
	{
		return ((tmp*tmp)%mo*x)%mo;
	}
	else 
		return (tmp*tmp)%mo;
}
void dfs(int x,int fa)
{
	ll s1=1,s2=1;
	ps[x]=1;
	for(int i=0;i<v[x].size();i++)
	{
		int u=v[x][i];
		if(u==fa) continue;
		dfs(u,x);
		sz[x]+=sz[u];
//		ps[x]=(ps[x]*sz[u])%mo;
		s1=(s1*ny[sz[u]])%mo;
		s2=(s2*ans[u])%mo;
	}
	sz[x]++;
	ps[x]=s1;
	ans[x]=((wow[sz[x]-1]*s1)%mo*s2)%mo;
}
void dfs2(int x,int fa)
{
	for(int i=0;i<v[x].size();i++)
	{
		int u=v[x][i];
		if(u==fa) continue;
		wai[u]=((((dp[x]*wow[(n-sz[u]-1)])%mo*ny[n-1])%mo*ksm(ans[u],mo-2))%mo*wow[sz[u]])%mo;
		dp[u]=((((ans[u]*ny[sz[u]-1])%mo*wow[n-1])%mo*wai[u])%mo*ny[n-sz[u]])%mo;
		dfs2(u,x);
	}
}
int main()
{
/*	freopen("","r",stdin);
	freopen("","w",stdout);*/
	int i;
	cin>>n;
	for(i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].pb(y);
		v[y].pb(x);
	}
	wow[0]=1;ny[0]=1;
	for(i=1;i<=n;i++)
		wow[i]=(wow[i-1]*i)%mo,ny[i]=ksm(wow[i],mo-2)%mo;
	
//	for(i=1;i<n;i++)
//		cout<<wow[i]<<" ";
//	cout<<endl;
//	for(i=1;i<n;i++)
//		cout<<ny[i]<<" ";
//	cout<<endl;	
	for(i=1;i<=n;i++)
		ans[i]=1;

	dfs(1,1);

	dp[1]=ans[1];
	dfs2(1,1);

	for(i=1;i<=n;i++)
		cout<<dp[i]<<endl;
//	cout<<endl;
//	for(i=1;i<=n;i++)
//		cout<<sz[i]<<" ";
//	cout<<endl;
//	for(i=1;i<=n;i++)
//		cout<<ans[i]<<" ";
//	cout<<endl;
}

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

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    for(int i = 0; i <= n; i++){
        int dig = 0;
        int num = i;
        while(num){
            dig += num%10;
            num /= 10;
        }
        if(dig >= a && dig <= b){
            ans += i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
    int a, b, c, d;
    long long s1, s2;

    cin >> a >> b >> c >> d;
    s1 = a*b;
    s2 = c*d;

    if(s1>=s2) cout << s1 << endl;
    if(s1<s2) cout << s2 << endl;

    

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s,t;
int s_len, t_len;
int dp[3001][3001];
int lcs(int i, int j){
    if(i>= s_len || j>=t_len ){
        return 0;
    }
    if(dp[i][j]!=-1){
        return dp[i][j];
    }
if(s[i]==t[j]){
   return dp[i][j]=1+lcs(i+1, j+1);
}
     int op1=lcs(i+1,j);
     int op2=lcs(i,j+1);
return dp[i][j]=max(op1,op2);
}
string solve(){
    memset(dp,-1,sizeof dp);
    s_len= s.length();
    t_len= t.length();
    string ans;
   int len=lcs(0,0);
       
       // GET LCS
       int i=0, j=0;
       while(len>0){
           if(s[i]==t[j]){
               ans.push_back(s[i]);
               i++;
               j++;
               len--;
           }
           else{
             if(dp[i+1][j] > dp[i][j+1]){
             i++;}
             else{
             j++; 
             }  

           }
       }

return ans;
}

int32_t main() {
      cin>>s>>t;
     // cout<<s<<" "<<t;
    cout<<solve();
    return 0;
}


Measured memory_bytes: 39024
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n, u;
vector<int>a, b;
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> u;
		a.push_back(u);
		b.push_back(u);
	}
	sort(all(b));
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int k = lower_bound(all(b), a[i]) - b.begin();
		if (k % 2 == 1 && i % 2 == 0) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
vector<int> ki[110000];
void dfs(int now,int last,vector<int> &dist){
	for(auto next:ki[now]){
		if(next == last)continue;
		dist[next] = dist[now] + 1;
		dfs(next,now,dist);
	}
}
signed main(){
	int n,tak,aok;cin >> n >> tak >> aok;
	tak--;aok--;
	rep(i,n-1){
		int a,b;cin >> a >> b;
		a--;b--;
		ki[a].push_back(b);
		ki[b].push_back(a);
	}
	vector<int> takahashi(n),aoki(n);
	dfs(tak,-1,takahashi);
	dfs(aok,-1,aoki);
	vector<int> kouho;
	rep(i,n){
		if(takahashi[i] < aoki[i]){
			kouho.push_back(i);
		}
	}
	int ret = 0;
	for(auto i:kouho){
		ret = max(ret,aoki[i]);
	}
	cout << ret -1 << endl;
	return 0;
}

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

class Main{
  public static void main(String[] args) throws IOException{
    Scanner scan=new Scanner(System.in);
    int W=Integer.parseInt(scan.next());
    int H=Integer.parseInt(scan.next());
    int x=Integer.parseInt(scan.next());
    int y=Integer.parseInt(scan.next());
    int r=Integer.parseInt(scan.next());

    
    if((x-r>=0) && (x+r<=W) && (y-r>=0) && (y+r<=H) ){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 26316
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=1007;

int n;
int tab[nax];

vi wyn;

int main()
{
	scanf("%d", &n);
	for (int i=1; i<=n; i++)
	{
		scanf("%d", &tab[i]);
	}
	int czy=1;
	while(n)
	{
		int g=-1;
		for (int i=1; i<=n; i++)
			if (tab[i]==i)
				g=i;
		if (g==-1)
		{
			czy=0;
			break;
		}
		for (int i=g+1; i<=n; i++)
			swap(tab[i], tab[i-1]);
		n--;
		wyn.push_back(g);
	}
	
	if (!czy)
	{
		printf("-1\n");
		return 0;
	}
	reverse(wyn.begin(), wyn.end());
	for (int i : wyn)
		printf("%d\n", i);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = long long;


int main() {
	int n, k; cin >> n >> k;
	string s; cin >> s;
	s[k - 1] = s[k - 1] - 'A' + 'a';
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace _0013
{
    class Program
    {
        static void Main(string[] args)
        {
            var carPark = new Stack<int>();

            while (true)
            {
                var input = Console.ReadLine();

                if (string.IsNullOrEmpty(input))
                {
                    break;
                }

                if (input == "0")
                {
                    if (carPark.Count > 0)
                    {
                        var outcar = carPark.Pop();
                        Console.WriteLine(outcar);
                    }
                }
                else
                {
                    carPark.Push(int.Parse(input));
                }
            }
        }
    }
}

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

using namespace std;

typedef long long int64;

const int64 mod = 1e9 + 7;

inline int64 modPow(int64 x, int64 n)
{
  if(n == 0) return (1);
  int64 ret = modPow(x, n / 2);
  (ret *= ret) %= mod;
  if(n & 1) (ret *= x) %= mod;
  return (ret);
}

inline int64 modInv(int64 a)
{
  return (modPow(a, mod - 2));
}

int64 fact[2001];

int64 nCr(int64 n, int64 r)
{
  int64 N = 1;
  for(int i = 0; i < r; i++, n--) (N *= n % mod) %= mod;
  return (N * modInv(fact[r]) % mod);
}

int main()
{
  int64 N, D, X;
  int64 dp[2001];

  fact[0] = 1;
  for(int i = 1; i < 2001; i++) (fact[i] = fact[i - 1] * i) %= mod;

  while(cin >> N >> D >> X, N) {

    memset(dp, 0, sizeof(dp));
    dp[0] = 1;

    int64 ret = 0, now = D;
    for(int64 i = 1; i <= min(D, N); i++) {

      // dp[i][j] := ???[k=j-X+1..j-1] dp[i - 1][k]
      for(int64 j = 1; j <= N; j++) (dp[j] += dp[j - 1]) %= mod;
      for(int64 j = N; j > 0; j--) {
        int64 sub = (j - X < 0 ? 0 : dp[j - X]);
        dp[j] = (dp[j - 1] - sub + mod) % mod;
      }
      dp[0] = 0;
      (ret += nCr(D, i) * dp[N] % mod) %= mod;
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N,i,ans=0,S;cin>>N;ll A[N];
  REP(i,N){
    cin>>A[i];ans^=A[i];
  }
  S=ans^A[0];cout<<S;
  REP(i,N-1){
    S=ans^A[i+1];cout<<" "<<S;
  }
  cout<<endl;
  return 0;
}

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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC   
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

const ll MOD = (ll)1e9+7; //change it for other mods

ll powmod(ll a,ll b)
{
   ll res = 1;
   while(b > 0) {
      if(b & 1) res = (res * a) % MOD;
      a = (a*a)%MOD;
      b = b >> 1; 
  }
  return res % MOD;
}

vector<vll> nodes;

void build(ll start, ll end, ll node, vll &c) 
{
	for(ll i = start; i <= end; i++) {
		nodes[node].pb(c[i]);
	}
	sort(all(nodes[node]));
	if(start == end) {
		return;
	}
	ll mid = (start + end) >> 1;
	build(start, mid, 2*node + 1, c);
	build(mid + 1, end, 2*node + 2, c);
}

ll query(ll start, ll end, ll node, ll lrange, ll rrange, ll find) 
{
	if(lrange <= start && rrange >= end) {
		auto it = upper_bound(all(nodes[node]), find);
		ll cnt = (ll)(nodes[node].end() - it);
		return cnt;
	}
	if(lrange > end || rrange < start) {
		return 0;
	}
	ll mid = (start + end) >> 1;
	return query(start, mid, 2*node + 1, lrange, rrange, find) + query(mid+1, end, 2*node+2, lrange, rrange, find);
}

void solve(ll testnum)
{
    ll n,q;
    cin >> n >> q;
    vll c(n), rt(n);
    vpll pt;
    for(ll i=0; i<n; i++) {
    	cin >> c[i];
    	pt.pb(mp(c[i], i));
    }
    sort(all(pt));
    for(ll i=0; i<n; i++) {
    	if( i == n-1  || pt[i].ff != pt[i+1].ff) {
    		rt[pt[i].ss] = n;
    	} else {
    		rt[pt[i].ss] = pt[i+1].ss;
    	}
    }
    nodes.resize(3*n);
    build(0, n-1, 0, rt);
    for(ll i=0; i<q; i++) {
    	ll x, y;
    	cin >> x >> y;
    	x--, y--;
    	cout << query(0, n-1, 0, x, y, y) << "\n";
    }
}

int main()
{
    FAST_IO;
    #ifdef STIO 
      freopen("input.txt" , "r", stdin);
      freopen("output.txt" , "w", stdout);
    #endif
    ll t = 1;
    // cin >> t;
    for (ll i = 1; i <= t; i++) {
        solve(i);
    }
}

Measured memory_bytes: 155208
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

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

    string S, T;
    cin >> S >> T;
    auto U = T.substr(0, T.size()-1);
    if (S == U) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3652
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007

int N;
char S[10005];

signed main(){
    scanf("%lld",&N);
    scanf("%s",&S);
    int ans=0;
    rep(i,strlen(S)){
         S[i]+=N;
         if(S[i]>'Z')S[i]=S[i]-'Z'-1+'A';
    }
    printf("%s\n",S);
    return 0;
}


Measured memory_bytes: 128
n = int(input())
ans = n

for i in range(n+1):
    j = n-i

    a = j
    p = 0
    while a>0:
        p += a%6
        a = a//6

    b = i
    q = 0
    while b>0:
        q += b%9
        b = b//9

    ans = min(ans, p+q)

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  vector<ll> L(N);
  for (ll i = 0; i < N; ++i) {
    cin >> L.at(i);
  }
  sort(L.begin(), L.end());
  ll ans = 0;
  for (ll i = 0; i < N - 2; ++i) {
    for (ll j = i + 1; j < N - 1; ++j) {
      for (ll k = j + 1; k < N; ++k) {
        if (L.at(i) == L.at(j) || L.at(i) == L.at(k) || L.at(j) == L.at(k)) {
          continue;
        }
        if (L.at(i) + L.at(j) > L.at(k)) {
          ans += 1;
        }
      }
    }
  }
  cout << ans << "\n";
}


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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

template<typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}


int main(int, char**)
{
	long long A;
	scanf("%lld",&A);
	long long B;
	scanf("%lld",&B);
	long long N;
	scanf("%lld",&N);

	ll z = min(N, B - 1);

	cout << min(A * z / B, A - 1) << endl;

	return 0;
}


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

long long ks(int* wt,int* val,int n,int C,long long ** dp){
  long long result;
 if(n==0 || C==0){
  return 0; 
 }
  if(dp[n][C]!=-1){
   return dp[n][C]; 
  }
  else if( wt[n]>C){
   result =  ks(wt,val,n-1,C,dp); 
  }
  else{
   long long temp1=ks(wt,val,n-1,C,dp);
    long long temp2= val[n]+ ks(wt,val,n-1,C-wt[n],dp);
    result = max(temp1,temp2);
  }
  dp[n][C]=result;
  return result;
}

int main(){
int n,w;
  cin>>n>>w;
  int wt[n+1];
  int val[n+1];
  for(int i=1;i<=n;i++){
   cin>>wt[i]>>val[i]; 
  }
  long long** dp = new long long* [n+1];
  for(int i=0;i<=n;i++){
   dp[i]=new long long[w+1];
    for(int j=0;j<=w;j++){
     if(j!=0){
      dp[i][j]=-1;
     }else{
       dp[i][j]=0;
     }
    }
  }
    cout<< ks(wt,val,n,w,dp);

      
  }

Measured memory_bytes: 79488
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;

int main(){
  long long int k;
  cin>>k;
  cout<<50<<endl;
  int n=50;
  vector<long long int> a(n);
  long long int x=k/50;
  for(int i=0;i<n;i++)a[i]=i+x;

  x*=50;

  while(1){
    if(x==k)break;
    //cout<<a[0]<<endl;
    a[0]+=n;
    for(int i=1;i<n;i++)a[i]--;
    x++;
    sort(a.begin(),a.end());
  }
  for(int i=0;i<n-1;i++)cout<<a[i]<<" ";
  cout<<a[49]<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e15;

int main(){
    int X, Y;
    cin >> X >> Y;
    int ans = 0;
    if(X == 1) ans += 300000;
    elif(X == 2) ans += 200000;
    elif(X == 3) ans += 100000;
    if(Y == 1) ans += 300000;
    elif(Y == 2) ans += 200000;
    elif(Y == 3) ans += 100000;
    if( X == 1 && Y == 1) ans += 400000;
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

	int [][] cards = new int [5][15];

	private  static String[] cards2 = {"0","S","H","C","D"};

	int n,j,i,k,cards4,Nu;
	String cards3;
	public void ca() {

		Scanner sc = new Scanner(System.in);

		for(j = 1;j <= 4;j++) {

			for(i = 1 ; i <= 13; i++) {

				k = i;

				cards[j][i] = k;

			}

		}

		n = sc.nextInt();

		for(k = 0 ; k < n ; k++) {

			cards3 = sc.next();

			cards4 = sc.nextInt();

			if(cards3.equals( "S" )) {

				Nu = 1;

			} else if(cards3.equals( "H" )) {

				Nu = 2;

			} else if(cards3.equals( "C" )) {

				Nu = 3;

			} else if(cards3.equals( "D" )) {

				Nu = 4;

			}

			switch(Nu) {

				case 1:

					for(j = 1;j <= 13 ; j++) {

						if(cards4 == cards[1][j]) {

							cards[1][j] -= cards4;

						}

					}

					break;

				case 2:

					for(j = 1;j <= 13 ; j++) {

						if(cards4 == cards[2][j]) {

							cards[2][j] -= cards4;

						}

					}

					break;

				case 3:

					for(j = 1;j <= 13 ; j++) {

						if(cards4 == cards[3][j]) {

							cards[3][j] -= cards4;

						}

					}

					break;

				case 4:
	
				for(j = 1;j <= 13 ; j++) {

						if(cards4 == cards[4][j]) {

							cards[4][j] -= cards4;

						}

					}

					break;

				default:

					break;

			}

		}

		for(j = 1;j <= 4;j++) {

			for(i = 1;i <= 13;i++) {

				if(cards[j][i] != 0) {

					System.out.printf("%S %d\n",cards2[j],cards[j][i]);

				}

			}

		}

	}

	public static void main(String[] agrs) {

		new Main().ca();

	}

}

Measured memory_bytes: 26444
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
  	int x,n;
  	cin>>x>>n;
  	vector<int> d(182);
	rep(i,n){
		int p;
		cin>>p;
		d[p] = 1;
	}
	P ans(99999,-1);
	for(int i =0; i <= 101; i++){
		if (d[i] == 1) continue;
		int dif = abs(x-i);
		ans = min(ans,P(dif,i));
	}
	cout << ans.second <<endl;
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

signed main(void)
{
	int n;
	cin >> n;
	vector<int> b(n), out;

	rep(i, n) cin >> b[i];
	rep(i, n)
	{
		for(int j = b.size() - 1; j >= 0; j--)
		{
			if (b[j] == j + 1)
			{
				out.push_back(b[j]);
				b.erase(b.begin() + j);
				break;
			}
		}
	}
	reverse(out.begin(), out.end());
	if (out.size() == n)
	{
		rep(i, out.size())
			cout << out[i] << endl;
	}
	else
		cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int N,n,d;

    while(1)
    {
        scanf("%d",&N);

        if(N==0)
            break;

        int i;

       int dd[210],nn[210];
        dd[0] = 0; nn[0] = 0;
        

        for(i=1;i<N;i++)
        {
            scanf("%d %d",&n,&d);

            if(d==0)       
            {
                dd[i] = dd[n] +1;
                nn[i] = nn[n];
            }
            else if(d==1)       
            {
                dd[i] = dd[n];
                nn[i] = nn[n]+1;
            }
            else if(d==2)       
            {
                dd[i] = dd[n]-1;
                nn[i] = nn[n];
            }
            else if(d==3)       
            {
                dd[i] = dd[n];
                nn[i] = nn[n]-1;
            }
        }
    int a = dd[0],b=dd[0],c=nn[0],d=nn[0];
    for(i=0;i<=N-1;i++)
        {
            if(dd[a] < dd[i])
                a = i;
            
            if(dd[b] > dd[i])
                b = i;

            if(nn[c] < nn[i])
                c = i;

            if(nn[d] > nn[i])
                d = i;
        }

    printf("%d %d\n",dd[a]-dd[b]+1,nn[c]-nn[d]+1);
        
    }


    return 0;
}


Measured memory_bytes: 2044
#include <iostream>
using namespace std;
 
int n;
char grid[255][255];
int dx[] = {1,0,1,-1};
int dy[] = {0,1,1,1};
 
int solv(int sx, int sy) {
    int res = 0;
    for (int i=0; i<4; ++i) {
        int cnt = 0, x = sx, y = sy;
        while (0 <= x && x < n && 0 <= y && y < n) {
            cnt = (grid[y][x] == '1' ? cnt+1 : 0);
            res = max(res, cnt);
            x += dx[i];
            y += dy[i];
        }
    }
    return res;
}
 
int main() {
    ios::sync_with_stdio(false);
    while (cin >> n, n) {
        char c;
        for (int i=0; i<n*n; ++i) {
            cin >> grid[i/n][i%n];
        }
        int res = 0;
        for (int i=0; i<n; ++i) {
            res = max(max(res, solv(0, i)), max(solv(n-1, i), solv(i, 0)));
        }
        cout << res << endl;
    }
    return 0;
}

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

struct edge{
	int from, cost;
	edge(){}
	edge(int from_, int cost_){
		from = from_; cost = cost_;
	}
};

const int INF = 1e+8;
int n, m;
vector<edge> G[401];
int dp[401];

void add_edge(int u, int v, int c){
	G[v].push_back( edge(u, c) );
}

// テ」ツδ。テ」ツδ「テ・ツ個姪・ツ?催・ツクツー
int solve(int v){
	if( v == 0 ) return 0;
	if( dp[v] != -1 ) return dp[v];
	
	int res = 0;
	for(int i = 0; i < G[v].size(); i++){
		int from = G[v][i].from, cost = G[v][i].cost;
		res = max(res, solve(from) + cost);
	}
	return dp[v] = res;
}

int main(){
	// テ・ツ按敕ヲツ慊淌・ツ個?
	for(int i = 0; i < 401; i++) dp[i] = -1;
	
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		int a, b, c;
		cin >> a >> b >> c;
		add_edge(a, b, c);
	}
	cout << solve(n-1) << endl;
}

Measured memory_bytes: 1220
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<map>
#define ran(x) (x).begin(),(x).end()
using namespace std;
int main() {
	int n, x, t;
	cin >> n >> x >> t;
	if(n % x == 0)
		cout << (n / x) * t << endl;
	else
		cout <<( n / x) * t +t << endl;
}

Measured memory_bytes: 3592
n = int(input())
a,b,c = [input() for i in range(3)]
cnt = 0
for i in range(n):
    if a[i] == b[i] and a[i] == c[i]:
        cnt += 0
    if a[i] == b[i] and not a[i] == c[i]:
        cnt += 1
    if b[i] == c[i] and not a[i] == c[i]:
        cnt += 1
    if c[i] == a[i] and not b[i] == c[i]:
        cnt += 1
    if not a[i] == b[i] and not b[i] == c[i] and not a[i] == c[i]:
        cnt += 2
print(cnt)


Measured memory_bytes: 3064
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pa;
typedef unsigned int uint;
typedef unsigned long long ull;
#define w1 first
#define ls (x<<1)
#define w2 second
#define ins insert
#define rs (x<<1|1) 
#define mp make_pair
#define pb push_back
#define mid ((l+r)>>1)
#define sqr(x) ((x)*(x))
#define cle(x) ((x).clear())
#define lowbit(x) ((x)&(-x))
#define SZ(x) (int((x).size()))
#define ms(x,y) memset(x,y,sizeof (x))
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)])
#define Rep2(p,x) for(int (p)=cur[(x)];(p);(p)=nxt[(p)])
template<class T>inline void rread(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
inline int getgcd(int x,int y){if(!x)return y;return getgcd(y%x,x);}
inline int power(int x,int k,int p){int res=1;for(;k;k>>=1,x=(ll)x*x%p)if(k&1)res=(ll)res*x%p;return res;}
const double pi=acos(-1);
inline void judge(){
	freopen("input.txt","r",stdin);
} 
//********************************head*************************************
ll n,m;
inline bool check(ll x){
	ll tn=n,tm=m;
	if(tn<x)tm-=2*(x-tn);
	return tm>=2*x;
}
int main(){
	rread(n);rread(m);
	ll l=0,r=1e12,ans=0;
	while(l<=r){
		if(check(mid))ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;

int main(){
    int H,W;
    while(true){
        scanf("%d %d",&H,&W);
        if (H==0 && W==0){
            break;
        }
        for (int i=0; i<H; i++){
            for (int j=0; j<W; j++){
                if (i==0 || i==H-1 || j==0 || j==W-1){
                    printf("#");
                } else {
                    printf(".");
                }
                
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2576