akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i,N) repv(i,0,N)
#define reps(i,N) repvs(i,0,N)
#define repv(i,a,b) for(int i=a;i<b;i++)
#define repvs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define debug(a) if(isDebugMode) cout<<#a<<"="<<a<<","
#define debug2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b
#define debug3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c
#define debug4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d
#define debugarr(arr,N){if(isDebugMode){ rep(i,N+1)\
	{if(arr[i]==INF)printf("INF ");\
		else cout<<arr[i]<<" ";} cout<<endl;}}
#define debugarr2(arr,N,M){if(isDebugMode) rep(i,N+1){rep(j,M+1)\
	{if(arr[i][j]==INF)printf(" INF");\
		else printf(" %3d",arr[i][j]);} cout<<endl;}}
#define pb push_back
#define pob pop_back
#define show(a) cout<<a<<endl;

auto chmax =[](int &a,int b){a=max(a,b);};
auto chmin =[](int &a,int b){a=min(a,b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF=100000000;
const int MOD = 100000007;
const int dx[4]={ 0, 1, 0,-1};
const int dy[4]={ 1, 0,-1, 0};

bool isDebugMode=true;
//--------------------------------------//
int n;
int c[9];
int f;

void solve(){
	int m=0;
	rep(i,8){
		if(c[i]!=0) m++;
	}
	int M;
	M=m+f;
	if(m==0&&f!=0) m=1;
	cout<<m<<" "<<M<<endl;
}

int main(){
	cin>>n;
	rep(i,n){
		int r;
		cin>>r;
		if(r>=3200) {r=3200;f++;}
		c[r/400]++;
	}
	solve();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
inline void write(int x)
{
    if(x<0)
	{
    	putchar('-');
		x=-x;
	}
    if(x>9)
		write(x/10);
    putchar(x%10+'0');
}
int A(string a)
{
	for(register int i=0;i<a.size();i++)
		if(a[i]=='A')
			return i;
}
int Z(string a)
{
	for(register int i=a.size()-1;i>=0;i--)
		if(a[i]=='Z')
			return i;
}
int main()
{
	ios::sync_with_stdio(false);
	string a;
	int l,r;
	cin>>a;
	l=A(a);
	r=Z(a);
	cout<<r-l+1<<endl;
    return 0;
}

Measured memory_bytes: 788
import java.util.*;
 
class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		long MOD=1000000007L;
		
		int a=sc.nextInt();
		int p=sc.nextInt();

		System.out.println((3*a+p)/2);

	}
	
}


Measured memory_bytes: 23892
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto k = readln.chomp.to!int;
    auto ab = readln.split.to!(int[]);
    auto A = ab[0];
    auto B = ab[1];
    auto x = k;
    while (x <= B) {
        if (x >= A) {
            writeln("OK");
            return;
        }
        x += k;
    }
    writeln("NG");
}

Measured memory_bytes: 2732
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}
ll INV(ll a){
    return RS(a,MOD-2,MOD);
}
ll c(ll n,ll a){
    ll bunbo=1;
    ll bunshi=1;
    
    REP1(i,a){
        bunbo*=i;
        bunbo%=MOD;
        bunshi*=n+1-i;
        bunshi%=MOD;
    }
    return (bunshi*INV(bunbo)%MOD);
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    map<string,int> m;
    int N=in();
    int max_kosu=0;
    REP(i,N){
        string s;
        cin>>s;
        m[s]++;
        max_kosu=max(max_kosu,m[s]);
    }
    for( auto i = m.begin(); i != m.end() ; ++i ) {
        if(i->second==max_kosu){
            cout<< i->first <<endl;
        }
    }
    return 0;

}

Measured memory_bytes: 23808
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 42;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<int,pair<int,int> > ppi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl '\n'
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORS(s) for(int i=0;i<s.length();i++)
#define input int t; cin>>t; while(t--)
#define SORT(arr) sort(arr,arr+n);
#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)
#define mod 998244353
#define MAXN 1000010
ll mE(ll x,ll y)
{
    ll result=1;
    while(y)
    {
        if(y&1)
            result=((result%MOD)*(x%MOD))%MOD;
        x=((x%MOD)*(x%MOD))%MOD;
        y>>=1;
    }
    return result%MOD;
}
int noOfDigits(ll k)
{
    int cnt=0;
    while(k)
    {
        cnt++;
        k/=10;
    }
    return cnt;
}
void solve() {
    string s;
    cin>>s;
    char ch=s[s.length()-1];
    if(ch!='s')
        s+='s';
    else
        s+="es";
    cout<<s<<endl;
    return;
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //input{
        //cout << "Case #" << t  << ": ";
        solve();
    //}
    return 0;
}

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

int main()
{
	int N;
	char S[100];

	scanf("%d %s", &N, S);

	if (N % 2 == 1)
	{
		printf("No\n");
		return 0;
	}

	for (int i = 0; i < N / 2; i++)
	{
		if (S[i] != S[N / 2 + i])
		{
			printf("No\n");
			return 0;
		}
	}

	printf("Yes\n");

	return 0;
}

Measured memory_bytes: 128
N = int(input())

L = []
for i in range(0, N):
    L.append(input().rstrip().split())

counter = 0
out = ""
for j in range(len(L)):
    if (L[j][0] == L[j][1]):
        counter += 1
        if (counter >= 3):
            out = "Yes"
            break
    else:
        counter = 0
        out = "No"
        
print(out)

Measured memory_bytes: 9192
lines = input().split(' ')
N = int(lines[0])
A = int(lines[1])
B = int(lines[2])

nums = [str(x) for x in range(1,N+1)]
total = 0

for i in range(N):
	sum = 0
	l = len(nums[i])
	for j in range(l):
		sum += int(nums[i][j])
	if sum >= A and sum <= B:
		total += int(nums[i])

print(total)
	

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

w_list = [int(x) for x in input().split()]
w_sum = sum(w_list)

ans = w_sum
temp_sum = 0
for w in w_list:
    temp_sum += w
    temp = abs(w_sum - 2 * temp_sum)
    if temp < ans:
        ans = temp
    else:
        break
print(ans)

Measured memory_bytes: 3060
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,m=LI()
  l2=[]
  for _ in range(m):
    l2.append(LI())

  l3=LI()

  l=[]
  a=len(bin(1<<n))-3
  for i in range(1<<n):
    l.append(str(bin(i))[2:].zfill(a))

  cnt=0
  for x in l:
    x=list(x)

    f=True
    for i in range(len(l2)):

      y=l2[i]
      c=0

      for a in y[1:]:
        c+=int(x[a-1])

      # print(c,l3[i])
      if c%2==l3[i]:
        pass
      else:
        f=False
        break

    if f:
      cnt+=1

  return cnt

print(main())


Measured memory_bytes: 6820
import java.util.*;
public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        String input = sc.next();
        
        int [] result = new int[3];
        
        for(int i = 0 ; i<3; i++){
            result[i] = Integer.parseInt(input.substring(i,i+1));
        }
        
    /*    for(int i = 0 ; i<3; i++){
            System.out.println(result[i]);
        }*/
        
        
        
        if(result[0]==result[1] && result[1]==result[2]){
            System.out.println(input);
        }
        else{
            if(result[0]>=result[1] && result[0]>=result[2]   ){
                System.out.print(result[0]);
                System.out.print(result[0]);
                System.out.print(result[0]);
            }
            else if(result[1]>result[0] || result[0]==result[1] && result[0]<result[2]){
                System.out.print((result[0]+1));
                System.out.print((result[0]+1));
                System.out.print((result[0]+1));
            }
        }
        
    }
}

Measured memory_bytes: 21844
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-(x)))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
typedef vector<ll> VLL;
typedef vector<int> VI;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9 + 7;
const ll inf = 1e9 + 7;
const ll INF = 1e15;
const ld eps = 1e-9;
const db PI = atan(1) * 4;


template<typename T, typename S>inline bool upmin(T&a, const S&b) { return a > b ? a = b, 1 : 0; }
template<typename T, typename S>inline bool upmax(T&a, const S&b) { return a < b ? a = b, 1 : 0; }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }
ll pow(ll a, ll b) {
	if (b == 0) {
		return 1;
	}
	if (b == 1) {
		return a;
	}
	ll ans = pow(a, b / 2);
	ans *= ans;
	ans *= b % 2 == 1 ? a : 1;
	return ans;
}

vector<VLL> mult(vector<VLL> A, vector<VLL> B) {
	int n = sz(A);
	vector<VLL> C(n, VLL(n));
	REP(i, 0, n) {
		REP(j, 0, n) {
			REP(k, 0, n) {
				C[i][j] += A[i][k] * B[k][j];
				C[i][j] %= mod;
			}
		}
	}
	return C;
}
vector<VLL> matrixpow(vector<VLL> A, ll b) {
	if (b == 1) {
		return A;
	}
	vector<VLL> ans = matrixpow(A, b / 2);
	ans = mult(ans, ans);
	ans = b % 2 == 1 ? mult(ans, A) : ans;
	return ans;
}

namespace SOLVE {
	void main() {
		ll n, k;
		cin >> n >> k;
		
		vector<VLL> adjmatrix(n, VLL(n));
		REP(i, 0, n) {
			REP(j, 0, n) {
				cin >> adjmatrix[i][j];
			}
		}
		vector<VLL> ans = matrixpow(adjmatrix, k);
		ll count = 0;
		REP(i, 0, n) {
			REP(j, 0, n) {
				// cout << ans[i][j] << ' ';
				count += ans[i][j];
				count %= mod;
			} // cout << endl;
		}

		cout << count << endl;

	}
}


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

	int t;
	//    in(t);
	t = 1;
	while (t--) {
		SOLVE::main();

	}

	return 0;
}


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

long long int N;
string s;

int main(){
    scanf("%lld", &N);
    if(!N)puts("0");
    while(N){ s.push_back((N & 1) + '0'); N = -((N - (N & 1)) >> 1);} reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}


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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


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

	ll ans = 0;
	if (n>=3 && m>=3) {
		ans += (n-2)*(m-2);
		cout << ans << "\n";
		return 0;
	}
	if (n == 2 || m == 2) {
		cout << 0 << "\n";
		return 0;
	}
	if (n==1 && m==1) {
		cout << 1 << "\n";
		return 0;
	}
	if (n==1) {
		cout << m-2 << "\n";
	}
	if (m==1) {
		cout << n-2 << "\n";
	}
}


Measured memory_bytes: 256
from sys import setrecursionlimit

setrecursionlimit(100000)

n = int(input())
arr = []
for i in range(n - 1):
    arr.append([int(s) for s in input().split(" ")])

mmk = {}

childNodeNums = [0 for i in range(n)]
childNodeStatus = [-1 for i in range(n)]


def generateID(fr, to):
    if to < fr:
        fr, to = to, fr
    return fr * 100000 + to


def prepare(n, arr):
    s = [[] for i in range(n)]
    for ar in arr:
        s[ar[0] - 1].append(ar[1] - 1)
        s[ar[1] - 1].append(ar[0] - 1)
    return s


# x为记录入边的颜色
def dfs(currentNode, arr, x):
    childNodes = arr[currentNode]
    if len(childNodes) == 0:
        return

    childNodeNums[currentNode] = childNodeNums[currentNode] + len(arr[currentNode])
    childNodeStatus[currentNode] = 1

    kk = 0
    for i, childNodeIndex in enumerate(childNodes):

        if childNodeStatus[childNodeIndex] == -1:
            kk = kk + 1
            if x == kk:
                kk = kk + 1
            mmk[generateID(currentNode + 1,childNodeIndex + 1)] = kk
            dfs(childNodeIndex, arr, kk)


data = prepare(n, arr)
dfs(0, data, -1)

print(max(childNodeNums))

for ar in arr:
    a0 = ar[0]
    a1 = ar[1]
    print(mmk[generateID(a0,a1)])


Measured memory_bytes: 90740
var
 a:array[1..3,1..3] of longint;
 s,i,j:longint;
begin
 readln(a[1,1]);
 readln(a[1,2]);
 readln(a[2,2]);
 s:=a[2,2]*3;
 a[1,3]:=s-a[1,1]-a[1,2];
 a[3,1]:=s-a[1,3]-a[2,2];
 a[3,3]:=s-a[1,1]-a[2,2];
 a[2,1]:=s-a[1,1]-a[3,1];
 a[2,3]:=s-a[2,1]-a[2,2];
 a[3,2]:=s-a[1,2]-a[2,2];
 for i:=1 to 3 do
  begin
   for j:=1 to 3 do write(a[i,j],' ');
   writeln;
  end;
end.

Measured memory_bytes: 128
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd
from itertools import accumulate
from functools import reduce


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

mod = 1000000007

if __name__ == "__main__":
    n,m = map(int, sys.stdin.readline().split())
    x = list(map(int, sys.stdin.readline().split()))
    ans=0
    if n > m:
        print(0)
    else:
        l=[]
        x.sort()

        for i in range(m-1):
            l.append(x[i+1]-x[i])
        l.sort()
        for i in range(m-n):
            ans += l[i]
        print(ans)


Measured memory_bytes: 15316
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;

public class Main {
    private static final ReadableByteChannel channel = Channels.newChannel(System.in);

    public static void main(String[] args) throws IOException {
	buf.clear();
	channel.read(buf);
	buf.flip();
	int n;
	while ((n = nextInt()) != 0) {
	    int[][] map = new int[21][21];
	    for (int i = 0; i < n; i++) {
		map[nextInt()][nextInt()] = 1;

	    }
	    int m = nextInt();
	    int x = 10;
	    int y = 10;
	    int count = 0;
	    for (int i = 0; i < m; i++) {
		char c = getChar();
		int l = nextInt();
		if (count != n) {
		    int dx = 0;
		    int dy = 0;
		    if (c == 'N') {
			dy = 1;
		    } else if (c == 'E') {
			dx = 1;
		    } else if (c == 'S') {
			dy = -1;
		    } else if (c == 'W') {
			dx = -1;
		    }
		    for (int j = 0; j < l; j++) {
			count += map[x][y];
			map[x][y] = 0;
			x += dx;
			y += dy;
		    }
		    count += map[x][y];
		    map[x][y] = 0;
		}
	    }
	    if (count == n) {
		System.out.println("Yes");
	    } else {
		System.out.println("No");
	    }
	}
    }

    private static char getChar() throws IOException {
	int c = ' ';
	while (c < 'E' || 'W' < c) {
	    c = buf.get();
	}
	return (char) c;
    }

    static ByteBuffer buf = ByteBuffer.allocate(10000000);

    private static int nextInt() throws IOException {
	char c = (char) buf.get();
	while ((c < '0' || '9' < c) && c != '-') {
	    c = (char) buf.get();
	}
	if (c == '-') {
	    return -nextInt();
	}
	int result = 0;
	while ('0' <= c && c <= '9') {
	    result = result * 10 + (c - '0');
	    c = (char) buf.get();
	}
	return result;
    }
}

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

string s;

void init(){
	getline(cin, s);

	//cout << s;
	int l = s.size();
	//cout << l;
	cout << s[0];
	for (int i = 7; i < l; ++i)
	{
			if(s[i] >= 65 and s[i] <= 90) {
				cout << s[i];
			}
	}

}

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};


int main(){
    char S; cin >> S;
    if(S=='A') cout << 'T' << endl;
    if(S=='T') cout << 'A' << endl;
    if(S=='C') cout << 'G' << endl;
    if(S=='G') cout << 'C' << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#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(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
#define Pll pair<ll,ll>

template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

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

int fn(int a,int b,int c,int cn){
	if(a%2||b%2||c%2) return cn;
	else return fn((b+c)/2,(a+c)/2,(a+b)/2,cn+1);
}

int main(void){
	int a,b,c;
	cin>>a>>b>>c;
	if(a%2||b%2||c%2) print(0);
	else if(a==b&&b==c) print(-1);
	else print(fn(a,b,c,0));
	
	return 0;
}




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

int main() {
  string s;
  cin >> s;
  ll k;
  cin >> k;
  ll n = min(k, (ll)s.size());
  int ans = 1;
  if(s[0]!='1') ans = s[0]-'0';
  else {
    for (int i = 1; i < (n); ++i){
      if(s[i]!='1') {
        ans = s[i]-'0';
        break;
      }
      else continue;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ii pair <int, int>
#define x first
#define y second
#define db(x) cerr << #x << " = " << x << endl;
#define _ << " _ " <<

using namespace std;

const int N = 1e3 + 7;
const int mod = 1e9 + 7;

int m, n;
int f[N][N];

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

	if(fopen("test.inp", "r")) freopen("test.inp", "r", stdin), freopen("test.out", "w", stdout);

	cin >> m >> n;
	f[0][1] = 1;
	for (int i = 1; i <= m; i++)
		for (int j = 1; j <= n; j++){
			char ch;
			cin >> ch;
			if (ch == '.')
				f[i][j] = (f[i - 1][j] + f[i][j - 1]) % mod;
			else 
				f[i][j] = 0;
		}
	cout << f[m][n];
}

Measured memory_bytes: 4224
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
#define NUM 1000000007
#define int long long
using ULL = unsigned long long;

using namespace std;

signed main()
{
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> v(n);
    vector<int> ans(n - 1);
    int sum = 0;
    for (size_t i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        sum += tmp;
        v[i] = sum;
    }
    for (size_t i = 0; i < n - 1; i++)
    {
        ans[i] = abs(v[i] - (v.back() - v[i]));
    }
    cout << *min_element(ans.begin(), ans.end()) << endl;
}

Measured memory_bytes: 3456
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		
		if( a < b && b < c )	System.out.println("Yes");
		else  System.out.println("No");
		
		
	}

}

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

N = int(input())
prime = [v for v in range(2, 55556) if v % 2 != 0]

for i in range(int(55555 ** 0.5) + 1):
    t = prime[i]
    prime = [v for v in prime if v == t or v % t != 0]
    
ans = []
for v in prime:
    if v % 5 == 1:
        ans.append(v)
        if len(ans) == N:
            print(" ".join(map(str, ans)))
            exit()

Measured memory_bytes: 4456
x = [input() for _ in range(5)]
ans = []
for i in range(5):
    if x[i][-1] == "0":
        ans.append(int(x[i]))
for j in range(9,0,-1):
    for i in range(5):
        if int(x[i][-1]) == j:
            if len(ans) != 4:
                for k in range(1,10):
                    if (int(x[i]) + k )% 10 == 0:
                        ans.append(int(x[i]) + k)
            else:
                ans.append(int(x[i]))

print(sum(ans))

Measured memory_bytes: 38256
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>

using namespace std;

#define ll long long
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 100000;
int v[5 + nmax];

int main()
{
  int n;
  cin >> n;
  int tochange = 0;
  ll result = 0;

  for(int i = 1;i <= n;i++) {
    cin >> v[i];
    if(v[i] < 0) {
      tochange++;
      v[i] = -v[i];
    }
    result += v[i];
  }
  sort(v + 1, v + n + 1);
  if(tochange % 2 == 1)
    result -= v[1] * 2;
  cout << result;
  return 0;
}


Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Integer> x = new ArrayList<>();
        IntStream.range(0, n).forEach(i -> x.add(sc.nextInt()));

        int sum = 0;
        for (int i = 0; i < n; i++) {
            if (x.get(i) < Math.abs(x.get(i) - k)) {
                sum += 2 * x.get(i);
                continue;
            }
            sum += 2 * Math.abs(x.get(i) - k);
        }
        System.out.println(sum);
    }

}


Measured memory_bytes: 27092
#include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define INF 1<<27
int n,cost[110][110],mincost[110];
bool used[110];
int prim(){
  r(i,n)mincost[i]=INF,used[i]=false;
  mincost[0]=0;
  int res=0;
  while(1){
    int v=-1;
    r(u,n)if(!used[u]&&(v==-1||mincost[u]<mincost[v]))v=u;
    if(v==-1)break;
    used[v]=1;
    res+=mincost[v];
    r(u,n)mincost[u]=min(mincost[u],cost[v][u]);
  }
return res;
}
int main(){
  int m,q,w,e;
  while(cin>>n>>m,n){
  r(i,n)r(j,n)cost[i][j]=INF;
  while(m--)cin>>q>>w>>e,cost[w][q]=cost[q][w]=e;
  cout<<prim()<<endl;
}
}

Measured memory_bytes: 3096
N,T = map(int,input().split())

c = []
for i in range(N):
  ci,ti = map(int,input().split())
  c.append([ci,ti])
  
c.sort(key=lambda x:x[0])

for i in range(N):
  if c[i][1] <= T:
    print(c[i][0])
    exit()
print('TLE')

Measured memory_bytes: 3060
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  int ans = 0;
  rep(i, n) ans += r[i] - l[i] + 1;
  cout << ans << endl;


  
  return 0;
}

Measured memory_bytes: 256
p = [i for i in range(200001)]
r = [1 for i in range(200001)]
ans = [1 for i in range(200001)]

def fs(a):
    if p[a] == a: return a
    p[a] = fs(p[a])
    return p[a]

def js(a, b):
    a = fs(a)
    b = fs(b)
    if a == b: return
    if r[a] > r[b]:
        p[b] = a
        ans[a] += ans[b]
    elif r[b] > r[a]:
        p[a] = b
        ans[b] += ans[a]
    else:
        p[b] = a
        ans[a] += ans[b]
        r[a] += 1

n, k = map(int,input().split())
for i in range(k):
    a, b = map(int,input().split())
    js(a, b)

ans1 = 0
for i in range(1, n+1):
    ans1 = max(ans1, ans[fs(i)])

print (ans1)

Measured memory_bytes: 113772
#include<bits/stdc++.h>
using namespace std;
long long a,b;

int main(){
    cin>>a>>b;
    if(a>0)cout<<"Positive";
    else if(a==0||(a<0&&b>0))cout<<"Zero";
    else if((abs(b)-abs(a))%2!=0)cout<<"Positive";
    else cout<<"Negative";
    return 0;
}

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

using namespace std;

typedef long long LL;

#define fin "\n"


#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

template <typename T>
inline void chmin(T &l,T r){l=min(l,r);}

template <typename T>
inline void chmax(T &l,T r){l=max(l,r);}

template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
int main(){
    int N;
    cin>>N;
    vector<int> v(2,0);
    REP(i,N){
        int a;
        cin>>a;
        v[a%2]++;
    }
    v[0]+=v[1]/2;
    v[1]%=2;
    v[0]%=2;
    if(v[1]+v[0]==2)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << -1; return;}
#define yes {cout << "Yes"; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

void solve() {
    int a, b;
    cin >> a >> b;
    for (int i = b * 10; i < (b + 1) * 10; ++i)
        if (2 * i / 25 == a) {
            cout << i; return;
        }
    cout << -1;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3624
import heapq
n, d = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)

for _ in range(d):
    t = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-t//2))

print(-sum(a))

Measured memory_bytes: 72216
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

bool valid(string a) {
  stack <char> s;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == '(') {
      s.push(a[i]);
    } else {
      if (s.empty()) return 0;
      char c = s.top();
      if (c != '(') return 0;
      s.pop();
    }
  }
  return (s.empty());
}

bool operator - (const string &a, const string &b) {
  if (a.size() != b.size()) {
    return a.size() < b.size();
  }
  for (int i = 0; i < a.size(); i++) {
    if (a[i] != b[i]) {
      return (a[i] < b[i]);
    }
  }
}

int main() {
  int n;
  string a, here;
  cin >> n >> a;
  string ans = string(400, '.');
  for (int i = 0; i <= 100; i++) {
    for (int j = 0; j <= 100; j++) {
      string add = string(i, '(');
      here = add + a;
      here += string(j, ')');
      if (!valid(here)) continue;
      if (here - ans) {
        ans = here;
      }
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
using namespace std;
typedef pair<int,int> P;//Pでpair<-,->を表す。
typedef long long LL; 
LL MOD=1000000007;

int main()
{ 
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        s[i]='x';
    }
    cout<<s<<endl;
    return 0;
}

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

int main() {
    ll n;
    string s;
    cin >> s;
    n = s.size()+1;
    vector<ll> a(n);
    for(ll i=0,cnt=0;i<n-1;i++){
        if(s[i] == '<') cnt++;
        else cnt = 0;
        a[i+1] = cnt;
    }
    for(ll i=n-2,cnt=0;i>=0;i--){
        if(s[i] == '>') cnt++;
        else cnt = 0;
        a[i] = max(a[i],cnt);
    }
    ll sum = 0;
    for(int i=0;i<n;i++){
        sum += a[i];
    }
    cout << sum << endl;
    return 0;
}




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

typedef long long ll;
const int INF = 1e9;

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             

int dp[50] = {};

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

	dp[0] = 1; 
	dp[1] = 1;
	FOR( i, 2, 50 ) {
		dp[i] = dp[i - 1] + dp[i - 2];
	}

	cout << dp[n] << endl;
}


Measured memory_bytes: 3088
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>
 
using namespace std;
 
 
int main(void) {
	long long N;
	scanf("%lld", &N);
	if(N%2 == 0){
	    printf("%lld\n",N);
    }else{
    	printf("%lld\n",N*2);
 	}
 	return 0;
}
 


Measured memory_bytes: 128
use std::cmp;
use std::collections::BinaryHeap;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { reader: s.lock() };
    let x: usize = sc.read();
    let y: usize = sc.read();
    let z: usize = sc.read();
    let n = x + y + z;
    let mut abc = vec![];
    for i in 0..n {
        let a: i64 = sc.read();
        let b: i64 = sc.read();
        let c: i64 = sc.read();
        abc.push((a, b, c));
    }
    abc.sort_by_key(|&(a, b, _)| b - a);

    let mut cur_x = 0;
    let mut prefix = vec![0; z + 1];
    let mut q = BinaryHeap::new();

    for i in 0..x {
        let (a, _, c) = abc[i];
        cur_x += a;
        q.push((c - a, a, c));
    }

    prefix[0] = cur_x;
    let mut cur_z = 0;
    for i in 0..z {
        let (a, _, c) = abc[i + x];
        cur_x += a;
        q.push((c - a, a, c));

        let (d, a, c) = q.pop().unwrap();
        cur_x -= a;
        cur_z += c;
        prefix[i + 1] = cur_x + cur_z;
    }

    let mut q = BinaryHeap::new();
    let mut suffix = vec![0; z + 1];
    let mut cur_y = 0;
    for i in 0..y {
        let (_, b, c) = abc[n - 1 - i];
        cur_y += b;
        q.push((c - b, b, c));
    }
    suffix[z] = cur_y;
    let mut cur_z = 0;
    for i in 0..z {
        let (_, b, c) = abc[n - 1 - y - i];
        cur_y += b;
        q.push((c - b, b, c));

        let (d, b, c) = q.pop().unwrap();
        cur_y -= b;
        cur_z += c;
        suffix[z - 1 - i] = cur_y + cur_z;
    }

    let mut ans = 0;
    for i in 0..(z + 1) {
        ans = cmp::max(ans, prefix[i] + suffix[i]);
    }
    println!("{}", ans);
}

pub struct Scanner<R> {
    reader: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 13432
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;
int a,b,c,d;
int k1,k2;
string s;

int main(){
  cin >>a;
  cout << 48-a << endl;
  
  return 0;
}



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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	string s;
	cin >> s;
	cout << ((s[2] == s[3] && s[4] == s[5]) ? "Yes\n" : "No\n");
	
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
#include <vector>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <list>
using namespace std;

vector<int> igets(int N) {
	vector<int> A;
	int temp;
	for (int i = 0; i < N; ++i) {
		cin >> temp;
		A.push_back(temp);
	}
	return A;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	int N;
	cin >> N;
	list<int> DATA;
	for (int i = 0; i < N; i++)
	{
		string commnad;
		cin >> commnad;
		int num;
		if(commnad=="insert" || commnad == "delete")
			cin >> num;
		if (commnad == "insert") {
			DATA.push_front(num);
		}
		else if (commnad == "delete") {
			for (list<int>::iterator ip = DATA.begin(); ip != DATA.end(); ip++) {
				if (*ip == num){
					DATA.erase(ip);
					break;
				}
			}
		}
		else if (commnad == "deleteFirst") {
			DATA.pop_front();
		}
		else {
			DATA.pop_back();
		}
	}
	bool a = 1;
	for (list<int>::iterator ip = DATA.begin(); ip != DATA.end(); ip++)
	{
		if (a) {
			cout << *ip;
			a = 0;
		}
		else cout << " " << *ip;
	}
	cout << endl;
}


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

#define min(a, b) ((a) > (b) ? (b) : (a))

int main(void) {
  int i;
  int A, B;
  scanf("%d %d", &A, &B);
  for(i = A * 12.5F;i <= B * 20;i++) {
    if(A == floorf(i * 0.08F) && B == floorf(i * 0.1F)) {
      printf("%d\n", i);
      return 0;
    }
  }
  puts("-1");
  return 0;
}


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

int main() {
    int n,d,x;
    cin>>n>>d>>x;
    d--;
    for (int i=0;i<n;i++) {
        int a;
        cin>>a;
        x+=d/a+1;
    }
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main(void) {
  int h,n,tmp;
  cin >> h >> n;
  
  int total = 0;
  
  rep(i,n){
    cin >> tmp;
    total = total + tmp;
  }
  
  if(total>=h){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MAX = 1000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
//setprecision(15)

int main() {
	int N; cin >> N;
	int ans = (N / 2) + (N % 2);
	cout << ans << endl;
}

Measured memory_bytes: 3548
WHITE = 0
GRAY = 1
BLACK = 2

NIL = -1


def dfs(u):
    global time
    color[i] = GRAY
    time += 1
    d[u] = time
    for v in range(n):
        if m[u][v] and (color[v] == WHITE):
            dfs(v)
        color[u] = BLACK
    time += 1
    f[u] = time


def next(u):
    for v in range(nt[u], n + 1):
        nt[u] = v + 1
        if m[u][v]:
            return v
    return NIL
            


n = int(input())

m = [[0 for i in range(n + 1)] for j in range(n + 1)]
vid = [0] * n
d = [0] * n
f = [0] * n
S = []
color = [WHITE] * n
time = 0
nt = [0] * n

tmp = []
for i in range(n):
    nums=list(map(int,input().split()))
    tmp.append(nums)
    vid[i] = nums[0]

for i in range(n):
    for j in range(tmp[i][1]):
        m[i][vid.index(tmp[i][j + 2])] = 1

for i in range(n):
    if color[i] == WHITE:
        dfs(i)

for i in range(n):
    print(vid[i], d[i], f[i])






Measured memory_bytes: 5824
#include <bits/stdc++.h>
using namespace std;
#define SQ(a) ((a)*(a))
typedef tuple<double, int, int> Tp;
#define at(t, i) get<i>(t)

struct UnionFind {
	vector<int> parent;
	
	UnionFind(int n){
		parent.resize(n);
		for (int i = 0; i < n; i++){
			parent[i] = i;
		}
	}
	
	int find(int x){
		if (parent[x] == x) return x;
		return parent[x] = find(parent[x]);
	}
	
	bool same(int x, int y){
		return find(x) == find(y);
	}
	
	bool unite(int x, int y){
		x = find(x);
		y = find(y);
		if (x == y) return false;
		parent[x] = y;
		return true;
	}
};

struct Point {
	double x, y, z;
	Point(){}
	Point(double x, double y, double z): x(x), y(y), z(z){}
};

struct Circle {
	Point p;
	double r;
	Circle(){}
	Circle(double x, double y, double z, double r): p(x, y, z), r(r){}
};

inline double dist(Point &a, Point &b)
{
	return sqrt(SQ(a.x - b.x) + SQ(a.y - b.y) + SQ(a.z - b.z));
}

inline double dist(Circle &a, Circle &b)
{
	return max(0.0, dist(a.p, b.p) - a.r - b.r);
}

int n;
Circle cs[100];

int main()
{
	while (scanf("%d", &n), n){
		for (int i = 0; i < n; i++){
			double x, y, z, r;
			scanf("%lf %lf %lf %lf", &x, &y, &z, &r);
			cs[i] = Circle(x, y, z, r);
		}
		
		vector<Tp> es;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				if (i == j) continue;
				es.push_back(Tp(dist(cs[i], cs[j]), i, j));
			}
		}
		
		sort(es.begin(), es.end());
		
		double res = 0.0;
		UnionFind uf(n);
		for (int i = 0; i < es.size(); i++){
			double cost = at(es[i], 0);
			int a = at(es[i], 1), b = at(es[i], 2);
			if (uf.unite(a, b)) res += cost;
		}
		
		printf("%.3f\n", res);
	}
}

Measured memory_bytes: 1608
#include<stdio.h>
#define N 100000
#define M 5010

int main(void){
  int i,j,k,n,num;
  int number[M];
  int sum,max[N];

  for(i=0;;i++){
    scanf("%d\n",&num);
    if(num==0)
      break;
    for(j=0;j<num;j++)
      scanf("%d",&number[j]);
    max[i]=number[0];
    for(j=0;j<num;j++){
      sum=0;
      for(k=j;k<num;k++){
        sum+=number[k];
        if(sum>max[i])  max[i]=sum;
      }
    }
  }
  n=i;
  for(i=0;i<n;i++)
    printf("%d\n",max[i]);
  return 0;
}

Measured memory_bytes: 0
import bisect

#データの代入
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

#昇順にソート
A.sort()
B.sort()
C.sort()
 
#方針
#適当にBを決める
#当てはまるAとCのパターン数を求める
#A×C
#これをすべてのBで繰り返す

pattern = 0
minA = min(A)
maxC = max(C)

for i in B:
        if minA < i and maxC > i:
                #あてはまるA,Cが存在
                index = bisect.bisect_left(A, i)
                index2 = bisect.bisect_right(C, i)

                #挿入できる個数
                canA = index
                canC = N - index2

                pattern += canA * canC
        
print(pattern)

Measured memory_bytes: 23360
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		sc.nextInt();
		
		String input = sc.next();
		String abc = "ABC";
		
		int count = 0;
		
		for(int i = 0; i < input.length() - abc.length() + 1; i++) {
			if(input.substring(i, i + abc.length()).equals(abc)) {
				count++;
			}
		}
		
		System.out.println(count);
	}

}


Measured memory_bytes: 23892
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    private static Map<Integer, Double> expectedValues = new HashMap<>();

    private static double expectedValue(int i) {
        double res = 0;

        for (int j = 1; j <= i; j++) {
            res += ((double) j) / i;
        }

        return res;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        double[] ps = new double[n];

        for (int i = 0; i < n; i++) {
            int p = sc.nextInt();

            if (!expectedValues.containsKey(p)) {
                expectedValues.put(p, expectedValue(p));
            }
            ps[i] = expectedValues.get(p);
        }

        for (int i = 1; i < ps.length; i++) {
            ps[i] += ps[i - 1];
        }

        double res = 0;

        for (int i = k - 1; i < ps.length; i++) {
            if (i - k >= 0) {
                res = Math.max(res, ps[i] - ps[i - k]);
            } else {
                res = ps[i];
            }
        }

        System.out.println(res);
    }
}

Measured memory_bytes: 84888
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stderr, stdin, stdout, BufRead, BufWriter, Read, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::{i64, u64, usize};
#[allow(unused_macros)]
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;($($r :tt ) *) =>{let mut s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
#[allow(unused_macros)]
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;}
#[allow(unused_macros)]
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .expect ("Parse error" ) } ;}
#[allow(unused_macros)]
macro_rules !dbg {($($a :expr ) ,*) =>{writeln !(&mut stderr () ,concat !($(stringify !($a ) ," = {:?}, " ) ,*) ,$($a ) ,*) .unwrap () ;} }

fn f(x: u64) -> u64 {
    if x == 1 {
        1
    } else {
        2 * f(x / 2) + 1
    }
}

#[allow(non_snake_case)]
#[allow(dead_code)]
fn main() {
    input! {
        h: u64
    }
    let mut h = h;
    println!("{}", f(h));
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
    long long n;
    cin >> n;
    vector<long long> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    long long ans=1;
    long long temp = a[0];
    bool flag = false;
    bool valid = false;
    if(n==1){
        cout << ans << endl;
    }else{
        for(int i=1;i<n;i++){
            if(valid == true){
                if(flag == true){
                    if(temp>a[i]){
                        ans++;
                        valid = false;
                    }
                }else{
                    if(temp<a[i]){
                        ans++;
                        valid = false;
                    }
                }
            }else{
            if(temp < a[i]){
                valid = true;
                flag = true;
            }else if(temp > a[i]){
                valid = true;
                flag = false;
            }else if(temp == a[i]){
            }else{
                ans++;
            }
        }
        temp = a[i];
    }
    cout << ans << endl;
    }
}

Measured memory_bytes: 1024
/*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	double d = 0.0;	// ????????????????????¢
	double a = 0.0;	// ?????????????????????
	double x = 0.0;
	double y = 0.0;
	int ak = 90;	// ???????????????90????????????
	while (true)
	{
		scanf("%lf,%lf", &d, &a);	// double?????????????????????%f??§????????????%lf?????????
		if (d == 0 && a == 0) { break; }
		x += cos(ak*M_PI / 180) * d;
		y += sin(ak*M_PI / 180) * d;
		ak -= a;
		ak %= 360;
	}
	// ??????
	cout << (int)x << "\n" << (int)y << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= 100000; ++i) {
        int x = i * 8 / 100;
        int y = i * 10 / 100;
        if (x == a && y == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 3664