akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
 
using namespace std;
typedef int64_t ll;
typedef vector<int64_t> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<vin> vvin;
typedef vector<vvin> vvvin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<vd> vvd;
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define SIZE(a) int((a).size())
vin r(0),g(0),b(0);
int main(){
  ll n,ans=0;
  cin>>n;
  rep(i,0,n){
    char x;cin>>x;
    if(x=='R'){r.emplace_back(i+1);}
    if(x=='G'){g.emplace_back(i+1);}
    if(x=='B'){b.emplace_back(i+1);}
  }
  int R=SIZE(r);
  rep(i,0,SIZE(g)){
    rep(j,0,SIZE(b)){
      ll c,d,e;
      c=binary_search(r.begin(),r.end(),(g[i]+b[j])/2);
      if((g[i]+b[j])%2!=0){c=0;}
      d=binary_search(r.begin(),r.end(),2*b[j]-g[i]);
      e=binary_search(r.begin(),r.end(),2*g[i]-b[j]);
      ans+=R-c-d-e;
    }
  }
  if(n<=2){cout<<0<<endl;}
  else{cout<<ans<<endl;}
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <random>
#include <algorithm>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

#define FOR(i,a,b) for(int i = a; i < b; ++i)
#define REP(i,n)   for(int i = 0; i < n; ++i)
typedef long long ll;
typedef unsigned long long ull;

ull powmod(ull a, ull b, ull mod) {ull res = 1; for(; b; b >>= 1){if (b & 1) {res = res * a % mod;} a = a * a % mod;} return res;}

int main(){
  long double r;
  cin >> r;

  long double s = M_PI * (r * r);

  long double c = M_PI * 2 * r;

  cout << fixed << setprecision(5) << s << " " << fixed << setprecision(5) << c << "\n";
 
}



Measured memory_bytes: 3252
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int v[] = new int[n];
		double sum = 0;
		for (int i = 0; i < n; i++) {
			v[i] = sc.nextInt();
		}
		Arrays.sort(v);
		sum = (v[0] + v[1]) / 2.0;
		for (int i = 2; i < n; i++) {
			sum = (sum + v[i]) / 2.0;
		}
		System.out.println(sum);
	}
}


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

#define ll long long
#define N_MAX 52

using namespace std;

const ll MOD = 1e9+7;

int n;

ll k;

ll ma[N_MAX][N_MAX];

ll ans[N_MAX][N_MAX];

ll aux[N_MAX][N_MAX];

void prod1 ()
{
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
        {
            aux[i][j] = 0;
            for(int k = 1; k <= n; k++)
            {
                aux[i][j] += ans[i][k] * ma[k][j] % MOD;
                if(aux[i][j] >= MOD)
                    aux[i][j] -= MOD;
            }
        }
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            ans[i][j] = aux[i][j];
}

void prod2 ()
{
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
        {
            aux[i][j] = 0;
            for(int k = 1; k <= n; k++)
            {
                aux[i][j] += ans[i][k] * ans[k][j] % MOD;
                if(aux[i][j] >= MOD)
                    aux[i][j] -= MOD;
            }
        }
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            ans[i][j] = aux[i][j];
}

void pwr (ll e)
{
    if(e == 1)
        return;
    if(e & 1)
    {
        pwr(e ^ 1);
        prod1();
        return;
    }
    pwr(e >> 1);
    prod2();
}

int main()
{
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
        {
            cin >> ma[i][j];
            ans[i][j] = ma[i][j];
        }
    pwr(k);
    ll total = 0;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
        {
            total += ans[i][j];
            if(total >= MOD)
                total -= MOD;
        }
    cout << total << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
int main(){
    int x,count=0,i=0;
    cin >> x;
    while(x>count){
        i++;
        count+=i;
    }
    cout << i << endl;
}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        long n = long.Parse(Console.ReadLine());
        var list = new List<long>();
        for (int i = 0; i < 5; i++)
        {
            list.Add(long.Parse(Console.ReadLine()));
        }
        Console.WriteLine(Math.Ceiling((decimal)n / list.Min()) + 4);
    }
}

Measured memory_bytes: 13780
#include<bits/stdc++.h>
using namespace std;
int visit[101],d[101],f[101],t;
int n,m[101][101];
static const int WHITE=0;
static const int GRAY=1;
void dfs(int u){
  visit[u]=GRAY;
  d[u]=++t;
  for(int v=0;v<n;++v){
    if(m[u][v]==0) continue;
    if(visit[v]==WHITE) dfs(v);
    }
  f[u]=++t;
}
int main(){
  int u,v,k;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(int j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      m[u][v]=1;
    }
  }
  for(int i=0;i<n;i++){
    if(visit[i]==WHITE) dfs(i);
  }
  for(int j=0;j<n;j++){
    printf("%d %d %d\n",j+1,d[j],f[j]);
  }
  return 0;
}


Measured memory_bytes: 3240
n = int(input())
pcount = 0
p = 0
mcount = 0
m = 0
a = list(map(int,input().split()))
if a[0] > 0:
    p = a[0]
    m = -1
    mcount = a[0] + 1
elif a[0] < 0:
    p = 1
    pcount = abs(a[0]) + 1
    m = a[0]
else:
    p = 1
    pcount = 1
    m = -1
    mcount = 1
for i in range(1,n):
    p += a[i]
    m += a[i]
    if i % 2 == 1:
        if p >= 0:
            pcount += p+1
            p = -1
        if m <= 0:
            mcount += abs(m) + 1
            m = 1
    else:
        if p <= 0:
            pcount += abs(p) + 1
            p = 1
        if m >= 0:
            mcount += m + 1
            m = -1
print(min(pcount,mcount))

Measured memory_bytes: 63216
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

n.times do |i|
  a[i] -= i
end

a.sort!
center = a[n/2]

sum = 0
n.times do |i|
  sum += (a[i]-center).abs
end

printf("%d\n",sum)

Measured memory_bytes: 19456
n = input()

a = list(map(int,input().split()))

temp = pow(10, 18)
ans = 1
flag = 0

if 0 in a:
    print(0)
    flag = 1
else:
    for i in a:
        ans = ans * i
        if ans > temp:
            print(-1)
            flag = 1
            break

if flag == 0:
    print(ans)


Measured memory_bytes: 21640
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int d[128][128],solve[128];
int main(){
      int n,m,row,t;
      queue<int> que;
      cin >> n;
      for(int i= 0;i<n;i++){
            cin >>row>>m;
            for(int j = 0;j<m;j++){
                  cin>>t;
                  d[row][t] = 1;
            }
      }
      fill(solve,solve+n+2,-1);
      que.push(1);
      solve[1] = 0;
      while(!que.empty()){
            int p = que.front();
            que.pop();
            for(int i = 1;i<=n;i++){
                  if(d[p][i] && solve[i]==-1){
                        que.push(i);
                        solve[i] = solve[p] + 1;
                  }
            }
      }
      for(int i = 1;i<=n;i++)cout << i << ' '<< solve[i]<<endl;
}

Measured memory_bytes: 1252
#include <iomanip>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using ll = long long;
int main() {
	int n, m;
	cin >> n >> m;
	vector<int> G[n];
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	vector<int> par(n), dist(n, 1e9);
	rep(i, n) par[i] = i;
	queue<int> que;
	que.push(0);
	dist[0] = 0;
	while (!que.empty()) {
		int q = que.front();
		que.pop();
		for (auto nq : G[q]) {
			if (dist[q] + 1 < dist[nq]) {
				dist[nq] = dist[q];
				que.push(nq);
				par[nq] = q;
			}
		}
	}
	cout << "Yes" << endl;
	repl(i, 1, n) cout << par[i] + 1 << endl;
	return 0;
}

Measured memory_bytes: 10500
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		long a = sc.nextInt();
		long b = sc.nextInt();
		
		int[] x = new int[n];
		for(int i=0;i<n;i++){
			x[i] = sc.nextInt();
		}
		
		long increase = 0;
		for(int i=0;i<n-1;i++){
			long dis = x[i+1]-x[i];
			if(dis*a<b)
				increase+=dis*a;
			else
				increase+=b;
		}
		
		System.out.println(increase);
	}
}


Measured memory_bytes: 48048
// Reads multiple ints in a line, separate by a space.
// It works even if the actual number of ints is smaller than n.
// WARNING: This function does not work for -2^31.
// NOTE: This function does not handle error cases.
fun fastReadInts(n: Int): IntArray {
  val xs = IntArray(n)
  val s = readLine()!!
  var currentValue = 0
  var isNegative = false
  var currentIndex = 0
  for (c in s) {
    if (c == ' ') {
      xs[currentIndex] = currentValue * if (isNegative) -1 else 1
      currentValue = 0
      isNegative = false
      currentIndex++
    } else if (c == '-') {
      isNegative = true
    } else {
      currentValue *= 10
      currentValue += c - '0'
    }
  }
  xs[currentIndex] = currentValue * if (isNegative) -1 else 1
  return xs
}

fun countLessThan(xs: IntArray, v: Int): Int {
  if (xs.last() < v) {
    return xs.size
  }
  if (xs[0] >= v) {
    return 0
  }

  var l  = 0
  var u = xs.size - 1
  while (u - l >= 2) {
    val m = (l + u) / 2
    if (xs[m] < v) {
      l = m
    } else {
      u = m
    }
  }
  return u
}

fun countGreaterThan(xs: IntArray, v: Int): Int {
  if (xs[0] > v) {
    return xs.size
  }
  if (xs.last() <= v) {
    return 0
  }

  var l  = 0
  var u = xs.size - 1
  while (u - l >= 2) {
    val m = (l + u) / 2
    if (xs[m] <= v) {
      l = m
    } else {
      u = m
    }
  }
  return xs.size - u
}

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val xs = fastReadInts(n)
  val ys = fastReadInts(n)
  val zs = fastReadInts(n)
  xs.sort()
  ys.sort()
  zs.sort()

  val ans = ys.map { y -> countLessThan(xs, y).toLong() * countGreaterThan(zs, y).toLong() }.sum()
  println(ans)
}

Measured memory_bytes: 53836
#include <bits/stdc++.h>
#include <algorithm>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long 
#define pb push_back
#define mk make_pair
#define mod 1e9+7
using namespace std;

ll gcd(ll a, ll b){
    return __gcd(a,b);
}

ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}

bool isPrime(ll n){
    if(n <= 1) return false;
    for(ll i=2; i<=sqrt(n); i++){
        if(n%i == 0){
            return false;
        }
    }
    return true;
}

void solve(){
    ll n;
    cin >> n;
    for(ll i=n; i<=n+n; i++){
        if(isPrime(i)){
            cout << i ;
            return;
        }
    }
}

int main() {
    fast;
    solve();
	//ll t; cin >> t; while(t--){ solve(); }
	return 0;
}

Measured memory_bytes: 3636
import heapq
n,m = map(int,input().split())
a = list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(a)
for i in range(m):
  maxv = heapq.heappop(a)*(-1)
  heapq.heappush(a,(maxv//2)*(-1))
print(sum(a)*(-1))

Measured memory_bytes: 20260
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repp(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

int prime[35000];
bool is_prime[35001];

signed main(){
    int N = 35000, p = 0;

    rep(i, 0, N) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    rep(i, 2, N){
        if(is_prime[i]) prime[p++] = i;
        for(int j = 2 * i; j <= N; j += i) is_prime[j] = false;
    }

    int d[70000] = {};
    rep(i, 0, p){
        rep(j, i, p){
            d[prime[i] + prime[j]]++;
        }
    }

    int n;
    while(cin >> n, n){
        cout << d[n] << endl;
    }
}

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

namespace AtCoder
{
	public class ABC
	{
		static long mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int n = int.Parse(Console.ReadLine());
			string s = Console.ReadLine();
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			if (n % 2 == 0 && s.Substring(0, n / 2) == s.Substring(n / 2, n / 2)) {
				Console.WriteLine("Yes");
			} else {
				Console.WriteLine("No");
			}


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13140
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef unsigned long long ll;

#define MAX_N 30

int maze[MAX_N][MAX_N];
int verticalWall[MAX_N][MAX_N];
int horizontalWall[MAX_N][MAX_N];

void init(){
	rep(i,MAX_N){
		rep(j,MAX_N){
			maze[i][j] = -1;
			verticalWall[i][j] = 0;
			horizontalWall[i][j] = 0;
		}
	}
}

struct node{
	int h;
	int w;
	int time;
};

int main()
{
	int h,w;
	cin>>w>>h;
	while( !(h == 0 && w == 0)){
		init();
		for(int i = 0; i != (2*h - 1); i++){
			if(i % 2 == 0){
				rep(j,(w-1)){
					cin>>verticalWall[i/2][j];
				}
			}else{
				rep(j,w){
					cin>>horizontalWall[(i-1)/2][j];
				}
			}
		}
		struct node now;
		now.h = 0;
		now.w = 0;
		now.time = 0;
		queue<struct node> que;
		que.push(now);
		maze[0][0] = 0;
		while( que.empty() != true){
			now = que.front();
			que.pop();
			int dh[4] = {-1,0,0,1};
			int dw[4] = {0,-1,1,0};
			rep(i,4){
				int nh = now.h + dh[i];
				int nw = now.w + dw[i];
				if( 0 <= nh && nh < h && 0 <= nw && nw < w){
					struct node next;
					if( i == 0 && horizontalWall[now.h - 1][now.w] == 0 && maze[nh][nw] == -1){
						next.h = nh;
						next.w = nw;
						next.time = now.time + 1;
						maze[nh][nw] = next.time;
						que.push(next);
					}else if( i == 3 && horizontalWall[now.h][now.w] == 0 && maze[nh][nw] == -1){
						next.h = nh;
						next.w = nw;
						next.time = now.time + 1;
						maze[nh][nw] = next.time;
						que.push(next);
					}else if( i == 1 && verticalWall[now.h][now.w-1] == 0 && maze[nh][nw] == -1){
						next.h = nh;
						next.w = nw;
						next.time = now.time + 1;
						maze[nh][nw] = next.time;
						que.push(next);
					}else if( i == 2 && verticalWall[now.h][now.w] == 0 && maze[nh][nw] == -1){
						next.h = nh;
						next.w = nw;
						next.time = now.time + 1;
						maze[nh][nw] = next.time;
						que.push(next);
					}
				}
				/*rep(i,h){
					rep(j,w) cout<<maze[i][j]<<" ";
					cout<<endl;
				}*/
			}
		}
		if(maze[h-1][w-1] == -1){
			cout<<0<<endl;
		}else{
			cout<<maze[h-1][w-1]+1<<endl;
		}
		cin>>w>>h;
	}
	return 0;
}




Measured memory_bytes: 3144
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int s;
    cin >> s;

    int a = 1;
    while(a * a < s){
        a++;
    }
    int r;
    if(a * a == s){
        r = 0;
    }else{
        r = a - s % a;
    }

    cout << 0 << " " << 0 << " ";
    cout << a << " " << 1 << " ";
    cout << r << " " << (s + r) / a << endl;

    return 0;
}


Measured memory_bytes: 504
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String inp = in.next();
		boolean w = true;
		for(int i = 0; i < inp.length(); i++) {
			int count = 0;
			for (int j = 0; j < inp.length(); j++){
				if((inp.charAt(i) == inp.charAt(j)))
					count++;
			}
			if (count % 2 != 0){
				w = false;
				break;
			}
		}
		if (w == false)
			System.out.println("No");
		else
			System.out.println("Yes");
		
	}
}

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

typedef long long ll;

const int MAX = 1e6 + 10;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin >> n;
    ll sum = 0;
    for (int x = 1; x <= n; x++) {
        if ((x % 3 != 0) && (x % 5 != 0)) {
            sum += (ll) x;
        }
    }
    cout << sum;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  std::vector<std::string> s;
  for (int i = 0; i < n; i++) {
    std::string m1;
    cin >> m1;
    s.push_back(m1);
  }
  std::vector<int> count('z' - 'a' + 1, 0);
  bool first = true;
  for (auto tgt_s : s) {
    if (first) {
      first = false;
      std::vector<int> temp_count('z' - 'a' + 1, 0);
      for (auto tgt_c : tgt_s) {
        temp_count[tgt_c - 'a']++;
      }
      count = temp_count;
    } else {
      std::vector<int> temp_count('z' - 'a' + 1, 0);
      for (auto tgt_c : tgt_s) {
        temp_count[tgt_c - 'a']++;
      }
      for (int i = 0; i < 'z' - 'a' + 1; i++) {
        count[i] = std::min(count[i], temp_count[i]);
      }
    }
  }
  std::string result;
  for (int i = 0; i < 'z' - 'a' + 1; i++) {
    for (int j = 0; j < count[i]; j++) {
      result += (i + 'a');
    }
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

N = int(readline())
S = [readline().rstrip() for _ in range(N)]

def count_cb_ob(s):
    st = []
    for i, si in enumerate(s):
        if si == '(' or len(st) == 0 or st[-1] != '(':
            st.append(si)
        else:
            st.pop()
    return st.count(')'), st.count('(')

cb_obs = map(count_cb_ob, S)
f, b, s = [], [], []
for down, up in cb_obs:
    (f if down < up else (s if down == up else b)).append((down, up))

f = sorted(f)
b = sorted(b, key=lambda x:x[1], reverse=True)

count = 0
ans = 'Yes'
for down, up in (*f, *s, *b):
    count -= down
    if count < 0:
        ans = 'No'
    count += up

if count != 0:
    ans = 'No'

print(ans)

Measured memory_bytes: 107532
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int s;
  cin >> s;
  cout << s / 3600 << ':' << s % 3600 / 60 << ':' << s % 60 << endl;
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define IMP cout << "IMPOSSIBLE" << endl
#define Imp cout << "Impossible" << endl
#define imp cout << "impossible" << endl
#define M1 cout << "-1" << endl
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int h, a;
    cin >> h >> a;
    cout << dup(h, a) << endl;
}

signed main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

int main(){
   long long int Q, H, S, D, N;
   std::cin >> Q >> H >> S >> D >> N;
   long long int M = std::min(std::min(4*Q, 2*H), S);
   if (2*M <= D){
      std::cout << N*M << std::endl;
   } else{
      std::cout << (N/2)*D+(N%2)*M << std::endl;
   }

}



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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 998244353

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=3033;
int a[mxn],n,s;

void add(ll &a, ll b){
	a%=MOD; b%=MOD; a+=b; a%=MOD;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	cin >> n >> s;
	for(int i=1; i<=n; i++)cin >> a[i];
	sort(a+1,a+n+1);
	vector<ll>dp(s+1);
	dp[0]=1LL;
	for(int i=1; i<=n; i++){
		vector<ll>prev(s+1);
		swap(dp,prev);
		for(int j=0; j<=s; j++){
			add(dp[j],prev[j]*2LL);
			if(j+a[i]<=s)add(dp[j+a[i]],prev[j]);
		}
	}
	cout << dp[s] << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 3676
#include <iostream>
#include <string>
using namespace std;
int main(void){
  int a;
  cin >> a;
  if(a == 22)
  cout << "Christmas Eve Eve Eve" << endl;
  else if(a == 23)
    cout << "Christmas Eve Eve" << endl;
  else if(a == 24)
    cout << "Christmas Eve" << endl;
  else if(a ==25)
    cout << "Christmas" << endl;
  
  return 0;
}
    

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n, m;
  bool used[SIZE*2] = {};
  int a[SIZE*3] = {};
  
  scanf("%d%d", &n, &m);

  for(int i=0;i<m;i++){
    scanf("%d", a+i);
  }

  reverse(a, a+m);
  for(int i=0;i<n;i++){
    a[i+m] = i+1;
  }

  for(int i=0;i<n+m;i++){
    if(!used[a[i]]){
      printf("%d\n", a[i]);
      used[a[i]] = true;
    }
  }
  
  return 0;
}



Measured memory_bytes: 4596
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
const int INF = INT_MAX / 2;

typedef long long ll;

int N;
ll d[10], v[10];

ll GCD(ll a, ll b)
{
	if(b == 0) return a;
	return GCD(b, a % b);
}

ll LCM(ll a, ll b)
{
	return a / GCD(a, b) * b;
}

int main(){
	while(cin >> N, N)
	{
		int M, E, J;
		for(int i = 0; i < N; i++)
		{
			cin >> M >> E >> J;
			char ans;
			if(M == 100 || E == 100 || J == 100) ans = 'A';
			else if((M + E) / 2 >= 90) ans = 'A';
			else if((M + E + J) / 3 >= 80) ans = 'A';
			else if((M + E + J) / 3 >= 70) ans = 'B';
			else if((M + E + J) / 3 >= 50 && (M >= 80 || E >= 80)) ans = 'B';
			else ans = 'C';
			printf("%c\n", ans);
		}
	}
	return 0;
}

Measured memory_bytes: 1144
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input().split())
 
n, p = rli()
a = rli()
 
odd = 0
even = 0
for i in a:
    if(i % 2 == 0):
        even += 1
    else:
        odd += 1
ans = 2**max(0, odd-1)*2**(even)
if(p == 1 and odd == 0):
    ans = 0
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N = 105;
const int W = 1e5+5;
long long dp[N][W];
int main()
{
    long long n,lim;
    scanf("%lld %lld",&n,&lim);
    for(long long i=1,w,v;i<=n;i++)
    {
        scanf("%lld %lld",&w,&v);
        for(long long j=lim;j>=w;j--) dp[i][j] = max(dp[i-1][j],dp[i-1][j-w]+v);
        for(long long j=w-1;j>=0;j--) dp[i][j] = dp[i-1][j];
    }
    printf("%lld\n",dp[n][lim]);
    return 0;
}


Measured memory_bytes: 79360
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n, m;
    while (cin >> n >> m && n){
        VI a(n), b(m);
        int sa = 0, sb = 0;
        REP(i,n){
            cin >> a[i];
            sa += a[i];
        }
        REP(i,m){
            cin >> b[i];
            sb += b[i];
        }
        int x = 1e9, y = 1e9;
        REP(i,n) REP(j,m){
            if (2*(b[j]-a[i]) == sb-sa && a[i]+b[j] < x+y){
                x = a[i];
                y = b[j];
            }
        }

        if (x == 1e9) cout << -1 << endl;
        else cout << x << " " << y << endl;
    }

    return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){

  int n;
  cin >> n;
  int c[5];
  ll res = 0;
  REP(i,5)c[i] = 0;
  REP(i,n){
    string s;cin >> s;
    if(s[0] == 'M')c[0]++;
    if(s[0] == 'A')c[1]++;
    if(s[0] == 'R')c[2]++;
    if(s[0] == 'C')c[3]++;
    if(s[0] == 'H')c[4]++;
  }
  for(int bit = 1;bit < (1 << 5);bit++){
    vector<int> use;
    REP(i,5)if(bit >> i & 1)use.push_back(i);
    if(use.size() != 3)continue;
    ll sum = 1;
    REP(i,3)sum *= c[use[i]];
    res += sum;
  }
  cout << res << endl;

  





  return 0;
}

Measured memory_bytes: 256
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}          // Least Commont Multiple オーバーフローしないように先に割る

const ll INF = LONG_MAX;
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; }

int main(int argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in(argv[1]);
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;
    int o = n;
    if (n%2) n+=1;
    cout << double(n) /2.0 / o;

    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



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

using namespace std;
#define Real double
Real eps=1e-12;

Real add(Real a,Real b){
	if(abs(a+b)<eps*(abs(a)+abs(b))) return 0;
	return a+b;

}

bool equal(Real a,Real b){
	return add(a,-b)==0;
}

struct P{
	Real x,y;
	P() {}
	P(Real x,Real y):x(x),y(y) {}
	P operator+(P p) const{return P(add(x,p.x),add(y,p.y));}
	P operator-(P p) const{return P(add(x,-p.x),add(y,-p.y));}
	P operator*(Real d) const{return P(x*d,y*d);}
	Real dot(P p) const {return add(x*p.x,y*p.y);}
	Real dist(P p) const {return sqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y));}
};

Real square(Real r){
	return r*r;
}
Real dist(P p1,P p2,P q){
	q=q-p1;
	p2=p2-p1;
	return sqrt((q.dot(q)*p2.dot(p2)-square(q.dot(p2)))/p2.dot(p2));
}

Real distseg(P p1,P p2,P q){
	Real d=(q-p1).dot(p2-p1)/p2.dist(p1);
	if(d<0) return q.dist(p1);
	if(d>p2.dist(p1)) return q.dist(p2);
	return dist(p1,p2,q);
}

//int ans[1000];
int mr[1000];

double r[20];
P p[2][20];

vector<int> G[(1<<16)];
int z[(1<<16)];
int saiki(int e){

	if(G[e].size()==0) return 0;
	if(z[e]>=0) return z[e];
int w=-1;
	for(int i=0;i<G[e].size();i++){
		w=max(w,saiki(G[e][i]));
	}
	z[e]=w+1;
	return w+1;

}


int main() {
int n;
cin>>n;

for(int i=0;i<n;i++){
	cin>>r[i]>>p[0][i].x>>p[0][i].y>>p[1][i].x>>p[1][i].y;
}
for(int i=0;i<(1<<16);i++) z[i]=-1;
	
	for(int i=0;i<(1<<n);i++){
//		cout<<i<<endl;
		for(int j=0;j<n;j++){
			if((i&(1<<j))) continue;
				bool b=true;
			for(int k=0;k<n;k++){
				if(k==j) continue;
				int rr;
				if(i&(1<<k)) rr=1;
				else rr=0;

				if(distseg(p[0][j],p[1][j],p[rr][k]) < r[j]+r[k]) b=false;

			}
			if(!b) continue;
			G[i].push_back(i+(1<<j));
	//		cout<<i<<" "<<(i+ (1<<j))<<endl;

		}

	}


	cout<<saiki(0)<<endl;



    return 0;

}


Measured memory_bytes: 8840
<?php
        for($loop_cnt = 0; $loop_cnt < 5; $loop_cnt++)
        {

                $data_set = array();
                $data = array();

                // 変換表数設定
                $input_n = trim(fgets(STDIN));
                if( 0 == $input_n)
                {
                        break;
                }

                // 変換表設定
                for($loop_n = 0; $loop_n < $input_n; $loop_n++)
                {
                        $input_conv = explode( " " , trim(fgets(STDIN)) );

                        $data_set = $data_set + array( $input_conv[0] => $input_conv[1]) ;
                }

                // データ数設定
                $input_m = trim(fgets(STDIN));

                // データ設定
                for($loop_m = 0; $loop_m < $input_m; $loop_m++)
                {
                        $input_data = trim(fgets(STDIN));
                        $data[$loop_m] = $input_data;
                }

                // 変換後出力
                $work = [];
                for($loop_m = 0; $loop_m < $input_m; $loop_m++)
                {
                        if( isset( $data_set[$data[$loop_m]] ) )

                        {
                                $work[] = $data_set[ $data[$loop_m] ];
                        }
                        else
                        {
                                $work[] = $data[$loop_m];
                        }
                }
                echo implode('' , $work);
                echo "\n";
        };
?>


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

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  vector<int> y(n);
  for(int i = 0; i < n; i++){
    cin >> x.at(i);
  }
  for(int i = 0; i < n; i++){
    cin >> y.at(i);
  }
  int answer = 0;
  for(int i = 0; i < n; i++){
    if(x.at(i) - y.at(i) >= 0){
      answer += x.at(i) - y.at(i);
    }
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a < 6){
            b = 0;
        }else if(a < 13){
            b = b/2;
        }
		System.out.println(b);
	}
}


Measured memory_bytes: 22740
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {
	int N,an=0;
	cin >> N;
	string s = "NO";
	vector<ll> vec(N);
	vector<ll> te(N);
	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
		te.at(i)= vec.at(i);
	}
	sort(vec.begin(), vec.end());
	
	rep(i, N) {
		if (te.at(i) != vec.at(i)) {
			an++;
		}
	}
	if (an == 2||an==0) {
		s = "YES";
	}
		cout << s << endl;
	
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,x,m,sum;
vector<int>v;
set<int>s;
signed main(){
	cin>>n>>x>>m;
	for(;!s.count(x);x=x*x%m)
		s.insert(x),v.push_back(x);
	if(n<=v.size()){
		for(int i=0;i<n;i++)sum+=v[i];
		cout<<sum;return 0;
	}
	int t=v[v.size()-1]*v[v.size()-1]%m,p=0;
	for(int i=0;i<v.size();i++)
	    if(v[i]==t){p=i;break;}
	for(int i=p;i<v.size();i++)sum+=v[i];
	sum*=(n-p)/(v.size()-p);
	n=(n-p)%(v.size()-p)+p;
	for(int i=0;i<n;i++)sum+=v[i];
	cout<<sum;
}


Measured memory_bytes: 5968
import sys
N,Y=map(int,input().split())
Y=Y//1000
if N>Y or N*10<Y:
  print(-1,-1,-1)
  sys.exit()
for i in range(N+1):
  for j in range(N-i+1):
    k=N-i-j
    if i+5*j+10*k==Y:
      print(k,j,i)
      sys.exit()
print(-1,-1,-1)

Measured memory_bytes: 65404
N,M = map(int, input().split())
s = [list(map(int,input().split())) for _ in range(N)]
c = [list(map(int,input().split())) for _ in range(M)]

for i in range(N):
    min_dis = float("inf")
    min_dis_idx = 0
    for j in range(M):
        dis = abs(s[i][0]-c[j][0]) + abs(s[i][1]-c[j][1])
        if min_dis > dis:
            min_dis = dis
            min_dis_idx = j+1
    print(min_dis_idx)
        


Measured memory_bytes: 3064
n = input()
lis = list(map(int,input().split()))

lisf = 0
lisb = 0
wide = 100000

n = int(n)-1
for s in range(n):
  for i in range(s+1):
    lisf += lis[i]
  for t in range(n-s+1):
    if t == 0 :
      pass
    else:
      lisb += lis[-t]
  if abs(lisf-lisb) <= wide:
    wide = abs(lisf-lisb)
    lisf = 0
    lisb = 0
  else:
    lisf = 0
    lisb = 0
print(wide)

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

const int mod = 1e9 + 7;
signed main()
{
  int N;

  int fact = 1;
  
  cin >> N;
  

  Rep(i, N) {
    (fact *= i + 1) %= mod;
  }

  cout << fact << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a,b,c;
    char d,e;
  	string s;
  	cin>>s;
for(int i=0;i<4;i++){
	if(s.at(i)=='+')
      a++;
  	else
      a--;

}
  cout<<a<<endl;
 return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s1;
	string s2;
	cin>>s1>>s2;
	int a=0;
	for(int i=0;i<s1.length();i++)
	{
		if(s1[i]!=s2[i])
		a++;
	}
	cout<<a;
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;
#define REP(i,j,n) for(int i=j;i<n;i++)
#define rep(i,n) REP(i,0,n)


// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    ll ary[n];
    rep(i,n) cin >> ary[i];
    double logans = 0;
    double zeroflag = false;
    rep(i,n)
    {
        if(ary[i]==0)
        {
            zeroflag = true;
            break;
        }
        logans += log10(ary[i]);
    }

    if (zeroflag)
    {
        cout << 0 << endl;
        // cout << " a" << endl;
    }
    else if(logans > 18)
    {
        cout << -1 << endl;
        // cout << "b" << endl;
    }
    else
    {
        ll ans = 1;
        rep(i,n)
        {
            ans *= ary[i];
        }
        ll max = 1e18;
        if(ans > max)
        {
            cout << -1 << endl;
        }
        else
        {
            cout << ans << endl;
        }
    }
}


Measured memory_bytes: 4576
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    long a[n+1], b[n];
    for (auto &ai:a) cin >> ai;
    for (auto &bi:b) cin >> bi;
    long sum = 0;
    for (int i=0; i<n; i++) {
        long mons = min(a[i], b[i]);
        sum += mons;
        b[i] -= mons;
        mons = min(a[i+1], b[i]);
        sum += mons;
        a[i+1] -= mons;
    }
    cout << sum << '\n';
    return 0;
}

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

typedef long long ll;
#define PB push_back

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	string s; cin >> s;
	char cur = s[0];
	int res = 1;
	for (int i = 1; i < n; ++i) {
		if (s[i] != cur) {
			res++;
			cur = s[i];
		}
	}
	cout << res << "\n";
}

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

using namespace std;

int main(){
	int n; cin >> n;
	vector<int> a(n), b;
	for(int i=0;i<n;i++){
		cin >> a[i];
		b.push_back(i);
	}

	sort(b.begin(),b.end(),[&a](int &p, int &q){
		return a[p]<a[q];
	});
	vector<int> ans(n);
	for(int i=0;i<n;i++){
		if(i<n/2){
			ans[b[i]] = a[b[n/2]];
		}
		else{
			ans[b[i]] = a[b[n/2-1]];
		}
	}

	for(int i=0;i<n;i++){
		cout << ans[i] << endl;
	}
	return 0;
}


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

int main(){
    ll n, w; cin >> n >> w;
    P a[n];
    rep(i, n) cin >> a[i].first >> a[i].second;

    ll dp[n+1][w+1];
    memset(dp, -1, sizeof(dp));
    rep(i, n+1){
        rep(j, w+1){
            if(!i || !j) dp[i][j] = 0;
            else {
                if(j-a[i-1].first >= 0)
                    dp[i][j] = max(dp[i-1][j], dp[i-1][j-a[i-1].first] + a[i-1].second);
                else dp[i][j] = dp[i-1][j];
            }
        }
    }

    cout << dp[n][w] << endl;
    return 0;
}

Measured memory_bytes: 79104
program ccc
implicit none

integer :: n, i, res
character(100000) :: s
character(1) :: che

read*, n
read*, s

che=s(1:1)
res=1

do i=2, n
	if(s(i:i)/=che) then
		res=res+1
	end if
	che=s(i:i)
end do

write(*,'(i0)') res

end program

Measured memory_bytes: 1084
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define mod (ll)(1e9+7)
#define INF (ll)(1e9)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
int gcd(int A,int B) {if(!B)return A;return gcd(B,A%B);}
int cnt[31];
int main()
{
   int n,m,k;
   cin>>n>>m;
  for(int i=0;i<n;i++){
    cin>>k;
    for(int j=0;j<k;j++){
      int x;
      cin>>x;
      cnt[x]++;
    }
  }
  int ans = 0;
  for(int i=1;i<=m;i++)if(cnt[i] == n)ans++;
  cout<<ans;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int a,b,c,d;
	
	scanf("%d %d %d",&a,&b,&c);
	
	d=c-a;
	if(d>=0)d=b-d;
	if(d>=0)printf("YES");
	else printf("NO");
	
return(0);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N; 
	cin >> N; 
	long long int A[100010] = {}; 
	for(int i = 0; i < N; i++) cin >> A[i]; 
	long long int current = 1; 
	long long int ans = 0; 
	for(int i = 0; i < N; i++){
		if(A[i] == current) current ++; 
		else if(A[i] < current) continue; 
		else{
			ans += (A[i] - 1) / current; 
			if(i == 0) current ++; 
		}
	}
	cout << ans << endl; 
}

Measured memory_bytes: 1024
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
template <class... T> void printd(T&&...){ }
#endif

int main(){
    int n, m;
    cin >> n >> m;
    vector<ll> xs(n), ys(m);
    for(int i=0;i<n;i++){
        cin >> xs[i];
    }
    for(int i=0;i<m;i++){
        cin >> ys[i];
    }
    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());
    ll numx = 0, numy = 0;
    vector<ll> numsx(n), numsy(m);
    for(int i=1;i<n;i++){
        numsx[i] = (xs[i] - xs[i - 1]) * i + numsx[i - 1];
    }
    for(int i=1;i<m;i++){
        numsy[i] = (ys[i] - ys[i - 1]) * i + numsy[i - 1];
    }
    ll accx = 0, accy = 0;
    for(int i=0;i<n;i++){
        accx = (accx + numsx[i]) % M;
    }
    for(int i=0;i<m;i++){
        accy = (accy + numsy[i]) % M;
    }
    cout << (accx * accy) % M << '\n';
    return 0;
    // ll basex = xs.back() - xs.front(), basey = ys.back() - ys.front();
    // ll base = basex * basey;
    // // ll remx = base, remy = base, prevx = xs.front(), prevy = ys.front();
    // ll remx = 0, remy = base, prevx = xs.front(), prevy = ys.front();
    // ll ans = base;
    // for(int i=1;i<max(n-1, m-1);i++){
    //     if(i < xs.size()){
    //         ans = (ans + base) % M;
    //         ans = (ans + remx) % M;
    //         remx = basey * (xs.back() - xs[i]) % M;
    //     }
    //     if(i < ys.size()){
    //         ans = (ans + base) % M;
    //         ans = (ans + remy) % M;
    //         remy = basex * (ys.back() - ys[i]) % M;
    //     }
    // }
    // cout << ans << '\n';
    // return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define itn int
#define make_unique(x) sort((x).begin(), (x).end()); (x).erase(unique((x).begin(), (x).end()), (x).end())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

void solve() {
	long long a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a < b || b > d) {
		puts("No");
		return;
	}
	if (a > max(b, c)) {
		long long k = (a - max(b, c) + b - 1) / b;
		a -= k * b;
	}

	long long g = __gcd(b, d);

	if (a <= c) {
		a += d;
	}

	if (c + 1 >= b) {
		if (a >= b) {
			puts("Yes");
		} else {
			puts("No");
		}
		return;
	}

	// [c + 1, b - 1]
	if ((c + 1) / g + 1 < (b - 1) / g) {
		puts("No");
	} else if ((c + 1) / g == (b - 1) / g) {
		if (a % g >= (c + 1) % g && a % g <= (b - 1) % g) {
			puts("No");
		} else {
			puts("Yes");
		}
	} else if ((c + 1) / g + 1 == (b - 1) / g) {
		if (a % g >= (c + 1) % g || a % g <= (b - 1) % g) {
			puts("No");
		} else {
			puts("Yes");
		}
	}
}

int main() {
	int t = nxt();
	while (t--) {
		solve();
	}

	return 0;
}


Measured memory_bytes: 256