akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

const int N = 2005;
int n, mat[N][N], m, ans;
string s[N];
queue <pair<int, int > > q;

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

bool ok(int i, int j) {
	if(0 <= i && i < n)
		if(0 <= j & j < m) 
			return 1;
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> m;

	for(int i = 0; i < n; i++) cin >> s[i];

	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++) {
			// dbg(s[i][j]);
			if(s[i][j] == '#')
				q.push({i, j});
		}

	// dbg(q.size());
	// dbg(s[0]);
	// dbg(s[1]);
	while(!q.empty()) {
		auto p = q.front();
		// dbg(p);
		q.pop();

		for(int i = 0; i < 4; i++)
			if(ok(p.st + dx[i], p.nd + dy[i]) && s[p.st + dx[i]][p.nd + dy[i]] == '.') {
				q.push({p.st + dx[i], p.nd + dy[i]});
				s[p.st + dx[i]][p.nd + dy[i]] = '#';
				mat[p.st + dx[i]][p.nd + dy[i]] = mat[p.st][p.nd] + 1;
				ans = max(ans, mat[p.st + dx[i]][p.nd + dy[i]]);
			}
	}
	cout << ans << '\n';
}	




Measured memory_bytes: 14464
trump_card = [[0 for i in range(13)] for j in range(4)]

def get_type_index(type_str):
    if type_str == 'S':
        return 0
    elif type_str == 'H':
        return 1
    elif type_str == 'C':
        return 2
    else:
        return 3

def get_type_str(type_index):
    if type_index == 0:
        return 'S'
    elif type_index == 1:
        return 'H'
    elif type_index == 2:
        return 'C'
    else:
        return 'D'

def is_exist_card(type_index, num):
    return trump_card[type_index][num - 1] == 1

def set_card(type_str, num):
    type_index = get_type_index(type_str)
    trump_card[type_index][num - 1] = 1

N = int(input())
for i in range(N):
    type_str, card_num_str = input().split()
    set_card(type_str, int(card_num_str))

for type_index in range(len(trump_card)):
    for num in range(1, len(trump_card[type_index]) + 1):
        if not is_exist_card(type_index, num):
            print(get_type_str(type_index), num)



Measured memory_bytes: 5612
#include<iostream>
#include<cstdio>
using namespace std;
#define LL long long
int n;  LL a[110000];
int main(){
	cin>>n;
	for(int i=1;i<=n;++i)  scanf("%lld",&a[i]);
	LL bwl=1;
	LL cmp=1LL*1000000000*1000000000;
	for(int i=1;i<=n;++i){
		if(bwl==0)  break;  //attention3
		if(cmp/bwl<a[i]){  //attention
			bwl=-1;
			break;
		}
		bwl=bwl*a[i];  //attention2
	}
	for(int i=1;i<=n;++i)if(a[i]==0){
		bwl=0;
		break;
	}
	cout<<bwl<<endl;
	return 0;
}




Measured memory_bytes: 4432
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    sorted_a = sorted(a)
    a_max = max(a)
    a_second = sorted_a[-2]

    for ai in a:
        if ai == a_max:
            print(a_second)
        else:
            print(a_max)


if __name__ == '__main__':
    main()


Measured memory_bytes: 70152
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a >= 13) {
            System.out.println(b);
        } else if (a >= 6) {
            System.out.println(b / 2);
        } else {
            System.out.println(0);
        }
    }
}


Measured memory_bytes: 23380
import std.stdio, std.algorithm, std.conv, std.array, std.string;

void main()
{
    long h, w;
    readf("%d %d", &h, &w);

    if (h%3 == 0 || w%3 == 0) {
        writeln("0");
        return;
    }

    long ret_d = long.max;

    foreach (wd; 1..w) {
        auto hb = h * wd;
        auto wb1 = (h+1)/2 * (w-wd);
        auto wb2 = h/2 * (w-wd);
        auto dd1 = max(hb, wb1, wb2) - min(hb, wb1, wb2);

        auto h2 = h * ((w-wd+1)/2);
        auto h3 = h * ((w-wd)/2);
        auto dd2 = max(hb, h2, h3) - min(hb, h2, h3);

        auto dd = min(dd1, dd2);

        if (dd < ret_d) ret_d = dd;
    }

    foreach (hd; 1..h) {
        auto wb = hd * w;
        auto hb1 = (h-hd) * ((w+1)/2);
        auto hb2 = (h-hd) * (w/2);
        auto dd1 = max(wb, hb1, hb2) - min(wb, hb1, hb2);

        auto w2 = ((h-hd+1)/2) * w;
        auto w3 = ((h-hd)/2) * w;
        auto dd2 = max(wb, w2, w3) - min(wb, w2, w3);

        auto dd = min(dd1, dd2);

        if (dd < ret_d) ret_d = dd;
    }

    writeln(ret_d);
}

Measured memory_bytes: 380
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
//#include <cstdio>
//#include <cstdlib>
#include <cstring>

using namespace std;

class Node {
public:
    int mKey;
    Node* mPrev;
    Node* mNext;

    Node() {
        mKey = 0;
        mPrev = this;
        mNext = this;
    }
    Node(int k, Node* pre, Node* next) {
        mKey = 0;
        mPrev = pre;
        mNext = next;
    }
    ~Node() {
    }
};


Node* nil;
void init() {
    nil = new Node();    
}

void insert(int key) {
    Node* pNode = new Node();
    pNode->mKey = key;

    pNode->mNext = nil->mNext;
    nil->mNext->mPrev = pNode;
    nil->mNext = pNode;
    pNode->mPrev = nil;
}

Node* listSearch(int key) {
    Node* cur = nil->mNext;

    while (cur != nil && cur->mKey != key) {
        cur = cur->mNext;
    }
    return cur;
}

void deleteNode(Node* node) {
    if (node == nil) return;
    node->mPrev->mNext = node->mNext;
    node->mNext->mPrev = node->mPrev;

    delete node;
    node = nullptr;
}

void deleteFirst() {
    deleteNode(nil->mNext);
}

void deleteLast() {
    deleteNode(nil->mPrev);
}

void deleteKey(int key) {
    deleteNode(listSearch(key));
}

void printList() {
    Node* cur = nil->mNext;
    int isf = 0;
    while (1) {
        if (cur == nil) break;
        if (isf++ > 0) printf(" ");

        printf("%d", cur->mKey);
        cur = cur->mNext;
    }
    printf("\n");
}

void deleteList() {
    Node* cur = nil->mNext;
    while (1) {
        if (cur == nil) break;

        Node* curNext = cur->mNext;
        deleteNode(cur);

        cur = curNext;
    }
}

int main()
{
    int n;
    int size = 0;
    char com[20];
    int np{ 0 }, nd{ 0 };

    scanf("%d", &n);

    init();

    for (int i = 0; i < n; i++) {
        int key;
        scanf("%s %d", com, &key);
        if (com[0] == 'i') {
            insert(key);
            np++;
            size++;
        }
        else if (com[0] == 'd') {
            if (strlen(com) > 6) {
                if (com[6] == 'F') deleteFirst();
                else if (com[6] == 'L') deleteLast();
            }
            else {
                deleteKey(key);
                nd++;
            }
            size--;
        }
    }
    printList();
    deleteList();
    delete nil;

}


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

int main(){
  int N;
  cin >> N;
  int d = N % 10,c =(N % 100 - d) / 10 ,b = (N % 1000 - c * 10 - d) / 100, a = (N - 100 * b - 10 * c - d ) / 1000;

  if (a == b && b == c){
   cout << "Yes" << endl;
  }
  else if (b == c && c == d){
    cout << "Yes" << endl;
  }
  else 
    cout << "No" << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
X = input()
intx = int(X)

gohyakuX = int(intx / 500)
nokori = intx - (gohyakuX * 500)
nokoriX = int(nokori / 5)
#1024
result = gohyakuX * 1000 + nokoriX * 5
print(result)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		print(a);
		insertionSort2(a);

	}

	static void print(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			} else {
				System.out.print("\n");
			}
		}
	}

	static void insertionSort1(int[] a) {
		for (int i = 1; i < a.length; i++) {
			for (int j = 0; j < i; j++) {
				if (a[i] < a[j]) {
					int tmp = a[i];
					for (int k = i - 1; k >= j; k--) {
						a[k+1] = a[k];
					}
					a[j] = tmp;
				}
			}
			print(a);
		}
	}
	static void insertionSort2(int[] a) {
		for (int i = 1; i < a.length; i++) {
			int v = a[i];
			int j = i-1;
			while (j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			print(a);
		}
	}

}


Measured memory_bytes: 33980
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
 /* #ifndef ONLINE_JUDGE
      // for getting input from input.txt
      freopen("input.txt", "r", stdin);
      // for writing output to output.txt
      freopen("output.txt", "w", stdout);
  #endif*/
fast();
//ll  t;cin>>t;while(t--)
{
  ll n,s=0,i=0,c=1;
  cin>>n;
  ll a[n];
  f(i,n){
    cin>>a[i];
  }
  ll temp=a[0];
  for(i=1;i<n;i++)
  {
   if(temp>=a[i])
   {
    temp=a[i];
    c++;
   }
  }
cout<<c<<endl;
  
  

}
return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include <cassert>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int>VI;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reprev(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define fi first
#define se second
#define MAX 100100//5
#define MAX_N 200100
#define MAX_B 1001001//6
#define MAX_S 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1 << 29
#define INFTY 1000000000000000000LL
#define MAX_INT INT_MAX

int main(){
    
    int n,a[MAX_B];
    cin>>n;rep(i,n)cin>>a[i];
    ll max_v=0;
    rep(i,n){if(max_v<a[i])max_v=a[i];}
    int second=0;
    rep(i,n)if(a[i]!=max_v && second<a[i])second=a[i];
    int count=-1;
    rep(i,n)if(a[i]==max_v)count++;
    rep(i,n){
        if(a[i]==max_v && !count)cout<<second<<endl;
        else cout<<max_v<<endl;
    }
}

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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

//--------------------------------------------

int n;
int loop = 0;
int a[100010];
bool done[100010] = {0};

bool nextNum(int num) {
  if (num == 2) return 1;
  else if (done[num] != 0) return 0;
  else {
    done[num] = 1;
    loop++;
    return nextNum(a[num - 1]);
  }
}

int main(){

  scanf("%d",&n);
  REP (i, n) scanf("%d",&a[i]);

  if (nextNum(1)) printf("%d\n",loop);
  else printf("-1\n");

}


Measured memory_bytes: 896
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	private static FastScanner sc = new FastScanner();
	static long cnt = 0;

	public static void main(String[] args) {
		int n = sc.nextInt();
		
		int[] A = new int[n];
		for(int i=0; i<n; i++) {
			A[i] = sc.nextInt();
		}
		
		mergeSort(A, 0, n);
		
		System.out.println(cnt);
	}
	
	static void merge(int A[], int left, int mid, int right) {
		int n1 = mid - left;
		int n2 = right - mid;
		int[] L = new int[n1 + 1];
		int[] R = new int[n2 + 1];
		for(int i=0; i<n1; i++) {
			L[i] = A[left + i];
		}
		for(int i=0; i<n2; i++) {
			R[i] = A[mid + i];
		}
		L[n1] = Integer.MAX_VALUE;
		R[n2] = Integer.MAX_VALUE;
		int i = 0;
		int j = 0;
		for(int k=left; k<right; k++) {
			if(L[i] <= R[j]) {
				A[k] = L[i];
				i++;
			} else {
				A[k] = R[j];
				j++;
				cnt += n1 - i;
			}
		}
	}
	
	static void mergeSort(int[] A, int left, int right) {
		if(left + 1 < right) {
			int mid = (left + right) / 2;
			mergeSort(A, left, mid);
			mergeSort(A, mid, right);
			merge(A, left, mid, right);
		}
	}
	
	static class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
	    }
	    public long nextLong() {
	        return Long.parseLong(next());
	    }
	    public int nextInt(){
	    	return Integer.parseInt(next());
	    }
	}
}

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

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

const int mxn = 2e5 + 5;
const ll inf = 1e18;
int n, v[mxn];
map <int, ll> dp[mxn];

int main() {
	scanf("%d", &n);
	rep(i, n) scanf("%d", &v[i]);
	dp[0][0] = 0;
	rep(i, n) {
		for (int j = max(0, i / 2 - 5); j <= i / 2 + 5; ++ j) {
			dp[i + 1][j] = dp[i].find(j) == dp[i].end() ? -inf : dp[i][j];
			if (j) {
				ll old = dp[max(0, i - 1)].find(j - 1) == dp[max(0, i - 1)].end() ? -inf : dp[max(0, i - 1)][j - 1];
				dp[i + 1][j] = max(dp[i + 1][j], old + v[i]);
			}
		}
	}
	printf("%lld\n", dp[n][n / 2]);
	return 0;
}


Measured memory_bytes: 151444
#include<iostream>
#include<string.h>
int main()
{
    char a[10] = {'\0'};
    std::cin>>a;
    if(strcmp(a,"ABC")){
        std::cout<<"ABC"<<std::endl;
    }
    else{
        
        std::cout<<"ARC"<<std::endl;
    }
    return 0;
}

Measured memory_bytes: 3644
def diff(u, v):
    ans = 0
    for i in range(len(u)):
        if u[i] != v[i]:
            ans += 1
    return ans

s = input()
t = input()
ans = len(t)
for i in range(len(s) - len(t) + 1):
    ans = min(ans, diff(s[i:i + len(t)], t))
print(ans)

Measured memory_bytes: 72656
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long int n, k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    long long int sum=0;
    sort(arr,arr+n);
    for(int i=0;i<n-k;i++)
    {
        sum=sum+arr[i];
    }
    cout<<sum;
}


Measured memory_bytes: 1024
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
function main()
  V=zeros(Int,3010,3010)
  dp=zeros(Int,3010,3010,4)
  R,C,K=parse.(Int,split(readline()))
  for i=1:K
    r,c,v=parse.(Int,split(readline()))
    V[r,c]=v
  end
  @simd for i=1:R
    for j=1:C
      for k=1:4
        #sita
        @inbounds dp[i+1,j+1,1]=max(dp[i+1,j+1,1],dp[i,j+1,k])
        @inbounds dp[i+1,j+1,2]=max(dp[i+1,j+1,2],dp[i,j+1,k]+V[i,j])
        #migi
        @inbounds dp[i+1,j+1,k]=max(dp[i+1,j+1,k],dp[i+1,j,k],k>1 ? dp[i+1,j,k-1]+V[i,j] : 0)
      end
    end
  end
  println(maximum(dp[R+1,C+1,:]))
end
main()
if isdefined(Base, :mystdin);close(mystdin);end

Measured memory_bytes: 578164
# import itertools
# import math


def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    even = list(filter(lambda x: x % 2 == 0, A))

    for ee in even:
        if (ee % 3) != 0 and (ee % 5) != 0:
            print('DENIED')
            return

    print('APPROVED')


resolve()


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

int main()
{
	int A, B;
	scanf("%d%d", &A, &B);
	char S[A + B + 2];
	scanf("%s", S);
	int i, j, k;

	int flag = 0;
	for (i = 0; i < A + B + 1; i++) {
		if (i == A) {
			if (S[i] != '-')
				flag = 1;
		} else if ((S[i] < '0') || ('9' < S[i])) 
			flag = 1;
//		printf("%d\n", flag);
	}

	printf(flag ? "No\n" : "Yes\n");

	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int X = (A); X <= (Y);++X)
#define _rep2(X, Y) for (int X = 0; X < (Y); ++X)
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
typedef long long ll;

#define MAX_N 50
#define MAX_A 50
int N, A;
int x[MAX_N + 1];
ll dp[MAX_N + 1][MAX_N + 1][MAX_N * MAX_A + 1];

int main() {
    scanf("%d %d", &N, &A);
    rep(i, 1, N) scanf("%d", &x[i]);

    rep(i, N) dp[i][0][0] = 1;

    rep(i, 1, N) {
        rep(j, 1, i) {
            rep(k, 1, N * A) {
                if (k < x[i]) {
                    dp[i][j][k] = dp[i - 1][j][k];
                } else {
                    dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i]];
                }
            }
        }
    }

    ll ans = 0;
    rep(j, 1, N) {
        ans += dp[N][j][j * A];
    }

    printf("%lld\n", ans);

    return 0;
}


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

int main(){
    int n, m, ans1 = 0, ans2 = 0;
    cin >> n >> m;
    int p;
    string s;
    vector<int> wa(n, 0);
    vector<bool> ac(n, false);
    
    for(int i = 0; i < m; i++){
        cin >> p >> s;
        p--;
        if(s[0] == 'A' && s[1] == 'C'){
            ac[p] = true;
        }
        else{
            if(!ac[p]){
                wa[p]++;
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(ac[i]) {
            ans1++;
            ans2 += wa[i];
        }
    }

    cout << ans1 << ' ' << ans2 << endl;
    return 0;
}

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

main(){
   int n;
   cin>>n;
   int a[n];
   int count[n+1] = { 0 };
   for(int i = 0;i<n-1;i++){
       cin>>a[i];
       count[a[i]]++;
   }
   for(int i = 1;i<n+1;i++) cout<<count[i]<<"\n";
}

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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

struct P {
    int x, y, h;
};

void solve() {
    int N;
    cin >> N;

    vector<P> C;

    for (int i = 0; i < N; i++) {
        int x, y, h;
        cin >> x >> y >> h;
        C.push_back({x, y, h});
    }

    for (int x = 0; x <= 100; x++) {
        for (int y = 0; y <= 100; y++) {
            int h = 0;
            for (int i = 0; i < N; i++) {
                if (C[i].h != 0 && C[i].h + abs(C[i].x - x) + abs(C[i].y - y) != 0) {
                    h = C[i].h + abs(C[i].x - x) + abs(C[i].y - y);
                    break;
                }
            }
            if (h == 0) {
                assert(false);
            }
            bool ok = true;
            for (int i = 0; i < N; i++) {
                if (max(0, h - abs(C[i].x - x) - abs(C[i].y - y)) != C[i].h) ok = false;
            }
            if (ok) {
                cout << x << " " << y << " " << h << endl;
                return;
            }
        }
    }
    assert(false);
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}


Measured memory_bytes: 256
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = IL()

dp = [[0]*(N+1) for i in range(N+1)]
data = [[0]*(N+1) for i in range(N+1)] # data[i][j] = sum(a[i:j])
for i in range(N):
  data[i][i+1] = a[i]
for i in range(N+1):
  for j in range(N+1):
    if i+j <= N:
      data[j][i+j] = sum(a[j:i+j])
    else:
      break

for i in range(2,N+1):
  for j in range(N+1):
    if i+j <= N:
      tmp = MAX_INT
      for k in range(1,i):
        tmp = min(tmp,dp[j][k+j] + dp[k+j][i+j])
      dp[j][i+j] = tmp + data[j][i+j]
    else:
      break

#print(data)
#print(dp)
print(dp[0][N])


Measured memory_bytes: 71516
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#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 ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll dp[300][300];
    REP(i, n)REP(j, n) cin >> dp[i][j];

    bool need[300][300];
    fill_n((bool*)need, 300 * 300, true);
    REP(i, n)REP(j, n)REP(k, n){
        if(i == j || j == k || k == i) continue;
        if(dp[j][k] > dp[j][i] + dp[i][k]){
            cout << -1 << "\n";
            return 0;
        }
        need[j][k] &= (dp[j][k] < dp[j][i] + dp[i][k]);
    }

    ll ans = 0;
    REP(i, n)REP(j, n)if(i < j && need[i][j]) ans += dp[i][j];
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 1024
<?php
  fscanf(STDIN, "%s", $str);
  $splited_str = str_split($str);
  $hug = 0;
  $set_num = floor(count($splited_str)/2);

  for ($i=0; $i<=$set_num-1; $i++) {
    if ($splited_str[$i] != $splited_str[count($splited_str)-$i-1]) {
      $hug++;
    }
  }
  echo $hug;

Measured memory_bytes: 4728
/***********************
*  Author: xuziyuan    * 
***********************/
 
#include <bits/stdc++.h>
 
#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))
 
using namespace std;
 
const LL MOD=1e9+7;
 
LL n,m,a[1010][3],dp[1010][1010][2][2][2],to[2],ans=0;
 
int main()
{
	to[0]=1;
	to[1]=-1;
	rep(i,1005) rep(j,1005) rep(k,2) rep(p,2) rep(r,2) dp[i][j][k][p][r]=-1e18;
	rep(i,2) rep(j,2) rep(k,2) dp[0][0][i][j][k]=0;
	cin>>n>>m;
	rep(i,n) rep(j,3) scanf("%lld",&a[i][j]);
	rep(i,n)
	{
		rep(j,m+1)
		{
			if(j>i) break;
			rep(k,2) rep(p,2) rep(r,2)
			{
				if(dp[i][j][k][p][r]==-1e18) continue;
				dp[i+1][j][k][p][r]=max(dp[i+1][j][k][p][r],dp[i][j][k][p][r]);
				dp[i+1][j+1][k][p][r]=max(dp[i+1][j+1][k][p][r],
				dp[i][j][k][p][r]+to[k]*a[i][0]+to[p]*a[i][1]+to[r]*a[i][2]);
			}
		}
	}
	rep(i,2) rep(j,2) rep(k,2) ans=max(ans,dp[n][m][i][j][k]);
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 63744
n,m = map(int,input().split())
a = int(n/2)
b = a+1
offset = False
if n%2 == 0:
	offset = True
for i in range(m):
	if offset and b-a >= n/2:
		b += 1
		offset = False
	print(a,b)
	a -= 1
	b += 1

Measured memory_bytes: 9264
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  string s,t;
  int count=0;
  cin>>s>>t;
  for(int i=0;i<s.size();i++){
    t=t.back()+t.substr(0,t.size()-1);
    if(s==t)
      count++;
  }
  if(count==0)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;
}

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

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];

bool X[N][N];

void initialize() {
  for (int i = 0; i < N; i++) {
    row[i] = FREE;
    col[i] = FREE;
  }
  for (int i = 0; i < 2 * N - 1; i++) {
    dpos[i] = FREE;
    dneg[i] = FREE;
  }
}

void printBoard() {
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (X[i][j]) {
        if (row[i] != j) return;
      }
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cout << ( (row[i] == j) ? "Q" : "." );
    }
    cout << endl;
  }
}

void recursive(int i) {
  if (i == N) {
    printBoard();
    return;
  }

  for (int j = 0; j < N; j++) {
    if ( col[j] == NOT_FREE ||
         dpos[i + j] == NOT_FREE ||
         dneg[i - j + N - 1] == NOT_FREE ) continue;

    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE;

    recursive(i + 1);

    row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
  }

}

int main() {
  initialize();

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      X[i][j] = false;
    }
  }

  int k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    int r, c;
    cin >> r >> c;
    X[r][c] = true;
  }

  recursive(0);

  return 0;

}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for (int i = a; i < (int)b; ++i)
#define rrep(i, n) for (int i = ((int)n - 1); i >= 0; --i)

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

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<ll> a(n);
    rep (i, n) cin >> a[i];
    ll tmp = a[0];
    rep (i, n - 1) tmp ^= a[i + 1];
    vector<ll> res;
    rep (i, n) res.push_back(tmp ^ a[i]);
    rep (i, res.size()) {
        cout << res[i];
        if (i == res.size() - 1) cout << endl;
        else cout << " ";
    }
    
    return 0;
}



Measured memory_bytes: 6900
def main():
    n=int(input())
    s=input()
    ans=s[1:].count("E")
    cnt=ans
    for i in range(1,n):
        if s[i-1]=="W":
            cnt+=1
        if s[i]=="E":
            cnt-=1
        ans=min(ans,cnt)
    print(ans)
if __name__=="__main__":
    main()

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

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

  ll d = 1;
  ll k = n;
  while(k > pow(26LL, d)) {
    k -= pow(26LL, d);
    d++;
  }

  string ans(d, 'a');
  k--;
  d--;
  while(k > 0 && d >= 0){
    int r = k % 26;
    ans[d] = 'a' + r;
    d--;
    k /= 26;
  }

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

Measured memory_bytes: 4048
n = int(input())

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

ans = 0
ch = 0
tmp = 0
if n == 1:
    print(0)
    exit()

for fn in factorization(n):
    while True:
        ch += 1
        if fn[1] >= ch:
            fn[1] -= ch
            tmp += 1
        else:
            break
    ans += tmp
    tmp = 0
    ch = 0
print(ans)

Measured memory_bytes: 9524
#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	char s[201], t[101], p[101];

	scanf("%s %s", s, p);
	strcpy(t, s);
	strcat(s, t);

	if (strstr(s, p)== NULL)printf("No\n");
	else printf("Yes\n");

    return 0;
}


Measured memory_bytes: 2756
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = ["a", "i", "u", "e", "o"]
    c = S()
    if c[0] in a:
        print("vowel")
    else:
        print("consonant")
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 38512
/*
Author: QAQAutomaton
Lang: C++
Code: A.cpp
Mail: lk@qaq-am.com
Blog: https://www.qaq-am.com/
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int inf;
const double eps=1e-8;
const double pi=acos(-1.0);
template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
template<class T>int dcmp(T a,T b){return a>b;}
template<int *a>int cmp_a(int x,int y){return a[x]<a[y];}
#define min mmin
#define max mmax
#define abs aabs
struct __INIT__{
	__INIT__(){
		memset(&inf,0x3f,sizeof(inf));
	}
}__INIT___;
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	template<typename A>
	inline bool read (A &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}
	inline bool read (char &x) {
		while((x=gc())==' '||x=='\n' || x=='\r');
		return x!=EOF;
	}
	inline bool read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r');
		if(*x==EOF)return 0;
		while(!(*x=='\n'||*x==' '||*x=='\r'))*(++x)=gc();
		*x=0;
		return 1;
	}
	template<typename A,typename ...B>
	inline bool read(A &x,B &...y){
		return read(x)&&read(y...);
	}
	template<typename A>
	inline bool write (A x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}
	inline bool write (char x) {
		putc(x);
		return 0;
	}
	inline bool write(const char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	inline bool write(char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	template<typename A,typename ...B>
	inline bool write(A x,B ...y){
		return write(x)||write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
char s[55][105],t[105];
int w[55];
signed main(){
#ifdef QAQAutoMaton 
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
#endif
	int n;
	read(n);
	for(int i=1;i<=n;++i){
		read(s[i],w[i]);
	}
	read(t);
	int ans=0;
	for(int i=n;i;--i){
		if(strcmp(s[i],t)==0)return write(ans,'\n');
		ans+=w[i];

	}
	return 0;
}



Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000009
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define rollcall cout<<"I'm Sucu."<<endl
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define int ll


signed main(void){
    string S;
    cin >> S;
    int Ans=-4;
    REP(i,4){
        if(S[i]=='+'){
            Ans+=2;
        }
    }
    cout << Ans << endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 998244353
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

N,M,K = inputIL()

res = 0
for k in range(K+1):
  a = (M*pow(M-1,N-1-k,MOD)) %MOD
  b = nCr(N-1,k)
  res = ( res + a*b )%MOD
  
print(res)

Measured memory_bytes: 103448
//----------ACCIDENTAL COMPETITIVE PROGRAMMER---------------------

#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair


const LL MOD = (1e9) + 7 ;
const LD EPS = 0.0000001 ;

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

    LL A, B; cin >> A >> B;
    if (A > B)
    	swap(A,B);
    if (A == B){
    	cout << A + B << endl;
    } else {
    	cout << B + B - 1 << endl;
    }

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ull = unsigned long long;

static const ull MOD = 1000000007LL;

int n;
char s[100005];
ull dp[100005][13];
ull solve () {
int i, j, ki;
ull res = 0;

 scanf("%s", s);
 n = strlen(s);

 dp[0][0] = 1;
 for (i = 0; i < n; i++) {
 int c;
 if (s[i] == '?') c = -1;
 else c = s[i] - '0';

for (j = 0; j < 10; j++) {
 if (c != -1 && c != j) continue;
 for (ki = 0; ki < 13; ki++) {
 dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki];
 }
 }
 for (j = 0; j < 13; j++) dp[i + 1][j] %= MOD;
 }
 res = dp[n][5];

 printf("%llu\n", res);
 return 0;
 }

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


Measured memory_bytes: 10624
#include <stdio.h>
#include <math.h>

typedef struct{
  double x;
  double y;
} pp;

void Koch_Curve(int,pp,pp);

int main(){
  pp end,begin;
  int n;
  scanf("%d",&n);
  
  begin.x = 0;
  begin.y = 0;
  end.x = 100;
  end.y = 0;
  
  printf("%.5lf %.5lf\n",begin.x,begin.y);
  Koch_Curve(n,begin,end);
  printf("%.5lf %.5f\n",end.x,end.y);
  
  return 0;
}

void Koch_Curve(int n,pp a,pp b){
  pp s,t,u;
    double theta = M_PI/3; //正三角形を作るから、60度をラジアンへ変換
    if(n > 0){
      s.x = (2.0*a.x + 1.0*b.x) / 3.0;
      s.y = (2.0*a.y + 1.0*b.y) / 3.0;
      t.x = (1.0*a.x + 2.0*b.x) / 3.0;
      t.y = (1.0*a.y + 2.0*b.y) / 3.0;
      u.x = (t.x-s.x)*cos(theta)-(t.y-s.y)*sin(theta) + s.x;
      u.y = (t.x-s.x)*sin(theta)+(t.y-s.y)*cos(theta) + s.y;
      
      Koch_Curve(n-1,a,s);
      printf("%.5lf %.5lf\n",s.x,s.y);
      
      Koch_Curve(n-1,s,u);
      printf("%.5lf %.5lf\n",u.x,u.y);
      
      Koch_Curve(n-1,u,t);
      printf("%.5lf %.5lf\n",t.x,t.y);
      
      Koch_Curve(n-1,t,b);
    }    
}




Measured memory_bytes: 2044
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	a := nextInt()
	b := nextInt()
	num, _ := strconv.Atoi(fmt.Sprintf("%d%d", a, b))

	if isInteger(math.Sqrt(float64(num))) {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")

}
func isInteger(x float64) bool {
	return math.Floor(x) == x
}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1776
import sys
input = sys.stdin.readline

n = int(input())
robot = []
for _ in range(n):
    x, l = map(int, input().split())
    robot.append([x - l, x + l])

# startが被らないendが小さいもの

ans = 0
robot.sort(key=lambda x: x[1])
last = - float('inf')
for start, end in robot:
    if start >= last:
        ans += 1
        last = end

print(ans)


Measured memory_bytes: 21292
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>

using namespace std;
using ll = long long;

int n;
ll x[55], y[55];

int main(){
  cin >> n;
  for(int i = 0; i < n; ++i){
    cin >> x[i] >> y[i];
  }
  ll mn = n;
  for(int i = 0; i < n; ++i){
    for(int j = i + 1; j < n; ++j){
      ll tmp1 = x[i] - x[j];
      ll tmp2 = y[i] - y[j];
      ll ans = n;
      for(int k = 0; k < n; ++k){
        for(int o = 0; o < n; ++o){
          if(x[k] - x[o] == tmp1 && y[k] - y[o] == tmp2){
            ans--;
            
          }
        }
      }
      mn = min(ans, mn);

    }
  }
  cout << mn << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int b,r,g,c,s,t;
	while(scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t),t)
		printf("%d\n",100+b*80+r*54+g*7+c*2-(t-s-b*5-r*3)*3);
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cfenv>
#include <cmath>

using namespace std;

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

  if(s=="ABC")
  cout<<"ARC"<<endl;
  else
    cout<<"ABC"<<endl;

  return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int n;
		double[] ans = new double[4];
		for(int i=0;i<4;i++){
			ans[i]=0;
		}
		Scanner scan = new Scanner(System.in);
		n=scan.nextInt();
		int[][] vectors = new int[2][n];
		int[] vd = new int[n];
		for(int i=0;i<2;i++){
			for(int j=0;j<n;j++){
				vectors[i][j]=scan.nextInt();
			}
		}
		scan.close();
		
		for(int i=0;i<n;i++){
			vd[i]=Math.abs(vectors[0][i]-vectors[1][i]);
		}
		for(int i=0;i<3;i++){
			for(int j=0;j<n;j++){
				ans[i]+=Math.pow(vd[j], (i+1));
				if(vd[j]>ans[3]){
					ans[3]=vd[j];
				}
			}
		}
		ans[1]=Math.sqrt(ans[1]);
		ans[2]=Math.cbrt(ans[2]);
		for(int i=0;i<n;i++){
			if(ans[3]<vd[i]){
				ans[3]=vd[i];
			}
		}
		for(int i=0;i<4;i++){
			System.out.println(ans[i]);
		}
	}
}



Measured memory_bytes: 26732
#include<bits/stdc++.h>
#ifndef LOCAL_PROJECT
#define cerr if(0)cerr
#endif
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll mod=998244353;
const int mn=3e3+10;
ll dp[mn][mn][2][2];
int main(){
#ifdef LOCAL_PROJECT
    freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
#else
    cin.tie(0);
    cin.sync_with_stdio(0);
#endif
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    dp[a][b][1][1]=1;
    for(int i=a;i<=c;i++){
        for(int j=b+(i==a);j<=d;j++){
            dp[i][j][1][1]=((dp[i-1][j][1][1]+dp[i-1][j][0][1])*(j-1)+(dp[i][j-1][1][1]+dp[i][j-1][1][0])*(i-1))%mod;
            if(i>a&&j>b)dp[i][j][1][1]*=(mod+1)/2,dp[i][j][1][1]%=mod;
            dp[i][j][1][0]=((dp[i-1][j][1][1]+dp[i-1][j][0][1])+dp[i-1][j][1][0]*j)%mod;
            dp[i][j][0][1]=((dp[i][j-1][1][1]+dp[i][j-1][1][0])+dp[i][j-1][0][1]*i)%mod;
        }
    }
    ll ans=(dp[c][d][1][1]+dp[c][d][1][0]+dp[c][d][0][1])%mod;
    printf("%lld",ans);
}

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

int main(){
	string s;
	while(cin >> s){
		string::iterator it = s.begin();
		while(it != s.end()){
			if(*it == '@'){
				it += 2;
				for(int i = 0; i < *(it-1) - '0'; i++){
					cout << *it;
				}
				it++;
			}else{
				cout << *it;
				it++;
			}
		}
	cout << endl;
	}
}

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }

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

int32_t main(){
  DESYNC;
  int n;
  cin >> n;
  int v[n+1];
  int ans = 0;
  for(int i=0; i<n+1; i++){
    cin >> v[i];
  }
  for(int i=0; i<n; i++){
    int x;
    cin >> x;
    int tira = min(v[i], x);
    x -= tira;
    v[i] -= tira;
    ans += tira;
    tira = min(v[i+1], x);
    x -= tira;
    v[i+1] -= tira;
    ans += tira;
  }
  cout << ans << endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define PB push_back
#define SP << " " <<

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;

__attribute__((constructor))
void initial(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed <<setprecision(15);
}


int main(void){
	ll N, K;
    cin >> N >> K;
    ll a = N/K;
    ll ans = N- K*a;
    chmin(ans,K-ans);
    cout << ans << 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) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

class Dice{
    private:
        // 0
        //3124
        // 5
        int rabel[6];
    public:
        void setRabel(int a[6]){
            rep(i,6) rabel[i] = a[i];
        }
        void setRabel(int South, int top){
            ;
        }
        int getTop(){ return rabel[0]; };
        int getBottom(){ return rabel[5]; };
        int getNorth(){ return rabel[4]; };
        int getEast(){ return rabel[2]; };
        int getSouth(){ return rabel[1]; };
        int getWeat(){ return rabel[3]; };
        void role(char com){
            int temp;
            switch (com) {
                case 'E':
                    temp = rabel[0];
                    rabel[0] = rabel[3];
                    rabel[3] = rabel[5];
                    rabel[5] = rabel[2];
                    rabel[2] = temp;
                    break;
                case 'N':
                    temp = rabel[0];
                    rabel[0] = rabel[1];
                    rabel[1] = rabel[5];
                    rabel[5] = rabel[4];
                    rabel[4] = temp;
                    break;
                case 'W':
                    temp = rabel[2];
                    rabel[2] = rabel[5];
                    rabel[5] = rabel[3];
                    rabel[3] = rabel[0];
                    rabel[0] = temp;
                    break;
                case 'S':
                    temp = rabel[4];
                    rabel[4] = rabel[5];
                    rabel[5] = rabel[1];
                    rabel[1] = rabel[0];
                    rabel[0] = temp;
                    break;
                default:
                    assert(0);
            }
        }
};

int main(){
    Dice d;
    int a[6];
    rep(i,6) cin >> a[i];
    d.setRabel(a);

    char com;
    while(cin >> com){
        d.role(com);
    }
    cout << d.getTop() << endl;
}

Measured memory_bytes: 3112