akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

VVI com(60, VI(60));

ll comb(ll n, ll k) {
    if (n < 0 || k < 0 || k > n) return 0;
    return com[n][k];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll i, j;
    for (i = 0; i < 60; i++) com[i][0] = 1;
    for (i = 1; i < 60; i++) {
        for (j = 1; j <= i; j++) {
            com[i][j] = com[i - 1][j - 1] + com[i - 1][j];
        }
    }
    ll n, k, s, t;
    cin >> n >> k >> s >> t;
    ll a[n];
    VI r(18, -1);
    for (i = 0; i < n; i++) cin >> a[i];
    ll m = 0;
    for (i = 0; i < 18; i++) {
        if (((s >> i) & 1) && !((t >> i) & 1)) {
            cout << 0 << endl;
            return 0;
        } else if (((s >> i) & 1) && ((t >> i) & 1)) {
            r[i] = 1;
        } else if (!((s >> i) & 1) && !((t >> i) & 1)) {
            r[i] = 0;
        } else {
            m++;
        }
    }
    VI na;
    for (i = 0; i < n; i++) {
        bool ng = 0;
        for (j = 0; j < 18; j++) {
            if (r[j] == 1 && !((a[i] >> j) & 1))
                ng = 1;
            else if (r[j] == 0 && ((a[i] >> j) & 1))
                ng = 1;
        }
        if (ng) continue;
        ll x = 1;
        ll b = 0;
        for (j = 0; j < 18; j++) {
            if (r[j] == -1) {
                if ((a[i] >> j) & 1) b += x;
                x <<= 1;
            }
        }
        na.pb(b);
    }
    // for (i = 0; i < na.size(); i++) cout << na[i] << endl;
    ll sum = 0;
    for (i = 0; i < na.size(); i++) {
        ll u = na[i];
        for (j = 0; j < (1 << m); j++) {
            ll ans = 0;
            ll cnt = 0;
            for (ll l = i + 1; l < na.size(); l++) {
                if ((u & j) == (na[l] & j)) cnt++;
            }
            bool pl = 1;
            for (ll l = 0; l < m; l++) {
                if ((j >> l) & 1) pl = !pl;
            }
            for (ll l = 0; l <= k - 1; l++) {
                ans += comb(cnt, l);
            }
            if (pl)
                sum += ans;
            else
                sum -= ans;
            // cout << ans << endl;
            //sum %= mod;
        }
        // cout << 1111 << " " << sum << endl;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int c, n;
  cin >> c >> n;
  for(int i=n-(c-1); i<=n+(c-1); i++) {
    cout << i;
    if (i+1<=n+(c-1))
      cout << " ";
  }
  cout << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#define _USE_MATH_DEFINES

#include<math.h>

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

int main()
{
	int n;
	vector<int> a;

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int ta;
		scanf("%d", &ta);
		a.push_back(ta);
	}

	reverse(a.begin(), a.end());

	for (int i = 0; i != a.size(); i++)
	{
		printf("%d", a[i]);
		if (i < (a.size() - 1))
		{
			printf(" ");
		}
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 3212
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#define INF 10e10

using namespace std;

//  #define y cout << "yes"<< endl
  #define Y cout << "YES" << endl
  #define y cout << "Yes" << endl
//  #define n cout << "no"<< endl
  #define N cout << "NO" << endl
  #define n cout << "No" << endl
  #define pu(q) cout << q ;
  #define put(q) cout << q << " ";
  #define puts(q) cout << q << endl;
  
  
//	int a,b,c,d,e,f,g,h,ans,res;
//	char a,b,c,d,e,f,g,h,ans,res;
	string a,b,c,d,e,f,g,h,ans,res;
//	double a,b,c,d,e,f,g,h,ans,res;
	
void take(int x);
  
int main(void){
	take(1);//数
	
	
	
	if(((a[0]==a[1]&&a[2]==a[3])&&a[0]!=a[2])||((a[0]==a[2]&&a[1]==a[3])&&a[0]!=a[1])){
		
		
		y;	//Yes
	//	Y;	//YES
	//	n;	//No
	//	N;	//NO
	}
	
	else if(((a[0]==a[3]&&a[1]==a[2])&&a[0]!=a[1])){
		
		
		y;
	//	Y;
	//	n;
	//	N;
		
	}/*
	else if(){
		
		
	//	y;
	//	Y;
	//	n;
	//	N;
		
	}
	else if(){
		
		
	//	y;
	//	Y;
	//	n;
	//	N;
		
	}
	*/
	else{
		
		
	//	y;
	//	Y;
		n;
	//	N;
		
	}
	
	return 0;
}
void take(int x){
	if(x==1)
		cin >> a;
	else if(x==2)
		cin >> a >> b;
	else if(x==3)
		cin >> a >> b >> c;
	else if(x==4)
		cin >> a >> b >> c >> d;
	else if(x==5)
		cin >> a >> b >> c >> d >> e;
	else if(x==6)
		cin >> a >> b >> c >> d >> e >> f;
	else if(x==7)
		cin >> a >> b >> c >> d >> e >> f >> g;
	else if(x==8)
		cin >> a >> b >> c >> d >> e >> f >> g >> h;
	return ;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

#define MOD 1000000007

long sum(long a, long b) { return (a + b) % MOD; }
long mult(long a, long b) { return (a * b) % MOD; }

long pow(long a, long b) {
    long res = 1;
    while (b > 0) {
        if (b & 1) {
            res = mult(res, a);
        }
        a = mult(a, a);
        b >>= 1;
    }
    return res;
}

long inv(long a) {
    return pow(a, MOD - 2);
}

int main() {
    std::ios::sync_with_stdio(false);

    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> x(q), y(q);
    for (int i = 0; i < q; i++) cin >> x[i] >> y[i];

    vector<vector<long>> d(n, vector<long>(n));
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            d[i][j] = 1;
        }
    }

    long inv2 = inv(2LL);

    for (int i = q - 1; i >= 0; i--) {
        int u = x[i];
        int v = y[i];
        u--; v--;

        for (int i = 0; i < n; i++) {
            if (i == v) continue;
            if (i == u) continue;
            d[u][i] = d[v][i] = mult(sum(d[u][i], d[v][i]), inv2);
            d[i][u] = d[i][v] = mult(sum(d[i][u], d[i][v]), inv2);
        }
        d[u][v] = d[v][u] = inv2;

    }

    long res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i] < a[j]) {
                res = sum(res, d[j][i]);
            }
        }
    }

    for (int i = 0; i < q; i++) {
        res = sum(res, res);
    }

    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 70784
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		int c = a * b;

		if (c % 2 == 0) {
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}
	}
}


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



double T(double a,double b,double c){
	double s=(a+b+c)/2;
	return sqrt(s*(s-a)*(s-b)*(s-c));
}


int main(){
	
	double a,l,x;
	while(cin>>a>>l>>x){
		double ans=T(a,l,l);
		ans+=T(l,(l+x)/2.0,(l+x)/2.0);
		ans+=T(l,(l+x)/2.0,(l+x)/2.0);
		printf("%.12f\n",ans);
	}
	
	return 0;
}


Measured memory_bytes: 1240
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
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);
}
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
typedef long long ll;
typedef long double ld;
typedef unsigned long long int ull;
const ll INF = 1LL << 60;
const int inf = 1 << 25;
ll n, m, k, y, x, d, w = -1, num, sum, ans = INF; string s;
int main(void) {
	cin >> n; vector<int> a(100000);
	for (int i = 1; i * i <= 10000; i++) {
		for (int j = 1; j * j <= 10000; j++) {
			for (int k = 1; k * k <= 10000; k++) {
				num = i * i + j * j + k * k + i * j + i * k + j * k;
				if (num > 10000) break;
				a[num]++;
			}
		}
	}
	req(i, n) cout << a[i] << endl;
}

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

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

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

int main() {
    string o, e; cin >> o >> e;

    int l = max(o.length(), e.length());

    string ans;

    for(int i = 0; i < l; i++) {
        if(i <= o.length()-1) ans += o[i];
        if(i <= e.length()-1) ans += e[i];
    }
    cout << ans;
}

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

using namespace std;

typedef long long ll;

ll N, M, P, Q, R, S, A, B, C, D, E, F, X, Y, Z;
ll arr[200005];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	X += (N/500) * 1000;
	N %= 500;
	X += 5*(N/5);
	cout << X << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int long long n,num,temp,sum=0;
    cin>>n;
    num=n;
    while(num!=0)
    {
        sum+=num%10;
        num/=10;
    }
    if(n%sum==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"bytes"
	"container/list"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var (
	n   int
	tmp int
)

func main() {
	fmt.Scanln(&n)

	buf := bytes.NewBufferString("")

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	ls := list.New()

	i := 0
	for sc.Scan() {
		tmp, _ := strconv.Atoi(sc.Text())
		if i%2 == 0 {
			ls.PushFront(tmp)
		} else {
			ls.PushBack(tmp)
		}
		i++
	}

	if n%2 == 0 {
		for e := ls.Back(); e != nil; e = e.Prev() {
			buf.WriteString(
				fmt.Sprintf("%d ", e.Value),
			)
		}
	} else {
		for e := ls.Front(); e != nil; e = e.Next() {
			buf.WriteString(
				fmt.Sprintf("%d ", e.Value),
			)
		}
	}

	fmt.Println(strings.TrimSpace(buf.String()))
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
#define N 200005 
#define MOD 2019
#define ll long long 
int n,s,vs[MOD];ll ans;char a[N];
int main()
{
	vs[0]=1;scanf("%s",a+1);n=strlen(a+1);
	for(int i=n,t=1;i>=1;--i,t=t*10%MOD)
		s=(s+(a[i]-'0')*t)%MOD,ans+=vs[s],++vs[s];
	printf("%lld\n",ans);return 0;
}

Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string A;
    cin>>A;
    int i,j;
    if(A[0]==67&&A[1]==70)
    {
        cout<<"Yes";
        return 0;
    }
    for(i=0;i<=A.length();i++)
    {
        if(A[i]==67)
        {
            int pd=0;
            for(j=i;j<=A.length();j++)
            {
                if(A[j]==70)
                {
                    pd=1;
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np


if __name__ == '__main__':
    n = int(input())
    A = np.array([int(a) for a in input().split()], dtype=np.int)

    isEven = True
    count = 0
    while isEven:
        if (A%2).any() != 0 :
            isEven = False
            break
        A = A/2
        count+=1
    print(count)

Measured memory_bytes: 12496
#include <iostream>
#include <stdio.h>

#define MAX_N 100

using namespace std;

int S[MAX_N];

int main() {
  int N;
  cin >> N;
  int t = 0;
  for (int i = 0; i < N; ++i) {
    cin >> S[i];
    t += S[i];
  }
  if (t % 10 != 0) {
    printf("%d\n", t);
    return 0;
  }
  int res = 0;
  for (int i = 0; i < N; ++i) {
    if ((t - S[i]) % 10 != 0) {
      res = max(res, t - S[i]);
    }
  }
  printf("%d\n", res);
}

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

int main(){
  int N,X;
  cin >> N >> X;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  long long count=0;
  for(int i=0;i<N-1;i++){
    int B=A.at(i)+A.at(i+1);
    if(B<=X){
      continue;
    }
    int C=B-X;
    count+=C;
    if(A.at(i+1)>=C){
      A.at(i+1)-=C;
      C=0;
    }
    else{
      A.at(i+1)=0;
    } 
  }
  cout << count << endl;
} 

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

using namespace std;
using ll=long long;

void solve() {
    ll x; cin >> x;
    ll res = x/11 * 2;
    x%=11;
    res += (x>0) + (x>6);
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		int x = nextInt();
		int t = nextInt();


		System.out.println(Math.max(0, x-t));

	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 19156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i)
static const ll INFTY = 1L << 62L;
ll MAX = 1000000007;
ll solver(ll *a, ll n)
{
    ll sum = 0, ans = 0;
    rep(i, 0, n)
    {
        sum += a[i];
    }
    rep(i, 0, n - 1)
    {
        sum -= a[i];
        ans += a[i] * (sum % MAX);
        ans %= MAX;
    }
    return ans;
}
int main()
{
    ll n;
    cin >> n;
    ll a[n];
    rep(i, 0, n) cin >> a[i];
    cout << solver(a, n) << endl;
}

Measured memory_bytes: 5228
#include<stdio.h>
int main()
{
  long long N,K,tmp;
  scanf("%lld %lld",&N,&K);
  while(1){
    tmp=N;
    if(N<K){
      N=K-N;
    }
    else{
      N=N%K;
    }
    if(tmp<=N){
      break;
    }
  }
  printf("%lld",tmp);
  return 0;
}


Measured memory_bytes: 128
n, m = gets.split.map(&:to_i)
s = gets.chomp
t = gets.chomp

LCM = n.lcm(m)

x = Hash.new

if s[0] != t[0]
	puts "-1"
	exit
end

n_ = LCM / n
i = 1
while n_ * i < LCM
	x[n_*i] = s[i%n]
	i += 1
end

m_ = LCM / m
i = 1
while m_ * i < LCM
	if(x[m_*i].nil? || x[m_*i] == t[i%m])
		x[m_*i] = t[i%m]
	else
		puts "-1"
		exit
	end
	i += 1
end

puts LCM

Measured memory_bytes: 20732
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int N, K;
	string S;
	cin >> N >> K >> S;
	transform(S.begin() + K - 1, 
		      S.begin() + K, 
		      S.begin() + K - 1, ::tolower);
	cout << S << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N, M, K;
    cin >> N >> M >> K;

    int b;
    for(int i=0;i<=N;i++){
        b = i*M;
        for(int j=0;j<=M;j++){
            b += (N-i) - i;
            if(b == K){
                cout << "Yes" << endl;
                return 0;
            }
                
        }
    }
    cout << "No" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=1e5+5;
int n;

inline int nxi(FILE *fd=stdin){
	int x=0;
	char c;
	while((c=fgetc(fd))>'9'||c<'0');
	while(x=x*10-48+c,(c=fgetc(fd))>='0'&&c<='9');
	return x;
}

template <class T> inline void apx(T &x,const T y){
	x<y?x=y:0;
}

template <class T> inline void apn(T &x,const T y){
	x>y?x=y:0;
}

namespace G{
	int cnt,split_v,fir[N],sz[N],xsz[N];
	lint tot;
	struct edge{
		int to,wi,nx;
	}eg[N<<1];

	inline void add(const int a,const int b,const int v){
		eg[++cnt]=(edge){b,v,fir[a]};
		fir[a]=cnt;
	}

	void dfs_sz(const int x){
		sz[x]=1;
		for(int i=fir[x]; i; i=eg[i].nx){
			const int y=eg[i].to;
			if(!sz[y]){
				dfs_sz(y);
				sz[x]+=sz[y];
				apx(xsz[x],sz[y]);
			}
		}
	}

	int get_ndis(){
		int ndis=1e9;
		for(int x=1; x<=n; ++x){
			if(sz[x]<<1<n||xsz[x]<<1>n) continue;
			for(int i=fir[x]; i; i=eg[i].nx){
				apn(ndis,eg[i].wi);
			}
		}
		return ndis;
	}

	bool split(){
		for(int i=1; i<=n; ++i){
			if(sz[i]*2==n) return 1;
		}
		return 0;
	}

	void get_tot(){
		tot=0;
		for(int i=1; i<=n; ++i){
			for(int j=fir[i]; j; j=eg[j].nx){
				int tx=i,ty=eg[j].to;
				if(sz[tx]<sz[ty]) continue;
				int v1=sz[ty],v2=n-sz[ty];
				if(v1>v2) std::swap(v1,v2);
				int wgt=std::min(2*v1,2*v2-1);
				tot+=(lint)wgt*eg[j].wi;
			}
		}
	}
}

int main(){
	n=nxi();
	for(int i=1; i<n; ++i){
		const int a=nxi(),b=nxi(),v=nxi();
		G::add(a,b,v);
		G::add(b,a,v);
	}
	G::dfs_sz(1);
	G::get_tot();
	if(G::split()){
		printf("%lld\n",G::tot);
		return 0;
	}
	printf("%lld\n",G::tot-G::get_ndis());
	return 0;
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t a,b,c;
  cin >> a >> b >> c;
  
  if(a+b+c<=21) cout << "win" << endl;
  else cout << "bust" << endl;
  return 0;
}




Measured memory_bytes: 3652
from math import sqrt
n=int(input())
def make_divisors(n):
	lower_divisors , upper_divisors = [], []
	i = 1
	while i*i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n//i)
		i += 1
	return lower_divisors + upper_divisors[::-1]
l=make_divisors(n)
if len(l)%2==0:
	print((l[len(l)//2]+l[(len(l)//2)-1])-2)
elif len(l)%2==1:
	print(int((sqrt(n)*2)-2))

Measured memory_bytes: 9148
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

#pragma once

/**
 * @brief Union-Find
 * @docs ./docs/union_find.md
 */

#include <algorithm>
#include <vector>

struct UnionFind {
private:
    const int n;
    int size_;
    vector<int> uf;
public:
    // 初期化 UnionFind uni(n) のように宣言すれば良い
    UnionFind(int _n) : n(_n), size_(_n), uf(_n, -1) {}
    // find (木の根を求める)
    int find(int x) {return (uf[x] < 0) ? x : uf[x] = find(uf[x]);}
    // x と y が同じ集合に属するかどうか
    bool same(int x, int y) {return find(x) == find(y);}
    // x が属する集合の要素数
    int size(int x) {return -uf[find(x)];}
    // 集合はいくつあるか
    int size()      {return size_;}
    // x と y の属する集合を併合
    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        size_--;
        if(-uf[x] < -uf[y]) swap(x, y);
        uf[x] += uf[y]; uf[y] = x;
        return true;
    }
};

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    vector<int> C(100010);
    for(auto e : A) C[e]++;

    ll ans = 0;
    for(int i=0; i<100010; i++) ans += 1LL * i * C[i];

    int Q; scanf("%d", &Q);
    while(Q--) {
        ll b, c; scanf("%lld%lld", &b, &c);
        ans -= b * C[b];
        ans += c * C[b];
        C[c] += C[b];
        C[b] = 0;
        printf("%lld\n", ans);
    }
    return 0;
}


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

int n,s;
char c[10];
int a;
bool black;

int score(char x){
  if('2'<= x && x <= '9')return x-'0';
  if(x == 'A')return 11;
  return 10;
}

void cal(int x){
  s += score(c[x]);
  if(c[x] == 'A')a++;
  while(s>21 && a){
    s -= 10;
    a--;
  }
}

int main(){
  scanf("%d",&n);

  while(n--){
    black = false;
    for(int i=0;i<10;i++)scanf(" %c ",&c[i]);
    if(score(c[0])+score(c[1])==21)black = true;
    if(!black){
      s = a = 0;
      for(int i=0;i<10;i++){
	cal(i);
	if(s<=16 || (s==17 && a) )continue;
	break;
      }
    }
    if(black)printf("blackjack\n");
    else if(s>21)printf("bust\n");
    else printf("%d\n",s);
  }
}
    
  

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

int main() {
    int N=0;
    cin >> N;
    double sum=0;
    for(int i=0; i<N; i++){
        double x=0;
        cin >> x;
        string u="";
        cin >> u;
        if(u=="JPY"){
            sum += x;
        }else{
            sum += x*380000.0;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n, m, lot[30];
	scanf("%d %d",&n,&m);
	for(int i=0; i<n; i++){lot[i] = i+1;}
	while(m--){
		int a, b;
		scanf("%d,%d",&a,&b);
		swap(lot[a-1],lot[b-1]);
	}
	for(int i=0; i<n; i++){printf("%d\n",lot[i]);}
	return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    vector< int > w;

    int i = 0;
    a *= 100;
    b *= 100;
    while( i <= f ) {
        int j = 0;
        while( i + j <= f ) {
            if( i == 0 && j == 0 ) {
                j += b;
                continue;

            }

            w.pb(i + j);
            j += b;

        }
        i += a;

    }
    sort(all(w));

    vector< int > s;
    i = 0;
    while( i <= f ) {
        int j = 0;
        while( i + j <= f ) {
            s.pb(i + j);
            j += d;

        }
        i += c;

    }
    sort(all(s));

    unique(all(w));
    unique(all(s));

    int res_al = 0, res_s = 0;
    double n = 0;
    for( i = 0; i < w.size(); ++i ) {
        int pos = 0;
        if( w[i] == 0 ) continue;
        while( pos < s.size() && w[i] + s[pos] <= f && w[i] / 100 * e >= s[pos] ) {
            if( n <= (double)(100 * s[pos]) / (double)(w[i] + s[pos]) ) {
                n = (double)(100 * s[pos]) / (double)(w[i] + s[pos]);
                res_al = w[i] + s[pos];
                res_s = s[pos];

            }
            ++pos;
        }
    }
    cout << res_al << " " << res_s << endl;
    return 0;
}



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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

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

template <class T>
T Sq(const T &t) {
  return t * t;
}

signed main() {
  int N = read(), max = 0, h, ans = 0;
  REP(i, N) {
    if (i == 0) {
      max = read();
      ans++;
    } else {
      h = read();
      if (max <= h) {
        ans++;
        max = h;
      }
    }
  }
  print(ans);
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n, k;
	int sum = 1;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		if (sum + k <= sum * 2) sum +=k;
		else sum *=2;
	}
	cout << sum;
}


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

class MyClass
{
    public static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var ans = 0;
        var count = 0;
        foreach (var item in a)
        {
            if (item == 1)
            {
                count++;
            }
            else
            {
                ans = Math.Max(ans, count);
                count = 0;
            }
        }
        ans = Math.Max(ans, count);
        Console.WriteLine(ans + 1);
    }
}


Measured memory_bytes: 18340
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(I,0,n){cout<<(I ? " ":"")<<A[I]x;}cout<<endl;
#define pprint(A,y,m,n) rep(J,0,m){print(A[J],y,n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
long modpow(long x,int n){
	int i = 0;long res = 1;
	while(n >= (1<<i)){
		if(n & (1<<i)) (res *= x) %= mod;
		i++;
		x = (x * x) % mod;
	}return res;
}
int main(){
	int N; cin>>N;
    long A, B;
	map<pair<long,long>,pair<int,int>> mp;
    int cnt = 0;
	rep(i,0,N){
		cin>>A>>B;
        if(A == 0 && B == 0){ cnt++; continue; }
		long g = gcd(A, B);
		A /= g; B /= g;
        if(A < 0){ A = -A; B = -B; }
        if(A == 0 && B < 0) B = -B;
		if(B > 0) mp[{A,B}].first++;
		else mp[{-B,A}].second++;
	}long ans = 1;
	for(pair<pair<long,long>,pair<int,int>> p:mp){
		int s = p.second.first;
		int t = p.second.second;
		(ans *= (modpow(2, s) + modpow(2, t) - 1) % mod) %= mod;
	}cout<<(ans + cnt + mod - 1) % mod<<endl;
}

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

int main(){
    int a,b;
    cin>>a>>b;
    
    int ans=0;

    for(int i=a;i<=b;i++){
        int o,p,q,r;
        o=i/10000;
        r=i%10;
        p=i/1000%10;
        q=i%100/10;
        if(o==r&&p==q){ans++;}
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
w, h, n = map(int, input().split())
 
x0, y0 = (0, 0)
x1, y1 = (w, h)
 
for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        if x0 < x:
            x0 = x
        if x1 < x:
            x1 = x
    if a == 2:
        if x0 > x:
            x0 = x
        if x1 > x:
            x1 = x
    if a == 3:
        if y0 < y:
            y0 = y
        if y1 < y:
            y1 = y
    if a == 4:
        if y0 > y:
            y0 = y
        if y1 > y:
            y1 = y
 
ans = (x1 - x0) * (y1 - y0)
print(ans)

Measured memory_bytes: 3064
N,P=map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
p=factorization(P)
#print(p)
k=[]
ans=1
for i in range(len(p)):
    d=p[i][1]//N
    k.append(d)
for i in range(len(p)):
    ans*=pow(p[i][0],k[i])
print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
        using namespace std;
        #define int long long int
        #define pb push_back
        #define mk make_pair
        #define ft first
        #define sc second
        #define ppb pop_back
        #define sz size
        #define forn(i,a,n) for(i=a;i<n;i++)
        #define M 998244353 
        #define inf 2e18
 
        bool check(int n,int k){
            while(n%k==0){
                n=n/k;
            }
            return n%k==1;
        }
        
        signed main() {
 
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        int n;
        cin>>n;
        int ans=0;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++){
                for(int k=1;k<=n;k++){
                    int t=__gcd(i,j);
                    t=__gcd(t,k);
                    ans+=t;
                }
            }
        }
        cout<<ans;
 
 
        return 0;
    }

Measured memory_bytes: 3616
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
#include<map>
#include<set>
#include<utility>
#include<tuple>
using namespace std;
#define ull unsigned long long
#define llong long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()

vector<vector<int>> WarshallFloyd(int n, vector<vector<int>>initializedMatrix) {
	auto w = initializedMatrix;
	rep(k, n) {
		rep(i, n) {
			rep(j, n) {
				w[i][j] = min(w[i][j], w[i][k] + w[k][j]);
			}
		}
	}
	return w;
}
int main() {
	int h, w;
	cin >> h >> w;
	int n = 10;
	vector<vector<int>>c(n, vector<int>(n, 0));
	vector<vector<int>>a(h, vector<int>(w, 0));
	rep(i, n) rep(j, n) cin >> c[i][j];
	rep(i, h)rep(j, w) cin >> a[i][j];
	auto dist = WarshallFloyd(n, c);
	llong sum = 0;
	rep(i, h)rep(j, w) {
		if(a[i][j]!=-1) sum += dist[a[i][j]][1];
	}
	cout << sum << endl;
	return 0;
}





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

int main() {
	int a, b, c = 0;
	cin >> a;
	cin >> b;
	if (b < a) {
		int temp = b;
		b = a;
		a = temp;
	}
	for (int i = 0; i < b; ++i) {
		c *= 10;
		c += a;
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll  long long
#define ull unsigned long long  
using namespace std;
#define  inf 1e18+18
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod 1000000007
#define  f1(i,n) for(i=1;i<=n;i++)
#define f0(i,n)  for(i=0;i<n;i++)
#define w(x)   while(x--)
const int maxn=500001;
#define  pq priority_queue
#define  ff first
#define  ss second 
#define pb  push_back
#define lb lower_bound
int db(int n)
{
    int i=0;
    int j=0;
    while(n>0)
    {
        int r=n%10;
        n=n/10;
        j+=(1<<i)*r;
        i++;
    }
    return j;
}
int main()
{
   
    
   
    ll i,j,k,r,b;
    string s;
    cin>>s;
    int n=s.size();
    if(s[n-1]=='s')
    {
        cout<<s.substr(0,n)+"es"<<"\n";
    }
    else
        cout<<s.substr(0,n)+"s";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int arr[100000][101]; // arr[i][j]: 位置iから10^j回移動した先

int main(void){
	string S;
	cin >> S;
	int N = (int)S.size();

	for(int i = 0; i < N; i++){
		arr[i][0] = (S[i] == 'L' ? i - 1 : i + 1);
	}
	for(int i = 1; i <= 100; i++){
		for(int j = 0; j < N; j++){
			int pos = j;
			for(int k = 0; k < 10; k++){
				pos = arr[pos][i-1];
			}
			arr[j][i+1] = pos;
		}
	}

	vector<int> res(N, 0);
	for(int i = 0; i < N; i++){
		res[arr[i][100]]++;
	}

	for(int i = 0; i < N; i++) cout << res[i] << (i == N-1 ? '\n' : ' ');

	return 0;
}

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

typedef struct {
	int L;
	int R;
}pair;

int compair(const void *a, const void *b){
	int sub = ((pair *)a)->L - ((pair *)b)->L;
	if(sub != 0){
		return sub;
	}
	else{
		return ((pair *)a)->R - ((pair *)b)->R;
	}
}

int main(){
	int N, M, Q, p, q, i, j, k;
	scanf("%d%d%d", &N, &M, &Q);
	pair *ps = (pair *)malloc(sizeof(pair) * M);
	for(i = 0; i < M; i++){
		scanf("%d%d", &ps[i].L, &ps[i].R);
	}
	qsort(ps, M, sizeof(pair), compair);
	int **sum = (int **)malloc(sizeof(int *) * (N + 1));
	for(i = 0; i <= N; i++){
		sum[i] = (int *)malloc(sizeof(int) * (N + 1));
		for(j = 0; j <= N; j++){
			sum[i][j] = 0;
		}
	}
	for(i = N - 1, j = M - 1; i >= 0; i--){
		while(j >= 0){
			if(ps[j].L - 1 < i){
				break;
			}
			sum[i][ps[j].R]++;
			j--;
		}
		for(k = 1; k <= N; k++){
			sum[i][k] += sum[i][k - 1];
		}
		for(k = 1; k <= N; k++){
			sum[i][k] += sum[i + 1][k];
		}
	}
/*	for(i = 0; i < N; i++){
		for(j = 0; j <= N; j++){
			printf("%d ", sum[i][j]);
		}
		printf("\n");
	}
*/	for(i = 0; i < Q; i++){
		scanf("%d%d", &p, &q);
		printf("%d\n", sum[p - 1][q]);
	}
	return 0;
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

signed main() {
    
    string s;
    cin >>s;
    rep(i, s.length()){
        if(s[i]==',') cout << " ";
        else cout << s[i];
    }
    cout << endl;
    return 0;
}


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

const int INF = 1001001001;
int dist[105][105];
struct edge{
    int from, to, cost;
};
vector<edge> es;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, m;
    cin >> n >> m;
    fill((int*)dist, (int*)(dist + n), INF);
    for(int i = 0; i < n; ++i){
        dist[i][i] = 0;
    }
    for(int i = 0; i < m; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        --a;
        --b;
        dist[a][b] = c;
        dist[b][a] = c;
        es.push_back((edge){a, b, c});
    }
    
    for(int k = 0; k < n; ++k){
        for(int i = 0; i < n; ++i){
            for(int j = 0; j < n; ++j){
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    
    int ans = 0;
    for(int i = 0; i < m; ++i){
        edge &e = es[i];
        
        bool used = false;
        for(int s = 0; s < n; ++s){
            if(dist[s][e.from] + e.cost == dist[s][e.to]){
                used = true;
                break;
            }
        }
        
        if(!used)   ++ans;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

#define TRACE(x) std::cout << #x << " = " << x << "\n"
#define _ << " _ " <<

using namespace std;

int main() {
  std::ios_base::sync_with_stdio(false);
  int N;
  string T;
  cin >> N >> T;

  vector<int> next = {0, 2, 1};
  vector<int> pw(N + 1);
  pw[0] = 1;
  for (int i = 1; i <= N; ++i) pw[i] = pw[i - 1] * 3;
  int M = pw[N];

  vector<vector<int>> f(N), sw(N);
  for (int i = 0; i < N; ++i) {
    f[i].resize(pw[i + 1]);
    sw[i].resize(pw[i + 1]);
    for (int j = 0; j < pw[i + 1]; ++j) {
      f[i][j] = j / pw[i];
    }
  }

  int swapsCnt = 0;
  for (char c : T) {
    if (c == 'S') {
      swapsCnt ^= 1;
    } else {
      int suf = 0;
      for (int k = 0; k < N; ++k) {
        int v = -1;
        for (int d = 0; d < 3; ++d) {
          int x = pw[k] * d + suf;
          if (sw[k][x] != swapsCnt) {
            f[k][x] = next[f[k][x]];
            sw[k][x] ^= 1;
          }
          f[k][x]++;
          if (f[k][x] == 3) {
            f[k][x] = 0;
            v = d;
          }
        }
        assert(v != -1);
        suf += pw[k] * v;
      }
    }
  }

  for (int x = 0; x < M; ++x) {
    int ans = 0, c = x;
    for (int k = N - 1; k >= 0; --k) {
      if (sw[k][c] != swapsCnt) {
        f[k][c] = next[f[k][c]];
        sw[k][c] ^= 1;
      }
      ans += pw[k] * f[k][c];
      c %= pw[k];
    }
    cout << ans << ' ';
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 10420
N, K=map(int,input().split())
S = str(input())

# count sequence man and memo the cnt in group
man_groups = []
same_cnt = 0
last_man = ""
for i in range(N):
    cur_man = S[i]
    if cur_man != last_man:
        if same_cnt > 0:
            if last_man == "0":
                same_cnt *= -1
            man_groups.append(same_cnt)
        same_cnt = 1
    else:
        same_cnt += 1
    last_man = cur_man
if same_cnt > 0:
    if last_man == "0":
        same_cnt *= -1
    man_groups.append(same_cnt)

# count max from evey
sum_list = []
end_pos = 2 * K if man_groups[0] > 0 else 2 * K - 1
end_pos = min(end_pos, len(man_groups) - 1)
last_max = sum(map(abs, man_groups[0: end_pos + 1]))
sum_list.append(last_max)
for i in range(1, len(man_groups)):
    if end_pos >= len(man_groups) - 1:
        break
    last_max -= abs(man_groups[i - 1])
    if man_groups[i] > 0:
        next_end_pos = min(end_pos + 2, len(man_groups) - 1)
        man_groups_to_add = man_groups[end_pos + 1: next_end_pos + 1]
        last_max += sum(map(abs, man_groups_to_add))
        end_pos = next_end_pos
    sum_list.append(last_max)

#print(sum_list)
#print(sum_list)
print(max(sum_list))







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

bool isPrime(int x); 
int gcd(int a, int b); 
vector<int> primeFactorization(int x); 
void printVector(vector<long> list, string str); 
void setPrecision(int n);

int hoge(int count, int num, int div) {
  if (num == 0) return count;

  return hoge(count+1, num/div, div);
}

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  if (a == b && a != c) {
    cout << "Yes" << endl;
  } else if (b == c && b != a) {
    cout << "Yes" << endl;
  }  else if (c == a && c != b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

bool isPrime(int x) {
  if (x < 2) return false;
  if (x == 2) return true;
  if (x % 2 == 0) return false;

  double num = sqrt(x);
  for (int i = 3; i <= num; i+=2) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}

// 素因数分解
// example: primeFactorization(12) = vector<int>{2, 2, 3}
vector<int> primeFactorization(int x) {
  vector<int> ans;
  int i = 2;
  while (i*i <= x) {
    if (x % i == 0) {
      ans.push_back(i);
      x /= i;
    } else {
      i++;
    }
  }
  ans.push_back(x);
  return ans;
}

void printVector(vector<long> list, string str) {
  for (int i = 0; i < list.size(); i++) {
    cout << str << ": " << list[i] << endl;
  }
}

void setPrecision(int n) {
  cout << fixed << setprecision(n);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
  vector<int> giri(n);
  for(int i=0;i<n;i++){
    cin>>giri[i];
  }
  vector<int> dp(n+1,INT_MAX);
  dp[0]=0;
  dp[1]=abs(giri[1]-giri[0]);
  for(int i=2;i<=n;i++){
 dp[i]=min(dp[i-2]+(abs(giri[i-2]-giri[i])) ,dp[i-1]+abs(giri[i-1]-giri[i]));
           }
           cout<<dp[n-1];
           return 0;
           }
  

Measured memory_bytes: 3944
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
    var x = chunk.toString().split(' ');
    var a = Number(x[0]);
    var b = Number(x[1]);
    var c = Number(x[2]);
    if (a > b){
        t = a;
        a = b;
        b = t;
    }
    if (b > c){
        t = b;
        b = c;
        c = t;
    }
    if (a > b){
        t = a;
        a = b;
        b = t;
    }
    console.log(a + " " + b + " " + c);
});

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    //lol result{0};
    string n; cin >> n;
    //lol k; cin >> k;
    /*
    vector<lol> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    */
    if(n[2] == n[3] && n[4] == n[5])
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    

    return 0;
}

Measured memory_bytes: 3540
#include<iostream>
#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i = l;i < r;i++)
#define de(x) cout<<#x<<" = "<<x<<endl
int main()
{
	int n,y;
	cin>>n>>y;
	rep(i,0,y/10000 + 1){
		if(i * 10000 > y || i > n) break;
		rep(j,0,y/5000 + 1){
			if(i*10000 + j*5000 > y || i + j > n) break;
			rep(k,0,y /1000 + 1)
			if(i*10000 + j*5000 + k * 1000 > y || i + j + k > n) break;
			else if(i*10000 + j*5000 + k*1000 == y && i+j+k == n)
			return 0*printf("%d %d %d",i,j,k);
		}
	} 
	cout<<"-1 -1 -1";
	return 0;
} 

Measured memory_bytes: 384