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

int main() {
	long long N, M, MOD = 1000000007;
	cin >> N >> M;
	static long long DP[301][301][301] = {};
	for (int i = 0; i < M; i++) {
		long long L, R, X;
		cin >> L >> R >> X;
		if (X == 1) {
			for (int j = 0; j < L; j++) {
				for (int k = L; k <= R; k++) {
					DP[j][k][R] = DP[j][R][k] = DP[k][j][R] = DP[k][R][j] = DP[R][j][k] = DP[R][k][j] = -1;
				}
			}
			for (int j = L; j <= R; j++) {
				for (int k = L; k <= R; k++) {
					DP[j][k][R] = DP[j][R][k] = DP[R][j][k] = -1;
				}
			}
		}
		if (X == 2) {
			for (int j = 0; j < L; j++) {
				for (int k = 0; k < L; k++) {
					DP[j][k][R] = DP[j][R][k] = DP[R][j][k] = -1;
				}
			}
			for (int j = L; j <= R; j++) {
				for (int k = L; k <= R; k++) {
					DP[j][k][R] = DP[j][R][k] = DP[R][j][k] = -1;
				}
			}
		}
		if (X == 3) {
			for (int j = 0; j < L; j++) {
				for (int k = 0; k < L; k++) {
					DP[j][k][R] = DP[j][R][k] = DP[R][j][k] = -1;
				}
			}
			for (int j = 0; j < L; j++) {
				for (int k = L; k <= R; k++) {
					DP[j][k][R] = DP[j][R][k] = DP[k][j][R] = DP[k][R][j] = DP[R][j][k] = DP[R][k][j] = -1;
				}
			}
		}
	}
	DP[0][0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < N; k++) {
				if (DP[i][j][k] == -1) continue;
				long long M = max({ i, j, k });
				if (DP[i][j][M + 1] != -1) DP[i][j][M + 1] = (DP[i][j][M + 1] + DP[i][j][k]) % MOD;
				if (DP[i][M + 1][k] != -1) DP[i][M + 1][k] = (DP[i][M + 1][k] + DP[i][j][k]) % MOD;
				if (DP[M + 1][j][k] != -1) DP[M + 1][j][k] = (DP[M + 1][j][k] + DP[i][j][k]) % MOD;
			}
		}
	}
	long long ANS = 0;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			for (int k = 0; k <= N; k++) {
				if (max({ i, j, k }) == N && DP[i][j][k] != -1) {
					ANS += DP[i][j][k];
					ANS %= MOD;
				}
			}
		}
	}
	cout << ANS << endl;
}

Measured memory_bytes: 213376
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<b?(a=b,1):0)
#define chmin(a,b) (a>b?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef long long ll;
typedef pair<int,int> pii;

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  if (a==1&&b==1||c==1) cout << "Open" << endl;
  else cout << "Close" << endl;
}

Measured memory_bytes: 1156
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
    return list(map(int,input().split()))
def m():
    return map(int,input().split())
def onem():
    return int(input())
def s(x):
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa == x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x):
    return " ".join(map(str,x))

w,h,x,y= m()

if w/2 == x and h/2 == y:
    print("{0} {1}".format(w*h/2,1))
else:
    print("{0} {1}".format(w*h/2,0))





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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    # ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t,a=0,b=0,c=0,d=0;
cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        if(s[0]=='A')
            a++;
        else if(s[0]=='W')
            b++;
        else if(s[0]=='T')
            c++;
        else if(s[0]=='R')
            d++;
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<b<<endl;
    cout<<"TLE x "<<c<<endl;

    cout<<"RE x "<<d<<endl;

        
    
    
    return 0;
    }



Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;

namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            long N = long.Parse(ReadLine());
            long[] Aarray = ReadLine().Split(' ').Select(long.Parse).ToArray();
            var ls = new List<long>();
            ls.AddRange(Aarray);
            long[] Barray = ReadLine().Split(' ').Select(long.Parse).ToArray();

            long ans = 0;
            for (int i = 0; i < N; i++)
            {
                long tmp = Barray[i];

                //まだ一回転保証
                if (tmp - ls[i] >= 0)//左全部殺せる
                {
                    tmp -= ls[i];
                    ans += ls[i];
                    ls[i] = 0;

                    if (tmp - ls[i + 1] >= 0)//右も全部殺せる
                    {
                        ans += ls[i + 1];
                        ls[i + 1] = 0;
                    }
                    else//殺しきれない
                    {
                        ls[i + 1] -= tmp;
                        ans += tmp;
                    }
                }
                else//左殺しきれない
                {
                    ans += tmp;
                }
            }
            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 35292
import math
N, K = map(int, input().split())
P = list(map(int, input().split()))
Q = []
for p in P:
    Q.append(sum(range(1, p + 1)) / p)
max = 0
max_i = 0
tmp = 0
for i in range(N - K + 1):
    if i == 0:
        for j in range(K):
            tmp += Q[j]
    else:
        tmp = tmp + Q[i + K - 1] - Q[i - 1]
    if max < tmp:
        max = tmp
        max_i = i
print(max)


Measured memory_bytes: 73992
// Template
#include "bits/stdc++.h"
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep3(i, l, r) for (int i = (int)(l); i < (int)(r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define per(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003LL;
template <typename T>
inline bool chmin(T &x, const T &y) {
    if (x > y) {
        x = y;
        return true;
    }
    return false;
}
template <typename T> 
inline bool chmax(T &x, const T &y) {
    if (x < y) {
        x = y;
        return true;
    }
    return false;
}
struct IOSET {
    IOSET() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
    }
} ioset;

// Main
int main() {
    int d;
    cin >> d;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(d, vector<int>(26));
    rep(i, d) rep(j, 26) cin >> s[i][j];

    auto score = [&](vector<int> &t_) -> int {
        int res = 0;
        vector<int> last(26, -1);
        rep(i, t_.size()) {
            res += s[i][t_[i]];
            last[t_[i]] = i;
            rep(j, 26) res -= c[j] * (i - last[j]);
        }
        return res;
    };

    vector<int> t;
    rep(i, d) {
        int mx = -inf, idx = -1;
        rep(j, 26) {
            t.push_back(j);
            if (chmax(mx, score(t))) idx = j;
            t.pop_back();
        }
        t.push_back(idx);
    }

    rep(i, d) cout << t[i] + 1 << "\n";
}

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

using namespace std;

int main()
{
	long n, x, max = 0, min = 0, mix = 0;
	
	cin >> n;
	
	for(int i = 1; i <= n; i++){
		cin >> x;
		if(i == 1) max = x;
		if(max < x) max = x;
		if(i == 1) min = x;
		if(min > x) min = x;
		mix += x;
	}
	
	cout << min << " " << max << " " << mix << endl;
	
	return 0;
}

Measured memory_bytes: 3104
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<queue>
#define pr(x) cout<<#x<<" "<<x;
#define pl(x) cout<<#x<<" "<<x<<endl;
#include<math.h>
#include<algorithm>
using namespace std;
char maze[1005][1005];
int dx[] = {-1,1,0,0};
int dy[] = {0,0,-1,1};
int d[1005][1005];
const int INF = 0x7f7f7f7f;
typedef pair <int ,int > p;
queue <p> que;
int h,w;
void chushihua(){
    for(int i = 0;i<1005;i++){
        for(int j = 0;j<1005;j++){
            d[i][j] = INF;
        }
    }
}
int bfs(int x,int y,int gx,int gy){
    chushihua();
    d[x][y] = 0;
    que.push(p(x,y));
    while(que.size()){
        p cp = que.front();
        que.pop();
        if(cp.first==gx&&cp.second==gy){break;}
        for(int i = 0;i<4;i++){
            int nx = cp.first + dx[i];
            int ny = cp.second + dy[i];
            if(nx>=0&&nx<h&&ny>=0&&ny<w&&maze[nx][ny]!='X'&&d[nx][ny]==INF){

               que.push(p(nx,ny));
               d[nx][ny] = d[cp.first][cp.second] + 1;

            }
        }
    }
    while(que.size()){que.pop();}
    return d[gx][gy];


}
int main(){
    int n;
    cin>>h>>w>>n;
    int indexmap[n+5][4];
    getchar();
    for(int i = 0;i<h;i++){
        scanf("%s",&maze[i]);
    }
    for(int i = 0;i<h;i++){
        for(int j = 0;j<w;j++){
            if(maze[i][j]=='S'){
                indexmap[0][0] = i;
                indexmap[0][1] = j;

            }
            else if((int)maze[i][j]>=49&&(int)maze[i][j]<=57){
                int index = maze[i][j]-'0';
                indexmap[index][0] = i;
                indexmap[index][1] = j;


            }
        }
    }
    int ans = 0;
    for(int i=0;i<n;i++){
        ans += bfs(indexmap[i][0],indexmap[i][1],indexmap[i+1][0],indexmap[i+1][1]);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 6172
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstdio>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <climits>

using namespace std;
typedef long long ll;

int main() {
	ll a, b;
	cin >> a >> b;
	vector<ll> v = { a + a - 1, b + b - 1, a + b };
	cout << *max_element(v.begin() ,v.end())<< endl;
}

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

#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) \
  for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) \
  for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int;  // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector<pair<ll, ll>> prime_factorize(ll n) {
  vector<pair<ll, ll>> p;
  for (ll i = 2; i * i <= n; i++) {
    if ((n % i) != 0) continue;
    pair<ll, ll> a = make_pair(i, 0);
    while ((n % i) == 0) {
      n /= i;
      a.second += 1;
    }
    p.push_back(a);
  }

  if (n != 1) p.push_back(make_pair(n, 1));
  return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a) {
  ll b = MOD, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= MOD;
  if (u < 0) {
    u += MOD;
  }
  return u;
}
// 順列
ll permutation(const ll n, const ll m) {
  ll result = 1;
  for (ll i = n; i > n - m; i--) {
    result = (result * i) % MOD;
  }
  return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x) {
  if (x == 0) return 1;
  ll res = repeat_square(n, x / 2);
  res = res * res % MOD;
  if ((x % 2) == 1) res = res * n % MOD;
  return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m) {
  ll p = permutation(n, m);
  ll div = 1;
  for (ll i = 2; i <= m; i++) {
    div = (div * i) % MOD;
  }
  return (p * modinv(div)) % MOD;
}

// アルファベットの取得
string get_alphabet(ll n) {
  n--;
  return string(1, 'a' + (n % 26));
}

int main() {
  int a;
  cin >> a;
  cout << (a + (a*a) + (a*a*a)) << endl;
  return 0;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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 (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N, M;
vector<int> G[200010];
bool checked[200010];

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

	cin >> N >> M;
	int a, b;
	rep(i, 0, M)
	{
		cin >> a >> b;
		a--, b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	queue<pii> q;
	q.push(mp(0, 0));
	while (!q.empty())
	{
		auto p = q.front();
		q.pop();
		if (p.second == 2)continue;
		for (auto e : G[p.first])
		{
			if (checked[e])continue;
			checked[e] = true;
			q.push(mp(e, p.second + 1));
		}
	}

	if (checked[N - 1])
	{
		cout << "POSSIBLE" << endl;
	}
	else
	{
		cout << "IMPOSSIBLE" << endl;
	}

	return 0;
}

Measured memory_bytes: 14568
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, K = MAP()
H = LIST()

H = sorted(H, reverse=True)
H = H[K:]

print(sum(H))

Measured memory_bytes: 27228
data = [
    [[0 for r in range(10)]for f in range(3)] for b in range(4)
]


count = int(input())
for c in range(count):
    b, f, r, v = [int(i) for i in input().split()]
    data[b-1][f-1][r-1] += v

for bi, b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')

        print()

    if bi < 3:
        print('#' * 20)

Measured memory_bytes: 7740
# -*- coding: utf-8 -*-
import sys


def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())


antennas = get_nums(5)
k = get_num()

if antennas[-1] - antennas[0] > k:
    print(':(')
else:
    print('Yay!')

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

int main(){
  int N,array[10001],i,count=0;
  cin >> N;
  for(i=0;i<N;i++){
    cin >> array[i];
  }
  
  for(i=0;i<N;i++){
    while(array[i]%2==0){
      array[i]/=2;
        count++;
    }
  }
    cout << count << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;//list用
using System.Text;//StringBuilder用
using System.Collections;
using System.Linq;
class Program
{
    static List<int> s = new List<int>();
    static decimal result;
static Hashtable ht=new Hashtable();
static StringBuilder sb = new StringBuilder();
static int N,M,K;
static long[,] table;
    static void Main()
    {
Read3();
result=s[2];
      for(int i=0;i<10;i++){
      result=result*s[0]-s[1];
                    Console.WriteLine(result.ToString());
      }
    }


    static void Read1()//1項
    {
        string tmp = Console.ReadLine();
        N = int.Parse(tmp);
    }
 
    static void Read2()//複数項（項目数Ｎ）
    {
        string[] tmp = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++) { s.Add(int.Parse(tmp[i])); }
    }
    static void Read3()//1行複数項
   {
       string[] tmp = Console.ReadLine().Split(' ');
       for (int i = 0; i < tmp.Length; i++) { s.Add(int.Parse(tmp[i])); }
    }
    static void Read4()//NK１行
    {
        string[] tmp = Console.ReadLine().Split(' ');
       N = int.Parse(tmp[0]);
       K = int.Parse(tmp[1]);
    }
    static void Read5()//N行K項
    {

 
    }


}

Measured memory_bytes: 11220
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = Long.parseLong(sc.next());
		long b = Long.parseLong(sc.next());
		long c = Long.parseLong(sc.next());
		long k = Long.parseLong(sc.next());
		long ans = a - b;
		if (k % 2 != 0)
			ans *= -1;
		if (Math.abs(ans)>=(long)1000000000*1000000000)
			ans = 0;
		System.out.println(ans);
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D, w) for(auto vec : vec2D) { for (auto v : vec) cerr << setw(w) << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

const char en = '\n';

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

typedef ll Weight;
typedef vector<vector<Weight>> Graph;
void add_edge(vector<vector<Weight>>& g, Weight from, Weight to, bool isDirected) {
	g[from].push_back(to);
	if (!isDirected) g[to].push_back(from);
}

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

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

  int t; cin >> t;
	cout << 10 - t/200 << endl;

}

Measured memory_bytes: 3648
N, K = map(int, input().split())
S = input()

L = []

tmp = None
cnt = 0
for s in S:
  if tmp == None:
    tmp = s
    cnt = 1
  else:
    if tmp != s:
      L.append((cnt, tmp))
      cnt = 1
      tmp = s
    else:
      cnt += 1
else:
  L.append((cnt, tmp))


ll = len(L)
 
for i in range(K):
  if ll == 1:
    break
  if ll == 2:
    ll -= 1
  else:
    ll -= 2

print(N - ll)

Measured memory_bytes: 10356
//秒単位の時間 S が与えられるので、h:m:s の形式で出力するプログラム

#include <stdio.h>

#define ONE_HOUR_SECOND 3600
#define ONE_MINUTE_SECOND 60 

int main(void)
{
    //変数定義
    int iHour;
    int iMinute;
    int iSecond;
    int iInputSecond;

    //変数の初期化
    iHour = 0;
    iMinute = 0;
    iSecond = 0;
    iInputSecond = 0;

    scanf("%d",&iInputSecond);
    iHour = iInputSecond / ONE_HOUR_SECOND;
    iMinute = (iInputSecond % ONE_HOUR_SECOND) / ONE_MINUTE_SECOND;
    iSecond = (iInputSecond % ONE_HOUR_SECOND) % ONE_MINUTE_SECOND;
    printf("%d:%d:%d\n",iHour,iMinute,iSecond);

    return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stdlib.h>
#include <time.h>
#include <queue>
#include <sstream>
using namespace std;
int main(void){
	int n;
	while(cin >> n){
		if(n == 0)break;
		int a = 0; 
		int b = 0;
		for(int i = 0; i < n; i++){
			int r, l;
			cin >> l >> r;
			if(r < l){
				a += r+l;
			}else if(r > l){
				b += r+l;
			}else if(r == l){
				a += l;
				b += r;
			}
		}
		cout << a << " " << b << endl;
	}
}

Measured memory_bytes: 1160
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

vll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> N;
    cin >> K;

    rep(ni,N){
        cin >> ltmp;
        A.push_back(ltmp);
    }
    sort(A.rbegin(),A.rend());
    ll cnt = 0;

    rep(ai,A.size()){
        if(A[ai]>=K){
            cnt++;
        }else{
            break;
        }
    }

    cout << cnt << endl;

}

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

int asc(const void *a, const void *b){
    return *(int *)a - *(int *)b;
}

int main(void){
    int n;
    scanf("%d", &n);

    int l[n];
    for(int i=0; i<n; i++){
        scanf("%d", &l[i]);
    }

    qsort(l, sizeof(l) / sizeof(int), sizeof(int), asc);

    int count = 0;

    for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n-1; j++){
            int t = n;
            int u = j+1;
             while(t!=u){
                int m = (t+u)/2;
                     if(l[m]<l[i]+l[j]) u = m+1;
                     else t = m;
                }
            count = count + (t - j - 1);
        }
    }
    printf("%d", count);
}

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

struct UnionFind{
    vector<ll> par;
    vector<ll> sizes;
    UnionFind(ll n) : par(n), sizes(n, 1) {
        rep(i,n) par[i] = i;
    }
    int find(ll x) {
        if (x == par[x]) return x;
        return par[x] = find(par[x]);
    }
    void unite(ll x, ll y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }

    bool same(ll x, ll y) {
        return find(x) == find(y);
    }

    ll size(ll x) {
        return sizes[find(x)];
    }
};

vector<int> f[100010], b[100010];

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind tree(n);
    rep(i, m){
        int p, q;
        cin >> p >> q;
        p--, q--;
        tree.unite(p, q);
        f[p].push_back(q);
        f[q].push_back(p);
    }
    rep(i, k){
        int p, q;
        cin >> p >> q;
        p--, q--;
        b[p].push_back(q);
        b[q].push_back(p);
    }
    ll ans[100010];

    rep(i, n){
        int cnt = 0;
        rep(j, f[i].size()){
            int tmp = f[i][j];
            if (tree.same(i, tmp)) cnt++;
        }
        rep(j, b[i].size()){
            int tmp = b[i][j];
            if (tree.same(i, tmp)) cnt++;
        }
        ans[i] = tree.size(i) - cnt - 1;
    }
    rep(i, n-1) cout << ans[i] << " ";
    cout << ans[n-1] << endl;

    return 0;
}


Measured memory_bytes: 14200
function Main(input) {
  var ans = Math.floor(input);

  var x = ans / 1.08;

  var lowest = Math.floor(x);
  var highest = Math.ceil(x);

  if (Math.floor(lowest * 1.08) === ans) {
    console.log(lowest);
  } else if (Math.floor(highest * 1.08) === ans) {
    console.log(highest);
  } else {
    console.log(':(');
  }
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
 
int search(vector<string> data,int H,int W,int i,int j){
  int count=0;
  for(int x=-1;x<=1;x++){
    for(int y=-1;y<=1;y++){
      if(i+x >= 0 && i+x < H && j+y >= 0 && j+y < W){
        if((i+x != i || j+y != j) && data.at(i+x).at(j+y) == '#'){
          count++;
        }
      }
    }
  }
  
  return(count);
}
      
 
int main(){
  int H,W;
  cin >> H >> W;
  vector<string> data(H);
  vector<string> output(H);
  
  for(int i=0;i<H;i++){
    cin >> data.at(i);
  }
  
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(data.at(i).at(j) == '.'){
        output.at(i) += char(search(data,H,W,i,j)+'0');
      }else{
        output.at(i) += '#';
      }
    }
  }
 
  for(int i=0;i<H;i++){
    cout << output.at(i) << endl;
  }
  
  return(0);
} 


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

int main() {
  int N,X;
  cin >> N >> X;
  vector<int> m(N);
  int sum=0;
  for(int i=0;i<N;i++){
    cin >> m[i];
    sum+=m[i];
  }
  sort(m.begin(),m.end());
  cout << N+(X-sum)/m[0];
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] arg) {
		int Q = sc.nextInt();
		for (int i = 0; i < Q; ++i) {
			System.out.println(solve(sc.nextInt()));
		}
	}

	static int solve(int n) {
		if (n < 10) return 0;
		int base = 10;
		int max = 0;
		while (base <= n) {
			int hi = n / base;
			int lw = n % base;
			base *= 10;
			max = Math.max(max, hi * lw);
		}
		return solve(max) + 1;
	}
}

Measured memory_bytes: 19060
#include<stdio.h>
#define MAX 100005
#define NIL -1

struct Node{ int p, l, r,key;};
struct Node T[MAX];

int n, S[MAX],DG[MAX],H[MAX], D[MAX];

int getDepth(int u){
  int d = 0,n = u;
  while(1){
    n = T[n].p;
    if(n == NIL)break;
    d++;
  }
  return d;
}


int getHeight(int u){
  int L=0,R=0;
  if (T[u].r == NIL && T[u].l == NIL) return 0;
    if (T[u].l != NIL){
      L =  getHeight(T[u].l)+1;
    }
    if(T[u].r != NIL){
      R =  getHeight(T[u].r)+1;
    }
    if(L > R) return L; 
    
    else return R; 
}


int getDegree(int u){
  int n = u;
  if(T[n].l != NIL && T[n].r != NIL)return 2;
  else if(T[n].l != NIL || T[n].r != NIL)return 1;
  else return 0;
}

int getSibling(int u, int n){
  int i;
  for(i = 0; i < n; i++ ){
    if(T[u].p == T[i].p && i != u)return i; 
  }
  return NIL;
}

void print(int u){
  int n = u;
  printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d,",u,T[u].p,S[u],DG[u],D[u],H[u]);
  n = T[n].l;

  if(T[u].p == NIL)printf(" root\n");
  else if(DG[u]>= 1 && DG[u] <= 2)printf(" internal node\n");
  else printf(" leaf\n");
 
}
int main(){
  int i,v,l,r;

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    T[i].p = T[i].l = T[i].r = NIL;
  }

  for ( i = 0; i < n; i++ ){
    scanf("%d %d %d", &v,&l,&r);
    /*make tree*/
    T[v].l = l;
    T[v].r = r;
    if(l != NIL)T[l].p = v;
    if(r != NIL)T[r].p = v;
  }
 
  for(i = 0; i < n; i++){
    S[i] = getSibling(i,n);
  }

  for(i = 0; i < n; i++){
    DG[i] = getDegree(i);
    }
  for ( i = 0; i < n; i++ ){
     D[i] = getDepth(i);
  }
 
  for (i = 0; i < n; i++ ){
    H[i] = getHeight(i);
  } 

  for ( i = 0; i < n; i++ ) print(i);
  return 0;
  
}

Measured memory_bytes: 628
#include"bits/stdc++.h"
using namespace std;

int main(){
  int N, i, j, S1, S2, min=100;
  cin >> N;
  vector<int> W(N);
  for(i=0; i<N; i++) cin >> W[i];

  for(i=1; i<N; i++){
    S1 = 0;
    S2 = 0;
    for(j=0; j<i; j++){
      S1 += W[j];
    }
    for(j=i; j<N; j++){
      S2 += W[j];
    }
    if(abs(S1-S2)<min) min = abs(S1-S2);
  }

  cout << min << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;

  vector<int> acc;
  int bt = 1;
  int cnt = 0;
  rep(i, n) {
    if(s[i] != (char)(bt + '0')) {
      acc.push_back(cnt);
      bt ^= 1;
      cnt = 1;
    } else {
      cnt++;
    }
  }
  if(cnt != 0) acc.push_back(cnt);
  if(!bt) acc.push_back(0);

  int m = (int)acc.size();
  int d = 2 * k + 1;
  int ans = 0;
  for(int i = 0; i < m; i += 2) {
    int tmp = 0;
    int left = i;
    int right = min(i + d, m);
    for(int j = left; j < right; j++) {
      tmp += acc[j];
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int M = 1000000007;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n, k, s, t;
    cin >> n >> k >> s >> t;
    if ((s | t) != t) {
        cout << 0 << '\n';
        return 0;
    }
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int aa;
        cin >> aa;
        if ((aa & s) == s && (aa | t) == t) {
            a.push_back(aa);
        }
    }
    n = a.size();
    k = min(n, k);
    vector<P> cond;
    for (int i = 0; i < 18; ++i) {
        if (((s >> i) & 1) == 0) {
            cond.push_back({ i, 0 });
        }
        if (((t >> i) & 1) == 1) {
            cond.push_back({ i, 1 });
        }
    }
    vector<unordered_map<long long, long long>> dp(k + 1);
    for (int i = 0; i <= k; ++i) {
        dp[i].reserve(1 << 18);
    }
    dp[0][0] = 1;
    for (int i = 0; i < n; ++i) {
        long long mask = 0;
        for (int j = 0; j < (int)cond.size(); ++j) {
            if (((a[i] >> cond[j].first) & 1) == cond[j].second) {
                mask ^= 1LL << j;
            }
        }
        for (int j = k - 1; j >= 0; --j) {
            for (auto& l : dp[j]) {
                dp[j + 1][l.first | mask] += l.second;
            }
        }
    }
    long long ans = 0;
    for (auto& i : dp) {
        ans += i[(1LL << (int)cond.size()) - 1];
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 187812
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}

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

//////////////////////////////////////////////////

ll gcd (ll a, ll b) { return b?gcd(b,a%b): a;}

int main() {
    int n; cin >> n;
    ll m; cin >> m;
    vector<ll> a(n);
    rep(i,n) cin >> a[i], a[i] /= 2;

    ll lc = 1;
    rep(i,n) {
        lc = lc*a[i]/gcd(lc, a[i]);
        if (lc > m) {
            cout << 0 << endl;
            return 0;
        }
    }
    // cout << lc << endl;

    rep(i,n) {
        if ((lc/a[i])%2==0) {
            cout << 0 << endl;
            return 0;
        }
    } 

    int ans = (m/lc+1)/2;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
def gcd(n,m):#n,mは正の整数、最大公約数　許容は？
    if n==0:
        return m
    elif m==0:
        return n
    elif n>m:
        n=n%m
        return gcd(n,m)
    else:
        m=m%n
        return gcd(n,m)
def lcm(n,m):
    return n*m//gcd(n,m)


def longlcm(A):
    import copy
    if len(A)==2:
        return A[0]*A[1]//gcd(A[0],A[1])
    else:
        x=A[0]
        for i in range(1,len(A)):
            x=lcm(x,A[i])
        return x

N=int(input())
T=[0]*N
for i in range(0,N):
    T[i]=int(input())

print(longlcm(T))

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

using namespace std;

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

    const long long MOD = 1e9 + 7;
    long long n, mul = 1;

    cin >> n;
    for (int i = 1; i <= n; ++i)
        mul = (mul * i) % MOD;

    cout << mul << endl;

    return 0;
}


Measured memory_bytes: 256
#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 = 1000000007;
const int inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int, P>PP;

signed main() {
	string s; cin >> s;
	int cnt = 0;
	int n = s.size();
	rep(i, n/ 2) {
		if (s[i] != s[n - 1 - i])cnt++;
	}
	cout << cnt << endl;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

lli dp[100100];

signed main(){

	lli n,w;
	cin>>n>>w;

	REP(i,0,100100)dp[i]=INF;
	dp[0]=0;

	REP(i,0,n){
		lli w,v;
		cin>>w>>v;
		for(lli i=100005;i>=0;i--){
			if(i+v>100100)continue;
			dp[i+v] = min(dp[i]+w,dp[i+v]);
		}
	}

	lli ans=0;
	for(lli i=100005;i>=0;i--){
		if(dp[i]<=w){
			cout<<i<<endl;
			return 0;
		}
	}

	return 0;
}

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

#pragma GCC optimze("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")

#define x first
#define y second
#define pb push_back
#define mp make_pair

#define all(a) (a).begin(), (a).end()
#define sz(a) (int) (a).size()

#define ll long long
#define ld long double

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    ld x[n], y[n];
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
    vector<int> p(n);
    ld c = 0, s = 0;
    iota(all(p), 0);
    do {
        c += 1;
        for (int i = 1; i < n; i++) {
            s += sqrt((x[p[i]] - x[p[i - 1]]) * (x[p[i]] - x[p[i - 1]]) + (y[p[i]] - y[p[i - 1]]) * (y[p[i]] - y[p[i - 1]]));
        }
    } while (next_permutation(all(p)));
    cout << setprecision(20) << fixed << s / c << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, D, X;
  cin>>N>>D>>X;
  int A;
  int ans = 0;
  for(int i=0;i<N;++i) {
    cin>>A;
    ans += (D-1)/A+1;
  }
  cout<<ans+X<<endl;
}



Measured memory_bytes: 3600
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
 
using namespace std;
 
const int MX=2005;
 
int g[MX][MX],ev[MX][MX],eh[MX][MX],v[MX][MX];
int n,m,q;
int main(){
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++){
		static char t[MX];
		scanf("%s",t+1);
		for(int j=1;j<=m;j++)
			g[i][j]=t[j]-'0';
		}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			v[i][j]=v[i-1][j]+v[i][j-1]-v[i-1][j-1]+g[i][j];
	for(int i=2;i<=n;i++)
		for(int j=1;j<=m;j++)
			ev[i][j]=ev[i-1][j]+ev[i][j-1]-ev[i-1][j-1]+(g[i][j]&g[i-1][j]);
	for(int i=1;i<=n;i++)
		for(int j=2;j<=m;j++)
			eh[i][j]=eh[i-1][j]+eh[i][j-1]-eh[i-1][j-1]+(g[i][j]&g[i][j-1]);
	for(int i=1;i<=q;i++){
		int X1,Y1,X2,Y2;
		scanf("%d%d%d%d",&X1,&Y1,&X2,&Y2);
		printf("%d\n",
		(v[X2][Y2]-v[X1-1][Y2]-v[X2][Y1-1]+v[X1-1][Y1-1])
		-(ev[X2][Y2]-ev[X1][Y2]-ev[X2][Y1-1]+ev[X1][Y1-1])
		-(eh[X2][Y2]-eh[X1-1][Y2]-eh[X2][Y1]+eh[X1-1][Y1])
		);
	}
	return 0;
}

Measured memory_bytes: 64512
import java.util.HashMap;
import java.util.Scanner;
public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int n,con;
        String s;

        con=0;
        n=nextInt();
        s=next();
        for(int i=0;i<=s.length()-3;i++){
            if(s.charAt(i)=='A'){
                if(s.charAt(i+1)=='B'){
                    if(s.charAt(i+2)=='C'){
                        con+=1;
                    }
                }
            }
        }
        print(con);
    }



    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }
    public static void print(Object a){
        System.out.println(a);
    }
}


Measured memory_bytes: 25172
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		//入力表示
		String S = sc.next();

		int N = S.length();

		if (S.substring(0, (N - 1) / 2).equals(S.substring((N + 1) / 2, N))) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 21712
n = int(input())
li = []
for i in range(n):
    li_buf = input().split()
    li_buf[1] = int(li_buf[1])
    li_buf.append(i + 1)
    li.append(li_buf)

li_a = sorted(li, key=lambda x:x[1], reverse=True)
li_b = sorted(li_a, key=lambda x:x[0])

for i in range(n):
    print(li_b[i][2])

Measured memory_bytes: 3064
import sys
import numpy as np

n, d, *x = map(int, sys.stdin.read().split())
x = np.array(x, dtype=np.int64).reshape(n, d)

def main():
    cnt = 0
    for i in range(n-1):
        for j in range(i+1, n):
            dist = np.sqrt(((x[i] - x[j]) ** 2).sum())
            if dist == int(dist):
                cnt += 1
    
    return cnt
    
if __name__ == '__main__':
    ans = main()
    print(ans)

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

int main() {
	ios_base::sync_with_stdio( false );

	int H, W, N;
	cin >> H >> W >> N;

	map<pair<int, int>, int> mp;
	for( int i = 0; i < N; ++i ) {
		int a, b;
		cin >> a >> b;
		a -= 1;
		b -= 1;

		for( int p = a-2; p <= a; ++p ) {
			if( p < 0 || p >= H-2 ) { continue; }

			for( int q = b-2; q <= b; ++q ) {
				if( q >= 0 && q < W-2 ) {
					mp[{p, q}] += 1;
				}
			}
		}
	}

	vector<int64_t> sums( 10 );
	sums.at( 0 ) = (int64_t)(H-2)*(W-2) - mp.size();

	for( const auto& v: mp ) {
		sums.at( v.second ) += 1;
	}

	for( auto v: sums ) {
		cout << v << '\n';
	}
}


Measured memory_bytes: 56576
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

int main()
{
    int n, ans = 0;
    cin>>n;
    vector<vector<int>>who(n,vector<int>());
    vector<vector<int>>TorF(n,vector<int>());
    vector<vector<int>>copy_TorF(n,vector<int>());
    vector<int>number(n);
    rep(i,n){
        cin>>number[i];
        who[i].resize(number[i]);
        TorF[i].resize(number[i]);
        copy_TorF[i].resize(number[i]);
        rep(j,number[i]){
            cin>>who[i][j]>>TorF[i][j];
        }
    }

    rep(s,1<<n){
        int how_many = 0;
        bool ok = true;
        vector<int>which(n);
        rep(i,n){
            rep(j,number[i]){
                copy_TorF[i][j] = TorF[i][j]; 
            }
        }

        rep(i,n){
            if(s>>i&1) which[i] = 1;
        }
        rep(i,n){
            rep(j,number[i]){
                if(which[i]){
                    if(copy_TorF[i][j] ^ which[who[i][j]-1]) ok = false;
                }
            }
        }
        if(ok){
            rep(i,n){
                if(which[i]) how_many++;
            }
        }
        ans = max(ans,how_many);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int a[100],n,i,j,box1,count=0,minv,v,p;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);//配列読み込み
	for(i=0;i<n;i++){//i ソート済みの配列番号
		minv=101;//制約条件より最大値を格納
		for(j=i;j<n;j++){//未ソート部分から最小値を捜索
			if(a[j]<minv){
				minv=a[j];
				v=j;
			}
		}
		if(minv!=a[i]){//最小値が左端でなければ交換
			box1=a[i];
			a[i]=minv;
			a[v]=box1;
			count++;
		}
	}
	for(i=0;i<n;i++){
	    	printf("%d",a[i]);
	    	if(i!=n-1) printf(" ");
		}
		printf("\n%d\n",count);
	
	return 0;
}


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

int main(){
  int n,k;
  cin >>n>>k; 
  vector<int> h(n);
  for(int i=0; i<n; i++){
    cin >>h[i];
  }
  int ans =0;
  for(int i=0; i<n; i++){
    if(h[i]>=k){
      ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cctype>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <complex>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
const double PI = 3.141592653589793238462643383279502884L;
const int LARGE_PRIME = 1000000007;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i,a,cont,next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i,a,b,s) repfn(i,a,i<b,i+s)
#define repab(i,a,b) repby(i,a,b,1)
#define rep(i,b) repab(i,0,b)
#define pb push_back
#define sz(c) int((c).size())

int main(int argc, char **argv)
{
  int c;

  while ((c = getchar()) != EOF) {
    if (islower(c))
      c = toupper(c);
    printf("%c", c);
  }
  return 0;
}

Measured memory_bytes: 1072
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2015>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

int N,M;
ll solve(){
    ll res = 0;
    vector<ll> h(N+1),w(M+1);
    for(int i = 1; i <= N;i++){
        cin >> h[i];
        h[i] += h[i-1];
    }
    for(int i = 1; i <= M;i++){
        cin >> w[i];
        w[i] += w[i-1];
    }
    set<ll> s;
    map<ll,ll> x,y;
    for(int i = 0; i <= N;i++){
        for(int j = i+1; j <= N;j++){
            ll dif = h[j]-h[i];
            s.insert(dif);
            x[dif]++;
        }
    }
    for(int i = 0; i <= M;i++){
        for(int j = i+1; j <= M;j++){
            ll dif = w[j] - w[i];
            s.insert(dif);
            y[dif]++;
        }
    }
    
    for(auto v:s){
        res += x[v]*y[v];
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    while(cin >> N>>M,N|M){
        cout<< solve() << endl;
    }
    return 0;
}



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

int main() {
  vector<char> vec(3), vec2(3);
  for (int i = 0; i < 3; i++) cin >> vec.at(i);
  for (int i = 0; i < 3; i++) cin >> vec2.at(i);
  reverse(vec.begin(), vec.end());
  if (vec.at(0) == vec2.at(0) && vec.at(1) == vec2.at(1) && vec.at(2) == vec2.at(2)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    sort(S.begin(), S.end());
    if(S[0] == S[1] && S[2] == S[3] && S[0] != S[2]){
        cout<<YES<<endl;
    }else{
        cout<<NO<<endl;
    }
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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 const *argv[]) {
    int a,b; cin>>a>>b;
    if (a >= 10 || b>=10) {
        cout << -1 << endl;
        return 0;
    }

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

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

int main()
{
    int n;
    cin >> n;
    double xi, ans = 0;
    string ui;
    for(int i = 0; i < n; i++){
        cin >> xi >> ui;
        ans += xi * (ui == "JPY" ? 1 : 380000);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int count = 0;
        while (n > 0) {
            n /= k;
            count++;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 21588