akhauriyash/Code-Regression huggingface dataset:
//Beginner
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;
const int INF = 1 << 29;
int main ()
{
    int N,R;
    cin >> N >> R;
    if (N < 10) {
        cout << (R + (100 * (10 - N))) << endl;
    }
    else {
        cout << R << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int X = Integer.parseInt(tokens[0]);
		int Y = Integer.parseInt(tokens[1]);
		int result = getValue(X) + getValue(Y);
		if (X == 1 && Y == 1) {
			result += 400000;
		}
		System.out.println(result);
	}

	static int getValue(int rank) {
		switch (rank) {
		case 1:
			return 300000;
		case 2:
			return 200000;
		case 3:
			return 100000;
		default:
			return 0;
		}
	}

}


Measured memory_bytes: 21076
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

// こちらを参考にした
// https://drken1215.hatenablog.com/

func main() {
	var A int
	var B float64
	fmt.Scan(&A, &B)
	B100 := int(B*100 + 0.001)
	ans := (A * B100) / 100
	fmt.Println(ans)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 1856
using System;
class aizu{
    public static int Main(){
        int[] n = new int[2];
        string[] str = new string[100];
        for( ; ; ){
        	str = Console.ReadLine().Split(' ');
        	n[0] = int.Parse(str[0]);
            n[1] = int.Parse(str[1]);
        	if(n[0]==0 && n[1]==0) break;
            Array.Sort(n);
        	Console.WriteLine("{0} {1}",n[0],n[1]);
        }
        return 0;
    }
}

Measured memory_bytes: 9320
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e12;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 998244353;


int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n;
    string s, t;
    cin >> n;
    cin >> s >> t;
    for(int i = 0; i < n; i++)
        cout << s[i] << t[i];
    return 0;
}

Measured memory_bytes: 256
s = input()

def check(ss):
    idx = 1
    nn = (len(ss)-1)//2
    if len(ss) == 1:
        return True
    elif len(ss) == 2:
        if ss[0]==ss[1]:
            return True
        else:
            return False
    for i in range(nn):
        #print('s ss[i], ss[-i-1]: ', s, ss[i], ss[-i-1])
        if ss[i] != ss[-i-1]:
            return False
    return True
    

if check(s):
    if check(s[:(len(s)-1)//2]):
        if check(s[(len(s)+3)//2-1:]):
            print('Yes')
            exit()

print('No')
    
    

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

using namespace std;

signed main() {
    int n, k, s;
    int inf = 1e9;
    cin >> n >> k >> s;
    vector<int> arr(n);
    for (int i = 0; i < k; ++i) {
        arr[i] = s;
    }
    for (int i = k; i < n; ++i) {
        if (s == inf) {
            arr[i] = 1;
        } else {
            arr[i] = inf;
        }
    }
    for (auto i : arr)
        cout << i << ' ';
    cout << endl;
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")
ll dp[3100][3100][4];
ll field[3100][3100];
int main()
{
	int R, C, K;
	cin >> R >> C >> K;
	fx(K) {
		int r, c, v;
		cin >> r >> c >> v;
		field[r-1][c-1] = v;
	}
	

	fx(R) {
		fy(C) {

			if(y==0) {
				if (field[x][0]>0) {
					dp[x][0][2] = max(dp[x][0][2], dp[x][0][3]+field[x][0]);
				}
			}

			fz(4) {
				if (y+1<C) {
					dp[x][y+1][z] = max(dp[x][y][z], dp[x][y + 1][z]);
					if (field[x][y+1]>0 && z>0) {
						dp[x][y+1][z - 1] = max(dp[x][y+1][z - 1], dp[x][y+1][z]+ field[x][y+1]);
					}
				}
			}
			if (x + 1 < R) {
				ll ma = max({ dp[x][y][0],  dp[x][y][1] , dp[x][y][2] , dp[x][y][3] });
				dp[x + 1][y][3] = ma;
			}
		}
	}

	ce(max({ dp[R - 1][C - 1][0],  dp[R - 1][C - 1][1] , dp[R - 1][C - 1][2] , dp[R - 1][C - 1][3] }))

    return 0;
}



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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String[] words = str.split(" ");
		int[] times = new int[words.length];
		int max = 0;
		int maxleng = 0;
		int maxlengindex = -1;
		for (int i = 0; i < words.length; i++) {
			if (words[i].length() > maxleng) {
				maxleng = words[i].length();
				maxlengindex = i;
			}
			for (int j = i + 1; j < words.length; j++) {
				if (words[i].equals(words[j])) {
					times[i]++;
					if (times[i] > max)
						max = times[i];
				}
			}
		}
		for (int i = 0; i < words.length; i++)
			if (times[i] == max)
				System.out.print(words[i] + " ");
		System.out.println(words[maxlengindex]);
	}
}

Measured memory_bytes: 24504
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int H,W;
    while(true){
        cin>>H>>W;
        if(H==0&&W==0){
            break;
        }
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
            cout<<'#';
        }
        cout<<endl;
    }
    cout<<endl;
}
}


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

int main() {
  int N;
  int64_t K;
  cin >> N >> K;
  vector<int>A(N);
  vector<int>B(N);
  for(int i=0; i<N; i++)cin >> A.at(i) >> B.at(i);
  vector<pair<int, int>>P(N);
  for(int i=0; i<N; i++)P.at(i)=make_pair(A.at(i), B.at(i));
  sort(P.begin(), P.end());
  int64_t count=0;
  
  for(int i=0; i<N; i++){
    count += P.at(i).second;
    if(count >= K){
      cout << P.at(i).first << endl;
      break;
    }
  }
  
    
}

Measured memory_bytes: 4824
#include<iostream>
#include<string>
using namespace std;
int ans[10005];
int main()
{
    string s;
    int top=0;
    while(cin>>s)
    {
        //if(s[i]==' ')continue;
        if(s[0]=='+')
        {
            int a=ans[top--];
            int b=ans[top--];
            ans[++top]=a+b;
        }
        else if(s[0]=='*')
        {
            int a=ans[top--];
            int b=ans[top--];
            ans[++top]=a*b;
        }
        else if(s[0]=='-')
        {
            int a=ans[top--];
            int b=ans[top--];
            ans[++top]=b-a;
        }
        else if(s[0]=='/')
        {
            int a=ans[top--];
            int b=ans[top--];
            ans[++top]=b/a;
        }
        else
        {
            ans[++top]=stoi(s);
        }
    }
    cout<<ans[top]<<endl;
    return 0;
}



Measured memory_bytes: 3160
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <math.h>
using namespace std;
using s64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{
    int a,b,c;
    cin >> a >> b >> c;

    int cnt = c <= b/a ? c : b/a;

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define LL long long
#define PI 3.14159265359
template<class T> inline void chmax(T & a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

int main(void) {
	int A, B, C;
	cin >> A >> B >> C;

	if (A + B >= C) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;

signed main(){
	string s;
	cin >> s;
	if(s == "ABC")out("ARC");
	else out("ABC");
}

Measured memory_bytes: 3628
//
//  main.cpp
//  A - Transfer
//
//  Created by Hashizo on 2019/08/04.
//  Copyright © 2019 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>

using namespace std;

#undef LONG_MAX
#undef LONG_MIN

#define LONG_MAX	9223372036854775807
#define LONG_MIN	(-LONG_MAX  -1)

#define ll long long

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

int main(int argc, const char * argv[]) {
	ll a,b,c;
	cin >> a >> b >> c ;

	ll d;
	if ((c - (a- b)) < 0) {
		d = 0;
	}
	else {
		d = c - (a- b);
	}
	
	cout << d << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


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

	int N;
	ll x;
	cin >> N >> x;
	vector<ll>a(2*N);
	for (int i = 0; i < N; i++)cin >> a[i];
	for (int i = 0; i < N; i++)a[i+N] = a[i];


	vector<vector<ll>>li(N);
	for (int i = 0; i < N; i++) {
		for (int k = 0; k < N; k++) {
			if (k == 0)li[i].pb(a[N+i]);
			else li[i].pb(min(a[N+i-k],li[i][k-1]));
		}
	}

	ll ans = inf;
	for (int k = 0; k < N; k++) {
		ll temp = k * x;
		for (int i = 0; i < N; i++)temp += li[i][k];
		ans = min(ans, temp);
	}
	puts(ans);


	return 0;
}

Measured memory_bytes: 32384
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin>>n;
    for (;n--;){
        int a,b,c;
        cin>>a>>b>>c;
        if (a>b) swap(a,b);
        if (b>c) swap(b,c);
        if (a*a + b*b == c*c)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
} 

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long

bool kaibun(string s){
    string t=s;
    reverse(s.begin(),s.end());
    return t==s;
}

int main(void)
{
    ll x,y; cin>>x>>y;
    bool ok=false;
    for(int i=0;i<=x;i++){
        ll kame=x-i;
        if(y==2*i+4*kame) ok=true;
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;

}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#define int long long
#define INF 100000000000
#define EPS 0.0000000001
 
using namespace std;
int movex[300000], movey[300000];
int graphx[300];
int graphy[300];
int photox[10100];
int photoy[1010];
 
void syoki() {
    for (int i = 0; i<300000; i++) {
        movex[i] = 0;
        movey[i] = 0;
    }
    for (int i = 0; i<1010; i++) {
        graphx[i] = 0;
        graphy[i] = 0;
        photox[i] = 0;
        photoy[i] = 0;
    }
}
 
signed main() {
    int m, n;
    int x, y;
    while (1) {
        syoki();
        cin >> m;
        if (m == 0)break;
        for (int i = 0; i < m; i++) {
            cin >> x >> y;
            graphx[i] = x;
            graphy[i] = y;
        }
        cin >> n;
        for (int i = 0; i < n; i++) {
            cin >> x >> y;
            photox[i] = x;
            photoy[i] = y;
 
        }
        int k = 0;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                movex[k] = photox[j] - graphx[i];
                movey[k] = photoy[j] - graphy[i];
                k++;
            }
        }
        int cntx = 0;
        int cnty = 0;
        int ansx = 0, ansy = 0;
        sort(movex, movex + k);
        sort(movey, movey + k);
        for (int i = 0; i < k; i++) {
            if (movex[i] == movex[i + 1])cntx++;
            else cntx = 0;
            if (movey[i] == movey[i + 1])cnty++;
            else cnty = 0;
            if (cntx == m - 1)ansx = movex[i];
            if (cnty == m - 1)ansy = movey[i];
            //cout << movex[i] << " " << movey[i] << endl;
            //printf("[%d] [%d]",cntx,cnty);
            if (ansx&&ansy)break;
        }
        cout << ansx << " " << ansy << endl;
    }
    return 0;
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  if(R < 1200) cout << "ABC" << endl;
  else if(R < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
  
  return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 18:01 -> 18:36 (give up. TLE)
from collections import deque

dx = [0,1,0,-1]
dy = [1,0,-1,0]

H, W = map(int, input().split())

A = []
black_deque = deque()

for i in range(H):
    A.append(list(input()))
    black_deque.extend([(i,j) for j in range(W) if A[i][j] == '#'])

if len(black_deque) == H*W:
    print(0)
    exit(0)

for x,y in black_deque:
    A[x][y] = 0

while len(black_deque) != 0:
    x,y = black_deque.popleft()
    depth = A[x][y]
    for k in range(4):
        new_x = x+dx[k]
        new_y = y+dy[k]
        if 0 <= new_x < H and \
           0 <= new_y < W and \
           A[new_x][new_y] == '.':
            black_deque.append((new_x, new_y))
            A[new_x][new_y] = depth+1

print(depth)

Measured memory_bytes: 190240
#include <iostream>
#include <string>

using namespace std;

int main() {
    string a, b;
    cin >> a >> b;
    if (a == b)
        cout << "EQUAL" << endl;
    else if (a.size() > b.size() || (a.size() == b.size() && a > b))
        cout << "GREATER" << endl;
    else
        cout << "LESS" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <list>
#include <sstream>
#include <string>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

string print(list<string>& l){
	string s="";
	for(list<string>::iterator it=l.begin();it!=l.end();it++){
		s+=*it;
	}
	return s;
}

int main(void){
	int n,K;

	while(cin>>n>>K,n||K){
		string a[10];
		string s;
		std::map<string,bool> m;
		std::list<string> L;
		for(int i=0;i<n;i++)cin>>a[i];
		rep(i,n){
			L.push_back(a[i]);
			if(K==1){
				m[print(L)]=true;
				L.pop_back();
				continue;
			}
			rep(j,n){
				if(i==j)continue;
				L.push_back(a[j]);
				if(K==2){
					m[print(L)]=true;
					L.pop_back();
					continue;
				}
				rep(k,n){
					if(i==k||j==k)continue;
					L.push_back(a[k]);
					if(K==3){
						m[print(L)]=true;
						L.pop_back();
						continue;
					}
					rep(l,n){
						if(i==l||j==l||k==l)continue;
						L.push_back(a[l]);
						if(K==4){
							m[print(L)]=true;
							L.pop_back();
							continue;
						}
						L.pop_back();
					}
					L.pop_back();
				}
				L.pop_back();
			}
			L.pop_back();
		}
		cout<<m.size()<<endl;
	}
	return 0;
}

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

int main(){
	int n;
  	cin >> n;
  	vector<int> l(n);
  	rep(i, n) cin >> l[i];
  
  	sort(l.begin(), l.end());
  	int ans = 0;
  	rep(b, n){
    	rep(a, b){
          	int ab = l[a] + l[b];
          	int c;
			for(c = b+1;c < n; c++){
            	if(ab <= l[c]) break;; 
            }
          	ans += c-(b+1);
        }
    }
  
  	cout << ans << endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>
#include <algorithm>
#include <string>
#include <queue>
#include <numeric>
#pragma warning(disable : 4996)
#define nptr nullptr
#define all(x) (x).begin(), (x).end()
#define drobucs ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define ff first
#define ss second
using namespace std;
typedef long long ll;

const int maxn = (int)1e5 + 13;
const ll INFL = 9223372036854775807;
const int INF = 2147483647;
const ll MOD = (int)1e9 + 9;//1e9 + 21, 1e9 + 33, 1e9 + 87, 1e9 + 93
const ll base = 101;
const long double pi = 3.1415926535897932;



int main() {
	drobucs;
	
	ll k, a, b;
	cin >> k >> a >> b;
	for (int i = 0; i <= b; i += k) {
		if (a <= i) {
			cout << "OK\n";
			return 0;
		}
	}
	cout << "NG\n";
	return 0;
}

Measured memory_bytes: 3532
// JAI SHREE RAM
#pragma GCC optimize("O3")
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define sec second
#define fir first
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(ll (i)=(m);(i)<(n);(i)++)
// #define all(a) (a).begin(),(a).end()
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
#define MOD 998244353
int n, k, c;
set<ll>st;
std::vector<ll> a,b;
void cnt(string x)
{

	int g = 0;
	for (int i = 0; i < n && g<k ; i++ )
	{
		if (x[i] == 'o')
		{
			g++;
			a.pb(i);
			i += c ;
		}

	}
	g = 0;
	for (int i = n - 1; i >= 0 && g<k ; i-- )
	{
		if (x[i] == 'o')
		{
			g++;
			b.pb(i);
			i -= (c);
		}

	}

	// for (auto el : st)
	// 	cout << el << endl;


	for(int i=0;i<k;i++)
	{
		if(a[i]==b[k-1-i])
			cout<<a[i]+1<<endl;
	}
	return ;
}
void solve()
{
	string s;
	cin >> n >> k >> c;
	cin >> s;
	cnt(s);
}

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	fast
	int T;
	// cin >> T;
	T = 1;
	while (T--)
	{
		solve();
	}
	return 0;
}


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

using namespace std;
int cnt=0,len;
char s[100005];
int main()
{
	scanf("%s",s+1);len=strlen(s+1);
	for(int i=1;i<=len;i++)
		if(s[i]!=s[i-1]) cnt++;
	printf("%d",cnt-1);
	return 0;
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------
ll gcd(ll a, ll b){ return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return a/gcd(a,b)*b;}

map<ll, ll> prime_factorize(ll n) {
  map<ll, ll> mp;
  while(n%2==0){
    mp[2]++;
    n/=2;
  }
  for(ll i=3; i*i<=n; i+=2){
    while(n%i==0){
      mp[i]++;
      n/=i;
    }
  }
  if(n != 1) mp[n] = 1;
  return mp;
}

int main(void) {
  int n;
  cin >> n;
  arr(a,n);

  int tmp=a[0];
  rep(i,n){
    tmp = gcd(tmp, a[i]);
  }
  if(tmp!=1){
    prt("not coprime");
    return 0;
  }

  map<ll, int> chk;
  rep(i,n){
    map<ll,ll> plist=prime_factorize(a[i]);
    for(auto k : plist){
      chk[k.first]++;
    }
  }

  for(auto k : chk){
    if(k.second>1){
      prt("setwise coprime");
      return 0;
    }
  }

  prt("pairwise coprime");

}


Measured memory_bytes: 11912
let h, n = Scanf.scanf " %d %d" @@ fun a b -> a, b
let ab_s = Array.init n @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a, b
let dp = Array.make (h + 1) (1 lsl 40)
let _ = for i = 1 to h do Array.iter (fun (a, b) -> dp.(i) <- min dp.(i) @@ if a >= i then b else dp.(i - a) + b) ab_s done; Printf.printf "%d\n" @@ dp.(h)

Measured memory_bytes: 3456
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
 
public class Program
{
    public void Proc() {
        Reader.IsDebug = false;
        long[] inpt = Reader.ReadLine().Split(' ').Select(a=>long.Parse(a)).ToArray();
        this.SCount = inpt[0];
        this.CCount = inpt[1];

        long s = this.GetSCount(this.SCount, this.SCount + this.CCount / 2);
        long ans = GetCount(s);
        Console.WriteLine(ans);
    }

    private long GetSCount(long min, long max) {

        long mid1 = min + (max-min)/3;
        long mid2 = min + ((max-min)*2/3);

        long[] vals = new long[]{GetCount(min), GetCount(mid1), GetCount(mid2), GetCount(max)};
        long v = vals.Max();

        if(max-min <= 3) {
            if(vals[0] == v) {
                return min;
            } else if(vals[1] == v) {
                return mid1;
            } else if(vals[2] == v) {
                return mid2;
            }
            return max;
        }

        if(vals[0] == v) {
            return this.GetSCount(min, mid1);
        } else if(vals[1] == v) {
            return this.GetSCount(min, mid2);
        } else if(vals[2] == v) {
            return this.GetSCount(mid1, max);
        } else {
            return this.GetSCount(mid2, max);
        }

    }
    private long GetCount(long s) {
        long makeS = s-this.SCount;

        long c = CCount - (makeS*2);

        if(c < 0) {
            return 0;
        }

        return Math.Min(s, c/2);

    }

    private long SCount;
    private long CCount;

    public class Reader {
        public static bool IsDebug = true;
        private static System.IO.StringReader SReader;
        private static string InitText = @"



12345 678901




";
        public static string ReadLine() {
            if(IsDebug) {
                if(SReader == null) {
                    SReader = new System.IO.StringReader(InitText.Trim());
                }
                return SReader.ReadLine();
            } else {
                return Console.ReadLine();
            }
        }
    }
    public static void Main(string[] args)
    {
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 11348
#include<iostream>
using namespace std;
int main(int n,char**){
    int i,c0=0,c1=0,c2=0,c3=0;
    cin>>n;
    for(i=0;i<n;i++){
        string s;
        cin>>s;
        if(s=="AC"){
            c0++;
        }else if(s=="WA"){
            c1++;
        }else if(s=="TLE"){
            c2++;
        }else if(s=="RE"){
            c3++;
        }
    }
    cout<<"AC x "<<c0<<endl;
    cout<<"WA x "<<c1<<endl;
    cout<<"TLE x "<<c2<<endl;
    cout<<"RE x "<<c3<<endl;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
int main(){
    int n,i;
    double S,a;;
    while(true){
        cin >> n;
        if(n==0)break;
        vector<int> A(n);
        S=0;
        for(i=0;i<n;i++){
            cin >> A.at(i);
            S += A.at(i);
        }
        S /= n;
        a=0;
        for(i=0;i<n;i++){
            a += (A.at(i)-S)*(A.at(i)-S);
        }
        a /=n;
        printf("%.4lf\n",sqrt(a));
    }
    return 0;
}


Measured memory_bytes: 3120
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
// bool operator<(const pair<int, int> &a, const pair<int, int> &b)
// {
//     if (a.first == b.first)
//         return a.second < b.second;
//     return a.first < b.first;
// };

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

/*bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}*/

int arr[1000010];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(8);

    int s;
    cin >> s;
    int idx = 1;
    for (int i = 0; i < 1000010; ++i)
        arr[i] = -1;
    while (1)
    {
        if (arr[s] == -1)
        {
            arr[s] = idx;
        }
        else
        {
            cout << idx << endl;
            return 0;
        }
        if (s % 2 == 0)
        {
            s = s / 2;
        }
        else
        {
            s = 3 * s + 1;
        }
        idx++;
    }
    return 0;
}

Measured memory_bytes: 4224
# 愚直にQ回分各頂点を更新すると Q * N = 10^10 回の更新が必要で間に合わない
# 根のカウントを累計しておき、最後に木全体を操作しながらカウントを算出する
# 答えとなるカウント数 = 親 + 自分のカウントでOKなはず

from collections import deque

N, Q = map(int, input().split())

T = [[] for _ in range(N + 1)]

counts = [0] * (N + 1)

for _ in range(N - 1):
  a, b = map(int, input().split())
  T[a].append(b)
  T[b].append(a)
  
for _ in range(Q):
  p, x = map(int, input().split())
  counts[p] += x
  
q = deque([1])
visited = set()

# 1に近い順から処理していく
while q:
  parent = q.popleft()
  
  if parent in visited:
    continue
  
  visited.add(parent)
    
  for child in T[parent]:
    if child not in visited:
      counts[child] += counts[parent]
      q.append(child)
    
print(
  ' '.join(
    str(counts[i])
    for i in range(1, N + 1)
  )    
)

Measured memory_bytes: 141168
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			if n == i*j {
				fmt.Println("Yes")
				return
			}
		}
	}

	fmt.Println("No")
}


Measured memory_bytes: 512
import java.util.*;
public class Main {
	public static void main(String[] args){
       Scanner sc = new Scanner(System.in);
      // 取得
	  int A = sc.nextInt();
      int B = sc.nextInt();
      int K = sc.nextInt();
      int pos = A;
      //前から
      for(int i=0;i<K && pos<=B;i++){
        pos++;
        System.out.println(A+i);
      }
      //後ろから
      for(int j=pos;j<=B;j++){
        if(j>B-K){
          System.out.println(j);
        }
      }
    }
}

Measured memory_bytes: 36120
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <int,int> PII;
typedef pair <int,string> PIS;
typedef vector <int> vec;
#define endl '\n'
#define pi 3.141592653589793
#define fori(z,n) for(int i=z;i<n;i++)
#define forii(z,n) for(int i=z;i<=n;i++)
int main() 
{ 
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    cout<<3*n*n<<endl;
    cerr<<"Time elapsed"<<1.0*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x[] = new int[n];
		int y[] = new int[n];

		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
			}
		for (int i = 0; i < n; i++) {
			y[i] = sc.nextInt();
		}

		System.out.println(getManhattanDistance(n, x, y));
		System.out.println(getEucliDistance2(n, x, y));
		System.out.println(getEucliDistance3(n, x, y));
		System.out.println(getChebyshevDistance(n, x, y));
	}

	static double getManhattanDistance(int n, int x[], int y[]) {
		double sum = 0;
		for (int i = 0; i < n; i++) {
			sum += Math.abs(x[i] - y[i]);
		}
		return sum;
	}

	static double getEucliDistance2(int n, int x[], int y[]) {
		double sum = 0;
		for (int i = 0; i < n; i++) {
			sum += Math.pow(x[i] - y[i], 2);
		}
		return Math.sqrt(sum);
	}

	static double getEucliDistance3(int n, int x[], int y[]) {
		double sum = 0;
		for (int i = 0; i < n; i++) {
			sum += Math.pow(Math.abs(x[i] - y[i]), 3);
		}
		return Math.cbrt(sum);
	}

	static double getChebyshevDistance(int n, int x[], int y[]) {
		double max = Math.abs(x[0] - y[0]);
		for (int i = 1; i < n; i++) {
			if (max < Math.abs(x[i] - y[i])) {
				max = Math.abs(x[i] - y[i]);
			}
		}
		return max;
	}
}



Measured memory_bytes: 26524
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;
int dy[4] = { 1, 0, -1, 0 }, dx[4] = { 0, 1, 0, -1 };
typedef pair<ll, ll> P;
const int MAX_N = 1000;
int dp[MAX_N + 1][MAX_N + 1];
string x, y;
int q;

int solve(string x, string y)
{
    int n = x.size(), m = y.size();
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (x[i] == y[j]) {
                dp[i + 1][j + 1] = dp[i][j] + 1;
            } else {
                dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
            }
        }
    }
    return dp[n][m];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> x >> y;
        cout << solve(x, y) << endl;
    }
    return 0;
}


Measured memory_bytes: 7144
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
// #define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pair < pll, int > a, pair < pll, int > b)//true for a before b
{
	if(a.F.F*b.F.S <= b.F.F*a.F.S)
		return 1;
	return 0;
}

const int N = (1e2) + 9;
const int M = (N<<2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 2*550;
const int SQRT = BUCK+9;



void solve()
{
	ll w, h, x, y;
	double a;
	int b = 0;
	cin >> w >> h >> x >> y;
	a = 0.5*w*h;
	if(x+x == w && y+y == h)
		b = 1;
	cout << a << " " << b << '\n';
	return;
}

int main()
{
	sws;
	clock_t clk;
	clk = clock();
	// io_file;
	// srand (time(NULL));

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(2);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = ns()
if s >= "A" and s <= "Z":
    print("A")
else:
    print("a")


Measured memory_bytes: 61676
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	long n, k, x, y, ans;
	while(~scanf("%ld %ld %ld %ld", &n, &k, &x, &y)){
		if(n <= k)  ans = n * x;
		else ans = k * x + (n - k) * y;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    auto ans = 0;
    rep(i, 4){
        char c;
        cin >> c;
        if (c=='+'){
            ans++;
        }else{
            ans--;
        }
    }
    co(ans);
    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 pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}


int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int k; 
    cin >> k;
    rep (i,k) {
        if (a>=b) { 
            b *= 2;
            continue;
         }
        if (b>=c) {
            c *= 2;
            continue;
        }
    }
    if(a<b && b<c) cout << "Yes"<<endl;
    else cout << "No" << endl;
}

            


Measured memory_bytes: 3620
import sys
from collections import deque
readline = sys.stdin.readline

N, X, Y = map(int, readline().split())
X -= 1
Y -= 1

a = [[1e9] * N for i in range(N)]

def test(n):
    b = [1e9] * N
    q = deque()

    q.append((n, 0))
    while len(q) > 0:
        n, d = q.popleft()
        if b[n] == 1e9:
            b[n] = d
            if n - 1 >= 0:
                q.append((n - 1, d + 1))
            
            if n + 1 < N:
                q.append((n + 1, d + 1))
            
            if n == X:
                q.append((Y, d + 1))
            elif n == Y:
                q.append((X, d + 1))
    
    return b

for n in range(N):
    a[n] = test(n)

ans = [0] * (N - 1)
for i in range(N):
    for j in range(i + 1, N):
        ans[int(a[i][j] - 1)] += 1

for x in ans:
    print(x)

Measured memory_bytes: 144520
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;

int main(){
int n;
  cin>>n;
  vector<int> a(n);
rep(i,n) cin>>a.at(i);
  sort(all(a));
  int ans =0;
  
  for(int i=0;i<n-2;i++){
     for(int j=i+1;j<n-1;j++){
        for(int k=j+1;k<n;k++){
           if(a.at(i)+a.at(j)<=a.at(k)) break;
          else if(abs(a.at(i)-a.at(j))<a.at(k)) ans ++;
        }
     }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import collections

n = int(input())
v = input().split()
odd = collections.Counter(v[0::2])
even = collections.Counter(v[1::2])
a = odd.most_common()
b = even.most_common()
c = a[1][1] if len(a)>1 else 0
d = b[1][1] if len(b)>1 else 0
if a[0][0] == b[0][0]:
  if a[0][1]+d > b[0][1]+c:
    e, f = a[0][1], d
  else:
    e, f = c, b[0][1]
else:
  e, f = a[0][1], b[0][1]
  
print((n+1)//2-e + n//2-f)

Measured memory_bytes: 25580
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    
    int a,b,c;
    cin>>a>>b>>c;
    int ans=a;
    if(a==b)ans=c;
    if(a==c)ans=b;
    cout<<ans<<endl;
    
    return 0;
}


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

int main(){
    ll n;
    cin >> n;
    vector<ll> x(n);
    ll mini=100,maxi=0;
    for (ll i = 0; i < n; i++){
        cin >> x[i];
        mini = min(mini,x[i]);
        maxi = max(maxi,x[i]);
    }
    ll sum = 0;
    ll ans = 1000000;
    for (ll i = mini; i <= maxi; i++){
        sum = 0;
        for (ll j = 0; j < n; j++){
            sum += pow(i-x[j],2);
        }
        ans = min(sum,ans);
    }
    cout << ans << endl;
}

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


int main()
{
    string s;
    int A, B;
    bool t=0;

    cin >> A >> B;
    cin >> s;

    for(int i=0; i<A; i++)
    {
        if(s.at(i)>='0' && s.at(i)<='9')
        {
            t=1;
        }
        else
            t=0;
    }

    if(t==1)
    {
        if(s.at(A)=='-')
        {
           t=1;
        }
        else t=0;
    }

    if(t==1)
    {
        for(int i=A+1; i<(A+1+B); i++)
        {
           if(s.at(i)>='0' && s.at(i)<='9')
           {
               t=1;
           }
           else
               t=0;
        }
    }

    if(t==0)
    {
        cout<< "No" << endl;
    }
    else
        cout << "Yes" << endl;

    return 0;
}





Measured memory_bytes: 256
s = list(input())

if s[0] != 'A':
    print("WA")
    exit(0)

if s[2 : len(s) - 1].count('C') != 1:
    print("WA")
    exit(0)

n = s.index('C')
t = []

for i in range(len(s)):
    if i != 0 and i != n:
        t.append(s[i])

tt = ''.join(t)

if tt.islower():
    print("AC")

else:
    print("WA")


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <set>
#include <queue>
#include <map>

using namespace std;

int main(int argc, char const *argv[])
{
	string s,temp;
	int cnt;
	int i1,i2;
	int check;

	map<string,string> clr;
	clr["rg"]="bb";
	clr["gr"]="bb";
	clr["gb"]="rr";
	clr["bg"]="rr";
	clr["br"]="gg";
	clr["rb"]="gg";

	while(1){
		cin>>s;
		if(s=="0") break;

		queue<pair<string,int> > q;
		q.push(make_pair(s,0));
		set<string> bf;
		bf.insert(s);

		while(!q.empty()){
			s=q.front().first;
			cnt=q.front().second;
			q.pop();

			check=0;
			for(i1=0;i1<s.size()-1;i1++){
				if(s[i1]!=s[i1+1]) {
					check=1;
					if(i1<s.size()-2){
						temp=s.substr(0,i1)+clr[s.substr(i1,2)]+s.substr(i1+2);
					}
					else {
						temp=s.substr(0,i1)+clr[s.substr(i1,2)];
					}

					if(bf.find(temp)==bf.end()) {
						q.push(make_pair(temp,cnt+1));
						bf.insert(temp);
					}
				}
			}
			if(check==0) {
				check=2;
				break;
			}
		}

		if(check==2) cout<<cnt<<endl;
		else cout<<"NA"<<endl;
	}
	return 0;
}

Measured memory_bytes: 2660
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
        template <typename T, typename U> operator std::pair<T, U>() const { T f; U s; std::cin >> f >> s; return std::pair<T, U>(f, s); }
    };

    inp inp1; // input one
}

int main() {

    ll k = inp1;

    // ちょうどk回で満足する数列

    // 長さ2の数列にする
    // これで一回の操作で-1
    // ともに1以下になるまでやる
    // これだと制約満たせないや

    // 長さ50にする

    // すべて同じ値にすると楽
    int n = 50;
    ll v = 50 + (k - 1) / 50; // 50回分余分にとる
    vector<ll> ans(n, v);

    // 一回の操作を減らすには
    // 一つの要素を-nしてほかの要素を+1する
    ll cnt = 50LL * ((k - 1) / 50 + 1LL) - k;
    rep(i, cnt) {
        ans[i] += cnt - 1 - n;
    }
    Rep(i, cnt, n) {
        ans[i] += cnt;
    }

    Cout(n);
    Cout(ans);

    return 0;
}


Measured memory_bytes: 256
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,m=mi()
a =  [list(map(int, input().split())) for i in range(n)]
c =  [list(map(int, input().split())) for i in range(m)]

INF = 100000000000
dis = INF
ans = 0
for i in range(n):
    for j in range(m):
        if abs(a[i][0]-c[j][0]) + abs(a[i][1]-c[j][1]) < dis:
            dis = abs(a[i][0]-c[j][0]) + abs(a[i][1]-c[j][1])
            ans = j+1

    print(ans)
    dis = INF
    ans = 0

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#include<iomanip>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const ll INF=1e18;


int main()
{
    string s,t;
    cin>>s>>t;
    cout<<t+s;

}

Measured memory_bytes: 888