akhauriyash/Code-Regression huggingface dataset:
//template
import java.util.*;
import java.util.stream.*;
import java.io.*;
public class Main{
	static BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter out= new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	
	private static final int HUNDRED = 100;
	public static void main(String[] args) throws IOException{
		
		String s=in.readLine();
		String t=in.readLine();
		int i=s.length()-t.length();
		int ans=0;
		if(i==0) {
			for(int x=0;x<s.length();x++) {
				if(s.charAt(x)==t.charAt(x))
					ans++;
			}
			out.append(t.length()-ans+"");
		}else {
			for(int x=0;x<i;x++) {
				int cont=0;
				for(int j=0;j<t.length();j++) {
					if(t.charAt(j)==s.charAt(j+x)) {
						cont++;
					}
				}
				ans=Math.max(cont, ans);
			}
			out.append(t.length()-ans+"");
		}
		
		out.flush();
		in.close();
		out.close();
	}
	public static int mcm(long num1,long num2) {
		int mcm=1;
		int i=2;
		while(i <= num1 || i <= num2)
        {
            if(num1%i==0 || num2%i==0)
            {
            mcm=mcm*i;
            if(num1%i==0) num1=num1/i;
            if(num2%i==0) num2=num2/i;
            }
            else
                i=i+1;               
        }                       
		return mcm;
	}
	public static long MCD(long a, long b) {
	       if(b==0)
	           return a;
	       else
	           return MCD(b, a % b);
	}
	private static int modulo(int S, int N) { return ((S) & (N - 1)); } // returns S % N, where N is a power of 2
	private static int isPowerOfTwo(int S) { return (S & (S - 1)) == 0 ? 1 : 0; }
	private static int[] readInts() throws IOException {
		return Stream.of(in.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
	}
	private static int readInt() throws IOException {
		return Integer.parseInt(in.readLine());
	}
	private static long[] readLongs() throws IOException {
		return Stream.of(in.readLine().split(" ")).mapToLong(Long::parseLong).toArray();
	}
	private static long readLong() throws IOException {
		return Long.parseLong(in.readLine());
	}
	 
}


Measured memory_bytes: 36788
import java.util.Scanner;

class Main{
      public static void main(String args[]){
	Scanner sc = new Scanner(System.in);
	int x = sc.nextInt();
	x%=10;
	if(x==2||x==4||x==5||x==7||x==9)
	    System.out.println("hon");
	else if(x==0||x==1||x==6||x==8)
	    System.out.println("pon");
	else
	    System.out.println("bon");
      }
}


Measured memory_bytes: 35740
#include <cstdio>
#include <string.h>
#include <string>
#include <vector>
#include <array>
#include <algorithm>

int main()
{
    int X, Y, A, B, C;

    scanf("%d %d %d %d %d", &X, &Y, &A, &B, &C);

    std::vector<int> p;
    std::vector<int> q;
    std::vector<int> r;
    r.reserve(C);

    for (int i = 0; i < A; ++i)
    {
        int t;
        scanf("%d", &t);
        p.push_back(t);
    }
    std::sort(p.rbegin(), p.rend());

    for (int i = 0; i < B; ++i)
    {
        int t;
        scanf("%d", &t);
        q.push_back(t);
    }
    std::sort(q.rbegin(), q.rend());

    for (int i = 0; i < C; ++i)
    {
        int t;
        scanf("%d", &t);
        r.push_back(t);
    }
    std::copy(p.begin(), p.begin() + X, std::back_inserter(r));
    std::copy(q.begin(), q.begin() + Y, std::back_inserter(r));
    std::sort(r.rbegin(), r.rend());

    uint64_t total = 0;
    for (size_t i = 0; i < (X + Y); ++i)
    {
        total += r[i];
    }

    printf("%lld\n", total);

    return 0;
}


Measured memory_bytes: 2672
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string& s, char c) { vector<string> v; stringstream ss(s); string x; while(getline(ss,x,c)) v.emplace_back(x); return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

double re[151234];
double dp[151234];

double dfs(const vv<int> &g,int v,int p){
  double re=0;
  int cnt=0;
  for(int w:g[v])if(w!=p) re+=dfs(g,w,v)+1, ++cnt;
  return dp[v]=cnt?re/cnt:0;
}
void dfs(const vv<int> &g,int v,int p,double P){
  double sum=P;
  for(int w:g[v])if(w!=p) sum+=dp[w]+1;
  //out(v,sum,P,1);
  re[v]=sum/g[v].size();
  //for(int w:g[v])if(w!=p) out(v,w,1);
  for(int w:g[v])if(w!=p) dfs(g,w,v,g[v].size()>1?(sum-dp[w]-1)/(g[v].size()-1)+1:1);
}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  int n;
  cin>>n;
  if(n==1){
    cout<<0<<endl;
    return 0;
  }
  vv<int> g(n);
  rep(i,n-1){
    int x,y;
    cin>>x>>y; --x; --y;
    g[x].pb(y);
    g[y].pb(x);
  }
  dfs(g,0,-1);
  //rep(i,n) cout<<dp[i]<<endl;
  dfs(g,0,-1,0);
  rep(i,n) cout<<re[i]<<endl;
  return 0;
}


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

# define ll long long
ll mod=pow(10,9)+7;

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

    int n,k;
    cin>>n>>k;
    int ar[n+1];
    for(int i=1;i<=n;i++)
        cin>>ar[i];
    int dp[n+1][k+1]={0};
    int value[n+1]={0};

    for(int i=1;i<=n;i++)
        for(int j=1;j<=k;j++)
            dp[i][j]=INT_MAX;
    dp[1][1]=0;
    value[1]=0;
    for(int i=2;i<=n;i++){
        int mn=INT_MAX;
        for(int j=1;j<=k;j++)
            mn=min(mn,dp[i-1][j]);
        value[i-1]=mn;

        for(int j=1;j<=k;j++){
            if(i-j<=0)
                break;
            dp[i][j]=value[i-j]+abs(ar[i]-ar[i-j]);
        }
    }

    int mn=INT_MAX;
    for(int j=1;j<=k;j++)
        mn=min(mn,dp[n][j]);
    cout<<mn<<endl;
}


Measured memory_bytes: 43816
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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 COM (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<bool> eratosthenes(ll n) {
    vector<bool> sieve(n+1, true);
    vector<ll> table;
    sieve[0] = sieve[1] = false;
    for (ll i = 2; i <= n; i++) {
        if (sieve[i]) {
            table.push_back(i);
            for (ll j = 2; i * j <= n; j++) {
                sieve[i * j] = false;
            }
        }
    }

    return sieve;
}

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

    ll N;
    cin >> N;

    COMinit();

    vector<bool> check = eratosthenes(100);
    vector<ll> cnt(N+1, 0);

    for (ll i = 1; i <= N; i++) {
        ll num = i;
        for (ll j = 0; j <= N; j++) {
            if (check[j]) {
                while (num % j == 0) {
                    cnt[j]++;
                    num /= j;
                }
            }
        }
    }

    sort(cnt.begin(), cnt.end(), greater<ll>());
    ll o3, o5, o15, o25, o75;
    o3 = o5 = o15 = o25 = o75 = 0;
    for (auto e : cnt) {
        // if (e >= 2) cout << e << "\n";
        if (e >= 2) o3++;
        if (e >= 4) o5++;
        if (e >= 14) o15++;
        if (e >= 24) o25++;
        if (e >= 74) o75++;
    }

    // cout << o3 << " " << o5 << " " << o15 << " " << o25 << " " << o75 << "\n";

    ll ans = o5 * (o5-1) * (o3-2) / 2 + o25 * (o3-1) + o15 * (o5-1) + o75;
    cout << ans << "\n";
}

Measured memory_bytes: 12160
module Main where

import Data.Functor

main :: IO ()
main =  do
 { [h,w] <- getInts
 ; if h == 0 && w == 0 then done
   else putStrLn (unlines (rectangle h w)) >> main
 }


rectangle :: Int -> Int -> [String]
rectangle h w = replicate h (replicate w '#')

done :: IO ()
done = return ()

getInts :: IO [Int]
getInts = map read . words <$> getLine

Measured memory_bytes: 4024
s = gets.chomp
ans = 'AC'
count = 0

s.length.times do |i|
  if s[0] != 'A'
    ans = 'WA'
  end

  if i > 0
    unless s[i] > s[i].upcase
      if s[i] == 'C' && i > 1
        count += 1
        if count == 2
          ans = 'WA'
        end
        if s.length-1 == i
          ans = 'WA'
        end
      else
        ans = 'WA'
      end
    end
  end
end

if count == 0
  ans = 'WA'
end

puts ans

Measured memory_bytes: 1788
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;

int main()
{
	int x,a,b;
	cin>>x>>a>>b;
	if(fabs(x-a)<fabs(x-b)){
		cout<<"A"<<endl; 
	}
	else cout<<"B"<<endl;
	return 0;
}	 


Measured memory_bytes: 256
from math import sqrt
N=int(input())
for A,B in [map(int,input().split())for _ in range(N)]:
    rt=int(sqrt(A*B))
    crossable = rt*(rt+1) < A*B
    print(2*(rt-1+crossable)-1 + ((not crossable and rt*rt < A*B) or A==B))

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n,k,s;

void solve(){
  cin >> n >> k >> s;
  if(s==1000000000){
    rep(i,k){
      cout << s << " ";
    }
    rep(i,n-k){
      cout << s-1 << " ";
    }
    cout << "" << endl;
  }
  else{
    rep(i,k){
      cout << s << " ";
    }
    rep(i,n-k){
      cout << 1000000000 << " ";
    }
    cout << "" << endl;
  }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  vector<string> cand = {"dream", "dreamer", "erase", "eraser"};
  string S; cin >> S;
  int L = S.size();
  vector<bool> dp(L+1, false);

  dp[0] = true;
  REP(i, L) {
    if (not dp[i]) continue;
    for (string s : cand) {
      bool flag = true;
      for (int j = 0; j < (int)s.size(); j++) {
        if (i + j >= L) {
          flag = false;
          break;
        }
        flag &= S[i+j] == s[j];
      }
      if (flag) dp[i+s.size()] = true;
    }
  }

  cout << (dp[L] ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <cstring>

using namespace std;

int mp[1001][1001][3];

int main(){
    int n,m,k;
    char joi[4]="JOI";  
    cin>>m>>n>>k;
    char t[1001];
    memset(mp,0,sizeof(mp));
    for(int i=1;i<=m;++i){        
        cin>>t;  
        for(int j=1;j<=n;++j){
            for(int l=0;l<3;++l) mp[i][j][l]=mp[i][j-1][l]+mp[i-1][j][l]-mp[i-1][j-1][l];
            for(int l=0;l<3;++l){
                if(t[j-1]==joi[l]){++mp[i][j][l];break;}
            }
        }
    }
    int ans[3];
    for(int i=0;i<k;++i){
        int yb,xb,ye,xe;
        cin>>yb>>xb>>ye>>xe;
        for(int j=0;j<3;++j) ans[j]=mp[ye][xe][j]-mp[yb-1][xe][j]-mp[ye][xb-1][j]+mp[yb-1][xb-1][j];
        cout<<ans[0]<<" "<<ans[1]<<" "<<ans[2]<<endl;
    }   
    return 0;
}

Measured memory_bytes: 14840
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct binaryHeap{
  void *h;
  size_t heapSize;
  size_t maxSize;
  size_t size;
  int (*cmp)(const void *,const void *);
} heap;

heap* newHeap(const size_t size,int (*cmpF)(const void *,const void *)){
  const size_t maxSize=1;
  heap *res=(heap *)malloc(sizeof(heap));
  res->h=malloc(size*(maxSize+1));
  res->heapSize=0;
  res->maxSize=maxSize;
  res->size=size;
  res->cmp=cmpF;
  return res;
}

int isEmpty(const heap *h){
  return h->heapSize==0;
}

void freeHeap(heap *h){
  free(h->h);
  free(h);
  return;
}

void initHeap(heap *h){
  h->heapSize=0;
  return;
}

static inline void heapFunc_swap(void * restrict a,void * restrict b,void * restrict tmp,size_t size){
  memcpy(tmp,a,size);
  memcpy(a,b,size);
  memcpy(b,tmp,size);
  return;
}

void push(heap *q,const void *p){
  if(q->heapSize==q->maxSize){
    q->maxSize*=2;
    q->h=realloc(q->h,q->size*(q->maxSize+1));
  }
  q->heapSize+=1;
  char *h=(char *)(q->h);
  int k=q->heapSize;
  const size_t size=q->size;
  int (*cmp)(const void *,const void *)=q->cmp;
  memcpy(h+k*size,p,size);
  while(k>1){
    size_t parent=k/2;
    if(cmp(h+parent*size,h+k*size)<=0) return;
    heapFunc_swap(h+parent*size,h+k*size,h,size);
    k=parent;
  }
  return;
}

void pop(heap *q,void *res){
  char *h=(char *)(q->h);
  const size_t size=q->size;
  if(res!=NULL) memcpy(res,h+size,size);
  memcpy(h+size,h+size*q->heapSize,size);
  q->heapSize-=1;
  int (*cmp)(const void *,const void *)=q->cmp;
  const size_t n=q->heapSize;
  size_t k=1;
  while(2*k+1<=n){
    size_t next=cmp(h+2*k*size,h+(2*k+1)*size)<=0?2*k:2*k+1;
    if(cmp(h+k*size,h+next*size)<=0) return;
    heapFunc_swap(h+k*size,h+next*size,h,size);
    k=next;
  }
  if(2*k<=n && cmp(h+k*size,h+2*k*size)>0) heapFunc_swap(h+k*size,h+2*k*size,h,size);
  return;
}

void top(const heap *q,void *res){
  memcpy(res,(char *)q->h+q->size,q->size);
  return;
}

typedef long long int int64;

int cmpInt(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}

typedef struct sushi{
  int t,d;
} node;

int cmpSushi(const void *a,const void *b){
  return -(((node *)a)->d-((node *)b)->d);
}

void run(void){
  int n,k;
  scanf("%d%d",&n,&k);
  node *a=(node *)calloc(n,sizeof(node));
  int i;
  for(i=0;i<n;i++) scanf("%d%d",&a[i].t,&a[i].d);
  qsort(a,n,sizeof(node),cmpSushi);
  int *used=(int *)calloc(n+1,sizeof(int));
  heap *h=newHeap(sizeof(int),cmpInt);
  int cnt=0;
  int64 sum=0;
  for(i=0;i<k;i++){
    sum+=a[i].d;
    if(used[a[i].t]){
      push(h,&a[i].d);
    } else {
      used[a[i].t]=1;
      cnt++;
    }
  }
  int64 max=sum+(int64)cnt*cnt;
  for(i=k;i<n && !isEmpty(h);i++){
    if(used[a[i].t]) continue;
    used[a[i].t]=1;
    int v;
    pop(h,&v);
    sum-=v;
    sum+=a[i].d;
    cnt++;
    if(max<sum+(int64)cnt*cnt) max=sum+(int64)cnt*cnt;
  }
  printf("%lld\n",max);
}

int main(void){
  run();
  return 0;
}


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

#define N 1000

int main(void){
  int a[N], tmp[N];
  int n, q, b, m, e;
  
  cin >> n;
  for (int i=0; i<n; i++){
    cin >> a[i];
  }
  cin >> q;
  for (int i=0; i<q; i++){
    cin >> b >> m >> e;
    for (int j=0; j<e-b; j++){
      tmp[(j+e-m)%(e-b)] = a[b+j];
    }
    for (int j=0; j<e-b; j++){
      a[b+j] = tmp[j];
    }
  }
  cout << a[0];
  for (int i=1; i<n; i++){
    cout << " " << a[i];
  } cout << endl;
  return 0;
}


Measured memory_bytes: 3128
#%%
x, y = map(int,input().split())
x,y =max(x,y),min(x,y)
y_1 = y
y_2 = 0
x_1 = 0
x_2 = y
while x_1 + x_2*2 > x:
    y_1 -=2
    y_2 +=1
    x_1 +=1
    x_2 -=2
if x_1 + x_2*2 !=x or y_1 + 2*y_2 !=y:
    print(0)
    exit()
p = 10 ** 9 + 7
N = y + 1  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

fact = [ 0 for i in range(N+1)]
factinv = fact.copy()
inv = fact.copy()

fact[0], fact[1] = 1, 1
factinv[0], factinv[1] = 1, 1
inv[0], inv[1] = 0, 1


for i in range(2, N + 1):
    fact[i] = (fact[i-1] * i) % p##階乗のリスト
    inv[i] = (-inv[p % i] * (p // i)) % p
    factinv[i] =(factinv[i-1] * inv[i]) % p##階乗の逆数のリスト

#知りたいのが数通りのcmbだけの場合
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

print(fact[y_1+y_2]*factinv[y_1]*factinv[y_2] %p)


Measured memory_bytes: 121808
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi   = vec<int>;
using vvi  = vec<vi>;
using vvvi = vec<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  string s, t;
  cin >> s >> t;
  int cnt = 0;
  rep(i,3){
    if(s[i]==t[i]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3648
n,c=map(int,input().split()) 
d=[[] for i in range(c)]
for i in range(c):
    d[i]=list(map(int,input().split()))
mat=[[] for i in range(n)]
cl=[[] for i in range(3)]
for i in range(n):
    mat[i]=list(map(int,input().split()))
for i in range(n):
    for j in range(n):
        if (i+j)%3==0:
            k=0
        elif (i+j)%3==1:
            k=1
        else:
            k=2
        cl[k].append(mat[i][j])
q=[[0 for i in range(c)] for i in range(3)]
for i in range(c):
    for j in range(3):
        for k in cl[j]:
            q[j][i]+=d[k-1][i]            
mi=10**9
for i in range(c):
    for j in range(c):
        for k in range(c):
            if i!=j and j!=k and k!=i:
                s=q[0][i]+q[1][j]+q[2][k]
                if s<mi:
                    mi=s
print(mi)

Measured memory_bytes: 7696
import heapq

N,u,v = map(int,input().split())
u -= 1
v -= 1

#du = [0]*N
#dv = [0]*N
du = [float('inf')]*N
dv = [float('inf')]*N
#du[u] = 0
#dv[v] = 0
q = []

G = [[]]*N

'''
def dfs(v, d, p, dis):
    dis[v] = d
    if G[v] != []:
        for u in G[v]:
            if( u == p):
                continue
            else:
                dfs( u, d+1, v, dis )

def calcDist(s, dist):
    dfs(s, 0, -1, dist)
'''
def calcDist(s, dist):
    heapq.heappush(q,[0, s])
    dist[s] = int(0)
    
    while q!=[]:
        p = heapq.heappop(q)
        pv = p[1]
        if dist[pv] < p[0] :
            continue
        for i in range(len(G[pv])):
            eto = G[pv][i]
            if dist[eto] > dist[pv] + 1:
                 dist[eto] = int(dist[pv] + 1)
                 heapq.heappush(q, [dist[eto], eto])


for i in range(N-1):
    e1,e2 = map(int, input().split())
    e1 -= 1
    e2 -= 1
    if G[e1] == []:
        G[e1] = [e2]
    else:
        G[e1].append(e2)
    if G[e2] == []:
        G[e2] = [e1]
    else:
        G[e2].append(e1)

if v in G[u]:
    ans = 0
else:    

    calcDist(v,dv)
    calcDist(u,du)
    maxD = 0
    for idu,idv in zip(du,dv):
        if idu < idv:
            maxD = max(maxD, idv)       
    ans = maxD-1
    
print(ans)

Measured memory_bytes: 29532
n = int(input())
a = list(map(int, input().split()))
arr = [sorted([i, j]) for i, j in enumerate(a,1)]
arr = sorted(arr)
counter = 0
for i in range(n-1):
    if arr[i][0] == arr[i+1][0] and arr[i][1] == arr[i+1][1] :
        counter +=1
print(counter)

Measured memory_bytes: 23012
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int A, B;
	cin >> A >> B;
	int C = B - A;
	C--;
	int S = C * (C + 1) / 2;
	cout << S - A << endl;
}

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

int main() {
    int N; cin >> N;
    vector<vector<int> > count(10, vector<int>(10, 0));
    for (int i = 1; i <= N; i++) {
        int a = i % 10;
        int b = i;
        while (b >= 10) {
            b /= 10;
        }
        count[a][b]++;
    }
    long long ans = 0;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            ans += count[i][j] * count[j][i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int x,y,i,s,t;
    for(i=0;i<3000;i++){
        scanf("%d %d",&x,&y);
        if(x > y){
            s = x;
            t = y;
            x = t;
            y = s;
        } else {}
        if(x == 0&&y == 0) break;
        printf("%d %d\n",x,y);
    }
    return 0;
}


Measured memory_bytes: 2068
t = 0
h = 0
for i in range (int(input())):
    cards = input().split()
    if cards[0] == cards[1]:
        t += 1
        h += 1
    elif cards[0] < cards[1]:
        h += 3
    else:
        t += 3
print(str(t), str(h))



Measured memory_bytes: 5600
#include <stdio.h>
#include <string.h>
 
int main(){
    char str[1000][50], max[50], strtemp[50], mfstr[50];
    int len = 0, len1 = 0, n=0, cnt = 0, mfreq = 0, i = 0, j = 0;

    while(scanf("%s", str[n]) != EOF){
        len = strlen(str[n]);
        if(len1 < len){
            len1 = len;
            strcpy(max, str[n]);
        }
        n++;
    }
    for(i=0; i < n; i++){
        cnt = 0;
        strcpy(strtemp, str[i]);
        for(j=0; j < n; j++){
            if(strcmp(str[j], strtemp) == 0) cnt++;
        }   
        if(mfreq < cnt){
            mfreq = cnt;
            strcpy(mfstr, strtemp);
        }
    }
     
    printf("%s %s\n", mfstr, max);
     
    return 0;
}

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

using namespace std;

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

	int n, l;
	cin >> n >> l;
	vector<string> s(n);
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
	}
	sort(s.begin(), s.end());
	for (auto str : s) {
		cout << str;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<utility>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
typedef pair<int,int> pi;
const int inf= 1<<28;

int n,m,r,z[1000];
int DL[200][200],DS[200][200];

int dp[1000][200];

int main(){
	while(cin>>n>>m,n)
	{
		rep(i,n)rep(j,n)DL[i][j]=DS[i][j]=inf;
		
		rep(i,m)
		{
			int x,y,t; char c;
			cin>>x>>y>>t>>c; x--,y--;
			if(c=='L')DL[x][y]=DL[y][x]=min(DL[x][y],t);
			if(c=='S')DS[x][y]=DS[y][x]=min(DS[x][y],t);
		}
		rep(i,n)DL[i][i]=DS[i][i]=0;
		
		cin>>r;
		rep(i,r)cin>>z[i],z[i]--;
		rep(i,r)rep(j,n)dp[i][j]=inf;
		
		rep(k,n)rep(i,n)rep(j,n)
		{
			DL[i][j]=min(DL[i][j],DL[i][k]+DL[k][j]);
			DS[i][j]=min(DS[i][j],DS[i][k]+DS[k][j]);
		}
		
		dp[0][z[0]]=0;
		priority_queue<pair<int,pi> > Q; Q.push(mp(0,mp(0,z[0])));
		while(!Q.empty())
		{
			int cc=Q.top().first;
			int cur=Q.top().second.first,ship=Q.top().second.second; Q.pop();
			
			if(dp[cur][ship]>-cc)continue;
			if(cur==r-1)
			{
				cout<<-cc<<endl; break;
			}
			
			//land
			int nc=cc-DL[z[cur]][z[cur+1]];
			if(DL[z[cur]][z[cur+1]]!=inf&&dp[cur+1][ship]>-nc)
				dp[cur+1][ship]=-nc,Q.push(mp(nc,mp(cur+1,ship)));
			
			//sea
			rep(i,n)if(DL[z[cur]][ship]!=inf&&DS[ship][i]!=inf&&DL[i][z[cur+1]]!=inf)
			{
				nc=cc-DL[z[cur]][ship]-DS[ship][i]-DL[i][z[cur+1]];
				if(dp[cur+1][i]>-nc)
					dp[cur+1][i]=-nc,Q.push(mp(nc,mp(cur+1,i)));
			}
		}
	}
	return 0;
}

Measured memory_bytes: 2096
#include<stdio.h>
#include<string.h>
#include<math.h>
typedef struct complex complex;
#define rep(i,N) for(int i=0;i<(int)N;i++)
#define SWAPCP(a,b) (a=Add(a,b),b=Add(a,Minus(b)),a=Add(a,Minus(b)))
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=(c==45),c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?~x+1:x;
}
static inline void OUT(long a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
struct complex{double real,imag;}A[524288]={{0},{0}};
static inline complex Add(complex x,complex y){complex z;z.real=x.real+y.real;z.imag=x.imag+y.imag;return z;}
static inline complex Minus(complex x){x.real=-x.real;x.imag=-x.imag;return x;}
static inline complex Mul(complex x,complex y)
{
  complex z;z.real=x.real*y.real-x.imag*y.imag;
  z.imag=x.real*y.imag+x.imag*y.real;return z;
}
struct REV{int val;}rev[524288];
const int MOD=200003,len=524288,bit=19;
const double pi=3.141592653589793238462643383;
static inline void FFT(int t)
{
  rep(i,len)if(rev[i].val>i){SWAPCP(A[rev[i].val],A[i]);}
  for(int i=1;i<len;i<<=1)
  {
    complex v;v.real=cos(pi/i),v.imag=t*sin(pi/i);
    for(int j=0;j<len;j+=i<<1)
    {
      complex w;w.real=1;w.imag=0;
      rep(k,i)
      {
        complex x=A[k+j],y=Mul(w,A[k+j+i]);
        A[k+j]=Add(x,y);A[k+j+i]=Add(x,Minus(y));
        w=Mul(v,w);
      }
    }
  }
  if(t==-1)rep(i,len){A[i].real/=len;A[i].imag/=len;}
} 
int main(void)
{
  int N=IN(),temp=1,to[200003];long total=0;
  rep(i,MOD-2){temp=2*temp%MOD;to[temp]=i+1;}
  rep(i,len){rev[i].val=(rev[i>>1].val>>1)|((i&1)<<(bit-1));}
  rep(i,N)
  {
    int x=IN();
    total-=1l*x*x%MOD;
    if(!x)continue;
    x=to[x];A[x].real+=1.0;A[x].imag=0;
  }
  FFT(1);rep(i,len){A[i]=Mul(A[i],A[i]);}FFT(-1);
  temp=1%MOD;rep(i,400004){total+=(long)(A[i].real+0.5)*temp;temp=2*temp%MOD;}
  return OUT(total/2),0;
}

Measured memory_bytes: 13304
package main

import "fmt"

func main() {
	var n string
	fmt.Scan(&n)
	max := 0
	cnt := 0
	for _, r := range n {
		if string(r) == "R" {
			cnt++
		} else {
			cnt = 0
		}
		if cnt >= max {
			max = cnt
		}
	}
	fmt.Println(max)
}

Measured memory_bytes: 1768
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <queue>
#include<set>
using namespace std;

int main() {
   int n, m;
   cin >> n >> m;
   priority_queue <pair<int, int>> q;
   for(int i = 0; i < n; i++) {
       int a;
       cin >> a;
       q.push(make_pair(a, 1));
   }

   for(int i = 0; i < m; i++) {
       int b, c;
       cin >> b >> c;
       q.push(make_pair(c, b));
   }

   long long ans = 0;

   for(int i = 0; i < n; i++) {
       auto qt = q.top();
       q.pop();
       ans += qt.first;
       if (qt.second > 1) {
           q.push(make_pair(qt.first, qt.second - 1));
       }
   }

   cout << ans << endl;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include <iostream>
#include <ctype.h>
#include <string>
typedef long long ll;
using namespace std;
#define mod 1e9+7



int main(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a>=0&& c>=0 ){
      cout<<b*d;
  }else if(b<=0 && d<=0){
      cout<<a*c;
  }else if(a>=0 && d<=0){
      cout<<a*d;
  }else if(b<=0 && c>=0){
      cout<<b*c;
  }else{
      cout<<max(a*c,d*b);
  }


}

Measured memory_bytes: 3632
#include<iostream>
#include<functional>
#include <algorithm>
using namespace std;

int main(){
  int N;
  int A[101];
  int alice = 0;
  int bob = 0;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  sort(A,A+N,greater<int>());
  for(int i=0;i<N;i++){
    if(i%2 == 0){
      alice += A[i];
    }else{
      bob += A[i];
    }
  }
  cout << alice-bob << endl;
}

Measured memory_bytes: 256
n = int(input())
s = [ input() for _ in range(n) ]

c = {}
for i in s:
  x = ''.join(sorted(i))
  if x in c:
    c[x] += 1
  else:
    c[x] = 1

ans = 0
for i in c.values():
  if i > 1:
    ans += i * (i-1) / 2

print(int(ans))

Measured memory_bytes: 24980
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            int len1 = s1.Length;
            int len2 = s2.Length;
            int temp;

            int[,] dp = new int[len1 + 1, len2 + 1];
            for (int i = 0; i <= len1; i++) dp[i, 0] = i;
            for (int i = 0; i <= len2; i++) dp[0, i] = i;

            for (int i = 0; i < len1; i++)
            {
                for (int j = 0; j < len2; j++)
                {
                    temp = (s1[i] == s2[j]) ? dp[i, j] : dp[i, j] + 1;
                    temp = Math.Min(temp, dp[i + 1, j] + 1);
                    temp = Math.Min(temp, dp[i, j + 1] + 1);

                    dp[i + 1, j + 1] = temp;
                }
            }
            Console.WriteLine(dp[len1, len2]);
        }
    }
}

Measured memory_bytes: 13012
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    int x,y;
    cin>>x>>y;
    int b=y-2*x, a=4*x-y;
    if(b>=0&&b%2==0&&a>=0&&a%2==0){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}


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

int N,K,F[4010][4010] = {{0}};

int main(){
	cin >> N >> K;
	int x,y;
	char c;
	for(int i=0;i<N;i++){
		cin >> x >> y >> c;
		x %= 2*K;
		if(c=='W') y += K;
		y %= 2*K;
		F[x][y]++;
		F[x+K][y+K]++;
		F[x+K][y]--;
		F[x][y+K]--;
		x += K;
		y += K;
		F[x][y]++;
		F[x+K][y+K]++;
		F[x+K][y]--;
		F[x][y+K]--;
	}
	for(int i=0;i<4*K;i++){
		for(int j=1;j<4*K;j++){
			F[i][j] += F[i][j-1];
		}
	}
	int ans = 0;
	int A[2010][2010] = {0};
	for(int i=1;i<4*K;i++){
		for(int j=0;j<4*K;j++){
			F[i][j] += F[i-1][j];
		}
	}
	for(int i=0;i<4*K;i++){
		for(int j=0;j<4*K;j++){
			A[i%(2*K)][j%(2*K)] += F[i][j];
		}
	}
	for(int i=0;i<2*K;i++){
		for(int j=0;j<2*K;j++){
			ans = max(ans,A[i][j]);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 78720
N=int(input())
S=[int(input()) for i in range(N)]
if sum(S) %10 != 0:
  print(sum(S))
else:
  tmp = -1
  for s in sorted(S):
    if s % 10 != 0:
      tmp = s
      break
  if tmp != -1:
    print(sum(S)-tmp)
  else:
    print(0)

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
using namespace std;
typedef pair<int,int> P;
const int INF = (int)((unsigned int)-1>>1);

struct team{
    int mis[10];
    int m,n,t;
    team(){
        fill(mis,mis+10,0);
        m = 0;
        n = 0;
        t = 0;
    }
};

bool cmp(const team& left, const team& right){
    if (left.n == right.n){
        if (left.m == right.m){
            return left.t > right.t;
        }else{
            return left.m < right.m;
        }
    }else{
        return left.n > right.n;
    }
}

int main(){
    while(1){
        int M,T,P,R;
        cin >> M >> T >> P >> R;
        if (M==0)break;

        vector<team> g(T);
        for(int i=0;i<T;i++) g[i].t = i+1;
        for(int i=0;i<R;i++){
            int m,t,p,j;
            cin >> m >> t >> p >>j;
            t--;p--;
            //printf("%d %d %d %d\n",m,t,p,j);
            if (j==0){
                g[t].n += 1;
                g[t].m += m + g[t].mis[p]*20;
            }else{
                g[t].mis[p] += 1;
            }
        }

        sort(g.begin(),g.end(),cmp);
        printf("%d",g[0].t);
        for(int i=1;i<T;i++){
            if(g[i].n == g[i-1].n && g[i].m == g[i-1].m){
                printf("=%d",g[i].t);
            }else{
                printf(",%d",g[i].t);
            }
        }
        printf("\n");
    }
}

Measured memory_bytes: 1184
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	inputs := scanner.Text()

	inputsSlice := strings.Split(inputs, " ")
	a, _ := strconv.Atoi(inputsSlice[0])
	b, _ := strconv.Atoi(inputsSlice[1])
	c, _ := strconv.Atoi(inputsSlice[2])
	d, _ := strconv.Atoi(inputsSlice[3])

	// a*c, a*d, b*c, b*d の結果を格納
	patterns := make([]int, 4)

	patterns[0] = a * c
	patterns[1] = a * d
	patterns[2] = b * c
	patterns[3] = b * d

	max := 0
	for i := 0; i < len(patterns); i++ {
		if i == 0 {
			max = patterns[i]
		}

		if patterns[i] > max {
			max = patterns[i]
		}
	}

	fmt.Println(max)
}


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

using namespace std;

int main(int argc,char* argv[]){
	long a,b,x;
	cin >> a >> b >> x;
	if(a%x==0) {
		cout << b/x-a/x+1 << endl;
	}else cout << b/x-a/x << endl;
	return 0;
}


Measured memory_bytes: 256
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 100005;
const ll mm = 1e+18;
void solve()
{
    string s;
    cin>>s;
    cout<<s.substr(0,5)<<" "<<s.substr(6,7)<<" "<<s.substr(14);
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    long long N, K;
    cin >> N;
    cin >> K;

    double ans = 0;

    for (int i = 1; i <= N; ++i) {
        int sum = i;
        int count = 0;
        while (sum < K) {
            count++;
            sum = 2 * sum;
        }

        ans += (1.0 / N) * pow(0.5, count);
    }

    cout << std::setprecision(11) << ans;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> l(m);
	vector<int> r(m);
	for (int i = 0; i < m; i++) {
		cin >> l[i] >> r[i];
	}

	int min = *max_element(l.begin(), l.end());
	int max = *min_element(r.begin(), r.end());

	int ans = max - min + 1;
	if (ans <= 0) ans = 0;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>
#include <sstream>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (*(x.end()-1))

using namespace std;

#define EPS 0.0000000001

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int r;

// 1 x 1 x pi
// r x r x pi

void input() {
  cin >> r;
}

void solve() {
  cout << r * r << endl;
}

int main(void) {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr ll INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// ----------------------------------------------------------------------------


int main(){
  ll N;
  cin >> N;
  ll ans = 0;
  vector<vector<int>> G(10,vector<int> (10,0));
  for(int i=1; i<=N; i++){
    int x = i;
    int se,ma;
    ma = x%10;
    while(1){
      if(x/10 == 0){
        break;
      }
      x /= 10;
    }
    se = x;
    G[se][ma]++;
  }
  for(int i=1; i<=9; i++){
    for(int j=1; j<=9; j++){
      ans += G[i][j]*G[j][i];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int N, M, C, A[20][20], B[20], i, j, sum, accepted = 0;

    scanf("%d%d%d", &N, &M, &C);

    for (j = 0; j < M; j++) {
        scanf("%d", &B[j]);
    }

    for (i = 0; i < N; i++) {
        for (j = 0; j < M; j++) {
            scanf("%d", &A[i][j]);
        }
    }

    for (i = 0; i < N; i++) {
        sum = 0;
        for (j = 0; j < M; j++) {
            sum += A[i][j] * B[j];
        }
        if ((sum + C) > 0) {
            accepted++;
        }
    }

    printf("%d", accepted);

    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt(); //500
    	int B = sc.nextInt(); //100
    	int C = sc.nextInt(); //50
    	int X = sc.nextInt();
    	
    	int total_a;
    	int total_b;
    	int total_c;
    	
    	int ans = 0;
    	
    	for(int cntA = 0;cntA <= A;cntA++){
    		total_a = cntA * 500;
    		if(total_a > X){
    			break;
    		}
    		for(int cntB = 0;cntB <= B;cntB++){
    			total_b = cntB * 100;
    			if(total_a + total_b > X){
    				break;
    			}
    			for(int cntC = 0;cntC <= C;cntC++){
        			total_c = cntC * 50;
        			if(total_a + total_b + total_c == X){
        				++ans;
        			}
        			
        		}
    		}
    	}
    	System.out.println(ans);
    }
}



Measured memory_bytes: 23124
#include "bits/stdc++.h"
#define debug 0
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define qceil(n,d) ((n) > 0 ? ((n) - 1) / (d) + 1 : (n) / (d))
#define parity(a,b) (a & 1 ^ b & 1 ^ 1)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;

const pii dir[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int mod = 1e9 + 7;
const int inf32 = (1 << 30) - 1;
const ll inf64 = (1LL << 62) - 1;

ll modpow(ll n, ll e, ll m = mod){
	ll res = 1;
	n %= m;
	e %= (m - 1);
	while(e) {
		if(e & 1) res = res * n % m;
		n = n * n % m;
		e >>= 1;
	}
	return res;
}

ll N,M,Q,K,L,H,W,D;
string S;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> N;
	vct<string> x(N);
	rep(i,N) cin >> x[i];
	vct<int> alp(26);
	rep(i,26) alp[i] = inf32;
	vct<int> tmp(26);
	rep(i,N){
	    for(char c : x[i]) tmp[c - 'a']++;
	    rep(i,26) alp[i] = min(alp[i],tmp[i]),tmp[i] = 0;
	}
	rep(i,26)rep(j,alp[i]) cout << (char)(i + 'a');
	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  int n, k; cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) a[i]--;
  vector<int> s(n+1);
  rep(i,n){
    s[i+1] = (s[i]+a[i])%k;
  }
  map<int,int> mp;
  queue<int> q;
  ll ans = 0;
  rep(j,n+1){
    ans += mp[s[j]];
    mp[s[j]]++;
    q.push(s[j]);
    if(q.size() == k){
      mp[q.front()]--;
      q.pop();
    }
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 12032
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll a, b; cin >> a >> b; int cnt = 0;
  while(a<=b){
    cnt++; a *= 2;
  }
  cout << cnt << endl;
    
}

Measured memory_bytes: 256
def output_route(length, string):
    for _ in range(length):
        print(string, end = '')
sx, sy, tx, ty = map(int, input().split())
len_x = tx - sx
len_y = ty - sy
output_route(len_x, "R")
output_route(len_y, "U")
output_route(len_x, "L")
output_route(len_y + 1, "D")
output_route(len_x + 1, "R")
output_route(len_y + 1, "U")
output_route(1, "L")
output_route(1, "U")
output_route(len_x + 1, "L")
output_route(len_y + 1, "D")
output_route(1, "R")

Measured memory_bytes: 4468