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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl

typedef pair<int, int> P;
typedef long long ll;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<int> p(n);
    REP(i,n)cin>>p[i];
    sort(all(p));
    p[n-1] /= 2;
    int ans = accumulate(all(p),0);
    print(ans);
    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace AtCoderMake.ABC165
{
    class ABC165D
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split().Select((x) => long.Parse(x)).ToArray();

            long ans;
            if (s[1] - 1 < s[2])
            {
                ans = (s[0] * (s[1] - 1)) / s[1];
            }
            else
            {
                ans = (s[0] * s[2]) / s[1];
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 28232
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] field = new char[h][];
		ArrayList<Cell> list = new ArrayList<>();
		for (int i = 0; i < h; i++) {
			field[i] = sc.next().toCharArray();
			for (int j = 0; j < w; j++) {
				if (field[i][j] == '#') {
					list.add(new Cell(i, j));
				}
			}
		}
		int count = 0;
		int start = 0;
		int end = list.size();
		while (list.size() < h * w) {
			for (int i = start; i < end; i++) {
				Cell c = list.get(i);
				if (c.x > 0) {
					if (field[c.y][c.x - 1] == '.') {
						list.add(new Cell(c.y, c.x - 1));
						field[c.y][c.x - 1] = '#';
					}
				}
				if (c.y > 0) {
					if (field[c.y - 1][c.x] == '.') {
						list.add(new Cell(c.y - 1, c.x));
						field[c.y - 1][c.x] = '#';
					}
				}
				if (c.x < w - 1) {
					if (field[c.y][c.x + 1] == '.') {
						list.add(new Cell(c.y, c.x + 1));
						field[c.y][c.x + 1] = '#';
					}
				}
				if (c.y < h - 1) {
					if (field[c.y + 1][c.x] == '.') {
						list.add(new Cell(c.y + 1, c.x));
						field[c.y + 1][c.x] = '#';
					}
				}
			}
			start = end;
			end = list.size();
			count++;
		}
		System.out.println(count);
	}
	
	static class Cell {
		int y;
		int x;
		public Cell(int y, int x) {
			this.y = y;
			this.x = x;
		}
	}
}


Measured memory_bytes: 65472
#include <stdio.h>
#include <string.h>

int main(void){
	long A, B;
	char func[2];

	scanf("%d", &A);
	scanf("%s", func);
	scanf(" %d", &B);

	if(strcmp(func, "+") == 0){
		printf("%d\n", A+B);
	}else if(strcmp(func, "-") == 0){
		printf("%d\n", A-B);
	}

	return 0;
}


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

#define MAX 101
int A[MAX];

int main(){
  int i, j, n, cnt, swap;
  bool flag = 1;
  cin >> n;
  for (i = 0; i < n; i++)    cin >> A[i];
  for (i = 0; flag; i++){
    flag = 0;
    for (j = n - 1; j >= i + 1; j--){
      if (A[j] < A[j - 1]){
        cnt++;
        swap = A[j];
        A[j] = A[j - 1];
        A[j - 1] = swap;
        flag = 1;
      }
    }
  }


  cout << A[0];
  for (i = 1; i < n; i++) cout << " " << A[i];
  cout << "\n";
  cout << cnt << "\n";
  return 0;

}


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

(N, K) = (int(i) for i in input().split())

A = [int(i) for i in input().split()]

# 一周する数を求める
have_been = set()
have_been_list = []
have_been.add(1)
have_been_list.append(1)
now_place = 1
while True:
    next_place = A[now_place - 1]
    if next_place not in have_been:
        have_been.add(next_place)
        have_been_list.append(next_place)
        now_place = next_place
    else:
        break

#print('have_been = {}'.format(have_been))
loop_start_index = have_been_list.index(next_place)

loop_length = len(have_been_list) - loop_start_index
#print('loop = {}'.format(loop))

left_K = K - loop_start_index
if left_K <= 0:
    print(have_been_list[K])
    sys.exit()

mod = left_K % loop_length
print(have_been_list[mod + loop_start_index])

Measured memory_bytes: 33552
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

type mapData struct {
	index  int
	length int
}

func main() {
	N := oneInt()

	for index := 1; index < 10; index++ {
		amari := N % index
		kotae := N / index
		if 0 < kotae && kotae < 10 {
			if amari == 0 {
				fmt.Print("Yes")
				return
			}
		}
	}
	fmt.Print("No")
}

var sc = bufio.NewScanner(os.Stdin)

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}
func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func scanNums() (nums []int) {
	s := nextLine()
	numStr := strings.Split(s, " ")

	for _, n := range numStr {
		i, _ := strconv.Atoi(n)
		nums = append(nums, i)
	}
	return nums
}

func scanStrings() (strs []string) {
	s := nextLine()
	list := strings.Split(s, " ")
	strs = append(strs, list...)
	return strs
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}


Measured memory_bytes: 640
#include <iostream>
#include <limits.h>
#include <utility>

using namespace std;

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

  int min_c = 1001;
  
  for (int n=0; n<N; ++n) {
    int c, t;
    cin >> c >> t;
    
    if (t > T)
      continue;

    min_c = min(c,min_c);
  }

  if (min_c==1001)
    cout << "TLE" << endl;
  else
    cout << min_c << endl;

  return 0;
}

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

int main(){
	int H, W, A, B, i, j;
	scanf("%d%d%d%d", &H, &W, &A, &B);
	vector<vector<int>> s(H, vector<int>(W, 0));
	for(i = 0; i < H; i++){
		for(j = 0; j < W; j++){
			if((i < B && j < A) || (i >= B && j >= A)){
				s[i][j] = 1;
			}
		}
	}
	for(i = 0; i < H; i++){
		for(j = 0; j < W; j++){
			printf("%d", s[i][j]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
int main(){
long long int n,k;
  cin >>n >>k;
  long long int p[n],j[n-k+1],ans=INT_MAX;
  for (int i=0;i<n;i++){
  cin >>p[i];
  }
  sort(p,p+n);
  for (int i=0;i<n-k+1;i++){
  j[i]=p[i+k-1]-p[i];
  }
  sort(j,j+(n-k+1));
  cout << j[0]<<endl;
}

Measured memory_bytes: 1792
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
//		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//		String W	 = in.readLine();
//		int num = Integer.parseInt(W.split(" ")[0]);

		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long C = sc.nextLong();
		long D = sc.nextLong();
		long LCM = C*D/gcd(C,D);

		long ans = B-A+1;
		ans-=(B/C-(A-1)/C);
		ans-=(B/D-(A-1)/D);
//		System.out.println((B/(C*D)));
//		System.out.println((A-1)/(C*D));
		ans+=(B/(LCM)-(A-1)/(LCM));

		System.out.println(ans);

	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}

}


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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

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

int gcd(int x, int y){
    if(y == 0) return x;
    else return gcd(y, x % y);
}

int main(){
    int n, X; cin>>n>>X;
    vector<int> x(n+1);
    x[0]=X;
    for(int i=1; i<=n; i++) cin>>x[i];
    sort(x.begin(), x.end());
    //for(int i=0; i<=n; i++) cout << x[i] << endl;

    if(n==1){
        cout << x[1]-x[0] << endl;
        return 0;
    }

    ll ans=gcd(x[1]-x[0], x[2]-x[1]);
    for(int i=3; i<=n; i++){
        ans=gcd(ans, x[i]-x[i-1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    int MOD = 2019;

    Map<Integer, Integer> map = new HashMap<>();

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        char[] arr = sc.next().toCharArray();
        int len = arr.length;
        int sumMod = 0;
        for (int i=len-1; 0<=i; i--) {
            int tmp = arr[i] - '0';
            tmp *= modPow(10, len-1-i);
            sumMod += tmp;
            sumMod %= MOD;
            if (map.containsKey(sumMod)) {
                int val = map.get(sumMod);
                map.put(sumMod, val+1);
            } else {
                map.put(sumMod, 1);
            }
        }

        long ans = 0;

        for (Integer t: map.values()) {
            ans += t * (t - 1) / 2;
        }

        System.out.println(ans + ((map.get(0)==null) ? 0 : map.get(0)));
//        System.out.println(map);
    }

    int modPow(int x, int n) {
        int sum = 1;
        while (n > 0) {
            if ((n & 1) == 1) {
                sum *= x;
                sum %= MOD;
            }
            x *= x;
            x %= MOD;
            n >>= 1;
        }
        return sum % MOD;
    }

}


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

template <typename InputIterator>
typename InputIterator::value_type
summation(InputIterator first, InputIterator last) {
  using T = typename InputIterator::value_type;
  T *p = new T();
  const auto sum = std::accumulate(first, last, *p);
  delete p;
  return sum;
}
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n, t;
  std::cin >> n >> t;
  std::vector<int64_t> tt(n);
  std::cin >> tt;

  int64_t ans = t;
  for (int64_t i = 0; i < n - 1; i++) {
    ans += std::min(t, tt[i + 1] - tt[i]);
  }

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


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int H,W,x,y,r;

int main() {
	string Ans = "No";
	cin >> W >> H >> x >> y >> r;
	if(r<=W && r<=H){
		if((r<=x) && (x<=W-r)){
			if((r<=y) && (y<=H-r)){
				Ans = "Yes";
			}
		}
	}

	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 3160
#include<iostream>
#include<string>
#include<queue>
#include<map>
#define SIZE_MAP 8
#define N 12
using namespace std;

int main(){
    int n;
    cin >>n;
    for(int i = 0; i < n; i++){
        int dx[SIZE_MAP][SIZE_MAP], x, y;
        for(int j = 0; j < SIZE_MAP; j++){
            string input;
            cin >>input;
            for(int k = 0; k < SIZE_MAP; k++){
                if(input[k] == '1') dx[j][k] = 1;
                else dx[j][k] = 0;
            }
        }
        cin >>x >>y;
        queue< pair<int, int> > zahyou;
        zahyou.push( make_pair(x - 1, y - 1) );
        dx[y - 1][x - 1] = 0;
        while(!zahyou.empty()){
            int sousay[N] = {-1, -2, -3, 0, 0, 0, 1, 2, 3, 0, 0, 0};
            int sousax[N] = {0, 0, 0, 1, 2, 3, 0, 0, 0, -1, -2, -3};
            for(int j = 0; j < N; j++){
                int nowx = zahyou.front().first + sousax[j];
                int nowy = zahyou.front().second + sousay[j];
                if(nowx >= 0 && nowx < SIZE_MAP && nowy >= 0 && nowy < SIZE_MAP){
                    if(dx[nowy][nowx] == 1){
                        zahyou.push( make_pair(nowx, nowy) );
                        dx[nowy][nowx] = 0;
                    }
                }
            }
            zahyou.pop();
        }
        cout <<"Data " <<i + 1 <<":" <<endl;
        for(int j = 0; j < SIZE_MAP; j++){
            for(int k = 0; k < SIZE_MAP; k++){
                cout <<dx[j][k];
            }
            cout <<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define int long long
using P = pair<int,int>;

signed main(){
  int n;
  cin >> n;
  map<string,int> kuzi;
  rep(i,n){
    string s;
    cin >> s;
    kuzi[s]++;
  }
  cout << kuzi.size() << endl;
}

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

int main() {

	int A,B,cnt=0;
	cin>>A>>B;
  for(int i=A;i<=B;i++){
    if(to_string(i).at(0)==to_string(i).at(4) &&to_string(i).at(1)==to_string(i).at(3))cnt++;
  }
	cout<<cnt<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const int INF = 1e9;
const double pi=acos(-1);
using namespace std;

int main(){
  int now=0;
  int q; 
  cin >> q;
  vector<ll>a(q);
  rep(i,q){
    char c;
    ll x;
    cin >> c;
    if(c!='2')cin>>x;
    if(c=='0'){
      a[now]=x;
      now++;
    }
    if(c=='1')cout << a[x] << endl;
    if(c=='2'){
      a[now]=0;
      if(now>0)now--;
    }
  }
  return 0;
}



Measured memory_bytes: 4408
#include <stdio.h>

int main(void)
{
	int h, w, i, j;
	
	while (1) {
		scanf("%d %d", &h, &w);

		if (h == 0 && w == 0)
			break;

		for (i = 1; i <= h; i++) {
            for (j = 1; j <= w; j++) {
                if (i == 1 || i == h){
                    printf("#");
                    if (j == w)
                        printf("\n");
                } else {
                    if (j == 1)
                        printf("#");
                    else if (j == w)
                        printf("#\n");
                    else
                        printf(".");
                }
            }
        }
        
        printf("\n");
    }
    
    return 0;
}

Measured memory_bytes: 588
N, M = map(int, input().split())
t = [-1] * N

import sys
sys.setrecursionlimit(10 ** 6)
def find(e):
    if t[e] < 0:
        return e
    else:
        t[e] = find(t[e])
        return t[e]


def unite(a, b):
    a_root = find(a)
    b_root = find(b)
    if a_root == b_root:
        return
    t[a_root] += t[b_root]
    t[b_root] = a_root


for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    unite(a, b)


def size(x):
    x = find(x)
    return -t[x]


ans = 0
for i in range(N):
    ans = max(ans, size(i))
print(ans)



Measured memory_bytes: 36000
def examA():
    A, B = LI()
    if A%3==0 or B%3==0 or (A+B)%3==0:
        ans = "Possible"
    else:
        ans = "Impossible"
    print(ans)



import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()


Measured memory_bytes: 38384
def GCD(a, b):
    c = a % b
    if c == 0: return b
    return GCD(b, c)

N, X = map(int, input().split(" "))
xs = map(int, input().split(" "))

ans = 0
for x in xs:
    d = abs(x - X)
    if ans == 0:
        ans = d
    else:
        ans = GCD(ans, d)

print(ans)

Measured memory_bytes: 11096
# C - Average Length
from math import sqrt
import numpy as np
N = int(input())
length = np.zeros(int(N * (N - 1) / 2))
point = [0] * N
for i in range(N):
    x, y = map(int, input().split())
    point[i] = (x, y)
    
k = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        length[k] = sqrt((point[i][0] - point[j][0]) ** 2 + (point[i][1] - point[j][1]) ** 2)
        k += 1
        
print(length.sum() * 2 / N)

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
    int x, y, z;
    cin >> x >> y >> z;

    cout << z << " " << x << " " << y << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define MAX_N 200010
long long inv[MAX_N];
long long factorial[MAX_N];
long long inv_factorial[MAX_N];

void GetInv(){
    for (int i = 1; i < MAX_N; i++) {
        if (i == 1) inv[i] = 1;
        else {
            inv[i] = (mod - (mod / i) * inv[mod % i]) % mod;
            if (inv[i] < 0) inv[i] += mod;
        }
    }
}
void GetFactorial(){
    factorial[0] = 1; inv_factorial[0] = 1;
    for (int i = 1; i < MAX_N; i++) {
        factorial[i] = factorial[i-1] * i;
        factorial[i] %= mod;
        inv_factorial[i] = inv_factorial[i-1] * inv[i];
        inv_factorial[i] %= mod;
    }
}

long long combination(int n, int r) {
    if (r < 0) return 0;
    if (n < r) return 0;
    long long ret = factorial[n] * inv_factorial[r];
    ret %= mod;
    ret *= inv_factorial[n-r];
    return ret % mod;
}

int main(){
    GetInv(); GetFactorial();
    int n, k; cin >> n >> k;
    for (int i = 1; i <= k; i++) {
        long long c = combination(k-1, i-1);
        long long d = combination(n-k-1, i-2) + combination(n-k-1, i-1) * 2 + combination(n-k-1, i);
        d %= mod;
        if (n == k && i == 1) {
            cout << 1 << endl;
            continue;
        }
        cout << c * d % mod << endl;
    }
    return 0;
}


Measured memory_bytes: 4992
import sys
def main():
    input = sys.stdin.readline
    N,M=map(int, input().split())
    G=[[] for _ in range(N)]
    for _ in range(M):
        l,r,d=map(int, input().split())
        l,r=l-1,r-1
        G[l].append((r,d))
        G[r].append((l,-d))

    d=[0]*N
    used=[False]*N
    ans=True
    for i in range(N):
        if used[i]: continue
        used[i]=True
        stk=[(i,0)]
        while stk:
            v,vd=stk.pop()
            for to,td in G[v]:
                if used[to]:
                    if d[to]!=vd+td:
                        ans=False
                    continue
                used[to]=True
                d[to]=vd+td
                stk.append((to,d[to]))
    print('Yes' if ans else 'No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 82208
#include <iostream>
#include <string.h>
using namespace std;

#define MAX_M 100001
#define MAX_N 100001
int n, m;

long long br[MAX_M];
long long sz[MAX_M];

long long a[MAX_N], b[MAX_N];
long long result[MAX_N];

void init() {
	for (int i = 0 ; i < MAX_M; i++) {
		br[i] = i;
		sz[i] = 1;
	}
}
int root(int x) {
	return br[x] == x ? x : (br[x] = root(br[x]));
}
bool same(int x, int y) {
	return root(x) == root(y);
}
void unite(int x, int y) {
	x = root(x);
	y = root(y);
	if (x == y) {
		return;
	}
	br[x] = y;
	sz[y] = sz[x] + sz[y];
}

int main(void) {
	long long sum;
	init();
	cin >> n >> m;
	sum = (long long)n * (long long)(n - 1) / 2;
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
	}
	int cnt = 0;
	result[cnt++] = sum;
	for (int i = m - 1; i >= 0; i--) {
		int ra = root(a[i]);
		int rb = root(b[i]);
		if (ra != rb) {
			long long sz1 = sz[ra];
			long long sz2 = sz[rb];
			sum -= sz1 * sz2;
		}
		result[cnt++] = sum;
		unite(a[i], b[i]);
	}
	for (int i = m - 1; i >= 0; i--) {
		cout << result[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using Graph = vector<vector<int>>;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i)
        cin >> A[i];

    int exor = 0;
    ll ans = 0;
    for (int l = 0, r = 0; l < N; ++l) {
        while (r < N && !(exor & A[r])) {
            exor |= A[r];
            ans += (++r) - l;
        }
        exor ^= A[l];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
// Problem : D - Sum of Divisors
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_d
// Memory Limit : 1024 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	// && has higher precedence than ||
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int N;
	cin>>N;
	vi v(N+1);
	FOR(x,2,N+1)
	{
		for(int y=x;y<N+1;y+=x)
		{
			++v[y];
		}
	}
	ll ans=0;
	FOR(x,1,N+1)
	{
		// bug(v[x]+1);
		ans+=x*(ll)(v[x]+1);
	}
	cout<<ans<<nl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 42264
program main
implicit None
integer(8)::n,p,q,i
integer(8),allocatable::a(:),b(:)
	
	read*,n
	allocate(a(n),b(n))
	read*,a
	read*,b
	
	a = a-b
	
	if(sum(a) < 0)then
		print 101,-1
		stop
	endif
	
	call h2(a,n)
	
	p = 0
	q = 0
	do i = 1,n
		if(a(i) >= 0)then
			p = i-1
			exit
		endif
		q = q + a(i)
	enddo
	
	if(p == 0)then
		print 101,p
		stop
	endif
	
	do i = n,1,-1
		q = q + a(i)
		p = p + 1
		if(q >= 0)then
			exit
		endif
	enddo
	
	print 101,p
	
101 format(i0)
end program main

subroutine h2(a,n)
implicit None
	integer(8)::a(n),x
	integer(8)::n,i,ie,i0,i1,i2
	
	do i = n/2,1,-1
		x = a(i);ie = n + 1; i0 = i; i1 = i0 * 2
		do while(i1 < ie)
			i2 = i1 + 1
			if(i2 < ie .and. a(i1) < a(i2)) i1 = i2
			if(a(i1) > x)then
				a(i0) = a(i1);a(i1) = x
				else
				exit
			endif
			i0 = i1;i1 = i0 *2
		enddo
	enddo
	do ie = n,2,-1
		x = a(ie)
		a(ie) = a(1)
		a(1) = x
		i0 =1;i1 =2
		do while(i1 <ie)
			i2 = i1 +1
			if(i2 < ie .and. a(i1) < a(i2)) i1 = i2
			if(a(i1) > x)then
				a(i0) = a(i1);a(i1) = x
				else
				exit
			endif
			i0 = i1;i1 = i0 *2
		enddo
	enddo
end subroutine h2

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
struct Card
{
	char suit;
	char value;
};

void BubbleSort(Card C[],int N){
	int i,j;
	for(i=0;i<N;i++){
		for(j=N-1;j>=i;j--){
			if(C[j].value < C[j-1].value)swap(C[j],C[j-1]);
		}
	}
}

void SelectionSort(Card A[],int N){
	int i,j,minj;
	for(i=0;i<N;i++){
		minj = i;
		for(j=i;j<N;j++){
			if(A[j].value < A[minj].value) minj = j;
		}
		if(minj!=i){
			swap(A[i],A[minj]);
		}
	}
}

void print(Card C[],int N){
	for(int i=0;i<N;i++){
		if(i>0)cout << " ";
		cout << C[i].suit << C[i].value;
	}
	cout << endl;
}



int main(){
	Card C1[36],C2[36];
	int i,N,ch=1;
	cin >> N;
	for(i=0;i<N;i++){
		cin >> C1[i].suit >> C1[i].value;
		C2[i] = C1[i];
	}
	BubbleSort(C1,N);
	SelectionSort(C2,N);

	for(i=0;i<N;i++){
		if(C1[i].suit != C2[i].suit){
			ch = 0;
			break;
		}
	}
	print(C1,N);
	cout << "Stable" << endl;
	print(C2,N);
	if(ch) cout << "Stable" << endl;
	else cout << "Not stable" << endl;
	return 0;
}

Measured memory_bytes: 3072
#include <functional>
#include <iostream>
#include <vector>

using ll = long long;
int main(int argc, char ** argv)
{
  //
  int n, m;
  std::cin >> n >> m;

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

  std::sort(a.begin(), a.end(), std::greater<int>());
  for (int i = 0; i < m; ++i) {
    double A = a[i] / 1.0;
    double B = total / (4.0 * m);
    if (A < B) {
      std::puts("No");
      return 0;
    }
  }
  std::puts("Yes");
  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


int main()
{
    int A,B,C,K;

    cin >> A >> B >> C >> K;

    int sum = 0;
/*
    while (K > 0)
    {
        if(A > 0 ){
            sum ++;
            A --;
            K --;
            
        }else if(B > 0){
        
            B --;
            K --;
            
        }else{
            C --;
            K --;
            sum --;
        }
    }
    */
   while(A > 0 && K > 0){
       sum ++;
       A --;
       K --;
   }
   while(B > 0 && K > 0){
       B --;
       K --;
   }
   while(C > 0 && K > 0){
       sum --;
       C --;
       K --;
   }


    cout << sum << endl;
    

    return 0;
    

}

Measured memory_bytes: 3192
N,K=map(int,input().split())
A=list(map(int,input().split()))
a=A.index(min(A))
r=a
l=N-(r+1)
rc=r//(K-1)
lc=l//(K-1)

if N-(rc+lc)*(K-1)==1:
  print(rc+lc)
elif 1<N-(rc+lc)*(K-1)<=K:
  print(rc+lc+1)
else:
  print(rc+lc+2)

Measured memory_bytes: 13812
unittest
{
	assert( [ "010" ].parse.expand.solve == 2 );
	assert( [ "100000000" ].parse.expand.solve == 8 );
	assert( [ "00001111" ].parse.expand.solve == 4 );
	
	assert( [ "11111111" ].parse.expand.solve == 8 );		// 追加ケース
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	auto ans = s.length.signed;
	for( auto i = 1L; i < s.length; i++ )
	{
		if( s[ i - 1 ] != s[ i ] ) ans = min( ans, max( i, s.length.signed - i ) );
	}
	return ans;
}


Measured memory_bytes: 2712
import java.util.Scanner

object Main {
  def main(args:Array[String]) {
    val sc = new Scanner(System.in)
    val tmp = sc.nextLine().split(" ")

    if ((tmp(0) == "H" && tmp(1) == "H") ||  (tmp(0) == "D" && tmp(1) == "D")) {
      println("H")
    } else if ((tmp(0) == "H" && tmp(1) == "D") || (tmp(0) == "D" && tmp(1) == "H")) {
      println("D")
    }
  }
}

Measured memory_bytes: 27720
use std::cmp::*;
use std::io::*;
use std::num::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn string() -> String {
    read()
}
fn int() -> i64 {
    read()
}
fn char() -> char {
    read::<String>().pop().unwrap()
}
fn vecchar() -> Vec<char> {
    string().chars().collect()
}

fn main() {
    let a = vecchar();
    let b = vecchar();
    let c = vecchar();
    println!(
        "{}{}{}",
        a[0].to_uppercase().next().unwrap(),
        b[0].to_uppercase().next().unwrap(),
        c[0].to_uppercase().next().unwrap()
    )
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
static const ll INF = 9223372036854700;
static const ll MOD = 1000000007;
bool access_1[200009],access_N[200009];

int main(){
  int n,m;
  cin >> n >> m;
  for(int i=0;i<=n;i++){
    access_1[i] = false;
    access_N[i] = false;
  }

  for(int i=0;i<m;i++){
    int a,b;
    cin >> a >> b;
    if(a == 1) access_1[b] = true;
    if(b == n) access_N[a] = true;
  }

  bool ans = false;
  for(int i=2;i<n;i++){
    if(access_1[i] && access_N[i]) ans = true;
  }
  if(ans) cout << "POSSIBLE" << endl;
  else cout <<"IMPOSSIBLE" <<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

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

    ll sum1 = 0;
    ll ans1 = 0;
    for(int i = 0; i < n; i++){
        sum1 += a[i];
        if(i % 2 == 0){
            if(sum1 >= 0){
                ans1 += sum1 + 1;
                sum1 = -1;
            }
        }else{
            if(sum1 <= 0){
                ans1 += 1 - sum1;
                sum1 = 1;
            }
        }
    }

    ll sum2 = 0;
    ll ans2 = 0;
    for(int i = 0; i < n; i++){
        sum2 += a[i];
        if(i % 2 == 1){
            if(sum2 >= 0){
                ans2 += sum2 + 1;
                sum2 = -1;
            }
        }else{
            if(sum2 <= 0){
                ans2 += 1 - sum2;
                sum2 = 1;
            }
        }
    }
    cout << min(ans1, ans2) << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
  	long A, B, C, ans;
	cin >> A >> B;
	if (A%2==0){
		if (B%2==0){
			C=(B-A)/2;
			if (C%2==0) ans = B;
			else ans = B^1;
		}else{
			C=(B-A+1)/2;
			if (C%2==0) ans = 0;
			else ans = 1;
		}
	}else{
		if (B%2==0){
			C=(B-A-1)/2;
			if (C%2==0) ans = A^B;
			else ans = A^B^1;
		}else{
			C=(B-A)/2;
			if (C%2==0) ans = A;
			else ans = 1^A;
		}
 
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;

//=============================
void input()
{
    cin>>N;

}
//=============================
void func(){}
//=============================
void solve()
{
    int s = 0;
    int n =N;
    while(N){
        s += N%10;
        N /= 10;
    }

    cout<<(n%s ? "No" : "Yes")<<endl;

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
#define min(x,y)((x)<(y)?(x):(y))
H,W,M[101*104],S[101*104];
i,f,s;
main(){
	for(;scanf("%d%d\n",&W,&H),W;){
		W++;
		memset(M,0,sizeof(M));
		memset(S,1,sizeof(S));
		for(i=0;i<H*W;i++){
			f=getchar();
			if(f=='&')
				S[W*2+i]=0;
			M[W*2+i]=f=='#';
		}
		for(f=1;f;){
			f=0;
			for(i=0;i<(H+2)*W;i++){
				s=S[W+i];
				s=min(s,S[W+i+1]+(M[W+i]>M[W+i+1]));
				s=min(s,S[W+i-1]+(M[W+i]>M[W+i-1]));
				s=min(s,S[W+i+W]+(M[W+i]>M[W+i+W]));
				s=min(s,S[W+i-W]+(M[W+i]>M[W+i-W]));
				if(S[W+i]!=s)
					S[W+i]=s,f=1;
			}
		}
		/*
		for(i=0;i<(H+2)*W;i++){
			printf("%d",S[W+i]);
			if(i%W==W-1)
				puts("");
		}*/
		printf("%d\n",S[W]);
	}
	exit(0);
}

Measured memory_bytes: 496
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n],d=1000000000,e;
  for(int i=0;i<n;i++){
    e=0;
    cin >> a[i];
    while(a[i]%2==0){
      a[i]/=2;
      e++;
    }
    d=min(d,e);
  }
  cout << d;
}

Measured memory_bytes: 256
a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(n==0)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;}

Measured memory_bytes: 608
import java.util.*;

class Main {
   public static void main(String[] args)
   {
      Scanner scan  = new Scanner(System.in);
      int     hour  = scan.nextInt();
      int     money = scan.nextInt();
      

      if(hour - money > 0){
         System.out.println(hour - money);
         }
      else{
          System.out.println(0);
          }
   }
}


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

typedef long long int ll; 

int main(void)
{
	ll x,n,arr[1000];

	cin >> x >> n;

	if(n!=0)
	{
		for(ll i=0;i<n;i++)
		cin >> arr[i];
		sort(arr,arr+n);
	
	}

	ll ans=-1,diff=0;
	ll val,a,b,temp=0;

	if(n==0)
		cout << x << endl;
	else
	{
		while(ans==-1)
		{
			a = x - diff;
			b = x + diff;
			if(!binary_search(arr,arr+n,a))
			{
				// cout << "a: " << a << "not found in array\n";		
				ans = 1;
				val = a;
			}	
			if(!binary_search(arr,arr+n,b))
			{
				// cout << "b: " << b << "not found in array\n";			

				if(ans==1)
					ans=5;
				else
					ans = 2;
				val = b;
				
			}

			if(ans==-1)
				diff++;
		}
		if(ans==5)
			cout << min(a,b) << endl;
		else
			cout << val << endl;
	}
	return 0;
}

Measured memory_bytes: 3640
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a + b == c + d)
	{
		cout << "Balanced" << "\n";
	}
	else if ((a + b) > (c + d))
	{
		cout << "Left" << "\n";
	}
	else
	{
		cout << "Right" << "\n";
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<vector<int>> b1;
    b1 = vector<vector<int>>(3,vector<int>(10,0));
    vector<vector<int>> b2;
    b2 = vector<vector<int>>(3,vector<int>(10,0));
    vector<vector<int>> b3;
    b3 = vector<vector<int>>(3,vector<int>(10,0));
    vector<vector<int>> b4;
    b4 = vector<vector<int>>(3,vector<int>(10,0));


    int tmp_b, tmp_f, tmp_r, tmp_v;
    while(n > 0){
        cin >> tmp_b >> tmp_f >> tmp_r >> tmp_v;
        switch (tmp_b) {
            case 1:
                b1[tmp_f-1][tmp_r-1] += tmp_v;
                break;
            case 2:
                b2[tmp_f-1][tmp_r-1] += tmp_v;
                break;
            case 3:
                b3[tmp_f-1][tmp_r-1] += tmp_v;
                break;
            case 4:
                b4[tmp_f-1][tmp_r-1] += tmp_v;
                break;
        }
        n -= 1;
    }

    for(int i=0; i<3; i++){
        for(int j=0; j<10; j++){
            if(j==9){
                cout << " " << b1[i][j] <<endl;
                break;
            }
            cout << " " << b1[i][j];
        }
    }

    cout << "####################" << endl;

    for(int i=0; i<3; i++){
        for(int j=0; j<10; j++){
            if(j==9){
                cout << " " << b2[i][j] <<endl;
                break;
            }
            cout << " " << b2[i][j];
        }
    }

    cout << "####################" << endl;

    for(int i=0; i<3; i++){
        for(int j=0; j<10; j++){
            if(j==9){
                cout << " " << b3[i][j] <<endl;
                break;
            }
            cout << " " << b3[i][j];
        }
    }

    cout << "####################" << endl;

    for(int i=0; i<3; i++){
        for(int j=0; j<10; j++){
            if(j==9){
                cout << " " << b4[i][j] <<endl;
                break;
            }
            cout << " " << b4[i][j];
        }
    }

    return 0;
}



Measured memory_bytes: 3172
N = int(input())
A = list(map(int, input().split()))

minv = A[0]
sw = 0
for i in range(N):
    minv = min(A[i:])
    mini = A[i:].index(minv) + i
    if A[i] > minv:
        temp = A[i]
        A[i] = minv
        A[mini] = temp
        sw += 1

print(*A)
print(sw)


Measured memory_bytes: 5604
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();

    char c;
    cin >> c;

    cout << char(c + 1) << endl;

    return 0;
}

Measured memory_bytes: 256
d,n=gets.chomp.split(' ').map(&:to_i)
 
if d == 0
  if n%100==0
    n += 1
  end
  puts n
elsif d == 1
  if n%100 == 0
    n += 1
  end
  puts n*100
else
  if n%100==0
    n+=1
  end
  puts n*10000
end

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

int main()
{
    int N;
    long long int L[87];

    scanf("%d",&N);

    L[0] = 2;
    L[1] = 1;

    if(N<2){
        printf("%lld\n",L[N]);
        return 0;
    }

    for(int i=2;i<=N;i++)
    {
        L[i] = L[i-1] + L[i-2];
    }

    printf("%lld\n",L[N]);

    return 0;
}

Measured memory_bytes: 256
def resolve():
    '''
    code here
    '''

    K = int(input())

    import math
    
    temp_list = []
    for k in range(1,K+1):
        for j in range(1,K+1):
            temp_list.append(math.gcd(k,j))

    res = 0
    for item in temp_list:
        for i in range(1,K+1):
            res += math.gcd(item, i)

    print(res)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9408
import math

a,b,h,m = map(int,input().split())

def calc_ans(rad):
    x = a**2 + b**2 -2*a*b*math.cos(rad)
    ans = math.sqrt(x)
    return ans

l_w = 2*math.pi/(12*60)
s_w = 2*math.pi/60

long_rad = l_w * (h*60+m)
short_rad = s_w * m

if abs(long_rad-short_rad) >= math.pi:
    rad = 2*math.pi-abs(long_rad-short_rad)
else:
    rad = abs(long_rad-short_rad)

ans = calc_ans(rad)
print(ans)

Measured memory_bytes: 9412
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll a, b, h;
    cin >> a >> b >> h;
    cout << ((a+b)*h)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007LL
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  150
#define tmod             998244353LL
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll SUMD(ll n);
ll BS(vector<pair< ll ,ll > > &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
//bool P[N+1];
void Sieve(int n=N);
ll Powb(ll b,ll n,ll m);

vector<vector<int> > G(200005);
vector<ll> A(200005),ans(200005,1);

void DFS(ll s,ll p,ll &l,vector<ll> &V)
{
    ll ol = l,ov;
    auto it = lower_bound(V.begin(),(V.begin()+l),A[s]);
    if(it==V.begin()+l) V[l++] = A[s];
    else {ov = (*it); *it = A[s];}
    ans[s] = l;
    for(auto it:G[s]) if(it!=p) DFS(it,s,l,V);
    if(ol==l) *it = ov;
    else l--;
}

int main()
{
fast;
ll q=1,t;
//cin >> q;
while(q--)
{
    ll i,j,n,m,k,l,r,a,b,c=0,d=0,e,g,p,q,u,v,w,x,y,flag=1;
    //n=m=k=i=j=l=r=a=b=c=d=u=v=w=p=x=y=0;
    cin >> a >> b >> n;
    r = min(b-1,n);
    cout << (r*a)/b;
}
    return 0;
}

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

ll Powb(ll b,ll n,ll m)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2,m);
    if(n%2==0){return (temp*temp)%m;}
    else{return (b*((temp*temp)%m))%m;}
}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;

}
ll BS(vector<pair<ll,ll> > &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid].F==ser)
    {
        return mid;
    }
    else if(PS[mid].F > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}
/*
void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}

*/


Measured memory_bytes: 10964
import itertools
H, W, K = map(int, input().split())
maps = [list(input()) for i in range(H)]

count_match = 0
H_skip = []
for x in range(0, H + 1, 1):
    tmp = list(itertools.combinations(range(H), x))
    for y in tmp:
        H_skip.append(y)

W_skip = []
for v in range(0, W + 1, 1):
    tmp = list(itertools.combinations(range(W), v))
    for w in tmp:
        W_skip.append(w)

for h_skip in H_skip:
    for w_skip in W_skip:
        count = 0
        for q in range(H):
            for r in range(W):
                if maps[q][r] == "#" and q not in h_skip and r not in w_skip:
                    count += 1

        if count == K:
            count_match += 1

print(count_match)


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

int notomamiko(const void* x, const void* y) {
	int a = *(const int*)x, b = *(const int*)y;
	return a < b ? -1 : a > b;
}

int N;
int A[271828];

char era[1234567];

int main(void) {
	int i;
	int miyukiti = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	qsort(A, N, sizeof(*A), notomamiko);
	for (i = 0; i < N; i++) {
		if (!era[A[i]]) {
			int j;
			if (!(i + 1 < N && A[i + 1] == A[i])) miyukiti++;
			for (j = A[i]; j <= A[N - 1]; j += A[i]) era[j] = 1;
		}
	}
	printf("%d\n", miyukiti);
	return 0;
}


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

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

    vector<pair<int, int>> a(n), b(n);
    for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
    for (int i = 0; i < n; i++) cin >> b[i].first >> b[i].second;

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    int cnt = 0;
    bool used[n] = {};
    for (int i = 0; i < n; i++) {
        int t = -1, f = -1;
        for (int j = 0; j < n; j++) {
            if (!used[j] && a[j].first < b[i].first && a[j].second < b[i].second && a[j].second > t)
                t = a[j].second, f = j;
        }
        if (f > -1) used[f] = true, cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256