akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int r,c,g = 0,k = 0;
    cin>>r>>c;
    int hyo[r+1][c+1];
    for(int i = 0;i<r;i++){
        for(int j = 0;j<c;j++){
            cin>>hyo[i][j];
        }
    }
    
    for(int i = 0;i<r;i++){
        g = 0;
        for(int j = 0;j<c;j++){
            cout<<hyo[i][j]<<" ";
            g+=hyo[i][j];
        }cout<<g;
        cout<<endl;
    }
    for(int i = 0;i<c;i++){
        g = 0;
        for(int j = 0;j<r;j++){
               g+= hyo[j][i];
    
        }
        cout<<g<<" ";
    }
    g = 0;
    for(int i = 0;i<r;i++){
        for(int j = 0;j<c;j++){
            g += hyo[i][j];
        }
       
    } cout<<g<<endl;
   
}



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

int n, m, h[100002], ans=0;
vector<int>adjl[100002];

int main(){
	cin >> n >> m;
	for (int i=1;i<=n;i++) cin >> h[i];
	for (int i=0;i<m;i++){
		int u, v;
		cin >> u >> v;
		adjl[u].push_back(v);
		adjl[v].push_back(u);
	}
	for (int i=1;i<=n;i++){
		bool ok=1;
		for (int next : adjl[i]){
			if (h[next]>=h[i]) ok=0;
		}
		if (ok) ans++;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 9148
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N, M; cin >> N >> M;
    vector<int> A(N);
 
    int sum = 0;
    for(auto& it:A){
        cin >> it;
        sum += it;
    }
    sort(A.begin(),A.end(),greater<int>());
 
    double tag = (double)sum/(4*M);
 
    if(A.at(M-1) < tag){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
 
}

Measured memory_bytes: 256
import math
from collections import Counter


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    alphabets = 'abcdefghijklmnopqrstuvwxyz'
    counts = {k: math.inf for k in alphabets}
    counters = []
    answer = []
    for _ in range(N):
        counters.append(Counter(input().strip()))
    for k in alphabets:
        is_in_all = True
        count = math.inf
        for counter in counters:
            if counter[k] == 0:
                is_in_all = False
                break
            count = min(count, counter[k])
        if is_in_all:
            answer += [k]*count
    return ''.join(answer)


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


Measured memory_bytes: 69460
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long H, long long A){
    cout<< (H+A-1)/A <<endl;
}

int main(){
    long long H;
    scanf("%lld",&H);
    long long A;
    scanf("%lld",&A);
    solve(H, A);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    long long N, K;
    cin >> N >> K;
    long long ans = 0;
    for(long long i=K; i<=N+1; i++){
        long long a = (i*(2*N-i+1) - i*(i-1))/2+1;
        a %= MOD;
        ans += a;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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 V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int A, B;
  cin >> A >> B;
  cout << max({A + B, A - B, A * B}) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define _ "\n"
#define sz(x) (int)x.size();
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef  long long ll;
const int inf = int(1e9);
const int mod =1e9+7;
const int N = (int)2e5 + 5;


void solve(){
	int a,b;
	cin>>a>>b;
	for(int i=b-a+1;i<=b+a-1;i++)cout<<i<<" ";
}
int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

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

Measured memory_bytes: 1696
def minus26(idx):
    while idx >= 26:
        idx = idx - 26
    return idx
    
N = int(input())
S = list(input())

alphabet = ['A', 'B', 'C', 'D', 'E', 'F',
            'G', 'H', 'I', 'J', 'K', 'L',
            'M', 'N', 'O', 'P', 'Q', 'R',
            'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

S_idx = [alphabet.index(s)+N for s in S] 
S_idx = [minus26(idx) for idx in S_idx]
print(''.join([alphabet[idx] for idx in S_idx]))


Measured memory_bytes: 3316
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
 int A,B,flag=1,i;
 char c[15];
 cin>>A>>B;
 scanf("%s",c);
 for(i=0;i<strlen(c)&&flag;++i)
 {
 	if(i==A)
 	{
 		if(c[i]!='-')
 		{
 		
		 	flag=0;
		}
	}
  	else if(c[i]<'0'||c[i]>'9')
	 flag=0;
 }
 if(flag)cout<<"Yes"<<endl;
 else cout<<"No"<<endl;
 return 0;
} 

Measured memory_bytes: 256
import numpy as np

n,k=map(int,input().split())
A=np.array(input().split(),np.int64)
A.sort()

zero=A[A==0]
neg=A[A<0]
pos=A[A>0]

def f(x): # count pairs x or less
    cnt=0
    #zero
    if x>=0:
        cnt += len(zero)*n
    #pos
    cnt += A.searchsorted(x//pos,side="right").sum()
    #neg
    cnt += (n-A.searchsorted(-(-x//neg),side="left")).sum()
    #except a*a
    cnt-=np.count_nonzero(A*A<=x)
    return cnt//2

l=-10**18
r=10**18

while l<r:
    pov=(l+r)//2
    if f(pov)>=k:
        r=pov
    else:
        l=pov+1
print(l)

Measured memory_bytes: 34636
#include <bits/stdc++.h>
using namespace std;
#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++)
typedef int64_t llong;
#define INF 100000000000
#define n_max 100

int main(){
    int n;
    cin >> n;
    bool isopen[n_max][10];
    int kari;
    REP(i,n){
        REP(j,10){
            scanf("%d", &kari);
            if(kari) isopen[i][j]=true;
            else isopen[i][j]=false;
        }
    }
    int profit[n_max][11];
    REP(i,n){
        REP(j,11) scanf("%d",&profit[i][j]);
    }



    int flag=1;
    llong ans =-INF;
    while(flag < 1024){
        int ryoueigyou[n_max]={};

        REP(i,10){
            if( (flag & (1 <<i)) ){


            REP(j,n){
                if(isopen[j][i]) ryoueigyou[j]+=1;
            }
        }
        }
        llong tmp_ans=0;
        REP(j,n){
            tmp_ans+=profit[j][ ryoueigyou[j] ];
        }
        if(ans < tmp_ans) ans= tmp_ans;
        flag+=1;
    }
    cout << ans << endl;
}

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

int main(void){
    char topping[3];
    cin >> topping;

    int count = 0;
    for(int i = 0; i < 3; i++){
        if(topping[i] == 'o'){ count++; }
    }
    
    cout << (700 + count * 100) << endl;

    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0

for i in range(n):
    ans+=min(b[i],a[i])
    if a[i] < b[i]:
        diff = b[i] - a[i]
        ans+=min(diff,a[i+1])
        a[i+1] = a[i+1] - min(diff,a[i+1])
print(ans)

Measured memory_bytes: 19156
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int k = Integer.parseInt(sc.nextLine());
		int x = Integer.parseInt(sc.nextLine());
		int y = Integer.parseInt(sc.nextLine());
		int fee = (n-k) > 0? x * k + y * (n-k) : x * n;
		System.out.println(fee);
	}

}


Measured memory_bytes: 9428
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 6010
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dp[MAXN][3010][2];
int n,m;
int main(){
	SF("%d%d",&n,&m);
	m*=2;
	for(int i=1;i<=n;i++)
		dp[0][i][0]=1;
	dp[0][0][1]=1;
	for(int i=1;i<=m;i++){
		int top=n-(i%2);
		for(int j=0;j<=top;j++){
			if(j==0){
				if(i%2==1)
					dp[i][j][1]=(((dp[i-1][j][0]+dp[i-1][j][1])%MOD+dp[i-1][j+1][0])%MOD+dp[i-1][j+1][1])%MOD;
				else
					dp[i][j][1]=(dp[i-1][j][0]+dp[i-1][j][1])%MOD;
			}
			else{
				if(i%2==1){
					dp[i][j][1]=(dp[i-1][j][1]+dp[i-1][j+1][1])%MOD;
					dp[i][j][0]=(dp[i-1][j][0]+dp[i-1][j+1][0])%MOD;
				}
				else{
					dp[i][j][1]=(dp[i-1][j][1]+dp[i-1][j-1][1])%MOD;
					dp[i][j][0]=(dp[i-1][j][0]+dp[i-1][j-1][0])%MOD;
				}
			}
		}
	}
	int ans=0;
	for(int i=0;i<=n;i++)
		ans=(ans+dp[m][i][1])%MOD;
	PF("%d",ans);
}

Measured memory_bytes: 141440
s = input()
t = input()
r = 0
p = 0
x = 0
for i in t:
    if s.find(i) == -1:
        print(-1)
        exit()
    if p > s.find(i):
        if s[p:].find(i) == -1:
            x += 1
            p = s.find(i) + 1
        else:
            p = p + s[p:].find(i) + 1
    else:
        p = s.find(i) + 1
print(x * len(s) + p)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n1,n2,total;
  while ( cin >> n1 >> n2 ) {
    total = n1 + n2;
    int n = 0;
    while (1) {
      if ( total < 1 ) break;
      total /= 10;
      n++;
    }
    cout << n << endl;
  }
  return 0;
}

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

static const int MAX = 100;

void trace(int A[], int N)
{
	for(int i = 0; i < N; i++) {
		cout << A[i];
		if(i < N-1) cout << " ";
	}
	cout << endl;
}

void insertionSort(int A[], int N)
{
    int v, j;
	
	for(int i = 1; i < N; i++) {
		v = A[i];
		j = i - 1;
		while(j >= 0 && A[j] > v) {
			A[j+1] = A[j];
			--j;
		}
		A[j+1] = v;
		trace(A, N);
	}
}

int main()
{
	int A[MAX], N;
	
	cin >> N;
	
	for (int i = 0; i < N; i++) cin >> A[i];
	
	trace(A, N);
	insertionSort(A, N);
	
	return 0;
}

Measured memory_bytes: 1160
def main():
    n = int(input())
    s = list(input())
    r = 0
    g = 0
    b = 0
    # print(s)
    for i, rgb in enumerate(s):
        if rgb == 'R':
            r += 1
        elif rgb == 'G':
            g += 1
        else:
            b += 1


    # print(r)
    ans = 0
    mid = 0
    # print('A')
    for i, rgb in enumerate(s):
        # print(i)

        # print('A')
        for j in range(1,i+1):
            # print(i,j,rgb)
            if i+j >= n or i-j < 0:
                break
            # print(s[i-j],rgb,s[i+j])
            if rgb != s[i-j] and s[i-j] != s[i+j] and rgb != s[i+j]:
                mid += 1


    print(r * g * b - mid)
    # # print(mid)
    # for i, ss in enumerate(s):
    #     if i == 0:
    #         continue
    #     if ss == 'R':
    #         tmp = g[i-1] * (b[-1] - b[i])
    #         tmp += b[i-1] * (g[-1] - g[i])
    #         tmp -= mid[i]
    #     elif ss == 'G':
    #         tmp = r[i-1] * (b[-1] - b[i])
    #         tmp += b[i-1] * (r[-1] - r[i])
    #         tmp -= mid[i]
    #     else:
    #         tmp = g[i-1] * (r[-1] - r[i])
    #         tmp += r[i-1] * (g[-1] - g[i])
    #         tmp -= mid[i]
    #     ans += tmp
    # print(ans)

if __name__=='__main__':
    main()


Measured memory_bytes: 9216
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 string S;
 cin >> S;
 sort(S.begin(), S.end());
  
  bool flag = true;
  for(int i = 0;i<S.size()-1;i++){
    if(S[i] == S[i+1]){
      flag = false;
      break;
    }
  }
  if(flag) cout << "yes" << endl;
  else cout << "no" << endl;
  
}


Measured memory_bytes: 256
// Created by Tanuj Jain
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

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

	//#ifndef ONLINE_JUDGE
	//freopen("inputf.in","r",stdin);
	//freopen("outputf.in","w",stdout);
	//#endif

	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	for(int i=0;i<n;i++)
		cin>>v[i];
	vector<bool> dp(k+1);
	for(int stones=0;stones<=k;stones++)
	{
		for(int x : v)
		{
			if(stones>=x && !dp[stones-x])
				dp[stones]=true;
		}
	}
	if(dp[k])
		cout<<"First";
	else if(!dp[k])
		cout<<"Second";
	
}

Measured memory_bytes: 256
#include<stdio.h>
 main(){ 
	int N,K,i,j,k,l;
	l=0;
	scanf("%d %d",&N,&K);
	int a[200][200];
	int d[200],p[200];
	for(int h=0;h<200;h++){
		p[h]=0;
	}
	for(i=1;i<K+1;i++){
	scanf("%d",&d[i]);	
    for(j=1;j<d[i]+1;j++){
        scanf("%d",&a[i][j]);
        k=a[i][j];
		p[k]++;		}
		
		}
	for(k=1;k<=N;k++){
			if(p[k]==0)
			l++;
			
	}
	 printf("%d ",l);
 }

Measured memory_bytes: 1784
void main() {
	auto N = readAs!long;
	auto V = readAs!(long[]);
	writeln(V.sum - N * (N + 1) / 2);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 5636
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef int ftype;
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define forn(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define RETURN(x) do{cout << x << '\n'; return 0;}while(0)
#define FIRSTWIN do{cout << "Monocarp\n"; return 0;}while(0)
#define SECONDWIN do{cout << "Bicarp\n"; return 0;}while(0)

const int MAXN = 1e5+5;
const int MOD = 1e9+7;
const LL INF = 1e18+1;

int N;
char S[MAXN];

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N >> S;
    int ans = 1;
    fore(i,1,N-1) ans += (S[i] != S[i-1]);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
import sys
sys.setrecursionlimit(500000)
N, Q, *D = map(int, open(0).read().split())
val = [0 for _ in range(N+1)]
E = [[] for _ in range(N+1)]
D = list(zip(*[iter(D)]*2))
assert(len(D) == N+Q-1)
for i in range(N+Q-1):
  l, r = D[i][0], D[i][1]
  if i < N - 1:
  	E[l].append(r)
  	E[r].append(l)
  else:
    val[l] += r
visited = [False for _ in range(N+1)]
def dfs(c):
  visited[c] = True
  for ch in E[c]:
    if not visited[ch]:
      val[ch] += val[c]
      dfs(ch)
dfs(1)
print(' '.join(map(str, val[1:N+1])))

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	int N;
	string S;
	int count = 1;
	bool flag = false;

	cin >> N;
	cin >> S;

	for (int i = 1; i < N; i++)
	{
		if (S[i] == S[i - 1])
		{
			if (!flag)
				flag = true;
		}
		else
		{
			flag = false;
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if ((a % 2 == 1) && (b % 2 == 1)) {
    cout << "Odd" << endl;
  } else {
    cout << "Even" << endl;
  }
}


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

using namespace std;
using ll = long long;

const ll INF = 1000000000000000000LL;

int main() {
    int N;
    cin >> N;
    vector<ll> nums(N);
    bool zero = false;
    for (int i = 0; i < N; ++i) {
        cin >> nums[i];
        if (nums[i] == 0)
            zero = true;
    }
    if (zero) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    for (int i = 0; i < N; ++i) {
        if (nums[i] * ans < ans || nums[i] * ans > INF) {
            cout << -1 << endl;
            return 0;
        }
        ans *= nums[i];
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}
//long long int ruizyo(long long int aa, long long int bb){
  //  if(aa==0){
    //    return 1;
    //}
    //else if(aa%2==0){
      //  long long int tt=ruizyo(aa/2,bb);
        //return (tt*tt)%MOD;
    //}
    //else{
      //  return (ruizyo(aa-1,bb)*bb)%MOD;
    //}
//}フェルマ－のア


//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

//visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに


long long int n,cnt=0,ans=0,a[10000000],b,c,cmp=0,cmpp=0,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

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

       cin>>n;
       pos=n;
       rep(i,n){
           cin>>a[i];
           if(a[i]%4==0){
               cmp++;
           }
           else if(a[i]%2==0){
               cmpp++;
               fl=false;
           }
       }
       if(!fl){
      n=n-(cmpp-1);
       }
       //Cout(cmpp);
       Yes(n/2<=cmp || cmpp==pos);
       
return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

typedef long long ll;

const ll mod = 1000000007L;

#define MAXN 200020

ll fact[MAXN], inv[MAXN];

ll expo(ll a, ll b) {
	if (b == 0LL) return 1LL;
	ll ret = expo(a, b/2L);
	ret = (ret*ret)%mod;
	if (b&1LL) ret = (ret*a)%mod;
	return ret;
}

void init() {
	fact[0] = inv[0] = 1LL;
	for (int i=1; i<MAXN; i++) {
		fact[i] = (fact[i-1] * (ll)(i))%mod;
		inv[i] = expo(fact[i], mod-2L);
	}
}

ll bin(int p, int q) {
	return ((fact[p] * inv[q])%mod * inv[p-q])%mod;
}

int main() {
	init();
	int r,c,x,y,t;
	cin>>r>>c>>x>>y;
	x = r-x;
	t = r+c-2;

	ll ans = 0LL;
	for (int i=0; i<c-y; i++) {
		int k = y+i+x-1;
		ans += bin(y+i+x-1, y+i) * bin(t-1-k, r-1-x);
		ans %= mod;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,k;
    cin >> n >> k;
    int l[60];
    for(int i=0; i < n; ++i) cin >> l[i];
    sort(l, l + n, greater<int>());
    int sum=0;
    for(int i=0; i < k; i++){
        sum += l[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const ll INF = 1E+18;

ll a;
ll b;
ll c;
ll d;
ll n;
map<ll, ll> mp;

ll f (ll x) {
    if (x==0) return 0;
    if (x==1) return d;
    if (mp.count(x)) return mp[x];
    ll l2 = x - x%2;
    //ll r2 = ((x-1)/2 + 1)*2;
    ll r2 = l2+2LL;
    if (l2==2LL) r2 = 2LL;
    ll l3 = x - x%3;
    ll r3 = ((x-1)/3+1)*3;
    //ll r3 = l3 + 3LL;
    ll l5 = x - x%5;
    ll r5 = ((x-1)/5+1)*5;
    //ll r5 = l5 + 5LL;
    ll res = INF;
    if (d<=INF/x) res = d*x;
    //debug(x);
    res = min(res, abs(l2-x)*d+a+f(l2/2));
    //debug(x);
    res = min(res, abs(r2-x)*d+a+f(r2/2));
    //debug(x);
    res = min(res, abs(l3-x)*d+b+f(l3/3));
    //debug(x);
    res = min(res, abs(r3-x)*d+b+f(r3/3));
    //debug(x);
    res = min(res, abs(l5-x)*d+c+f(l5/5));
    //debug(x);
    res = min(res, abs(r5-x)*d+c+f(r5/5));
    //debug(x);
    mp[x] = res;
    return res;
}

int main(){
    int t;
    cin >> t;
    rep(i, t) {
        cin >> n >> a >> b >> c >> d;
        mp.clear();
        ll ans = f(n);
        cout << ans << endl;
    }    
    return 0;
}


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

int main(){
	int n;
	cin >> n;
	double probs[n];
	for(int i =0;i<n;i++)
		cin >> probs[i];
	double dp[n+1][n+1];
	memset(dp,0,sizeof(dp));
	dp[0][0] = 1.0;
	for(int i =1;i<=n;i++){
		dp[0][i] = 0.0;
	}

	for(int i =1;i<=n;i++){
		for(int j =0;j<=i-1;j++){
			dp[i][j+1]+= dp[i-1][j] * probs[i-1];
			dp[i][j] += dp[i-1][j]*(1-probs[i-1]);
		}
	}
	double ans = 0.0;
	for(int i = 1;i<=n;i++){
		if(i>n/2)
			ans+=dp[n][i];
	}
	cout <<fixed << setprecision(12) <<  ans << endl;
}

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

signed main(void)
{
	vector<long long> a(5);
	long long n, ans;

	cin >> n;
	rep(i, 5) cin >> a[i];
	sort(a.begin(), a.end());
	ans = (n / a[0] + 1) + 4;
	if (n % a[0] == 0) ans--;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
#include<stdbool.h>
int main()
{
 char s[11]={},t[12]={};
  
  scanf("%s %s",s,t);
  
  int i;
  bool b=true;
  
  for(i=0;i<strlen(s);i++)
  {
    if(s[i]!=t[i])
    {
      b=false;
    }
  }
  
  if(b==true)
  {
    printf("Yes\n");
  }
  else
  {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 1644
/**
    BISMILLAH
    @Author : Arham
*/
#include <bits/stdc++.h>
#define endl "\n"
#define found true
#define infinity 1e+10+10
#define not_found false
#define FOR(limit) for(int i = 0; i < limit; i++)
#define __FOR(limit) for(int j = 0; j < limit; j++)
#define __FOR__(limit) for(int k = 1; k <= limit; k++)
#define hello(a) a ? "Yes" : "No"
#define HELLO(a) a ? "YES" : "NO"
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pof pop_front
#define pob pop_back
#define I insert
#define fr front
#define B back
#define P push
#define pp pop
#define T top
#define F first
#define S second
/// getline (cin, string);
/// find (lower_bound(inclusive), upper_bound(exclusive), value);
/// set.find (value):
typedef long long lld;
using namespace std;

void solving_f() {
    string s;
    cin >> s;
    lld sum = not_found;
    for(lld i = not_found; i < s.size(); i++) {
        sum += s[i] - '0';
    }
    int count = found;
    if(sum % 9)
        count = not_found;
    string fin = hello(count);
    cout << fin << endl;
}

int main(string hello_world) {
    ios_base :: sync_with_stdio(not_found);
    cin.tie(NULL);
//    cout.tie(0);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    solving_f();

    return not_found;
}


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

int main() {
   int year, month, day;
   scanf("%d/%d/%d", &year, &month, &day);
   if (year > 2019 || (year == 2019 && month > 4) || (year == 2019 && month == 4 && day > 30))
      puts("TBD");
   else
      puts("Heisei");
   return 0;
}//main


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

typedef long long ll;

ll mod = 1000000007;



int main() {
	ll n;
	cin >> n;
	vector<pair<ll, ll> > v;
	ll lval = 0;
	ll rval = 0;
	vector<ll> all;
	for(int i=0; i<n; i++){
		ll x, y;
		cin >> x >> y;
		v.push_back(make_pair(x, y));
		all.push_back(x);
		all.push_back(y);
		lval+=x;
		rval+=y;
	}
	sort(all.begin(), all.end());
	ll cutoff = all[n-1];
	ll sum = 0;
	for(int i=0; i<n; i++){
		sum += all[i];
	}
	ll mn = sum + 2000000000;
	for(int i=0; i<n; i++){
		if(v[i].first <= cutoff && v[i].second <= cutoff){
			cout << sum << endl;
			return 0;
		}
		else if(v[i].first <= all[n-2]){
			mn = min(mn, v[i].second + sum - all[n-1]);
		}
		else if(v[i].second <= all[n-2]){
			mn = min(mn, v[i].first + sum - all[n-1]);
		} else{
			mn = min(mn, v[i].first + v[i].second + sum - all[n-1] - all[n-2]);
		}
	}
	cout << min(min(lval, rval), mn) << endl;
	
	return 0;
}

Measured memory_bytes: 3564
#include <stdio.h>
#include <string.h>
 
int main(void){
  int n, f, t = 0, h = 0;
  char c1[101], c2[101];
  scanf("%d", &n);
  while(n--){
    scanf("%s%s", c1, c2);
    f = strcmp(c1, c2);
    if(!f) t++,h++;
    else if(f > 0) t += 3;
    else if(f < 0) h += 3;
  }
  printf("%d %d\n", t, h);
  return 0;
}


Measured memory_bytes: 2044
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = []
for x in range(q):
    b.append(list(map(int, input().split())))

hikaku = 0
a_wa = sum(a)
cou = collections.Counter(a)
for i in range(q):
    a_wa += cou[b[i][0]] * b[i][1] - cou[b[i][0]] * b[i][0]
    cou[b[i][1]] += cou[b[i][0]]
    cou[b[i][0]] = 0

    print(a_wa)

Measured memory_bytes: 40564
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

int main(){
  ll N,ans=0;
  cin >> N;
  if(N%2==1){
    cout << 0 << endl;
    return 0;
  }
  else{
    ll X=10,K=1;
    while(K<=25){
      ans+=N/X;
      X*=5;
      K++;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
   int N,D;
   cin >> N >> D;
   int X[N][D];
   for(int i=0;i<N;i++){
      for(int j=0;j<D; j++){
         cin >> X[i][j];
      }
   }
   int cnt = 0;
   for(int i=0;i<N;i++){
      for(int j=i+1;j <N; j++){
         int d=0;
         for(int k=0;k<D;k++){
            d+= (X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
         }
         for(int k=0; k < 1000 && k*k <= d; k++){
            if(k*k == d){
               cnt++;
            }
         }
      }
   }
   cout << cnt << endl;

   return 0;
}


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

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


#define pb push_back
#define ff first
#define ss second
#define INF int(3e9)
#define BIG_INF ll(9e18)
#define SIZE 100001
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define len(v) int((v).size())
#define sqr(x) (x) * (x)
#define cube(x) (x) * (x) * (x)
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout);


ll binpow(ll a, ll b, ll MOD = BIG_INF)
{
    ll res = 1;

    while(b)
    {
        if(b & 1)
            res *= a;
        a *= a;
        b >>= 1;
        a %= MOD;
        res %= MOD;
    }

    return res % MOD;
}

const ll mod = 1e9 + 7;

int T = 1;
int n, m;
int a, b, c;
string s;


void solve()
{

    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << ' ' << b << ' ' << c;
    return;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//    filein;fileout;
////
//    cin >> T;

    while(T--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

int main(){
  int n,b,t;
  cin >> n;
  vector<int> d;
  REP(i,n){
    cin >> b;
    d.push_back(b);
  }
  SORT(d);
  b = d[0];
  t = 0;
  REP(i,n-1){
    if (b==d[i+1]) t++;
    b = d[i+1];
  }
  cout << n-t;
  return 0;
}

Measured memory_bytes: 256
// AOJ DPL_1_F 0-1 Knapsack Problem II
// 2018.5.9 bal4u

#include <stdio.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define INF 0xAAAAAAAALLU
unsigned dp[102][10002];

int knapsack01(int N, int W, int *v, int *w, int max)
{
	int i, j;
	unsigned nv, ans;

	memset(dp, INF, sizeof(dp)); dp[0][0] = 0;
	for (i = 0; i < N; i++) {
		for (j = 0; j <= max; j++) {
			if (j < v[i]) dp[i+1][j] = dp[i][j];
			else {
				nv = dp[i][j-v[i]] + w[i];
				if (nv < dp[i][j]) dp[i+1][j] = nv;
				else               dp[i+1][j] = dp[i][j];
			}
		}
	}
	ans = 0; for (i = 0; i <= max; i++) if (dp[N][i] <= (unsigned)W) ans = i; 
	return ans;
}

int val[102], weight[102];

int main()
{
	int n, N, W, i, vmax;

	n = in(), W = in(), vmax = 0;
	N = 0; for (i = 0; i < n; i++) {
		val[N] = in(), weight[N] = in();
		if (weight[N] <= W) {
			if (val[N] > vmax) vmax = val[N];
			N++;
		}
	}
	printf("%d\n", knapsack01(N, W, val, weight, n*vmax));
	return 0;
}


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



using namespace std;


int main()
{

	int n, k,sum=0;
	cin >> n >> k;

	vector<int> a;
	a.resize(n);
	for (int i = 0;i < n;i++) cin >> a[i];

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

	for (int i = n - 1;i > n - 1 - k;i--)
	{
		sum += a[i];
	}

	cout << sum << endl;


	return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
d = [["#" if i < 50 else "." for _ in range(100)] for i in range(100)]
for i in range(a - 1):
    d[(i // 50) * 4][(i % 50) * 2] = "."
for i in range(b - 1):
    d[99 - (i // 50) * 2][(i % 50) * 2] = "#"
print(100, 100)
for i in range(100):
    print(*d[i], sep="")

Measured memory_bytes: 9328
<?php
$d_g = explode(" ", (trim(fgets(STDIN))));

$quest = [];
for ($i = 0; $i < $d_g[0]; $i++) {
     $tmp = explode(" ", (trim(fgets(STDIN))));
     $quest[$i] = [
         'number' => (int)$tmp[0],
         'point' => ($i+1) * 100,
         'comp' => (($i+1) * 100) * $tmp[0] + $tmp[1]
     ];
}

$ans = PHP_INT_MAX;
for ($mask = 0; $mask < (1 << $d_g[0]); $mask++) {
    $sum = 0;
    $number = 0;
    $nokori = [];
    for ($i = 0; $i < $d_g[0]; $i++) {
         if(($mask >> $i) & 1) {
             $sum += $quest[$i]['comp'];
             $number += $quest[$i]['number'];
         } else {
             $nokori[] = $i;
         }
    }
    
    if($sum >= $d_g[1]) {
        $ans = min($ans, $number);
    } else {
        for ($i = 0; $i < $quest[$nokori[count($nokori) - 1]]['number'] - 1; $i++) {
             $sum += $quest[$nokori[count($nokori) - 1]]['point'];
             $number++;
             
             if($sum >= $d_g[1]) {
                $ans = min($ans, $number);
             }
        }
    }
}

echo $ans;

Measured memory_bytes: 4604
n, m, k = map(int, input().split())
a = list(map(int , input().split()))
b = list(map(int , input().split()))
import bisect

class Cumulative_Sum:
    def __init__(self, a):
        la = len(a)
        self.s = [0] * (la + 1)
        for i in range(la):
            self.s[i+1] = self.s[i] + a[i]
    # s[l]からs[r]までの和
    def sum(self, l, r):
        return self.s[r] - self.s[l]
csa = Cumulative_Sum(a)
csb = Cumulative_Sum(b)
#print(csa.s)
#print(csb.s)
ans = 0
for i in range(n+1):
    t = csa.s[i]
    if t > k:
        continue
    p = k - t
    bi = bisect.bisect_left(csb.s, p)
    ans = max(ans, i)
    if csb.s[m] <= p:
        ans = max(ans, i + m)
    else:
        ans = max(ans, i + bi-1)

print(ans)


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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= m; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
void solve(int r, int t){
  int c1 = (t / 30) * 5 + (r / 100);

    if(t % 30 == 0){
        if(r % 100 == 0){
          cout << c1 << endl;
          }else{
              cout << c1 << " " << (c1 + 1) << endl;
            }
      }else{
        if(r % 100 == 0){
            cout << c1 << " " << (c1 + 5) << endl;
          }else{
              cout << c1 << " " << (c1 + 1) << " " << (c1 + 5) << " " << (c1 + 6) << endl;
            }

        }
  }

int main(){
  int n;
  int at,bt;
  vector<pair<int,int>> fr;
  cin >> n;

  REP(i,n){
      cin >> at >> bt;
      fr.pb(make_pair(at,bt));
    }
    REP(i,n) solve(fr[i].first, fr[i].second);
    return 0;
}


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// *st.find_by_order(index), 0-based
// order_of_key(e)

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll N,D; cin>>N>>D;
	int ret=0;
	for (int i=0; i<N; i++) {
		ll X,Y; cin>>X>>Y;
		if(X*X+Y*Y<=D*D) ret++;
	}
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long               ll;
const int mod = 1e9+7;
#ifndef M_PI
const double M_PI = acos(-1.0);
#endif

int main(){
  int n;
  cin>>n;
  vector<int> bef(n+2), aft(n+2);
  vector<int> mult(n+2);
  vector<int> par_sum(n+2);
  bef[0] = 1;
  aft[n+1] = 1;
  for(int i=1; i<n+2; ++i){
    bef[i] = (ll)bef[i-1]*i%mod;
  }
  for(int i=n; i> 0; --i){
    aft[i] = (ll)aft[i+1]*i%mod;
  }
  for(int i=1; i<=n; ++i){
    mult[i] = (ll)bef[i-1]*aft[i+1]%mod;
    par_sum[i] = ((ll)par_sum[i-1]+mult[i])%mod;
  }
  ll res = 0;
  for(int i=0; i<n; ++i){
    int a;
    scanf("%d", &a);
    res += (ll)a*par_sum[i+1];
    res += (ll)a*par_sum[n-i];
    res -= (ll)a*par_sum[1];
    res %= mod;
  }
  res += mod;
  res %= mod;
  cout<<res<<'\n';
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int N;
	cin >> N;
	vector<int> a(N), b(N), c(N);
	for(int i = 0; i < N; i++) cin >> a[i];
	for(int i = 0; i < N; i++) cin >> b[i];
	for(int i = 0; i < N; i++) cin >> c[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	ll ans = 0;
	for(int i = 0; i < N; i++) {
		auto tmp = lower_bound(a.begin(), a.end(), b[i]);
		auto tmp2 = lower_bound(c.begin(), c.end(), b[i] + 1);
		ans += distance(a.begin(), tmp) * (N - distance(c.begin(), tmp2));
	}
	cout << ans;
	return 0;
}


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

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        for (int i = 0; i < n; i++) {
            String[] input = br.readLine().split(" ");

            double x1 = Double.parseDouble(input[0]);
            double y1 = Double.parseDouble(input[1]);
            double x2 = Double.parseDouble(input[2]);
            double y2 = Double.parseDouble(input[3]);
            double x3 = Double.parseDouble(input[4]);
            double y3 = Double.parseDouble(input[5]);

            double A = x2 - x1;
            double B = y2 - y1;
            double p = (y2 * y2 - y1 * y1 + x2 * x2 - x1 * x1) / 2;
            double C = x3 - x1;
            double D = y3 - y1;
            double q = (y3 * y3 - y1 * y1 + x3 * x3 - x1 * x1) / 2;

            double X = (D * p - B * q) / (A * D - B * C);
            double Y = (A * q - C * p) / (A * D - B * C);

            double r = Math.sqrt(Math.pow(X - x1, 2.0) + Math.pow(Y - y1, 2.0));

            System.out.printf("%.3f %.3f %.3f%n", X, Y, r);
        }
    }
}


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

long long N, M;
long long a[21005];
long long b[21005];
long long c[21005];

long long d[105][105];


int main(){
	for(int i = 0; i < 105; i++){
		for(int j = 0; j < 105; j++){
			d[i][j] = INT_MAX;
		}
		d[i][i] = 0;
	}


	cin >> N >> M;
	for(int i = 0; i < M; i++){
		cin >> a[i] >> b[i] >> c[i];
		a[i]--;b[i]--;
		d[a[i]][b[i]] = c[i];
		d[b[i]][a[i]] = c[i];
	}


	for(int k = 0; k < N; ++k){
		for(int i = 0; i < N; ++i){
			for(int j = 0; j < N; ++j){
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}


	set<int> used;

	for(int i = 0; i < M; i++){
		long long start = a[i];
		long long mid = b[i];
		long long mdis = c[i];

		for(int j = 0; j < N; j++){
			if(d[start][j] == mdis + d[mid][j]){
				used.insert(i);
			}
		}

	}
	cout << M - used.size() << endl;





}


Measured memory_bytes: 384
import java.util.*;

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

    Long n=sc.nextLong();

    for(long i=n;i>=1;i--){
      if(Math.sqrt(i)%1==0){
        System.out.println(i);
        break;
      }
    }


	}
}


Measured memory_bytes: 23892
import sys
import numpy as np
import heapq


def input():
    return sys.stdin.readline()[:-1]


def solve():
    N, K = map(int, input().split())
    S = input()
    cnt = 2*K
    for i in range(N-1):
        if S[i] == S[i + 1]:
            cnt += 1
    print(min(N-1, cnt))


if __name__ == "__main__":
    solve()


Measured memory_bytes: 12620
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int H,W;cin>>H>>W;
    if(H%3==0 || W%3==0){
        cout<<0<<endl;
        return 0;
    }
    else{
        ll ans=min(H,W);
        ll S1,S2,S3,dS;
        for(int w=1;w<=W-1;w++){
            S1=(ll)w*(ll)H;
            if(H%2==0){
                S2=S3=(ll)(W-w)*(ll)(H/2);
                dS=abs(S1-S2);
            }
            else{
                S2=(ll)(W-w)*(ll)(H/2);
                S3=(ll)(W-w)*(ll)(H/2+1);
                dS=max(S3-S2,max(abs(S1-S2),abs(S1-S3)));
            }
            ans=min(ans,dS);
        }
        for(int h=1;h<=H-1;h++){
            S1=(ll)h*(ll)W;
            if(W%2==0){
                S2=S3=(ll)(H-h)*(ll)(W/2);
                dS=abs(S1-S2);
            }
            else{
                S2=(ll)(H-h)*(ll)(W/2);
                S3=(ll)(H-h)*(ll)(W/2+1);
                dS=max(S3-S2,max(abs(S1-S2),abs(S1-S3)));
            }
            ans=min(ans,dS);
        } 
        cout<<ans<<endl;
        return 0;       
    }
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N, M;
  cin >> N >> M;
  ll res = min(N, M / 2);
  M -= res * 2;
  res += M / 4;
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var x, a, b int
	fmt.Scan(&x, &a, &b)
	if a >= b {
		fmt.Println("delicious")
	} else if b-a <= x {
		fmt.Println("safe")
	} else {
		fmt.Println("dangerous")
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


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

int main(){
	string s;
	int i_c;
	cin >> s;
	// condition 1
	if(s[0] != 'A'){
		cout << "WA" << endl;
		return 0;
	}
	// condition 2
	if(count(s.begin()+2, s.end()-1, 'C') != 1){
		cout << "WA" << endl;
		return 0;
	}
	// condition 3
	for(int i=1; i<s.length(); i++){
		if(s[i] == 'C'){
			i_c = i;
			break;
		}
	}
	for(int i=1; i<s.length(); i++){
		if(i == i_c)
			continue;
		if(!(s[i] >= 'a' && s[i] <= 'z')){
			cout << "WA" << endl;
			return 0;
		}
	}
	cout << "AC" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    int x;
    cin >> x;
    if(x==3||x==5||x==7) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256