akhauriyash/Code-Regression huggingface dataset:
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <utility>
#include <tuple>
using namespace std;

struct UnionFind{
private:
  vector<int> data;
public:
  int N;
  UnionFind(int n) : data(n, -1), N(n){}
  bool unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return false;
    --N;
    if(data[y] < data[x]) swap(x,y);
    data[x] += data[y];
    data[y] = x;
    return x != y;
  }
  bool same(int x, int y){ return find(x) == find(y); }
  int find(int x){
    if(data[x] < 0) return x;
    return data[x] = find(data[x]);
  }
  int size(int x){ return -data[find(x)]; }
};

int main(){
  int N;
  cin >> N;
  vector<tuple<int,int,int>> C;
  for(int i = 0; i < N; ++i){
    int x, y;
    cin >> x >> y;
    --x,--y;
    C.emplace_back(x,y,i);
  }
  sort(C.begin(), C.end());

  UnionFind uf(N);
  set<pair<int,int>> S;
  for(auto [x, y, i] : C){
    int y_min = y;
    while(S.size() and S.begin()->first < y){
      uf.unite(i,S.begin()->second);
      y_min = min(y_min,S.begin()->first);
      S.erase(S.begin());
    }
    S.emplace(y_min,i);
  }
  for(int i = 0; i < N; ++i)
    cout << uf.size(i) << '\n';
}


Measured memory_bytes: 11112
use std::io::*;
use std::str::FromStr;

/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//main function
fn main() {
    let m: i32 = read();
    for i in 0..50_000 {
	if m == (i as f64 * 1.08) as i32 {
	    println!("{}",i);
	    return;
	}
    }
    println!(":(");
}


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

int	plus_each_digit(int N)
{
	int sum;

	sum = 0;
	while (N)
	{
		sum += N % 10;
		N /= 10;
	}
	return (sum);
}

int main() {
	int N;

	cin >> N;
	if (N % plus_each_digit(N) == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
a2 = list(map(lambda x:x*2,a))
All = sum(a)
p = All-sum(a2[1::2])
a3 = [p]
for i in range(n-1) :
    p = a[i]*2 - p
    a3.append(p)
mountain = ""
for j in range(n) :
    mountain += str(a3[j])
    if j == n-1 :
        print(mountain)
        exit()
    mountain += " "

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

#define INF 1E9

int n,k,*h;
long *dp;

int calcCost(int from,int to)
{
	if (h[from]>h[to]) return h[from] - h[to];
	return h[to] - h[from];
}

int myMin(int a,int b)
{
	return (a-b>0)?b:a;
}

void chMin(long *a,int b)
{
	if (*a>b) *a = b;
	return;
}

int main(void)
{
	int i,j;
	scanf("%d %d",&n,&k);
	h = (int *)malloc(sizeof(int) * n);
	for (i=0;i<n;i++) scanf("%d",&h[i]);

	dp = (long *)malloc(sizeof(long) * n);
	dp[0] = 0;
	for (i=1;i<n;i++) dp[i] = INF;
	
	for (i=1;i<n;i++) {
		for (j=1;j<=k;j++) {
			if (i-j<0) break;

			chMin(&dp[i],dp[i-j] + calcCost(i-j,i));
		}
	}
	
	printf("%ld\n",dp[n-1]);

	free(h);
	free(dp);
	return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define rep(i,c) for(int i=0;i<(int)c;i++)
using namespace std;


int main(){
  int N,A,B;
  string S;
  cin >> N >> A >> B;
  cin >> S;
  int inJ = 0;
  int outJ = 0;
  rep(i, S.size())
  {
    if(S.at(i)=='a'&&inJ<A+B){
      cout << "Yes" << endl;
      inJ++;
      continue;
    }
    if(S.at(i)=='b'&&inJ<A+B&&outJ<B){
      cout << "Yes" << endl;
      //cout << "国外現在通過者累積" << outJ << endl;
      inJ++;
      outJ++;
      continue;
    }
    cout << "No" << endl;
  }
}

Measured memory_bytes: 896
from statistics import median
n=int(input())
a=list(map(int,input().split()))
mid=0
l=[]
for i in range(n):
    l+=[a[i]-i-1]

mid=median(l)
ans=0
for i in range(n):
    ans+=abs(a[i]-(mid+i+1))

print(int(ans))

Measured memory_bytes: 27236
Imports System
Module A
	Sub Main
		Dim N,R As Integer
		Dim inputs() As String
		inputs = Console.ReadLine().Split()
		N = Integer.Parse(inputs(0))
		R = Integer.Parse(inputs(1))
		If N >= 10
			Console.WriteLine(R)
		Else
			Console.WriteLine(R+(100*(10-N)))
		End If
	End Sub
End Module


Measured memory_bytes: 13140
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

S = str(input())

if 0 < int(S[0:2]) < 13 and 0 < int(S[2:]) < 13:
    ans = "AMBIGUOUS"
elif 0 < int(S[:2]) < 13:
    ans = "MMYY"
elif 0 < int(S[2:]) < 13:
    ans = "YYMM"
else:
    ans = "NA"

print(ans)


Measured memory_bytes: 6864
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


  int n;
  

int findhalf(char color[],int l,int r){
  if(r-l==1){
    return l;}
  int mid=(l+r)/2;
  printf("?");
  for(int i=mid;i<n+mid;i++){
    printf(" %d",i);
    fflush(stdout);}
  printf("\n");
  fflush(stdout);
  char acol[5];
  scanf("%s",acol);
  if(strcmp(acol,"-1")==0){
    exit(0);}
  if(strcmp(color,acol)!=0){
    return findhalf(color,l,mid);}
  else{
    return findhalf(color,mid,r);}
  
}

void print(int m){
  char col1[5];
  char ncol[2*n];
  int no;
  for(int i=1;i<=2*n;i++){
    printf("? %d",i);
    if(i<m+1 || i>=m+n){
      no=m;}
    else{
      no=m+n;}
    for(int j=no+1;j<n+no;j++){
      printf(" %d",(j-1)%(2*n)+1);
      fflush(stdout);}
    printf("\n");
    fflush(stdout);//flush
    scanf("%s",col1);
    if(strcmp(col1,"-1")==0) exit(0);
    ncol[i-1]=col1[0];}//1st letter

  printf("! ");
  for(int i=0;i<2*n;i++){
    printf("%c",ncol[i]);
    fflush(stdout);}
  printf("\n");
  fflush(stdout);
}

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

  //find f(m)!=f(m+1)
  char color[5];
  printf("?");
  for(int i=1;i<=n;i++){
    printf(" %d",i);
    fflush(stdout);}
  printf("\n");
  fflush(stdout);
  scanf("%s",color);
  if(strcmp(color,"-1")==0) return 0;
  int m = findhalf(color,1,n+1);

  //m has "color"
  print(m);

  return 0;
}


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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b == c || b + c == a || c + a == b)
  {
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
ab = sorted(ab, key=lambda x: x[0])

price = 0
cnt = 0
for info in ab:
    a, b = info
    if cnt + b >= M:
        price += (M-cnt)*a
        break
    else:
        cnt += b
        price += a*b

print(price)


Measured memory_bytes: 29796
#include <stdio.h>
#include <string.h>
#define LEN 100005

typedef struct pp {
	char name[100];
	int t;
} P;

P Q[LEN];
int head,tail,n;

void enqueue(P x)
{
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

P dequeue()
{
	P x = Q[head];
	head = (head + 1) % LEN;
	return x;
}

int min(int a,int b) {return a < b ? a : b;}

int main(void)
{
	int elaps = 0,c;
	int i,q;
	P u;
	
	scanf("%d %d",&n,&q);
	
	for(i = 1; i <= n; i++)
	{
		scanf("%s",Q[i].name);
		scanf("%d",&Q[i].t);
	}
	head = 1; tail = n + 1;
	
	while(head != tail)
	{
		u = dequeue();
		c = min(q, u.t);
		u.t -= c;
		elaps += c;
		if(u.t > 0) enqueue(u);
		else
		{
			printf("%s %d\n",u.name,elaps);
		}
	}
	return 0;
}

Measured memory_bytes: 10756
#include <bits/stdc++.h>
using namespace std;
const int MAX = 10010;

void countingSort(vector<int> &A, vector<int> &B, int k) {
  vector<int> C(k+1);
  for (int i = 0; i < A.size(); i++) {
    C[A[i]]++;
  }
  for (int i = 1; i <= k; i++) {
    C[i] += C[i-1];
  }
  for (int i = A.size() - 1; i >= 0; i--) {
    B[C[A[i]] - 1] = A[i];
    C[A[i]]--;
  }
}

int main() {
  int n;
  cin >> n;
  vector<int> A(n), B(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  countingSort(A, B, MAX);
  for (int i = 0; i < n; i++) {
    if (i) {
      cout << " ";
    }
    cout << B[i];
  }
  cout << endl;
}


Measured memory_bytes: 18316
#include <iostream>
#include <queue>

using namespace std;

int main()
{
	int n, m;
	
	while(1){
		cin >> n >> m;
		if(n == 0 && m == 0){
			break;
		}
		queue<int> que;
		for(int i = 1; i <= n; i++){
			que.push(i);
		}
		
		n = 1;
		while(que.size() > 1){
			if(n == m){
				n = 0;
			} else {
				que.push(que.front());
			}
			que.pop();
			n++;
		}
		
		cout << que.front() << endl;
	}
	
	return 0;
}

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

namespace Aizu {
    public class OnlineJudge {
        static void Main() {
            foreach (var n in Enumerable.Range(1, int.Parse(Console.ReadLine()))) {
                Console.ReadLine();
                var board = new bool[8][];
                for (int i = 0; i < 8; ++i) {
                    board[i] = Console.ReadLine().Select(c => c == '1').ToArray();
                }
                var q = new Queue<int[]>();
                var f = new[] { int.Parse(Console.ReadLine()) - 1, int.Parse(Console.ReadLine()) - 1 };
                board[f[1]][f[0]] = false;
                q.Enqueue(f);
                while (q.Any()) {
                    var p = q.Dequeue();
                    for (int b = 1; b <= 3; ++b) {
                        for (int d = 0; d < 4; ++d) {
                            var y = p[1];
                            var x = p[0];
                            var v = b * ((d & 2) == 0 ? 1 : -1);
                            if ((d & 1) == 0) {
                                y += v;
                            }
                            else {
                                x += v;
                            }
                            if (y >= 0 && y < 8 && x >= 0 && x < 8) {
                                if (board[y][x]) {
                                    q.Enqueue(new[] { x, y });
                                }
                                board[y][x] = false;
                            }
                        }
                    }
                }
                Console.WriteLine("Data {0}:", n);
                for (var y = 0; y < 8; ++y) {
                    for (var x = 0; x < 8; ++x) {
                        Console.Write(board[y][x] ? "1" : "0");
                    }
                    Console.WriteLine();
                }
            }
        }
    }
}

Measured memory_bytes: 10624
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////

LD cal(pair<LD, LD> A, pair<LD, LD> B) {
	LD ans = 0;
	ans = (A.first - B.first)* (A.first - B.first)
		+ (A.second - B.second) * (A.second - B.second);
	return sqrt(ans);
}
void solve() {
	int N;
	cin >> N;
	vector<pair<LD, LD>>pos(N);
	
	for (int i = 0; i < N; ++i) {
		cin >> pos[i].first >> pos[i].second;
	}
	vector<int> A(N);
	for (int i = 0; i < N; ++i) {
		A[i] = i;
	}
	LD ans = 0;
	do {
		LD res = 0;
		for (int i = 0; i < N - 1; ++i) {
			res += cal(pos[A[i]], pos[A[i + 1]]);
		}
		ans += res;
	} while (next_permutation(A.begin(),A.end()));
	for (LD i = N; i >= 1; --i) {
		ans /= i;
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
import sys
def solve(l, r):
	if r == "":
		if eval(l) == 7:
			print(l + "=7")
			sys.exit()
	else:
		solve(l + "+" + r[0], r[1:])
		solve(l + "-" + r[0], r[1:])

s = input()
solve(s[0], s[1:])


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include<map>
#include<queue>
#include<cstring>
#include<algorithm>
using namespace std;
const int  maxn = 1e5 +100;
int n, c[maxn];

int main ()
{
    memset(c,0,sizeof(c));
    cin>>n;
    int x, y;
    vector<int>a[maxn];
    vector< pair<int,int> > b;
    for(int i = 1; i < n; i ++)
    {

        cin>>x>>y;
        c[x]++;
        c[y]++;
        a[x].emplace_back(y);
        b.emplace_back(x,y);
    }

    sort(c + 1, c + n + 1);
    int sum = c[n];
    memset(c, 0, sizeof c);
    map<pair<int,int>, int> g;
    queue<int> q;
    q.push(1);
    while(!q.empty())
    {
        int k = 1;
        int shu = q.front(); q.pop();
        if(a[shu].size())
        {
            for(int j = 0; j < a[shu].size(); j ++)
            {
                if(c[shu]==k)
                    k++;
                g[make_pair(shu,a[shu][j])]=k;
                q.push(a[shu][j]);
                c[a[shu][j]]=k;
                k++;
            }
        }
    }
    cout<< sum <<endl;
    for(auto p:b) cout << g[p] <<endl;
}

Measured memory_bytes: 11892
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Set<Integer> num = new HashSet<>();
        for (int i=0; i<N; i++){
            int di = sc.nextInt();
            num.add(di);
        }
        System.out.println(num.size());

    }
}

Measured memory_bytes: 21972
<?php
    fscanf(STDIN, "%d %d", $n, $m);
    $ar = array();
    for($i = 0; $i < $n; $i++){
        $ar[] = 0;
    }
    for($i = 0; $i < $m; $i++){
        fscanf(STDIN, "%d %d", $a, $b);
        $ar[--$a]++;
        $ar[--$b]++;
    }
    for($i = 0; $i < $n; $i++){
        echo "$ar[$i]\n";
    }
?>


Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	
	int n;
	cin >> n;
	vector<pair<double, double>> c(n);
	rep(i, n){
		double x, y;
		cin >> x >> y;
		c[i] = make_pair(x, y);
	}
	double ave = 0.0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(i == j) continue;
			ave += sqrt( (c[i].first - c[j].first) * (c[i].first - c[j].first) + (c[i].second - c[j].second) * (c[i].second - c[j].second));
			
		}
	}
	double ans = ave / (double) n;
	printf("%.10f\n", ans);
	return 0;
}

Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	mod := int64(1e9 + 7)
	counter := make([]int64, n+1)
	counter[0] = 3

	ans := int64(1)
	for i := 0; i < n; i++ {
		a := getNextInt(scanner) + 1
		ans *= (counter[a-1] - counter[a])
		ans %= mod
		counter[a]++
	}
	fmt.Fprintln(writer, ans)
	writer.Flush()
}


Measured memory_bytes: 2432
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 17;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()

int main() {
	int N, i;
	ll A, B, C, D;
	scanf("%d", &N);
	scanf("%lld %lld %lld %lld", &A, &B, &C, &D);

	for (i = 0; i < N; i++) {
		ll t1 = i, t2 = N - 1 - i;
		ll mx = D * t1 - C * t2;
		ll mn = C*t1 - D*t2;
		if (mn <= B - A && B - A <= mx) return !printf("YES\n");
	}
	return !printf("NO\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>

using namespace std;

const int MOD = 1000000007;
typedef long long ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,A,B;
  cin>>N;
  if(N==1){
    cout<<"Hello World"<<endl;
  }else{
    cin>>A>>B;
    cout<<A+B<<endl;
  }
}


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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

 
int main(){
  int x, n;
  cin >> x >> n;
  int a[105] = {};
  if(n==0){
    cout << x << endl;
    return 0;
  }
  for(int i=0; i<n; i++){
    int p;
    cin >> p;
    a[p] = 1;
  }
  int diff = 1000;
  int ans = 0;
  for(int i=0; i<105; i++){
    if(!a[i]){
      if(diff>abs(i-x)){
        ans = i;
        diff = abs(i-x);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B;
  cin >> A >> B;
  int s1, s2, s3, s4, s5;
  int times = 0;
  
  for (int i = A; i < B + 1; i++){
      s1 = (i % 10);
      s2 = ((i - s1) % 100) / 10;
      s3 = ((i - s1 - s2*10) % 1000) / 100;
      s4 = ((i - s1 - s2*10 - s3*100) % 10000) / 1000;
      s5 = ((i - s1 - s2*10 - s3*100 - s4*1000) % 100000) / 10000;
      
      if (s1 == s5 && s2 == s4){
          times++;
      }
  }
  cout << times << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

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

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

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	string s;
	cin >> s;
	int n = s.length();
	int ans = 2;
	int i, j;
	for(i = n - 3;i >= 0;i-=2) {
		bool flag = true;
		for (j = 0;j <(i+1)/2;++j) {
			if (s[j] != s[(i + 1) / 2 + j])flag = false;
		}
		if (flag)break;
		ans += 2;
	}
	cout << (n-ans) << endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) tsort(v);reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_1
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

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() {
	cin.tie(0);
	ios::sync_with_stdio(0);

	string s, t;
	cin >> s >> t;
	tsort(s); trev(t);
	Yes(s < t);
	gc();
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  int sx, sy, tx, ty;
  scanf("%d %d %d %d", &sx, &sy, &tx, &ty);
  int dx = tx - sx;
  int dy = ty - sy;
  rep (i, dx) {
    printf("R");
  }
  rep (i, dy) {
    printf("U");
  }
  rep (i, dx) {
    printf("L");
  }
  rep (i, dy) {
    printf("D");
  }

  printf("D");
  rep (i, dx+1) {
    printf("R");
  }
  rep (i, dy+1) {
    printf("U");
  }
  printf("LU");
  rep (i, dx+1) {
    printf("L");
  }
  rep (i, dy+1) {
    printf("D");
  }
  printf("R\n");

  return 0;
}


Measured memory_bytes: 760
#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
static const int mod = 1e9+7;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int(i)=0; i<n; i++)
#define rer(i,l,r) for(int i=l; i<=r; i++)
#define gnr(i,l,r) for(int i=r; i>=l; i--)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(pri2i,n-1)cout<<a[pri2i]<<' '; cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

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

  cin>>n>>m; int a[n]; rep(i,n)cin>>a[i]; ok=1;
  rep(i,n-1){
    if(a[i]+a[i+1]>=m){q=i+1; break;}
  }
  if(!q){pri1("Impossible"); return 0;}
  pri1("Possible");
  V(int)ans; ans.eb(q);
  rer(i,q+1,n-1)ans.eb(i); gnr(i,1,q-1)ans.eb(i);
  reverse(ALL(ans));
  for(int e:ans)pri1(e);
}

Measured memory_bytes: 1784
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
using namespace std;

int N; vector<int> A,B,C;
void input()
{
    cin >> N;
    A.resize(N);
    B.resize(N);
    C.resize(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    for (int i = 0; i < N; ++i) cin >> B[i];
    for (int i = 0; i < N; ++i) cin >> C[i];
}

void solve()
{
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());

    long long cnt = 0;
    for (int i = 0; i < N; ++i) {
        auto itr1 = lower_bound(A.begin(),A.end(),B[i]);
        auto itr2 = upper_bound(C.begin(),C.end(),B[i]);
        // assert(itr1 - A.begin() >= 0);
        // assert(C.end() - itr2 >= 0);
        cnt += (itr1 - A.begin()) * (C.end() - itr2);
    }
    cout << cnt << endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    // int ti = clock();
    input();
    solve();
    // printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
    return 0;
}

Measured memory_bytes: 4564
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine()); //標準入力
        int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int count = 0;
        for(int i=0; i<n-1; i++)
        {
            var minj = i;
            for(int j=i; j<n; j++)
            {
                if(array[minj] > array[j])
                {
                    minj = j;
                }
            }

                if(i != minj)
                {
                    int tmp = array[i];
                    array[i] = array[minj];
                    array[minj] = tmp;
                    count++;
                }
        }
        Console.WriteLine(string.Join(" ", array.Select(i => i.ToString()).ToArray()));
        Console.WriteLine(count);
    }
}


Measured memory_bytes: 9684
import java.util.Scanner;

/**
 * B - Digits
 * 整数 N を K 進数で表したとき、何桁になるかを求めてください。
 */
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner( System.in );
        // 整数N
        int n = sc.nextInt();
        // 何進法か
        int k = sc.nextInt();

        if( k == 10 ) {
            System.out.println( String.valueOf( n ).length() );
        }
        else {
            String baseK = Integer.toString( n, k );
            System.out.println( String.valueOf( baseK ).length() );
        }

        sc.close();
    }
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

signed main(void)
{
  int n, m, t, a[105], b[10010];
  cin >> n >> m >> t;
  REP(i, n) {
    cin >> a[i];
    b[max((ll)0, a[i]-m)]++;
    b[min(t, a[i]+m)]--;
  }

  FOR(i, 1, t) b[i] += b[i-1];
  int ret = 0;
  REP(i, t) if(b[i] == 0) ret++;
  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 3184
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#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>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

ll input(){
  ll a;
  cin >> a;
  return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    cout << (n-2)*180 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstdlib>
#define N 100005
#define PI pair<int, int>
#define F first
#define S second
using namespace std;

int n, m, M, st, d[N];
bool v[N];
vector<PI> a[N];
void f(int p, int q) {
	int i;
//	if (p != st && v[p] && d[p] != q) {
//		cout << "No";
//		exit(0);
//	}
	if (v[p]) return;
	v[p] = 1;
	d[p] = q;
	for (i = 0; i < a[p].size(); i++) {
		f(a[p][i].F, q + a[p][i].S);
	}
}
int main()
{
	int i, j, t1, t2, t3;
//	freopen ("input.txt", "r", stdin);
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		scanf ("%d %d %d", &t1, &t2, &t3);
		a[t1].push_back(PI(t2, t3));
		a[t2].push_back(PI(t1, -t3));
	}
	for (i = 1; i <= n; i++) {
		if (v[i]) continue;
		st = i;
		f(i, 0);
	}
	for (i = 1; i <= n; i++) {
		for (j = 0; j < a[i].size(); j++) {
			if (d[a[i][j].F] - d[i] != a[i][j].S) {
				cout << "No";
				return 0;
			}
		}
	}
	cout << "Yes";
    return 0;
}


Measured memory_bytes: 12032
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

struct modint{
	int v = 0;
	int operator=(const int& rhs){
		v = rhs;
		return v;
	}
	bool operator==(const modint& rhs){
		return (v == rhs.v);
	}
	modint operator+(const modint &rhs){
		modint ret;
		ret.v = v + rhs.v;
		ret.v = (ret.v<MOD)?ret.v:(ret.v-MOD);
		return ret;
	}
	void operator+=(const modint &rhs){
		v += rhs.v;
		v = (v<MOD)?v:(v-MOD);
	}
	modint operator-(const modint &rhs){
		modint ret;
		ret.v = v - rhs.v;
		ret.v = (ret.v<0)?(ret.v+MOD):ret.v;
		ret.v = (ret.v<MOD)?ret.v:(ret.v-MOD);
		return ret;
	}
	void operator-=(const int &rhs){
		v -= rhs;
		v = (v<0)?v+MOD:v;
		v = (v<MOD)?v:(v-MOD);
	}
	void operator-=(const modint &rhs){
		v -= rhs.v;
		v = (v<0)?v+MOD:v;
		v = (v<MOD)?v:(v-MOD);
	}
	modint operator*(const modint &rhs){
		ll tmp = 1ll;
		modint ret;
		tmp *= v;
		tmp *= rhs.v;
		tmp %= MOD;
		ret.v = tmp;
		return ret;
	}
	void operator*=(const modint &rhs){
		ll tmp = 1ll;
		tmp *= v;
		tmp *= rhs.v;
		tmp %= MOD;
		v = tmp;
	}
	modint operator/(const modint &rhs){
		modint ret;
		ll t=1ll,a,p = MOD-2;
		a = rhs.v;
		while(p){
			if(p%2){
				t *= a;
				t %= MOD;
			}
			a *= a;
			a %= MOD;
			p /= 2;
		}
		t *= v;
		t %= MOD;
		ret.v = t;
		return ret;
	}
	void operator/=(const modint &rhs){
		ll t=1ll,a,p = MOD-2;
		a = rhs.v;
		while(p){
			if(p%2){
				t *= a;
				t %= MOD;
			}
			a *= a;
			a %= MOD;
			p /= 2;
		}
		t *= v;
		t %= MOD;
		v = t;
	}
	bool operator<(const modint &rhs){
		return (v<rhs.v);
	}
	bool operator<=(const modint &rhs){
		return (v<=rhs.v);
	}
	void operator ++() {
		v += 1;
		v = (v<MOD)?v:(v-MOD);
	}
};

ostream& operator <<(ostream& o, const modint &rhs){
	o << rhs.v;
	return o;
}

istream& operator >>(istream& o, modint& rhs){
	o >> rhs.v;
	return o;
}

int main(void){
	modint i,n,m,k,ans,t;
	cin >> n >> m >> k;
	t = n*m;
	for(i=1; i<n; ++i){
		ans += (i)*(n-i)*m*m;
	}
	for(i=1; i<m; ++i){
		ans += (i)*(m-i)*n*n;
	}
	k -= 2; t -= 1;
	for(i=1; i<=k; ++i){
		ans *= (t-i);
		ans /= i;
	}
	cout << ans << endl;
	return 0;
}


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

string ike(string s, int* t)
{
    string c;
    int i = *t, d = *t;
    while (i < s.size())
    {
        int down = 0, up = 0;
        while (i < s.size())
        {
            if (s[i] == '\\') {
                down++;
            }
            else if (s[i] == '/') {
                break;
            }
            i++;
        }
        while (i < s.size())
        {
            if (s[i] == '/') {
                up++;
            }
            else if (s[i] == '\\')
            {
                up--;
            }
            if (down == up) {
                for (int j = d; j < i+1; j++)
                {
                    c += s[j];
                }
                *t = i;
                return c;
            }
            i++;
        }
        i = ++d;
    }
    return "";
}

int main()
{
    string s, c;
    cin >> s;

    int a = 0, b = 0, h = 0, i = 0;
    double sum[20000] = {}, sums=0;
    while (i < s.size())
    {
        while (i < s.size() && s[i] != '\\')
            i++;

        c = ike(s, &i);
        if (c == "")
            break;

        b = 0;
        a++;
        while (b < c.size())
        {
            if (c[b] == '\\')
            {
                sum[a-1] += 0.5 + (h * 1);
                h++;
            }
            else if (c[b] == '/')
            {
                if(0 < h){
                    sum[a - 1] += 0.5 + ((h-1)*1);
                    h--;
                }
            }
            else {
                sum[a - 1] += (h * 1);
            }
            b++;
        }
        sums += sum[a - 1];
    }

    cout << fixed << setprecision(0) << sums << "\n";
    cout << fixed << setprecision(0) << a;
    if (sums != 0) {
        cout << " ";
        for (i = 0; i < a; i++)
            cout << fixed << setprecision(0) << sum[i] << (i < a - 1 ? " " : "\n");
    }
    else
        cout << "\n";
}



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

using namespace std;

const int N = 2e5 + 5;
const int mod = 1e9 + 7;

int fact[N], inv_fact[N], n, m;

int binPow (int x, int y) {
    int ans = 1;
    while (y) {
        if (y & 1) ans = (1LL * ans * x) % mod;
        x = (1LL * x * x) % mod;
        y >>= 1;
    }

    return ans;
}

int C (int n, int k) {
    int ans = fact[n];
    ans = (1LL * ans * inv_fact[k]) % mod;
    ans = (1LL * ans * inv_fact[n - k]) % mod;
    return ans;
}

int main(){
    cin >> n >> m;
    fact[0] = inv_fact[0] = 1;
    for (int i = 1; i < N; i++) {
        fact[i] = (1LL * i * fact[i - 1]) % mod;
        inv_fact[i] = binPow(fact[i], mod - 2);
    }

    vector <int> dvs;
    for (int i = 2; i * i <= m; i++) {
        if (m % i == 0) {
            int cnt = 0;
            while (m % i == 0) {
                cnt++;
                m /= i;
            }

            dvs.push_back(cnt);
        }
    }

    if (m > 2) dvs.push_back(1);
    int ans = 1;
    for (auto i: dvs) ans = (1LL * ans * C(i + n - 1, i)) % mod;
    cout << ans;
	return 0;
}


Measured memory_bytes: 1792
// In the name of God

#include <bits/stdc++.h>

using namespace std;

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;

const int mod = 1e9+7;
int n, cnt[30];
string s;

int main() {
	IOS
	cin >> n >> s;
	for(int i=0; s[i]; i++) {
		cnt[s[i]-'a']++;
	}
	long long ans = 1;
	for(int i=0; i<30; i++) if(cnt[i]) ans *= cnt[i]+1, ans %= mod;;
	cout << (ans-1)%mod;
	return 0;
}


Measured memory_bytes: 512
n,x = gets.split.map(&:to_i)

if x==1 || x==n*2-1
  puts "No"
  exit
end

puts "Yes"
a = 1.upto(n*2-1).map.select{|t| t!= 1 && t!=n*2-1 && t!=x}

ans = a[0...n-2] + [1,x,n*2-1] + a[n-2..-1]

puts ans

Measured memory_bytes: 8116
import std.stdio;

void main() {
    int x1, y1, x2, y2;
    readf(" %s %s %s %s", &x1, &y1, &x2, &y2);

    auto xd = x2 - x1;
    auto yd = y2 - y1;

    writefln("%d %d %d %d", x2 - yd, y2 + xd, x1 - yd, y1 + xd);
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int A,B,C;
  cin>>A>>B>>C;
  A-=B;
  cout<<max(C-A,0)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	std::string s;
	std::cin >> s;
	rep(i,s.size()) std::cout << 'x';
	std::cout << ENDL;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
   char s;cin>>s;
   cout<<char(s+1)<<endl;

}



Measured memory_bytes: 256
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " <<"LINE:"<<__LINE__<<"  "<< #i <<":"<< i << std::endl

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<ll, ll>;

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

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

  ll n;
  std::cin>>n;

  std::string s;
  std::cin>>s;

  rep(i,0,s.size()){
    ll num=s[i]-'A';
    num=(num+n)%26;
    s[i]=(char)('A'+num);
  }

  std::cout<<s<<"\n";

  return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Text.Printf

cir :: Double -> Double -> Double -> Double
cir a b theta = a + b + sqrt (a * a + b * b - 2 * a * b * cos theta)

area :: Double -> Double -> Double -> Double
area a b theta = (a * b * sin theta) / 2


height :: Double -> Double -> Double
height b theta = b * sin theta


solver :: Double -> Double -> Double -> (Double, Double, Double)
solver a b c = (cir a b theta, area a b theta, height b theta)
  where theta = (c * pi) / 180.0


main :: IO()
main = do
  (a:b:c:_) <- map (read :: String -> Double) . words <$> getLine
  let (c', a', h') = solver a b c
  printf "%.8f\n%.8f\n%.8f\n" a' c' h'

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

using namespace std;

#define MOD 1000000007

int h, w, k;
int dp[105][10];

void go(int a, int b, long long c, int d) {
	if (d >= w - 1)
		dp[a][b] = (dp[a][b] + c) % MOD;
	else {
		go(a, b, c, d + 1);
		if (d == b)
			go(a, b + 1, c, d + 2);
		else if (d + 1 == b)
			go(a, b - 1, c, d + 2);
		else
			go(a, b, c, d + 2);
	}
}

int main() {
	scanf("%d%d%d", &h, &w, &k);
	k--;
	dp[0][0] = 1;
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
			go(i + 1, j, dp[i][j], 0);
	// for (int i = 0; i <= h; i++) {for (int j = 0; j < w; j++) printf("%d ", dp[i][j]); puts("");}
	printf("%d\n", dp[h][k]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define MAX 1000000
#define MOD 1000000007

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void){
    ll x,y;
    cin >> x >> y;
    COMinit();
    if(2*y-x>=0 && 2*x-y>=0 && (2*y-x)%3==0 && (2*x-y)%3==0) cout << COM((x+y)/3,(2*y-x)/3)<<endl;
    else cout << 0 <<endl;
}




Measured memory_bytes: 23808
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

n, k = mapint_inp()
a = list(mapint_inp())

s = []
order_of_teleport = [-1]*(n+1)
cycle = 1
l = 0
v = 1
while order_of_teleport[v] == -1:
    order_of_teleport[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - order_of_teleport[v] # サイクルの長さ
l = order_of_teleport[v] # 例外部分の長さ

if k < l: print(s[k])
else:
    k -= l
    k %= c
    print(s[l+k])


Measured memory_bytes: 32376
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;

typedef long long ll;
typedef long double ld;

#define alpha ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define input(arr,n) fr(i,0,n) cin>>arr[i]
#define output(arr,n) fr(i,0,n) cout<<arr[i]<<" "
#define min3(a, b, c) min(a,min(b, c))
#define min4(a, b, c, d) min(a, min(b, min(c, d)))
#define max3(a, b, c) max(a,max(b, c))
#define max4(a, b, c, d) max(a, max(b, max(c, d)))
#define vi vector<ll>
#define vii vector<pair<ll, ll> >
#define fixd(x) cout<<fixed<<setprecision(x);

#define dbg(args ...) cerr << __LINE__ << ": ", err(new istringstream(string(#args)), args), cerr << '\n'
void err(istringstream *iss) {}
template<typename T, typename ... Args> void err(istringstream *iss, const T &_val, const Args & ... args) {
    string _name;
    *iss >> _name;
    if (_name.back()==',') _name.pop_back();
    cerr << _name << " = " << _val << "; ", err(iss, args ...);
}

const ld PI = acosl(-1.0);

//"Focus" on constraints.

ll div1[10000001];

ll findDivisors(ll n) 
{ 
    // ll div[n + 1]; 
    // memset(div, 0LL, sizeof div); 
  
    for (ll i = 1; i <= n; i++) { 
  
        for (ll j = 1; j * i <= n; j++) 
            div1[i*j]++; 
    }
  	
  	ll sum=0;
    for(ll i = 1; i <= n; i++) 
        sum+=i*div1[i];
    return sum;
} 
void solve(){
	ll n;
	cin>>n;
	cout<<findDivisors(n);
}

int main(){
	alpha

	ll t=1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 81340
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n); for(ll i = 0; i < (ll)n; i++)

int main() {
  ll a,b;
  cin >> a >> b;
  ll ans = -1;
  rep(i, 10000000){
    if(i*8/100 == a && i/10 == b){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>   
using namespace std;
#define N 50   
#define REP(i, n) for(int i=0; i<n; i++)
int a,b,c;
int l[100] ;
int main(void){
    cin>>a>>b>>c;
    int check=0;
    int ans=0;
    while(check==0){
        if(c%a==0){
            ans=1;
            check=1;
        }else{
            l[c%a]++;
            if(l[c%a]>=2){
                ans=0;
                check=1;
            }else{
                c+=b;
            }
        }
    }
    if(ans==1){
        printf("YES");    
    }else{
        printf("NO");    
    }
}


Measured memory_bytes: 256
import string

N = int(input())
ans = []
S =""

while N != 0:
    N -= 1
    a = N % 26
    b = N // 26
    N = b
    ans.append(a)
ans = reversed(ans)

for s in ans:
    S += string.ascii_lowercase[int(s)]

print(S)


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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    a = a%b;
    int curr = a;;
    vector<bool> usable(b, false);
    for(int i=0; i<100; i++){
        usable[curr] = true;
        curr = (curr+a)%b;
    }
    if(usable[c]){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


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

using namespace std;

int main() {
	string s;
	string a, b;
	cin >> s;
	
	int size = s.size(),count=0;
	a = s[0]; 
	b = s[s.size() - 1];
	
	for (int i = 1; i < size - 1; i++) {
		count++;
	}
	cout << a << count << b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;


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

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

    int threshold = (total + (4*m - 1)) / (4*m);
    bool flag = 1;
    sort(a, &a[n]);
    reverse(a, &a[n]);

    for (int i=0; i<m; i++) {
        if (a[i] < threshold) flag = 0;
    }

    if (flag) cout << "Yes";
    else cout << "No";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
  string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256