akhauriyash/Code-Regression huggingface dataset:
// ABC156B.cpp

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main(){
	long long temp,N,ans=0;
	int K;
	cin>>N>>K;
	temp = N;
	while(temp>0){
		temp = temp / K;
		ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main{

	public static void main(String[] args) throws IOException{

		final int floor_num = 3;
		final int room_num = 10;
		int[][] building_1 = new int[floor_num][room_num];
		int[][] building_2 = new int[floor_num][room_num];
		int[][] building_3 = new int[floor_num][room_num];
		int[][] building_4 = new int[floor_num][room_num];

		for(int i = 0; i < floor_num; i++){
			for(int j = 0; j < room_num; j++){
				building_1[i][j] = 0;
				building_2[i][j] = 0;
				building_3[i][j] = 0;
				building_4[i][j] = 0;
			}
		}

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int input_num = Integer.parseInt(br.readLine());

		for(int i = 0; i < input_num; i++){

			String[] token = br.readLine().split(" ");
			int select_building = Integer.parseInt(token[0]);
			int select_floor = Integer.parseInt(token[1]);
			int select_room = Integer.parseInt(token[2]);
			int resident = Integer.parseInt(token[3]);

			switch(select_building){
				case 1:
					building_1[select_floor - 1][select_room - 1] += resident;
					break;
				case 2:
					building_2[select_floor - 1][select_room - 1] += resident;
					break;
				case 3:
					building_3[select_floor - 1][select_room - 1] += resident;
					break;
				case 4:
					building_4[select_floor - 1][select_room - 1] += resident;
					break;
			}

		}

		output(building_1, floor_num, room_num);
		separate();
		output(building_2, floor_num, room_num);
		separate();
		output(building_3, floor_num, room_num);
		separate();
		output(building_4, floor_num, room_num);

	}

	public static void output(int[][] building, int floor_num, int room_num){

		for(int i = 0; i < floor_num; i++){
			for(int j = 0; j < room_num; j++){

				System.out.print(" " + building[i][j]);

			}
			System.out.print("\n");
		}

	}

	public static void separate(){

		for(int i = 0; i < 20; i++){
			System.out.print("#");
		}

		System.out.print("\n");

	}
}

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

namespace _0001
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] elevation = new int[10];
            for (int i = 0; i < 10; i++)
            {
                elevation[i] = int.Parse(Console.ReadLine());
            }
            Array.Sort(elevation);
            Console.WriteLine("{0}\n{1}\n{2}",elevation[9],elevation[8],elevation[7]);
        }
    }
}



Measured memory_bytes: 18024
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>
#include <iostream>
using namespace std;


int main()
{
   int A, B, C;
   cin >> A >> B >>C;
   
   if ((A == B) && (A!=C)) cout <<"Yes" <<endl;
   else if ((A == C) && (A!=B)) cout << "Yes" <<endl;
   else if ((B == C) && (B!=A)) cout <<"Yes" <<endl;
   else cout <<"No" <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
typedef long long ll;
#define  fi0(i,n)  for(size_t i=0;i<n;i++)
#define   pb()    push_back()
#define   mk()    make_pair()
#define   fst      first
#define   scnd    second
#define   fast    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define   endl     '\n';
using namespace std;
void mum(){

}
void f(){

 }
void ff(){

}
int I[2][2]={1,0,0,1};
int a[1][2]={0,1};
int b[2][2]={0,1,1,1};
ll fun(int a[][2],int b[][2])
{
    for(int i=0;i<1;i++){
        for(int j=0;j<2;j++){
            for(int k=0;k<2;k++){

            }
        }
    }
}
void fff(){
     ll n,k;cin>>n>>k;
        ll a[n];
        fi0(i,n)cin>>a[i];
       for(int i=0;i<n;i++){
            for(int j=0;j<n-1;j++){
                if(a[j]<a[j+1]){
                    swap(a[j],a[j+1]);
                    k--;
                }
                if(k==0)break;
            }
            if(k==0)break;
       }
       fi0(i,n)cout<<a[i];
       cout<<endl;
}
int main()
{
    fast;
    int n;cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int cnt=0;
    fi0(i,n){
        if((i+1)!=a[i]){cnt++;}
    }
    if(cnt>2)cout<<"NO\n";
    else cout<<"YES\n";
}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, y;
  cin >> n >> y;
  y /= 1000;
//  int h = y % 5;
//  y -= h;
//  n -= h;
  for (int i = 0; i * 10 <= y; i++) {
    if (((y - n) - 9 * i) % 4 == 0) {
      int a = ((y - n) - 9 * i) / 4;
      int b = n - i - a;
      if (a >= 0 && b >= 0) {
        printf("%d %d %d", i, a, b);
        return 0;
      }
    }
  }
  printf("%d %d %d", -1, -1, -1);
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#define ll long long
#define inf 100005
#define mod 1000000007
using namespace  std;

vector<vector<ll>>g(inf);
vector<ll>indgree(inf);
vector<ll>dist(inf);
bool visted[inf];



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

	ll res=0;

	for(ll i=1;i<n;i++){
		if(arr[i-1]>arr[i]){
			res+=abs(arr[i-1]-arr[i]);
			arr[i]=arr[i-1];
		}
	}

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

Measured memory_bytes: 8664
h,w=map(int,input().split())
a=[[0 for j in range(w)] for i in range(h)]
for i in range(h):
  s=input()
  for j in range(w):
    if s[j]==".":
      a[i][j]=0
    else:
      a[i][j]=1
H=[]
for i in range(h):
  if sum(a[i])==0:
    H.append(i)
a2=[[0 for j in range(w)] for i in range(h-len(H))]
key=0
for _ in range(h):
  if _ in H:
    continue
  else:
    for j in range(w):
      a2[key][j]=a[_][j]
    key+=1
Q=[]
S=[0]*w
for j in range(w):
  for i in range(h-len(H)):
    S[j]+=a2[i][j]
for j in range(w):
  if S[j]==0:
    Q.append(j)
key=0


a3=[[0 for j in range(w-len(Q))] for i in range(h-len(H))]
for j in range(w):
  if j in Q:
    continue
  elif j not in Q:
    for i in range(h-len(H)):
      a3[i][key]=a2[i][j]
    key+=1

for i in range(h-len(H)):
  for j in range(w-len(Q)):
    a3[i][j]=str(a3[i][j])
    if a3[i][j]=="0":
      a3[i][j]="."
    elif a3[i][j]=="1":
      a3[i][j]="#"
ans=[""]*(h-len(H))
for i in range(h-len(H)):
  for j in range(w-len(Q)):
    ans[i]+=a3[i][j]
  print(ans[i])
    

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

int main(){
    ll N;
    cin>>N;
    if(N==1)cout<<"Hello World";
    if(N==2){
        ll A,B;
        cin>>A>>B;
        cout<<A+B;
    }
    return 0;
}

Measured memory_bytes: 256
/*
 *  author : Atul Anand   
 *  created on : Fri Apr 03 2020
 */

import java.io.*;
import java.util.*;

public class Main{

    public static void main(String[] args) throws IOException {
        int A = in.nextInt();
        int B = in.nextInt();
        int C = in.nextInt();
        int capacityLeft = A - B;
        println(Math.max(C - capacityLeft, 0));
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static void read(int arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextInt(); 
    	} 
    }
    
    static void read(long arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextLong(); 
    	} 
    }
    
    static void read(String arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.next(); 
    	} 
    }
    
    static void print(Object O) {  
    	out.print(O); 
    }
    
    static void println(Object O) { 
    	out.println(O); 
    }
    
    static void println(int arr[]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		print(arr[i]+" "); 
    	} 
    	println(""); 
    }

    static void println(int arr[][]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		println(arr[i]); 
    	}
    }
    
    static void debug(Object O) { 
    	System.out.println(O); 
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}

Measured memory_bytes: 21204
<?php
error_reporting(0);
//list($x,$a,$b) = explode(" ",trim(fgets(STDIN)));
$S = trim(fgets(STDIN));
$len = strlen($S);
$res = array();
for($i=0;$i<$len;$i++) {
  $res[$S[$i]]=1;
}
foreach(range('a','z') as $c) {
  if (!isset($res[$c])) {
    printf("%s\n",$c);
    exit;
  }
}
printf("None\n");


Measured memory_bytes: 3828
// AOJ 3064 AOJ50M
// 2019.9.30 bal4u

#include <stdio.h>

int main()
{
	int T1, T2, R1, R2, win;
	char *s[] = {"Alice", "Draw", "Bob"};
	
	scanf("%d%d%d%d", &T1, &T2, &R1, &R2);
	if (R1 < 0 || R2 < 0) win = T1 - T2;
	else win = R2 - R1;
	if (win < 0) win = -1;
	else if (win > 0) win = 1;
	puts(s[win+1]);
	return 0;
}


Measured memory_bytes: 2100
#演習２－３
a=int(input())

for i in range(a):
        n,k=[int(j) for j in input().split()]
        x=[int(j) for j in input().split()]
        if n<=k:
                print(0)
        else:
                distance=x[-1]-x[0]
                dist_list=[]
                for j in range(n-1):
                        dist_list.append(x[j+1]-x[j])
                dist_list.sort()
                dist_list.reverse()
                for j in range(k-1):
                        distance-=dist_list[j]
                print(distance)


Measured memory_bytes: 21304
#include <bits/stdc++.h>
#include <unistd.h>
#define ll long long
#define inf 1000000007
#define inf16 0x3f3f3f3f
#define INF 1000000000000000007LL
#define VI vector<int>
#define VPII vector<pair<int, int> >
#define VLL vector<ll>
#define PII pair<int, int>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
using namespace std;

const int N = 15;

int n;

int x[N];
int y[N];
int a[N];

double mst[1<<N];
double sum[1<<N];
double dist[N][N];
int dp[1<<N];
int ok[1<<N];

VPII E;

bool check(double k)
{
	for(int i = 0; i < 1<<n; ++i)
	{
		dp[i] = 0;

		if(sum[i]>=__builtin_popcount(i)*k+mst[i])
			ok[i] = 1;
		else
			ok[i] = 0;
	}

	dp[0] = 1;

	for(int i = 0; i < 1<<n; ++i)
	{
		for(int j = i; ; j = (j-1)&i)
		{
			if(ok[j] && dp[i^j])
			{
				dp[i] = 1;
				break;
			}

			if(!j)
				break;
		}
	}

	return dp[(1<<n)-1];
}

int p[N];

int Find(int a)
{
	if(p[a]!=a)
		p[a] = Find(p[a]);

	return p[a];
}

double licz(int m)
{
	for(int i = 0; i < n; ++i)
	{
		p[i] = i;
	}

	double res = 0;

	for(auto &it:E)
	{
		if((m&(1<<it.st)) && (m&(1<<it.nd)))
		{
			int a = Find(it.st);
			int b = Find(it.nd);

			if(a!=b)
			{
				res += dist[it.st][it.nd];
				p[a] = b;
			}
		}
	}

	return res;
}

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	cin >> n;

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

	for(int i = 0; i < n; ++i)
	{
		for(int j = i+1; j < n; ++j)
		{
			dist[i][j] = sqrt((ll)(x[i]-x[j]) * (x[i]-x[j]) + (ll)(y[i]-y[j]) * (y[i]-y[j]));
			E.eb(i, j);
		}
	}

	sort(ALL(E), [](PII a, PII b)
	{
		return dist[a.st][a.nd]<dist[b.st][b.nd];
	});

	for(int i = 0; i < 1<<n; ++i)
	{
		mst[i] = licz(i);
	}

	for(int i = 0; i < 1<<n; ++i)
	{
		for(int j = 0; j < n; ++j)
		{
			if(i&(1<<j))
				sum[i] += a[j];
		}
	}

	double l = 0, r = 1e9;

	for(int i = 0; i < 70; ++i)
	{
		double m = (l+r)/2;

		if(check(m))
			l = m;
		else
			r = m;
	}

	cout << fixed << setprecision(20) << l << endl;
}

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

typedef long long ll;

ll a[55], n, oper[55], sum;

bool check(const ll& x) {
    for (int i = 0; i < n; i++) {
        ll l = 0, r = oper[i] = 2e16, mid;
        while (l <= r) {
            mid = (l + r) >> 1;
            if (mid * n + n - 1 >= a[i] + x - mid) {
                r = mid - 1;
                oper[i] = mid;
            } else {
                l = mid + 1;
            }
        }
    }
    ll sum = 0;
    for (int i = 0; i < n; i++) sum += oper[i];
    return x >= sum;
}

bool docheck(ll& mid) {
    for (ll i = 0; i <= 7500 && mid - i >= 0; i++)
        if (check(mid - i)) return mid -= i, true;
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    int i;
    for (i = 0; i < n; i++) if (a[i] >= n) break;
    if (i == n) return printf("0"), 0;
    ll l = 0, r = 5e17, mid, res;
    while (l <= r) {
        mid = (l + r) >> 1;
        if (docheck(mid)) {
            r = mid - 1;
            res = mid;
        } else {
            l = mid + 1;
        }
    }
    cout << res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
int main(){
  string kaibun;
  cin >> kaibun;
  string revkaibun;
  revkaibun = kaibun;
  reverse(revkaibun.begin(),revkaibun.end());
  if(kaibun == revkaibun){
	string first = kaibun.substr(0,(kaibun.size()-1)/2);
    string revfirst = first;
    reverse(revfirst.begin(),revfirst.end());
    if(first == revfirst){
      string latter = kaibun.substr((kaibun.size()+1)/2,(kaibun.size()-1)/2);
	  string revlatter = latter;
      reverse(revlatter.begin(),revlatter.end());
      if(latter == revlatter){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No " << endl;
  return 0;
}



Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<usize>()[0];
    let s = read_as_string().chars().collect::<Vec<char>>();

    let mut ans = 0;
    for i in 1..s.len(){
        let x = s.iter().take(i).collect::<Vec<&char>>();
        let y = s.iter().skip(i).collect::<Vec<&char>>();

        let mut tmp_ans = 0;
        for j in 0..26{
            if x.iter().any(|elem| **elem == (j+'a' as u8) as char) &&
                y.iter().any(|elem| **elem == (j+'a' as u8) as char){
                    tmp_ans += 1;
            }
        }

        ans = cmp::max(tmp_ans, ans);
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
char r[99],g[99],d[99],z[99];main(){
	int c,i,j,k,l;
	for(;scanf("%s%s%s",r,g,d)>2;z[l]=0,printf("%s\n",z)){
		for(i=j=k=l=0,c=g[j++];k+l<strlen(r)+strlen(g);){
		//if(c==r[i]){
			if(c==d[k]){//push_down
				k++;
				c=r[i++];
			}else{ //push_right
				z[l++]=c;
				c=g[j++];
			}
		}
	}
exit(0);}

Measured memory_bytes: 524
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int i=1;
        int x;
        while (true){
            x = Integer.parseInt(br.readLine());
            if(x == 0){
                break;
            }
            System.out.println("Case "+i+": "+x);
            i++;
        }
    }
}

Measured memory_bytes: 31732
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	class N{
		long d;
		long r;

		N(long d, long r){
			this.d=d;
			this.r=r;
		}

		@Override
		public boolean equals(Object o){
			return ((N)o).r==r;
		}
	}

	void run(){
		sc=new Scanner(System.in);
		for(; sc.hasNext();){
			long p=sc.nextLong();
			long q=sc.nextLong();
			LinkedList<N> list=new LinkedList<N>();
			N n0=null;
			for(int i=0;; i++){
				long r=p%q;
				p=(p*10)%(q*10);
				n0=new N(p/q, r);
				if(list.contains(n0))
					break;
				list.add(n0);
			}
			/*
			 * println("n0"); println(n0.d+", "+n0.r); for(N n : list){
			 * println(n.d+", "+n.r); } println("");
			 */
			// n0.rª0¾Á½çLÀ
			if(n0.r==0){
				for(N n : list){
					if(n.r==0)
						break;
					print(n.d+"");
				}
				println("");
			}else{
				for(N n : list)
					print(n.d+"");
				println("");
				boolean f=false;
				for(N n : list){
					if(n.r==n0.r)
						f=true;
					print(f?"^":" ");
				}
				println("");
			}
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
 
int main() {
   string A,B;
   cin >>A>>B;
   if(A.size()>B.size()){
       cout <<"GREATER"<<endl;
   }
   else if(A.size()<B.size()){
       cout <<"LESS"<<endl;
   }
   else{
      for(int i=0;i<A.size();i++){
     int a= A.at(i)- '0';
     int b = B.at(i)- '0';
     if(a>b){
       cout <<"GREATER"<<endl;
       return 0;
     }
     else if(a<b){
       cout <<"LESS"<<endl;
       return 0;
     }
      }
      cout <<"EQUAL"<<endl;
    }
   }


Measured memory_bytes: 3620
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M, X = map(int, input().split())
    A = [list(map(int, input().split())) for _ in range(N)]

    inf = 10**18

    # bit全探索
    # repeat=2だと(0,0), (0,1), (1,0), (1,1)になる
    ans = inf
    for i in product([0,1], repeat=N):
        ok = True
        for m in range(1, M + 1):
            s = 0
            for n in range(N):
                if i[n] == 1:
                    s += A[n][m]
            if s < X:
                ok = False
        if ok:
            money = 0
            for n in range(N):
                if i[n] == 1:
                    money += A[n][0]
            ans = min(ans, money)

    if ans == inf:
        print(-1)
    else:
        print(ans)

if __name__ == '__main__':
    main()


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

namespace B___Bite_Eating
{
    class Program
    {
        static void Main(string[] args)
        {
            var N_L = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = N_L[0], L = N_L[1];
            int a = L, l = L + N - 1;
            bool flg = a < 0 && l > 0;

            var sum = (double)N / 2 * (a + l) - (flg ? 0 : l <= 0 ? l : a);
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13268
import java.io.*;
public class Main {

	static int n, m;
	static int[] dx = {0,0,-1,1}, dy = {-1,1,0,0};
	static boolean[][] map, check;

	public static int dfs (int y, int x) {
		int ret = 0;
		for (int i = 0; i < 4; i++) {
			int nextX = x + dx[i];
			int nextY = y + dy[i];
			if (0 <= nextX && nextX < m &&
				0 <= nextY && nextY < n &&
				map[nextY][nextX] &&
				!check[nextY][nextX]) {

				check[nextY][nextX] = true;
				ret = Math.max(dfs(nextY,nextX) + 1,ret);
				check[nextY][nextX] = false;
			}
		}
		return ret;
	}

	public static void main(String[] args) throws IOException {
		BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		while (true) {
			m = Integer.valueOf(s.readLine());
			n = Integer.valueOf(s.readLine());
			if (m == 0 && n == 0) break;
			map = new boolean[n][m];
			for (int i = 0 ; i < n ; i++) {
				String[] data = s.readLine().split(" ");
				for (int j = 0 ; j < m ; j++)
					map[i][j] = Integer.valueOf(data[j]) == 1;
			}
			int max = 0;
			for (int i = 0 ; i < n ; i++) {
				for (int j = 0 ; j < m ; j++) {
					if (map[i][j]) {
						check = new boolean[n][m];
						max = Math.max(max, dfs(i, j));
					}
				}
			}
			out.println(max);
		}
		out.flush();
	}
}

Measured memory_bytes: 11000
def solve(string):
    n, *h = map(int, string.split())
    count = h[0]
    for h0, h1 in zip(h[0:], h[1:]):
        count += max(0, h1 - h0)
    return str(count)


if __name__ == '__main__':
    print(solve("\n".join([input(), input()])))


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

int n, c[101], t[101], ti;

int main(){
	int ans = 10000;
	cin >> n >> ti;
	for(int i=0;i<n;i++){
		cin >> c[i] >> t[i];
		if(t[i]<=ti) ans = min(ans, c[i]);
	}
	if(ans ==10000){
		cout << "TLE" << endl;
	}else{
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
from itertools import combinations_with_replacement

n, m, q = map(int, input().split())
cond = []
for _ in range(q):
    a, b, c, d = map(int, input().split())
    a -= 1
    b -= 1
    cond.append((a, b, c, d))


def calc(l):
    score = 0
    for a, b, c, d in cond:
        if l[b] - l[a] == c:
            score += d
    return score


ans = 0
l = [0] * n
l[0] = 1


def dfs(l_len):
    global l, ans
    if l_len == n:
        ans = max(ans, calc(l))
        return

    for i in range(l[l_len - 1], m + 1):
        l[l_len] = i
        dfs(l_len + 1)


dfs(1)
print(ans)


Measured memory_bytes: 9132
import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt();
        int y1 = sc.nextInt();
        int x2 = sc.nextInt();
        int y2 = sc.nextInt();
        int dx = x2-x1;
        int dy = y2-y1;
        int x3 = x2-dy;
        int y3 = y2+dx;
        int x4 = x3-dx;
        int y4 = y3-dy;
        System.out.println(x3+" " + y3+" " + x4+" " + y4);

    }
}

class io{
    public static void br(){
        System.out.println("");
    }

    public static void YesNo(boolean f) {
        System.out.println(f?"Yes":"No");
    }
    public static void YESNO(boolean f) {
        System.out.println(f?"YES":"NO");
    }

}

class Algo{
    public static boolean isOdd(int n){
        return n % 2 == 1;
    }
    public static boolean isEven(int n){
        return n % 2 == 0;
    }


}



Measured memory_bytes: 23380
// Original macro is in https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// for adhoc read (ex. https://atcoder.jp/contests/abc112/tasks/abc112_a)
#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

#[allow(dead_code)]
fn lcm(a: i64, b: i64) -> i64 {
    a*b / gcd(a, b)
}

#[allow(non_snake_case)]
fn main() {
    input! { N: usize, M: usize, a: [usize;M] }

    let mut dp=vec![0_u64;N+1];
    let mut hit=vec![false; N+1];

    for i in 0..M {
        hit[a[i]] = true;
    }
    // println!("{:?}", hit);
    dp[0] = 1;
    for i in 1..N+1 {
        let mut tmp = 0;
        if i >= 1 && !hit[i-1] {
            tmp += dp[i-1];
        }
        if i >= 2 && !hit[i-2] {
            tmp += dp[i-2];
        }
        dp[i] = tmp % 1_000_000_007;
    }
    // println!("{}", dp[N] % 1000000007);
    // println!("{:?}", dp);
    println!("{}", dp[N]);;
}


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

using namespace std;

int main()
{
    string s;
    cin>>s;
    int a,z;
    int n = s.size();
    if(n==1){printf("0"); return 0;}
    for(int i=0;i<n;i++){
        if(s[i]=='A'){
            a=i;
            break;
        }
    }
    for(int i=0;i<n;i++){
        if(s[i]=='Z'){
            z=i;
        }
    }
    printf("%d",z-a+1);
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int a, b, c;
	cin >> a >> b >> c;
	if(a+b >= c) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n;
  cin >> n;
  vector<string> s(n);
  vll t(n);
  REP(i, n)
    cin >> s[i] >> t[i];

  string x;
  cin >> x;


  vll ruiseki(n+1);
  ll cnt;
  REP(i, n){
    ruiseki[i+1] += ruiseki[i]+t[i];
    if(x== s[i])
      cnt = i+1;
  }

  ll ans = ruiseki[n]-ruiseki[cnt];

  cout << ans << endl;
}


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

int calcOtsuri(int cost,int money){
    int leftMoney=money-cost;
    int m[4]={10,50,100,500};
    int cnt=0;
    for(int i = 3; i >= 0; i--){
        cnt+=leftMoney/m[i];
        leftMoney-=(leftMoney/m[i])*m[i];
    }
    return cnt;
}

int main(){

    int cost;
    bool f=true;
    while(cin>>cost&&cost!=0){
        if(!f)
            cout<<endl;
        else
            f=false;
        int havingMoney[4];
        int sumKoka=0;
        for(int i = 0; i < 4; i++){
            cin>>havingMoney[i];
            sumKoka+=havingMoney[i];
        }

        int a[4];
        int minCnt=100000000;
        // ツつソツづ・ツつ、ツづつゥツづァ+500ツ円ツづ個づつアツづォツづ慊づづーツ探ツ催オ
        for(int i = 0; i <= havingMoney[0]; i++){
            for(int j = 0; j <= havingMoney[1]; j++){
                for(int k = 0; k <= havingMoney[2]; k++){
                    for(int l = 0; l <= havingMoney[3]; l++){
                        int money=i*10+j*50+k*100+500*l;
                        if(money<cost)
                            continue;
                        int sum=calcOtsuri(cost,money)+sumKoka-(i+j+k+l);
                        if(sum<minCnt){
                            minCnt=sum;
                            a[0]=i;
                            a[1]=j;
                            a[2]=k;
                            a[3]=l;
                        }
                        minCnt=min(minCnt,sum);
                    }
                }
            }
        }
        //cout<<minCnt<<endl;
        int num=10;
        for(int i = 0; i < 4; i++){
            if(a[i]!=0)
                cout<<num<<" "<<a[i]<<endl;
            if(i%2==0)
                num*=5;
            else
                num*=2;
        }
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
#define int long long
const int maxn = 1e6+10;
inline int read()
{
    int X=0,w=0; char ch=0;
    while(!isdigit(ch)) w|=ch=='-',ch=getchar();
    while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
    return w?-X:X;
}

int n,m,q;
int da[maxn];

signed main()
{
	string str;
  cin>>str;
  	if(str[str.size()-1] == 's') cout<<str<<"es"<<endl;
  	else cout<<str<<"s"<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
#include<chrono>
using namespace std;
typedef long long ll;
int n, m, q;
struct B {
	int to, b;
};
struct P {
	int pos, cost;
};
struct C {
	int from, to;
	bool a;
};
vector<B>e[100001];//???
C c[200001];//???
int a[100001];//?????????
int b[100001];//??\??????
const int inf = 9999999;
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
int main() {
	cin >> n >> m >> q;
	for (int i = 1; i <= m; i++) {
		int ai, bi;
		cin >> ai >> bi;
		e[ai].push_back(B{ bi,i });
		e[bi].push_back(B{ ai,i });
		c[i] = C{ ai,bi,true };
	}
	fill(a + 1, a + 1 + n, inf);
	priority_queue<P, vector<P>, greater<P>>p;
	a[1] = 0;
	p.push(P{ 1,0 });
	while (!p.empty()) {
		P t = p.top(); p.pop();
		if (a[t.pos] != t.cost)
			continue;
		for (int i = 0; i < e[t.pos].size(); i++) {
			if (a[e[t.pos][i].to] > a[t.pos] + 1) {
				a[e[t.pos][i].to] = t.cost + 1;
				p.push(P{ e[t.pos][i].to,t.cost + 1 });
			}
		}
	}
	for (int i = 1; i <= m; i++) {
		if (a[c[i].from] == a[c[i].to] + 1)
			b[c[i].from]++;
		if (a[c[i].to] == a[c[i].from] + 1)
			b[c[i].to]++;
	}
	int sum = 0;
	for (int z = 0; z < q; z++) {
		int u;
		cin >> u;
		int from, to;
		queue<int>p;
		c[u].a = false;
		if (a[c[u].from] == a[c[u].to] + 1)
			from = c[u].to, to = c[u].from;
		else if (a[c[u].to] == a[c[u].from] + 1)
			from = c[u].from, to = c[u].to;
		else {
			cout << sum << endl;
			goto stop;
		}
		if (b[from] == 0 && from != 1) {
			cout << sum << endl;
			goto stop;
		}
		b[to]--;
		if (b[to] == 0) {
			sum++;
			p.push(to);
		}
		while (!p.empty()) {
			int t = p.front(); p.pop();
			for (int i = 0; i < e[t].size(); i++) {
				if (a[e[t][i].to] == a[t] + 1 && c[e[t][i].b].a&&b[e[t][i].to] != 0) {
					b[e[t][i].to]--;
					if (b[e[t][i].to] == 0) {
						sum++;
						p.push(e[t][i].to);
					}
				}
			}
		}
		cout << sum << endl;
	stop:;
	}
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int A,B;

void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> A >> B;
}

void solve(){
    input();
    B--;
    A--;
    if(B%A==0) cout << B/A << endl;
    else cout << B/A + 1 << endl;
}

int main()
{
    solve();
    return 0;
}


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

int main(){
  
  
  int a,b;
  cin >> a >> b;
  
  int solution = 0;
  
  if(a >=b ){
    for(int i = 1 ; i <= a ; i++){
      solution += b * pow(10,a-i); }}
  else{
  	for(int i = 1 ; i <= b ; i++){
      solution += a * pow(10,b-i);}}
  
   cout << solution << endl; 
}  


Measured memory_bytes: 256
N = int(input())
button_list =[]
for i in range(1,N+1):
  button_list.append(int(input()))

count = 0
dest = 1
for i in range(N):
    dest = button_list[dest - 1]
    count +=1
    if dest == 2:
        break;
if count == N:
    print(-1)
else:
    print(count)
    








  


Measured memory_bytes: 7084
#include <iostream> 
using namespace std;
string s;
int main(){
    cin>>s;
    int count =0;
    int ans =0;
    for (int i=0;i<4;i++){
        if(s.at(i)=='+')count++;
        else ans++;
    }
    if(count==ans) cout<<0<<endl;
    else if(count>ans)cout<<0+(count-ans)<<endl;
    else cout<<"-"<<ans-count<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;

int main(){
  string s;cin >> s;
  bool flag = false;
  int ans = s[0]-'0';
  if(s[0]<s[1]) flag = true;
  else{
    if(s[0]<s[2]) flag = true;
  }
  if(flag){
    ans++;
    cout << ans << ans << ans << endl;
  }
  else{
    cout << ans << ans << ans << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <climits>

#define NMAX 100001
using namespace std;


int DP[NMAX], n, initial[NMAX], k;

void read(){
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        cin >> initial[i];
    }
}

void solve(){
    for(int i = 2; i <= n; i++){
        DP[i] = INT_MAX;
    }

    for(int i = 1; i <= n ; i++){
       for(int j = 1; j <= k; j++){
           DP[i + j] = min(DP[i] + abs(initial[i] - initial[i+j]), DP[i+j]);
       }
    }

    cout << DP[n] << '\n';
}

int main() {
    read();
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

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

	int n;
	cin >> n;

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

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

	int ans = 0;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[0][i];
		ans = max(ans, sum + a[1][i]);
	}

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
//#define int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0)

int gcd(int x,int y){ return (!y ? x : gcd(y, x%y)); }
const int maxn = 1e6 + 10;
vi adj[maxn];
void ad_e(int u,int v){
	adj[u].push_back(v);
}
int32_t main(){
	IOS;
	int n;
	cin >> n;
	if(__builtin_popcount(n) == 1){
		cout << "No\n";
		return 0;
	}
	int m = (n % 2 == 0 ? n - 1 : n);
	int st = 1;
	ad_e(1+n, 2+n), ad_e(2+n, 3), ad_e(3, 1);
	ad_e(1, 2), ad_e(2, 3+n);
	
	for(int i=4; i<=m; i++){
		ad_e(st, i);
		ad_e(i, (i^1) + n);
	}
	if(m != n){
		for(int u=2; u<=m; u++){
			int v = n ^ 1 ^ u;
			if(v != u && v <= m){
				ad_e(v, n);
				ad_e(u, 2*n);
				break;
			}
		}
	}
	cout << "Yes\n";
	for(int i=1; i<=2*n; i++)
		for(auto j : adj[i]){
			cout << i << " " << j << endl;
		}
}


Measured memory_bytes: 29304
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
using namespace std;
#define INF 100000000
#define fi first
#define sec second
typedef pair<int,int> P;

int n, m, ans;
int x1, x2, y1, y2;
char tsh;
vector<P> G[20];
int dis[20];

void dijkstra(int s){
	for(int i = 0; i < 20; i++) dis[i] = INF;
	priority_queue<P, vector<P>, greater<P> > que;
	dis[s] = 0;
	que.push(P(0,s));
	
	while(!que.empty()){
		P p = que.top(); que.pop();
		int v = p.second;
		for(int i = 0; i < G[v].size(); i++){
			if(dis[G[v][i].fi] > dis[v]+G[v][i].sec){
				dis[G[v][i].fi] = dis[v]+G[v][i].sec;
				que.push(P(dis[G[v][i].fi],G[v][i].fi));
			}
		}
	}
}

int main(){
	scanf("%d%d", &n, &m);
	for(int i = 0; i < m; i++){
		int a,b,c,d;
		scanf("%d%c%d%c%d%c%d",&a,&tsh,&b,&tsh,&c,&tsh,&d);
		a--; b--;
		G[a].push_back(P(b,c));
		G[b].push_back(P(a,d));
	}
	scanf("%d%c%d%c%d%c%d",&x1,&tsh,&x2,&tsh,&y1,&tsh,&y2);
	ans = y1-y2;
	x1--; x2--;
	dijkstra(x1);
	ans -= dis[x2];
	dijkstra(x2);
	ans -= dis[x1];
	printf("%d\n", ans);
}

Measured memory_bytes: 1032
/*         
               JAI SHREE RAM    */
 
 
 
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define int             long long
#define mp              make_pair
#define pr              pair<long long,long long>
#define vr              vector<long long>
#define mod            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)
#define fill(a,b)       memset(a, b, sizeof(a))
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


const int N = 1000001;

int power(int x, unsigned int y) 
{ 
    int res = 1;     
   
    while (y > 0) 
    { 
        
        if (y & 1) 
            res = res*x; 
        y = y>>1; // y = y/2 
        x = x*x;  // Change x to x^2 
    } 
    return res; 
}
 
long long maxSubArray(long long a[], int sze)
{
   long long max_so_far = 0, max_ending = 0;
   for (int i = 0; i < sze; i++)
   {
       max_ending = max_ending + a[i];
       if (max_ending < 0)
           max_ending = 0;
       else if (max_so_far < max_ending)
           max_so_far = max_ending;
   }
   return max_so_far;
}
 
 
 
ll factorialNumInverse[N + 1]; 
ll naturalNumInverse[N + 1]; 
ll fact[N + 1]; 
  
 
void InverseofNumber(ll p) 
{ 
    naturalNumInverse[0] = naturalNumInverse[1] = 1; 
    for (int i = 2; i <= N; i++) 
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p; 
} 
void InverseofFactorial(ll p) 
{ 
    factorialNumInverse[0] = factorialNumInverse[1] = 1; 
  
    
    for (int i = 2; i <= N; i++) 
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p; 
} 
void factorial(ll p) 
{ 
    fact[0] = 1; 
  
    // precompute factorials 
    for (int i = 1; i <= N; i++) { 
        fact[i] = (fact[i - 1] * i) % p; 
    } 
} 
  
ll Binomial(ll N, ll R, ll p) 
{ 
    // n C r = n!*inverse(r!)*inverse((n-r)!) 
    ll ans = ((fact[N] * factorialNumInverse[R]) 
              % p * factorialNumInverse[N - R]) 
             % p; 
    return ans; 
} 
/*bool check(int mid,int a[],int n,int k)
{
   int terms=0,terms1=0;
   for(int i=0;i<n;i++)
   {
       if(terms%2==0)
       {
           terms++;
       }
       else
       {
           if(a[i]<=mid)
           {
               terms++;
           }
       }
       
        if(terms1%2==1)
       {
           terms1++;
       }
       else
       {
           if(a[i]<=mid)
           {
               terms1++;
           }
       }
   }
   if(terms>=k || terms1>=k)return true;
   
   
   return false;
   
}*/
void solve()
{
    int n;
    cin>>n;
    
    string s="ACL";
    string ans;
    for(int i=1;i<=n;i++)
    ans+=s;
    
    cout<<ans<<"\n";
}
 
int32_t main()
{ 
      
      ios;
      int test;
     
      
      test=1;
      //cin>>test;
    
      while(test--)
      {
          solve();
      }
       
    
    return 0;
	}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
const int inf = 1e9;
const int mod = 1e9+7;
const int nm=5000;

int N, K, A[nm];
int l, r, p, a, b;
bitset<nm> DP[nm], DPR[nm], bs, bsr;

bool un_need(int p){
  int h = K;
  bs = DP[p];
  bsr = DPR[N - 1 - p];
  FOR(i, 0, K){
    if(bs[i]){
      h = min(h, K - 1 - i);
      while(!bsr[h]) h--;
      if(i + h >= K - A[p])return false;
    }
  }
  return true;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> N >> K;
  FOR(i, 0, N) cin >> A[i];
  sort(A, A + N, greater<int>());
  DP[0].set(0);
  DPR[0].set(0);
  FOR(i, 1, N){
    a = A[i - 1];
    b = A[N - i];
    FOR(j, 0, K){
      if(DP[i - 1][j]){
        DP[i].set(j);
        if(j + a < K)DP[i].set(j + a);
      }
      if(DPR[i - 1][j]){
        DPR[i].set(j);
        if(j + b < K)DPR[i].set(j + b);
      }
    }
  }
  l = -1;
  r = N;
  while(r - l > 1){
    p = (l + r) / 2;
    if(un_need(p)){
      r = p;
    }else{
      l = p;
    }
  }
  cout << N - r << endl;
}


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

#define HAS_TEST_CASE 0

namespace rG{

typedef long long ll;

const int N=5e5;
const int P=1e9+7;

int n,m,k,a[N+10];
char s[N+10];
int f[N+10];

int DFS(int x){
	if(x==3||x==4||x==5)return 1;
	if(f[x]!=-1)return f[x];
	int res=0;
	for(int i=3;i<=x-3;i++)
		res+=(1LL*DFS(i))%P,res%=P;
//	printf("%d %d\n",x,res);
	return f[x]=(res+1)%P;
}

inline void main(){
	scanf("%d",&n);
	memset(f,-1,sizeof(f));
	if(n<=2)puts("0");
	else printf("%d\n",DFS(n));
}

} // namespace rG

int main(){
#if defined(LOCAL)&&HAS_TEST_CASE
	freopen("tmp.out","w",stdout);
#endif
#if HAS_TEST_CASE
	int T;
	scanf("%d",&T);
	while(T--)rG::main();
#else
	rG::main();
#endif
	return 0;
}


Measured memory_bytes: 5776
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    int64_t a = 2, b = 1;
    for (int i = 0; i < n; i++) {
        int64_t c = a + b;
        a = b;
        b = c;
    }

    cout << a << endl;

    return 0;
}

Measured memory_bytes: 256
L,R,c[555][555],s;main(n){for(scanf("%*d%d%*d",&n);~scanf("%d%d",&L,&R);s=0)for(n--;n<0?R/L||!printf("%d\n",s):R<501;)n<0?s+=c[L++][R]:c[L][R++]++;}

Measured memory_bytes: 1920
import math

a,b,c=map(int,input().split())

s=a*b*math.sin(math.radians(c))/2
l=a+b+math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(c)))
h=s/a*2

print(s,l,h)



Measured memory_bytes: 5704
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class T>inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

int a[1050],b[1050],c[1050][20];

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N,M; cin >> N >> M;
    vector<int> dp(5000,INF);
    dp[0] = 0;
    rep(i,M){
        cin >> a[i] >> b[i];
        rep(j,b[i]){
            cin >> c[i][j];
            c[i][j]--;
        }
    }
    rep(i,M){
        int now=0;
        rep(j,b[i]){
            now |= (1<<c[i][j]);
        }
        rep(j,(1 << N)){
            chmin(dp[j|now],dp[j]+a[i]);
        }
    }
    if(dp[(1<<N)-1]==INF) cout << -1 << endl;
    else cout << dp[(1<<N)-1] << endl;
}

Measured memory_bytes: 512