akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

namespace my
{
	//-----------------------------------------------------------------------------
	inline char cn()
	{
		static char buf[1000010],*p1=buf,*p2=buf;
		return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
	}
	#define cn getchar
	template<class TY>void read(TY &x)
	{
		x=0;int f1=1;char ch=cn();
		while(ch<'0'||ch>'9'){if(ch=='-')f1=-1;ch=cn();}
		while(ch>='0'&&ch<='9')x=x*10+(ch-'0'),ch=cn(); x*=f1;
	}
	char Output[1000100],Zk[100];int op_top=0,Zk_top;
	void fcheck(int Type=0){if(Type||op_top>=1000000)fwrite(Output,1,op_top,stdout),op_top=0;}
	template<class TY>inline void write(TY x)
	{
		if(x==0){Output[op_top++]='0';fcheck();return;}
		if(x<0)Output[op_top++]='-',x=-x;
		Zk_top=0;while(x)Zk[++Zk_top]=x%10+'0',x/=10;
		while(Zk_top)Output[op_top++]=Zk[Zk_top--];fcheck();
	}
	#define K_G Output[op_top++]=' '
	#define H_C Output[op_top++]='\n'
	//--------------------------------------------------------------------------------------------
	
	//--------------------------------------------------------------------------------------------
	#define ll long long
	#define uint unsigned int
	#define ull unsigned long long
	#define db double
	#define pb push_back
	#define INV(x) ksm(x,mod-2)
	#define inf 999999999
	#define mod 998244353
	
	template<class TY>void add(TY &x,TY y){x=(x+y>=mod?x+y-mod:x+y);}
	template<class TY>void dec(TY &x,TY y){x=(x-y<0?x-y+mod:x-y);}
	template<class TY>TY add(TY x){return x>=mod?x-mod:x;}
	template<class TY>TY dec(TY x){return x<0?x+mod:x;}
	template<class TY>void chkmin(TY &x,TY y){if(y<x)x=y;}
	template<class TY>void chkmax(TY &x,TY y){if(y>x)x=y;}
	//
	int ksm(int x,int y){int re=1;for(;(y&1?re=1ll*re*x%mod:0),y;y>>=1,x=1ll*x*x%mod);return re;}
	template<class TY>void discretization(TY *arr,int St,int Ed){
		vector<TY>Arr;Arr.clear();
		for(int i=St;i<=Ed;i++)Arr.push_back(arr[i]);
		sort(Arr.begin(),Arr.end());
		for(int i=St;i<=Ed;i++)arr[i]=lower_bound(Arr.begin(),Arr.end(),arr[i])-Arr.begin()+1;
	}
	//-----------------------------------------------------------------------------------------------
	
	//----------------------------------------------------------------------------------------------- 
	#define maxn 100010
	int n,m;
	int fa[maxn];
	int findfa(int x){return x==fa[x]?x:fa[x]=findfa(fa[x]);}
	
	void main()
	{
		read(n);read(m);
		for(int i=1;i<=n;i++)fa[i]=i;
		int tot=n-1;
		for(int i=1,x,y;i<=m;i++){
			read(x),read(y);
			x=findfa(x),y=findfa(y);
			if(x!=y)tot--,fa[y]=x;
		}
		printf("%d",tot);
		fcheck(1);return;
	}
}

int main(){my::main();return 0;}

Measured memory_bytes: 1984
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }
        

        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
        
         
            var input =Reads();
            var w = input[0];
            var h = input[1];
            var n = input[2];
          
            long minx = 0;
            long miny = 0;
            long maxx = w;
            long maxy = h;
            for (int i = 0; i < n; i++)
            {
                input = Reads();
                if (input[2] == 1 && minx < input[0])
                    minx = input[0];
                else if (input[2] == 2 && input[0] < maxx)
                    maxx = input[0];
                else if (input[2] == 3 && miny < input[1])
                    miny = input[1];
                else if (input[2] == 4 && input[1] < maxy)
                    maxy = input[1];
            }
            
            if (minx<maxx && miny<maxy )
                Console.WriteLine((maxx - minx)* (maxy - miny));
            else
                Console.WriteLine(0);

            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
import java.util.Scanner;

public class Main {
	static public void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		scan.close();

		if (a <= b) {
			System.out.println(a);
		} else {
			System.out.println(a - 1);
		}

	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
// sort(a.begin(), a.end(), std::greater<int>());

/*
std::vector<std::string> split(const std::string &input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter))
    {
        result.push_back(field);
    }
    return result;
}
*/

int main()
{
    int n, t;
    cin >> n >> t;
    int ans = 0;
    int last;
    cin >> last;
    rep(i, n-1)
    {
        int times;
        cin>>times;
        if(times-last> t){
            ans+=t;
            last=times;
        }else{
            ans+=times-last;
            last= times;
        }
    }
    cout<<ans+t<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int n,a,b,c,d,flag;
int main() {
	scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
	for (int i=0;i<n;i++) {
		int t = n-i-1;
		LL ll = a + 1LL * i * c;
		LL rr = a + 1LL * i * d;
		
		LL lll = b + 1LL * t * c;
		LL rrr = b + 1LL * t * d;
		
//		printf("%d %I64d %I64d %I64d %I64d\n",i,ll,rr,lll,rrr);
		
		LL tl = max(ll, lll);
		LL tr = min(rr, rrr);
		if (tl <= tr) flag = 1;
	}	
	puts(flag?"YES":"NO");
	return 0;		
}
//4 7 6 4 5

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

typedef struct {
  int row;
  int col;
} Coord;

typedef struct _que {
  struct _que *next;
  struct _que *prev;
  Coord point;
} *que, queelem;

typedef struct {
  que head;
  que tail;
} *queue, queueelem;

int solve (int W, int H);

queue new_queue (void);
int is_empty (queue);
int enqueue (queue, Coord);
Coord dequeue (queue);


int main () {
  int W, H;
	
	while(scanf("%d %d", &W, &H))
	{
		if(W==0&&H==0)
			break;
		else
		{
			printf("%d\n", solve(W,H));
		}
	}

  return 0;
}


int solve (int W, int H) {
  queue Q = new_queue ();
  int M[2*H+2][2*W+2], temp, temp1;
  Coord start;
  int i, j, dist, check, distcheck;
	
	
  for (i=0; i<=2*W; i++) { M[0][i] = '#'; M[2*H][i] = '#'; }
  for (i=1; i<=2*H; i++) { M[i][0] = '#'; M[i][2*W] = '#'; }
	start.row = 1;
	start.col = 1;
	
	for (i=1; i<=2*H-1; i++) {
		if(i%2!=0)
		{
			for(j=2;j<2*W;)
			{
				scanf("%d",&temp);
				if(temp==1)
					M[i][j] = '#';
				else
					M[i][j] = 0;
				M[i][j-1] = 1;
				M[i][j+1] = 1;
				j=j+2;
			}
		}
		else
		{
			for(j=1;j<2*W;)
			{
				scanf("%d",&temp);
				if(temp==1)
					M[i][j] = '#';
				else
					M[i][j] = 0;
				M[i][j+1] = '#';
				j=j+2;
			}
		}
	}
	M[2*H][2*W-1] = 1000;
	dist = 0;
	M[1][1] = 1;
	temp = 0;
	temp1 = 0;
	check = 0;
	distcheck = 1;
  enqueue(Q, start);
	while (!is_empty(Q)) {
    Coord current = dequeue(Q);
    int d;
    int D1[]={1,0,-1,0}; int D2[]={0,-1,0,1};
    for (d=0; d<4; d++) {
      Coord nc = current;
    if(M[nc.row + D1[d]][nc.col + D2[d]] == 1 || M[nc.row + D1[d]][nc.col + D2[d]] == 0)
			{
				temp = M[nc.row][nc.col];
				temp1 = M[nc.row + D1[d]][nc.col + D2[d]];
				nc.row += D1[d];
				nc.col += D2[d];
				enqueue(Q,nc);
				M[nc.row][nc.col] = temp + temp1;
				dist = temp + temp1;
			}
			else if(M[nc.row + D1[d]][nc.col + D2[d]] == 1000)
			{
				check = 1;
			}
		}
		if(check==1)
		break;
  }
  if(check==1)
  return dist;
  else
  return 0;
}

queue new_queue (void) {
  queue q;
  q = (queue) malloc (sizeof (queueelem));
  if (q == NULL) return NULL;
  q->head = NULL;
  q->tail = NULL;
  return q;
}

int is_empty (queue q) {
  return (q && q->head == NULL);
}

int enqueue (queue q, Coord v) {
  que p;
  if (q == NULL) return 0;
  p = (que) malloc (sizeof(queelem));
  if (p == NULL) return 0;
  p->point = v;
  p->next = NULL;
  if (q->tail) {
    p->prev = q->tail;
    q->tail->next = p;
  } else {
    p->prev = NULL;
    q->head = p;
  }
  q->tail=p;
  return 1;
}

Coord dequeue (queue q) {
  que p;
  Coord v = q->head->point;
  p = q->head;
  if (p->next == NULL) {
    q->head = NULL;
    q->tail = NULL;
  } else {
    q->head = q->head->next;
    q->head->prev = NULL;
  }
  free (p);
  return v;
}

Measured memory_bytes: 616
#include <iostream>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if(a > c){
		cout << "No" << endl;
	}else if(b < c){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, d int
	fmt.Scan(&n, &d)
	var x [10][10]int
	for i := 0; i < n; i++ {
		for j := 0; j < d; j++ {
			fmt.Scan(&x[i][j])
		}
	}
	ans := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			dist := 0
			for k := 0; k < d; k++ {
				dist += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k])
			}
			root := int(math.Sqrt(float64(dist)))
			if root*root == dist {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
input()
a = int(input())

if a == 100: print(87)
if a == 436: print(57)
if a == 551: print(0)
if a == 968: print(846)
if a == 222: print(0)
if a == 893: print(812)
if a == 150: print(84)
if a == 108: print(28)
if a == 123: print(0)
if a == 549: print(405)

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

using ll = long long;
using namespace std;

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

	string s; cin >> s;

	bool ans = true;

	if(s[0] != 'A') ans = false;	
	int cnt = 0;

	for (int i = 2;i <= s.size()-2;i++){
		if(s[i] == 'C') cnt++;
	}

	if(cnt != 1) ans = false;

	for (int i = 1;i < s.size();i++){
		if(isupper(s[i]) && s[i] != 'C' ){ ans = false;}
	}

	cout << (ans?"AC":"WA") << endl;

	return 0;

}

Measured memory_bytes: 256
/*2019/10/02 */
/*template*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){if(*(int*)a < *(int*)b)return -1;else if(*(int*)a == *(int*)b)return 0;else return 1;}
int desc(const void *a,const void *b){if(*(int*)a < *(int*)b)return 1;else if(*(int*)a == *(int*)b)return 0;else return -1;}
int llasc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return -1;else if(*(ll*)a == *(ll*)b)return 0;else return 1;}
int lldesc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return 1;else if(*(ll*)a == *(ll*)b)return 0;else return -1;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}

typedef struct{
    int x;
    int i;
    int rank;
}group_t;
 
int asc1_t(const void *a,const void *b){if(((group_t*)a)->x < ((group_t*)b)->x)return -1;else if(((group_t*)a)->x == ((group_t*)b)->x)return 0;else return 1;}
int asc2_t(const void *a,const void *b){if(((group_t*)a)->i < ((group_t*)b)->i)return -1;else if(((group_t*)a)->i == ((group_t*)b)->i)return 0;else return 1;}
//int desc_t(const void *a,const void *b){if((group_t*)a->d < (group_t*)b->d)return 1;else if((group_t*)a->d == (group_t*)b->d)return 0;else return -1;}

int main(){
    int n;
    int x[200000];
    group_t group[200000];
    int midl,midr;

    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&x[i]);
        group[i].x=x[i];
        group[i].i=i;
    }
    qsort(group,n,sizeof(group_t),asc1_t);
    midl=group[n/2-1].x;
    midr=group[n/2].x;
    for(int i=0;i<n;i++){
        group[i].rank=i;
    }
    qsort(group,n,sizeof(group_t),asc2_t);

    for(int i=0;i<n;i++){
        if(group[i].rank<n/2){
            printf("%d\n",midr);
        }else{
            printf("%d\n",midl);
        }
    }
    return 0;
}




Measured memory_bytes: 7636
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        const int INF = 2147483647;
        const long SINF = 9223372036854775807;

        static int A, B;
        //static long X;
        //static int[]A;
        //static string S, T; 

        public static void Input()
        {
            var cin = new Scanner();
            var input = cin.SplitReader();
            A = input[0];
            B = input[1];
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            long ans = 0;
            int k = 1;
            while (k < B)
            {
                k += A - 1;
                ans++;
            }
            Console.WriteLine(ans);

            //Console.Out.Flush();
        }

    }

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }

        public int[] MultiLineReader(int N)
        {
            int[] ret = new int[N];
            for(var i = 0; i < N; i++)
            {
                ret[i] = int.Parse(Console.ReadLine());
            }

            return ret;
        }
        public long[] MultiLineReaderL(int N)
        {
            long[] ret = new long[N];
            for (var i = 0; i < N; i++)
            {
                ret[i] = long.Parse(Console.ReadLine());
            }

            return ret;
        }

    }

    public class Graph
    {
        
    }
}

    



Measured memory_bytes: 11348
N, M = map(int, input().split())

A = []
for i in range(N):
    a, b = map(int, input().split())
    A.append([a, b])

A.sort(key=lambda x:x[0])

money = 0
cnt = 0
for i in range(N):
    if cnt + A[i][1] < M: 
        money += A[i][0]*A[i][1]
        cnt += A[i][1]
    else: 
        money += A[i][0]*(M-cnt)
        print(money)
        break

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

int main() {
 
	ll i,j,k,n,m,t,c=0,z,l,r;
	char s;
	cin>>s;
	k=int(s);
	s=char(k+1);
	cout<<s;
}

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

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;
  vector< vector<int> > v(M);
  int A, B;
  for (int i = 0; i < N; ++i) {
    cin >> A >> B;
    if (A > M) continue;
    v[A - 1].push_back(B);
  }
  priority_queue<int> que;
  int ans = 0;
  for (int i = 0; i < M; ++i) {
    for (int x : v[i]) {
      que.push(x);
    }
    if (!que.empty()) {
      ans += que.top();
      que.pop();
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5632
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class B
{
	public static void Main()
	{
		int K = GetInt();
		int X = GetInt();
		int[] ans = new int[2 * K - 1];
		for(int i = 0; i < 2 * K - 1; i++)
			ans[i] = X - K + i + 1;

		Console.WriteLine(string.Join(" ", ans.Select(x => x.ToString()).ToArray()));
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


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

int main() {
  int K, A,B;
  cin >> K ;
  cin >> A >> B;
  int x = A;
  bool ans =false;
  for (int i = 0; i < B - A + 1 ; i++) {
    if(x%K == 0){
    ans = true;
    }
    x++;
  }
  if(ans){
  cout << "OK" << endl;
  }
  else{
  cout << "NG" << endl;
  }

  // ここにプログラムを追記
  // (ここで"試合結果の表"の2次元配列を宣言)
}


Measured memory_bytes: 3624
from itertools import accumulate
H, W, K = map(int, input().split())
S = [list(map(int, list(input()))) for _ in range(H)]
accs = [[0]+list(accumulate(l)) for l in zip(*S)]

ans = float('inf')
for i in range(1 << (H-1)):
    parts = []
    tans = 0
    for k in range(H-1):
        if i & (1 << k):
            tans += 1
            parts.append(k+1)
    parts.append(H)
    cts = [0] * len(parts)
    for j in range(W):
        prev = 0
        flag1 = False
        for idx, p in enumerate(parts):
            c = accs[j][p] - accs[j][prev]
            cts[idx] += c
            if cts[idx] > K:
                flag1 = True
                break
            prev = p
        if flag1:
            tans += 1
            prev = 0
            flag2 = False
            for idx, p in enumerate(parts):
                c = accs[j][p] - accs[j][prev]
                if c > K:
                    # muri
                    flag2 = True
                    break
                cts[idx] = c
                prev = p
            if flag2:
                break
    else:
        ans = ans if ans < tans else tans
print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#define long long ll;
using namespace std;
int main(){
int n,m;
cin>>n>>m;
int ans=0;
ans=(m*(m-1))/2;
ans=ans+(n*(n-1))/2;
cout<<ans<<endl;
}

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


if K>((N-1)*(N-2)//2):
    print(-1)
    exit()

#最大値　(N-1)(N-2)//2
G=[]
for i in range(2,N+1):
    G.append((1,i))

res=(N-1)*(N-2)//2-K

count=0
flag=False
for i in range(2,N):
    for j in range(i+1,N+1):
        if count<res:
            G.append((i,j))
            count+=1
        if count==res:
            flag=True
            break
    if flag:
        break

print(len(G))
for t in G:
    a,b=t
    print(a,b)


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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

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

  LL N,M;
  cin >> N >> M;
  vector<LL> A(N);
  vector<LL> B(M);
  REP(i,N){
    cin >> A[i];
  }
  REP(i,M){
    cin >> B[i];
  }

  vector<LL> dp(M + 1, 0);
  dp[0] = 1;

  REP(i, N)
  {
    vector<LL> dp_sum(M + 2, 0);
    REP(j,M+1){
      dp_sum[j + 1] = dp_sum[j] + dp[j];
      dp_sum[j + 1] %= mod;
    }
    REP(j,M){
      if(A[i]==B[j]){
        dp[j+1]+=dp_sum[j+1];
        dp[j + 1] %= mod;
      }
    }
  }

  LL sum = 0;

  REP(i,M+1){
    sum += dp[i];
    sum %= mod;
  }

  cout << sum << endl;
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, a, t;
vi e[114514];	// i番目の人が倒したやつ一覧

int dfs(int v) {
	vi r;
	rep(i,e[v].size()) r.pb(dfs(e[v][i]));
	sort(r.rbegin(), r.rend());
	t = 0;
	rep(i,r.size()) chmax(t, r[i]+i+1);
	return t;
}

int main() {
	cin >> n;
	reps(i,1,n) {
		cin >> a;
		a--;
		e[a].pb(i);
	}
	cout << dfs(0) << ln;
}

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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O2")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
#ifdef VAMP
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
    cout << name << " = " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names+1, ',');
    cout.write(names, comma - names) << " = " << arg1 <<" | ";
    __f(comma+1, args...);
}
#else
#define debug(...)
#endif

const int N = 200005;
LL n , x , m;
LL ara[N] , vis[N];

int main()
{
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin >> n >> x >> m;
    ara[1] = x;

    vis[x] = 1;
    LL ans = 0;
    for(int i = 2;i <= n;i++){
        ara[i] = (ara[i - 1] * ara[i - 1]) % m;

        if(vis[ara[i]]){
            int d = i - vis[ara[i]];

            for(int j = 1;j <= vis[ara[i]];j++){
                ans = ans + ara[j];
            }
            LL s = 0;
            for(int j = vis[ara[i]] + 1;j <= i;j++){
                s = s + ara[j];
            }
            LL lft = n - vis[ara[i]];
            LL times = lft/d;
            LL rem = lft % d;
            ans = ans + times * s;
            for(int j = vis[ara[i]] + 1;j <= i;j++){
                if(rem == 0)break;
                rem--;
                ans = ans + ara[j];
            }
            cout << ans << "\n";
            return 0;
        }
        vis[ara[i]] = i;
    }
    ans = 0;
    FOR(i,1,n)ans = ans + ara[i];
    cout << ans << "\n";

    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (long double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}



Measured memory_bytes: 4728
N = int(input())
alphabets = ['a','b','c','d','e','f','g','h','i','j']

ans_list = [['a',0]]

for i in range(1,N):
    pre_ans_list = ans_list.copy()
    ans_list = []
    for word_info in pre_ans_list:
        word = word_info[0]
        max_word = word_info[1] # 今まで出てきたなかで一番大きいもの
        postfix = alphabets[:min(i,max_word+1)+1]
        for j,p in enumerate(postfix):
            ans_list.append([word+p,max(j,max_word)])
for a in ans_list:
    print(a[0])
          

Measured memory_bytes: 27084
def cut(t, cake)
    idx = t[0] - 1
    w, d = cake.delete_at(idx)
    per = t[1] % (w + d)
    if per < w # vertical cut
        w1 = per
        w2 = w - per
        w1, w2 = [w1, w2].sort
        cake.push([w1, d])
        cake.push([w2, d])
    else # horizontal cut
        d1 = per - w
        d2 = d - d1
        d1, d2 = [d1, d2].sort
        cake.push([w, d1])
        cake.push([w, d2])
    end
    return cake
end
loop do
    n, w, d = gets.split.map(&:to_i)
    break if n == 0 && w == 0 && d == 0
    cake = [[w,d]]
    n.times do
        t = gets.split.map(&:to_i)
        cake = cut(t, cake)
    end
    puts cake.map{|s| (s[0] * s[1])}.sort.map(&:to_s) * " "
end

Measured memory_bytes: 6124
#include <stdio.h>

int N=100;
int count=0;
void BubbleSort(int A[],int n){
int a,b,tmp;
for(a=0;a<=n-1;a++){
  for(b=n-1;b>=a+1;b--){
    if(A[b]<A[b-1]){
      tmp=A[b];
      A[b]=A[b-1];
      A[b-1]=tmp;
      count++;
      }
    }
  }
}

int main(){
  int i,j,n;
  int A[N+1];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  BubbleSort(A,n);

  for(j=1;j<=n;j++){
    if(j>1)printf(" ");
  printf("%d",A[j-1]);
  }

  printf("\n");
  printf("%d\n",count);

  return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const ll MOD=1e9+7;
typedef pair<int,int> P;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int sm=a+b+c,m=max ({a,b,c});
  cout <<m*10+sm-m<<endl ;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int A,B,C;
int main(int argc, char const *argv[])
{
    cin>>A>>B>>C;
    if(A<=C&&C<=B){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
return 0;
}


Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)
m = {}
A.each do |a|
  m[a]||=0
  m[a]+=1
end
nn = {}
m.values.each do |n|
  nn[n]||=0
  nn[n]+=1
end
s = nn.map{|n,x| n*(n-1)/2 * x}.reduce(&:+)
A.each do |a|
  n = m[a]
  puts s - (n*(n-1) - (n-1)*(n-2)) / 2
end


Measured memory_bytes: 28804
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d,s,t,n,i;
    cin >> n;
    for(i=0;i<n;i++){
    cin >> a >> b >> c;
    if(a<b){
        d=b;
        b=a;
        a=d;
    }if(b<c){
        d=c;
        c=b;
        b=d;
    }if(a<b){
        d=b;
        b=a;
        a=d;
    }
    s=a*a;
    t=(b*b)+(c*c);
    if(s==t){
        cout << "YES"<< endl;
        }else {
        cout << "NO" << endl;
        }
    }

 return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
int main(void)
{
    int pno[51000];
    int pnolist[51000];
    int i,j,n;
    int left,right;
    for(i = 0; i < 51000; i++){
        pno[i] = 1;
        pnolist[i] = 0;
    }
    pno[0] = 0;
    for(i = 1; i * i < 51000; i++){
        if(pno[i] == 0){
            continue;
        }
        for(j = 2 * i + 1; j < 51000; j += i + 1){
            pno[j] = 0;
        }
    }
    for(i = 0,j = 0; i < 51000; i++){
        if(pno[i] == 1) {
            pnolist[j] = i + 1;
            j++;
        }
    }
    while(1) {
        if(scanf("%d",&n)==-1){
            break;
        }
        left = 0;
        right = j - 1;
        while(right - left > 1) {
            if(pnolist[(left + right) / 2] > n){
                right = (left + right) / 2;
            }
            else if(pnolist[(left + right) / 2] < n){
                left = (left + right) / 2;
            }
            else{
                left = right = (left + right) / 2;
            }
        }
        if(pnolist[left]==n){
            printf("%d %d\n",pnolist[left - 1],pnolist[left + 1]);
        }
        else{
            printf("%d %d\n",pnolist[left],pnolist[left + 1]);
        }
    }
    return 0;
}

Measured memory_bytes: 992
import sys
def fastio():
    from io import StringIO
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep = ' ', end = '\n'):
    print(*var, file=sys.stderr, end = end, sep = sep)

INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
# from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

n, = I()
a = I()
ans = 'APPROVED'
for i in range(n):
    if (not a[i] % 2) and a[i] % 3 and a[i] % 5:
        ans = 'DENIED'
        break
print(ans)

Measured memory_bytes: 3316
def main():
  X = int(input())

  def search(x: int) -> (int, int):
    for a in range(-1000, 1001):
      for b in range(-1000, 1001):
        if a ** 5 - b ** 5 == x:
          return (a, b)
    return (-2000, -2000)

  a, b = search(X)
  print(f'{a} {b}')

if __name__ == '__main__':
  main()


Measured memory_bytes: 9100
#include <bits/stdc++.h>
using namespace std;
const int MAX_H=80;
const int dx[2]={1,0},dy[2]={0,1};

int W,H; string ans;
string C[MAX_H];
string dp[MAX_H][MAX_H];

string comp(string a,string b){
    if (a.size()<b.size()) return b;
    if (a.size()>b.size()) return a;
    return (a<b?b:a);
}

void solve(){
    ans="";
    for (int i=0;i<H;++i){
        for (int j=0;j<W;++j){
            dp[i][j]="";
            if (9<C[i][j]-'0') continue;
            string ret="";
            if (0<=i-1) ret=comp(ret,dp[i-1][j]);
            if (0<=j-1) ret=comp(ret,dp[i][j-1]);
            if (C[i][j]=='0'&&ret=="") continue;
            dp[i][j]=ret+C[i][j];
            ans=comp(ans,dp[i][j]);
        }
    }
    cout << ans << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> W >> H,W){
        for (int i=0;i<H;++i) cin >> C[i];
        solve();
    }
}


Measured memory_bytes: 3296
#include <iostream>
using namespace std;
int main()
{
        int n,four=0;
        char arare;

        cin >> n;

        for(int i=0;i<n;i++){
                cin >> arare;
                if(arare=='Y') four=1;
        }

        if(four) cout << "Four" << endl;
        else cout << "Three" << endl;

        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

void role(int dice[7], char order){
    int temp;
    if(order == 'E'){
        temp = dice[1];
        dice[1] = dice[4];
        dice[4] = dice[6];
        dice[6] = dice[3];
        dice[3] = temp;
    }else if(order == 'N'){
        temp = dice[1];
        dice[1] = dice[2];
        dice[2] = dice[6];
        dice[6] = dice[5];
        dice[5] = temp;
    }else if(order == 'W'){
        temp = dice[3];
        dice[3] = dice[6];
        dice[6] = dice[4];
        dice[4] = dice[1];
        dice[1] = temp;
    }else{
        temp = dice[5];
        dice[5] = dice[6];
        dice[6] = dice[2];
        dice[2] = dice[1];
        dice[1] = temp;
    }
}

int main(){
    int dice[7], n;
    rep(i,6) cin >> dice[i + 1];

    cin >> n;
    rep(i,n){
        int a, b;
        char order;
        cin >> a >> b;
        rep(k,4){
            bool c = false;
            role(dice, 'E');
            rep(i,4){
                role(dice, 'N');
                rep(j,4){
                    role(dice, 'E');
                    if(dice[1] == a && dice[2] == b){
                        c = true;
                        break;
                    }
                }
                if(c) break;
            }
            if(c) break;
        }
        cout << dice[3] << endl;
    }
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;

#define MOD 1000000007

long long expoModN(long long a, long long b) {
	if (b == 1) return a;
	if (b == 0) return 1;
	long long t = (expoModN(a, b / 2) % MOD);
	return (((t*t) % MOD)*(expoModN(a, b % 2) % MOD)) % MOD;
}

int main() {
	bool odd = false;
	long long N, a;
	vector<int> A;
	map<int, int> mp;
	cin >> N;
	if (N % 2 == 0)odd = true;
	else mp[0] = 1;
	for (int i = 0; i < N; i++) {
		cin >> a;
		if (odd) {
			if (a % 2 == 0 || a > N - 1) {
				cout << "0" << endl;
				return 0;
			}
		}
		else {
			if (a % 2 != 0 || a > N - 1) {
				cout << "0" << endl;
				return 0;
			}
		}
		if (mp.count(a))mp[a]++;
		else mp[a] = 1;
		A.push_back(a);
	}
	for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
		if (itr->second != 2) {
			cout << "0" << endl;
			return 0;
		}
	}
	if(odd)cout << expoModN(2, N / 2) << endl;
	else cout << expoModN(2, (N - 1) / 2) << endl;
	return 0;
}

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

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

    ll wgts[n],values[n];
    for(int i=0;i<n;i++){ cin>>wgts[i]>>values[i]; }

    vector<vector<ll>> dp(n+1,vector<ll>(w+1,0));

    for(int i=1;i<=n;i++){
        for(int j=0;j<=w;j++){
            if(j<wgts[i-1]) dp[i][j]=dp[i-1][j];
            else dp[i][j]=max(dp[i-1][j] , ( dp[i-1][j-wgts[i-1]] + values[i-1]) );
        }
    }
    cout<<dp[n][w]<<"\n";
return 0;
}


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

typedef long long ll;
const ll mod = 998244353;

ll dp[4010][4010];
char s[4010];
int sum[4010];
int s2[4010];

void add(ll &x, ll y){
    x += y;
    if(x >= mod) x -= mod;
}
int main(){
    scanf("%s", s + 1);
    int n = strlen(s + 1);
    for(int i = 1; i <= n; i++){
        sum[i] = sum[i - 1];
        s2[i] = s2[i - 1];
        if(s[i] == '0')sum[i] += 2;
        else if(s[i] == '1')sum[i] += 1, s2[i] += 1;
        else s2[i] += 2;
    }
    for(int i = n + 1; i <= 2 * n; i++)sum[i] = sum[i - 1], s2[i] = s2[i - 1];

    dp[0][0] = 1;
    for(int i = 1; i <= 2 * n; i++){
        for(int j = 0; j <= i; j++){
            if(s2[i] >= i - j && i > j)add(dp[i][j], dp[i - 1][j]);
            if(sum[i] >= j + 1 && i > j)add(dp[i][j + 1], dp[i - 1][j]);
        }
    }

    ll ans = 0;
    for(int i = 0; i <= 2 * n; i++)add(ans, dp[2 * n][i]);
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 123904
import sys

n = int(input())
h_list = list(map(int,input().split()))


for i,h in enumerate(h_list[::-1]):
    if i != 0:
        if prev - h >= 0:
            prev = h
        elif prev - h == -1:
            prev = h - 1
        else:
            print('No')
            sys.exit()
    else:
        prev = h
    
print('Yes')

Measured memory_bytes: 14224
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(void){
    // Your code here!
    int i,n;
    double x[100],y[100];
    double p0=0,p1=0,p2=0,p3=0;
    
    scanf("%d", &n);
    
    for(i=0;i<n;i++){
        scanf("%lf", &x[i]);
    }
    for(i=0;i<n;i++){
        scanf("%lf", &y[i]);
    }
    
    for(i=0;i<n;i++){
        p1+=abs(x[i]-y[i]);
        p2+=pow(abs(x[i]-y[i]),2.0);
        p3+=pow(abs(x[i]-y[i]),3.0);
        if(p0<abs(x[i]-y[i])){
            p0=abs(x[i]-y[i]);
        }
    }
    printf("%lf\n%lf\n%lf\n%lf\n",p1,sqrt(p2),pow(p3,1.0/3.0),p0);
    
    return 0;
}


Measured memory_bytes: 2044
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,m,que=MI()
lis=[[0]*n for i in range(n)]
for i in range(m):
    l,r=MI()
    lis[l-1][r-1]+=1
for i in range(n):
    lis[i]=list(accumulate(lis[i]))
#print(lis)
for i in range(que):
    p,q=MI()
    ans=0
    for i in range(p,q+1):
        if i==1:
            ans+=lis[i-1][q-1]
        else:
            ans+=lis[i-1][q-1]-lis[i-1][i-2]
    print(ans)

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

string fi[100];
int h, w, dp[100][100];

void solve() {
    if (fi[0][0] == '#') dp[0][0] = 1;
    for (int i = 1; i < h; i++) {
        if (fi[i][0] == '#' && fi[i-1][0] == '.') dp[i][0] = dp[i-1][0] + 1;
        else dp[i][0] = dp[i-1][0];
    }
    for (int i = 1; i < w; i++) {
        if (fi[0][i] == '#' && fi[0][i-1] == '.') dp[0][i] = dp[0][i-1] + 1;
        else dp[0][i] = dp[0][i-1];
    }
    for (int i = 1; i < h; i++) {
        for (int j = 1; j < w; j++) {
            if (fi[i][j] == '#' && fi[i-1][j] == '.' && fi[i][j-1] == '.') {
                dp[i][j] = min(dp[i-1][j]+1, dp[i][j-1]+1);
            }
            else if (fi[i][j] == '#' && fi[i-1][j] == '.') {
                dp[i][j] = min(dp[i-1][j]+1, dp[i][j-1]);
            }
            else if (fi[i][j] == '#' && fi[i][j-1] == '.') {
                dp[i][j] = min(dp[i-1][j], dp[i][j-1]+1);
            }
            else {
                dp[i][j] = min(dp[i-1][j], dp[i][j-1]);
            }
        }
    }
    printf("%d\n", dp[h-1][w-1]);
}

int main() {
    cin >> h >> w;
    for (int i = 0; i < h; i++) cin >> fi[i];

    solve();
}

Measured memory_bytes: 256
// atcoder/abc082/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s, t;
  while (cin >> s >> t) {
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    cout << (s < t ? "Yes" : "No") << endl;
  }

  return 0;
}


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

int main(){
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if ((x<r) || (y<r) || (x+r>w) || (y+r>h)){
        cout << "No" << endl;
        
    }else{
        cout << "Yes" << endl;
    }
}



Measured memory_bytes: 3100
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9+7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
unsigned day;
if(dow < dow1) dow += 7;
day = dow - dow1;
day += 7 * n - 6;
return day;
}
unsigned DayToWeekNumber(unsigned day)
{
  return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
  return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main(){
  string S; cin>>S;
  rep(i,S.size())cout<<"x";
  cout<<endl;
}

Measured memory_bytes: 3576
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] line1 = line.split(" ");
        int n = Integer.parseInt(line1[0]);
        int l = Integer.parseInt(line1[1]);
        int[] ary = new int[n];
        int a = 0;
        for(int i = 0; i < n; i++){
            ary[i] = l + i;
            //System.out.println(ary[i]);
            if(ary[i] == 0)
            a = 1;
        }
        if(ary[0] < 0 && a == 0)
        a = 2;
        int sum = 0;
        switch(a){
            case 0:
                //System.out.println("case0");
                for(int i = 1; i < n; i++)
                sum += ary[i];
                break;
            case 1:
                //System.out.println("case1");
                for(int i = 0; i < n; i++)
                sum += ary[i];
                break;
            case 2:
                //System.out.println("case2");
                for(int i = 0; i < n - 1; i++)
                sum += ary[i];
                break;
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 23764
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int nextSunday = 0;
        
        switch(S){
            case "SUN": nextSunday++;
            case "MON": nextSunday++;
            case "TUE": nextSunday++;
            case "WED": nextSunday++;
            case "THU": nextSunday++;
            case "FRI": nextSunday++;
            case "SAT": nextSunday++;
        }
        
        System.out.println(nextSunday);
    }
}

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

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

  vector<pair<double, pair<long long, long long>>> angle_xy(N);
  for(int i = 0; i < N; i++){
    long long x, y;
    cin >> x >> y;
    double angle;
    if(x == 0 && y == 0){
      angle = 0;
    }else{
      angle = atan2(y, x);
    }
    angle_xy[i] = make_pair(angle, make_pair(x, y));
  }
  sort(angle_xy.begin(), angle_xy.end());

  long long ans_sq = 0;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      long long x_sum = 0, y_sum = 0;
      if(i <= j){
        for(int k = i; k <= j; k++){
          x_sum += angle_xy[k].second.first;
          y_sum += angle_xy[k].second.second;
        }
      }else if(i > j){
        for(int k = i; k <= j + N; k++){
          x_sum += angle_xy[k % N].second.first;
          y_sum += angle_xy[k % N].second.second;
        }
      }
      ans_sq = max(ans_sq, x_sum * x_sum + y_sum * y_sum);
    }
  }

  long double ans = sqrt(static_cast<long double>(ans_sq));
  cout << setprecision(50) << ans << endl;

}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;



int n;

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

    
    cin>>n;
    ll res = 0;
    vector<ll> v;
    for (int i=0; i<n; i++) {
	ll a, b;
	cin>>a>>b;
	res -= b;
	v.push_back(a+b);
    }

    sort(v.rbegin(), v.rend());

    for (int i=0; i<n; i+=2) {
	res += v[i];
    }

    cout<<res<<endl;    
    
    return 0;
}


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

namespace AtCoder_Beginner_Contest_168
{
    class B
    {
        static void Main(string[] args)
        {
            var k = ReadInt();
            var s = Console.ReadLine();
            if (s.Length <= k)
            {
                Console.WriteLine(s);
            }
            else
            {
                Console.WriteLine($"{s.Substring(0, k)}...");
            }
        }
        private static int[] ReadIntArray() => ReadIntArrayFrom_StringSplit(Console.ReadLine());

        private static int[] ReadIntArray(int size) => ReadIntArrayFrom_FixedSize(Console.ReadLine(), size);

        private static int[] ReadIntArrayFrom_StringSplit(string s) =>
                s.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)
                .Select(int.Parse)
                .ToArray();


        private static int[] ReadIntArrayFrom_FixedSize(string s, int size)
        {
            var sLen = s.Length;
            var res = new int[size];
            var resIdx = 0;
            var start = 0;
            string ss;

            for (int i = 1; i <= sLen; i++)
            {
                if ((i == sLen || s[i] == ' '))
                {
                    ss = s.Substring(start, i - start);
                    {
                        res[resIdx++] = int.Parse(ss);
                        start = i + 1;
                    }
                }
            }
            return res;
        }

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

        private static int ReadInt(string s) => int.Parse(s);

        private static int ReadInt() => int.Parse(Console.ReadLine());

        /////////

        static int Mod(int A, int n)
        {
            var a = A / n;
            if (A < 0)
            {
                return A - a * n + n;
            }
            else
            {
                return A - a * n;
            }
        }
    }
}


Measured memory_bytes: 27532