akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#define int long long
#define uint unsigned long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
using namespace std;

#define S 0
#define W 1

int ans[100000];
int n;
string s;

bool is_valid(int index)
{
	int cur = index;
	int prev = (index - 1) % n;
	int next = (index + 1) % n;
	if (ans[cur] == S && s.at(cur) == 'o' && ans[prev] == ans[next])
	{
		return true;
	}
	else if (ans[cur] == S && s.at(cur) == 'x' && ans[prev] != ans[next])
	{
		return true;
	}
	else if (ans[cur] == W && s.at(cur) == 'o' && ans[prev] != ans[next])
	{
		return true;
	}
	else if (ans[cur] == W && s.at(cur) == 'x' && ans[prev] == ans[next])
	{
		return true;
	}

	return false;
}

signed main()
{
	cin >> n;
	cin >> s;

	for (int k = 0; k < 4; k++)
	{
		if (s.at(0) == 'o')
		{
			switch (k)
			{
			case 0:
				ans[n - 1] = S;
				ans[0] = S;
				ans[1] = S;
				break;
			case 1:
				ans[n - 1] = W;
				ans[0] = S;
				ans[1] = W;
				break;
			case 2:
				ans[n - 1] = S;
				ans[0] = W;
				ans[1] = W;
				break;
			case 3:
				ans[n - 1] = W;
				ans[0] = W;
				ans[1] = S;
				break;
			}
		}
		else if (s.at(0) == 'x')
		{
			switch (k)
			{
			case 0:
				ans[n - 1] = S;
				ans[0] = S;
				ans[1] = W;
				break;
			case 1:
				ans[n - 1] = W;
				ans[0] = S;
				ans[1] = S;
				break;
			case 2:
				ans[n - 1] = S;
				ans[0] = W;
				ans[1] = S;
				break;
			case 3:
				ans[n - 1] = W;
				ans[0] = W;
				ans[1] = W;
				break;
			}
		}


		for (int i = 1; i <= n - 3; i++)
		{
			int prev = (i - 1) % n;
			int next = (i + 1) % n;

			if (s.at(i) == 'o')
			{
				if (ans[i] == S)
				{
					ans[next] = ans[prev];
				}
				else
				{
					ans[next] = (ans[prev] ^ 1);
				}
			}
			else if (s.at(i) == 'x')
			{
				if (ans[i] == S)
				{
					ans[next] = (ans[prev] ^ 1);
				}
				else
				{
					ans[next] = ans[prev];
				}
			}
		}

		if (is_valid(n - 2) && is_valid(n - 1))
		{
			string s = "";
			for (int i = 0; i < n; i++)
			{
				s += (ans[i] == S) ? "S" : "W";
			}
			cout << s << endl;
			return 0;
		}
	}

	cout << -1 << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <tuple>
#include <set>
#include <functional> 
#include <string.h>
//#include <assert.h>
//#include <typeinfo.h>
#include <time.h>

#define X first
#define Y second
#define MP make_pair
#define MT make_tuple
#define FOR(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REP(i, a, n) for(int (i) = (a); (i) < (n); ++(i))
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll > pll;
using namespace std;

const int INIT_SIZE_MAX = (1 << 29) + 10;
const int INIT_SIZE_MIN = -(1 << 29) - 10;
const int INIT_SIZE = 0;
const int MAX = 8;
const int DIR_SIZE = 12;
const double PI = 3.1415926535897932384;

template<class T, class U>
void convert(T &t, U &u){
	stringstream ss;
	ss << t;
	ss >> u;
}

int main(){
	int h, m, s;
	while (cin >> h >> m >> s){
		if (h == -1 && m == -1 && s == -1) break;
		
		int used = (h * 60 + m) * 60 + s;
		int standard = 2 * 60 * 60 - used;
		//int three_times = 2 * 60 * 60 - (used / 3 + (used % 3));
		int three_times = 3 * standard;

		printf("%02d:%02d:%02d\n", standard / 3600, standard % 3600 / 60, standard % 3600 % 60);
		printf("%02d:%02d:%02d\n", three_times / 3600, three_times % 3600 / 60, three_times % 3600 % 60);
	}
	return 0;
}

Measured memory_bytes: 1144
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define rs(a, b) ((a) >> (b))
#define ls(a, b) ((a) << (b))
#define gcd __gcd
#define lcm(a, b) ((a * b) / gcd(a, b))
#define pq priority_queue
#define um unordered_map
#define us unordered_set
#define lb lower_bound
#define ub upper_bound
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define nani(x) cerr << #x << " is " << x << endl;
#define ch(x) (x - 'a' + 1)
#define mp make_pair
#define pb push_back
#define loop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define scan(x, n) loop(i, 0, n) cin >> x[i];
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({ v, w }), g[v].pb({ u, w });
#define print(x, n) loop(i, 0, n) cout << x[i] << " ";
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000
#define mod 1000000007

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef pair<long, long> pll;
typedef vector<ii> vii;
typedef vector<pll> vll;
typedef um<int, int> umii;
typedef um<char, int> umci;
typedef map<char, int> mci;
typedef map<int, int> mii;

int main()
{
    fast;
    //freopen("input.txt", "r", stdin);
    string s;
    int a;
    cin >> a >> s;
    if (a >= 3200)
        cout << s;
    else
        cout << "red";
    return 0;
}


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

#define sint(i) scanf("%d",&i);
#define sintt(i,j) scanf("%d%d",&i,&j);
#define sinttt(i,j,k) scanf("%d%d%d",&i,&j,&k);
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

char masu[5001][5001];
int main(){
	while(1){
		int n;
		sint(n);
		if(n==0)break;
		rep(i,5001){
			rep(j,5001){
				masu[i][j]=-1;
			}
		}
		
		int nx[3001];
		int ny[3001];
		
		rep(i,n){
			sintt(nx[i],ny[i]);
			masu[nx[i]][ny[i]]=1;
		}
		
		/*
		rep(i,10){
			rep(j,10){
				printf("%2d",masu[j][9-(i)]);
			}puts("");
		}*/
		
		int maxi=0;
		rep(i,n){
			rep(j,n-i){
				if(i==j+i){
					continue;
				}
				int dx=nx[i]-nx[j+i];
				int dy=ny[i]-ny[j+i];
				
				int a[8];
				a[0]=nx[i]+dy*-1;
				a[1]=ny[i]+dx;
				a[2]=nx[j+i]+dy*-1;
				a[3]=ny[j+i]+dx;
				a[4]=nx[i]+dy;
				a[5]=ny[i]+dx*-1;
				a[6]=nx[j+i]+dy;
				a[7]=ny[j+i]+dx*-1;
				
				int flg1=0,flg2=0;
				rep(k,4){
					if(a[k]<0 || a[k]>5000){
						flg1=1;
					}
				}
				rep(k,4){
					if(a[k+4]<0 || a[k+4]>5000){
						flg2=1;
					}
				}/*
				rep(k,8){
					printf("%6d",a[k]);
				}
				printf(" 1==%d 2==%d\n",flg1,flg2);
				*/
				
				if((flg1==0 && masu[nx[i]+dy*-1][ny[i]+dx]==1 && masu[nx[j+i]+dy*-1][ny[j+i]+dx]==1) ||
				  (flg2==0 && masu[nx[i]+dy][ny[i]+dx*-1]==1 && masu[nx[j+i]+dy][ny[j+i]+dx*-1]==1)){
				  	maxi=max(maxi,dx*dx+dy*dy);
				}
			}
		}
		printf("%d\n",maxi);
	}
}

/*
4
0 5000
5000 0
0 0
5000 5000

*/

Measured memory_bytes: 24000
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

ll counter(ll x) {
  if (x == 0) return 0;
  return counter(x >> 1) + (x & 1);
}

signed main() {
  ll N;
  cin >> N;
  vector<vector<P>> syogen(N);

  rep(i, N) {
    ll A;
    cin >> A;
    rep(j, A) {
      ll x, y;
      cin >> x >> y;
      x--;

      syogen[i].pb({x, y});
      debug(i);
      debug(x);
      debug(y);
    }
  }
  ll ans = 0;
  // bitですべて探索
  rep(bits, 1 << N) {
    bool ok = true;
    debug(bits);

    // 正しいか確認する
    rep(i, N) {
      if (bits & (1 << i)) {
        debug(i);
        for (P t : syogen[i]) {
          ll settei = (bits >> t.first) & 1;
          debug(t.first);
          debug(t.second);
          debug(settei);
          ll ttt = (bits >> t.second) & 1;
          debug(ttt);
          if (settei != t.second) {
            debug("false");
            ok = false;
            break;
          }
        }
      }
      if (!ok) {
        break;
      }
    }
    if (ok) {
      debug("ok");
      debug(counter(bits));
      ans = max(ans, counter(bits));
    }
    // ENDL;
  }
  COUT(ans);

  return 0;
}

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

int N, A, B, C;
vector<int> l;

int dfa(int cur, int a, int b, int c){
  if(cur==N){
    if(min({a,b,c})>0){
      return abs(A-a)+abs(B-b)+abs(C-c)-30;
    } else {
      return 10e8;
    }
  }

  return min({dfa(cur+1,a,b,c),
	dfa(cur+1,a+l[cur],b,c)+10,
	dfa(cur+1,a,b+l[cur],c)+10,
	dfa(cur+1,a,b,c+l[cur])+10});
}

 int main(void) {
  cin >> N >> A >> B >> C;
  l=vector<int>(N);
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }

  cout << dfa(0,0,0,0) << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys, math
input = sys.stdin.readline
H, W = map(int, input().split())

if H == 1 or W == 1:
  print(1)
  exit()
  
n1 = math.ceil(W/2)
n2 = math.floor(W/2)
m1 = math.ceil(H/2)
m2 = math.floor(H/2)

ret = m1 * n1 + m2 * n2
print(ret)

Measured memory_bytes: 3060
#include<stdio.h>
int main(){
  while(1){
    int n,c=0,k=5;
    scanf("%d",&n);
    if(n==0)break;
    while(k<20000){
      c+=n/(k);
      k*=5;
    }
      // c+=n/50000;
    printf("%d\n",c);
  }
  return 0;
}

Measured memory_bytes: 600
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
sys.setrecursionlimit(1000000000)

def resolve():
    it = map(int, sys.stdin.read().split())

    T = next(it)
    ans = []
    for i in range(T):
        N = next(it)

        val = 0; a1 = []; a2 = []
        for i, v1, v2 in ((next(it), next(it), next(it)) for i in range(N)):
            diff = v1 - v2
            a, v, diff = (a1, v2, diff) if diff >= 0 else (a2, v1, -diff)
            a.append((diff, i))
            val += v
        a1.sort(reverse=True); a2.sort(reverse=True)

        ls = len(a1)
        vis = [None]*(N+1)
        def root(x):
            if vis[x] == None: return x

            vis[x] = root(vis[x])
            return vis[x]
        def root(x):
            a = []
            while True:
                y = vis[x]
                if y == None:
                    break
                a.append(x)
                x = y
            for i in a:
                vis[i] = x
            return x

        for diff, i in a1:
            j = min(i, ls) - 1
            k = root(j)
            #print(diff, i, j, k,  vis)
            if k < 0: continue
            val += diff
            vis[k] = k - 1


        for diff, i in a2:
            j, v2 = max(i, ls), [[-1]]
            k = root(j)
            #print(diff, i, j, k,  vis)
            if k >= N: continue
            val += diff
            vis[k] = k + 1

        ans.append(val)

    print(*ans, sep="\n")



if __name__ == "__main__":
    resolve()


Measured memory_bytes: 127276
import numpy as np

n = int(input())
arr = list(map(int,input().split()))
for i in range(n):
    arr[i]-=(i+1)

arr.sort()

mean=int(sum(arr)/n)
mid1=arr[n//2]
mid2=arr[(n-1)//2]

ans = [0,0,0]

for i in range(n):
    ans[0] += abs(arr[i]-mean)
    ans[1] += abs(arr[i]-mid1)
    ans[2] += abs(arr[i]-mid2)

print(int(min(ans)))



Measured memory_bytes: 34232
# -*- coding: utf-8 -*-


def main():
    n, c, k = list(map(int, input().split()))
    t = sorted([int(input()) for _ in range(n)])

    remain_seats = c - 1
    departure_time = t[0] + k
    bus_count = 1

    # See:
    # https://www.youtube.com/watch?v=cJ-WjtA34GQ
    for i in range(1, n):
        if remain_seats >= 1 and t[i] <= departure_time:
            remain_seats -= 1
        else:
            bus_count += 1
            remain_seats = c - 1
            departure_time = t[i] + k

    print(bus_count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 8280
h, w = list(map(int, input().split()))

moji_arr = [0]*h
for i in range(h):
    moji_arr[i] = input()

sharp_arr = [0]*(h+2)

sharp_arr[0] = '#'*(w+2)
for i in range(h):
    sharp_arr[i+1] = '#' + moji_arr[i] + '#'
sharp_arr[h+1] = '#'*(w+2)

for i in range(h+2):
    print(sharp_arr[i])

Measured memory_bytes: 3064
#include <stdio.h>

using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	int A[n];

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

	for(int i = n-1; i > 0; i--) printf("%d ",A[i]);
	printf("%d\n",A[0]);
}



Measured memory_bytes: 2752
#include<iostream>
#include<cmath>

using namespace std;


int main(){
	
	int n;
	cin >> n;
			
	long long minv = 10000000000, maxv = -10000000000;
	
	for(int j=0;j<n;j++){
	
	long long a;
	cin >> a;
	
  	maxv = max( maxv, a - minv );
  	minv = min( minv, a );
	
}
	cout << maxv << "\n";
    return 0;
}


Measured memory_bytes: 3012
import java.util.*;
public class Main {
    public static void main(String[] args ){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        for (int i = 1; i < n; i++) {
            a ^= sc.nextInt();
        }
        if (a == 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

#define N_MAX 100000

int main() {
    long n;
    cin >> n;
    long A[N_MAX];
    for (long i = 0; i < n; i++) {
        cin >> A[i];
    }

    sort(A, A + n);


    long kind_num = 1;
    for (long i = 0; i < n - 1; i++) {
        if (A[i+1] != A[i]) {
            kind_num++;
        }
    }

    if (kind_num == 1) {
        if (A[0] == 0) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }

    else if (kind_num == 2) {
        long num1 = A[0];   // 0
        long num2 = A[n - 1];
        long cnt_num1 = 0;
        long cnt_num2 = 0;
        for (long i = 0; i < n; i++) {
            if (A[i] == num1) {
                cnt_num1++;
            }
            else if (A[i] == num2) {
                cnt_num2++;
            }
        }

        if (n % 3 == 0 && num1 == 0) {
            if (cnt_num1 == n / 3 && cnt_num2 == n * 2 / 3) {
                cout << "Yes" << endl;
            }
            else {
                cout << "No" << endl;
            }
        }
        else {
            cout << "No" << endl;
        }
    }

    else if (kind_num == 3) {
        long num1 = A[0];
        long num2;
        long num3 = A[n - 1];
        long cnt_num1 = 0;
        long cnt_num2 = 0;
        long cnt_num3 = 0;
        for (long i = 0; i < n; i++) {
            if (A[i] != num1) {
                num2 = A[i];
                break;
            }
        }
        for (long i = 0; i < n; i++) {
            if (A[i] == num1) {
                cnt_num1++;
            }
            else if (A[i] == num2) {
                cnt_num2++;
            }
            else if (A[i] == num3) {
                cnt_num3++;
            }
        }

        if (cnt_num1 == cnt_num2 && cnt_num2 == cnt_num3) {
            if ((num1 ^ num2) == num3 && (num2 ^ num3) == num1 && (num3 ^ num1) == num2) {
                cout << "Yes" << endl;
            }
            else {
                cout << "No" << endl;
            }
        }
        else {
            cout << "No" << endl;
        }
    }

    else if (kind_num > 3) {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderWorkspace
{
    class Program
    {
        static void Main(string[] args)
        {
            var cin = new Scanner();
            var N = cin.nextInt();

            var list = new List<Tuple<int,string, int>>();
            for (int i = 0; i < N; i++)
            {
                var s = cin.next();
                var p = cin.nextInt();

                list.Add(new Tuple<int,string,int>(i+1,s, p));
            }

            list.Sort((a, b) =>
            {
                if (a.Item2.Equals(b.Item2))
                {
                    return b.Item3.CompareTo(a.Item3);
                }
                return a.Item2.CompareTo(b.Item2);
            });

            for (int i = 0; i < N; i++)
            {
                Console.WriteLine(list[i].Item1);
            }                
        }
    }
    
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
    public static class ListExtensions
    {

        public static T Dequeue<T>(this IList<T> self)
        {
            var result = self[0];
            self.RemoveAt(0);
            return result;
        }


        public static void Enqueue<T>(this IList<T> self, T item)
        {
            self.Add(item);
        }


        public static T Peek<T>(this IList<T> self)
        {
            return self[0];
        }
    }

}


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

int main() {
    string s, p;
    cin >> s >> p;
    s += s;
    int count = 0;
    for (int i = 0; i < s.size() - p.size(); i++) {
        for (int j = 0; j < p.size(); j++) {
            if (s[i+j] == p[j]) {
                count++;
                if (count == p.size()) {
                    cout << "Yes" << endl;
                    return 0;
                }
            } else {
                count = 0;
                break;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

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

// doubly LL
// せっかくなのでまじめに自前で実装する
typedef struct node{
  int data;
  struct node *prev, *next;
} Node;

class DLList{
  Node *top;
  Node *btm;
  
public:
  DLList(){
    top = btm = NULL;
  }
  void insert(int x){
//    cout << "ins: " << x << endl;
    Node *node = new Node;
    node->data = x;
    node->prev = NULL;
    node->next = top;
    if (top!=NULL) top->prev = node;
    top = node;
    if (btm==NULL) btm = node;
  }
  void del(int x){
//    cout << "dlX:" << x << endl;
    Node *p;
    p = this->seek(x);
    if (p==NULL) return;
    if (p->prev!=NULL){ // *p isn't a top node
      p->prev->next = p->next;
    } else top = p->next;
    if (p->next!=NULL){ // *p isn't a btm node
      p->next->prev = p->prev;
    } else btm = p->prev;
    delete p;
  }
  void delFirst(){
//    cout << "dlF" << endl;
    Node *p = top;
    if (top->next!=NULL){ // list has 2 or more nodes
      top->next->prev = NULL;
      top = top->next;
    } else { // list has only 1 nodes
      top = NULL;
      btm = NULL;
    }
    delete p;
  }
  void delLast(){
//    cout << "dlL" << endl;
    Node *p = btm;
    if (btm->prev!=NULL){ // list has 2 or more nodes
      btm->prev->next = NULL;
      btm = btm->prev;
    } else { // list has only 1 nodes
      top = NULL;
      btm = NULL;
    }
    delete p;
  }
  void print(){
    Node *p;
    for (p=top; p!=NULL ;p=p->next){
      cout << p->data;
      if (p->next==NULL) cout << endl;
      else cout << " ";
    }
  }
  void printBack(){
    Node *p;
    for (p=btm; p!=NULL ;p=p->prev){
      cout << p->data;
      if (p->prev==NULL) cout << endl;
      else cout << " ";
    }
  }
private:
  Node *seek(int x){
    Node *p;
    for (p=top; p!=NULL ;p=p->next){
      if (p->data==x) return p;
    }
    return p;
  }
};

int main(void){
  DLList list;
  int n, x;
  string cmd;
  
  cin >> n;
  for (int i=0; i<n; i++){
    cin >> cmd;
    if (cmd=="insert"){
      cin >> x;
      list.insert(x);
    } else if (cmd=="delete"){
      cin >> x;
      list.del(x);
    } else if (cmd=="deleteFirst"){
      list.delFirst();
    } else if (cmd=="deleteLast"){
      list.delLast();
    }
  }
  list.print();
  return 0;
}
  
  



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

int main(int argc, char *argv[]){
  int n, t;
  cin >> n >> t;
  string s[2][n];
  int time[2][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      int a, b;
      scanf("%d:%d ", &a, &b);
      time[j][i] = 60*a + b;
      cin >> s[j][i];
    }
  }
  vector<int> id;
  for (int i = 1; i < n; i++) {
    if(time[0][i] - time[1][i - 1] >= t){
      id.push_back(i);
    }
  }
  std::cout << id.size() << std::endl;
  for (int i = 0; i < id.size(); i++) {
    std::cout << s[0][id[i]] << " " <<
      time[0][id[i]] - time[1][id[i] - 1] << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRT(v) sort(v.begin(),v.end())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;


int abc104_c(){
    //入力
    int n,d,x;
    cin >> n >> d >> x;
    int a[n];
    REP(i,0,n){
        cin >> a[i];
    }
    int ans = x;
    //処理
    REP(i,0,n){
        ans += (d-1)/a[i]+1;
    }
    
    //出力
    cout << ans << ENT;
    return 0;
}

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


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

#define int ll
#define rep(i, n) for (int i = 0, i##_cond = (n); i < i##_cond; ++i)
#define FOR(i, a, b) for (int i = (a), i##_cond = (b); i < i##_cond; ++i)
#define ROF(i, a, b)                                                           \
  for (int i = (a)-1, i##_cond = (b); i >= i##_cond; --i) // ROF(i,n,0)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend() // sortで降順
#define SUM(a) accumulate(all(a), int(0))
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
constexpr ll inf = 1ll << 61;
constexpr ll mod = 1e9 + 7;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> T add(const T &a, const T &b) { return (a + b) % mod; }

signed main() {
  int x, n;
  cin >> x >> n;
  set<int> p;
  rep(i, n) {
    int a;
    cin >> a;
    p.insert(a);
  }

  int d = 0;
  while (1) {
    if (p.count(x - d) == 0) {
      cout << x - d << endl;
      return 0;
    }
    if (p.count(x + d) == 0) {
      cout << x + d << endl;
      return 0;
    }
    d++;
  }
}

Measured memory_bytes: 3624
#include<iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    a=a[0]-32;
    b=b[0]-32;
    c=c[0]-32;
    cout << a << b << c << endl;
    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

int main() {
    string S; cin >> S;
    int N = sz(S);
    vector<int> pos;
    repp(i, 0, N) {
        if(i == 0 || i == N) pos.push_back(i);
        else if(S[i] == '<' && S[i - 1] == '>') pos.push_back(i); 
    }
    ll sum = 0;
    rep(i, sz(pos) - 1) {
        int s = pos[i], e = pos[i + 1];
        ll right = 0, left = 0;
        repp(i, s, e - 1) {
            if(S[i] == '<') right++;
            else break;
        }
        repp(i, s, e - 1) {
            if(S[i] == '>') left++;
        }
        ll MAX = max(right, left), MIN = min(right, left);
        // cout << MAX << " " << MIN << "\n";
        sum += MAX * (MAX + 1) / 2 + MIN * (MIN - 1) / 2;
    }
    cout << sum << "\n";
}

Measured memory_bytes: 1540
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005


ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}


/////////////////////////////////////////////////////////////////
typedef pair<double,int> i_d;
#define MAX_V 1005//調節！！！！！！！！！！！！！！！！！！！！！！！！
struct edge{int to;double cost;};
double d[MAX_V];//頂点sからの最短距離
int V;//頂点数！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！
vector<edge>G[MAX_V];
void dijkstra(int s){
    priority_queue<i_d,vector<i_d>,greater<i_d>> que;//firstは最短距離、secondは頂点の番号
    fill(d,d+V+1,inf);//頂点番号は0~V-1でも1~Vでもお好きな方で
    d[s]=0;
    que.push(i_d(0,s));
    while(!que.empty()){
        //greater<i_i>なのでfirstが小さい順に取り出せる！
        i_d p=que.top();que.pop();
        int v=p.second;
        if(d[v]<p.first)continue;
        for(int i=0;i<G[v].size();i++){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(i_i(d[e.to],e.to));
            }
        }
    }
}
////////////////////////////////////////

double dis(double x1,double y1,double x2,double y2){
    return sqrt((double)pow(x1-x2,2)+double(pow(y1-y2,2)));
}
int main(){
    int xs,ys,xt,yt;cin>>xs>>ys>>xt>>yt;
    int n;cin>>n;
    V=n+2;
    ll point[n+2][3];
    rep(i,1,n){
        rep(j,0,2){
            cin>>point[i][j];
        }
    }
    point[0][0]=xs;point[0][1]=ys;point[0][2]=0;
    point[n+1][0]=xt;point[n+1][1]=yt;point[n+1][2]=0;
    rep(i,0,n+1){
        rep(j,i+1,n+1){
            double distance=dis(point[i][0],point[i][1],point[j][0],point[j][1]);
            distance-=point[i][2]+point[j][2];
            distance=max(distance,0.0);
            edge e;
            e.to=j;e.cost=distance;
            G[i].pb(e);
            e.to=i;
            G[j].pb(e);
        }
    }
    dijkstra(0);
  /*  rep(i,0,n+1){
        cout<<i<<" "<<d[i]<<endl;
    }*/
    printf("%10.10lf\n",d[n+1]);
    
    return 0;
}

Measured memory_bytes: 22548
def getComb(n, k, MOD):
    if n < k:
        return 0
    if n-k < k:
        k = n-k
    # n!/(n-k)!
    comb = 1
    for x in range(n-k+1, n+1):
        comb = (comb * x) % MOD
    # k!
    d = 1
    for x in range(1, k+1):
        d = (d * x) % MOD
    # n!/((n-k)!*k!)
    comb *= pow(d, MOD-2, MOD)
    return comb % MOD

r1,c1,r2,c2 = map(int,input().split())
MOD = 10**9 + 7
ans = 0

ans += getComb(r2+c2+2, r2+1, MOD)
ans -= getComb(r2+c1+1, r2+1, MOD)
ans -= getComb(r1+c2+1, r1, MOD)
ans += getComb(r1+c1, r1, MOD)

print(ans % MOD)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define ios; ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define ls(x) (x<<1)
#define rs(x) (ls(x)|1)
#define eps 1e-11
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef double db;
mt19937 rnd(random_device{}());
const int mod = 1e9 + 7;
const int N = 2e5 + 5;
const int M = 1e3 + 5;
inline ll gcd(ll a,ll b){ return b?gcd(b,a%b):a; }
inline ll lcm(ll a,ll b){ return a*b/gcd(a,b); }
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
int n, m, k;

int main(){
    ios;
    ll a;
    db b;
    cin>>a>>b;
    ll x=a*(int)b;
    ll y=(b-floor(b)+eps)*100;
    x += a*y/100;
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int ans = 0;
    for(int i = 1; i < n; i++)
    {
        if(a[i] == a[i-1])
        {
            ans++;
            i++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    long n = sc.nextLong();
    long k = sc.nextLong();
    
    long min = 0;
    
    if (n > k){
      long a = n%k;
      if (a > 0){
        min = Math.abs(a-k);
      }
    } else if (n < k){
      long a = k-n;
      if (n < a){
        min = n;
      } else {
        min = a;
      }
    }
    
    System.out.println(min);
  }
}

Measured memory_bytes: 23892
#include <iostream>
using namespace std;
int main()
{
    int x;
    cin >> x;
    int ans = 1;
    for (int b = 2; b < 35; b++)
    {
        int bp = b * b;
        while (bp <= x)
        {
            ans = max(ans, bp);
            bp *= b;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define rep(i,n) for (int i=0;i<(n);i++)

#define INF (1000000000)

int main(){
  vector<vector<ll>> G;

  int n,m;
  cin >> n >> m;

  G.resize(n,vector<ll>(n,INF));

  rep(i,n)G[i][i] = 0;

  rep(i,m) {
    ll a,b,c;

    cin >> a >> b >> c;
    a--;b--;

    G[a][b] = G[b][a] = c;
  }

  vector<vector<ll>> G2 = G;

  rep(k,n) {
    rep(i,n) {
      rep( j,n) {
        G2[i][j] =  min(G2[i][j],G2[i][k] + G2[k][j]);
      }
    }
  }

  ll ans = 0;

  rep(i,n) {
    for (int j=i+1;j<n;j++) {
      if (G[i][j] < INF && G[i][j] > G2[i][j])
        ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 384
var i:longint;
    a:array[0..100]of int64;
    x,ans,max:int64;
    k,c:longint;
begin
  for i:=1 to 3 do
  begin
    read(a[i]);
    if a[i]>max then
    begin
      max:=a[i];
      c:=i;
    end;
  end;
  read(k);
  x:=1;
  for i:=1 to k do
  x:=x*2;
  for i:=1 to 3 do
  if c<>i then inc(ans,a[i]);
  inc(ans,a[c]*x);
  writeln(ans);
end.


Measured memory_bytes: 128
H_1,M_1,H_2,M_2,K = map(int,input().split())
if H_2 < H_1:
    H_2 += 24
MaxH = abs(H_2 - H_1)
if M_1 >= M_2:
    MaxM = M_2 - M_1
if M_1 < M_2:
    MaxM = abs(M_1 - M_2)
useTime = MaxH*60 + MaxM
useTime -= K
print(useTime)

Measured memory_bytes: 9188
using System;

class Program
{
    static void Main(string[] args)
    {
        double r, circleArea, circumference;
        string num = Console.ReadLine();
        r = double.Parse(num);

        circleArea = r * r * 3.141592653589;
        circumference = r * 2 * 3.141592653589;

        Console.Write("{0:0.000000}", circleArea + " ");
        Console.WriteLine("{0:0.000000}", circumference);
    }
}


Measured memory_bytes: 9376
#include<stdio.h>
#include<math.h>
#include<string.h>

void sha(char *a, char *b, int k){
  int i;
  char w[101];
  for(i=0;i<101;i++)
    w[i]=0;
  for(i=0;i<k;i++){
    w[a[i]]++;
  }
  for(i=0;i<k;i++){
    b[i]=w[a[i]];
  }
}

int main(){
  int n;
  while(1){
    char s[13];
    char p[13];
    char q[13];
    scanf("%d", &n);
    char c;scanf("%c", &c);
    if(n!=0){
      int i;
      for(i=0;i<n;i++){
	scanf("%d", &s[i]);
      }
      char v;scanf("%c", &v);
    }
    else
      {break;}

    strcpy(p, s);
    int h=0;
    while(1){
      sha(p, q, n);
      //printf("\n");
      int flag=0;
      int u;
      for(u=0;u<n;u++){
	if(p[u]!=q[u])
	  flag=1;
      }
      if(flag==0){
	  printf("%d\n",h);
	  int d;
	  for(d=0;d<n-1;d++)
	    printf("%d ", p[d]);
	  printf("%d\n", p[n-1]);
	  break;}
      strcpy(p, q);
      //printf("%d\n", h);
      h++;
    }
  }
  
  //printf("%d\n",an);
  //int i;
  //for(i=0;i<n;i++){
  //  printf("%d ", ans[i]);
  //}
  //printf("\n");
  
  /*int t;
  for(t=0;t<n-1;t++){
    printf("%d ", p[t]);
  }
  printf("%d\n", p[n-1]);*/

  
  return 0;
}

Measured memory_bytes: 2600
import java.util.Scanner;

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

    char[] X = scanner.next().toCharArray();
    int res = X.length;
    int count = 0;
    for (char ch : X) {
      if (ch == 'S') count++;
      else if (count > 0) {
        res -= 2;
        count--;
      }
    }
    System.out.println(res);
  }
}


Measured memory_bytes: 27328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
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;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,d;cin>>n>>d;
    int ans = n/(2*d+1);
    if(n%(2*d+1) != 0)ans++;
    cout<<ans<<endl;
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int N;
    cin >> N;

    vector<tuple<string, int, int>> rest(N);
    for (int i = 0; i < N; i++) {
        string city; int score;
        cin >> city >> score;
        rest[i] = make_tuple(city, -score, i);
    }

    sort(all(rest));

    for (auto p : rest) {
        cout << get<2>(p) + 1 << "\n";
    }

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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++)


int main() {
  int n;
  cin >> n;
  vector<long>a(n),b(n);
  rep(i,n){
    cin>>a.at(i)>>b.at(i);
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  long ans;
  if(n%2==1){
    ans=b.at(n/2)-a.at(n/2)+1;
  }
  else{
    ans=(b.at(n/2-1)+b.at(n/2))-(a.at(n/2-1)+a.at(n/2))+1;
  }
  
    cout<<ans<<endl;
  
}


Measured memory_bytes: 6376
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
    int n;
    cin >> n;
    int ans=0;
    for (int i=1;i<=n;i+=2){
        int cnt=0;
        for (int j=1;j <= n;j++){
            if (i%j==0) cnt++;
        }
        if (cnt==8) ans++;
    }
    cout << ans << endl;
    return 0;  
}


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

typedef unsigned long long ULL;
typedef long long LL;

const int PI = 3.1415926535;
const int inf = 1000111222;
const int mod = 1000000007;
const int N = 100007;


int main() {
	
	ios_base :: sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	int d, t, s; cin >> d >> t >> s;
	int ans = d / s;
	int flag = 0;
	if (s * t >= d) {
		cout << "Yes\n";
	}
	else cout << "No\n";
	return 0;
}


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

using namespace std;
typedef long long ll;


int main()
{
    int n,m;
    cin >> n >> m;
    vector<pair<int,int>> arr[n];

    for(int i = 0 ; i < m ; i++){
        int p,y;
        cin >> p >> y;
        p--;
        arr[p].push_back(make_pair(y,i));
    }

    for(int i = 0 ; i < n ; i++)
        sort(arr[i].begin(), arr[i].end());


    ll ans[m];


    for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < arr[i].size() ; j++){
            ans[arr[i][j].second] = ll(i + 1)*1000000 + (j + 1);

        }
    }

    for(int i = 0 ; i < m ; i++){
        printf("%012lld\n",ans[i]);
    }


}


Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    int n,k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i,n)cin >> h[i];
    sort(all(h));
    ll sum=0;
    rep(i,n-k)sum+=h[i];
    cout << sum;


}

/*



 */



Measured memory_bytes: 1792
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define FOR(i, start, end) for(ll i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

int main(void) {
    int N;
    cin >> N;
    vector<int> C(N);
    vector<int> S(N);
    vector<int> F(N);

    FOR (i, 1, N) {
        cin >> C[i] >> S[i] >> F[i];
    }

    FOR (i, 1, N) {
        int t = 0;
        FOR (j, i, N) {
            t = max(t, S[j]);
            if (t % F[j] != 0) {
                t = (t / F[j] + 1) * F[j];
            }
            t += C[j];
        }
        cout << t << endl;
    }
    cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
from operator import itemgetter
n,m=map(int,input().split())
T=[list(map(int,input().split())) for i in range(m)]
for i in range(m):
  T[i].append(i)
T.sort(key=itemgetter(0,1))

cnt=1
ans=[[] for _ in range(m)]
for i in range(m-1):
  ans[T[i][2]]=str(T[i][0]).zfill(6)+str(cnt).zfill(6)
  if T[i][0]==T[i+1][0]:
    cnt+=1
  else:
    cnt=1
ans[T[m-1][2]]=str(T[m-1][0]).zfill(6)+str(cnt).zfill(6)
print(*ans,sep='\n')

Measured memory_bytes: 40716
#include <stdio.h>
int main(void){
    
   int n,i,num,min,max;
   long long int sum = 0;
   
   scanf("%d",&n);
   
   scanf("%d",&num);
   sum = num;
   max = num;
   min = num;
   
   for (i = 2;i <= n;i++){
       scanf("%d",&num);
       
       sum += num;
       
       if(num>max)
       max = num;
       
       if(num<min)
       min = num;
       
   }
   printf("%d %d %lld\n",min,max,sum);
   
   return 0;

   }
   


Measured memory_bytes: 2104
using System;

class Program{
  static void Main(){
    var cin=Console.ReadLine().Split(' ');
    var a=int.Parse(cin[0]);
    var b=int.Parse(cin[1]);
    var t=int.Parse(cin[2]);
    
    int result=t/a*b;
    
    Console.WriteLine(result);
    
    return;
  }
}


Measured memory_bytes: 13140
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// # Examples
//
// # integers
// input! { n: usize, m: usize, ... }
//
// # array
// input! { n: usize, v: [i32; n], }
//
// # matrix
// input! { n: usize, m: usize, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: usize,
//     w: usize,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: usize, b: usize, c: usize,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}
fn main() {
    input!{
        a: usize, b: usize
    }
    println!("{}", (a-1)*(b-1));
}

Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.swing.text.Segment;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			long ans = 0;
			for(int i = 0; i < N; i++){
				final int l = sc.nextInt();
				final int r = sc.nextInt();
				
				ans += (r - l + 1);
			}
			
			System.out.println(ans);
		}
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
		
		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 23636
x = int(input())
dp = [0]*(x + 105 + 1)
dp[100] = 1 
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1

for i in range(100,x-105+25):
    for j in range(100,106):
        dp[i+j] = max(dp[i] , dp[i+j])

print(dp[x])

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

using namespace std;

const long long INF = 1e18;
const int N = 1e5;
const int MOD = 1e9 + 7;

const double PI = acos(-1);


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    cout << (abs(d2 - d1) > 1 && m1 != m2);
}

Measured memory_bytes: 256
N = gets.to_i
arr = gets.split.map(&:to_i)
arrsrt = arr.sort
center = N / 2
a = arrsrt[center]
b = arrsrt[center - 1]
N.times do |i|
  if arrsrt.bsearch_index{|x|x >= arr[i]} < center
    puts a
  else
    puts b
  end
end

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll N,K, P[202020];

ll i,j,k;
int main(){
    scanf("%lld%lld", &N,&K);
    fornum(i,0,N){
        scanf("%lld", &P[i]);
    }
    double ans = 0;
    double a = 0;
    fornum(i, 0, K){
        a += (P[i] + 1.0) / 2.0 ;
    }
    ans = a;
    fornum(i,K,N){
        a -= P[i - K] * (P[i - K] + 1.0) / 2.0 / P[i - K];
        a += P[i] * (P[i] + 1.0) / 2.0 / P[i];
        ans = max(ans, a);
    }
    printf("%.12lf", ans);

    return 0;
}

Measured memory_bytes: 1920