akhauriyash/Code-Regression huggingface dataset:
import math
D,G = map(int,input().split())
s_max = []
pn = []
for i in range(1,D+1):
    p,c = map(int,input().split())
    s_max.append(100*i*p+c)
    pn.append(p)
num_all = sum(pn)
for i in range(2<<D):
    a = []
    for j in range(D):
        a.append(i%2)
        i = i//2
    s = sum([s_max[i] for i in range(D) if a[i] == 1])
    if 0 in a:
        m = max([i for i in range(D) if a[i] == 0])
        num = math.ceil((G-s)/(100*(m+1)))
        if G> s and num <= pn[m]:
            num_all = min(num_all,sum([pn[i] for i in range(D) if a[i] == 1])+num)
        elif G <= s:
            num_all = min(num_all,sum([pn[i] for i in range(D) if a[i] == 1]))
print(num_all)

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> grid(H, vector<char>(W));
    
    for (int i=0; i<H; i++) {
        vector<char> row(W);
        for (int j=0; j<W; j++) {
            cin >> row.at(j);
        }
        grid.at(i) = row;
    }
    
    vector<bool> row(H), column(W);
    
    for (int i=0; i<H; i++) {
        bool flag = true;
        for (int j=0; j<W; j++) {
            if (grid.at(i).at(j) == '#') flag = false;
        }
        row.at(i) = flag;
    }
    
    
    for (int i=0; i<W; i++) {
        bool flag = true;
        for (int j=0; j<H; j++) {
            if (grid.at(j).at(i) == '#') flag = false;
        }
        column.at(i) = flag;
    }
    
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            if (row.at(i) || column.at(j)) continue;
            cout << grid.at(i).at(j);
        }
    if (!row.at(i)) cout << endl;
    }
}


Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<string>
#include<list>
#include<utility>
#include<tuple>
#include<map>
#include<unordered_map>
#include<complex>
#include<set>
using namespace std;
typedef long long llong;
llong gcd(llong a, llong b) {
	if (a < b) std::swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}
llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}
//ここまで共通
int N, M;
priority_queue<double> A;
llong ANS = 0;
int main() {
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		double a;
		cin >> a;
		A.push(a);
	}
	for (int i = 0; i < M; i++) {
		double tmp = A.top();
		A.pop();
		tmp /= 2;
		A.push(tmp);
	}
	for (int i = 0; i < N; i++) {
		int tmp = A.top();
		A.pop();
		ANS += tmp;
	}
	cout << ANS << endl;
	return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define int long long 
using namespace std;

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

signed main() {
  int H, W;
  cin >> H >> W;
  
  vector<string> meiro(H);
  for( int i = 0; i < H; i++ ) cin >> meiro.at(i);
  
  vector<vector<int>> dist(H, vector<int>(W, -1));
  dist.at(0).at(0) = 0;
  
  //どこから来たのか
  vector<vector<int> > prev_x(H, vector<int>(W, -1));
  vector<vector<int> > prev_y(H, vector<int>(W, -1));
  
  queue<pair<int, int>> que;
  que.push(make_pair(0,0));
  
  
  for( int i = 0; i < H; i++ ){
    for( int j = 0; j < W; j++ ){
      while (!que.empty()){
        pair<int, int> current_pos = que.front();
        int x = current_pos.first;
        int y = current_pos.second;
        que.pop();
        
        for (int direction = 0; direction < 4; ++direction) {
            int next_x = x + dx[direction];
            int next_y = y + dy[direction];
            if (next_x < 0 || next_x >= H || next_y < 0 || next_y >= W) continue;
            if (meiro[next_x][next_y] == '#') continue;
          if (dist[next_x][next_y] == -1) {
              que.push(make_pair(next_x, next_y));
              dist[next_x][next_y] = dist[x][y] + 1;
              prev_x[next_x][next_y] = x;
              prev_y[next_x][next_y] = y;
          }
        }
      }
    }
  }
  
  if( dist.at(H-1).at(W-1) == -1 ){
    cout << -1 << endl;
    return 0;
  }
  
  int x = H-1;
  int y = W-1;
  while( x != -1 && y != -1 ){
    meiro.at(x).at(y) = 'o';
    int px = prev_x[x][y];
    int py = prev_y[x][y];
    x = px;
    y = py;
  }
  
  int ans = 0;
  for( int i = 0; i < H; i++ ){
    for( int j = 0; j < W; j++ ){
      if( meiro.at(i).at(j) == '.' ) ans++;
    }
  }
  
  cout << ans << endl;
  
                                          
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

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

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

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N := sc.nextInt()
	A := sc.nextIntSlice(N)
	set := make(map[int]bool)
	all := true
	for i := 0; i < N; i++ {
		if !set[A[i]] {
			set[A[i]] = true
		} else {
			all = false
		}
	}

	if all {
		fmt.Fprintln(wtr, "YES")
	} else {
		fmt.Fprintln(wtr, "NO")
	}
}


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

int main(void) {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  
  if(e-a > k)
    cout << ":(" << endl;
  else
    cout << "Yay!" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (n > k * 2) {

	}
	return fac[n] / (fac[k] * fac[n - k]);
}

ll dp[201010][2];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char c[10][10];
bool flag[10][10];
bool flag2[10][10];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n;
	cin >> n;
	vector<ll>a(n + 1);
	for (ll i = 1;i <= 100;++i) {
		for (ll j = 1;j <= 100;++j) {
			for (ll k = 1;k <= 100;++k) {
				ll res = i * i + j * j + k * k + i * j + j * k + k * i;
				if (res > n)continue;
				a[res]++;
			}
		}
	}
	for (ll i = 1;i <= n;++i) {
		cout << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3672
#include <iostream>

using namespace std;

constexpr double EPS = 0.0000000001;

int main()
{
    double xA, yA, xB, yB, xC, yC, xD, yD;

    while(cin >> xA >> yA >> xB >> yB >> xC >> yC >> xD >> yD) {
        if (-EPS < (yA-yB) * (yC-yD) + (xC-xD) * (xA-xB) &&
                (yA-yB) * (yC-yD) + (xC-xD) * (xA-xB) < EPS) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

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

int main(){
    int N,K;
    int result = INT_MAX;
    cin>>N>>K;
    int x[N];
    for(int i = 0;i < N;i++) cin>>x[i];
    for(int i = 0;i < N-K+1;i++){
       int tmp = min(abs(x[i])+abs(x[i+K-1]-x[i]),abs(x[i+K-1])+abs(x[i+K-1]-x[i]));
       result = min(result,tmp);
    }
    cout<<result;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int k;
    cin>>k;
    int visited[k+1];
    int distance[k+1];
    for(int i=0;i<k;i++){
        visited[i]=0;
        distance[i]=0;
    }
    vector<ii> arr[k+1];
    for(int i=0;i<k;i++){
        arr[i].pb(mp(1,(i+1)%k));
        arr[i].pb(mp(0,(i*10)%k));
    }

    deque<int> q;
    visited[1]=1;
    distance[1]=1;
    q.push_front(1);

    while(!q.empty()){
        int v=q.front();
        q.pop_front();
        visited[v]=1;
        for(int i=0;i<arr[v].size();i++){
            int node=arr[v][i].se;
            int d=arr[v][i].fi;
            if(visited[node]==0){
                if(d==0){
                    distance[node]=distance[v];
                    q.push_front(node);
                }
                else{
                    distance[node]=distance[v]+1;
                    q.push_back(node);
                }
            }
        }
    }
    cout<<distance[0]<<endl;
    return 0;
}


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

#define ll 				long long
#define vi 				vector<ll>
#define vb 				vector<bool>
#define vvi				vector<vi>
#define vvb				vector<vb>
#define vii				vector<pair<ll,ll>>
#define pii				pair<ll,ll>
#define mii 			map<ll,ll>
#define rev(a); 		reverse(a.begin(), a.end());
#define sortv(a); 		sort(a.begin(), a.end());
#define sortd(a); 		sort(a.begin(), a.end(), greater<int>());
#define FOR(i,a,b) 		for (int i = (a); i < (b); i++)
#define ROF(i,a,b) 		for (int i = (b)-1; i >= (a); i--)
#define pb 				push_back
#define mp 				make_pair
#define printv(a);		FOR(_Q,0,(int)(a).size())cout<<(a)[_Q]<<" ";cout<<'\n';
#define IOS 			ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

void solve();

ll MOD = 1000000007;
ll INF = LLONG_MAX;

/*****************************************************************************/
signed main() {
	IOS;
	int n;cin>>n;
	set<string> dong;
	FOR(i,0,n) {
		string s;cin>>s;
		dong.insert(s);
	}
	cout<<dong.size();
}

Measured memory_bytes: 19252
using System;

public class Class1
{
	public static void Main()
	{
		while(true)
		{
			string ways = Console.ReadLine();
			string[] nx= ways.Split();
			int n = int.Parse(nx[0]);//3<=n<=100
			int x = int.Parse(nx[1]);
			if(n+x==0)
			{
				break;
			}
			int count=0;
			for(int i=1;i<=n-2;i++)
			{
				for(int j=i+1;j<=n-1;j++)
				{
					for(int k=j+1;k<=n;k++)
					{
						if(i+j+k==x)
						{
							count++;
						}
					}
				}
			}
			Console.WriteLine(count);
		}
	}
}
			    

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

using pii = pair<int, int>;
using vi = vector<int>;
using ll = long long;

int main() {
    int N;
    string name;
    cin >> N >> name;
    int ans = 0;
    for(int i = 0; i < N; ++i) {
        string s; cin >> s;
        bool ok = false;
        for(int w = 0; w < s.size(); ++w) {
            for(int l = 0; l < s.size(); ++l) {
                string tmp;
                for(int j = 0; j < name.size() && j * w + l < s.size(); ++j) {
                    tmp += s[j * w + l];
                }
                ok |= name == tmp;
            }
        }
        ans += ok;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;

vector< ll > divisor(ll n) {
  vector< ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(),ret.end());
  return (ret);
}


int main(){
    int N;
    ll K;
    ll sum=0;
    ll ans=0;
    cin>>N>>K;
    vector<ll> d(N);
    for(int i=0;i<N;i++) {cin>>d.at(i); sum+=d.at(i);}

    vector<ll> R=divisor(sum);
    for(int i=R.size()-1;i>=0;i--){
        ll yaku=R.at(i);
        vector<ll> kari;
        ll sum=0;
        ll a=0;
        for(int j=0;j<N;j++){
            kari.push_back(d.at(j)%yaku);
            sum+=d.at(j)%yaku;
        }

        sort(kari.begin(),kari.end());
        for(int i=0;i<(sum/yaku);i++){a+=(yaku-kari.at(kari.size()-1-i));}

        if(a<=K) {ans=yaku; break;}



    }

    cout<<ans<<endl;


}

Measured memory_bytes: 256
#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>;

const int MAX=1e6+1;

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

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

    sort(A, A+N);

    vector<int> div(MAX, 0);
    int num_pre=0;
    rep(i, N){
        if(num_pre==A[i]){
            div[A[i]]=1;
            continue;
        }
        for(int j=A[i]*2; j<MAX; j+=A[i]){
            div[j]=1;
        }
        num_pre=A[i];
    }

    int ans=0;
    rep(i, N){
        if(div[A[i]]==0) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))


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

    if (a == b) {
        if (b == c) {
            printf("Yes");
        } else {
            printf("No");
        }
    } else {
        printf("No");
    }

    
	return 0;
}

Measured memory_bytes: 128
using System;

namespace ITP1
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            char[] s = str.ToCharArray();
            int q = int.Parse(Console.ReadLine());

            for (int i = 0; i < q; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                int a = int.Parse(input[1]);
                int b = int.Parse(input[2]);
                switch (input[0])
                {
                    case "print":
                        for (int k = a; k <= b; k++)
                        {
                            Console.Write(s[k]);
                        }
                        Console.WriteLine();
                      
                        break;
                    case "reverse":
                        char[] z = new char[b-a+1];
                        int e = 0;
                        for (int k = a; k <= b ; k++)
                        {
                            z[e] = s[k];
                            e++;
                        }
                        e--;
                        for (int k = a; k <= b; k++)
                        {
                            s[k] = z[e];
                            e--;
                        }
                       
                        break;
                    case "replace":
                        string p = input[3];
                        int c = 0;
                        for (int k = a; k <= b ; k++)
                        {
                            s[k] = p[c];
                            c++;
                        }
                        
                            break;
                }

            }
        }
    }
}

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

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int res = 0;
  while(n) {
    n /= k;
    res++;
  }
  cout << res << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int test=in.nextInt();
        int ar[]=new int[test];
        int n=in.nextInt();
        long sum=0;int count=1;
        for (int i = 0; i < test; i++) {
            ar[i]=in.nextInt();
            sum=sum+ar[i];
            if(sum<=n){
                count++;
            }
        }
        System.out.println(count);
    }
}

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

int main() {
    int N;  cin >> N;
    vector<int> P(N), Q(N);
    for (int i = 0; i < N; ++i) cin >> P[i];
    for (int i = 0; i < N; ++i) cin >> Q[i];
    vector<int> perm(N);
    for (int i = 0; i < N; ++i) perm[i] = i + 1;

    // DUMP(P, Q, perm);

    int a, b, cnt = 1;
    do {
        if (P == perm) a = cnt;
        if (Q == perm) b = cnt;
        ++cnt;
    } while (next_permutation(perm.begin(), perm.end()));

    cout << abs(b - a) << endl;
}


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

int mx(100000);
vector<bool> ok(mx, false);

void solve(int n){
	if(n<=mx && ok[n] == false){
		ok[n] = true;
		for(int i(0);i<=5;++i){
			solve(n+100+i);
		}
	}
	return;
}

int main(){
	int n;
	cin >> n;
	solve(0);
	cout << int(ok[n]) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    ArrayList<String> array2 = new ArrayList<String>();
    while (in.hasNext()){
      StringBuilder sb = new StringBuilder();
      HashMap<String,String> map1 = new HashMap<String,String>();
      ArrayList<String> array1 = new ArrayList<String>();
      int n1 = in.nextInt();
      if (n1 == 0){
        break;
      }
      for (int i = 0; i < n1; i++){
        String a1 = in.next();
        String b2 = in.next();
        map1.put(a1,b2);
     }
      int n2 = in.nextInt();
      for (int i = 0; i < n2; i++){
        String key = in.next();
        if (map1.containsKey(key)){
          array1.add(map1.get(key));
        }else{
          array1.add(key);
        }
      }
      for (int i = 0; i < array1.size(); i++){
        sb.append(array1.get(i));
      }
      String s = sb.toString();
      array2.add(s);
    }
    for (String sss: array2){
      System.out.println(sss);
    }
  }
}

Measured memory_bytes: 68372
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int sosu(int a){
    if(a==2){
        return 1;
    }
    for(int i=2;i<sqrt(a)+1;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}
int n,m,cnt=0,aa[220000],ans=0;
pair<int,int> pp[220000];
string s,sa[220000];
char c;
queue<int> que;
signed main(){
    cin>>s;
    rep(i,(s.size()+1)/2-1){
        rep(j,i+1){
            if(s[j]!=s[j+i+1]){
                goto no;
            }
        }
        cnt=(i+1)*2;
        no:;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 10624
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


template<typename T>
class Perm {
public:
    ll n;
    vector<T> p;
    vector<vector<T>> p_v;
    Perm(ll n):n(n){}

    void build() {
        vector<T> v(n);
        iota(v.begin(), v.end(), 1);
        do {
            ll num = 0;
            for(ll i=0; i<v.size(); i++) num += pow(10, v.size()-(i+1)) * v[i];
            p.push_back(num);
        }while(next_permutation(v.begin(), v.end()));
    }

    void build_v(){
        ll size = 1;
        for(ll i=0; i<=n; i++) size *= i;
        p_v.assign(size);
        vector<T> v(n);
        iota(v.begin(), v.end(), 1);
        ll ind = 0;
        do {
            for(auto const e : v) p_v[ind].push_back(e);
            ind++;
        }while(next_permutation(v.begin(), v.end()));
    }
};

class CCountOrder {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        int p[10], q[10];
        ll p_num = 0, q_num = 0;
        in >> n;
        rep(i, n){
            in >> p[i];
            p_num += pow(10, n-(i+1)) * p[i];
        }
        rep(i, n){
            in >> q[i];
            q_num += pow(10, n-(i+1)) * q[i];
        }

        Perm<int> perm(n);
        perm.build();

        int a = distance(perm.p.begin(), upper_bound(all(perm.p), p_num));
        int b = distance(perm.p.begin(), upper_bound(all(perm.p), q_num));

        out << abs(a - b) << endl;
	}
};


int main() {
	CCountOrder solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

int main(){
    int n;
    cin>>n;
    rep(loop,n){
        if(loop!=0)cout<<endl;
        string data[30];
        int h,w;
        cin>>h>>w;
        rep(i,h){
            cin>>data[i];
        }
        int x;
        cin>>x;
        string s;
        cin>>s;
        
        pii now;
        char st=' ';
        
        rep(i,h){
            rep(j,w){
                if( data[i][j]=='>' || data[i][j]=='^' || data[i][j]=='<' || data[i][j]=='v' ){
                    now=pii(i,j);
                    st=data[i][j];
                    data[i][j]='.';
                    break;
                }
            }
        }
        rep(i,x){
            if(s[i]=='R'){
                if(now.second+1<w&&data[now.first][now.second+1]=='.'){
                    now.second++;
                }
                st='>';
            }
            if(s[i]=='L'){
                if(now.second-1>=0&&data[now.first][now.second-1]=='.'){
                    now.second--;
                }
                st='<';
            }
            if(s[i]=='D'){
                if(now.first+1<h&&data[now.first+1][now.second]=='.'){
                    now.first++;
                }
                st='v';
            }
            if(s[i]=='U'){
                if(now.first-1>=0&&data[now.first-1][now.second]=='.'){
                    now.first--;
                }
                st='^';
            }
            if(s[i]=='S'){
                int y=now.first,x=now.second;
                int dir=0;
                int dx[]={0,1,0,-1};
                int dy[]={1,0,-1,0};
                if(st=='v')dir=0;
                if(st=='>')dir=1;
                if(st=='^')dir=2;
                if(st=='<')dir=3;
                while(1){
                    y+=dy[dir];
                    x+=dx[dir];
                    if(y<0||y>=h||x<0||x>=w)break;
                    if(data[y][x]=='#')break;
                    if(data[y][x]=='*'){
                        data[y][x]='.';
                        break;
                    }
                }
            }
        }
        data[now.first][now.second]=st;
        rep(i,h){
            rep(j,w){
                cout<<data[i][j];
            }
            cout<<endl;
        }
    }
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<pii>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

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

    int N, M;
    cin >> N >> M;
    cout << (N == M ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

const int INF = 1e9+5;

int main(){
  vector<vector<int>> c(3,vector<int>(3));
  rep(i,3)rep(j,3) cin >> c[i][j];

  rep(i,3){
    int a=10000;
    rep(j,3) chmin(a,c[i][j]);
    rep(j,3) c[i][j]-=a;
  }
  rep(i,3){
    if(c[0][i] != c[1][i] || c[1][i] != c[2][i]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
include Math
n=gets.to_i
l=[0]
n.times{|i|l=l.flat_map{|v|[v,v+1,v-1,v]}}

x=y=0.0
puts [x,y]*" "
r=100.0/3**n
l.map{|i|
x+=r*cos(2*i*PI/6)
y+=r*sin(2*i*PI/6)
puts"%f %f"%[x,y]
}

Measured memory_bytes: 6288
{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Char
import Data.Int
import Data.Foldable
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B

solve :: Int -> VU.Vector Int -> Int
solve !n !ws = minimum
  [ let (w1, w2) = VU.splitAt i ws in abs (VU.sum w1 - VU.sum w2)
  | i <- [0 .. n - 1]
  ]

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  n  <- (\vec -> (vec VU.! 0)) . VU.unfoldrN 1 readInt <$> B.getLine
  ws <- VU.unfoldrN n readInt <$> B.getLine
  print $ solve n ws


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
string a;
bool c=false,f=false;
int main(){
    cin>>a;
	for(int i=0;i<a.size();++i)
	{
		if(a[i]=='C')
			c=true;
		if(a[i]=='F'&&c==true)
			f=true;
	}
	if(c==true&&f==true)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
    return 0;
}

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

int main(){
    int mat[3][3];
    int i,j;
    for(i=0;i<3;i++){
        for(j=0;j<3;j++)
        cin>>mat[i][j];
    }
    int n,b,k;
    cin>>n;
    for(k=0;k<n;k++){
        cin>>b;
        for(i=0;i<3;i++){
            for(j=0;j<3;j++){
                if(mat[i][j]==b){
                    mat[i][j]=0;
                    break;
                }
            }
        }
    }
    int temp=1;
    for(j=0;j<3;j++){
        if(mat[0][j]!=0){
            temp=0;
            break;
        }
    }
    if(temp){
        cout<<"Yes";
        return 0;
    }
    temp=1;
    for(j=0;j<3;j++){
        if(mat[1][j]!=0){
            temp=0;
            break;
        }
    }
    if(temp){
        cout<<"Yes";
        return 0;
    }
    temp=1;
    for(j=0;j<3;j++){
        if(mat[2][j]!=0){
            temp=0;
            break;
        }
    }
    if(temp){
        cout<<"Yes";
        return 0;
    }
    temp=1;
    for(j=0;j<3;j++){
        if(mat[j][0]!=0){
            temp=0;
            break;
        }
    }
    if(temp){
        cout<<"Yes";
        return 0;
    }
    temp=1;
    for(j=0;j<3;j++){
        if(mat[j][1]!=0){
            temp=0;
            break;
        }
    }
    if(temp){
        cout<<"Yes";
        return 0;
    }
    temp=1;
    for(j=0;j<3;j++){
        if(mat[j][2]!=0){
            temp=0;
            break;
        }
    }
    if(temp){
        cout<<"Yes";
        return 0;
    }
    temp=1;
    for(j=0;j<3;j++){
        if(mat[j][j]!=0){
            temp=0;
            break;
        }
    }
    if(temp){
        cout<<"Yes";
        return 0;
    }
    temp=1;
    if(mat[2][0]!=0 || mat[1][1]!=0 || mat[0][2]!=0)
    temp=0;
    if(temp)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> vec(N);
  int a,b;
  for(int i=0;i<M;i++){
    cin >> a >> b;
    vec[a-1]++;
    vec[b-1]++;
  }
  for(int i=0;i<N;i++){
    cout << vec[i] << endl;
  }
}


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

using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	
	int n, x;
	cin >> n;
	
	vector<pair<int, int> > v;
	
	for (int i = 0; i < n; ++i) {
		cin >> x;
		v.emplace_back(make_pair(x, i+1));
	}
	
	sort(v.begin(), v.end());
	
	for (int i = 0; i < n; ++i) {
		cout << v[i].second << " ";
	} 
}


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

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

int main()
{
    ll N, X;
    cin >> N >> X;
    vector<ll> x(N+1);
    rep(i, N){
        cin >> x[i];
    }
    x[N] = X;
    sort(x.begin(), x.end());
    vector<ll> x_diff(N);
    ll D = x[1] - x[0];
    rep(i, N){
        x_diff[i] = x[i+1] - x[i];
        D = gcd(D, x_diff[i]);
    }
    cout << D << endl;

    return 0;
}


Measured memory_bytes: 4764
#include <iostream>
#include <map>

using namespace std;

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

    map<long long, long long> m;
    for (long long i = 2, j = p; i * i <= p; i++) {
        m.erase(j);

        for (; j % i == 0; j /= i) {
            m[i]++;
        }
        if (i < j) {
            m[j]++;
        }
    }

    long long res = 1;
    for (map<long long, long long>::iterator i = m.begin(); i != m.end(); i++) {
        for (int j = 0; j < i->second / n; j++) {
            res *= i->first;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 384
n,y = map(int,input().split())
a = 10000
b = 5000
c = 1000
for i in range(n+1):
    for j in range(n-i+1):
        if a*i + b*j + c*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 3060
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun gcd(a:Int, b:Int):Int {
    val c = a % b
    if (c == 0) return b
    return gcd(b, c)
}

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextLong()
    val fac = mutableMapOf<Long, Int>()
    var d = 2L
    var m = n
    while (d * d <= m) {
        if (m % d == 0L) {
            var count = 0
            while (m % d == 0L) {
                m /= d
                count++
            }
            fac[d] = count
        }
        d++
    }
    if (m != 1L) {
        fac[m] = 1
    }
    val prime = fac.keys.toList()
    val l = prime.count()
    var ans = 0L
    d = 1L
    while (d * d <= n - 1) {
        if ((n - 1) % d == 0L) {
            ans++
            if (d * d != n - 1) {
                ans++
            }
        }
        d++
    }
    ans--
    for (i in 0 until 1L.shl(l)) {
        val lst = mutableListOf<Int>()
        var ak1 = 1L
        var kb = 1L
        var gcd = 0
        for (j in 0 until l) {
            if ((1L.shl(j) and i) != 0L) {
                ak1 *= Math.pow(prime[j].toDouble(), fac[prime[j]]!!.toDouble()).toLong()
            } else {
                kb *= Math.pow(prime[j].toDouble(), fac[prime[j]]!!.toDouble()).toLong()
                gcd = gcd(gcd, fac[prime[j]]!!)
                lst.add(j)
            }
        }
        if (kb == 1L) continue
        val div = mutableListOf<Int>()
        var d = 1
        while (d * d <= gcd) {
            if (gcd % d == 0) {
                div.add(d)
                if (d * d != gcd) {
                    div.add(gcd / d)
                }
            }
            d++
        }
        for (b in div) {
            var k = 1L
            for (j in lst) {
                k *= Math.pow(prime[j].toDouble(), fac[prime[j]]!!.toDouble() / b).toLong()
            }
            if (ak1 % k == 1L) {
                ans++
            }
        }
    }
    println(ans)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 31004
import sys
sys.setrecursionlimit(10000)
n,m = map(int,input().split())
rel = [[False for i in range(n+1)] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    rel[a][b] = True
    rel[b][a] = True

ans=0
def rec(l):
    global ans
    if(len(l)==n):
        ans+=1
    x = l[-1]
    for i in range(1,n+1):
        if(i in l):
            continue
        if(rel[x][i]):
            rec(l+[i])

rec([1])
print(ans)

Measured memory_bytes: 3064
//1の位と10の位を決めると、日付と月が決まる. 日付と月が範囲に収まってるかを考えれば良い。
#include <iostream>
using namespace std;

int m, d;

int main() {
	cin >> m >> d;
	
	int ans = 0;
	for (int x = 2; x <= 9; x++) {
		for (int y = 2; y <= 9; y++) {
			if (10 * x + y <= d && x * y <= m) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n,x = list(map(int,input().split()))

l = [int(s) for s in input().split()]
d = 0
i = 1
d = [0] * (n+1)
count = 0
if n == 1 and x >= l[0]:
    print(1)
elif n == 1 and x < l[0] :
    print(0)
else:

    while True:
        
        
        d[i] = d[i-1] + l[i-1]
        count += 1
        
        if d[i] > x:
            break
        
        i += 1
        if i > n:
            print(count+1)
            exit()

    print(count)


Measured memory_bytes: 3064
import fractions


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

a,b = map(int,input().split())

div_a = make_divisors(a)
div_a.sort()
#print(div_a)
#exit()

div_b = make_divisors(b)
div_b.sort()

#print(div_a,div_b)

ans = 0
a_inc = 0
b_inc = 0
ans_list = []
"""
for i in range(len(div_a)):
    while i+a_inc < len(div_a) and i+b_inc < len(div_b):
        if div_a[i+a_inc] == div_b[i+b_inc]:
            ans += 1
            ans_list.append(div_a[i+a_inc])
            break
        elif div_a[i+a_inc] > div_b[i+b_inc]:
            b_inc += 1
        else:
            a_inc += 1
"""

while a_inc < len(div_a) and b_inc < len(div_b):
    if div_a[a_inc] == div_b[b_inc]:
        ans += 1
        ans_list.append(div_a[a_inc])
        b_inc += 1
        a_inc += 1
    elif div_a[a_inc] > div_b[b_inc]:
        b_inc += 1
    else:
        a_inc += 1


if ans == 1:
    print(ans)
    exit()
#print(div_a)
a_list = []
a_list.append(ans_list[1])

for i in range(2,ans):
    for j in range(len(a_list)):
        if ans_list[i] % a_list[j] == 0:
            break
        if j == len(a_list)-1:
            a_list.append(ans_list[i])

print(len(a_list)+1)

Measured memory_bytes: 5628
while 1:
    M,T,P,R=map(int,input().split())
    if not M and not T and not P and not R:break
    d={i:[0,0] for i in range(1,T+1)}
    wa=[[0 for _ in range(P)] for _ in range(T)]
    for _ in range(R):
        m,t,p,j=map(int,input().split())
        if j:
            wa[t-1][p-1]+=20
        else:
            d[t][0]+=1
            d[t][1]+=(m+wa[t-1][p-1]) 
    rank=sorted(d.items(),key=lambda x:(x[1][0],-x[1][1]),reverse=True)        
    f=lambda x:"=".join(sorted(x,key=lambda y:int(y),reverse=True))
    l=[]
    b=[]
    for (i,j) in enumerate(rank):
        if i>0 and rank[i][1]!=rank[i-1][1]:
            l.append(f(b))
            b=[]
        b.append(str(j[0]))
    if b:l.append(f(b))
    print(",".join(l))



Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e4+7;
const int inf=1e8;
int w[maxn],c[maxn];
int f[maxn],j[maxn];
int V,n;
void Completepark(){
    for(int i=1;i<=V;i++)
        f[i]=inf;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=V;j++){
            f[j] = min(f[j], f[j-c[i]] + w[i]);
        }
}
int main() {
    scanf("%d%d",&V,&n);
    for(int i=1;i<=n;i++){
        scanf("%d%d",&c[i],&w[i]);
    }
    Completepark();
    printf("%d\n",f[V]);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;

ll n, m, q, u, v, x, y, ted, ans;
int A[MAXN], B[MAXN], C[MAXN];
int comp[MAXN], mark[MAXN];
vector<int> G[MAXN];

void dfs(int node, int cid){
	comp[node]=cid;
	for (int v:G[node]) if (!comp[v]) dfs(v, cid);
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>m>>q;
	for (int i=0; i<q; i++){
		cin>>A[i]>>B[i]>>C[i];
		A[i]++, B[i]++;
		if (!C[i]){
			G[A[i]].pb(B[i]);
			G[B[i]].pb(A[i]);
		}
		else if (m<n) kill("No")
	}
	for (int i=1; i<=n; i++) if (!comp[i]) dfs(i, i), ted++;
	debug(ted)
	for (int i=0; i<q; i++) if (C[i] && comp[A[i]]==comp[B[i]]) kill("No")
	debug("shit1")
	if (ted*(ted-1)/2+n-ted<m) kill("No")
	kill("Yes")
	
	return 0;
}


Measured memory_bytes: 11472
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
//inputに含まれるsearchを全てformatに置き換え 破壊的
void replace_all(string& input, const string& search, const string& format) {
	string::size_type pos = input.find(search);
	while (pos != string::npos) {
		input.replace(pos, search.size(), format);
		pos = input.find(search, pos + format.size());
	}
}
signed main() {
	string s; cin >> s;
	replace_all(s, ",", " ");
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
use proconio::input;

const MAX: usize = 55_555;

fn sieve(n: usize) -> Vec<usize> {
    let mut is_prime = vec![true; n+1];
    is_prime[0] = false;
    is_prime[1] = false;
    let mut primes = vec![];

    for i in 2..=n {
        if !is_prime[i] {
            continue;
        }
        primes.push(i);
        for b in is_prime.iter_mut().skip(i*i).step_by(i) {
            *b = false;
        }
    }

    primes
}

fn main() {
    input! {
        n: usize,
    }

    let primes = sieve(MAX);

    let mut ans = vec![];

    for prime in primes {
        if prime % 5 == 1 {
            ans.push(prime);
            if ans.len() == n {
                break;
            }
        }
    }

    let ans = ans.into_iter().map(|e| e.to_string()).collect::<Vec<_>>().join(" ");
    println!("{}", ans);
}


Measured memory_bytes: 2216
#include<iostream>
using namespace std;
#define T t[i][j]
#define r(i,h) for(int i=0;i<h;i++)
int main(){
int h,a;
while(cin>>h,h){
a=0;
int t[200][5]={{0},{0}};
r(i,h)r(j,5)cin>>T;
while(1){
bool f=1;
r(i,h){
int c=0,q=-1;
r(j,3){
if(T==t[i][j+1]&&T==t[i][j+2]&&T!=0){
c++;
if(q==-1)q=j;
}
}
if(c!=0){a+=t[i][q]*(2+c),f=0;r(j,2+c)t[i][q+j]=0;}
}
if(f)break;
for(int i=h-2;i>=0;i--){
r(j,5){
int x=i;
while(true){
if(x==h-1||t[x+1][j]!=0)break;
t[x+1][j]=t[x][j];
t[x][j]=0;
x++;
}
}
}
}
cout<<a<<endl;
}
return 0;
}

Measured memory_bytes: 1164
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	String s;
	public void solve() {
		s = next();
		out.println(s.replaceAll(","," "));
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 8276
#include <cstdio>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <math.h>
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;

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

#define ALL(a) (a).begin(),a.end()
#define MAXE(a) *max_element(ALL(a))
#define MINE(a) *min_element(ALL(a))

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

	ll x = (ll)sqrt((double)N) + 1;

	ll out = 1;
	
	for(x;x>1;x--){
		if(N%x == 0){
			out = x;
			break;
		}
	}
	ll out2 = N/out;

	
	

	ll d = (ll)log10(out)+1;
	ll d2 = (ll)log10(out2)+1;




	cout << max(d,d2)  << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int A,B,C,X;cin>>A>>B>>C>>X;

    int ans=0;
    _rep(a,A,0){
        _rep(b,B,0){
            _rep(c,C,0){
                if(a*500+b*100+c*50==X) ans++;
            }
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

const ll MAX_N = 100000;
int vmap[MAX_N];

int main(){
	int A, B, C;
	cin >> A >> B >> C;
	if (A == B){
		cout << C << endl;
	}
	else if (A == C){
		cout << B << endl;
	}
	else{
		cout << A << endl;
	}
	return 0;
}


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

string str,ans;

int main() {
  ans = "No";
  cin >> str;
  if (str.at(2) == str.at(3) and str.at(4) == str.at(5)) {
    ans = "Yes";
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf INT_MAX
#define llinf LONG_LONG_MAX
long long int dp[405][405];
long long int w[405][405];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // std::cout << std::setprecision(10) << std::fixed;
    long long int n,i,k,j;
    cin>>n;
    long long int a[n+1];
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=n;i++)
    {
        long long int sum=0;
        for(j=i;j<=n;j++)
        {
            sum=sum+a[j];
            w[i][j]=sum;
        }
    }
    for(i=1;i<=n;i++)
        dp[i][i]=0;
    for(i=1;i<n;i++)
    {
        for(j=1;j<=(n-i+1);j++)
        {
            dp[j][j+i]=dp[j][j]+dp[j+1][j+i]+w[j][j+i];
            for(k=j+1;k<j+i;k++)
            {
                dp[j][j+i]=min(dp[j][j+i],dp[j][k]+dp[k+1][j+i]+w[j][j+i]);
            }
        }
    }
    cout<<dp[1][n];
}

Measured memory_bytes: 2816