akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
 int cnt = 0;
  string s;
  cin>>s;
  int d = s.size();
  for(int i=0;i < d;i++)
  {
    if(s[i] == 'x')
      cnt++;
  }
  if (cnt>=8)
    cout<<"NO"<<endl;
    else
      cout<<"YES"<<endl;
  return 0;
}

Measured memory_bytes: 3600
#include<stdio.h> //なんで動かないのかわからない。飛ばす。

void swap(int* a, int* b){
    int tmp = *a;
    *a = *b;
    *b = tmp;
}

int bubblesort(int A[], int N){
    int sw = 0;
    
    for( int i = 0; i < N-1; i++){
        for(int j = N-1; j > i; j--){
            if( A[j] < A[j - 1]){
                swap(&A[j], &A[j - 1]);
                sw++;
            }
        }
    }
    return sw;
}

int main(){
    int A[100], N, sw;
    
    scanf("%d", &N);
    for(int i = 0; i < N; i++) scanf("%d", &A[i]);
    
    sw = bubblesort(A, N);
    
    for(int i = 0; i < N; i++){
        if(i) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n");
    printf("%d\n", sw);
    return 0;
}


Measured memory_bytes: 2036
from collections import defaultdict

import itertools

n, m, q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(q)]

a = itertools.combinations_with_replacement(range(1, m + 1), n)

ans = 0
for i in a:
  prs = 0
  for a, b, c, d in ABCD:
    if i[b - 1] - i[a - 1] == c:
      prs += d
  ans = max(ans, prs) 

print(ans)

Measured memory_bytes: 9472
#include <iostream>
#include <bits/stdc++.h>
#define endl '\n'
#define MAXN 1000010
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n; cin >> n;
    vi num;
    vii ordered;
    int index = 0;
    int n1 = n;
    while (n1--){
        int x; cin >> x;
        num.push_back(x);
        ordered.emplace_back(x, index);
        index++;
    }
    sort(ordered.begin(), ordered.end());
    int count = 0;
    for (int i = 0; i < n; ++i) {
        if(ordered[i].second % 2 != i % 2) ++count;
    }
    cout << (count >> 1) << endl;
    return 0;
}

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

bool A[105][105];

int main() {
	#ifdef INPUT
	freopen("r", "r", stdin);
	#endif
	int a, b;
	scanf("%d %d", &a, &b); a--, b--;
	for(int i = 51; i <= 100; ++i) for(int j = 1; j <= 100; ++j) A[i][j] = 1;
	for(int i = 1; i <= 59; ++i) for(int j = 1; j <= 100; ++j) {
		if(a and i % 2 and j % 2) A[i][j] = 1, a--;
	}
	for(int i = 52; i <= 100; ++i) for(int j = 1; j <= 100; ++j) {
		if(b and i % 2 and j % 2) A[i][j] = 0, b--;
	}
	printf("%d %d\n", 100, 100);
	for(int i = 1; i <= 100; ++i) {
		for(int j = 1; j <= 100; ++j) printf("%c", A[i][j] ? '.' : '#');
		puts("");
	}
}

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

int main() {
    long long n, ret = 0;
    std::cin >> n;
    std::vector<long long> a(3 * n);
    for (auto i = 0; i < 3 * n; i++) std::cin >> a[i];
    std::sort(a.begin(), a.end());
    std::reverse(a.begin(), a.end());
    for (auto i = 0; i < n; i++) ret += a[i * 2 + 1];
    std::cout << ret << std::endl;
    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
int main(){
    int i,j;
    scanf("%d %d",&i,&j);
    if (i+j>=i-j && i+j>=i*j) printf("%d",i+j);
    else if (i-j>=i+j && i-j>=i*j) printf("%d",i-j);
    else printf("%d",i*j);
    return 0;
}

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


int main(){
	
	string a;
	while(1){
		cin >> a;
		if(a[0] == '0')break;
		
		int b[10] = {};
		for(int i = 0;i < 1000;i++){
			if(!a[i])break;
			if(a[i] == '1')b[1]++;
			else if(a[i] == '2')b[2]++;
			else if(a[i] == '3')b[3]++;
			else if(a[i] == '4')b[4]++;
			else if(a[i] == '5')b[5]++;
			else if(a[i] == '6')b[6]++;
			else if(a[i] == '7')b[7]++;
			else if(a[i] == '8')b[8]++;
			else if(a[i] == '9')b[9]++;
		}
		int ans = 0;
		ans = 0;
		for(int i = 1;i < 10;i++)ans += b[i]*i;
		cout << ans << "\n";
		
	}
	
	
	return 0;
}

Measured memory_bytes: 3184
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


# MOD = 998244353


def argsort(li, key=None, reverse=False):
    return [i for _, i in sorted(
        [(a, i) for i, a in enumerate(li)], key=(lambda t: key(t[0])) if key else None, reverse=reverse
    )]


N, K, Q = list(map(int, sys.stdin.buffer.readline().split()))
A = list(map(int, sys.stdin.buffer.readline().split()))


def count(l, r, M):
    # [l, r) から M 以下の数を選べる個数
    ret = 0
    for i in range(l, r):
        ret += A[i] <= M
    return min(r - l - K + 1, ret)


def test(M, lr):
    # M 以下の数を Q 個選べるか
    cnt = 0
    for l, r in lr:
        cnt += count(l, r, M)
        if cnt >= Q:
            return True
    return False


def split(lr, i):
    ret = []
    for l, r in lr:
        if l <= i < r:
            if i - l >= K:
                ret.append((l, i))
            if r - (i + 1) >= K:
                ret.append((i + 1, r))
        else:
            ret.append((l, r))
    return ret


# 座圧して BIT 使えばもっと計算量減らせそう
lr = [(0, N)]

ans = max(A) - min(A)
# 小さい順
idx = argsort(A)
for i in idx:
    # i 番目を最小値とする
    m = A[i]
    if test(m + ans - 1, lr):
        ok = m + ans - 1
        ng = m - 1
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            if test(mid, lr):
                ok = mid
            else:
                ng = mid
        ans = ok - m
    lr = split(lr, i)
    if not lr:
        break
print(ans)


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

pair<int,int> dfs(vector< vector< pair<int,int> > > &G, vector<bool> &visited, int v){
  pair<int,int> ret(0,v);
  visited[v] = true;
  for(size_t i = 0; i < G[v].size(); ++i){
    int v_ = G[v][i].second;
    if(visited[v_]) continue;
    pair<int,int> ret_ = dfs(G,visited,v_);
    ret_.first += G[v][i].first;
    ret = max(ret,ret_);
  }
  return ret;
}

int diameter(vector< vector< pair<int,int> > > &G){
  int N = G.size();
  vector<bool> init(N,false);
  int v = dfs(G,init,0).second;
  init = vector<bool>(N,false);
  return dfs(G,init,v).first;
}

int main(){
  int n;
  cin >> n;
  vector< vector< pair<int,int> > > G(n);
  for(int i = 0; i < n-1; ++i){
    int s, t, w;
    cin >> s >> t >> w;
    G[s].emplace_back(w,t);
    G[t].emplace_back(w,s);
  }
  cout << diameter(G) << endl;
  return 0;
}



Measured memory_bytes: 16028
for e in iter(input,'0 0 0'):
 N,M,S=map(int,e.split());N*=N
 d=[[0]*-~S for _ in[0]*-~N];d[0][0]=1
 for i in range(1,N+1):
  for j in range(i,S+1):
   d[i][j]+=d[i][j-i]+d[i-1][j-i]-(M+1<=j and d[i-1][j-M-1])
 print(d[N][S]%10**5)


Measured memory_bytes: 11968
n = int(input())
a = list(map(int, input().split()))

left = []
right = []

if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            right.append(a[i])
        else:
            left.append(a[i])
    
    print(*(left[::-1]+right))
else:
    for i in range(n):
        if i % 2 == 0:
            left.append(a[i])
        else:
            right.append(a[i])
    
    print(*(left[::-1]+right))

Measured memory_bytes: 116260
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define p pair<int,int>
const int inf = 1 << 30;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}
int N;
int a[250010];
int ans[250010];
bool flag = true;


int main(){
    cin >> N;
    for(int i = 1; i <= N; i++){
        int x;
        cin >> x;
        a[x] = i;
    }
    int l = 1;
    for(int i = 1; i <= N * N; i++){
        if(a[i] == 0) continue;
        ans[i] = a[i];
        
        int d = a[i] - 1;
        for(; l <= i && d > 0; l++){
            if(ans[l] == 0){
                ans[l] = a[i];
                d--;
            }
        }
        if(d != 0){
            flag = false;
        } 
    }
    int r = N * N;
    for(int i = N * N; i >= 1; i--){
        if(a[i] == 0) continue;

        int d = N - a[i];
        for(; r >= i && d > 0; r--){
            if(ans[r] == 0){
                ans[r] = a[i];
                d--;
            }
        }
        if(d != 0){
            flag = false;
        }
    }
    if(flag){
        cout << "Yes" << endl;
        for(int i = 1; i <= N * N; i++) cout << ans[i] << " ";
        cout << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 2816
n = int(input())
h = list(map(int, input().split()))

cnt = 0
flag = True
for i in range(1, n):
    for j in range(i):
        if h[i] < h[j]:
            flag = False
            break
    if flag:
        cnt += 1
    flag = True

print(cnt + 1)


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

int main() {
  
  string S;
  cin >> S;
  
  if (S.at(2)==S.at(3) && S.at(4)==S.at(5)) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}

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

int main() {
  int N, K;
  string S;
  cin >> N >> K >> S;
  if(S.at(K-1) == 'A') {
    S.at(K-1) = 'a';
  } else if(S.at(K-1) == 'B') {
    S.at(K-1) = 'b';
  } else if(S.at(K-1) == 'C') {
    S.at(K-1) = 'c';
  }
  cout << S << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp>
using namespace std;
using ll=long long;
const int MOD=1000000007;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  map<int,int> m;
  for(ll i=0;i<n;i++){
    cin >> a.at(i);
    m[a.at(i)]++;
  }
  ll ans=0;
  for (auto p : m) {
    auto k = p.first;
    auto v = p.second;
    if(k>v)
    ans+=v;
    else 
    ans+=(v-k);
  }
  cout << ans << endl;
}

Measured memory_bytes: 8492
N,K = map(int,input().split())
A = list(map(int,input().split()))

dic = {}

for i in range(N):
    if A[i] in dic:
        dic[A[i]] += 1
    else:
        dic[A[i]] = 1

ks = list(dic.keys())
vs = list(dic.values())

vs.sort()

B = (len(ks))
cnt = 0

for i in range(len(vs)):
    if B > K:
        B -= 1
        cnt += vs[i]
    else:
        break

print(cnt)


Measured memory_bytes: 32288
#include<stdio.h>

int main(){
  int n;

  scanf("%d", &n);

  if(n == 1 || n == 2 || n == 3 || n == 5 || n == 6 || n == 9 || n == 10 || n == 13 || n == 17){
    printf("No\n");
  }
  else{
    printf("Yes\n");
  }


  return 0;
}


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

const long long INF = 1e13;

long long N, A;

long long pw(long long a, int b) {
	long long ret = 1;
	for (int i = 1; i <= b; ++i) {
		if (ret > INF / a) return INF;
		ret *= a;
	}
	return ret;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> N >> A;
	if (N == 1) {
		return cout << 1 << endl, 0;
	}

	long long res = N;

	for (int i = 1; i <= 40; ++i) {
		// a[1] * a[2] * ... * a[i + 1] >= N
		// find min A * i + a[1] + a[2] + ... + a[i + 1]
		long long low = 1, high = N;
		while(low < high) {
			long long mid = ((low + high) >> 1);
			if (pw(mid, i + 1) >= N) high = mid; 
			else low = mid + 1;
		}

		for (int j = 0; j <= i; ++j) {
			// (low - 1)^j * (low)^(i + 1 - j) >= N
			if (j > 0 && low == 1) continue;
			long long cur = 1;
			for (int k = 1; k <= j; ++k) {
				if (cur <= INF / (low - 1)) cur *= (low - 1);
				else cur = INF;
			}
			for (int k = 1; k <= i + 1 - j; ++k) {
				if (cur <= INF / low) cur *= low;
				else cur = INF;
 			}
			if (cur >= N) res = min(res, A * i + (low - 1) * j + low * (i + 1 - j));
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int x;
    in>>x;
    for(int i=x/105-2;i<x/100+2;++i){
        if(i<=0) continue;
        int y=x-100*i;
        if(y>=0&&y<=5*i) return cout<<1<<endl,0;
    }
    cout<<0<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int n,m,i,ans;
  ans=0;
  scanf("%d %d",&n,&m);
long int h[n],judge[n];
  for(i=0;i<n;++i)
  {
  scanf("%ld",&h[i]);
    judge[i]=0;
  }
int a[m],b[m];
  for(i=0;i<m;++i)
  {
  scanf("%d %d",&a[i],&b[i]);
   if(h[a[i]-1]>h[b[i]-1]) judge[b[i]-1]++;
   else if(h[a[i]-1]<h[b[i]-1]) judge[a[i]-1]++;
   else if(h[a[i]-1]==h[b[i]-1]) {judge[a[i]-1]++;
                             judge[b[i]-1]++;}
  }
  
  for(i=0;i<n;++i)
  {
  if(judge[i]==0) ans++; 
  }

  printf("%d",ans);
  
return 0;
}

Measured memory_bytes: 4072
#include<stdio.h>
#include<math.h>

int main(){
    int a,b,val,root;

    scanf("%d %d",&a,&b);

    if(b>0&&b<10)
    val = a*10+b;
    else if(b>9&&b<100)
    val = a*100+b;
    else if(b==100)
    val = a*1000+b;

    root = sqrt(val);

    if(root*root == val)
    printf("Yes");
    else
        printf("No");

    return 0;

}

Measured memory_bytes: 2132
//////////////////////////////////////
////       ABHINASH GIRI          ////
/////////////////////////////////////
#include<bits/stdc++.h>
using namespace std;
#define pr 4294967296   // 2^32
#define fast ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define high 1000000001
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             -1e18
#define pinf              1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define e               1000000000
#define w(x)            int t; cin>>t; while(t--)
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define co(x) cout<<(x)<<"\n"
#define endl "\n"
typedef unsigned long int  ul;
typedef unsigned long long int ull;
typedef unsigned long long  int  li;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<long int> vl;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long int,long int>> vpl;
typedef vector<pair<long long int,long long int>> vpll;
typedef long long ll;
bool cmp(pair<char,int>a,pair<char,int>b)
{
    if(a.first==b.first)
        return a.second<b.second;
    return a.first>b.first;
}
int main() {
    std::chrono::time_point<std::chrono::high_resolution_clock> start_timer, end_timer;
    start_timer = std::chrono::high_resolution_clock::now();
    bool show_time = false;  //  change it to true when needed;
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//    #endif

    /* Cook your Code  */
    fast;
    int n,k;
    cin>>n>>k;
    int d;
    set<int>s;int q;
    for (int i = 0; i <k ; ++i) {
        cin>>d;
        for (int j = 0; j <d ; ++j) {
            cin>>q;
            s.insert(q);
            //cout<<" s "<<s.size()<<endl;
        }
    }
//    cout<< " size "<<s.size()<<endl;

    cout<<n-s.size()<<endl;



    end_timer = std::chrono::high_resolution_clock::now();
    ll elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(end_timer-start_timer).count();
    if(show_time)
    {cout << "\\nElapsed Time: " << elapsed_time << "ms\\n";}

    return 0;
}

Measured memory_bytes: 3672
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var N = vals[0];
            var X = vals[1];
            var m = new List<int>();
            foreach(var i in Enumerable.Range(0, N))
            {
                m.Add(int.Parse(Console.ReadLine()));
            }

            //1個ずつ作る
            var remainMaterial = X - m.Sum();
            var reaminCount = (int)(remainMaterial / m.Min());

            Console.WriteLine(N + reaminCount);

        }
    }

}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int x,a,b;
cin >> x >> a >> b;
if (abs(x-a) < abs(x-b)) cout << 'A' << endl;
else cout << 'B' << endl;

return 0;
}


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

long long int solve(long long int n, long long int x,
                    std::vector<long long int> &a,
                    std::vector<long long int> &b) {
  if (x == 0) {
    return 0;
  } else if (x == 1) {
    return n == 0 ? 1 : 0;
  } else if (x < a[n - 1] + 2) {
    return solve(n - 1, x - 1, a, b);
  } else if (x == a[n - 1] + 2) {
    return b[n - 1] + 1;
  } else if (x <= 2 * a[n - 1] + 2) {
    return b[n - 1] + 1 + solve(n - 1, x - a[n - 1] - 2, a, b);
  } else {
    return b[n];
  }
}

int main() {
  long long int n, x;
  std::cin >> n >> x;
  std::vector<long long int> a(n + 1), b(n + 1);
  a[0] = 1, b[0] = 1;
  for (int i = 1; i < n + 1; i++) {
    a[i] = 3 + 2 * a[i - 1];
    b[i] = 1 + 2 * b[i - 1];
  }
  std::cout << solve(n, x, a, b) << std::endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
	int N; cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; ++i)
		cin >> a[i];
	sort(a.begin(), a.end());
	vector<ll> acc(N);
	acc[0] = a[0];
	for (int i = 1; i < N; ++i)
		acc[i] = acc[i - 1] + a[i];
	for (int i = N - 2; i >= 0; --i) {
		if (a[i + 1] > acc[i] * 2) {
			cout << (N - 1 - i) << endl;
			return 0;
		}
	}
	cout << N << endl;
	return 0;
}

Measured memory_bytes: 1408
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    N = int(input())
    A = list(sorted(list(map(int, input().split()))))

    if A[0] == 0:
        print(0)
        return

    cons = 10 ** 18
    ans = 1
    for a in A:
        ans *= a
        if ans > cons:
            print(-1)
            return

    print(ans)


def main():
    solve()


if __name__ == '__main__':
    main()


Measured memory_bytes: 23292
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

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

    cout << a + b + c - max(a, max(b, c)) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

char s[300][301];
char temp[300][301];
int main() {
	int n;
	scanf("%d", &n);
	fup(i, 0, n - 1, 1)scanf("%s", s[i]);
	int ans = 0;
	fup(i, 0, n - 1, 1)
	{
		fup(ii,0,n-1,1)
			fup(jj, 0, n - 1, 1)
		{
			temp[ii][jj] = s[ii][(jj + i) % n];
		}
		bool ok = 1;
		fup(ii,0,n-1,1)
			fup(jj, ii + 1, n - 1, 1)
		{
			if (temp[ii][jj] != temp[jj][ii])
			{
				ok = 0;
				break;
			}
		}
		if (ok)ans += n;
	}
	printf("%d", ans);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//}

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int dp[1010][1010];
int bingo[3][3];
int cnt[2][105];

int main() {
	int n;
	cin >> n;
	vector<int>t(n), x(n), y(n);
	rep(i, n) {
		cin >> t[i] >> x[i] >> y[i];
	}
	bool flag = true;
	int resx = 0, resy = 0;
	rep(i, n) {
		if (abs(x[i] - resx) + abs(y[i] - resy) > t[i] || (x[i] + y[i]) % 2 != t[i] % 2)flag = false;
	}
	if (flag)puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <iostream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define ll long long
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
 
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> ordered_set;
		
#ifndef ONLINE_JUDGE
template<typename T>
void __p(T a) {
  cout<<a;
}
template<typename T, typename F>
void __p(pair<T, F> a) {
  cout<<"{";
  __p(a.first);
  cout<<",";
  __p(a.second);
  cout<<"}";
}
template<typename T>
void __p(std::vector<T> a) {
  cout<<"{";
  for(auto it=a.begin(); it<a.end(); it++)
    __p(*it),cout<<",}"[it+1==a.end()];
}
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) {
  __p(a1);
  __p(a...);
}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cout<<name<<" : ";
  __p(arg1);
  cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
  int bracket=0,i=0;
  for(;; i++)
    if(names[i]==','&&bracket==0)
      break;
    else if(names[i]=='(')
      bracket++;
    else if(names[i]==')')
      bracket--;
  const char *comma=names+i;
  cout.write(names,comma-names)<<" : ";
  __p(arg1);
  cout<<" | ";
  __f(comma+1,args...);
}
#define trace(...) cout<<"Line:"<<__LINE__<<" ", __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...)
#define endl '\n'
#endif

struct edge{
	int a, b, weight;
};
		
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
		
long long modInverse(long long a, long long m) { 
    if(__gcd(a, m) != 1){
		throw "modular inverse does not exist.";
	}
	long long m0 = m;
    long long y = 0, x = 1; 
    if (m == 1) return 0; 
    while (a > 1) {  
        long long q = a / m; 
        long long t = m;  
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    }  
    if (x < 0) 
       x += m0; 
    return x; 
} 
 
long long modExp(long long a, long long b, long long p) {
	long long res = 1;
	long long mult = a;
	while (b > 0) {
		if (b % 2 != 0) {
			res = (res * mult) % p;
		}
		mult = (mult * mult) % p;
		b >>= 1;
	}
	return res;
}
 
vector<int> sieveOfEratosthenes(int n) {
	vector<int> primes;
	bool prime[n + 1];
	memset(prime, true, sizeof(prime));
	for (int p = 2; p * p <= n; p++) {
		if (prime[p] == true) {
			for (int i = p * p; i <= n; i += p)
				prime[i] = false;
		}
	}
	for (int p = 2; p <= n; p++)
		if (prime[p])
			primes.push_back(p);
	return primes;
}
 
void solve() {
	ll a;
	long double b;
	cin >> a >> b;
	ll c = (ll)round((b*100));
	
	trace(c);
	cout << (a*c)/100;
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1;
	//cin >> t;
	for (int i = 0; i < t; i++) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 3712
#include<iostream>
#include<string>

using namespace std;

typedef long long int llint;

int main() {
	llint X;
	cin >> X;
	llint ans = 0;
	ans += 1000 * (X / 500);
	X %= 500;
	ans += 5 * (X / 5);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{    
	string s; 
	int i=0;
    getline(cin,s); 
    while(i<s.length()){
        if(s[i]!='0'&&s[i]!='1') {
        if(i>0){
         	s.erase(i-1,2),i--;
		} 
        else{
			s.erase(i,1);
		} 
    }
    else{
    	i++;	
	} 
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
#%%
a, b, c, d = map(int, input().split())
check = [0] * 101

for i in range(a,b+1):
  check[i] = 1

for i in range(c, d+1):
  if check[i] == 1 :
    check[i] = 2

if check.count(2) != 0:
  print(check.count(2)-1)
else:
  print(0)



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

int main(){
  int n;
  cin >> n;
  char s[100],t[100];
  for(int i=0; i!=n; i++){
    cin >> s[i];
  }
  for(int i=0; i!=n; i++){
    cin >> t[i];
  }
  for(int i=0; i!=n; i++){
    cout << s[i] << t[i];
  }
  cout << '\n';
  return 0;
}


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

int main()
{
    int n;
    int i;
    string s;
    cin >> n >> s;
    int ans = 0;
    char b = '0';
    for(i = 0;i < n;++i){
        if(s.at(i) == b){
            continue;
        }else{
            ++ans;
            b = s.at(i);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	gcd := GCD(a, b)
	fmt.Println(1 + len(Factorize(gcd)))
}

func Factorize(n int) [][]int {
	res := [][]int{}
	for i := 2; i*i <= n; i++ {
		if n%i != 0 {
			continue
		}
		cnt := 0
		for n%i == 0 {
			n /= i
			cnt++
		}
		res = append(res, []int{i, cnt})
	}
	if n != 1 {
		res = append(res, []int{n, 1})
	}
	return res
}

func GCD(a, b int) int {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}


Measured memory_bytes: 512
main=do
    [x,y]<-map read.words<$>getLine
    print $ sol x y
sol x y
    | x==0 && y>0 = y
    | y==0 && x>0 = x+1
    | y==0 && x<0 = -x
    | x==0 && y<0 = -y+1
    | x<0 && y<0 && x<y = y-x
    | x<0 && y<0 && x>y = x-y+2
    | x>0 && y>0 && x<y = y-x
    | x>0 && y>0 && x>y = x-y+2
    | x<y && (-x) == y = 1
    | x<y && (-x)<y = y-(-x)+1
    | x<y && (-x)>y = (-y)-x+1
    | (-y)==x = 1
    | (-y)<x = y-(-x)+1
    | (-y)>x = (-y)-x+1


Measured memory_bytes: 508
def main():
    n,m = map(int, input().split())
    if n%2==0 and 2*(m+1)==n:
        if n%4:
            for i in range(1,n//4+1):
                print(i,n//2-i)
            j = n

            for i in range(n//2+1,n//2+n//4+1):
                print(i,j)
                j -= 1
        else:
            for i in range(1,n//4+1):
                print(i,n//2+1-i)
            j = n-1
            for i in range(n//2+1,n//2+n//4):
                print(i,j)
                j -= 1
    else:
        for i in range(1,m+1):
            print(i,n-i)
if __name__ == '__main__':
    main()

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    ll n, k;
    cin >> n >> k;

    ll p[n];
    NREP() {
        cin >> p[i];
    }
    double ans = 0;
    double now = 0;

    double exp[n];
    NREP() {
        exp[i] = ((double) p[i] + (double) 1) / 2.0;
    }

    REP(i, k) {
        now += exp[i];
    }
    ans = now;

    for (int i = k; i < n; ++i) {
        now -= exp[i - k];
        now += exp[i];
        ans = max(ans, now);
    }

    cout << fixed << setprecision(15) << ans << endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int main(){
	string s;
	cin >> s;
	int ans = MOD;
	for (int i = 0; i < s.length()-2; i++){
		string str = s.substr(i, 3);
		ans = min(abs(stoi(str) - 753), ans);
	}
	cout << ans << endl;
 	return 0;
 }




Measured memory_bytes: 256
//Abhinav ---IIIT_A
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define f(i,x,n) for(int i=x;i<(int)n;++i)
#define vpii vector<pair<int,int>> 
ld pie=3.141592653589793238462643383279;
int mod=1e9+7;
int dx[]={-1,1,0,0};
int dy[]={0,0,1,-1};


int dig(int a){
  int r=0;
  while(a!=0){
    int xp=a%10;
    a/=10; if(xp==1) ++r;
  }
  return r;
}

int fact[2000005];
int infact[2000005];

int inv(int a){
  int y=mod-2;
  int r=1;
  while(y!=0){
    if(y&1){
      r*=a; r%=mod;
    }
    y/=2; a*=a; a%=mod;
  }
  return r;
}

int po(int a,int y){
  int r=1;
  while(y!=0){
    if(y&1){
      r*=a; r%=mod;
    }
    y/=2; a*=a; a%=mod;
  }
  return r; 
}

void facto(){
  fact[0]=1;
  f(i,1,2000005) {fact[i]=i*fact[i-1]; fact[i]%=mod;}
  f(i,0,2000005) infact[i]=inv(fact[i]); 
}

int nck (int n,int k){
  if(k<0 || k>n) return 0;
  int ret=fact[n]; ret*=infact[k]; ret%=mod;
  ret*=infact[n-k]; ret%=mod;
  return ret;
}
int32_t main(){
#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  facto();
  int k; cin>>k;
  string s; cin>>s;
  int l=k+s.size();
  int xp=s.size();
  // total = 26^l - those which do not contain subsequence
  // --- i= 0 to  xp-1 prefix present as subseqeunce and remaining have 25^(l-i)
  int ret=1;
  f(i,0,l){
    ret*=26; ret%=mod;
  }
  int sub=0;

  f(i,0,xp){
    // l choose i
    sub+= (nck(l,i)*po(25,l-i));
    sub%=mod; 
  }

  cout<<((ret-sub)%mod + mod) %mod <<"\n";
  return 0;
}


Measured memory_bytes: 35496
#include <iostream>

using namespace std;

int main(void){

  int N, H[100000];
  int x, ans;

  x = ans = 0;

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

  for(int i=0; i<N-1; i++){
    if(H[i]>=H[i+1]) x++;
    else x = 0;
    if(ans<=x) ans = x;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3932
#include <stdio.h>
int main()
{    // Your code here!
    int a,b,c,d,e,f,x,y,z;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    if(a<b)
    {
        x=a;
    }
    else
    {
        x=b;
    }
    if(c<d)
    {
        y=c;
    }
    else
    {
        y=d;
    }
    if(x<y)
    {
        z=x;
    }
    else
    {
        z=y;
    }
    if(e<f)
    {
        printf("%d\n",a+b+c+d+f-z);
    }
    else
    {
        printf("%d\n",a+b+c+d+e-z);
    }
}


Measured memory_bytes: 2108
import math as m
p1 = list(map(int, input().split()))
p2 = list(map(int, input().split()))
p3 = list(map(int, input().split()))

points = (m.sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2) for p1, p2 in zip((p1, p2, p3), (p2, p3, p1)))
a, b, c = sorted(points)
s = (a + b + c) / 2
T = m.sqrt(s*(s-a)*(s-b)*(s-c))
ans = 2*T / (a + b + c + 4*T/c)
print(ans)


Measured memory_bytes: 3064
N=int(input())

#S = [[0 for j in range(3)] for i in range(2)]　2行3列の場合
S = [[0 for j in range(3)] for i in range(N)]

for i in range(N):
    A,B=map(str,input().split())
    B=int(B)
    S[i][0]=i+1
    S[i][1]=A
    S[i][2]=B


T=sorted(S,key=lambda x:x[2],reverse=True)
U=sorted(T,key=lambda x:x[1])
for i in range(N):
    print(U[i][0])

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

typedef pair<int,int> P;

int main(){
  int n, m;
  cin  >> n >> m;
  priority_queue<int> que;
  int s=0;
  for(int i=0; i<n; i++){
    int a;
    cin >> a;
    s+=a;
    que.push(a);
  }
  if(s%(m*4)==0){
    s /= 4*m;
  }else{
    s /= 4*m;
    s++;
  }
  
  for(int i=0; i<m; i++){
    int a = que.top(); que.pop();
    if(a<s){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(auto &it : (v))
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define sz(x) (int)(x).size()

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

vector<ll> A;
ll odd[200005];
ll even[200005];
ll zeros[200005];
ll sum[200005];
ll rodd[200005];
ll reven[200005];
ll rzeros[200005];
ll rsum[200005];
ll startCost[200005];
ll endCost[200005];
ll startScore[200005];
ll endScore[200005];

int main(){
	ios::sync_with_stdio(0);
    int L;
    cin >> L;
    A.resize(L);
    rep(i,0,L)
        cin >> A[i];
    startCost[0] = 0;
    rep(i,0,L) {
        odd[i+1] = odd[i];
        even[i+1] = even[i];
        zeros[i+1] = zeros[i];
        sum[i+1] = sum[i];
        if (A[i]%2)
            ++odd[i+1];
        else
            ++even[i+1];
        if(A[i] == 0)
            ++zeros[i+1];
        sum[i+1] += A[i];
    }
    rep(i,0,L+1) {
        rodd[i] = odd[L]-odd[i];
        reven[i] = even[L]-even[i];
        rzeros[i] = zeros[L]-zeros[i];
        rsum[i] = sum[L]-sum[i];
    }
    ll bestSeen = 0;
    rep(b,0,L+1) {
        bestSeen = min(bestSeen, sum[b]-odd[b]-2*zeros[b]);
        startCost[b] = odd[b]+2*zeros[b]+bestSeen;
    }
    bestSeen = 0;
    rrep(b,L+1,0) {
        bestSeen = min(bestSeen, rsum[b]-rodd[b]-2*rzeros[b]);
        endCost[b] = rodd[b]+2*rzeros[b]+bestSeen;
    }
    /*ll sumMinusZeros = 0;
    ll minSumMinusZeros = 0;
    rep(i,0,L) {
        startCost[i+1] = startCost[i];
        if (A[i]%2 == 1) {
            startCost[i+1]++;
        }
    }
    rep(i,0,L) {
        sumMinusZeros += A[i];
        if (A[i] == 0)
            sumMinusZeros -= 2;
        minSumMinusZeros = min(minSumMinusZeros, sumMinusZeros);
        startCost -= minSumMinusZeros;
    }
    endCost[L] = 0;
    rrep(i,L,0) {
        endCost[i] = endCost[i+1];
        if (A[i]%2 == 1) {
            endCost[i]++;
        }
    }
    numEven[0] = 0;
    rep(i,0,L) {
        numEven[i+1] = numEven[i];
        if (A[i]%2 == 0) {
            ++numEven[i+1];
        }
    }*/
    rep(i,0,L+1) {
        startScore[i] = startCost[i]-even[i];
        endScore[i] = endCost[i]+even[i];
    }
    ll bestStartScore = 0;
    ll ans = 1e18;
    rep(r,0,L+1) {
        bestStartScore = min(bestStartScore, startScore[r]);
        ans = min(ans, endScore[r]+bestStartScore);
    }
    //score = startCost[l]+endCost[r]+numEven[r]-numEven[l]
    cout << ans << endl;
}

Measured memory_bytes: 20608
s = input().split()
stk = []
for i in s:
	if i.isdigit():
		stk.append(int(i))
	else:
		a = stk.pop()
		b = stk.pop()
		if i == '+':
			stk.append(b + a)
		elif i == '-':
			stk.append(b - a)
		else:
			stk.append(b * a)
print(stk.pop())



Measured memory_bytes: 5596
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		int X = Integer.parseInt(in.readLine());
		int result = -1;
		if (X < 600) {
			result = 8;
		} else if (X < 800) {
			result = 7;
		} else if (X < 1000) {
			result = 6;
		} else if (X < 1200) {
			result = 5;
		} else if (X < 1400) {
			result = 4;
		} else if (X < 1600) {
			result = 3;
		} else if (X < 1800) {
			result = 2;
		} else {
			result = 1;
		}
		System.out.println(result);
	}

	void calc() {
	}

	void showResult() {
	}
}


Measured memory_bytes: 25376
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let mut aseq = vec![0; n + 1];
    let mut bseq = vec![0; n + 1];
    for i in 0..n + 1 {
        aseq[i] = read::<i64>();
    }
    for i in 0..n {
        bseq[i] = read::<i64>();
    }
    let mut ans = 0;
    let mut rest = 0;
    for i in 0..n + 1 {
        let mut v = aseq[i];
        let u = std::cmp::min(v, rest);
        v -= u;
        ans += u;
        let u = std::cmp::min(v, bseq[i]);
        ans += u;
        rest = bseq[i] - u;
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include<stdio.h>
#include<algorithm>
using namespace std;
long long G[100+10][100+10];
int n;
long long nil=9999999999;
void floy()
{
    for ( int k=0;k<n;k++){
        for (int i=0;i<n;i++){
            if(G[i][k]==nil) continue;//找指向?点K的?;
            for (int j=0;j<n;j++){
                if(G[k][j]==nil) continue;//找k指向的?点；
                {
                    G[i][j]=min(G[i][j],G[i][k]+G[k][j]);
                }
            }
        }
    }
}
int main()
{
    int e,a,b,c;
    scanf("%d%d",&n,&e);
    for (int i=0;i<n;i++)
        for (int j=0;j<n;j++)
    {
        G[i][j]=((i==j)?0:nil);//将?角????0
    }
    for (int i=0;i<e;i++)
    {
        scanf("%d%d%d",&a,&b,&c);
        G[a][b]=c;
    }
    floy();
    bool zhi=false;
    for (int i=0;i<n;i++)
    {
        if(G[i][i]<0)
           {
               zhi=true;
               break;
           }
    }//?自身??数的串???；
    if(zhi==true) printf("NEGATIVE CYCLE\n");
    else {
        for (int i=0;i<n;i++)
        { for (int j=0;j<n;j++){
            if(j!=0) printf(" ");
            if(G[i][j]==nil) printf("INF");
           else printf("%d",G[i][j]);
        }
        printf("\n");
    }
    }
    return 0;
}

Measured memory_bytes: 2784
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define per(i,n) for(int i=(n)-1; i>=0; i--)
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
const int MOD = 1000000007;

int main(){
    
    int n; cin >> n;
    
    queue<string> s;
    s.push("a");
    
    rep(i,n){
        while(s.front().size()==i){
            string t = s.front();
            set<char> clist;
            for(char c: t){
                clist.insert(c);
            }
            for(int i=0; i<=clist.size(); i++){
                string u = t;
                u += (char)('a'+i);
                s.push(u);
            }
            s.pop();
        }
    }
    
    while(!s.empty()){
        cout<<s.front();
        s.pop();
        if(s.empty())
            cout << endl;
        else
            cout <<" ";
    }
    
    return 0;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b&&b==c)cout<<1<<endl;
  else if(a==b||b==c||a==c)cout<<2<<endl;
  else cout<<3<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
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<int,P> 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};

string s;

int main(){
	cin>>s;
	if(s[0]=='7'||s[1]=='7'||s[2]=='7') cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 3624
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();
    if(x%y == 0){
      System.out.println(-1);
    }else{
      System.out.println(x);
    }
  }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)
//std::sort(v.begin(), v.end(), std::greater<Type>());
//set_intersection(x, x+7, y, y+6, back_inserter(v));
//set_union(x, x+7, y, y+6, back_inserter(v));
//set_difference(x, x+7, y, y+6, back_inserter(v));

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

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

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}

int main(){
  ll n;
  cin >> n;
  vector<ll>A(n);
  for(int i=0;i<n;i++) {
    cin >> A[i];
    if(A[i]==0){
      cout<< 0 <<endl;
      return 0;
    }
  }
  ll ans = 1;
  ll threshold = powl(10,18);
  for(int i=0;i<n;i++){
    if(ans <= threshold/A[i]) ans *= A[i];
    else{
      cout<< -1 <<endl;
      return 0;
    }
  }
  cout<< ans <<endl;
}


Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    int count=0;
    int i;
    for(i=0;s[i]!='\0';i++){
        if(s[i]!=t[i])
        count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3848
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1e9;
const long double EPS = 1e-10;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int ans = INF;
  FOR(i, -100, 101) {
    int res = 0;
    rep(j, n) res += (a[j] - i) * (a[j] - i);
    ans = min(ans, res);
  }
  cout << ans << endl;



  
  return 0;
}

Measured memory_bytes: 256
/*input
PD?D??P
*/
 
 
 
#include <bits/stdc++.h>
using namespace std;
 
 
 
#define int long long int
#define rep(i,n) \
    for(int i = 0; i < n; i++)
#define rep2(i, a, b) \
    for(int i = a; i < b; i++)
#define all(c) \
    c.begin(), c.end()
#define init(arr, num) \
    memset(arr, num, sizeof(arr))
#define fast\
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inputFile \
    freopen("input.txt", "r", stdin); 
#define outputFile \
    freopen("output.txt", "w", stdout);
#define modM 1000000007
#define PI 3.1415926535897932
#define F first
#define S second  
#define pb push_back  
 
#ifdef gaviria
#define TRACE
#endif
#ifdef TRACE
#define trace(...) _f(#VA_ARGS, __VA_ARGS_)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
 
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
typedef unordered_set<int> usi;
 
ll n,i,j,k,m;
int target;


void solve() 
{ 
string a;
cin>>a;

for(i=0;i<a.size();i++)
{
    if(a[i]=='?')
        a[i]='D';

}
cout<<a;
}
 
 
 
signed main()
{
 
    // inputFile;
    fast;
    int T = 1;
// cin >> T;
ll h=T;
    while(T--){
 
        solve();
cout<<endl;
     
        
        
 
    }
    
    
    return 0;
 
}

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

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

  vector<int> A(N, S == pow(10, 9) ? 1 : S+1);
  rep(i,0,K-1) A[i] = S;
  for (auto i : A) cout << i << ' ';
  return 0;
}


Measured memory_bytes: 3768