akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;

/*
const ll M = 1000000007;
vector<ll> fac(3001);
vector<ll> ifac(3001);
ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
 
ll comb(ll a, ll b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0 || b < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}
*/


ll lcm(ll a,ll b){
 
  ll r, x, tmp;
  x = a * b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}

ll gcd(ll a ,ll b){
    if(a==0){return b;}
    else if(b==0){return a;}
    else{
    ll tmp,r;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
    }
}




int main(void){
    const ll M = 1000000007;
    string s;
    cin >> s;
    int l,r;
    l = 0;
    r = 0;
    int n = s.length();
    int a[n];
    int b[n];
    for(int i=0;i<n;i++)b[i]=0;
    for(int i=0;i<n;i++){
        if(s.at(i)=='L')a[i]=0;
        else a[i]=1;
    }
    for(int i=0;i<n-1;i++){
        if(a[i]==1)r++;
        if(a[i]==1&&a[i+1]==0){
            b[i]+=r;
            r=0;
        }
    }
        for(int i=n-1;i>0;i--){
        if(a[i]==0)l++;
        if(a[i-1]==1&&a[i]==0){
            b[i]+=l;
            l=0;
        }
    }
    
    int x = 0;
    for(int i=0;i<n-1;i++){
        if(x==0){
        if(b[i]!=0&&b[i+1]!=0){
        int y = b[i];
        int z = b[i+1];
        b[i] = (y+1)/2;
        b[i] += (z/2);
        b[i+1] = y + z - b[i];
        x++;
        }
        }
        else if(x!=0){
            x=0;
        }
    }
       
    for(int i=0;i<n;i++)cout << b[i] << ' ';
    cout << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
struct UnionFind
{
    vector<int> data;

    UnionFind(int sz)
    {
        data.assign(sz,-1);
    }

    bool unite(int x, int y)
    {
        x = find(x), y = find(y);
        if(x == y) return(false);
        if(data[x] > data[y]) swap(x,y);
        data[x] += data[y];
        data[y] = x;
        return(true);
    }

    int find(int k)
    {
        if(data[k] < 0) return(k);
        return(data[k] = find(data[k]));
    }

    int size(int k)
    {
        return(-data[find(k)]);
    }
};

int main(){
    int n,k,l;
    cin >> n >> k >>l;
    struct UnionFind g1(n),g2(n);
    for(int i=0; i<k; i++){
        int p,q;
        cin >> p >> q;
        g1.unite(p-1,q-1);
    }
    for(int i=0; i<l; i++){
        int r,s;
        cin >> r >> s;
        g2.unite(r-1,s-1);
    }
    vector<pair<int,int>> s;
    for(int i=0; i<n; i++){
        s.push_back(make_pair(g1.find(i),g2.find(i)));
    }
    sort(s.begin(),s.end());
    for(int i=0; i<n; i++){
        cout << upper_bound(s.begin(),s.end(),make_pair(g1.find(i),g2.find(i)))
            -  lower_bound(s.begin(),s.end(),make_pair(g1.find(i),g2.find(i))) <<  ' ';
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3956
#include <stdio.h>
int a, b;

int main() {
	scanf("%d %d", &a, &b);
	if (a < b) {
	    printf("a < b\n");
	} else if (a > b) {
	    printf("a > b\n");
	} else {	
		printf("a == b\n");
	}
	return 0;
}


Measured memory_bytes: 2092
import java.util.*;

public class Main {

    class P {
        int idx, cost;

        public P(int idx, int cost) {
            this.idx = idx;
            this.cost = cost;
        }
    }

    void run() {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();
        long MOD = (long) 1e9 + 7;

        List<Integer>[] arr = new List[n];
        for (int i = 0; i < n; i++) {
            arr[i] = new ArrayList<>();
        }

        for (int i = 0; i < n - 1; i++) {
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            arr[a].add(b);
            arr[b].add(a);
        }

        boolean[] visited = new boolean[n];
        ArrayDeque<P> q = new ArrayDeque<>();

        long combi = 1;
        q.add(new P(0, k));
        int loopCounter = 0;
        while (!q.isEmpty()) {
            P curP = q.peek();
            int cur = curP.idx;
            combi = curP.cost * combi % MOD;
            List<Integer> l = arr[cur];
            int count = 0;
            for (int i : l) {
                int next = i;
                if (!visited[next]) {
                    q.add(new P(next, loopCounter == 0 ? k - 1 - count : k - 2 - count));
                    count++;
                }
            }
            visited[cur] = true;
            loopCounter++;
            q.pop();
        }

        System.out.println(combi);

    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 107256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int h = cin.Int();
			int w = cin.Int();
			int n = cin.Int();

			int m = Math.Max(h, w);
			int ans = n / m;
			if (n % m != 0) {
				++ans;
			}

			Console.WriteLine(ans);
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 11092
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) (v).begin(), (v).end()



int main() {

	ll X, Y;
	cin >> X >> Y;
	
	ll ans = 0;
	ll tmp = X;
	while (tmp <= Y) {
		tmp = 2 * tmp;
		++ans;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

#define PI 4*atan(1);

int main(){
  vector<int> W, K;
  int tmp, sumW = 0, sumK = 0;
  for(int i = 0; i < 10; i++){
    cin >> tmp;
    W.push_back(tmp);
  }
  for(int i = 0; i < 10; i++){
    cin >> tmp;
    K.push_back(tmp);
  }
  sort(W.begin(), W.end(), greater<int>());
  sort(K.begin(), K.end(), greater<int>());
  for(int i = 0; i < 3; i++){
    sumW += W[i];
    sumK += K[i];
  }
  cout << sumW << " " << sumK << endl;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define INF 1e9
#define All(x) (x).begin(),(x).end()
#define Cout(x) cout << (x) << endl
typedef long long ll;
using namespace std;

int main(){
    char c;
    cin>>c;
    c+=1;
    cout<<c<<endl;
}

Measured memory_bytes: 256
s = input()

def check(s):
    if s=="A" or s=="C" or s=="G" or s=="T":
        return True
    else:
        return False

max_count = 0
for i in range(len(s)):
    count = 0
    for j in range(i,len(s)):
        if check(s[j]):
            count+=1
        else:
            break
    max_count = max(count,max_count)

print(max_count)

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string n;
  cin >> n;
  string tmp = n;
  reverse(all(tmp));
  cout << (tmp == n ? "Yes" : "No") << "\n";
  return 0;
}

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

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b;
    cin>>a>>b;
    if(a>b) swap(a,b);
    for(int i = 0;i<b;i++){
        cout<<a;
    }
    cout<<endl;
}


Measured memory_bytes: 892
N,M = map(int,input().split())
listAB = [list(map(lambda x:int(x),input().split())) for i in range(M)]
# 要素の2番目でソート
listAB.sort(key=lambda x: x[1])
# 最後に切った橋の位置
last = -1
ans = 0
for a,b in listAB:
    # 切った橋より右側に依頼があるか
    if last <= a:
        ans += 1
        # 切った位置はbの位置
        last = b

print(ans)

Measured memory_bytes: 29112
# Strange Bank
# https://atcoder.jp/contests/abc099/tasks/abc099_c

# 個数制限なしナップサックDP
# ★1次元DP配列で実装するパターン
class KnapsackDPSolver2
  def main
    upper_w = gets.chomp.to_i

    # 品物（引き出し単位金額）のリストを生成
    items = []
    w = 1
    while w <= upper_w
      items << w
      w *= 6
    end
    w = 9
    while w <= upper_w
      items << w
      w *= 9
    end
    # pp items

    n = items.length

    # 金額wを引き出すのに必要な最小の回数を格納
    # dp[w] = v
    # ★【最小の】回数を格納するので初期値はINF的な値に
    dp = Array.new(upper_w+1, 1 << 29)
    # 左端は0に。0円は0回で引き出せるので。
    dp[0] = 0

    0.upto(n-1) do |i|
      # DPテーブルが2次元の場合と違い、
      # 現在金額より左側の部分（現在金額が使えない部分）をただ下に下ろすだけの処理が必要なくなるので、
      # ループの開始を現在金額にする
      items[i].upto(upper_w) do |w|
        dp[w] = [dp[w], dp[w - items[i]] + 1].min
      end
    end

    puts dp[upper_w]
  end
end

if __FILE__ == $0
  # KnapsackDPSolver.new.main
  KnapsackDPSolver2.new.main
end


Measured memory_bytes: 2556
/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_B&lang=jp*/
#include <iostream>
#include <queue>

using namespace std;

struct process{
    string name;
    int time;
};

int main(){
    int n,q;
    int time=0;
    queue<struct process> tasks;

    cin>>n;
    cin>>q;
    for(int i=0;i<n;i++){
        struct process p;
        cin>>p.name;
        cin>>p.time;
        tasks.push(p);
    }
    while(!tasks.empty()){
        struct process p=tasks.front();
        time+=q;
        p.time-=q;
        tasks.pop();
        if(p.time>0){
            tasks.push(p);
        }else{
            time+=p.time;
            cout<<p.name<<" "<<time<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4404
N=int(input())
_b=list(map(int,input().split()))
ix=[]
while len(_b)!=0:
    pp=[i for i in range(len(_b)) if _b[i]==i+1][-1:]
    if len(pp)==0:
        print(-1)
        exit(0)
    p=pp[0]
    _b.pop(p)
    ix.append(p)
ix.reverse()
for i in ix:
    print(i+1)


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

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

  ll n, x, m, ans = 0;
  cin >> n >> x >> m;
  vector<ll> s(m, -1);
  vector<ll> a;
  int cnt = 0;
  ll tot = 0;
  while (s[x] == -1) {
    a.push_back(x);
    s[x] = cnt;
    tot += x;
    ++cnt;
    x = (x*x)%m;
  }
  
  if (n <= cnt) {
    rep(i,n) ans += a[i];
  } else {
    int re = cnt - s[x];
    ll tot2 = 0;
    for (int i = s[x]; i < cnt; ++i) tot2 += a[i];

    ans += tot;
    n -= cnt;
    ans += (n/re)*tot2;
    n %= re;
    rep(i,n) ans += a[s[x]+i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 4636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef pair<ll, ll> P;
#define ALL(v) v.begin(),v.end()

const int MOD = 1000000007;
const int MAX = 5100000;
ll gcd(ll a, ll b) {
    return (b==0) ? a : gcd(b, a%b);
}

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

// 以下から
const int MAX_N = 100000;
struct Edge {
    int to;
    int id;
};

const int D = 80 * 160 + 10;
const int D2 = D*2;
typedef bitset<D2> bs;
int a[100][100];
bs dp[90][90];



const int N = 20;
int h;
int w;
vector<vector<char>> maze(N, vector<char>(N,'#'));

const int MAX_WH = 21;
int d[MAX_WH][MAX_WH];
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
const int INF = 1001001001;
int bfs(int x, int y) {
    queue<P> que;
    rep(i,MAX_WH) {
        rep(j,MAX_WH) {
            d[j][i] = INF;
        }
    }
    que.push(P(x,y));
    d[x][y] = 0;

    while (que.size()) {
        P p = que.front(); que.pop();
        for (int i=0; i< 4; i++) {
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];
            if (0 <= nx && nx < w && 0 <= ny && ny < h && maze[nx][ny] != '#' && d[nx][ny] == INF) {
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    int mx = 0;
    rep(i,h) rep(j,w) {
            if (d[j][i] == INF) continue;
            mx = max(mx, d[j][i]);
        }
    return mx;
}

bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.first < secondElof.first;
}
void dfs(){

}
const int MX = 100000;
vector<int> G[MX];

int main(){
    int h,n; cin >> h >> n;
    vector<int> dp(h+5, INF);
    dp[0] = 0;
    rep(i,n){
        int a,b; cin >> a >> b;
        rep(j,h) {
            int nj = min(j + a, h);
            dp[nj] = min(dp[nj], dp[j]+b);
        }
    }
    cout << dp[h] << endl;
}



Measured memory_bytes: 4352
from collections import Counter

def read():
    N = int(input().strip())
    D = list(map(int, input().strip().split()))
    return N, D

def argsort(x):
    pairs = [(i, x[i]) for i in range(len(x))]
    pairs.sort(key=lambda a: a[1])
    return [a[0] for a in pairs]


def solve(N, D, P=998244353):
    D = [-1] + D
    count = Counter(D)
    count_max = max(count.keys())

    if not(D[1] == 0 and count[0] == 1):
        return 0

    result = 1
    for i in range(1, count_max + 1):
        if count[i] == 0:
            return 0
        n_childs = count[i]
        n_parents = count[i-1]
        ptn = n_parents ** n_childs
        result *= ptn
        result %= P
    return result

if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))


Measured memory_bytes: 63340
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define mod 1e9 +7;
typedef long long ll;
typedef vector<ll> vll;
const double phi = (1 + sqrt(5)) / 2;
const double phi_ = (1 - sqrt(5)) / 2;
ll fib(ll n){
    double res = pow(phi, n+1) - pow(phi_, n+1);
    return res / sqrt(5);
}
ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}
ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}
string to_bin_string(ll n){
    stringstream ss;
    ss << bitset<8>(n); //任意の桁数<m>
    string s = ss.str();
    return s;
}
int main()
{
    ll n; cin >> n;
    string s;
    cin >> s;
    ll cnt = 0;
    vll e(n, 0), w(n, 0), c(n);
    REP(i,1,n){
        if(s[i-1] == 'E')cnt++;
        e[i] = cnt;
    }
    cnt = 0;
    REPR(i,n-2,0){
        if(s[i+1] == 'W')cnt++;
        w[i] = cnt;
    }
    rep(i,n)c[i] = e[i] + w[i];
    ll mj = 0, r= 0;
    rep(i,n)if(c[i] > c[mj])mj = i;

    rep(i,n){
        if(i < mj && s[i] == 'W')r++;
        else if(i > mj && s[i] == 'E')r++;
    }
    cout << r << endl;
    return 0;
} 

Measured memory_bytes: 7684
# -*- coding: utf-8 -*-
"""
A - BBQ Easy
https://atcoder.jp/contests/agc001/tasks/agc001_a

"""
import sys


def solve(N, L):
    ans = 0
    while L:
        a = L.pop()
        b = L.pop()
        ans += min(a, b)
    return ans


def main(args):
    N = int(input())
    L = sorted(map(int, input().split()))
    ans = solve(N, L)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

int main(){
  int64_t N;
  cin >> N;
  vector<int64_t> traf(5);
  for(int i=0; i<5; i++){
    cin >> traf.at(i);
  }

  int min_traf = 0;
  int64_t min_abord = traf.at(0);

  for(int i=1; i<=4; i++){
    if(traf.at(i) < min_abord){
      min_traf = i;
      min_abord = traf.at(i);
    }
  }

  int64_t max_time = N / min_abord;
  if(N % min_abord != 0){
    max_time++;
  }
  
  int64_t ans = min_traf + max_time + (4 - min_traf);
  cout << ans << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  bool ok=false;
  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
      if(N==i*j){
        ok=true;
      }
    }
  }
  if(ok){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}

      


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
int h, w;
vector<string> mp;
long long ans = 0;
vector<vector<bool>> used;
int hx[4] = {0, 0, 1, -1};
int hy[4] = {1, -1, 0, 0};
pair<int, int> dfs(int i, int j, char c) {
  if (used[i][j])
    return make_pair(0, 0);
  if (mp[i][j] != c)
    return make_pair(0, 0);
  used[i][j] = true;
  pair<int, int> ret;
  char d = c == '#' ? '.' : '#';
  for (int k = 0; k < 4; k++) {
    int y = i + hy[k], x = j + hx[k];
    if (y < 0 || y >= h || x < 0 || x >= w)
      continue;
    auto p = dfs(y, x, d);
    ret.first += p.first;
    ret.second += p.second;
  }
  if (c == '#')
    ret.first++;
  else
    ret.second++;
  return ret;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> w;
  mp.resize(h);
  used.resize(h);
  for (int i = 0; i < h; i++) {
    used[i].resize(w);
    cin >> mp[i];
  }
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) {
      if (used[i][j])
        continue;
      auto p = dfs(i, j, mp[i][j]);
      ans += (ll)p.first * p.second;
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 12928
//yukicoder@cpp14
//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
template <typename T>
T gcd(T a,T b){
  if(a%b==0)return b;
  else return gcd(b,a%b);
}
template <typename T>
T lcm(T a,T b){
  return a/gcd(a,b)*b;
}
int dp[200][200];
struct z{
	int a,b,c;
};
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
	int n,c;cin>>n>>c;
	int m = 0;
	for(int i = 0; c > i; i++){
		int t;cin>>t;m+=t;
	}
	cout << (m-1)/(n+1)+1 << endl;
}


Measured memory_bytes: 3204
#include <iostream>
#include <cstdlib>
#include <utility>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>

#define INF (1e9)
#define rep(i, n) for (int i = 0; i < (int)n; i++)

using namespace std;

int main() {
    int n; cin >> n;
    int k; cin >> k;
    vector <int> a(n, 0); 
    rep(i, n) {
        cin >> a[i];
    }   
    int ans = 0;
    rep(i, n) {
        if (a[i] >= k) ans++;
        else continue;
    }   
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

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

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    cout << 800 * n - ( n / 15 * 200 ) << endl;
    return 0;
}



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

void solve()
{
    int n;
    cin >> n;
    vector<int> t(n);
    rep(i, n) cin >> t[i];
    int m;
    cin >> m;
    rep(i, m)
    {
        int p, x;
        cin >> p >> x;
        p--;
        int sum = 0;
        int tmp = t[p];
        t[p] = x;
        rep(j, n) sum += t[j];
        cout << sum << endl;
        t[p] = tmp;
    }
}

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

Measured memory_bytes: 3608
def main():
    H, W, M = map(int, input().split())
    targets = set()
    totalH = [0] * H
    totalW = [0] * W
    for _ in range(M):
        h, w = map(lambda x: int(x)-1, input().split())
        totalH[h] += 1
        totalW[w] += 1
        targets.add((h, w))
    maxH = max(totalH)
    maxW = max(totalW)
    maxHindex = set()
    maxWindex = set()
    for i in range(H):
        if totalH[i] == maxH:
            maxHindex.add(i)
    for i in range(W):
        if totalW[i] == maxW:
            maxWindex.add(i)
    relatedTargets = set()
    for h, w in targets:
        if h in maxHindex and w in maxWindex:
            relatedTargets.add((h, w))
    if len(relatedTargets) == len(maxHindex) * len(maxWindex):
        print(maxH + maxW - 1)
    else:
        print(maxH + maxW)


if __name__ == "__main__":
    main()


Measured memory_bytes: 183604
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()	{
  int n;
  cin >> n;
  int t[n], a[n];
  for (int i = 0; i < n; i++)	{
	cin >> t[i];
	cin >> a[i];
  }
  long long A = 1, B = 1;
  long long total = 0;
  for (int i = 0; i < n; i++)	{
	long long x = t[i], y = a[i];
  	long long n = max((A - 1) / x + 1, (B - 1) / y + 1);
    A = n * x;
	B = n * y;
  }
  total = A + B;
  cout << total << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int a[100009];
int res[100009];
/*lets try to understand how to write recursive eqn for the current problem
 mincost(i,n)={min(a[i+1]-a[i]+mincost(i+1,n),a[i+2]-a[i]+mincost(i+2,n)) if i<n
                  ,0 if i>=n}         
 */
int mincost(int i)
{
  		if(i>=n)
		 return 0;
	 if(res[i]>=0)
	   return res[i];
	
  if(i<n-1)
  res[i]=min(abs(a[i+1]-a[i])+mincost(i+1),abs(a[i+2]-a[i])+mincost(i+2));
  else
    res[i]=abs(a[i+1]-a[i])+mincost(i+1);
 return res[i]; 
}
int main()
{  
for(int i=1;i<=100000;i++)
    res[i]=-1;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	 cout<<mincost(1);
}


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

int main() {
  string A, B;
  cin >> A >> B;
  if (A.size() != B.size()) {
      cout << (A.size() < B.size() ? "LESS" : "GREATER") << endl;
      return 0;
  }
  if (A < B) cout << "LESS" << endl;
  else if (B < A) cout << "GREATER" << endl;
  else cout << "EQUAL" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll x;
  cin>>x;
  ll am=100,r=1,ans=1,j=1;
  am=am*(pow((1+r/100.0),ans));
  while(am<x)
  {
      ++j;
      am=am*(pow((1+r/100.0),ans));
  }
  //cout<<am<<'\n';
  cout<<j;
  return 0;
}

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

int main() {
  int n; cin >> n;
  int sum = 0;

  int minNum,maxNum;
  for(int i = 0; i < n; ++i){
    cin >> minNum >> maxNum;
    if(minNum == maxNum) {sum++;}
    else {sum += maxNum - minNum +1;}
  }
  cout << sum << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <atcoder/all>

using ll = long long int;
const int INF = (1<<25);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll x[1111][2];

int main(void){
	int n,i,f,j,g;
	ll d;
	std::cin >> n >> d;
	atcoder::two_sat ts(n);
	for(i=0; i<n; ++i){
		for(f=0; f<2; ++f){
			std::cin >> x[i][f];
			for(j=0; j<i; ++j){
				for(g=0; g<2; ++g){
					if(abs(x[i][f]-x[j][g])<d){
						ts.add_clause(i,!f,j,!g);
					}
				}
			}
		}
	}
	auto ans = ts.satisfiable();
	if(!ans){
		std::cout << "No" << std::endl;
		return 0;
	}
	std::cout << "Yes" << std::endl;
	auto v = ts.answer();
	for(i=0; i<n; ++i){
		std::cout << x[i][v[i]] << std::endl;
	}
	return 0;
}


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

int main() {
	int ajou, asu, ari, aei, S ;/*A???????????????*/
	int bjou, bsu, bri, bei, T ;/*B???????????????*/
	scanf("%d%d%d%d", &ajou, &asu, &ari, &aei);
	scanf("%d%d%d%d", &bjou, &bsu, &bri, &bei);
	S = ajou + asu + ari + aei ;
	T = bjou + bsu + bri + bei ;
	if(S>T)
	{
		printf("%d\n",S);
	}else if(S<T){
		printf("%d\n",T);
	}else{
		printf("%d\n",S);
	}
	
	return 0;
}

Measured memory_bytes: 1188
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(s, t) = in.readLine().split("\\s+")

    out.println(t + s)

    out.flush()
  }
}


Measured memory_bytes: 25392
import java.util.Scanner;

class Main {
    private static void solve() {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();

        for (int i = 0; i < k; i++) {
            int btop = 0;
            int ctop = 0;
            boolean yes = true;
            for (int j = 0; j < 10; j++) {
                int n = scanner.nextInt();
                if (n > btop) {
                    btop = n;
                } else if (n > ctop) {
                    ctop = n;
                } else {
                    yes = false;
                }
            }
            System.out.println(yes ? "YES" : "NO");
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 12000
using System;
using System.Linq;

class Program
{
    static void Main(string[] args) {
        int n = int.Parse(Console.ReadLine());
        Console.WriteLine(solve(n));
    }
    static long solve(int n) {
        long[] l = new long[n+1];
        l[0] = 2;
        l[1] = 1;
        for(int i = 2; i <= n; i ++) l[i] = l[i-1] + l[i-2];
        return l[n];
    }
}

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

int max(int x,int y)
{
	if (x<y) return y; else return x;
}

int main()
{
	int h,n;
	int hurt[10009],cost[10009];
	int dp[50000];
	scanf("%d%d",&h,&n);
	int i,j;
	for (i=1;i<=n;i++) 	scanf("%d%d",&hurt[i],&cost[i]);
	
	memset(dp,0x7f,sizeof(dp));
	
	dp[0]=0;
	for (i=0;i<=h;i++)
		for (j=1;j<=n;j++)	
			if (dp[max(0,i-hurt[j])]+cost[j]<dp[i])
				dp[i]=dp[max(0,i-hurt[j])]+cost[j];
	
	printf("%d",dp[h]);
	return 0; 
}



Measured memory_bytes: 384
from collections import Counter
n= int(input())
if n==1:
  print(1)
  exit()
xy=[[int(x) for x in input().split()] for _ in range(n)]
gr = [[[0,0]for _ in range(n)]for _ in range(n)]
for i in range(n):
  a,b = xy[i]
  for j in range(n):
    gr[i][j] = [xy[j][0]-a,xy[j][1]-b]
gr1 = []
for i in gr:
  for j in i:
    gr1.append(tuple(j))
#print(gr1)
c = Counter(gr1)
l,f = c.most_common()[0]
if l!=(0,0):
  print(n-f)
else:
  l,f = c.most_common()[1]
  print(n-f)

Measured memory_bytes: 41392
n = int(input())
ab = []
for i in range(n):
    ab_i = map(int, input().split())
    ab.append(list(ab_i))

# bについてソート
ab = sorted(ab, key=lambda x: x[1])
sumNeed = 0
for item in ab:
    sumNeed += item[0]
    if sumNeed > item[1]:
        print('No')
        exit()

print('Yes')


Measured memory_bytes: 55184
/*
 *    author:  gantheory
 *    created: 2018-06-03 20:00:24
 */
#include <bits/stdc++.h>

using namespace std;

int n;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.setf(ios::fixed), cout.precision(9);
  cin >> n;
  int ans = INT_MAX;
  for (int i = 1; i < n; ++i) {
    string a = to_string(i), b = to_string(n - i);
    int now = 0;
    for (int j = 0; j < (int)a.size(); ++j) now += a[j] - '0';
    for (int j = 0; j < (int)b.size(); ++j) now += b[j] - '0';
    ans = min(ans, now);
  }
  cout << ans << '\n';
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define I(x, a) for(auto x : a)
#define F(i, l, r) for(auto i = l; i < r; ++i)
#define DF(i, l, r) for(auto i = l; i > r; --i)
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define all(x) x.begin(),x.end()
#define ret return
#define cont continue
#define brk break
#define ins insert
#define sz(a) ((int)(a).size())

typedef long long ll;
typedef unsigned long long ull;
typedef long double dbl;
typedef pair <int, int> pii;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)1e9 + 7;
const dbl eps = (dbl)1e-8;
const int maxn = (int)1e5 + 5;
const dbl pi = acos(-1);

int k;
ll a[maxn];

int main() {
//    fin("t.in");
    sync;
    cin >> k;
    F(i, 0, k) {
    	cin >> a[i];
    }
    ll l = 2, r = 2;
    DF(i, k - 1, -1) {
    	ll tl, tr;
    	tl = ((l / a[i]) + (l % a[i] != 0)) * a[i];
    	tr = (r / a[i]) * a[i] + a[i] - 1;
    	l = tl;
    	r = tr;
    }
    if (l <= r) {
    	cout << l << " " << r << endl;
	} else {
		cout << -1 << endl;
	}

    return 0;
}

Measured memory_bytes: 1024
n, m = map(int, input().split())
c = [0]*(m+1)
for i in range(n):
    a = list(map(int, input().split()))
    for j in a[1:]:
        c[j] += 1

ans = 0
for i in range(1, m+1):
    if c[i] == n:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    for(int i=1;i<n+1;i++){
        if(i%3==0)
            cout << " " << i << flush;
        else{
            int j=i;
            while(j>1){
                if(j%10==3){
                    cout << " " << i << flush;
                    break;
                }
                else
                    j=j/10;
            }
        }
    }
    cout << endl;
}


Measured memory_bytes: 3096
#include<iostream>
using namespace std;
int main () {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  int af = A * X + B * Y;
  int bf, cf;
  if (X > Y) {
    bf = 2 * C * Y + A * (X - Y);
    cf = 2 * C * X;
  }
  else {
    bf = 2 * C * X + B * (Y - X);
    cf = 2 * C * Y;
  }
  int ans = af;
  //cout << af << ' ' << bf << ' ' << cf << endl;
  if (ans > bf) ans = bf;
  if (ans > cf) ans = cf;
  cout << ans << endl;
}



Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a<b){
            System.out.println("a < b");
        }else if(a==b){
            System.out.println("a == b");
        }else{
            System.out.println("a > b");
        }
    }
}


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

int main() {
	int n; cin >> n;
	set<int> st;
	rep(i, n) {
		int a; cin >> a;
		st.insert(a);
	}
	if (st.size() == n) puts("YES");
	else puts("NO");
	return 0;
}


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

int main(){
    int N,K; cin >> N >> K;
    int a[N];
    for(int i=0;i<N;i++) cin >> a[i];
    bool dp[K+1];
    dp[0]=false;
    for(int i=1;i<=K;i++){
        dp[i]=false;
        for(int j=0;j<N;j++){
            dp[i] |= a[j]<=i && !dp[i-a[j]];
        }
    }
    //for(int i=0;i<=K;i++){
        //cout << dp[i] << endl;
    //}
    if(dp[K]==1){
        cout << "First" << endl;;
    }else{
        cout << "Second" << endl;
    }

}

Measured memory_bytes: 384
# coding: utf-8

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

for i in range(10000):
    if i % 2 == 0:
        c -= b
    else:
        a -= d
    if a <= 0:
        print('No')
        break
    if c <= 0:
        print('Yes')
        break

Measured memory_bytes: 9172
n = int(input())

for i in range(1, n + 1):
    x = i
    if(x % 3 == 0):
        print(' {}'.format(i), end = '')
        continue
    while x:
        if x % 10 == 3:
            print(' {}'.format(i), end = '')
            x = 0
            break
        x //= 10
print('')


Measured memory_bytes: 5872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)




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

  int n;
  cin >> n;
  string s[n];
  rep(i,n) cin >> s[i];
  bool ok=false;
  rep(i,n)rep(j,n) if(s[i][j]=='#') ok=true;
  if(!ok){
    cout << -1 << endl;
    return 0;
  }
  int r,c;
  r=c=0;
  rep(i,n){
    rep(j,n){      
      if(s[i][j]!='#'){
	break;
      }
      if(j==n-1) r++;
    }
    rep(j,n){
      if(s[j][i]!='#'){
	break;
      }
      if(j==n-1) c++;
    }    
  }
  int ans=INT_MAX;
  if(r>0){
    ans = n-c;
    cout << ans << endl;
    return 0;
  }
  int cou=n;
  rep(i,n){
    int tc=0;
    rep(j,n){
      if(s[i][j]=='.') tc++;     
    }
    if(s[i][i]=='.'){
      rep(j,n){
	if(s[j][i]=='#'){
	  --tc;
	  break;
	}
      }
    }
    //    cout << tc+1-((s[i][i]=='#')?1:0) << endl;
    cou = min(cou,tc+1-((s[i][i]=='#')?1:0));
  }/*
  rep(i,n){
    int	tc=0;
    rep(j,n){
      if(s[j][i]=='.') tc++;
    }
    if(s[i][i]=='.'){
      rep(j,n){
	if(s[i][j]=='#'){
          --tc;
          break;
	}
      }
    }    
    cou	= min(cou,tc+1-((s[i][i]=='#')?1:0));
    //    cout << cou << endl;
    }*/
  ans = min (ans, n-c+cou);
  cout << ans << endl;

  
  return 0;
    

}


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

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

  int ans = 0;

  for (int i = 0; i < N; i++) {
    set<char> X(S.begin(), S.begin() + i), Y(S.begin() + i, S.end());
    int A = 0;
    for (char c = 'a'; c <= 'z'; c++) {
      if(X.count(c) && Y.count(c)) A++;
    }
    ans = max(ans, A);
  }

  cout << ans << endl;
}

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

int main()
{
    int h, w;
    cin >> h >> w;
    vector<vector<int>> suml, sumr, sumu, sumd;
    suml.assign(h, vector<int>(w));
    sumr.assign(h, vector<int>(w));
    sumu.assign(h, vector<int>(w));
    sumd.assign(h, vector<int>(w));

    vector<string> s(h);
    rep(i, h) cin >> s[i];
    // lu
    rep(i, h) rep(j, w)
    {
        if (s[i][j] == '#')
        {
            suml[i][j] = 0;
            sumu[i][j] = 0;
        }
        else
        {
            if (j == 0)
                suml[i][j] = 1;
            else
                suml[i][j] = suml[i][j - 1] + 1;
            if (i == 0)
                sumu[i][j] = 1;
            else
                sumu[i][j] = sumu[i - 1][j] + 1;
        }
    }
    // rd
    for (int i = h - 1; i >= 0; --i)
        for (int j = w - 1; j >= 0; --j)
        {
            if (s[i][j] == '#')
            {
                sumr[i][j] = 0;
                sumd[i][j] = 0;
            }
            else
            {
                if (j == w - 1)
                    sumr[i][j] = 1;
                else
                    sumr[i][j] = sumr[i][j + 1] + 1;
                if (i == h - 1)
                    sumd[i][j] = 1;
                else
                    sumd[i][j] = sumd[i + 1][j] + 1;
            }
        }

    int ans = 1;
    rep(i, h) rep(j, w)
        ans = max(ans, suml[i][j] + sumr[i][j] + sumu[i][j] + sumd[i][j] - 3);
    cout << ans << endl;
}

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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> A(N);
	for (auto& e: A) scanf("%d", &e);
	std::sort(A.begin(), A.end());
	A.erase(std::unique(A.begin(), A.end()), A.end());
	if (A.size() == N) puts("YES");
	else puts("NO");

	return 0;
}

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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int a,b;
  cin >> a >> b;
  int c=max(a,b);
  if(c>8)
    cout << ":(" << endl;
  else
    cout << "Yay!" << endl;
}


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

public class Main {
    FastScanner in;
    PrintWriter out;

    void solve() {
        String s = in.next();
        String[] arr = s.split(",",3);
        out.println(arr[0]+' '+arr[1]+' '+arr[2]);
    }

    void run() {
        try {
            in = new FastScanner(new File("test.in"));
            out = new PrintWriter(new File("test2.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

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

    public static void main(String[] args) {
        new Main().runIO();
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
const int N = 1e5;
int a[N];

int main() {
    int n, k; scanf("%d%d", &n, &k);
    if(n < k + k - 1) puts("-1");
    else {
        int t = 0;
        for(int i = 0; i < k; ++ i) {
            printf("%d %d %d\n", k+i,  n*2+i, k+i*2+n*2);
            a[t++] = k + i*2 + n*2 + 1;    
        }
        for(int i = 0; i < t && i+k < n; ++ i) {
            printf("%d %d %d\n", i+k*2, k+n+i, a[i]);
        }
        int tmp = 3*k+n*2;
        for(int i = k*2 + t; i < n+k; ++ i) {
            printf("%d %d %d\n", i, n-k+i, tmp++);
        }
    }
   // int amo; std::cin >> amo;
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
const int N=10010;
int main()
{
	int n;
	while(cin>>n)
	{
		int a[N],b[N],c[N];
		for(int i=1;i<=n-1;i++)
			cin>>b[i];
		for(int i=2;i<=n-1;i++)
		{
			c[i]=min(b[i],b[i-1]);
		}
		c[1]=b[1],c[n]=b[n-1];
		int sum=0;
		for(int i=1;i<=n;i++)
		{
			sum+=c[i];
		}
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
int dp[100001]={};
int dp2[100001]={};

int main() {
	string s;
	cin>>s;
	int r=0;
	int n=s.size();
	rep(i,n/2){
		if(s[i]!=s[n-1-i])r++;
	}
	printf("%d",r);

	return 0;
}


Measured memory_bytes: 2560
#!/usr/bin/env python3
import sys

def solve(r: int, D: int, x: int):
    arr = []
    arr.append(x)
    for i in range(10):
        arr.append(r * arr[i] - D)
        print(arr[i + 1])
    

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    r = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    solve(r, D, x)



if __name__ == '__main__':
    main()


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

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
ll a[3];
int main() {
    std::cin >> a[0]>>a[1]>>a[2];
    sort(a,a+3);
    std::cout << a[2]*10+a[1]+a[0] << std::endl;
}


Measured memory_bytes: 764
import sys

(row, column) = sys.stdin.readline().rstrip('\r\n').split(' ')
row = int(row)
column = int(column)

a = []
b = []
c = []

for ii in range(row):
  a.append([int(x) for x in input().rstrip('\r\n').split(' ')])

for ii in range(column):
  b.append(int(input().rstrip('\r\n')))

for ii in range(len(a)):
  work = 0
  for jj in range(len(a[ii])):
    work += a[ii][jj] * b[jj]
  c.append(work)

for cc in c:
  print(cc)



Measured memory_bytes: 6024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
int a[100005];
int b[100005],c[100005];
ll ans;
int main(void){
	cin>>n>>m;
	map<ll,ll> M;
	for(int i=0;i<n;i++){
		cin>>a[i];
		M[a[i]]++;
	}
	for(int i=0;i<m;i++){
		cin>>b[i]>>c[i];
		M[c[i]]+=b[i];
	}
	map<ll,ll>::iterator ite;
	ite=M.end();
	ite--;
	//cout<<n<<" "<<ite->second<<endl;
	while(true){
		if(n>=ite->second){
			ans=ans+ite->second*ite->first;
			n=n-ite->second;
			//cout<<ans<<" "<<n<<endl;
		}else{
			ans=ans+n*ite->first;
			n=0;
			//cout<<ans<<" "<<n<<endl;
		}
		if(n==0){
			cout<<ans<<endl;
			return 0;
		}
		ite--;
	}
	
	
}


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

int main(){
  int n,i,ans=0,cur=0,res=0;
  
  string s;
  cin >> s;
  n=s.size();
  for(i=0; i<n; i++){
    if(i%2==0 && s[i]=='0' || i%2==1 && s[i]=='1'){
      cur++;
    }
  }
  cout << min(cur,n-cur);
}
  

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define FOR(i, N) for (long i = 0; i < (N); i++)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    long D;
    cin >> N >> D;

    long X_i, Y_i;
    int count = 0;
    long D_2, L_2;

    FOR(i, N) {
        cin >> X_i >> Y_i;
        L_2 = X_i * X_i + Y_i * Y_i;
        D_2 = D * D;
        if (L_2 > D_2) {
            continue;
        } else {
            count += 1;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3640
#include <cstdio>
#include <cstring>
#include <cmath>
#define EPS 1e-3
int n;
double x[501],y[501];
bool flag[501];
int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=1;i<=n;i++){
			scanf("%lf %lf",&x[i],&y[i]);
		}
		memset(flag,false,sizeof(flag));
		double len=0.0,mang,ll;
		int v=0,p=-1,next=-1;
		flag[0]=true;
		for(int i=0;i<n;i++){
			double ang;
			if(p!=-1)ang=atan2(y[v]-y[p],x[v]-x[p]);
			else ang=M_PI/2.0;
			//printf("%f\n",ang);
			for(int j=1;j<=n;j++){
				if(flag[j])continue;
				double ang2=atan2(y[j]-y[v],x[j]-x[v]);
				double ang3=ang-ang2;
				if(ang3+EPS<0)ang3+=M_PI*2;
				if(next==-1 || mang>ang3){
					mang=ang3;
					ll=sqrt((y[j]-y[v])*(y[j]-y[v])+(x[j]-x[v])*(x[j]-x[v]));
					next=j;
				}else if(mang==ang3 && sqrt((y[j]-y[v])*(y[j]-y[v])+(x[j]-x[v])*(y[j]-y[v]))<ll){
					ll=sqrt((y[j]-y[v])*(y[j]-y[v])+(x[j]-x[v])*(x[j]-x[v]));
					next=j;
				}
				//printf("%d %d %f %f %f %f\n",j,next,y[j]-y[v],x[j]-x[v],ang2,ang3);
			}
			len+=ll;
			flag[next]=true;
			//printf("%d %d %d %f\n",p,v,next,len);
			p=v;
			v=next;
			next=-1;
		}
		printf("%.1f\n",len);
	}
	return 0;
}

Measured memory_bytes: 1192