akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  ll n;
  cin>> n ;
  if(n%2 ==0){
    cout<<n<<endl;
  }
  else{
    cout<<2*n<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>
#include<cmath>
#include<queue>
#include <functional>

using namespace std;

int main() {

	string S;
	cin >> S;

	string result = "";
	if (S == "Sunny") { result = "Cloudy"; }
	if (S == "Cloudy") { result = "Rainy"; }
	if (S == "Rainy") { result = "Sunny"; }

	cout << result;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define VEC(kata, num) (kata*)calloc(num, sizeof(kata))
#define DB puts("ok")
#define SENTINEL 1000000007
typedef long long lli;

// 降順
int cmp(const void *a, const void *b) {
    return *(int*)b - *(int*)a;
}

int main()
{
    int i, n, a=0, b=0;
    char s[100000];
    scanf("%s",s);
    n = strlen(s);
    for(i=0; i<n; i++) {
        if(s[i] == '0') {
            a++;
        } else {
            b++;
        }
    }
    printf("%d", 2*MIN(a,b));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
using namespace std; 
int lst[100005], to[200005], pre[200005], tot; 
bool ok[100005]; 
inline void add_edge(int u, int v)
{
	to[tot] = v; 
	pre[tot] = lst[u]; 
	lst[u] = tot++; 
}
void dfs(int u, int fa = -1)
{
	for (int i = lst[u]; ~i; i = pre[i])
	{
		if (to[i] == fa)
			continue; 
		dfs(to[i], u); 
		if (!ok[to[i]])
		{
			if (ok[u])
			{
				puts("First"); 
				exit(0);
			}
			ok[to[i]] = true; 
			ok[u] = true; 
		}
	}
}
int main()
{
	memset(lst, -1, sizeof(lst)); 
	int n; 
	scanf("%d", &n); 
	for (int i = 1; i < n; i++)
	{
		int u, v; 
		scanf("%d%d", &u, &v); 
		add_edge(--u, --v); 
		add_edge(v, u); 
	}
	dfs(0); 
	puts(ok[0] ? "Second" : "First"); 
	return 0; 
}


Measured memory_bytes: 2304
#include<stdio.h>
int main(){
    int h,w;
    while(1){
        scanf("%d %d", &h, &w);
        if(h==0 && w==0)    break;
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2584
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define ET cout << "\n"
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#ifdef bbq
#define debug(...) {\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}
#define DB(a,s,e) {for(int _i=s;_i<e;++_i) cerr << a[_i] << " ";cerr << "\n";}
template<typename T>void _do(T &&x){cerr<<x<<endl;}
template<typename T,typename ...S> void _do(T &&x,S &&...t){cerr<<x<<", ";_do(t...);}
template<typename a,typename b> ostream& operator << (ostream &s,const pair<a,b> &p){return s<<"("<<p.X<<","<<p.Y<<")";}
#else
#define debug(...)
#define DB(a,s,e)
#endif

const int INF=1e9;
int arr[500005],pl[500005],ans[500005],seg[2000005],lazy[2000005],bit[500005],bg[500005],n;

void bit_modify(int x,int v)
{
    for(;x<=n;x+=x&-x)
        bit[x]+=v;
}

int bit_query(int x)
{
    int rt=0;
    for(;x;x-=x&-x)
        rt+=bit[x];
    return rt;
}

void build(int l,int r,int rt)
{
    if(l==r)
        return seg[rt]=bg[l],void();
    int m=l+r>>1;
    build(l,m,rt<<1),build(m+1,r,rt<<1|1);
    seg[rt]=min(seg[rt<<1],seg[rt<<1|1]);
}

#define lch (seg[rt<<1]+lazy[rt<<1])
#define rch (seg[rt<<1|1]+lazy[rt<<1|1])

void modify(int L,int R,int l,int r,int rt,int v)
{
    if(L<=l&&R>=r) 
        return lazy[rt]+=v,void();
    int m=l+r>>1;
    if(L<=m) modify(L,R,l,m,rt<<1,v);
    if(R>m) modify(L,R,m+1,r,rt<<1|1,v);
    if(lch<0) seg[rt]=rch;
    else if(rch<0) seg[rt]=lch;
    else seg[rt]=min(lch,rch);
}

int query(int l,int r,int rt,int d)
{
    d+=lazy[rt];
    if(l==r) return l;
    int m=l+r>>1;
    if(d+rch==0) return query(m+1,r,rt<<1|1,d);
    return query(l,m,rt<<1,d);
}

int main()
{
    IOS();
    int k;
    cin >> n >> k;
    for(int i=1;i<=n;++i)
        cin >> arr[i],pl[arr[i]]=i;
    for(int i=n;i>=1;--i)
        bg[pl[i]]=bit_query(min(n,pl[i]+k-1))-bit_query(max(0,pl[i]-k)),bit_modify(pl[i],1);
    build(1,n,1);
    for(int i=n;i>=1;--i)
    {
        int x=query(1,n,1,0);
        ans[x]=i,modify(x,x,1,n,1,-INF),modify(max(0,x-k+1),min(n,x+k-1),1,n,1,-1);
    }
    for(int i=1;i<=n;++i)
        cout << ans[i] << "\n";
}

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

int main()
{
    int64_t
    A, B, N;
    cin >> A >> B >> N;

    // int judge = 0;
    int64_t x = 0;
    int64_t l,m,y;

    // cout << "x = 9" << endl;
    // cout << "l = " << (A*x)/B << endl;
    // cout << "m = " << x/B << endl;
    if (N == B) {
        x = N -1;
    } else if (N > B) {
        x= B - 1;
    } else {
        x= N;
    }
    l = (A*x)/B;
    m = x/B;
    y = l - A * m;
    cout << y << endl;

    // x = 999999;
    // l = (A*x)/B;
    // m = x/B;
    // y = l - A * m;
    // cout << y << endl;
    // cout << "y = " << l - A * m << endl << endl;

    
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
#define N 210
#define mo 1000000007
#define X 100010
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
int n,x,a[N],g[X],dp[N][X],ansn;
void add(int &x,int y){x+=y;if (x>=mo) x-=mo;}
int main(){
	read(n);read(x);
	for (int i=1;i<=n;i++) read(a[i]);
	sort(a+1,a+n+1);
	g[0]=0;
	for (int j=1;j<=x;j++){
		g[j]=g[j-1];
		while (j>=a[g[j]+1]&&g[j]+1<=n) g[j]++;
	}
	dp[0][x]=1;
	for (int i=0;i<n;i++){
		for (int j=0;j<=x;j++){
			if (dp[i][j]){
				for (int k=1;k<=g[j];k++)add(dp[i+1][j%a[k]],dp[i][j]);
				add(dp[i+1][j],1ll*dp[i][j]*(n-g[j]-i)%mo);
			}
		}
	}
	for (int j=0;j<=x;j++) add(ansn,1ll*dp[n][j]*j%mo);
	cout<<ansn<<endl;
	return 0;
}

Measured memory_bytes: 79232
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
typedef long long ll;
typedef std::vector<int> vi;

using namespace std;

inline int nxt(){int x;cin>>x;return x;}


int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n=nxt();
    vi a(n);
    rep(i,0,n-1)a[i]=nxt();
    int ans=0;
    rep(i,0,n-1) rep(j,i+1,n-1) ans+=a[i]*a[j];
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> v(2*n);
    for(auto& i : v){
        cin >> i;
    }
    sort(all(v));
    int ans = 0;
    for(int i=0; i<2*n; i+=2){
        ans += v[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        if (a%2==0||b%2==0){
            System.out.println("Even");
        }else{
            System.out.println("Odd");
        }
    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
typedef pair<double,string> pd;
#define MK make_pair

int main(){
  while(1){


    
  int n;
  cin>>n;
  if(n==0){break;}
  vector<pd> p;
  for(int i=0;i<n;i++){
    string name;
    int g,a,b,c,d,e,f,s,t;
    cin>>name>>g>>a>>b>>c>>d>>e>>f>>s>>t;
    int grow=0,time=0,gold=0;
    grow+=a+b+c;
    time+=d+e;
    gold+=f*s;
    double mx=(double)(gold-g)/(grow+time);
    mx=max(mx,(double)(gold*t-g)/(grow+time*t));
    p.push_back(MK(mx,name));
  }
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  for(int i=0;i<p.size();i++){
    int t=1;
    while(p[i].first==p[i+t].first){
      if(t+i==p.size()){break;}
      t++;
    }
    sort(p.begin()+i,p.begin()+i+t);
  }

  
  for(int i=0;i<p.size();i++){
    cout<<p[i].second<<endl;
  }
  cout<<"#"<<endl;


  }
  
  
  return 0;
}
  
  



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

#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n)  for(int i=0;i<n;i++)

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   string s,t;
   cin>>s>>t;
   int n=(int)s.length(),ans=0;
   for(int i=0;i<n;i++)
   {
	   if(s[i]!=t[i])
	   ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3832
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,z,w,pok[2001];
    scanf("%d%d%d",&n,&z,&w);
    for(int i=0;i<n;i++){
        scanf("%d",&pok[i]);
    }
    if(n==1){
        printf("%d\n",abs(pok[n-1]-w));
    }else{
        printf("%d\n",max(abs(pok[n-1]-pok[n-2]),abs(pok[n-1]-w)));
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<long long> con(N, 0);
    vector<long long> sam(N,0);
    vector<long long> ke(N+1,0);
    vector<bool> ch(N, false);
    for (long long i = 1; i <= N;i++){
        ke[i] = i * (i - 1) / 2;
    }
    for (int i = 0; i < N;i++){
        cin >> sam[i];
        con[sam[i]]++;
    }
    long long ans = 0;
    for (int i = 0; i < N;i++){
        if(ch[sam[i]] == false){
            ans += ke[con[sam[i]]];
            ch[sam[i]] = true;
        }
    }

    for (int i = 0; i < N; i++)
    {
        if(ke[con[sam[i]]] > 0)
            cout << ans - (ke[con[sam[i]]] - ke[con[sam[i]] - 1]) << endl;
        else
            cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 7296
n,m=map(int,input().split())
pf=[]
for i in range(1,int(m**0.5)+1):
    if m%i==0:
        pf.append(i);pf.append(m//i)
pf.sort(reverse=True)
ans=100000000
for i in pf:
  if i>=n:
    ans=i
print(m//ans)

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

using namespace std;

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


int n;
string s;
int a[100010];


void solve() {
	for (int i = 0; i < n; i++) {
		if (a[i] == 0) {
			cout << 'S';
		} else {
			cout << 'W';
		}
	}
	cout << endl;
}

bool judge(int a, char c, int x, int y) {
	if (a == 0 && c == 'o' && x == y) {
		return true;
	} else if (a == 0 && c == 'x' && x != y) {
		return true;
	} else if (a == 1 && c == 'o' && x != y) {
		return true;
	} else if (a == 1 && c == 'x' && x == y) {
		return true;
	} else {
		return false;
	}
}


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

	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 2; j++) {
			a[0] = i;
			a[1] = j;
			for (int k = 2; k < n; k++) {
				if (a[k - 1] == 0 && s[k - 1] =='o') {
					a[k] = a[k - 2];
				}else if (a[k - 1] == 0 && s[k - 1] =='x') {
					a[k] = a[k - 2] ^ 1;
				}else if (a[k - 1] == 1 && s[k - 1] == 'o') {
					a[k] = a[k - 2] ^ 1;
				}else if (a[k - 1] == 1 && s[k - 1] == 'x'){
					a[k] = a[k - 2];
				}
			}

			if (judge(a[0], s[0], a[1], a[n - 1]) && judge(a[n- 1], s[n - 1], a[n - 2], a[0])) {
				solve();
				return 0;
			}
		}
	}
	
	cout << -1 << endl;
	
	
	return 0;
}

Measured memory_bytes: 896
// Vicfred
// https://atcoder.jp/contests/abc161/tasks/abc161_a
// simulation
import std.algorithm;
import std.stdio;

void main() {
    int a, b, c;
    readf("%s %s %s\n", &a, &b, &c);
    swap(a,b);
    swap(a,c);
    writefln("%s %s %s", a, b, c);
}



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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int x;
    cin >> x;
    if(x < 1200) {

    cout << "ABC";
    } else {
    cout << "ARC";

    }
    return 0;
}   
/** atcoder **/


Measured memory_bytes: 256
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    K=I()
    S=input()
    N=len(S)
    
    def cmb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return (fact[n] * factinv[r] * factinv[n-r])%mod

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]
    
    for i in range(2, N+K+2 + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)
    
    #Sの条件を初めて満たした時の末端いちで場合分け
    
    #i文字目が末端で，自由枠がj個（iが決まればjも決まるけど，まとめやすいので）
    def calc(i,j):
        temp=pow(26,K-j,mod)#残りの完全自由枠
        temp=(temp*pow(25,j,mod)*cmb(i-1,j,mod))%mod
        return temp
    
    ans=0
    for j in range(K+1):
        i=j+N
        ans=(ans+calc(i,j))%mod
        
    print(ans)


main()


Measured memory_bytes: 226964
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repi(i,x,n) for(ll i=x;i<(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 10000000000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};

ll BF(ll s,vector<vector<PL>>& v ,ll V){
  vector<ll> d(V,INF);
  d[s]=0;
  ll cnt=0,pofv;
  bool update=false;

  while(1){
    update=false;
    for(int i=0;i < V;i++)
    {
      for(int j=0;j < siz(v[i]);j++)
      {
        if(d[i] != INF && d[v[i][j].fi]> d[i]+v[i][j].se){
          update=true;
          d[v[i][j].fi]=d[i]+v[i][j].se;
        }
      }
    }
    
    if(!update)break;
    cnt++;

    if(V-1==cnt){
      pofv=d[V-1];
    }else if(2*V==cnt){
      if(d[V-1]!=pofv){
          
        return INF;
      }else{
        return d[V-1];
      }
    }
  }
  return d[V-1];
}

ll n,m,p,ans;
vector<vector<PL>> v(2510,vector<PL>(0));

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

    cin>>n>>m>>p;
    
    ll a,b,c;
    rep(i,m){
        cin>>a>>b>>c;
        a--;b--;
        v.at(a).pb({b,-(c-p)});
    }

    ans=BF(0,v,n);

    if(ans==INF){
        cout<<-1<<endl;
    }else{
        cout<<max(-ans,0ll)<<endl;
    }
}


Measured memory_bytes: 512
s = input()
ans = [-1,-1]
len_s = len(s)
for i in range(len_s-2):
    if s[i] == s[i+1]:
        ans = [i+1,i+2]
    if s[i] == s[i+2]:
        ans =[i+1,i+3]
if s[-1] == s[-2]:
    ans = [len_s -1,len_s]
print(ans[0],ans[1])

Measured memory_bytes: 3316
import java.util.Scanner;

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

        int a[][]=new int[n+1][m+1];
        int b[][]=new int[m+1][l+1];
       
        long sum=0;
     
        for(int i=1;i<=n;i++)
         for(int j=1;j<=m;j++)
          a[i][j]=sc.nextInt();
        
        for(int i=1;i<=m;i++)
         for(int j=1;j<=l;j++)
          b[i][j]=sc.nextInt();
        
        for(int i=1;i<=n;i++) {
         for(int j=1;j<=l-1;j++) {
          for(int k=1;k<=m;k++)
          sum+=a[i][k]*b[k][j];
         System.out.print(sum+" ");
         sum=0;
         }
         for(int k=1;k<=m;k++)
          sum+=a[i][k]*b[k][l];
         System.out.print(sum);
         sum=0;
         System.out.print("\n");
        }
  }
  
}


Measured memory_bytes: 55268
using System;
using System.Collections.Generic;
class Program
    {
    	static void Main(string[] args)
    	{
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]), d = int.Parse(s[1]);

            int ans = n / (2 * d + 1);
            if (n % (2 * d + 1) != 0) ans++;
            Console.WriteLine(ans);

            
            
        }
    }
    //mcs Main.cs
    //mono Main.exe

Measured memory_bytes: 11092
import java.util.Scanner;

class Main{


	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);

		int[] data = new int[scan.nextInt()*2];
		int known = scan.nextInt();

		for(int i=0;i<data.length;i++){
			data[i]=i+1;	
		}

		boolean rihul =false;

		int count=0;

		while(count<known){
			int key = scan.nextInt();		

			if(key==0){
				key=data.length/2;	
				rihul = true;
			}

			int[] a = new int[key];
			int[] b = new int[data.length-key];

			for(int i=0;i<key;i++){
				a[i]=data[i];
			}
			for(int i=key;i<data.length;i++){
				b[i-key]=data[i];
			}

			if(rihul){
				for(int i=0;i<data.length;i++){
					if(i%2==0){
						data[i]=a[i/2];
					}
					else{
						data[i]=b[i/2];
					}
				}


				rihul=false;
			}
			else{
				for(int i=0;i<b.length;i++){
					data[i]=b[i];
				}
				for(int i=0;i<a.length;i++){
					data[i+b.length] = a[i];
				}


			}

			count++;
		}
		for(int i=0;i<data.length;i++){
			System.out.println(data[i]);
		}
	}			

}

Measured memory_bytes: 26072
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::prelude::*;
use std::mem::*;
use std::num::*;
use std::slice::*;

const MOD: isize = 1_000_000_007;

fn main() {
    let s : String = rd();
    let s : Vec<char> =s.chars().collect();
    for &i in s.iter() {
        if (i == ',') {
            print!(" ");
        }
        else {print!("{}",i);}
    }
    println!();
}
fn rd<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let next: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    next.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
string s, t, u;
int a, b;

int main() {
	cin >> s >> t >> a >> b >> u;
	if(s == u) a--;
	else if(t == u) b--;
	printf("%d %d\n", a, b);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<string>
#define rep(i,N) for(int i = 0; i<N,i++)
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

llong gcd(llong a, llong b) {
	if (a < b) 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, K;
llong V[100];
llong ans;

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

	bool flag = true;

	for (int i = 0; i <= K; i++) {
		for (int j = -( (-i) / 2); j <= i && j <= N; j++) {
			for (int k = 0; k <= j; k++) {

				llong motimono[100];

				int l;

				for (l = 0; l < k; l++) {
					motimono[l] = V[l];
				}

				for (; l < j; l++) {
					motimono[l] = V[N - 1 - l + k];
				}

				sort(motimono, motimono + j, greater<llong>());

				llong SUM = 0;

				for (int m = 0; m < 2 * j - i; m++) {
					SUM += motimono[m];
				}

				if (flag) {
					ans = SUM;
					flag = false;
				}
				else ans = max(ans, SUM);
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, m; cin >> n >> m;
  vector<int> x(m); for(int & i : x) cin >> i;
  sort(x.begin(), x.end());
  set<pair<int,int> > mx;
  for(int i = 0; i < m; i++){
    if(i) mx.insert({x[i] - x[i - 1], i});
  }
  long long ans = 0;
  for(int i = 0; i < m - n; i++){
    auto it = mx.begin();
    ans += it->first;
    mx.erase(it);
  }
  cout << ans << endl;
  return 0;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    vi a(3*n);
    rep(i, 3*n) cin >> a[i];
    vi b(n);
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    ll ans = 0;
    for (int i=1; i<2*n; i+=2) ans += a[i];
    cout << ans << endl;
    return 0;
}


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

int ans;
int gcd(int x, int y) {
	if (x < y) swap(x, y);
	while (y) {
		x %= y;
		swap(x, y);
	}
	return x;
}

int main() {
	int k;
	cin >> k;
	for (int i = 1; i <= k; i++) {
		for (int j = 1; j <= k; j++) {
			for (int p = 1; p <= k; p++) {
				ans += gcd(gcd(i, j), p);
			}
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 3636
# -*- coding: utf-8 -*-

def solve():
    N = int(input())
    if N == 1:
        res = 'Yes'
    else:
        H = tuple(map(int, input().split()))
        h_, flag = H[0], False
        for h in H[1:]:
            if h < h_-1:
                res = 'No'
                break
            elif h == h_ -1:
                if flag:
                    res = 'No'
                    break
                else:
                    h_ = h
                    flag = True
            elif h == h_:
                pass
            elif h > h_-1:
                h_ = h
                flag = False
        else:
            res = 'Yes'

    return str(res)

if __name__ == '__main__':
    print(solve())

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

typedef long long ll;

int main() {
	 int n;
	 cin >> n;
	 int sum = 0;
	 int p = n;
	 while (p > 0) {
		sum += p % 10;
		p = p / 10; 
	 }
	 if (n % sum == 0) {
		 cout << "Yes";
	 }else {
		 cout << "No";
	 }
}


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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  long double a, b;
  cin >> a >> b;
  long double c=a;
  long double d=b;
  if (c == d) {
    cout << "EQUAL" << endl;
  } else if (c > d) {
    cout << "GREATER" << endl;
  } else if (c < d) {
    cout << "LESS" << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define mod 1000000007
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inp_vecN for(int i=0;i<n;i++)cin>>v[i]; 
vector<int> get_Factors(ll n)
{
      vector <int> v;
      for(ll i=1; i<=sqrt(n)+1; i++)
      {
            if(n%i==0)
            {
                  v.push_back(i);
                  v.push_back(n/i);
            }
      }

      return v;
}
string get_bin(ll n)
{
    string s = "";
    while(n > 0)
    {
        s += ('0' + n%2);
        n /= 2;
    }
    reverse(s.begin(), s.end());
    return s;
}

ll bin_to_dec(string s)
{
    ll ans = 0;
    for(auto ch: s)
    {
        ans *= 2;
        ans += (ch - '0');
    }
    return ans;
}
void PrintVector(vector<int> v,int n)
{

    for(int i=0;i<n;i++)
    {
        cout<<v[i]<<" ";
    }
    cout<<endl;
}
int no_of_primeFactors(int n)  
{ 
    int count=0;
    while (n % 2 == 0)  
    {  
        count++;
        n = n/2;  
    }  
   
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    { 
        while (n % i == 0)  
        {  
           count++;
            n = n/i;  
        }  
        
    }  
    if (n > 2)  
        count++;
    return count;
} 
 ll gcd(int a, int b)
{ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
} 
   
  ll lcm(int a, int b)  
{  
    return (a/gcd(a, b)*b);  
}  



ll pwr(ll base,ll expo,ll m)
{
    if(base==0) return 0LL;
    if(expo==0) return (1LL%m);
    if((expo&1)==0) {ll temp=pwr(base,expo>>1,m); return (temp*temp)%m;}
    return ((base%m)*pwr(base,expo-1,m))%m;
}

int main(int argc, char const *argv[])
{
    ios;
    
    int a,b;
    cin>>a>>b;
    

    int min=2*a;
    int max=4*a;


    if(b%2==0 && min<=b && max>=b)
    {
      cout<<"Yes";
    }
    else
      cout<<"No";


    return 0;
}

Measured memory_bytes: 3668
import queue
N=int(input())
G=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
q=queue.Queue()
P=[-1 for i in range(N)]
dist=[-1 for i in range(N)]
q.put(0)
#print(G)
dist[0]=0
while(not(q.empty())):
    r=q.get()
    for p in G[r]:
        if dist[p]==-1:
            q.put(p)
            dist[p]=dist[r]+1
            P[p]=r
#print(dist)
S=dist[-1]
#print(P)
L=[];k=N-1
while(k!=-1):
    L.append(k)
    k=P[k]
#fennec:1
#snuke:-1
c=[0 for i in range(N)]
for p in L:
    snuke=dist[p]
    fennec=S-dist[p]
    if fennec>=snuke:
        c[p]=1
    else:
        c[p]=-1
#print(c)
q=queue.Queue()
q.put(0)
reached=[0 for i in range(N)]
reached[0]=1
while(not(q.empty())):
    r=q.get()
    for p in G[r]:
        if reached[p]==0:
            if c[p]!=-1:
                q.put(p)
                c[p]=1
                reached[p]=1
for i in range(N):
    if c[i]==0:
        c[i]=-1
if sum(c)>0:
    print("Fennec")
else:
    print("Snuke")


Measured memory_bytes: 29236
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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 main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    string s, t;
    cin >> s >> t;

    string ans;
    REP(i, N) {
        ans.push_back(s[i]);
        ans.push_back(t[i]);
    }

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
	
	Scanner sc = new Scanner (System.in);
	
	int x = sc.nextInt();
	int y = sc.nextInt();
	
	while(!(x == 0 && y == 0)){
		if( x <  y){
			System.out.println(x + " " + y);
		} else {
			System.out.println(y + " "+ x);
		}
		x = sc.nextInt();
		y = sc.nextInt();
	}
	sc.close();
	}
}


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

int main(){
    int A,B; cin >> A >> B;
    int ans=-1;
    for(int i=1; i<1010; i++){
        if(floor(i*0.08)==A && floor(i*0.1)==B){
            ans=i;
            break;
        }
    }
    cout << ans << endl;
}


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

int main(){
  float A,B,H,M;
  cin >> A >> B >> H >> M;
  
  float angle;
  float HtoM = H*60;
  float angleH = (HtoM + M) * 0.5;
  float angleM = M*6;
  
  float diff = abs(angleH - angleM);

  if(diff > 180){
	angle = 360 - diff;  
  }else{
  	angle = diff;
  }
  cout << fixed << setprecision(9) << sqrt(pow(A,2) + pow(B,2) - 2*A*B*cos(M_PI*angle/180)) << endl;
}

Measured memory_bytes: 4136
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    int solve(vector<int>& A, int K) {
        const long long MOD = 1e9 + 7;

        auto norm = [&](long long a) {
            a %= MOD;
            if (a < 0) {
                a += MOD;
            }
            return a;
        };

        auto inverse = [&](long long a) {
            long long b = MOD;
            long long u = 0, v = 1;
            a = norm(a);
            while (a != 0) {
                long long d = b / a;
                b -= d * a;
                u -= d * v;
                swap(a, b);
                swap(u, v);
            }
            u = norm(u);
            return u;
        };

        int n = A.size();
        vector<long long> F(n + 1, 1);
        vector<long long> IF(n + 1, 1);

        for (int i = 2; i <= n; ++i) {
            F[i] = F[i - 1] * i % MOD;
        }
        IF[n] = inverse(F[n]);
        for (int i = n - 1; i > 0; --i) {
            IF[i] = IF[i + 1] * (i + 1) % MOD;
        }

        auto nCr = [&](int n, int r) {
            if (r < 0 || r > n) {
                return 0LL;
            }
            long long res = F[n] * IF[r] % MOD * IF[n - r] % MOD;
            return res;
        };

        
        sort(A.begin(), A.end());

        long long res = 0;
        for (int i = 0; i + K <= n; ++i) {
            long long cnt = nCr(n - i - 1, K - 1);
            long long v = A[i] * cnt % MOD;
            res -= v;
            res = norm(res);
        }
        for (int i = K - 1; i < n; ++i) {
            long long cnt = nCr(i, K - 1);
            long long v = A[i] * cnt % MOD;
            res += v;
            res = norm(res);
        }

        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }

    Solution sol;
    cout << sol.solve(A, k) << "\n";


    return 0;
}

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

using namespace std;

typedef long long ll;
#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  LCIN(N);
  ll ans = 1ll;
  REP(i, 101) {
    if (ans * 2 <= N) ans <<= 1;
    else break;
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

typedef long long ll;

int H, W;
char field[1000][1000];
ll dp[1000][1000];
ll MOD = 1000000007;

int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++)for (int j = 0; j < W; j++)cin >> field[i][j];
	dp[0][0] = 1;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (field[i][j] == '#')continue;
			if (i > 0)dp[i][j] += dp[i - 1][j];
			if (j > 0)dp[i][j] += dp[i][j - 1];
			dp[i][j] %= MOD;

		}
	}
	cout << dp[H - 1][W - 1] << endl;
	return 0;
}

Measured memory_bytes: 9088
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll a[2010];
ll cum[2010];
int main(){
	ll n;
	scanf("%lld",&n);
	a[0]=1;
	cum[0]=1;
	rep(i,3,n+1){
		a[i]=cum[i-3];
		cum[i]=(cum[i-1]+a[i])%MOD;
		//printf("%d %d %d\n",i,a[i],cum[i]);
	}
	printf("%lld",cum[n]);
}

Measured memory_bytes: 1764
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

const int M = 2e5 + 7;

int op[M];
vector<int> cl[M];

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

	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	for (auto &t : a) {
		cin >> t;
		t--;
	}
	auto add = [&](int l, int r) {
		assert(0 <= l && l < m);
		assert(0 <= r && r < m);
		if (l < r) {
			op[l]++;
			cl[r].push_back(l);
		} else {
			r += m;
			op[l]++;
			cl[r].push_back(l);
		}
	};
	int s = 0;
	for (int i = 0; i + 1 < n; i++) {
		add(a[i], a[i + 1]);
		s += (a[i + 1] - a[i] + m) % m;
	}
	vector<int> boost(m); 
	int ans = s;
	int sum_l = 0;
	int sz = 0;
	for (int i = 0; i <= 2 * m; i++) {
		boost[i % m] += (i * sz) - sum_l - sz;
		sum_l += i * op[i];
		sz += op[i];
		for (auto l : cl[i]) {
			sum_l -= l;
			sz--;
		}
	}
	cout << ans - *max_element(boost.begin(), boost.end()) << endl;
}


Measured memory_bytes: 10368
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool up_min(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool up_max(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_mdvector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_mdvector(int n, Ts ... ts){
        return vector<decltype(make_mdvector(ts...))>(n, make_mdvector(ts...));
    }

    inline ll bit(int x){
        return 1ll << x;
    }

    template<class T>
    istream& operator>>(istream& is, vector<T>& v){
        for (auto &&x : v) { is >> x; } return is;
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}
    ll N;
    void run();
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef XELMH
    string test_cases = "test_A.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


void solver::run(){
    int a, b;
    is >> a >> b;
    if(!is) return;
    if(a <= 9 and b <= 9){
        os << a * b << endl;
    }
    else{
        os << "-1\n";
    }
}


Measured memory_bytes: 256
use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();

    match s.trim() {
        "abc" | "acb" | "bac" | "bca" | "cab" | "cba" => println!("Yes"),
        _ => println!("No"),
    }
}

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

using namespace std;

#define FOR(i, s, e)   for(int i = (s); i < (e); i++)
#define FOR64(i, s, e) for(ll  i = (s); i < (e); i++)
#define ALL(x)         (x).begin(), (x).end()
#define SORT(b, e)     sort((b), (e))
#define REV(b, e)      reverse((b), (e))
#define VSORT(v)       sort((v).begin(), (v).end())
#define VREV(v)        reverse((v).begin(), (v).end())
#define pb(a)          push_back(a)
#define INF            999999999

typedef long long ll;

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

	if(N == 1){
		cout << P << endl;
		return 0;
	}

	ll res = 1;
	ll cur = P;
	for(ll k = 2; k * k <= P; k++){
		int cnt = 0;
		while(cur % k == 0){
			cur /= k;
			cnt++;
		}

		res *= pow(k, cnt / N);
	}

	cout << res << endl;

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define N 100001

char s[N];

int main() 
{
	int i, j, ti, tj, ans = 0, x, y;
	
	scanf("%s", s + 1);
	i = 0, j = strlen(s + 1) + 1;
	while(i < j){
		for(ti = i + 1; ti < j && s[ti] == 'x'; ti++);
		if(ti == j) break;
		for(tj = j - 1; s[tj] == 'x'; tj--);
		if(s[ti] != s[tj]){
			puts("-1");
			return 0;
		}
		x = ti - i, y = j - tj;
		if(y > x) ans += y - x;
		else ans += x - y;
		i = ti, j = tj;
	}
	printf("%d\n", ans);
			
	return 0;
}

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

#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define sz(v) ((int)(v).size())
#define fr(i, j, k) for(int i = j; i < k; i++)
#define nl "\n"
typedef pair<int, int> pii;
typedef vector <int> vi;

pii dir[8] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1} , {-1, 1}, {1, -1} };

const int inf = 1e18, mod = 1e9+7, nn = 2e5+5;

void solve(){
    int n; cin >> n;
    int a[n], z = 0, ans = 1;
    fr(i, 0, n) {
        cin >> a[i];
        if(a[i] == 0) z = 1;
    }
    if(z) {
        cout << 0;
        return;
    }

    fr(i, 0, n) {
        if(ans > inf/a[i]) {
            cout << -1;
            return;
        }
        ans = ans * a[i];
    }
    cout << ans;
}

int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 4472
def readinput():
    n,k=list(map(int,input().split()))
    r,s,p=list(map(int,input().split()))
    t=input()
    return n,k,r,s,p,t

def main(n,k,r,s,p,t):
    rireki=[]
    tokuten=0
    for i in range(n):
        c=t[i]
        if i<k:
            if(c=='r'):
                rireki.append('p')
                tokuten+=p
                #print('パー',tokuten)
            elif(c=='s'):
                rireki.append('r')
                tokuten+=r
                #print('グー',tokuten)
            elif(c=='p'):
                rireki.append('s')
                tokuten+=s
                #print('チョキ',tokuten)
        else:
            #print(rireki[i-k])
            if c=='r':
                if rireki[i-k]=='p':
                    rireki.append('x')
                    #print('パー以外',tokuten)
                else:
                    rireki.append('p')
                    tokuten+=p
                    #print('パー',tokuten)
            elif c=='s':
                if rireki[i-k]=='r':
                    rireki.append('x')
                    #print('グー以外',tokuten)
                else:
                    rireki.append('r')
                    tokuten+=r
                    #print('グー',tokuten)
            elif c=='p':
                if rireki[i-k]=='s':
                    rireki.append('x')
                    #print('チョキ以外',tokuten)
                else:
                    rireki.append('s')
                    tokuten+=s
                    #print('チョキ',tokuten)
        #print(rireki)
    return tokuten

if __name__=='__main__':
    n,k,r,s,p,t=readinput()
    ans=main(n,k,r,s,p,t)
    print(ans)



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

int main() {
  int H, W;
  cin >> H >> W;
  
  for (int i = 0; i < W + 2; i++){
    cout << "#";
  }
  cout << endl;
  
  for (int i = 0; i < H; i++){
    string a;
    cin >> a;
    cout << "#" << a << "#" << endl;
  }

  for (int i = 0; i < W + 2; i++){
    cout << "#";
  }
  cout << endl;

}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod1 1000000007
#define mod2 1000000009
int getTheAnswer() {
    return 42;
}

using namespace std;
using ll=long long;

class BJudgeStatusSummary {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        int t;
        cin>>t;
        map<string,int> m;
        while (t--){
            string s;
            cin>>s;
            m[s]++;
        }
        cout<<"AC x "<<m["AC"]<<endl<<"WA x "<<m["WA"]<<endl<<"TLE x "<<m["TLE"]<<endl<<"RE x "<<m["RE"]<<endl;
	}
};


int main() {
	BJudgeStatusSummary solver;
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3660
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        String[] tmpArray;
        Card[] cards = new Card[n];
        
        for(int i = 0; i < n; i++) {
            tmpArray = br.readLine().split(" ");
            cards[i] = new Card(i, tmpArray[0], Integer.parseInt(tmpArray[1]));
        }
        
        quickSort(cards, 0, cards.length - 1);
        
        if(isStable(cards)) {
            System.out.println("Stable");
        }else {
            System.out.println("Not stable");
        }
        
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++) {
            sb.append(cards[i].toString() + "\n");
        }
        System.out.print(sb.toString());
    }
    
    static boolean isStable(Card[] cards) {
        int currentNum = 0;
        
        for(int i = 1; i < cards.length; i++) {
            if(cards[i].number == currentNum && cards[i].id < cards[i - 1].id) {
                return false;
            }else if(cards[i].number != currentNum) {
                currentNum = cards[i].number;
            }
        }
        return true;
    }
    
    static void quickSort(Card[] cards, int p, int r) {
        if(p < r) {
            int q = partition(cards, p, r);
            quickSort(cards, p, q - 1);
            quickSort(cards, q + 1, r);
        }
    }
    
    static int partition(int[] array, int p, int r) {
        int x = array[r];
        int i = p - 1;
        int tmp = 0;
        
        for(int j = p; j <= r - 1; j++) {
            if(array[j] <= x) {
                i++;
                tmp = array[i];
                array[i] = array[j];
                array[j] = tmp;
            }
        }
        tmp = array[i + 1];
        array[i + 1] = array[r];
        array[r] = tmp;
        return i + 1;
    }
    
    static int partition(Card[] array, int p, int r) {
        int x = array[r].number;
        int i = p - 1;
        Card tmp = null;
        
        for(int j = p; j <= r - 1; j++) {
            if(array[j].number <= x) {
                i++;
                tmp = array[i];
                array[i] = array[j];
                array[j] = tmp;
            }
        }
        
        tmp = array[i + 1];
        array[i + 1] = array[r];
        array[r] = tmp;
        return i + 1;
    }
}

class Card {
    int id;
    String mark;
    int number;
    
    public Card(int id, String mark, int number) {
        this.id = id;
        this.mark = mark;
        this.number = number;
    }
    
    public String toString() {
        return mark + " " + number;
    }
    
}


Measured memory_bytes: 70212
#include<iostream>
#include<unordered_map>
using namespace std;
int main(){
    int n;
    cin>>n;
    unordered_map<int,int>mp;
    for(int i=0;i<n;i++)
    {
        int element;
        cin>>element;
        if(mp.find(element)==mp.end())
        {
            mp[element]=1;
        }
        else
        {
            mp[element]++;
        }
    }
    int count=0;
    for(auto it=mp.begin();it!=mp.end();it++)
    {
        if(it->first<it->second){
            count+=it->second-it->first;
        }
        else
        if(it->first>it->second){
            count+=it->second;
        }
    }
    cout<<count;
}

Measured memory_bytes: 7328