akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void) {
    int n, l, a, b, i, j;
    
    scanf("%d%d",&n,&l);
    
    b=100000;
    for(i=1;i<=n;i++){
        a=l+i-1;
        if(a<0) a=a*(-1);
        if(a<b){
            b=a;
            j=i;
        }
    }
    a=0;
    for(i=1;i<=n;i++){
        if(j!=i){
            a+=l+i-1;
        }
    }
    printf("%d\n",a);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

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

int main() {
	ll w,h;
	ll x,y;
	cin >> w >> h >> x >> y;


	//if((x == 0 && y == 0) || (x == w && y == 0) || (x == w && y == h) || (x == 0 && y == h)) cout << w*h/2 << " ";
	//else if((x > 0 && x < w) && (y > 0 && y < h)) cout << w*h/2 << " ";
	//if ((x == w/2 || y == h/2) && (x == w/2 && y == h/2)) {}
	cout << setprecision(20) << double(w)*double(h)/2 << " ";
	//else cout << min({})
	int count=0;
	
	/*if(x != w/2 && y != h/2) {
		if((w/2)/abs(w/2-x)*abs(h/2-y) < h/2) count++;
		if((h/2)/abs(h/2-y)*abs(w/2-x) < w/2) count++;
		count=1;
	}*/
	if (x + x == w && y + y == h) count=2;
	else count=1;
	/* if (x == w/2) {
		count=1;
	}
	else if (y == h/2) {
		count=1;
	}*/
	if(count == 2) cout << 1 << endl;
	else cout << 0 << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func reverseString(s string) string {
	t := make([]byte, len(s))
	for i, b := range []byte(s) {
		t[len(s)-1-i] = b
	}
	return string(t)
}

func main() {
	s := readString()
	t := readString()
	dp := make([][]int, len(s)+1)
	for i := 0; i <= len(s); i++ {
		dp[i] = make([]int, len(t)+1)
	}
	for i := 1; i <= len(s); i++ {
		for j := 1; j <= len(t); j++ {
			k := dp[i-1][j]
			if dp[i][j-1] > k {
				k = dp[i][j-1]
			}
			if s[i-1] == t[j-1] && dp[i-1][j-1]+1 > k {
				k = dp[i-1][j-1] + 1
			}
			dp[i][j] = k
		}
	}
	u := make([]byte, 0, 4096)
	i := len(s)
	j := len(t)
	for i > 0 && j > 0 {
		if dp[i-1][j] == dp[i][j] {
			i--
		} else if dp[i][j-1] == dp[i][j] {
			j--
		} else {
			u = append(u, s[i-1])
			i--
			j--
		}
	}
	fmt.Println(reverseString(string(u)))
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}


Measured memory_bytes: 75392
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

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; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9 + 5;
constexpr long long INFLL = 1LL << 62;
constexpr double eps = (1e-9);

using P = pair<int, int>;

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

  int n, l;
  cin >> n >> l;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int t = -1;
  for (int i = 1; i < n; i++) {
    if (a[i-1] + a[i] >= l) {
      t = i;
      break;
    }
  }

  if (t == -1) {
    cout << "Impossible" << endl;
    return 0;
  }

  cout << "Possible" << endl;

  // t が最後に切断される
  for (int i = 1; i < t; i++) {
    cout << i << endl;
  }
  for (int i = n-1; i > t; i--) {
    cout << i << endl;
  }

  cout << t << endl;

  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
const int INF = 100000;
void chmin(int &a, int b) { if (a > b) a = b; }

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

// 再帰
int rec(int i, int a, int b, int c) {
    if (i == N) {
        if (!a || !b || !c) return INF; // A, B, C いずれも竹は 1 本は必ず使ってないとダメ
        return abs(a - A) + abs(b - B) + abs(c - C); // 合体してできた a, b, c を A, B, C にするコスト
    }

    // 今ある竹を採用しない場合
    int res = rec(i+1, a, b, c);
    
    // A, B, C を使う場合。
    // (a ? 10 : 0) とかは、最初の 1 本目は合体コストなし、2 本目からはコスト 10 かかることを意味する
    chmin(res, rec(i+1, a + L[i], b, c) + (a ? 10 : 0));
    chmin(res, rec(i+1, a, b + L[i], c) + (b ? 10 : 0));
    chmin(res, rec(i+1, a, b, c + L[i]) + (c ? 10 : 0));
    
    return res;
}

int main() {
    // 入力
    cin >> N >> A >> B >> C;
    L.resize(N);
    for (int i = 0; i< N; ++i) cin >> L[i];
    
    // 再帰する
    cout << rec(0, 0, 0, 0) << endl;
}

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

int main()
{
   int count=0;
   string S;
   cin >> S;
   for(int i=0;i<(S.size())/2;i++){
      if(S.at(i)!=S.at((S.size())-1-i)){
         count++;
      }
   }
   cout << count << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;

inline int getint()
{
	static char c;
	while ((c = getchar()) < '0' || c > '9');

	int res = c - '0';
	while ((c = getchar()) >= '0' && c <= '9')
		res = res * 10 + c - '0';
	return res;
}

const int MaxN = 200000;
const int MaxM = 200000;

int n, m;
vector<int> pos[MaxM + 1];

priority_queue<int, vector<int>, greater<int>> q;

int res = 0;
int num[MaxM + 2];

int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; ++i)
	{
		int l = getint(), r = getint();
		pos[l].push_back(r);
	}

	for (int k : pos[0])
		++num[k];
	for (int i = 1; i <= m; ++i)
	{
		for (int k : pos[i])
		{
			q.push(k);
			if (q.size() > i)
				++num[q.top()], q.pop();
		}
	}

	int r = m + 1;
	for (int i = m; i; --i)
		for (int k = 0; k < num[i]; ++k)
			r - 1 > q.size() && r > i ? --r : ++res;

	cout << res + num[m + 1] << endl;

	return 0;
}

Measured memory_bytes: 10108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A___Christmas_Eve_Eve_Eve
{
	class Program
	{
		static void Main(string[] args)
		{
			int D;
			D = int.Parse(Console.ReadLine());
			if (D == 25)
				Console.WriteLine("Christmas");
			else if (D == 24)
				Console.WriteLine("Christmas Eve");
			else if (D == 23)
				Console.WriteLine("Christmas Eve Eve");
			else Console.WriteLine("Christmas Eve Eve Eve");
			Console.ReadKey();
		}
	}
}

Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <stack>

using namespace std;

int main(void){
	string s;
	while(getline(cin,s),s!="."){
		stack<char> r;
		bool ok=true;
		for(int i=0;i<s.size();i++){
			if(!ok)
				break;
			if(s[i]=='('||s[i]=='[')
				r.push(s[i]);
			if(s[i]==')'){
				if(!r.empty()&&r.top()=='(')
					r.pop();
				else
					ok=false;
			}
			if(s[i]==']'){
				if(!r.empty()&&r.top()=='[')
					r.pop();
				else
					ok=false;
			}
			
		}
		if(!r.empty())
			ok=false;
		if(ok)
			cout <<"yes" << endl;
		else 
			cout << "no" << endl;
	}
	return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>


using namespace std;

int main()
{

	string str;

	cin >> str;
	string ans;
	if (str == "Sunny") {

		ans = "Cloudy";


	}
	else if (str == "Cloudy") {

		ans = "Rainy";


	}
	else {

		ans = "Sunny";


	}


	cout << ans << endl;






	return 0;
}



Measured memory_bytes: 256
from itertools import product
from collections import defaultdict
inpl = lambda: list(map(int,input().split()))
N = int(input())
X = defaultdict(int)
for _ in range(N):
    S = input()
    if '.' in S:
        S = S.rstrip('0')
        S = S.rstrip('.')
    if '.' in S:
        T, U = S.split('.')
        m = len(U)
        p = q = -m
        a = int(T+U)
    else:
        p = q = 0
        a = int(S)
    while a % 2 == 0 and p < 9:
        p += 1
        a //= 2
    while a % 5 == 0 and q < 9:
        q += 1
        a //= 5
    X[(p,q)] += 1

ans = 0
for p in range(-9,10):
    for q in range(-9,10):
        for s in range(-9,10):
            for t in range(-9,10):
                if p == s and q == t:
                    if p >= 0 and q >= 0:
                        ans += X[(p,q)] * (X[(p,q)]-1)
                elif p + s >= 0 and q + t >= 0:
                    ans += X[(p,q)] * X[(s,t)]

print(ans//2)


Measured memory_bytes: 73948
n,m = map(int,input().split())
a = []
b = []
c = 0

for i in range(n):
    a.append([int(s) for s in input().split()])

for i in range(m):
    b.append(int(input()))

for i in range(n):
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)
    c = 0



Measured memory_bytes: 6008
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N, K, R, S, P;
    string T;
    int ans = 0;
    cin >> N >> K >> R >> S >> P >> T;
    for (int i = 0; i < K; i++) {
        vector<char> data;
        for (int j = i; j < N; j += K) {
            data.push_back(T[j]);
        }
        int count = 1;
        int n = data.size();
        for (int j = 1; j < n; j++) {
            if (data[j - 1] == data[j]) {
                count++;
            }
            else {
                int a = floor((count + 1) / 2);
                if (data[j - 1] == 'r') {
                    ans += a * P;
                }
                else if (data[j - 1] == 's') {
                    ans += a * R;
                }
                else {
                    ans += a * S;
                }
                count = 1;
            }
        }
        int a = floor((count + 1) / 2);
        if (data[n - 1] == 'r') {
            ans += a * P;
        }
        else if (data[n - 1] == 's') {
            ans += a * R;
        }
        else {
            ans += a * S;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3756
import sys
input = sys.stdin.readline
def print_ans(L, R):
    """Test Case
    >>> print_ans(2020, 2040)
    2
    >>> print_ans(4, 5)
    20
    """
    tmp = R - L
    if tmp > 2019:
        print("0")
    else:
        L = L % 2019
        R = L + tmp
        ans = 2019
        flg = False
        for i in range(L, R):
            for k in range(i + 1, R + 1):
                ans = min(ans, (i * k) % 2019)
                if ans == 0:
                    flg = True
                    break
            if flg :
                break
        print(ans)



if __name__ == '__main__':
    L, R = map(int, input().rstrip().split())
    print_ans(L, R)


Measured memory_bytes: 3064
def examA():
    N = I()
    ans = (N-1)//2
    print(ans)
    return

def examB():
    N = I()
    D = LI()
    d = Counter(D)
    loop = max(d.keys())
    if D[0]!=0 or d[0]!=1:
        print(0)
        return
#    print(d,loop)
    ans = 1; cur = 1
    for i in range(loop+1):
        if d[i]==0:
            print(0)
            return
        for _ in range(d[i]):
            ans *= cur
            ans %= mod2
        cur = d[i]
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    class Dijkstra(object):
        """
        construct: O(ElogV)
        """

        def __init__(self, edges, start=0):
            """
            :param list of list of list of int edges:
            :param int start=0:
            """
            self.__dist = [inf] * len(edges)
            self.__dist[start] = 0
            self.__calculate(edges, start)

        @property
        def dist(self):
            return self.__dist

        def __calculate(self, edges, start):
            Q = [(0, start)]  # (dist,vertex)
            while (Q):
                dist, v = heapq.heappop(Q)
                if self.dist[v] < dist: continue  # 候補として挙がったd,vだが、他に短いのがある
                for u, cost in edges[v]:
                    if self.dist[u] > self.dist[v] + cost:
                        self.__dist[u] = self.dist[v] + cost
                        heapq.heappush(Q, (self.dist[u], u))
    N, M = LI()
    V = [[]for _ in range(N)]
    for _ in range(M):
        l, r, c = LI()
        l -=1; r -=1
        V[l].append((r,c))
    for i in range(N-1):
        V[i+1].append((i,0))
#    print(V)
    D = Dijkstra(V)
    ans = D.dist[N-1]
    if ans==inf:
        ans = -1
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LFI(): return list(map(float,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examD()

"""

"""

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

const int N=1e5+5;
char s[N]; 
int ans[N];

int main()
{
	scanf("%s",s+1);	
	int n=strlen(s+1);
	int j=0;
	for(int i=1;i<=n;++i)
	{
		if(s[i]=='R')j=i;
		else ++ans[j+(i-j)%2];
	}
	for(int i=n;i;--i)
	{
		if(s[i]=='L')j=i;
		else ++ans[j-(j-i)%2];
	}
	for(int i=1;i<=n;++i)printf("%d ",ans[i]);
}

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

namespace AtCoder.ABC043
{
    class ProblemA
    {
        static void Main()
        {
            var a = ReadInt();
            Console.WriteLine(Enumerable.Range(1, a).Sum());
        }

        public static string ReadLine() => Console.ReadLine();

        public static int ReadInt() => int.Parse(ReadLine());

        public static int[] ReadIntArray() => ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
    }
}


Measured memory_bytes: 11220
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/16/20 07:31:34
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;


vector<int> graph[(int)2e5];
vector<int> cnt((int)2e5);
void dfs(int s, int p, int c) {
  c+= cnt[s];
  cnt[s] = c;
  for (auto t:graph[s]) {
    if (t==p) continue;
    dfs(t, s, c);
  }
}

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

  int n,q; cin>>n>>q;
  for (int i = 0; i < n-1; i++) {
    int a,b; cin>>a>>b; a--; b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (int i = 0; i < q; i++) {
    int p,x; cin>>p>>x; p--;
    cnt[p] += x;
  }
  dfs(0, -1, 0);
  for (int i = 0; i < n; i++)
    cout << cnt[i] << " ";
  cout << endl;

  return 0;
}


Measured memory_bytes: 23552
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


class Main {

    static int n;
    static int[] F;
	public static void main(String args[]) throws IOException{

		BufferedReader br =  new BufferedReader (new InputStreamReader (System.in) );
		 n = Integer.parseInt(br.readLine() );
        F = new int[n+1];
        Arrays.fill(F, -1 );

        System.out.println( makeFibonacci( ) );


	}


	public static int Fibonacci(int x){

		int ans;

		if(x == 0 ||x == 1 ){
		return	F[x] = 1;
		}

		else{

			ans = Fibonacci( x - 1) + Fibonacci( x - 2);
		}
		return ans;

	}


	public static int makeFibonacci(){

		F[0] = 1;
		F[1] = 1;
		for( int i = 2;i < n+1 ; i++ ){
			 F[i] = F[i-2] + F[i-1];
		}

		return F[n];
	}

}

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

const int INF = 1<<20;
const int MAX_V = 10;
const int MAX_E = 45;

int d[MAX_V][MAX_V];
int n;
int V;

void show_d() {
    cout << "===" << endl;
    for(int i = 0; i < V; i++) {
        for(int j = 0; j < V; j++) {
            printf("%3d ", d[i][j]);
        }
        cout << endl;
    }
}

void warshall_floyd() {
    for(int k = 0; k < V; k++) {
        for(int i = 0; i < V; i++) {
            for(int j = 0; j < V; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
        // show_d(); // debug
    }
}

int main() {
    while(true) {
        cin >> n;
        if(!n) break;
        int f, t, c;
        V = 0;
        for(int i = 0; i < MAX_V; i++) {
            for(int j = 0; j < MAX_V; j++) {
                d[i][j] = INF;
                if(i == j) d[i][j] = 0;
            }
        }
        for(int i = 0; i < n; i++) {
            cin >> f >> t >> c;
            d[f][t] = c;
            d[t][f] = c;
            V = max(V, f+1);
            V = max(V, t+1);
        }

        warshall_floyd();

        int ix = 0, s = INF;
        for(int i = 0; i < V; i++) {
            int tmp = 0;
            for(int j = 0; j < V; j++) {
                tmp += d[i][j];
            }
            if(tmp < s) {
                ix = i;
                s = tmp;
            }
        }

        cout << ix << " " << s << endl;

    }
    return 0;
}

Measured memory_bytes: 1160
dp = [[0] * 1001 for i in range(11)]
dp[0][0] = 1
for i in range(101):
    for j in range(9, -1, -1):
        for k in range(0, 1001 - i):
            dp[j + 1][k + i] += dp[j][k]
 
while True:
    n, s = map(int, raw_input().split())
    if (n,s) == (0,0):
        break
    print dp[n][s]

Measured memory_bytes: 4424
from math import factorial, ceil
n = int(input())
d = {}
for i in range(n):
    s = input()
    ns = ''.join(sorted(s))
    if ns not in d.keys():
        d[ns] = 1
    else:
        d[ns] += 1
ans = 0
for i, v in d.items():
    if v != 1:
        ans += factorial(v) /(factorial(v-2)*2)
print(int(ans))

Measured memory_bytes: 17888
module ABC087B
	sub Main(ByVal args() as String)
		dim a,b,c,x,i,j,k,r as integer
		a=Console.ReadLine()
		b=Console.ReadLine()
		c=Console.ReadLine()
		x=Console.ReadLine()
		for i=0 to x\500
			for j=0 to (x-500*i)\100
				k=x-500*i-100*j
				if k mod 50=0 andalso c>=k\50 andalso a>=i andalso b>=j
					r+=1
				end if
			next
		next
		Console.WriteLine(r)
	end sub
end module


Measured memory_bytes: 13140
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner scanner = new Scanner(System.in);
    int n,k;
    n = scanner.nextInt();
    k = scanner.nextInt();
    
    ArrayList<Integer> p = new ArrayList<Integer>();
    
    int x;
    for(int i = 0;i < n ; i++) { 
      x = scanner.nextInt();
      p.add(x);
    }
    
    Collections.sort(p);
    
    int ans = 0;
    for(int i = 0; i < k;i++) { 
      ans+=p.get(i);
    }
    
    System.out.println(ans);
}
}

Measured memory_bytes: 39044
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	var a int
	nums := make(map[int]int)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &a)
		nums[a]++
	}

	k := len(nums)

	if (n-k)%2 == 0 {
		fmt.Println(k)
	} else {
		fmt.Println(k - 1)
	}
}

// func main() {
// 	r := bufio.NewReader(os.Stdin)
// 	var n int
// 	fmt.Fscan(r, &n)
// 	var a int
// 	nums := make(map[int]int)
// 	for i := 0; i < n; i++ {
// 		fmt.Fscan(r, &a)
// 		nums[a]++
// 	}

// 	// priority_queue
// 	ih := &intHeap{}
// 	heap.Init(ih)
// 	for _, v := range nums {
// 		if v >= 2 {
// 			heap.Push(ih, v)
// 		}
// 	}

// 	ans := n
// 	for ih.Len() > 0 {
// 		v1 := heap.Pop(ih)

// 		var v2 interface{}
// 		if ih.Len() > 0 {
// 			v2 = heap.Pop(ih)
// 		}

// 		if v1.(int) > 2 {
// 			heap.Push(ih, v1.(int)-1)
// 		}
// 		if v2 != nil && v2.(int) > 2 {
// 			heap.Push(ih, v2.(int)-1)
// 		}

// 		ans -= 2
// 	}

// 	if ans <= 1 {
// 		fmt.Println(1)
// 	} else {
// 		fmt.Println(ans)
// 	}
// }

type intHeap []int

func (h intHeap) Len() int           { return len(h) }
func (h intHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h intHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }
func (h *intHeap) Push(x interface{}) {
	*h = append(*h, x.(int))
}
func (h *intHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 6784
#include <iostream>
using namespace std;
int k,a,b;
int main(void)
{
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
    return 0;
}

Measured memory_bytes: 3092
/*     *******************Bismillahir Rahmanir Rahim************************
                          MD. ASFAKUL GHANI!
                          *ProMAGFAT*!
 SECRET_warning :)->FAT   CSE-25!
                          JAHANGIRNAGAR UNIVERSITY!
                          Dhaka,Bangladesh!
*/

#include <bits/stdc++.h>
#include <set>
using namespace std;

#define           fasterIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define           Im int main()
#define           ll long long
#define           sc scanf
#define           pf printf
#define           rn0 return 0
#define           rn return
#define           f0(i,n) for(ll i=0;i<n;i++)
#define           f1(i,n) for(ll i=1;i<=n;i++)
#define           f2(i,n) for(ll i=n-1;i>=0;i--)
#define           pi 2*acos(0.0)
#define           modulo 1000003
#define           dd double
#define           PI 3.14159265358979
#define           pi 2*acos(0.0)
#define           p_b push_back
#define           ps push

/*
ll for_binarySearch(ll a,ll b,ll aa[],ll x){while(a<=b){ll mid=(a+b)/2;if(aa[mid]==x) return 1;else if(aa[mid] > x) b=mid-1;else a=mid+1;}return -1;}
ll for_gcd(ll a,ll b){if(a==0) return b;else return for_gcd(b%a,a);}
ll for_prime(ll x){for (ll i=2;i*i<=x;i++){if(x%i==0) return 0;}return 1;}
void for_swap(char *x,char *y){char temp;temp=*x;*x=*y;*y=temp;}
ll for_big_mod(ll b,ll p,ll m){if(p==0) return 1;else if(p%2==0){ll k=for_big_mod(b,p/2,m);return (k*k)%m;}else return ((b%m)*(for_big_mod(b,p-1,m)))%m;}
ll for_josephus(ll n,ll k){if(n==1) return 1;return (for_josephus(n-1,k)+k-1)%n+1;}
ll for_gcdExtended(ll a,ll b,ll *x,ll *y){if(a==0){*x=0;*y=1;return b;}ll x1,y1;ll gcd=for_gcdExtended(b%a,a,&x1,&y1);*x=y1-(b/a)*x1;*y=x1;return gcd;}
*/
/*
void debug1()
{
    cout << "***" << endl;
}

void debug11(ll n)
{
    cout << n << endl;
}
*/

Im
{
    /*#ifdef FAT
       freopen("input.txt","w",stdin);
    #endif // FAT*/

    fasterIO;

    ll m,n;
    cin>>m>>n;
    if (m == n) cout << "a == b" << endl;
    else if (m>n) cout << "a > b" << endl;
    else cout << "a < b" << endl;

   // main();

    rn0;
}

Measured memory_bytes: 3220
a = list(list(map(int,input().split())) for _ in range(3))
n = int(input())
b = list(int(input()) for _ in range(n))

for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            a[i][j] = 0

for i in range(3):
    if a[i][0] == a[i][1] == a[i][2] or a[0][i] == a[1][i] == a[2][i] or a[0][0] == a[1][1] == a[2][2] or a[2][0] == a[1][1] == a[0][2]:
        print("Yes")
        break
else:
     print("No")

Measured memory_bytes: 9220
import Control.Applicative

solve xs [] = xs
solve xs ('0':s) = solve (xs ++ "0") s
solve xs ('1':s) = solve (xs ++ "1") s
solve xs ('B':s)
	| xs /= "" = solve (init xs) s
	| otherwise = solve xs s

main :: IO()
main = do
	s <- getLine
	putStrLn $ solve "" s

Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 100005
 
 
#define PI 3.14159265358979323846264338327950
 
#define ll   long long int
ll mod = 1000000007;
ll a[MAXX], b[MAXX];
char str[MAXX];
 
int main()
{
	FAST;
	ll n, k, ans = 0;
	cin >> n;
	for(ll i = 1; i<= n; i++){
		cin >> k;
		ans += k;
		a[k] ++;
	}
	ll t;
	cin >> t;
	while(t --){
		ll b , c;
		cin >> b >> c;
		ans -= a[b] *b;
		ans += a[b] *c;
		a[c] += a[b];
		a[b] = 0;
		cout << ans << endl;;
	}
	
	
}

Measured memory_bytes: 4376
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<long> lucas(90);
  lucas[0]=2;
  lucas[1]=1;
  for(int i=2;i<89;i++){
    lucas[i]=lucas[i-1]+lucas[i-2];
  }
  cout<<lucas[n];
}


Measured memory_bytes: 256
def main():
  import math
  N = int(input())
  xyz = list(map(int, input().split()))
  S = sum(xyz)
  K = math.ceil(math.log(S, 2))
  T = 1
  table = [0] * (N+1)
  for i in range(N+1):
    if S < T:
      table[i] = S
    else:
      table[i] = T
    S -= xyz[i]
    T = (T - xyz[i]) * 2
  if T < 0:
    print(-1)
  else:
    print(sum(table))
main()

Measured memory_bytes: 671036
#include<stdio.h>
int main(){
	int n,m,i;
	long long sum=0;
	scanf("%d",&n);
	for(i=0;i<n&&scanf("%d",&m);i++){
		sum+=(long long)m;
	}
	printf("%d\n",(int)(sum/(long long)n));
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include <algorithm>
using namespace std;
#define ll long long
//macros
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
int mod = 1e9+7;
// If wrong answer use LONG LONG instead on int
/////////////////////////////////////////////////////////////SEGMENT  TREES////////////////////////////////////////////////
// const int N = 100000;  
// int n;
// int tree[2 * N]; 

// void build( int arr[])  
// {   
//     for (int i=0; i<n; i++) // insert leaf nodes in tree     
//         tree[n+i] = arr[i]; 
       
//     for (int i = n - 1; i > 0; --i) // build the tree by calculating parents add function here      
//         tree[i] = tree[i<<1] + tree[i<<1 | 1];     
// } 

// void updateTreeNode(int p, int value)  
// {   
//     tree[p+n] = value; 
//     p = p+n;

//     for (int i=p; i > 1; i >>= 1) 
//         tree[i>>1] = tree[i] + tree[i^1]; 
// } 
  
// // function to get sum on interval [l, r) 
// int query(int l, int r)  
// {  
//     int res = 0; 
      
//     // loop to find the sum in the range 
//     for (l += n, r += n; l < r; l >>= 1, r >>= 1) 
//     { 
//         if (l&1)  
//             res += tree[l++]; 
      
//         if (r&1)  
//             res += tree[--r]; 
//     } 
      
//     return res; 
// }

/////////////////////////////////////////////////////**********************/////////////////////////////////////////////////

// int gcd(int a,int b){
// 	if(b == 0){
// 		return a;
// 	}
// 	return gcd(b,a%b);
// }
int a[100005][4];
int dp[100005][4];
int n;

int dfs(int day,int flag){
	if(day == n){
		return 0;
	}
	if(dp[day][flag] != -1){
		return dp[day][flag];
	}
	int maxi = 0;
	if(flag == 0){
		maxi = max(maxi,a[day][1] + dfs(day+1,1));
		maxi = max(maxi,a[day][2] +dfs(day+1,2));
		maxi = max(maxi,a[day][3] +dfs(day+1,3));
	}
	else if(flag == 1){
		maxi = max(maxi,a[day][2] +dfs(day+1,2));
		maxi = max(maxi,a[day][3] +dfs(day+1,3));
	}
	else if(flag == 2){
		maxi = max(maxi,a[day][1] +dfs(day+1,1));
		maxi = max(maxi,a[day][3] +dfs(day+1,3));
	}
	else{
		maxi = max(maxi,a[day][1] +dfs(day+1,1));
		maxi = max(maxi,a[day][2] +dfs(day+1,2));
	}
	dp[day][flag] = maxi;
	return maxi;
}

void solution(){
	cin >> n;
	for(int i=0;i<n;i++){
		for(int j =1;j<=3;j++){
			cin >> a[i][j];
		}
	}
	memset(dp,-1,sizeof(dp));
	int ans = dfs(0,0);
	cout << ans << endl;
	return;
}
 
 
// void solution(){ //read a whole line from the input, possibly containing spaces
// 	string s;
// 	getline(cin,s);
// }
int main(){
	
    fio; // fast input output
    int t;
    t = 1;
    // cin >> t;
    while(t--){
    	// cout << "Case #" << t  << ": ";
        solution();
    }
    return 0;
};

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

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m));
  for (int i = 0; i < n; i++){
    cin >> c.at(i);
    for (int j = 0; j < m; j++){
      cin >> a.at(i).at(j);
    }
  }
  int ans = 0;
  
  for (int b = 0; b < (1 << n); b++){
    bitset<12> s(b);
    
    int y = 0;
    vector<int> t(m, 0);
    
    for (int i = 0; i < n; i++){
      if(s.test(i)){
        y += c.at(i);
        for (int j = 0; j < m; j++){
          t.at(j) += a.at(i).at(j);
        }
      }
    }
    bool skill = true;
    for (int j = 0; j < m; j++){
      if (t.at(j) < x){
        skill = false;
        break;
      }
    }
    if (skill){
      if (ans == 0){
        ans = y;
      }
      else{
        ans = min(ans, y);
      }
    }
  }
  
  if (ans == 0){
    cout << -1 << endl;
  }
  else{
    cout << ans << endl;
  }
}

Measured memory_bytes: 3600
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  int R, G, B, N; cin >> R >> G >> B >> N;
  int ans = 0;
  for (int r = 0; R*r <= N; r++) {
    for (int g = 0; R*r + G*g <= N; g++) {
      if ((N - R*r - G*g) % B == 0) {
        // debug3(r, g, (N - R*r - G*g) / B);
        ans++;
      }
    }
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


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

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

    string s;
    cin >> s;
    if (s.length() == 3) reverse(s.begin(), s.end());

    cout << s  << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
static ll p = 1000000007;

int main(){
  str l;
  cin >> l;
  reverse(l.begin(),l.end());
  ll n = l.length()+1;
  for(int i = 0;;i++){
    if(i==n){
      l = l + '1';
      break;
    }
    if(l[i]=='0'){
      l[i] = '1';
      break;
    }else{
      l[i] = '0';
    }
  }
  reverse(l.begin(),l.end());
  //cout << l << endl;

  ll pow2[n], pow3[n];
  pow2[0] = 1, pow3[0] = 1;
  for(int i = 1; i < n; i++){
    pow2[i] = pow2[i-1]*2%p;
    pow3[i] = pow3[i-1]*3%p;
  }

  ll ans = 0;
  int cnt1 = 0;
  int t = l.length();
  REP(i,t){
    if(l[i]=='0') continue;
    ans += pow2[cnt1]*pow3[t-i-1]%p;
    ans %= p;
    cnt1++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2076
#include<cstdio>
#include<algorithm>
#define N_ 501000
using namespace std;
long long n, K, Mod = 998244353;
long long F[N_], InvF[N_], Res;
long long Pow(long long a, long long b) {
	long long r = 1;
	while (b) {
		if (b & 1)r = r*a%Mod;
		a = a*a%Mod; b >>= 1;
	}
	return r;
}
long long Comb(int a, int b) {
	if (a < b || b<0)return 0;
	return F[a] * InvF[b] % Mod*InvF[a - b] % Mod;
}
long long Calc(int R, int B, int c) {
	int i;
	if (B < c || R < c)return 0;
	return (Comb(R + B, R) - Comb(R + B, c - 1) + Mod)%Mod;
}
int main() {
	int i;
	scanf("%lld%lld", &K, &n);
	F[0] = 1;
	for (i = 1; i <= n + 1; i++)F[i] = F[i - 1] * i%Mod;
	InvF[n] = Pow(F[n], Mod - 2);
	for (i = n; i >= 1; i--)InvF[i - 1] = InvF[i] * i%Mod;
	for (i = n % 2; i <= n; i+=2) {
		int CR = (n + i) / 2, CB = (n - i) / 2;
		if (i >= K) {
			Res = (Res + Comb(n, CR)) % Mod;
			continue;
		}
		if (i) {
			Res = (Res + Calc(CR, CB, K - i)) % Mod;
		}
		else {
			Res = (Res + Calc(CR, CB - 1, K - 1)) % Mod;
		}
	}
	printf("%lld\n", Res);
}

Measured memory_bytes: 7936
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
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--)

char s[200][200];

int main(){
    int h,w;
    scanf("%d%d",&h,&w);
    for(int i = 0;i < h;i++){
        scanf("%s",&s[i][0]);
    }

    for(int i = 0;i < w + 2;i++){
        printf("#");
    }
    printf("\n");
    for(int i = 0;i < h;i++){
        printf("#%s#\n",&s[i][0]);
    }
    for(int i = 0;i < w + 2;i++){
        printf("#");
    }
    printf("\n");
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int N = 5;
	vector<int> Time = { a,b,c,d,e };
	vector<int> nextTime(N);
	for (int i = 0; i < N; i++) {
		if (Time[i] % 10 == 0) {nextTime[i] = Time[i];}
		else {nextTime[i] = Time[i] - Time[i] % 10 + 10;}
	}
	int BestTime = 999999999;
	for (int i = 0; i < N;i++) {
		int SumeTime = 0;
		for (int j = 0; j < N; j++) {
			if (i==j) {SumeTime += Time[j];}
			else {SumeTime += nextTime[j];}
		}
		BestTime = min(BestTime, SumeTime);
	}
	cout << BestTime << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using P = pair<int, int>;
double pi = 2.0 * asin(1.0);    /* πの値. */

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

    double s = a*a*b/2;    /* 三角柱での最大体積. */
    int d=1;        /* 1:sankaku. */
    if(x > s) d=0;  /* 0:daikei. */

    double radian;
    double degree;
    /* sankaku. */

    if (d == 1) {
        //cout << "sankaku" << endl;
        /* 体積x = a * ac * b / 2. */
        double ac = x*2 / (b*a);
        radian = atan2(ac, b);
        degree = 90.0 - (radian * 180.0 / pi);
    } else {
        //cout << "daikei" << endl;
        /* 体積x = ((bc+b)*a / 2) * a. */
        double bc = (2*x)/(a*a) - b;
        /* 台形じゃない側の三角形は、縦(b-bc), 横(a). */
        radian = atan2(a, b-bc);
        degree = 90 - (radian * 180.0 / pi);
    }

    cout << fixed << setprecision(10) << degree << endl;

	return 0;
}


Measured memory_bytes: 4104
#include <stdio.h>

int main(void){
    int n;
    scanf("%d", &n);
    n %= 10;
    if(n==3){
        printf("bon");
    }else if(n==0||n==1||n==6||n==8){
        printf("pon");
    }else{
        printf("hon");
    }
    return 0;
}

Measured memory_bytes: 1720
#include <bits/stdc++.h>
using namespace std;
int check(char s,int K,int D[]){
	for(int i=0;i<K;i++){
		char temp[2];
		temp[0] = D[i]+'0';
		if(s==temp[0]){
			return 0;
		}
	}
	return 1;
}
int main(void){
	int N,K;
	cin >> N >> K;
	int D[K];
	for(int i=0;i<K;i++)cin >> D[i];
	int ans = 0;
	for(int i=N;i<=999999;i++){
		//条件を満たしたら終了
		string tmp = to_string(i);
		int flag  =1;
		for(int j=0;j<tmp.size();j++){
			if(check(tmp[j],K,D)==0){
				flag=0;
			}
		}
		if(flag == 1){
			cout << i;
			return 0;
		}
	}
}

Measured memory_bytes: 256
// By Debajit Chakraborty
#include<bits/stdc++.h>
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MP make_pair
#define pb push_back
#define ff first
#define ss second
#define sz(x) x.size()
#define all(c) c.begin(),c.end()
#define int long long
#define fr(i,j,x) for(int i=j;i<x;i++)
#define rep(i,j,x) for(int i=j;i<=x;i++)
#define rev(i,j,x) for(int i=j;i>=x;i--)
#define mem(x,val) memset(x,val,sizeof(x))
#define endl '\n'
#define vi vector<int>
#define pii pair<int,int>
 
const int mod=1e9+7;
const int N=2e5+10;
const int INF=1e12;



void solve(){
    int n,d;
    cin>>n>>d;
    int x,y,cnt=0;
    rep(i,1,n){
        cin>>x>>y;
        if(x*x+y*y<=d*d){
            cnt++;
        }
    }
    cout<<cnt<<endl;
}


int32_t main()
{
    
    SPEED;
    int T=1;
    //cin>>T;
    int t1=1;
    while(true)
    {  
        //cout<<"Case #"<<t1<<": ";
        //cout<<endl;
        solve();
        t1++;
        if(t1>T)
            break;
    }
}   


Measured memory_bytes: 3692
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int W =sc.nextInt();
        int H =sc.nextInt();
        int x =sc.nextInt();
        int y =sc.nextInt();
        int r =sc.nextInt();
        
        if(x+r>W || y+r>H ||x+r<0 || y+r<0){
            System.out.println("No");
        }else if(x-r>W || y-r>H ||x-r<0 || y-r<0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}
    


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

int main() {
    string s;
    cin >> s;
    int cnt=0;
    int w = 0, l = 0;
    for(int i=0; i<s.size(); ++i) {
        if(cnt == 0) {
            cnt++;
            if(s[i] == 'p') {
                l++;
            }
        } else {
            cnt--;
            if(s[i] == 'g') {
                w++;
            }
        }
    }
    cout << w - l << endl;
}


Measured memory_bytes: 512
//created by pyoxiao on 2020/05/10
#include<bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define CL(a, b) memset(a, b, sizeof(a))
using namespace std;
const int mod = 998244353, p = mod;
LL fpow(LL a, LL b, LL p = mod){LL ans = 1; a %= p; while(b) {if(b & 1) ans = ans * a % p; b >>= 1; a = a * a % p;} return ans;}
LL inv(LL x) {
    return fpow(x, mod - 2, mod);
}
LL gcd(LL a, LL b){return b == 0 ? a : gcd(b, a % b);}
const int N = 2e5 + 7;
LL n, m, k, jc[N];
void init(int n)  //预处理 阶乘 及 逆元(p为质数) O(n)
{
    jc[0] = jc[1] = 1;
    for (int i = 2; i <= n; ++i) {
        jc[i] = (LL)jc[i - 1] * i % p;
    }
}
LL C(LL a, LL b)  //组合数（p为质数）
{
    if (b > a)
        return 0;
    return (LL)jc[a] * fpow(jc[b], p - 2, p) % p * fpow(jc[a - b], p - 2, p) % p;
}
void solve() {
    scanf("%d %d %d", &n, &m, &k);
    LL ans = 0;
    for(int i = 0; i <= min(k, n - 1); i ++) {
        LL cur = C(n - 1, i) * m % mod * fpow(m - 1, n - i - 1) % mod;
        (ans += cur) %= mod;
    }
    printf("%lld\n", (ans % mod + mod) % mod);
}
int main() {
    int T = 1;
    // scanf("%d", &T);
    init(N - 1);
    while(T --) 
        solve();
    return 0;
}

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

int main(void)
{
  int S,s,m,h;
   cin >> S;
   cin >> h;
   cin >> m;
   cin >> s;
  
  h=S/3600;
  m=(S%3600)/60;
  s=S-h*3600-m*60;
  
    cout << h;
    cout << ":";
    cout << m;
    cout << ":";
    cout << s;
    cout << endl;
}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
   int n;cin >> n;
  int org = n;
  int tmp = 0;
  while(n>0){
    tmp+= n%10;
    n /= 10;
  }
  string ans = "No";
  if(org%tmp == 0)ans = "Yes";
  cout << ans << endl;
}


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

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

    int n1 = N / 1000;
    int n2 = (N % 1000) / 100;
    int n3 = (N % 100) / 10;
    int n4 = N % 10;
    if (n2 == n3 && (n1 == n2 || n3 == n4)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const ll MOD = 1e9 + 7;

void solve(istream& cin, ostream& cout) {
  int n;
  cin >> n;
  vector<int> l(n);
  REP(i, n) {
    cin >> l[i];
  }
  SORT(l);
  vector<int> sum(3000, 0);
  ll ans = 0;
  FOR(i, 2, n - 1) {
    REP(j, i - 1) {
      sum[l[i - 1] + l[j]]++;
    }
    FOR(j, l[i] + 1, 2500) {
      ans += sum[j];
    }
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


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

std::string lcs(std::string const& s, std::string const& t)
{
  std::vector<std::vector<int>> cache(s.size()+1, std::vector<int>(t.size()+1, 0));
  for (size_t ii = s.size(); ii > 0; --ii)
  {
    size_t i = ii - 1;
    for (size_t jj = t.size(); jj > 0; --jj)
    {
      size_t j = jj - 1;
      if (s[i] == t[j])
      {
        cache[i][j] = cache[i+1][j+1] + 1;
      }
      else
      {
        cache[i][j] = std::max(cache[i+1][j], cache[i][j+1]);
      }
    }
  }
  std::string res;
  size_t i = 0, j = 0;
  while (i < s.size() && j < t.size())
  {
    if (s[i] == t[j])
    {   
      res += s[i];
      ++i;
      ++j;
    }   
    else if (cache[i+1][j] >= cache[i][j+1])
    {   
      ++i;
    }   
    else
    {   
      ++j;
    }   
  }
  return res;
}

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

  std::string s, t;
  std::cin >> s >> t;


  std::cout << lcs(s, t); 
 
  return 0;
}

Measured memory_bytes: 35584
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;


int main() {

	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	int dx = tx - sx;
	int dy = ty - sy;

	cout << string(dy, 'U')<<string(dx,'R');
	cout << string(dy, 'D') << string(dx, 'L');
	dx++, dy++;
	cout <<'L'<< string(dy, 'U') << string(dx, 'R')<<'D';
	cout << 'R'<<string(dy, 'D') << string(dx, 'L')<<'U';

	cout << endl;
	

	return 0;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> pii;
 
#define REP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define PER(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)
 
void in(ll &x){ cin >> x; }
void pin(ll &x, ll &y){ cin >> x, y; }


int main(){
    //ll N,M,K,a,b,p,q,x,y,z;
    
    ll dp_up[110][5]={0};
    ll dp_low[110][5]={0};

    string N;
    cin >> N;
    ll K;
    in(K);
    
    ll L = N.size();

    dp_up[0][0]=1;
    REP(i,0,L){
        ll n = N[i] - '0';
        REP(j,0,K+1){
            dp_low[i+1][j]+=dp_low[i][j];
            dp_low[i+1][j+1]+=dp_low[i][j]*9;

            REP(k,0,10){
                if(k==n){
                    if(k==0){
                        dp_up[i+1][j]+=dp_up[i][j];
                    }else{
                        dp_up[i+1][j+1]+=dp_up[i][j];
                    }
                }
                if(k<n){
                    if(k==0){
                        dp_low[i+1][j]+=dp_up[i][j];
                    }else{
                        dp_low[i+1][j+1]+=dp_up[i][j];
                    }
                }
            }
        }
    }
    std::cout << dp_low[L][K] + dp_up[L][K] << std::endl;
    return 0;
}

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

int main(void)
{
    long long A, B, K;
    cin >> A >> B >> K;
    if (A >= K) {
        cout << A-K << " " << B << endl;
    }
    else if (B > (K-A)) {
        cout << 0 << " " << B-(K-A) << endl;
    }
    else {
        cout << 0 << " " << 0 << endl;
    }
}

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

HAYAI = []
OSOI = []

now = 0
c = 0
while now < N and c<K:
    if S[now]=='o':
        HAYAI.append(now)
        now += C+1
        c += 1
    else:
        now += 1
        
SS = S[::-1]
now = 0
c = 0
while now < N and c<K:
    if SS[now]=='o':
        OSOI.append(N-now-1)
        now += C+1
        c += 1
    else:
        now += 1
#print(HAYAI)
OSOI = OSOI[::-1]
#print(OSOI)
for i in range(K):
  if HAYAI[i]==OSOI[i]:
    print(HAYAI[i]+1)

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

int main() {
	long long N, M;
	cin >> N >> M;
	dsu d(N);

	for(long long i=0; i<M; ++i){
		long long a, b;
		cin >> a >> b;
		a--; b--;
		d.merge(a, b);
	}
	long long ans = d.groups().size();
	cout << ans-1 << endl;
	return 0;
}


Measured memory_bytes: 9040
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
  int n,d,x;
  cin >> n >> d >> x;
  int a[n];
  int choco=n;

  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
  }

  for (int i = 1; i < d; i++)
  {
    for (int j = 0; j < n; j++)
    {
      if (i%a[j]==0)
      {
        choco++;
      } 
    }
  }
  

  cout << choco+x << "\n";

  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int N;
    int Alice = 0;
    int Bob = 0;
    ArrayList<Integer> L = new ArrayList<Integer>();
    N = s.nextInt();
    for(int i = 0; i < N ;i++){
      L.add(s.nextInt());
    }
    Collections.sort(L);
    for(int i = 0; i < N ;i += 2){
      Alice += L.get(i);
    }
    for(int i = 1; i < N ;i += 2){
      Bob += L.get(i);
    }
    System.out.printf("%d",Math.abs(Alice - Bob));
  }
}


Measured memory_bytes: 23892
#include<bits/stdc++.h>
#define Ms(a,b) memset(a,b,sizeof a)
#define db(x) cout<<#x<<"="<<x<<endl;
#define db2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl;
#define db3(x,y,z) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl;
using namespace std;
int a;
char s[15000];
int main() {
	scanf("%d%s",&a,s);
	if(a>=3200)puts(s);
	else puts("red");
	return 0;
}


Measured memory_bytes: 256