akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
    int field[14][14] = {0};
    int x,y,p,i,j,count=0,max=0;

    while(scanf("%d,%d,%d",&x,&y,&p) != EOF) {
        field[x+2][y+2]++;
        if(p == 1){
            field[x+1][y+2]++;
            field[x+3][y+2]++;
            field[x+2][y+1]++;
            field[x+2][y+3]++;
        }
        else if(p == 2){
            for(i = y+1; i <= y+3; i++){
                for(j = x+1; j <= x+3; j++){
                    field[j][i]++;
                }
            }
            field[x+2][y+2]--;
        }
        else if(p == 3){
            for(i = y+1; i <= y+3; i++){
                for(j = x+1; j <= x+3; j++){
                    field[j][i]++;
                }
            }
            field[x+2][y+2]--;
            field[x][y+2]++;
            field[x+2][y]++;
            field[x+2][y+4]++;
            field[x+4][y+2]++;
        }
    }
    for(y = 2; y < 12; y++){
        for(x = 2; x < 12; x++){
            if(field[x][y] == 0)count++;
            if(field[x][y] > max) max = field[x][y];
        }
    }
    printf("%d\n%d\n",count,max);

    return 0;
}

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

int main () {
    
    int H, W;
    for (int i = 0;; i++) {
        cin >> H >> W;
        if (H == 0 && W == 0) break;

        for (int j = 0; j < H; j++) {
            for (int k = 0; k < W; k++) {
                if ((j+k)%2 == 0) {
                    cout << "#";
                }
                else {
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }

    return 0;
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[100005];

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

int main()
{
    int N;
    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
    }
    sort(A, A + N);
    int mi = 0;
    REP(i, N)
    {
        if (gcd(A[0], A[mi]) > gcd(A[0], A[i]))
            mi = i;
    }
    if (mi == 0)
        mi = 1;

    ll max = 0;
    {
        ll m = A[1];
        FOR(i, N, 1)
        {
            m = gcd(A[i], m);
        }
        max = std::max(max, m);
    }
    {
        ll m = A[0];
        REP(i, N)
        {
            if (i == mi)
                continue;
            m = gcd(A[i], m);
        }
        max = std::max(max, m);
    }
    cout << max << endl;

    return 0;
}

Measured memory_bytes: 1024
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

#print((v-w) // (b-a), v-w, b-a)
#if (abs(v-w)*t) % abs(b-a) == 0:
if abs(b-a) <= (v-w)*t:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9112
import sys
n = int(input())
a = list(map(int, input().split()))
ans = 1
if min(a) == 0:
    print(0)
    sys.exit()
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        sys.exit()
print(ans)

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

public class Main {
	public static void main(String[] age) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer sb = new StringBuffer();

		String[] Ginput = br.readLine().split(" ");
		int n = Integer.parseInt(Ginput[0]);
		int m = Integer.parseInt(Ginput[1]);
		int i = 0;
		int j = 0;
		int matrix[][] = new int[n][m];
		int mul[] = new int[m];
		int ans[] = new int[n];

		for( i=0 ; i<n ; i++ ){
			String[] input = br.readLine().split(" ");
			for( j=0 ; j<m ; j++ ){
				matrix[i][j]=Integer.parseInt(input[j]);
			}
		}

		for( i=0 ; i<m ; i++ ){
			mul[i] = Integer.parseInt(br.readLine());
		}

		for( i=0 ; i<n ; i++ ){
			for( j=0 ; j<m ; j++ ){
				int k = matrix[i][j] * mul[j];
				ans[i] = ans[i] + k;
			}
			sb.append(Integer.toString(ans[i])).append("\n");
		}

		System.out.print(sb);
	}
}

Measured memory_bytes: 27160
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  int max=0,min=1000000000;
  for(int i=0;i<n;i++){
    cin >> v[i];
    if(max<v[i]) max=v[i];
    if(v[i]<min) min=v[i];
  }
  cout << max-min << "\n";
  
  return 0;
}


Measured memory_bytes: 256
//https://pyteyon.hatenablog.com/entry/2019/03/11/200000

// ABC075_C
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>  // std::swap()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define pll pair<ll, ll>
#define F first
#define S second

class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N, M, a, b;
    cin >> N >> M;
    vector<pll> vec(M);
    REP(i, M) {
        cin >> a >> b; --a, --b;
        vec[i].F = a;
        vec[i].S = b;
    }

    // calculation
    UnionFind uf(N);
    ll res = 0;
    REP(i, M) {
        uf.init(N);
        REP(j, M) {
            if (j == i) continue;
            uf.merge(vec[j].F, vec[j].S);
        }
        if (uf.size(0) < N) res++;
    }

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Collections;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var ir = new Resolver(new ConsoleReader());
            Console.WriteLine(ir.Resolve());
        }
    }

    public class Resolver
    {
        IInputReader InputReader { get; }
        public List<string> Messages { get; set; } = new List<string>();

        int n;
        List<long[]> ls = new List<long[]>();

        public void ParseLines() {
            n = int.Parse(InputReader.ReadLine());
            foreach (var i in Enumerable.Range(0, n))
            {
                ls.Add(InputReader.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray());
            }

        }

        public class Table
        {
            public long PointA { get; set; } = 0;
            long[] A { get; }
            long[] B { get; }
            int[] _dishes;

            public Table(long[] a, long[] b, int ndish)
            {
                this.A = a;
                this.B = b;
                this._dishes = Enumerable.Range(0, ndish).ToArray();
            }

            public long CalculatePoint()
            {
                PointA = _dishes
                .Select(x => A[x] + B[x])
                .OrderBy(x => -x)
                .Where((x, i)=> i % 2 == 0 ).Sum();

                PointA -= B.Sum(x => x);
                return PointA;
            }


        }


    public class Person{
            public long[] Taste { get; }
            public long HappyScore { get; set; } = 0;

            public Person(long[] taste)
            {
                Taste = taste;
            }

        }


        public string Resolve()
        {
            var range = Enumerable.Range(0, n);

            var a = range.Select(i => ls[i][0]).ToArray();
            var b = range.Select(i => ls[i][1]).ToArray();

            var table = new Table(a, b, n);

            return table.CalculatePoint().ToString();
        }


        public Resolver(IInputReader inputReader)
        {
            InputReader = inputReader;
            ParseLines();
        }

    }

    public interface IInputReader
    {
        string ReadLine();
    }

    class ConsoleReader : IInputReader
    {
        string IInputReader.ReadLine()
        {
            return Console.ReadLine();
        }
    }
}


Measured memory_bytes: 31412
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define pi  acos(-1)
const int w=2e5+5;
const ll mod=1e9+7;
int main()
{
    int i,j;
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans=n/(a+b)*a;
    ans+=min(n%(a+b),a);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

int n;
cin >> n;
string s;
cin >> s;

ll r = 0, g = 0, b = 0;
rep(i,n) {
    if(s[i] == 'R') r++;
    if(s[i] == 'G') g++;
    if(s[i] == 'B') b++;
}
ll cnt = 0;
for(int i = 0; i < n-2; ++i) {
    for(int j = i + 1; j < n-1; ++j) {
        int k = 2*j - i;
        if(j < k && k < n) {
            if(s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) cnt++;
        }
    }
}
cout << r*g*b - cnt << endl;
return 0;
}

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

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}
 int main(int argc, char const *argv[])
{
	int P[3],n,f=1;
	for(int i=0;i<3;i++)scanf("%d" ,P+i);
qsort(P, 3, sizeof(int), asc);
for (int i = 0; i < 3; ++i)
{
	if(n==P[i])f++;
	/* code */
	n=P[i];
}

if(f==2)
printf("Yes\n");
else
printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define IL inline
#define rep(i,j,k) for(int i=j;i<=k;++i)
#define repd(i,j,k) for(int i=j;i>=k;--i)
#define pb push_back
#define db double
#define mp make_pair
#define mp3(a,b,c) mp(mp(a,b),c)
#define pii pair<int,int>
#define piii pair<pii,int>
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pbc(x) __builtin_popcount(x)
#define clr(x) memset(x,0,sizeof x)
#define SIZE(x) (int)(x.size())
const int mod=1e9+7;
IL int pls(int x,int y){x+=y;return x>=mod?x-mod:x;}
IL int dec(int x,int y){x-=y;return x<0?x+mod:x;}
IL int mul(int x,int y){return 1ll*x*y%mod;}
IL int mul(int x,int y,int z){return mul(mul(x,y),z);}
IL int mul(int x,int y,int z,int p){return mul(mul(x,y),mul(z,p));}
IL void add(int &x,int y){x+=y;x=(x>=mod)?x-mod:x;}
IL int fpw(int x,int y,int r=1){for(;y;y>>=1,x=mul(x,x))if(y&1)r=mul(r,x);return r;}
IL int inv(int x){return fpw(x,mod-2);}
IL int gi(){int x;int _w=scanf("%d",&x);return x;}
IL void gi(int &x){int _w=scanf("%d",&x);}
IL void write(int x){printf("%d\n",x);}
void chkmax(int &x,int y){x=(x>y)?x:y;}
void chkmin(int &x,int y){x=(x<y)?x:y;}
const int INF=0x3f3f3f3f;
template<typename T>IL void debug(T x){cerr<<x;return;}
/* --------------------------------------------------------------------------------------------------------- */
const int maxn=1e5+10;
int n;
int pri[maxn],fl[maxn];
IL void sieve(){
	rep(i,2,maxn-1){
		if(!fl[i])pri[++pri[0]]=i;
		for(int j=1;i*pri[j]<maxn;++j){
			fl[i*pri[j]]=1;
			if(i%pri[j]==0)break;
		}
	}
}
map<ll,int>num,rev;
const ll MaxL=1e10;
ll R(ll a, ll b){return b;}
ll A[maxn],B[maxn];
int main(){
#ifdef LOCAL
	freopen("/home/noilinux/Desktop/input.txt","r",stdin);
#endif
	sieve();
	n=gi();
	rep(i,1,n){
		ll ai,X=1,Y=1;
		scanf("%lld",&ai);
		for(int i=1;1ll*pri[i]*pri[i]*pri[i]<=ai;++i){
			int cnt=0;
			while(ai%pri[i]==0)ai/=pri[i],cnt++;
			if(cnt%3==1)X=X*pri[i],Y=R(Y,Y*pri[i]*pri[i]);
			else if(cnt%3==2)X=X*pri[i]*pri[i],Y=R(Y,Y*pri[i]);
		}
		if(ai!=1){
			ll val=sqrt(ai);
			if(val*val==ai)X=X*val*val,Y=R(Y,Y*val);
			else X=X*ai,Y=R(Y,Y*ai*ai);
		}
		num[X]++;
		A[i]=X,B[i]=Y;
	}
	int ans=0;
	rep(i,1,n){
		if(!num[A[i]])continue;
		if(A[i]==B[i])ans++,num[A[i]]=0;
		else ans+=max(num[A[i]],num[B[i]]),num[A[i]]=num[B[i]]=0;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 14720
import java.util.*;

class Main {
    //
    static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] ary = new int[n];
        int[] dif;
        if (n == 1) {
            System.out.println(k);
            return;
        }

        for (int i = 0; i < n; i++) {
            ary[i] = sc.nextInt();
        }
        int ans = 0;
        int count = ary[0];
        for(int i = 1;i < n;i++){
            if(count + k < ary[i]){
                ans += k;
                count = ary[i];
            }else{
                ans += ary[i] - ary[i-1];
                count = ary[i];
            }
        }
        ans += k;
        System.out.println(ans);
    }

}

Measured memory_bytes: 63788
#include<iostream>
#include<cstdio>
#include<string>
#include<map>
using namespace std;
int main(){
  map<string,int> t;
  string s, mxc, mxl;
  int freq = 1, len = 0;
  while(cin >> s){
    if(t.find(s) == t.end()){
      t[s] = 1;
    }
    else{
      t[s]++;
    }

    if(t[s] > freq){
      freq = t[s];
      mxc = s;
    }
    if(s.size() > len){
      len = s.size();
      mxl = s;
    }
  }
  cout << mxc << " " << mxl << endl;
}

Measured memory_bytes: 3064
N = int(input())
uvw = [[int(_) for _ in input().split()] for i in range(N - 1)]

from collections import defaultdict

uv = defaultdict(dict)

for u, v, w in uvw:
    uv[u][v] = w
    uv[v][u] = w
    
l = {1: 0}

s = [1]

while s:
    ns = []
    for i in s:
        for j in uv[i]:
            if not j in l:
                l[j] = l[i] + uv[i][j]
                ns.append(j)
    s = ns

for i in range(1, N + 1):
    print(l[i] % 2)


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	double a, b, x;
	cin >> a >> b >> x;
	double rest = a*a*b - x;
	if (a*a*b/2 > rest) {
	  cout << fixed << setprecision(10) << atan2(rest/a/a*2, a)/M_PI*180 << endl;
	} else if (a*a*b/2 == x) {
	  cout << fixed << setprecision(10) << atan2(b, a)/M_PI*180 << endl;
	} else {
	  cout << fixed << setprecision(10) << atan2(b, x/b/a*2)/M_PI*180 << endl;
	}
}


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

using namespace std;

#define llong long long int
#define ldouble long double
#define ternary(condition, x, y) ((condition) ? x : y) 
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static llong MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

llong dp[210000][5];

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

    int n;
    cin >> n;
    vector<int> A(n);
    rep(i, n) {
        cin >> A[i];
    }

    llong ans = 1000000000000;
    for (int i = -100; i <= 100; ++i) {
        llong tmp = 0;
        rep(j, n) {
            tmp += pow(i - A[j], 2);
        }
        ans = min(ans, tmp);
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
# ABC070D - Transit Tree Path
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def dfs(v: int, p: int) -> None:
    d = dist[v]
    for u, c in G[v]:  # search vertices available from v recursively
        if u != p:  # p: parent
            dist[u] += d + c  # dist(K, v) + dist(v, u) == d + c
            dfs(u, v)


def main():
    global G, dist
    N = int(input())
    E = tuple(tuple(map(int, input().split())) for _ in range(N - 1))
    Q, K = tuple(map(int, input().split()))
    X = tuple(tuple(map(int, input().split())) for _ in range(Q))
    G = [[] for _ in range(N + 1)]  # graph, N+1: 1-idx
    for v, u, c in E:  # construct a graph
        G[v] += [(u, c)]
        G[u] += [(v, c)]
    dist = [0] * (N + 1)  # distance from vertex K
    dfs(K, -1)
    ans = [dist[x] + dist[y] for x, y in X]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

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

int main()
{
	double ans;
	int N;
	int Kisuu, Guusuu;

	cin >> N;

	Guusuu = N / 2;
	Kisuu = Guusuu + (N % 2);

	ans = (double)Kisuu / (double)N;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll ar[500009],br[500009],cr[500009],dr[500009],fr[500009];
int main()
{
    ll q,dr,w,i,j,k,w1,z=0,y,g,h,f=0;
    cin>>q>>dr;
    w=sqrt(q);
    w1=sqrt(dr);
    j=0;k=0;
    for(i=1; i<=w; i++)
    {
       if(q%i==0)
       {
           ar[++j]=i;
           if(i!=(q/i))
           {
               ar[++j]=(q/i);
           }
       }
    }
    for(i=1; i<=w1; i++)
    {
        if(dr%i==0)
       {
           br[++k]=i;
           if(i!=(dr/i))
           {
               br[++k]=(dr/i);
           }
       }
    }
    for(i=1;i<=j;i++)
    {
        for(y=1;y<=k;y++)
        {
            if(ar[i]==br[y])
            {
                cr[++z]=ar[i];
                break;
            }
        }
    }
    sort(cr+1,cr+z+1);
    ll ckk=0,flg=0;
    for(i=1;i<=z;i++)
    {
        ckk=0;
        for(j=1;j<i;j++)
        {
            g=__gcd(cr[i],cr[j]);
            if(g>1)
            {
                ckk=1;
                break;
            }
        }
        if(ckk==0)
        {
            flg++;
        }
    }
    cout<<flg<<endl;
}


Measured memory_bytes: 6400
import math
n = int(input())
p = []
l = []
for _ in range(n):
    x, y = map(int, input().split())
    for i in range(len(p)):
        l.append(math.sqrt((abs(x - p[i][0]) ** 2) + (abs(y - p[i][1]) ** 2)))
    p.append((x, y))
print("{:.10f}".format(sum(l) * (len(p) - 1) / len(l)))

Measured memory_bytes: 3064
#include <stdio.h>

// Util
#define MIN(x, y) ((x) < (y) ? (x) : (y))
//


// I/O
int get_uint() {
    int n = 0;
    int c = getchar_unlocked();
    if(c < 48 || 57 < c) return c;
    while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
    return n;
}
void put_uint(int n) {
    if(!n) {
        putchar_unlocked('0');
        return;
    }
    char buf[11];
    int i = 0;
    while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
    while(i--)putchar_unlocked(buf[i]);
}
//


// Solve
int mcm(int *first, const int N) {
    int dp[N][N];
    for(int i = 0; i < N; ++i)
        for(int j = 0; j < N; ++j) dp[i][j] = 1 << 28;
    for(int i = 0; i < N; ++i) dp[i][i] = 0;
    for(int l = 0; l < N; ++l)
        for(int i = 0; i < N - l; ++i) {
            int j = i + l;
            for(int k = i; k < j; ++k)
                dp[i][j] = MIN(dp[i][j], dp[i][k] + dp[k + 1][j] + first[i] * first[k + 1] * first[j + 1]);
        }
    return dp[0][N - 1];
}

int main(int argc, char **argv) {
    int n = get_uint();
    int m[n + 1];
    for(int i = 0; i < n; ++i) m[i] = get_uint(), m[i + 1] = get_uint();
    put_uint(mcm(m, n));
    putchar_unlocked('\n');
    return 0;
}



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

typedef long long int ll;

ll calcSum(int begin, int end, ll a[]){
  return a[end-1] - a[begin-1];
}

int main(){
  int n;
  cin >> n;
  ll a[n+2];
  
  for(int i = 0 ; i < n+2 ; i++){
    a[i] = 0;
  }
  for(int i = 1 ; i <= n ; i++){
    cin >> a[i];
  }
  for(int i = 1 ; i <= n ; i++){
    a[i] += a[i-1];
  }
  
  int left, middle, right;
  left = 2;
  middle = 3;
  right = 4;

  ll res = (1LL << 60);
  while(middle <= n-1){
    while(1){
      ll sum1 = calcSum(1, left, a);
      ll sum2 = calcSum(left, middle, a);
      if(sum1 >= sum2 || !(left < middle-1)){
	ll _sum1 = calcSum(1, left-1, a);
	ll _sum2 = calcSum(left-1, middle, a);
	if(abs(sum1 - sum2) > abs(_sum1 - _sum2)){
	  left--;
	}
	break;
      }
      left++;
    }

    while(1){
      ll sum1 = calcSum(middle, right, a);
      ll sum2 = calcSum(right, n+1, a);
      if(sum1 >= sum2 || !(right < n)){
	ll _sum1 = calcSum(middle, right-1, a);
	ll _sum2 = calcSum(right-1, n+1, a);
	if(abs(sum1 - sum2) > abs(_sum1 - _sum2)){
	  right--;
	}
	break;
      }
      right++;
    }

    ll sum1 = calcSum(1, left, a);
    ll sum2 = calcSum(left, middle, a);
    ll sum3 = calcSum(middle, right, a);
    ll sum4 = calcSum(right, n+1, a);

    ll minv = min(sum1,min(sum2,min(sum3,sum4)));
    ll maxv = max(sum1,max(sum2,max(sum3,sum4)));

    res = min(res, maxv - minv);
    middle++;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1792
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

W,H = map(int,input().split())
P = [int(input()) for _ in range(W)]
Q = [int(input()) for _ in range(H)]

cost = 0
rest_P = W
rest_Q = H
P.sort()
Q.sort()
INF = 10**10
P.append(INF)
Q.append(INF)
p = 0
q = 0
for _ in range(W+H):
    x,y = P[p],Q[q]
    if x < y:
        cost += x * (rest_Q+1)
        p += 1
        rest_P -= 1
    else:
        cost += y * (rest_P+1)
        q += 1
        rest_Q -= 1
print(cost)

Measured memory_bytes: 11352
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) x.erase(x.begin(), x.begin()+n)
// #define int long long
#define P pair<int, int>
typedef long long ll;

const long long int MOD = 1e9+7;
const int INF = -1;
ll dp[100005][13];

signed main(void) {
	ll N;
	cin >> N;
	vector<ll> H;
	rep(i, N) {
		int tmp;
		cin >> tmp;
		H.pb(tmp);
	}

	string ans = "Yes";
	rep(i, N-1) {
		if (H[i] <= H[i+1]) {
			if (i!=0) {
				if (H[i-1] <= H[i]-1) {
					H[i]--;
				}
			} else {
				H[i]--;
			}

		} else {
			H[i]--;
			if (H[i] <= H[i+1]) {
				if (i != 0) {
					if (H[i-1] <= H[i]) {
					} else {
						ans = "No";
						break;
					}
				}
			} else {
				ans = "No";
				break;
			}
		}
	}

	cout << ans << endl;
	return 0;
}


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

namespace AtCoder.Beginner093
{
    public class ABC093B
    {
        public static void Main(string[] args)
        {

            int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int a = nums[0];
            int b = nums[1];
            int k = nums[2];
            
            for(int i = a; i <= b; i++)
            {
                if(i <= a + k - 1 || i >= b - k + 1)
                {
                    Console.WriteLine(i);
                }
            }
        }
    }
}

Measured memory_bytes: 13396
def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]

N, M, C = map(int, input().split())
B = [0] + list(map(int, input().split()))
ans = 0
for _ in range(N):
    acc = 0
    A = [0] + list(map(int, input().split()))
    for i in range(1, M+1):
        acc += A[i] * B[i]

    if acc + C > 0:
        ans += 1
print(ans)




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

int n,m;
int s[100001];
int a[100001];

int main(){
	scanf("%d%d",&n,&m);
	s[1] = 0;
	for(int i = 2; i <= n; i++){
		scanf("%d",&s[i]);
	}
	for(int i = 0; i < m; i++){
		scanf("%d",&a[i]);
	}

	// convert -> dist from 1st town
	for(int i = 2; i <= n; i++){
		s[i] = s[i-1] + s[i];
	}

	int pos = 1;
	int pre;
	int ans = 0;
	for(int i = 0; i < m; i++){
		pre = pos;
		pos += a[i];
		ans = (ans + abs(s[pos] - s[pre])) % 100000;
	}
	printf("%d\n",ans);

	return 0;
}



Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
	 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
#define clr(a) memset(a,0,sizeof(a))
#define umap unordered_map
#define uset unordered_set
#define fr first
#define sc second
#define pb push_back
#define M int(1e9+7)
#define endl '\n'	
#define largest(a,b,c) (a>b?(a>c? a:c):(b>c? b:c))
#define smallest(a,b,c) (a<b?(a<c? a:c):(b<c? b:c))	

using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;

int dp[100001];
 
int main(){
	fast_io; cout_precision;
	int n,k;	cin >> n >> k;
	int a[n];
	for(int i=0; i<n; i++)	cin >> a[i];
	dp[0] = 0;

	for(int i=1; i<=k; i++){
		dp[k] = 0;
		for(int j=0; j<n; j++){
			if(i-a[j]>=0 && !dp[i-a[j]]){
				dp[i] = 1;	break;
			}
		}
	}
	
	if(dp[k])	cout <<"First"<<endl;
	else	cout <<"Second"<<endl;

	return 0;
}


Measured memory_bytes: 4020
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

template <class T>
class Lazy_Segment_Tree{
	private:
	int n;
	vector<T> date,lazy,L;
	void Set_Lazy(int k,T x){
		if(x) date[k]=L[k]-date[k];
		(lazy[k]+=x)%=2;
	}
	void Push(int k){
		Set_Lazy(k*2+1,lazy[k]);
		Set_Lazy(k*2+2,lazy[k]);
		lazy[k]=0;
	}
	void Fix(int k){
		date[k]=date[k*2+1]+date[k*2+2];
	}
	void Reverse_func(int a,int b,int k,int l,int r){
		if(r<=a||b<=l) return;
		if(a<=l&&r<=b){
			Set_Lazy(k,1);
			return;
		}
		Push(k);
		int m=(l+r)/2;
		Reverse_func(a,b,k*2+1,l,m);
		Reverse_func(a,b,k*2+2,m,r);
		Fix(k);
	}
	public:
	Lazy_Segment_Tree(int n_,vi a){
		n=1;
		while(n<n_) n*=2;
		date=lazy=L=vector<T>(2*n-1);
		L[0]=n;
		for(int i=0;i<n_;i++) date[i+n-1]=a[i];
		for(int i=n-2;i>=0;i--) date[i]=date[i*2+1]+date[i*2+2];
		for(int i=1;i<2*n-1;i++) L[i]=L[(i-1)/2]/2;
	}
	T Reverse(int a,int b){
		Reverse_func(a,b,0,0,n);
		return date[0];
	}
	void Full_Open(){
		for(int i=0;i<2*n-1;i++) cout<<date[i]<<' ';
		cout<<endl;
		for(int i=0;i<2*n-1;i++) cout<<lazy[i]<<' ';
		cout<<endl;
	}
};

int n,q,id=0;
vvi g;
vi l,r,a;

void dfs(int v){
	l[v]=id++;
	for(auto u:g[v]) dfs(u);
	r[v]=id;
}

int main(){
	cin>>n>>q;
	g=vvi(n);
	a=l=r=vi(n);
	for(int i=1;i<n;i++){
		int p;
		cin>>p;
		g[p-1].push_back(i);
	}
	for(int i=0;i<n;i++){
		char c;
		cin>>c;
		if(c=='G') a[i]++;
	}
	dfs(0);
	vi a_(n);
	for(int i=0;i<n;i++) a_[l[i]]=a[i];
	Lazy_Segment_Tree<int> st(n,a_);
	for(int i=0;i<q;i++){
		int v;
		cin>>v;
		v--;
		int L=l[v],R=r[v],t=st.Reverse(L,R);
		if(n/2<t) cout<<"broccoli"<<endl;
		else cout<<"cauliflower"<<endl;
	}
}


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

int main() {
  long long int d;
  cin >> d;
  if (d == 25) {
    cout << "Christmas";
  } else if (d == 24) {
    cout << "Christmas Eve";
  } else if (d == 23) {
    cout << "Christmas Eve Eve";
  } else {
    cout << "Christmas Eve Eve Eve";
  }
  return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>v(N); rep(i, 0, N) { cin >> v[i]; }
	sort(all(v));
	v.erase(unique(all(v)), v.end());
	YES(v.size() == N);


	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define rg register
#define ll long long 
#define inf 0x3f3f3f3f
inline int read()
{
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
    return x*f;
}
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int n,ans,x;
int main(){

    n=read();ans=read();
    for(int i=2;i<=n;i++)
    {
        x=read();
        ans=gcd(x,ans);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
s = gets.chomp.split(//)

ans = 0
nums = Array.new(s.size+1, nil)
nums[0] = 0
migi = s[0] == '>'
ren = 0
minimum = 0

(0..(s.size-1)).each do |i|
  if s[i] == '>'
    unless migi
      minimum = nums[i]
    end
    nums[i+1] = nums[i]-1
    migi = true
    ren += 1
  else
    if migi # ターンした
      # p [ren, minimum]
      if nums[i] != 0
        ((i-ren)..i).each do |j|
          nums[j] -= nums[i]
        end
        nums[i-ren] = [nums[i-ren], minimum].max
      end
      migi = false
      ren = 0
    end
    nums[i+1] = nums[i]+1
  end
  # p nums
end

i = s.size
if migi # ターンした
  if nums[i] != 0
    ((i-ren)..i).each do |j|
      nums[j] -= nums[i]
    end
    nums[i-ren] = [nums[i-ren], minimum].max
  end
  migi = false
  ren = 0
  # p nums
end


puts nums.inject(:+)

# < >>> << > <<<<< >>> <
# 0,3,2,1,0,1,2,0,1,2,3,4,5,2,1,0,1


Measured memory_bytes: 49540
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	int h, w;
	{
		int[] tmp = readln.chomp.split.map!(to!int).array;
		h = tmp[0], w = tmp[1];
		}
	
	int count;
	for(int i = 0; i < h; i ++){
		string s = readln.chomp;
		foreach(c; s) if(c == '#') count += 1;
		}
	
	string ans;
	if(count == h + w - 1) ans = "Possible";
	else ans = "Impossible";
	
	ans.writeln;
	}
	


Measured memory_bytes: 256
// default code for competitive programming
// ver 3.1415 {{{

// Includes
#include <bits/stdc++.h>

// Defines
#define NAME(x) #x
#define SZ(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, e) for( int i = 0 ; i < (e) ; i++ )
#define ITER(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define REP(i, s, e) for(int i = (s); i <= (e); i++)
#define REPD(i, s, e) for(int i = (s); i >= (e); i--)
#define IOS ios_base::sync_with_stdio( 0 )
#define DEBUG 1
#define fst first
#define snd second
#define PB push_back
#ifdef ONLINE_JUDGE
#define FILE( fn ) \
    freopen(fn".in","r",stdin); \
freopen(fn".out","w",stdout);
#else
#define FILE( fn )
#endif

#ifdef AKAI
#define debug( ... ) fprintf( stderr , __VA_ARGS__ )
#else
#define debug( ... )
#endif

using namespace std;

// Typedefs
typedef double real;
typedef long long ll;
typedef pair<ll, int> pli;
typedef tuple<ll, int> tli;
typedef pair<int, int> pii;
typedef tuple<int, int> tii;
typedef unsigned long long ull;

// Some common const.
const double EPS = 1e-8;
const double Pi = acos(-1);

// Equal for double
bool inline equ(double a, double b)
{return fabs(a - b) < EPS;}

int _R( int& x ) { return scanf( "%d" , &x ); }
int _R( ll& x ) { return scanf( "%" PRId64 , &x ); }
int _R( double& x ) { return scanf( "%lf" , &x ); }
int _R( char* s ) { return scanf( "%s" , s ); }

int R() { return 0; }

  template< typename T1 , typename... T2 >
int R( T1& x , T2&... tail )
{
  int tmp = _R( x );
  return tmp + R( tail... );
}

  template< typename Iter , typename F >
inline void out( Iter s , Iter e , F of )
{
  bool flag = 0;
  for( Iter it = s ; it != e ; it++ )
  {
    if( flag ) printf( " " );
    else flag = 1;
    of( *it );
  }
  puts( "" );
}

// }}}
// start ~~QAQ~~

int h , w;
char ip[ 11 ][ 11 ];

bool check() {
  if( ip[ 1 ][ 1 ] != '#' ) return 0;

  {
    int i = h , j = w;
    while( i != 1 || j != 1 ) {
      //printf( "%d %d\n" , i , j );
      ip[ i ][ j ] = '.';
      if( ip[ i-1 ][ j ] == '#' && ip[ i ][ j-1 ] == '#' )
        return 0;
      if( ip[ i-1 ][ j ] == '#' ) i--;
      else if( ip[ i ][ j-1 ] == '#' ) j--;
      else return 0;
    }
  }
  ip[ 1 ][ 1 ] = '.';
  REP( i , 1 , h ) REP( j , 1 , w ) if( ip[ i ][ j ] == '#' ) return 0;
  return 1;
}

int main() {
  R( h , w );
  REP( i , 1 , h ) scanf( "%s" , ip[ i ]+1 );
  puts( check() ? "Possible" : "Impossible" );
}


Measured memory_bytes: 384
import java.util.*;
 
class Main {
  
    public static void main(String[] args) {
      
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int L = Integer.parseInt(sc.next());
        String moji[] = new String[N];
      
      for(int i=0;i<N;i++){
        moji[i] = sc.next();
      }

      Arrays.sort(moji);
      for(int i=0;i<N;i++){
        System.out.print(moji[i]);
      }
      
    }
}

Measured memory_bytes: 23380
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
using namespace std;

int main()
{
	int n, d,x;
	cin >> n >> d >> x;
	vector<int>a(n);
	for (int& p : a)cin >> p;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= d; j++) {
			if (j * a[i] + 1 <= d)x++;
			else break;
		}
	}
	cout << x << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace std;
struct Sieve
{
    int n;
    vector<int> f, primes;
    Sieve(int n = 1) : n(n), f(n + 1)
    {
        f[0] = f[1] = -1;
        for (int i = 2; i <= n; i++)
        {
            if (f[i])
                continue;
            primes.push_back(i);
            f[i] = i;
            for (ll j = i * i; j <= n; j += i)
                if (!f[j])
                    f[j] = i;
        }
    }
    bool isPrime(int x)
    {
        return f[x] == x;
    }
    vector<int> factorList(int x)
    {
        vector<int> res;
        while (x != 1)
        {
            res.push_back(f[x]);
            x /= f[x];
        }
        return res;
    }
    vector<pair<int, int>> factor(int x)
    {
        vector<int> fl = factorList(x);
        if (fl.size() == 0)
            return {};
        vector<pair<int, int>> res(1, pair<int, int>(fl[0], 0));
        for (int p : fl)
        {
            if (res.back().first == p)
            {
                res.back().second++;
            }
            else
            {
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
};
int main()
{
    Sieve sieve(100);
    int n;
    cin >> n;

    vector<int> mp(n+1);
    for (int i = 1; i <= n;i++)
    {
        auto f = sieve.factor(i);
        for(auto p:f){
            mp[p.first] += p.second;
        }
    }
    int cnt2 = 0,cnt4 = 0,cnt14=0,cnt24=0,cnt74=0;
    for (int i = 1; i <= n;i++){
        if(mp[i]>=2){
            cnt2++;
        }
        if(mp[i]>=4){
            cnt4++;
        }
        if(mp[i]>=14){
            cnt14++;
        }
        if(mp[i]>=24){
            cnt24++;
        }
        if(mp[i]>=74){
            cnt74++;
        }
    }
    int ans = 0;
    ans += (cnt2-cnt4) * cnt4 * (cnt4 - 1) / 2;
    ans += (cnt4) * (cnt4 - 1) * (cnt4 - 2) / 2;
    ans += (cnt2 - cnt24) * cnt24;
    ans += (cnt24) * (cnt24 - 1);
    ans += (cnt4 - cnt14) * (cnt14);
    ans += (cnt14) * (cnt14 - 1);
    ans += (cnt74);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  ll i = 0;
  for (auto x : v) {os << " [" << i++ << "]" << x; if (i % 10 == 0) os << std::endl;}
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp) {os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

//  bool judge = (vc == "1479");
//  if (judge) print("Yes");
//  else print("No");

  ll X, Y;
  std::cin >> X >> Y;

  if (X+Y == 15) print("+");
  else if (X*Y == 15) print("*");
  else print("x");

  return 0;
}


Measured memory_bytes: 256
A,B,C,D,E,F=map(int,input().split())
A,B=A*100,B*100
water=[]
for i in range(F//A+1):
    for j in range(F//B+1):
        if A*i+B*j<=F and not(i==0 and j==0):
            water.append((A*i+B*j))
water=list(set(water))
ans=[water[0],0]
mconc=0
sugar=[]
for x in water:
    sugar.append(min(F-x,(x*E//100)))
for w,s in zip(water,sugar):
    for i in range(s//C+1):
        j=(s-C*i)//D
        cap=(C*i+D*j)
        if(cap/(w+cap))*100>mconc:
            mconc=(cap/(w+cap))*100
            ans=[w+cap,cap]
print(*ans)

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

int main(){


 int a,b,mini,maxi;
  cin>>a>>b;
  mini=min(a,b);
  maxi=max(a,b);
  char c='0'+mini;
  string res(maxi,c);
  cout<<res<<endl;


    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a,k) distance((v).begin(),(k)+upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a,k) distance((v).begin(),(k)+lower_bound((v).begin(),(v).end(),(a)))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}



void Main(){
  int n;
  cin>>n;
  vl a(n);
  cin>>a;

  int r = 0;
  ll ans = 0;
  ll sum = 0;
  rep(l,n){
    while(r<n and ((sum+a[r]) == (sum^a[r])) ){
      sum += a[r];
      r++;
    }
    ans += r-l;
    if(r==l) r++;
    else{
      sum -= a[l];
    }
  }
  cout<<ans<<endl;

} int main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    vector<int> L(n);
    rep(i, n) cin >> L[i];
    sort(all(L));
    int cnt = 0;
    rep(i, n) {
        rep(j, i) {
            int a = L[i], b = L[j];
            auto r = lower_bound(all(L), a + b) - L.begin();
            cnt += r - i - 1;
        }
    }
    cout << cnt << endl;
}

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


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> V;

#define _ cin.tie(0);ios::sync_with_stdio(false);
llong n,m;
llong imo[10010];
int main(){ _;
  cin>>n>>m;
  vector<LP> ab(m);
  REP(i,m) cin>>ab[i].first>>ab[i].second;
  sort(ab.begin(),ab.end(),[](auto &left, auto &right) {
    return left.second < right.second;});
  llong ans=1;
  llong cut=ab[0].second-1;
  FOR(i,1,m){
    if(cut<ab[i].first){
      ++ans;
      cut=ab[i].second-1;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define tt this->
#define ll long long
using namespace std;
int main ()
{
int x,y ;
cin>>x>>y;
if (x==y)
    cout<<"Yes";
else
    cout<<"No";

    return 0;
}

/*
▀█████████▄     ▄████████    ▄████████    ▄████████
  ███    ███   ███    ███   ███    ███   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
 ▄███▄▄▄██▀    ███    ███  ▄███▄▄▄▄██▀   ███    ███
▀▀███▀▀▀██▄  ▀███████████ ▀▀███▀▀▀▀▀   ▀███████████
  ███    ██▄   ███    ███ ▀███████████   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
▄█████████▀    ███    █▀    ███    ███   ███    █▀
                            ███    ███

*/


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;
typedef long long ll;
// Welcome to my source code!

class Cube {
public:
    int face[6];
    void roll(int i, int j, int k, int l) {
        int t = face[i]; face[i] = face[j]; face[j] = face[k]; face[k] = face[l]; face[l] = t;
    }
    void roll_turn() { roll(1,2,4,3); } // Rotate to the side.
    void roll_S() { roll(1,0,4,5); } // to S
    void roll_E() { roll(2,0,3,5); } // to E
};

int getRight(Cube c, int top, int front) {
    rep(i,6) {
        rep(j,4) {
            if (c.face[0] == top && c.face[1] == front) return c.face[2];
            c.roll_turn();
        }
        if (i%2 == 0) c.roll_E();
        else c.roll_S();
    }
    return -1;
}

int main() {
    Cube c;
    int q, top, front;

    rep(i,6) cin >> c.face[i];
    cin >> q;

    rep(i,q) {
        cin >> top >> front;
        cout << getRight(c, top, front) << endl;
    }
}


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


// メイン関数
int main(void) {
    int p,q,r;
    scanf("%d %d %d",&p,&q,&r);
    int a = p;
    if(a < q) a = q;
    if(a < r) a = r;

    printf("%d",p+q+r-a);

    return 0;
}



Measured memory_bytes: 128
#include<stdio.h>
int main(){
    int w,h,x,y,r=0;
    double s;
    scanf("%d%d%d%d",&w,&h,&x,&y);
    s=(double)w*h/2;
    if(1.0*x/w==0.5&&1.0*y/h==0.5)r=1;
    printf("%lf %d",s,r);
    return 0;
}

Measured memory_bytes: 128