akhauriyash/Code-Regression huggingface dataset:
#include <sstream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <queue>
#include <bitset>
using namespace std;

#define int long long
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define REP(i, a) for (int i = 0, _a = (a); i < _a; ++i)
#define REPD(i,n) for(int i = (n)-1; i >= 0; --i)

#define DEBUG(X) { cerr << #X << " = " << (X) << endl; }
#define PR(A, n) { cerr << #A << " = "; FOR(_, 1, n) cerr << A[_] << ' '; cerr << endl; }
#define PR0(A, n) { cerr << #A << " = "; REP(_, n) cerr << A[_] << ' '; cerr << endl; }

#define sqr(x) ((x) * (x))
#define ll long long
#define double long double
typedef pair<int, int> II;
#define PI (2 * acos((double)0))
#define __builtin_popcount __builtin_popcountll
#define SZ(x) ((int)(x).size())
#define ALL(a) (a).begin(), (a).end()
#define MS(a,x) memset(a, x, sizeof(a))
#define next ackjalscjaowjico
#define prev ajcsoua0wucckjsl
#define y1 alkscj9u20cjeijc
#define y0 u9cqu3jioajc

double safe_sqrt(double x) { return sqrt(max((double)0.0, x)); }
int GI(int& x) { return scanf("%lld", &x); }

const int MN = 511;

int a[MN][MN];
int n;

bool empty() {
    FOR(i,1,n) FOR(j,1,n) if (a[i][j]) return false;
    return true;
}

bool isColumnFull(int j) {
    FOR(i,1,n) if (a[i][j] == 0) return false;
    return true;
}

int goodCol[MN], cntRow[MN];

int solve() {
    if (empty()) return -1;

    int fullCol = 0;
    FOR(j,1,n) {
        if (isColumnFull(j)) ++fullCol;
    }

    memset(goodCol, 0, sizeof goodCol);
    FOR(i,1,n) {
        cntRow[i] = 0;
        FOR(j,1,n) if (a[i][j]) {
            goodCol[j] = 1;
            cntRow[i]++;
        }
    }

    int bestRow = 2011;
    FOR(i,1,n) {
        int cur = 0, bad = 0;
        FOR(j,1,n) {
            if (a[i][j] == 1) continue;

            if (goodCol[i]) cur++;
            else ++bad;
        }
        int opt = 0;
        FOR(i2,1,n) if (i2 != i) opt = max(opt, cntRow[i2]);

        if (bad > 0) {
            cur += 1;
            cur += bad;
        }

        bestRow = min(bestRow, cur);
    }

    return bestRow + (n - fullCol);
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << (fixed) << setprecision(9);
    while (cin >> n) {
        FOR(i,1,n) FOR(j,1,n) {
            char c; cin >> c;
            if (c == '#') a[i][j] = 1;
            else a[i][j] = 0;
        }
        cout << solve() << endl;
    }
}


Measured memory_bytes: 2304
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func main() {
	log.SetFlags(log.Lshortfile)
	nextReader = NewScanner()
	a := nextInt()
	b := nextInt()
	c := nextInt()
	k := nextInt()
	if k%2 == 0 {
		fmt.Println(a - b)
	} else {
		fmt.Println(b - a)
	}
	log.Println(c)
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func minmax(a, b int) (int, int) {
	if a > b {
		return b, a
	}
	return a, b
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	return p[i].b < p[i].b
}

var nextReader func() string

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int count = 0;
		for (int i = 0; i < s.length(); i++) {
			if (String.valueOf(s.charAt(i)).equals("1")) {
				count++;
			}
		}
		System.out.println(count);

	}

}


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

int main(){
  int n;
  vector<int> v;
  vector<int> w;
  cin>>n;
  for(int i=0;i<n;i++){
    int tmp;
    cin>>tmp;
    v.push_back(tmp);
  }
  w=v;
  sort(w.begin(),w.end(),greater<int>());
  for(int i=0; i<n;i++){
    if(v[i]==w[0]){
      cout<<w[1]<<endl;
    }else{
      cout<<w[0]<<endl;
    }
  }
}

Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	long long int a;
	long double b;
	long long int ans;

	cin >> a >> b;
	//b = b* 100;
	ans = a * (long long int)(b*100+0.5)/100;
	cout << ans << endl;
}

Measured memory_bytes: 3740
#include <iostream>
#include <string>
using namespace std;
int main(){
  
  string s,t; cin >> s >> t;
  for(int i = 0; i < s.size(); i++){
  if(s[i] != t[i]){cout << "No" << endl; return 0;}
  }
  cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3624
#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,m;
  cin >> n >> m;
  if(abs(n-m) == 0){
    ll res = 2;
    for(int i = 1;i <= n;i++)res = (res*i)%MOD;
    for(int i = 1;i <= m;i++)res = (res*i)%MOD;
    cout << res << endl;
  }else if(abs(n-m) == 1){
    ll res = 1;
    for(int i = 1;i <= n;i++)res = (res*i)%MOD;
    for(int i = 1;i <= m;i++)res = (res*i)%MOD;
    cout << res << endl;
  }else{
    cout << 0 << endl;
  }


  

  return 0;
}


Measured memory_bytes: 256
import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda: list(map(int, input().strip().split()))

MOD = 10**9 + 7


def main():
	# ans_ = []
	# ans_.append(ans)
	# print(("\n").join(map(str, ans_)))
	n = input().strip()#10**200000 - 1#int(input())
	i = 0
	s = 0
	while i < len(n):
		# print(n)
		s += int(n[i])
		s %= 9
		i += 1
	print("YNeos"[s!=0::2])






if __name__ == "__main__":
	main()

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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>
void print1(T begin, T end) {
	while (begin != end) {
		cerr << (*begin) << " ";
		*begin++;
	}
	cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			cerr << " " << Array[i][j];
		}
		cerr << endl;
	}
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	std::cerr << head << " ";
	print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

int N, M;
int s[10];
int c[10];
vector<int> ans;

// 先頭の0
// s, cの条件
bool check(vector<int> v) {
	if (v[0] == 0 and v.size() >= 2) {
		return false;
	}

	rep (i, M) {
		if (v[s[i]-1] != c[i]) {
			return false;
		}
	}

	return true;
}

// vectorを数値に変換
int trans(vector<int> v) {
	int ten = 1;
	int num = 0;
	for (int i = N - 1; i >= 0; i--) {
		num += v[i] * ten;
		ten *= 10;
	}

	return num;
}

void dfs(int idx, vector<int> v) {
	if (idx >= N) {
		if (check(v)) {
			ans.push_back(trans(v));
		}
		return;
	} else {
		for (int i = 0; i <= 9; i++) {
			v.push_back(i);
			dfs(idx + 1, v);
			v.pop_back();
		}
	}
}

signed main() {
	cin >> N >> M;
	rep (i, M) {
		cin >> s[i] >> c[i];
	}

	vector<int> t;
	dfs(0, t);

	if (ans.size() == 0) {
		cout << -1 << endl;
	} else {
		sort(all(ans));
		cout << ans[0] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int h,w;
    cin>>h>>w;
    string s[h];
    rep(i,h)cin>>s[i];
    vector<vector<int>> l(h,vector<int>(w,-1)),d(h,vector<int>(w,h)),r(h,vector<int>(w,w)),u(h,vector<int>(w,-1));
    rep(i,h){
        rep(j,w){
            if(j>0)l[i][j]=l[i][j-1];
            if(s[i][j]=='#')l[i][j]=j;
        }

    }
    rep(i,h){
        for(int j=w-1;j>=0;--j){
            if(j<w-1)r[i][j]=r[i][j+1];
            if(s[i][j]=='#')r[i][j]=j;
        }

    }
    rep(j,w){
        rep(i,h){
            if(i>0)u[i][j]=u[i-1][j];
            if(s[i][j]=='#')u[i][j]=i;
        }

    }
    rep(j,w){
        for(int i=h-1;i>=0;--i){
            if(i<h-1)d[i][j]=d[i+1][j];
            if(s[i][j]=='#')d[i][j]=i;
        }
    }
    int ans=0;
    rep(i,h)rep(j,w){
        ans = max (ans, d[i][j]-u[i][j]+r[i][j]-l[i][j]-3);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 67200
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, x; cin >> N >> x;
	vector<int> a(N); rep(i, 0, N) { cin >> a[i]; }
	vector<vector<int>>b(N, vector<int>(N, INF));
	rep(i, 0, N)b[i][0] = a[i];
	
	int ans(INF);
	rep(k, 0, N) {
		int tmp(k*x);
		rep(i, 0, N) {
			if (k == 0)b[i][k] = a[i];
			else b[i][k] = min(b[i][k - 1], a[(i - k + N) % N]);
			tmp += b[i][k];
		}
		chmin(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 31616
/*

                   بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
                  لآ اِلَهَ اِلّا اللّهُ مُحَمَّدٌ رَسُوُل اللّهِ
*/

/*
    Auther:   n0oO0o0Ob(None of them)
    from  :   https://n0oo0o0ob.sleek.page/

*/




#include <bits/stdc++.h>

using namespace std;
#define endl "\n"
#define pb push_back

                                        #define noob n0oO0o0Ob
// ---------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
//----------------------------------
const ld PI = acos((ld)-1);
const int MOD = 1000000007;
//----------------------------------


int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int a;
    cin >> a;
    int ara[a];
    vector<int> v;
    int k = 0;
    for(int i =0; i<a; i++){
        cin >> ara[i];
        if(ara[i] % 2== 0) v.pb(ara[i]);
    }
    for(int i =0 ; i< v.size(); i++){
        if(v[i] % 3 == 0 || v[i] % 5 == 0){
            k++;
        }
    }
    if(k == v.size()) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;





	return 0;
}



Measured memory_bytes: 3652
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            int[] A=cin.ReadIntArray(2);
            int a = A[0];
            int b = A[1];
            if (a < b)
            {
                for(int i = 0; i < b; i++)
                {
                    Console.Write(a);
                }

            }
            else
            {
                for(int i = 0; i < a; i++)
                {
                    Console.Write(b);
                }
            }

        }

    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *p;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
Node treeMinimum(Node x){
  while( x->left != NIL ){
    x = x->left;
  }
  return x;
}
 
Node treeSearch(Node u, int k){
  if( u == NIL || k == u->key){
    return u;
  }
  if( k < u->key ){
    return treeSearch( u->left, k);
  }else {
    return treeSearch( u->right, k);
  }
 
}
 
Node treeSuccessor(Node x){
  Node y;
  if( x->right != NIL ){
    return treeMinimum(x->right);
  }
 
  y = x->p;
  while( y != NIL && x == y->right ){
    x = y;
    y = y->p;
  }
  return y;
}
 
void treeDelete(Node z){
  Node y = NIL; 
  Node x = NIL; 
 
  if( z->left == NIL || z->right == NIL ){
    y = z;
  } else {
    y = treeSuccessor(z);
  }
 
  if( y->left != NIL ){
    x = y->left;
  } else {
    x = y->right;
  }
 
  if( x != NIL ){
    x->p = y->p;
  }
  if( y->p == NIL ){
    root = x;
  }else if( y == y->p->left){
    y->p->left = x;
  }else {
    y->p->right = x;
  }
 
  if( y != z ){
    z->key = y->key;
  }
 
  free(y);
}
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while( x != NIL ){
    y = x;
    if( z->key < x->key ){
      x = x->left;
    }else{
      x = x->right;
    }
  }
 
  z->p = y;
 
  if( y == NIL ){
    root = z;
  }else if( z->key < y->key ){
    y->left = z;
  }else{
    y->right = z;
  }
 
}
 
void inorder(Node u){
  if( u == NIL ){
    return;
  }
 
  inorder(u->left);
  printf(" %d" ,u->key);
  inorder(u->right);  
}
 
void preorder(Node u){
  if( u == NIL ){
    return;
  }
 
  printf(" %d" ,u->key);
  preorder(u->left);
  preorder(u->right);  
 
 
}
 
 
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
 
  return 0;
}

Measured memory_bytes: 19360
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }


int main() {
    auto dp = make_v(2, 5, 1<<15, 0);
    dp[0][0][0] = 1;
    for (int i = 1; i <= 190; ++i) {
        int nxt = i&1, now = nxt^1;
        for (int j = 0; j < 5; ++j) {
            fill(dp[nxt][j].begin(),dp[nxt][j].end() , 0);
        }
        for (int j = 0; j < 5; ++j) {
            for (int k = 0; k < 1<<15; ++k) {
                dp[nxt][j][k] += dp[now][j][k];
                for (int l = j+1; l < 5; ++l) {
                    if(k+i*i*(l-j) < (1<<15)){
                        dp[nxt][l][k+i*i*(l-j)] += dp[now][j][k];
                    }
                }
            }
        }
    }
    int n;
    while(cin >> n, n){
        int ans = 0;
        for (int i = 0; i < 5; ++i) {
            ans += dp[0][i][n];
        }
        cout << ans << "\n";
    }
    return 0;
}



Measured memory_bytes: 4724
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


vector<vector<pair<ll,ll>>> G(100010);
vector<ll> d(100010,INF);
ll flag=0;
void dijkstra(ll r){
    //vector<ll> d(100010,INF);
    d[r] = 0;
    priority_queue<Pi,vector<Pi>,greater<Pi>> pque;
    pque.push(mp(0,r));
    while(!pque.empty()){
        Pi p = pque.top();
        pque.pop();
        ll pos=p.second,cost=p.first;
        //cout<<d[pos]<<endl;
        /*if(  d[pos]!=INF ){
            if(d[pos]!=cost){
                flag=1;
                return;
            }else{
                continue;
            }
        }*/
        if( cost > d[pos] )continue;
        //cout<<"OK"<<endl;
        rep(i,G[pos].size()){
            ll  to = G[pos][i].first;
            ll newcost = cost + G[pos][i].second;
            if(  d[to]!=INF ){
                if(d[to]!=newcost){
                    flag=1;
                    return;
                }else{
                    continue;
                }
            }
            if(newcost < d[to]){
                d[to] = newcost;
                pque.push(mp(d[to],to));
            }
        }

    }

}

int main() {
    ll N,M;
    cin >>N>>M;
    //vector<vector<ll>>dist(N,vector<ll>(N));

    rep(i,M){
        ll l,r,D;
        cin>>l>>r>>D;
        l--;r--;
        G[l].pb(mp(r,D));
        G[r].pb(mp(l,-D));
    }

    rep(i,N){
        if(d[i]==INF){
            dijkstra(i);
            //d[i]=INF;
        }
        if(flag==1){
            cout<<"No"<<endl;
            return 0;
        }

    }
    cout << "Yes" << endl;


    return 0;
    

}

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

using namespace std;

int main()
{
    map<long long, long long> mp;
    long long n, x;
    long long a = 0, b = 0, c = 0;
    cin >> n;
    for (long long i = 0; i < n; i++)

    {
        cin >> x;
        mp[x]++;
    }
    for (auto itr = mp.rbegin(); itr != mp.rend() && c < 2; itr++)
    {
        if (itr->second >= 4 && c == 0)
        {
            a = b = itr->first;
            c += 2;
        }
        else if (itr->second >= 2)
        {
            if (c == 0)
            {
                a = itr->first;
            }
            else
            {
                b = itr->first;
            }
            c++;
        }
    }
    cout << a * b << endl;
    return 0;
}

Measured memory_bytes: 6528
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		BigInteger a = new BigInteger(String.valueOf(sc.nextLong()));
		BigInteger b = new BigInteger(String.valueOf(sc.nextLong()));
		BigInteger c = new BigInteger(String.valueOf(sc.nextLong()));
		sc.close();

		boolean negative = c.compareTo(a.add(b)) != 1;
		if (negative) {
			print("No");
			return;
		}

		BigInteger two = new BigInteger("2");
		BigInteger aa = a.multiply(a);
		BigInteger bb = b.multiply(b);
		BigInteger cc = c.multiply(c);
		BigInteger ab = a.multiply(b);
		BigInteger bc = b.multiply(c);
		BigInteger ca = c.multiply(a);

		BigInteger num1 = two.multiply(ab.add(bc).add(ca));
		BigInteger num2 = aa.add(bb).add(cc);

		boolean ans = num1.compareTo(num2) == -1;

		printBool(ans);
	}

	public static void print(Object obj) {
		System.out.println(obj);
	}

	public static void printBool(boolean bool) {
		print(bool ? "Yes" : "No");
	}

}


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

const int MAX_N=100000;
int n, a[MAX_N];

int check(){
	int s=1;
	for(int i=0;i<n;i++){
		if(s==2) return i;
		s=a[s-1];
	}
	return -1;
}

int main(){
	cin >> n;
	for(int i=0;i<n;i++){		
		cin >> a[i];
	}
	
	cout << check() << endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>

  using namespace std;
   

//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
  typedef long long ll;
  typedef long double lld;
  typedef string str;
  typedef unsigned long long ull;
  ll INF = INT_MAX;
  // ll mod = 998244353;
  lld PI = 3.141592653;

// const int N = 2e5 + 5;

// int a[N];
// int n,k;



// void solve(){

// string s;
// cin>>s;


// }
 


  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
      
     
     ll n;
     cin>>n;
     ll ans = 0;
     for (int k=1;k<=n;k++){
      ll upbound = n/k*k;
      ll cnt = n/k;
      ans+= cnt*(k+upbound)/2;
     }
     cout<<ans<<"\n";
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (ll i=0;i<n;i++)
#define REP(i,n) for (ll i=1;i<=n;i++)
 
ll N,M,A,B,C;
string S,T,U;
double n,m,a,b,c;
 
int main() {
  cin>>N>>M;
  if (N<=1) A=0;
  else A=(N-1)*N/2;
  if (M<=1) B=0;
  else B=(M-1)*M/2;
  cout<<A+B<<endl;
  return 0;
}

Measured memory_bytes: 256
//
// Created by user on 3/9/2020.
//
#include <bits/stdc++.h>
//#define endl '\n'
using namespace std;

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

    for (int i = 1; i <= 10000; ++i) {
        cerr << i << " " << (int)(i * 0.08) << " " << (int)(i * 0.1) << endl;
        if ( (int)(i * 0.08) == a and (int)(i * 0.1) == b) {
            cout << i;
            return 0;
        }
    }
    cout << -1;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

// dp[i][j] := i??????????¢¨????????§?????????, j????¢¨???????????£???????????¨?????????????????¢
int dp[50][5];

void solve(const int n, const vector<int> & p, const vector<int> & t) {
	rep(i, 50)rep(j, 5) dp[i][j] = INF;
	dp[0][0] = 0;
	for (int i = 1; i <= n + 1; ++i) { // ?????????
		for (int j = 0; j <= 3; ++j) {
			// printf("%d %d\n", i, j);
			if(dp[i - 1][j] == INF) continue;
			// ???????????????????????????
			{
				int dist = p[i - 1] + p[i];
				int time = p[i - 1] * (j + 1) + p[i];
				// printf("dist %d time %d\n", dist, time);
				if(time <= (t[i] - t[i - 1])) {
					chmin(dp[i][1], dp[i - 1][j] + dist);
					// printf("1 dp[%d][%d](%d) = dp[%d][%d](%d) + %d\n", i, 1, dp[i][1], i - 1, j, dp[i - 1][j], dist);
				}
			}
			// ??????????????????
			{
				if(j == 3) continue;
				int time = abs(p[i] - p[i - 1]) * (j + 1);
				int dist = abs(p[i] - p[i - 1]);
				// printf("dist %d time %d\n", dist, time);
				if(time <= (t[i] - t[i - 1])) {
					chmin(dp[i][j + 1], dp[i - 1][j] + dist);
					// printf("2 dp[%d][%d](%d) = dp[%d][%d](%d) + %d\n", i, j+1, dp[i][j+1], i - 1, j, dp[i - 1][j], dist);
				}
			}
		}
	}
	int ans = INF;
	rep(i, 4) chmin(ans, dp[n + 1][i]);
	if (ans == INF) {
		int idx = 0;
		for (int i = 0; i <= n + 1; ++i) for (int j = 0; j <= 3; ++j) {
			if (dp[i][j] != INF) idx = max(idx, i + 1);
		}
		cout << "NG " << idx << endl;
	} else {
		cout << "OK " << ans << endl;
	}
}

int main(void) {
	while(1) {
		int n; cin >> n;
		if(n == 0) break;
		vector<int> p(n + 2), t(n + 2);
		p[0] = t[0] = 0;
		reps(i, 1, n + 1) cin >> p[i] >> t[i];
		p[n + 1] = 0, t[n + 1] = INF;
		solve(n, p, t);
	}
	return 0;
}

Measured memory_bytes: 3000
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
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;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int dp[310][310][310];
int main(){
	int n,m,MOD=1000000007;
	cin>>n>>m;
	vvp in(n+1);
	rep(i,m){
		int a,b,c;cin>>a>>b>>c;
		in[b].pb({a,c});
	}
	
	dp[0][0][0]=1;
	rep(i,n+1)rep(j,n+1)rep(k,n+1){
		int t=max(i,max(j,k));
		rep(l,in[t].size()){
			int co=0;
			if(in[t][l].first<=i)co++;
			if(in[t][l].first<=j)co++;
			if(in[t][l].first<=k)co++;
			if(co!=in[t][l].second)dp[i][j][k]=0;
		}
		(dp[t+1][j][k]+=dp[i][j][k])%=MOD;
		(dp[i][t+1][k]+=dp[i][j][k])%=MOD;
		(dp[i][j][t+1]+=dp[i][j][k])%=MOD;
	}
	int out=0;
	rep(i,310)rep(j,310)rep(k,310)if(max(i,max(j,k))==n)
		(out+=dp[i][j][k])%=MOD;
	cout<<out<<endl;
}










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

int main()
{
    int N;
    cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N; ++i){
        cin >> S[i];
    }
    for (int i = 0; i < N; ++i){
        sort(S[i].begin(), S[i].end());
    }
    sort(S.begin(), S.end());
    map<string, long int> mp;
    for (int i = 0; i<N; ++i){
        mp[S[i]]++;
    }
    long int ans = 0;
    for (auto i = mp.begin(); i != mp.end(); ++i)
    {
        long int s = i->second;
        ans += s * (s - 1) / 2;
    }

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

Measured memory_bytes: 13568
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

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

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

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll ans[110][110];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, d;
	cin >> n >> d;
	ll ans = 0;
	rep(i, n) {
		ll x, y;
		cin >> x >> y;
		double res = sqrt(x * x + y * y);
		if (res <= d)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3648
#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;

int main() {
	int n = 0;
	int m=0;
	int ans = 0;
	cin >> n >> m;

	ans = (n - 1)*(m - 1);

	cout <<ans << endl;


	return 0;
}


Measured memory_bytes: 256
using System;

class A{
  static void Main(){
    int X = int.Parse(Console.ReadLine());
    for (double i = 1; i <= 50000; i++){
      if (Math.Floor(i * 1.08) == X) {
        Console.WriteLine(i);
        return;
      }
    }
    Console.WriteLine(":(");
  }
}
    

Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e16;
#define int long long

const int MAX_N = 1010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	if (n % 2 != 0) {
		for (int i = n - 1; i >= 0; i--) {
			if (i % 2 == 0) {
				cout << a[i] << " ";
			}
		}
		rep(i, n) {
			if (i % 2 == 1) {
				cout << a[i] << " ";
			}
		}
	}
	else {
		for (int i = n - 1; i >= 0; i--) {
			if (i % 2 == 1) {
				cout << a[i] << " ";
			}
		}
		rep(i, n) {
			if (i % 2 == 0) {
				cout << a[i] << " ";
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cctype>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;

int main(){
	string str;
	cin>>str;
	int flag=0;
	int num=0;
	for(int i=0;i<str.length()-1;i++){
		for(int j=i+1;j<str.length();j++){
			if(str[i]==str[j]){
				flag=1;
				break;
			}
		}
	}
	if(flag){
		cout<<"no"<<endl;
	}
	else{
		cout<<"yes"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double sum =0;
		double a[] = new double [N];
		for(int i = 0;i<N;i++) {
			a[i]=sc.nextInt();
		}
        Arrays.sort(a);
		sum = (a[0]+a[1])/2;
		for(int b=2;b<N;b++) {
			sum=(sum+a[b])/2;
		}
		System.out.println(sum);
	}
 
}

Measured memory_bytes: 23764
import sys
from collections import Counter

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline


def prime_factorization(n):
    prime_arr = []
    while n % 2 == 0:
        prime_arr.append(2)
        n //= 2

    f = 3
    while f * f <= n:
        if n % f == 0:
            prime_arr.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        prime_arr.append(n)
    return prime_arr


N = int(input())
c = Counter(prime_factorization(N))
counter = 0

for v in c.values():
    t = 1
    while v - t >= 0:
        counter += 1
        v -= t
        t += 1

print(counter)


Measured memory_bytes: 9492
#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;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
    s.find_by_order(k) ---> returns iterator to the element at index(from 0) k
    s.order_of_key(val) ---> number of elements that are strictly smaller than the given value
*/
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int tc; cin >> tc; cin.ignore(); while(tc--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define HASH 18014398241046527
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
template <typename T>
ll SIZEOF(T a){return (ll)a.size();}
ll xlcm(ll a, ll b){return (a/__gcd(a, b))*b;}

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





void SOLVE(){
    inp(n);
    while(n--){
        cout << "ACL";
    }
}

int main() {
	fastIO();
	// #ifndef ONLINE_JUDGE
    //     freopen("i.txt", "r", stdin);
    //     freopen("o.txt", "w", stdout);
	// #endif

    ll TC = 1;
    // cin >> TC;
    for(ll tc1=1; tc1<=TC; tc1++){
        // cout << "Case #" << tc1 << ": ";
        SOLVE();
    }
    printclock;
}

Measured memory_bytes: 3748
int main()
{
	int N,B,F,R,V,A[5][4][11]={0},i,j,k;
	for(scanf("%d",&N);N--;)
	{
		scanf("%d%d%d%d",&B,&F,&R,&V);
		A[B][F][R]+=V;
	}
	for(i=1;i<=4;i++)
	{
		for(j=1;j<=3;j++)
			for(k=1;k<=10;k++)
				printf(" %d%s",A[i][j][k],k==10?"\n":"");
		if(i<4)
		puts("####################");
	}
	return 0;
}



Measured memory_bytes: 2108
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a=Integer.parseInt(sc.next());
int b=Integer.parseInt(sc.next());
int count=0;
for(int i=1;i<=a-1;i++){
    for(int j=1;j<=31;j++){
    if(i==j){
        if(i==2&&j>=29){count+=0;
        }else if((i==4||i==6||i==9||i==11)&&(j==31)){
        count+=0;
        }else{
        count++;
        }
        
    }
    }
    }
if(a<=b)count++;
System.out.println(count);

}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main()
{
  int n;
  cin >> n;
  set<string>ans;
  rep(i,n){
    string s;cin >> s;
    ans.insert(s);
  }
  cout << ans.size() << endl;
  return 0;
}

Measured memory_bytes: 19120
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#define INF (INT_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  int m;
  cin >> m;
  cout << (24 + (24 - m)) << endl;

  return 0;
}

Measured memory_bytes: 256
#https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_b
num=int(input())
lenlist=input().split()
lensum=0
sumlist=[]
for i in range(num):
    lensum+=int(lenlist[i])
    sumlist.append(lensum)
for i in range(num-1):
    if sumlist[i] <= lensum/2 <= sumlist[i+1]:
        print(min(abs(lensum-2*sumlist[i]),abs(lensum-2*sumlist[i+1])))
        break


Measured memory_bytes: 27560
N, M = map(int, input().split())
a = [-1]
for i in range(M):
  a.append(int(input()))

# a = [int(input()) for i in range(M)]
a.append(N+1)
# print(N,M)
# print(a)

diff = []
diffmax = 0
for i, v in enumerate(a):
  if i != len(a)-1:
    steps = a[i+1] - a[i]
    diff.append(steps)
    if diffmax < steps:
      diffmax = steps

#print(diff)
      
actptn = [0,1]
for i in range(2,diffmax):
  actptn.append(actptn[i-1] + actptn[i-2])
#print(len(actptn))

ans = 1
for i in diff:
  ans = (ans* actptn[i-1]) % 1000000007
print(ans)
 

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

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		try {
			String[] param = in.readLine().split(" ");
			int lim = Integer.parseInt(param[0]);
			int k = Integer.parseInt(param[1]);
			
			int max = 0;
			int sum = 0;
			int[] loads = new int[lim];
			for (int i = 0; i < lim; i++) {
				loads[i] = Integer.parseInt(in.readLine());
				sum = sum + loads[i];
				
				if (max < loads[i]) max = loads[i];
			}
			
			int start = (int)Math.ceil((double)sum / k);
			if (start < max) start = max;

			while (true) {
				int count = 0;
				
				int tmp = 0;
				for (int i = 0; i < loads.length; i++) {
					tmp = tmp + loads[i];
					
					if (tmp > start) {
						count++;
						tmp = loads[i];
					}
				}
				
				if (count < k) {
					System.out.println(start);
					break;
				}
				start++;
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

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

public class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            // int num = 5;
            // int[] arr = {5, 3, 2, 4, 1};
            
            int num = Integer.parseInt(br.readLine());
            String[] temp = br.readLine().split("\\s");
            int[] arr = new int[num];
            
            for(int i=0; i<num; i++) {
                arr[i] = Integer.parseInt(temp[i]);
            }
            
            Sort sort = bubbleSort(num, arr);
            
            String[] output = new String[num];
            
            for(int i=0; i<num; i++){
                output[i] = String.valueOf(sort.array[i]);
            }
            System.out.println(String.valueOf(String.join(" ", output)));
            System.out.println(String.valueOf(sort.count));
            
            
        } catch(IOException e) {
            e.printStackTrace();
        }
    }
    
    static Sort bubbleSort(int num, int[] arr) {
        int count = 0;
        for(int i=0; i<num; i++) {
            for(int j=num-1; i<j; j--){
                if(arr[j] < arr[j-1]) {
                    int tmp = arr[j];
                    arr[j]  = arr[j-1];
                    arr[j-1] =  tmp;
                    count += 1;
                }
            }
        }
        return new Sort(count, arr);
    }
}

class Sort{
    public int count;
    public int[] array;
    
    public Sort(int count, int[] array){
        this.count = count;
        this.array = array;
    }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

long long gcd(long long a, long long b) {
    if (a % b == 0)return(b);
    else return(gcd(b, a % b));
}

bool isPrime(long long num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
	long long A, B;
    cin >> A >> B;
    long long num = gcd(A, B);
    
    //cout << num << endl;
    vector<long long> ds;
    rep(i, sqrt(num)+1) {
        if (num % ((long long)i + 1) == 0) {
            if(isPrime(i+1))ds.push_back((long long)i + 1);
            long long num2 = num / ((long long)i + 1);
            if (isPrime(num2))ds.push_back(num2);
        }
    }
    // 重複要素の削除
    sort(ds.begin(), ds.end());
    ds.erase(unique(ds.begin(), ds.end()), ds.end());
    // rep(i, ds.size())cout << ds[i] << endl;
    cout << ds.size() + 1;
}



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

int main(){
  long long a,b;
  int h,g,s;
  while(scanf("%lld %lld",&a,&b)){
    if(!a||!b)break;
    h = g = s = 0;
    b -= a;
    s = b/1000;
    b %=1000;
    g = b/500;
    b %= 500;
    h = b/100;
    printf("%d %d %d\n",h,g,s);
  }
  return 0;
}

Measured memory_bytes: 1028