akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	s1, s2, s3 := ReadString(), ReadString(), ReadString()
	fmt.Println(strings.ToUpper(s1[:1] + s2[:1] + s3[:1]))
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

int main(){
    int N;
    cin >> N;
    vector<long> A(N);
    rep(i, N) cin >> A[i];

    sort(A.begin(), A.end());
    for(int i = 0; i < N-1; i++){
        if (A[i] == A[i+1]){
            cout << "NO" << endl;
             return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main()
{
    int a;
	cin >> a;
	if( a/10%111 == 0 || a%1000%111 == 0 ){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
def check(ar):
    h = 0
    for bottom, up in ar:
        if h + bottom < 0:
            return False
        h += up
    return True


if __name__ == "__main__":
    N = int(input())
    pos = []
    neg = []
    equal = 0
    for _ in range(N):
        cnt = 0
        bottom = 0
        for s in input():
            if s == "(":
                cnt += 1
            else:
                cnt -= 1
            bottom = min(bottom, cnt)
        equal += cnt
        if cnt >= 0:
            pos.append((bottom, cnt))
        else:
            cnt = -cnt
            bottom += cnt
            neg.append((bottom, cnt))

    pos.sort(reverse=True)
    neg.sort(reverse=True)
    if check(pos) and check(neg) and equal == 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 80108
import std.stdio;
import std.array;
import std.algorithm;
import std.conv;

void main() {
	int n, k;
	"%s\n%s\n".readf(&n, &k);
	int[] x = readln.split.map!(to!int).array;

	long ans = 0;
	foreach(int i; x) {
		ans += min(k-i, i)*2;
	}
	ans.writeln;
}


Measured memory_bytes: 3252
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    string n;
    cin>>n;
    
    for(int i=0;i<n.length();i++){
        if('7'==n[i]){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3628
import std.stdio;
import std.conv;
import std.string;

void main() {
  int S = to!int(chomp(readln()));

  int s = S % 60;
  S /= 60;

  int m = S % 60;
  S /= 60;

  int h = S;

  // writeln(to!string(h) ~ ":" ~ to!string(m) ~ ":" ~ to!string(s));
  writef("%d:%d:%d\n", h, m, s);
}

Measured memory_bytes: 2444
#include<bits/stdc++.h>
#define debug(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
const int INF = 1<<29;

using namespace std;



int main()
{
	
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	//clock_t time_req;time_req = clock();  
	int n,m;cin>>n>>m;
	int count = 0;
	for(int i = 1 ; i<n;i++) count+=i;
	for(int i = 1 ; i<m;i++) count+=i;
	cout<<count;




	//time_req = clock()- time_req;cout << "Time Compexity:"<< (float)time_req/CLOCKS_PER_SEC << " seconds" << endl; 
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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 gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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

int main(){
ll a,b;
char op;
cin>>a>>op>>b;
if(op=='+'){
    cout<<a+b<<endl;
}else{
    cout<<a-b<<endl;
}
}










Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int i,j,a,b,c,d,e,f,X,x[1000];
	scanf("%d",&a);
	for(i=0;i<a;i++){
		scanf("%d%d",&b,&c);
		x[i]=b*100+c;
	}
	scanf("%d",&d);
	for(i=a;i<d+a;i++){
		scanf("%d%d",&e,&f);
		x[i]=e*100+f;
	}
	for(i=0;i<a+d;i++){
		for(j=i;j<a+d;j++){
			if(x[i]>x[j]){
				X=x[i];
				x[i]=x[j];
				x[j]=X;
			}
		}
	}
	for(i=0;i<a+d;i++){
		if(x[i]==x[i+1]){
			while(x[i]!=x[i+1]){
				i++;
			}
		}
		else if(x[i]-(x[i]/100)*100<10){
			printf("%d:0%d",x[i]/100,x[i]-(x[i]/100)*100);
			if(x[i+1]!=0){
				printf(" ");
			}
		}
		else{
			printf("%d:%d",x[i]/100,x[i]-(x[i]/100)*100);
			if(x[i+1]!=0){
				printf(" ");
			}
		}
	}
	printf("\n");
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Graph Template
//-------------------------------------------------
template<class E>
struct Graph
{
    vector<vector<E> > adj;
    Graph(int N):adj(N){}
    virtual void add_edge(int v, E e){adj[v].push_back(e);}
    vector<E>& operator[](int v){return adj[v];}
    inline int size(){return adj.size();}
};

struct NormalEdge {
    int to;
    NormalEdge(int to):to(to){}
};

struct UWGraph : public Graph<NormalEdge>
{
    UWGraph(int N):Graph(N){}
    void add_edge(int v, int e){adj[v].push_back({e});}
};

//-------------------------------------------------
//--Dijkstra
//-------------------------------------------------
template<class T, class E>
vector<T> dijkstra(Graph<E> &G, int s, T inf)
{
    using P=pair<T,int>;
    vector<T> dist(G.size(),inf); dist[s]=0;
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
        T cost; int v;
        tie(cost,v) = que.top(); que.pop();
        if (cost>dist[v]) continue;
        for(auto e:G[v]){
            if (dist[e.to]>dist[v]+e.cost){
                dist[e.to]=dist[v]+e.cost;
                que.push(P(dist[e.to],e.to));
            }
        }
    }
    return dist;
}

struct Edge{int to; ll cost;};

const ll INF=1e15;

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M,r; cin>>N>>M>>r;
    Graph<Edge> G(N);
    rep(i,M){
        int a,b; ll c; cin>>a>>b>>c;
        G.add_edge(a,{b,c});
    }
    auto dist = dijkstra(G,r,INF);
    for(auto d:dist){
        if (d!=INF) cout<<d<<"\n";
        else cout<<"INF\n";
    }
    return 0;
}



Measured memory_bytes: 19292
#include <iostream>

using namespace std;
typedef unsigned long long Uint;

int main(void)
{
	int t;
	cin >> t;

	Uint a,b,c,d;

	for (int i = 0; i < t; i++)
	{
		cin >> a >> b >> c >> d;

		Uint gcd;

		Uint be = b, de = d;

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

		while(1)
		{
			if(be > de)
			{
				if(be%de == 0)
					break;
				be = be % de;
				if(de%be == 0)
					break;
			}
			else //d >= b
			{
				if(de%be == 0)
					break;
				de = de % be;
				if(be%de == 0)
					break;
			}
		}

		if(be%de == 0)
			gcd = de;
		if(de%be == 0)
			gcd = be;

		if( c < b - gcd + (a%gcd) )
			cout << "No" << endl;
		else
			cout << "Yes" << endl;
	}

	return 0;
}

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

public class Main {
    BufferedReader rd;

    Main() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        String s = rd.readLine().trim();
        int x = pint(s);
        boolean res = x%sumDigits(s)==0;
        out(res?"Yes":"No");
    }

    private int sumDigits(String s) {
        int sum = 0;
        for(int i=0;i<s.length();i++) {
            sum += s.charAt(i)-'0';
        }
        return sum;
    }

    private int pint() throws IOException {
        return pint(rd.readLine());
    }

    private int pint(String s) {
        return Integer.parseInt(s);
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new Main();
    }
}


Measured memory_bytes: 22868
#include <iostream>
#include <list>

using namespace std;

int main()
{
    int N; cin >> N;
    list<long> List;
    int Cur=0;
    
    List.insert(List.begin(), -1);

    auto ite = std::next(List.begin(), Cur);

    for(int i = 0; i < N; ++i)
    {
      int Command; cin >> Command;

      if(Command == 0)
      {
	long val; cin >> val;
	List.insert(ite, val);
	ite = next(ite, -1);
      }
      else if(Command == 1)
      {
	int val; cin >> val;
	Cur += val;
	//ite = std::next(List.begin(), Cur);
	ite = next(ite, val);
      }
      else 
      {
	if(Cur >= 0)
	{
	  //ite = std::next(List.begin(), Cur);
	  auto old = ite;
	  ite = next(ite, 1);
	  List.erase(old);

	}
      }

    }

    ite = std::next(List.end(), -1);
    List.erase(ite);
    for(const int& x : List)
      cout << x << endl;
    return 0;
}


Measured memory_bytes: 18596
s = input()
n = len(s)
cnt = 0
s1 = s[:((n-1)//2)]
s2 = s[(n+3)//2 -1:n]

for i in range(n//2):
    if s[i] != s[-i-1]:
        print('No')
        exit()
    else:
        if s1[i] != s2[i]:
            print('No')
            exit()
print('Yes')

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  int n, m; cin >> n >> m;
  vector<int> a(n + 1, 1), d(n + 1);
  d[1] = 1;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    if (d[u]) d[v] = 1;
    a[u]--;
    a[v]++;
    if (a[u] == 0) d[u] = 0;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (d[i]) ans++;
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


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

using namespace std;

typedef long long ll;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int n, min = 101, a, ans = 0;
  cin >> n;
  rep(i, 0, n) {
    cin >> a;
    ans += a;
    if(min > a && a % 10 != 0) min = a;
  }

  cout << (ans % 10 == 0 ? min > 100 ? 0 : ans - min : ans) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

void CountingSort(unsigned short A[], unsigned short B[], int n);




int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */
  for( i = 0; i < n; i++){
    scanf("%hu",&A[i+1]);
  }
  CountingSort(A,B,n);
   for( i = 1; i <= n; i++){
     if( i > 1)printf(" ");
     printf("%d",B[i]);
   }
   printf("\n");
  
  



  return 0;
}

void CountingSort(unsigned short A[], unsigned short B[], int n)
{
  int c[VMAX + 1];
  int i;
  int j;
  
  for( i = 0; i <= VMAX; i++)
    c[i] = 0;
  
  for( j = 1; j <= n; j++)
    c[A[j]]++;
  
  for( i = 1; i <= VMAX; i++)
    c[i] = c[i] + c[i-1];
  
  for( j = n; j >= 1; j--){
    B[c[A[j]]] = A[j];
    c[A[j]]--;
  }
  


}



Measured memory_bytes: 9580
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}

int a[1000000],b[1000000],check;

void migi(int i,int n){
  lp(x,n){
    if(a[x]==0) 1;
    else{
      b[x]+=1;
      b[x+a[x]]-=1;
    }
  }
  for(int x=1;x<n;x++){
    b[x]+=b[x-1];
  }
  lp(x,n){
    if(b[x]>0) 1;
    else{
      check=1;
      return;
    }
  }
  return;
}

int main(){
  int n;
  cin>>n;
  lp(i,n){
    cin>>a[i];
    a[i]/=10;
  }
  check=0;
  migi(0,n);
  if(check==0){
    lp(j,1000000){
      b[j]=0;
    }
    check=0;
    reverse(a,a+n);
    migi(0,n);
    if(check==0){
      cout<<"yes"<<endl;
    }
    else cout<<"no"<<endl;
  }
  else cout<<"no"<<endl;
  
  return 0;
}


Measured memory_bytes: 8124
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int check(double *l, double *s);

int main()
{
	int n, ans;
	double a[3], b[3];	//[0]:x[1]:y[2]:r

	cin >> n;

	for (int i=0; i<n; i++)
	{
		cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2];

		if(a[2] > b[2]) {		//aを大きい円、bを小さい円としたとき
			ans = check(&a[0], &b[0]);
		}
		else {					//bを大きい円、aを小さい円としたとき
			ans = check(&b[0], &a[0]);
			ans *= (ans == 2) ? -1 : 1;		//aがbの中にあるときの処理
		}

		cout << ans << endl;
	}

	return 0;
}

int check(double *l, double *s)	//円の重なり・内外を判定
{
	double d = (l[0]-s[0])*(l[0]-s[0]) + (l[1]-s[1])*(l[1]-s[1]);

	d = sqrt(d);

	if(d < l[2]-s[2]) {	//小さい円が大きい円の内側にあるとき
		return 2;
	}
	else if(l[2]-s[2] <= d && d <= l[2]+s[2]) {	//円周が交わっているとき
		return 1;
	}
	else {
		return 0;	//外側にあるとき
	}
}

Measured memory_bytes: 1232
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;
typedef vector< int > vi;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef vector< ll > vll;
// #define DEBUG_MODE
#ifdef DEBUG_MODE
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(x) fprintf(stderr, "[%s = %d]\n", #x, x)
#else
	#define errp(...)
	#define dbg(x) 
#endif

const int N = 100010;
int n, m, a[N];
vii b;

int main () { 
#ifdef DEBUG_MODE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	int v, c;
	for (int i = 0; i < m; i++) { 
		scanf("%d%d", &c, &v);
		b.emplace_back(v, c);
	}
	for (int i = 0; i < n; i++) b.emplace_back(a[i], 1);
	sort(begin(b), end(b));
	reverse(begin(b), end(b));
	int rem = n;
	ll ans = 0;
	for (int i = 0; i < b.size(); i++) {
		ans += (ll)b[i].first * min(rem, b[i].second);
		rem -= min(rem, b[i].second);
		if (rem == 0) break;
	}
	printf("%lld\n", ans);
}

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

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i=0; i< n;i++){
        cin >> v.at(i);
    }
    sort(v.begin(),v.end());
    double m = pow(2.0,n-1);
    double k = 0;
    for (int i = 0;i<n;i++){
        if (i == 0 | i == 1){
            k += v.at(i);
        }
        else{
            k += pow(2.0,i-1)*v.at(i);
        }
    }
    cout << k/m << endl;
}



Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			final int D = sc.nextInt();
			final int SIZE = 2 * D + 1;
			
			System.out.println((N + SIZE - 1)  / SIZE);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21332
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <list>

#include <cmath>
#include <algorithm>
#include <cassert>
#include <bitset>
#include <complex>
#include <climits>
#include <functional>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;
typedef pair<double, double> dd;
#define mp make_pair
#define pb push_back

#define debug(x) cerr << #x << " = " << x << " "



int main()
{
  vector<int> in(4, 0);
  int x;
  while (cin >> x) ++in[x-1];
  sort(in.begin(), in.end());
  puts(in == vector<int>({1, 1, 2, 2}) ? "YES" : "NO");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i <= n; i++)
template<class T> inline int chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline int chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<29;
const ll LINF = 1LL<<58;
const int mod = 1000000007;

int used[2][100010] = {0};
int color[2] = {0};
vector<int> G[100010];

void dfs(int v, int c){
    used[c][v]++;
    color[c]++;
    for(auto x: G[v]){
        if(used[c ^ 1][x]) continue;
        dfs(x, c^1);
    }
    return;
}

int main(){
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    dfs(0, 0);

    if(used[0][0] * used[1][0]) {
        cout << (ll)n * (n - 1) / 2 - m << endl;
    } else {
        cout << (ll)color[0] * color[1] - m << endl;
    }
    return 0;
}

Measured memory_bytes: 8448
#include <iostream>
using namespace std;
long long int n,c,ans;
long long int x[100005],v[100005],sj[100005],nj[100005],sz[100005],nz[100005];
int main() {
	
	//sは右回りnは左回り
	//jは累積和、zはiまでの片道のカロリーの最大値
	cin>>n>>c;
	for(int i=1;i<=n;i++){
		cin>>x[i]>>v[i];
	}
	for(int i=1;i<=n;i++){
		
		sj[i]=sj[i-1]+v[i];
		sz[i]=max(sz[i-1],sj[i]-x[i]);
	}
	for(int i=n;i>=1;i--){
		nj[i]=nj[i+1]+v[i];
		nz[i]=max(nz[i+1],nj[i]-(c-x[i]));
	}
	
	for(int i=1;i<=n;i++){
		ans=max(ans,sz[i]);//右回りの行ったきり
		ans=max(ans,sj[i]-2*x[i]+nz[i+1]);//右回りのi番目まで行って、左回りのi+1番目までの最大値
	}
	for(int i=n;i>=1;i--){
		ans=max(ans,nz[i]);
		ans=max(ans,nj[i]-2*(c-x[i])+sz[i-1]);
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define ll long long

string A;
ll alp[26];
int main()
{
	cin >> A;

	ll n = A.size();
	ll ans = n*(n - 1) / 2 + 1;
	REP(i, 0, n) {
		alp[A[i] - 'a']++;
	}

	REP(i, 0, 26) {
		ans -= (alp[i] * (alp[i] - 1) / 2);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

int main(){
  long long int X;
  scanf("%lld", &X);

  long long int min_n = 0, tmp = X%100;
  long long int tmp2, tmp3;

  min_n = (tmp+4)/5;
  if(X/100 >= min_n){
    std::cout << 1 << std::endl;
  }
  else{
    std::cout << 0 << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque

sys.setrecursionlimit(10 ** 5 + 100)

n, m = list(map(int, input().split()))
links = [set() for _ in range(n)]
root = set(range(n))
for line in sys.stdin.readlines():
    a, b = list(map(int, line.split()))
    a -= 1
    b -= 1
    links[a].add(b)
    root.discard(b)
root = root.pop()

parents = [set() for _ in range(n)]
q = deque([(root, -1)])

while q:
    v, p = q.popleft()
    parents[v].add(p)
    if len(parents[v]) > 1:
        continue
    q.extend((c, v) for c in links[v])

fixed = [-1] * n

# print(parents)

q = deque([(root, -1)])
while q:
    v, p = q.popleft()
    pv = parents[v]
    pv.remove(p)
    if len(pv) == 0:
        fixed[v] = p
        q.extend((c, v) for c in links[v])

print('\n'.join(str(p + 1) for p in fixed))


Measured memory_bytes: 121516
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <map>
#include <sstream>
#define ll long long
using namespace std;
// ver..(1.1)
string ent="\n";
string space=" ";
int main(){
   ios_base::sync_with_stdio(false);
   ll a,b;
   cin >> a >> b;
   cout << (a*b)/__gcd(a,b) << ent;
}
/*
5 25

kpk=25
fpb=5

3 21

kpk=21
fpb=3

*/

Measured memory_bytes: 256
#include <stdio.h>

int answer(int a,int b,int c);

int main(void){
	int num=0;
    int a,b,c;
    
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
	num=answer(a,b,c);
	
	switch(num){
	case 1:
	printf("Yes\n");
	break;
	case 2:
	printf("No\n");
	break;
	case 3:
	printf("0<=a,b,c<=100の数字を入力して下さい\n");
	break;
	}
    return 0;
}

int answer(int a, int b,int c){
	
	if(0>a || 100<a || 0>b || 100<b || 0>c || 100<c){
	return 3;
	}else if(a<b && b<c){
	return 1;
	}else{
	return 2;
	}
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
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; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;

//Modulo Calculation
const int MOD = 1e9 + 7;
// const int MOD = 998244353;

//ModInt
template <typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(ll x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
  
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
  
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};
using mint = ModInt<MOD>;

mint dp[5010][5010];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; string s; cin >> n >> s;
    dp[0][0] = 1;
    REP(i,n){
        dp[i+1][0] += dp[i][0];
        REP(j,n) dp[i+1][j+1] += dp[i][j];
        REPS(j,n) dp[i+1][j-1] += dp[i][j] * (mint)2;
    }
    cout << dp[n][SZ(s)] << endl;
}

Measured memory_bytes: 101684
#include<bits/stdc++.h>
using namespace std;
 
int main(void)
{
  char b;
  cin>>b;
 
  switch (b)
  {
  case 'A':
    cout<<'T'<<endl;
    break;
    
  case 'T':
    cout<<'A'<<endl;
    break;
 
  case 'G':
    cout<<'C'<<endl;
    break;
 
  case 'C':
    cout<<'G'<<endl;
    break;
  
  default:
    break;
  }
}

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

#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;

template <typename T>
class fenwick {
  public:
  vector<T> fenw;
  int n;
  fenwick(int _n) : n(_n) {
    fenw.resize(n);
  }
  void modify(int x, T v) {
    while (x < n) {
      fenw[x] += v;
      x |= (x + 1);
    }
  }
  T get(int x) {
    T v{};
    while (x >= 0) {
      v += fenw[x];
      x = (x & (x + 1)) - 1;
    }
    return v;
  }
  T get(int l, int r) {
    return (l == 0 ? get(r) : get(r) - get(l - 1));
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, tt;
  cin >> n >> tt;
  fenwick<ll> fenw(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    fenw.modify(i, x);
  }
  while (tt--) {
    int q;
    cin >> q;
    if (q == 1) {
      int l, r;
      cin >> l >> r;
      cout << fenw.get(l, r - 1) << '\n';
    } else {
      int p;
      cin >> p;
      ll x;
      cin >> x;
      fenw.modify(p, x);
    }
  }
  return 0;
}


Measured memory_bytes: 8256
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

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

using namespace std;
/** Problem0169 : Blackjack **/
int main()
{
	int ans, one, t;
	string s;
	
	while (!cin.eof()) {
		getline(cin, s);
		if (s == "0") break;
		stringstream ss(s);
		
		ans=0; one=0;
		while (!ss.eof()) {
			ss >> t;
			if (2 <= t && t < 10)
				ans += t;
			else if (t == 1) {
				one++;
				ans+=11;
			} else {
				ans+=10;
			}
		}
		
		while (ans>21 && one>0) {
			one--;
			ans-=10;
		}
		
		if (ans > 21) ans=0;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
#include <stdio.h>

void up_sort(int ary[10]){
  int tmp;
  for(int i = 0; i < 10; i++){
    for(int j = 9; j > i; j--){
      if(ary[j] > ary[j - 1]){
        tmp = ary[j];
        ary[j] = ary[j-1];
        ary[j - 1] = tmp; 
      }
    }
  } 
}

int main(){
  int i1[10];
  int w,k;
  for(int i = 0; i < 10; i++)
    scanf("%d",&i1[i]);
  
  up_sort(i1);
  w = i1[0] + i1[1] + i1[2];

  for(int i = 0; i < 10; i++)
    scanf("%d",&i1[i]);

  up_sort(i1);
  k = i1[0] + i1[1] + i1[2];  

  printf("%d %d\n",w,k);
}       

Measured memory_bytes: 2752
#include <iostream>
#include <algorithm>

using namespace std ;



int main(){
    int age;
    int pay;

    if(scanf("%d %d",&age,&pay) != 2){
        exit(1);
    };

    if(pay%2 == 1){
        exit(1);
    }

    if(age>=13){
        printf("%d",pay);
    }
    else if(age<=12 && age>=6){
        printf("%d",pay/2);
    }
    else{
        printf("%d",0);
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll=long long;
int main(){
	int n,k;
	cin >> n >> k;
	vector<int> x(n),y(n);
	vector<int> xary,yary;
	for(int i=0;i<n;i++){
		cin >> x[i] >> y[i];
		xary.push_back(x[i]);
		yary.push_back(y[i]);
	}
	sort(begin(xary),end(xary));
	sort(begin(yary),end(yary));
	ll ans=1LL*(xary[n-1]-xary[0])*(yary[n-1]-yary[0]);
	for(int xi=0;xi<n;xi++){
		for(int xj=xi+1;xj<n;xj++){
			for(int yi=0;yi<n;yi++){
				for(int yj=yi+1;yj<n;yj++){
					int num=0;
					ll lx=xary[xi],rx=xary[xj];
					ll by=yary[yi],uy=yary[yj];
					for(int i=0;i<n;i++){
						if(lx<=x[i]&&x[i]<=rx&&by<=y[i]&&y[i]<=uy) num++;
					}
					if(num>=k) ans=min(ans,1LL*(rx-lx)*(uy-by));
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <utility>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	int n, a, b;
	scanf("%d", &n);
	vector<pair<int,int> > v(n);
	for(int i = 0; i < n; ++i){
		scanf("%d%d", &a, &b);
		v[i].first = b;
		v[i].second = -a;
	}

	const pair<int,int> &p = *max_element(v.begin(), v.end());
	printf("%d %d\n", -p.second, p.first);
}

Measured memory_bytes: 1032
#include<stdio.h>
int main()
{
	int age;
	int i=0;
	scanf("%d",&age);
	if(age>=1&&age<=9)
	{
	if(age==5||age==7||age==3)
		printf("YES");
	else
	    printf("NO");
	}
	return 0;
		
		
}

Measured memory_bytes: 128
w, h, n = map(int, input().split())

x1, y1, x2, y2 = 0, 0, w, h
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        x1 = max(x1, x)
    if a == 2:
        x2 = min(x2, x)
    if a == 3:
        y1 = max(y1, y)
    if a == 4:
        y2 = min(y2, y)
if x1 < x2 and y1 < y2:
    print((x2 - x1) * (y2 - y1))
else:
    print(0)


Measured memory_bytes: 3064
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    String S =sc.next();
    int T =S.length();
    String ans ="x";
    for(int i=0 ;i<T-1;i++){
      ans =ans+"x";}
    System.out.println(ans);
  }
}

Measured memory_bytes: 38552
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()

int main(){
  char A;
  cin >> A;
  if(A-'a'>=0&&'z'-A>=0){
    cout << 'a' << endl;
  }else{
    cout << 'A' << endl;
  }
  
}


Measured memory_bytes: 3628
#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>;

int main() {
  int n; cin >> n;
  vector<int> a(n), l(n+1), r(n+1); rep(i, n) cin >> a[i];
  rep(i, n) l[i+1] = max(l[i], a[i]);
  for (int i = n-1; i >= 0; i--)
    r[i] = max(r[i+1], a[i]);
  rep(i, n) cout << max(l[i], r[i+1]) << endl;
  return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct shop{
    long long int a;
    long long int b;

    bool operator<(const shop &another){
        return a < another.a;
    }
};

int main(){
    int n, m;
    cin >> n >> m;
    vector<shop> data(n);
    for(int i = 0; i < n; i++) cin >> data[i].a >> data[i].b;
    sort(data.begin(), data.end());
    long long int ans = 0;
    long long int num = 0;
    for(int i = 0; i < n; i++){
        if(num >= m) break;
        long long int conum = min(data[i].b, m-num);
        ans += data[i].a * conum;
        num += data[i].b;
    }

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;
#define int long long
signed main(void){
    vector <vector<int>> bboard(2010,vector <int>(2010)),wboard(2010,vector <int>(2010));
    int N,K; cin>>N>>K;
    int sum = 0, white = 0, black=0;
    vector <vector<int>> bl(2010,vector <int>(2010)), wl(2010,vector <int>(2010));
    rep(i,N){
        int x,y; char c; cin>>x>>y>>c;
        x %= 2*K; y %= 2*K;
        if(c == 'B') {bl[x][y]++; black++;}
        else {wl[x][y]++; white++;}
        
    }
    for(int i=0;i<2*K;i++){
        for(int j=0;j<2*K;j++){
            bboard[i+1][j+1] = bboard[i+1][j] + bboard[i][j+1] - bboard[i][j] + bl[i][j];
            wboard[i+1][j+1] = wboard[i+1][j] + wboard[i][j+1] - wboard[i][j] + wl[i][j];
        }
    }
    
    int ma = -1145141919;
    for(int i=0; i<=K; i++) {
        for(int j=0; j<=K; j++) {
            int a = bboard[i][j];
            int b = bboard[i+K][j+K] - bboard[i+K][j] - bboard[i][j+K] + bboard[i][j];
            int c = bboard[2*K][j] - bboard[i+K][j];
            int d = bboard[i][2*K] - bboard[i][j+K];
            int e = bboard[2*K][2*K] - bboard[2*K][j+K] - bboard[i+K][2*K] + bboard[i+K][j+K];
            int as = wboard[i][j];
            int bs = wboard[i+K][j+K] - wboard[i+K][j] - wboard[i][j+K] + wboard[i][j];
            int cs = wboard[2*K][j] - wboard[i+K][j];
            int ds = wboard[i][2*K] - wboard[i][j+K];
            int es = wboard[2*K][2*K] - wboard[2*K][j+K] - wboard[i+K][2*K] + wboard[i+K][j+K];
            int tmp = a + b + c + d + e;
            int tmpw = as + bs + cs + ds + es;
            ma = max(ma, max(tmp + white - tmpw,black - tmp + tmpw ));
        }
    }
    cout<<ma<<endl;
}


Measured memory_bytes: 126848
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(a <= b ? a : a - 1);
    }
}

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

struct Node{
  int key;
  struct Node *right,*left,*parent;
};

struct Node *root,*NIL;

struct Node *find(struct Node *u,int k){
  while(u != NIL && k != u->key){
    if(k < u->key)u=u->left;
    else u=u->right;
  }
  return u;
}
void insert(int k){
  struct Node *y=NIL;
  struct Node *x=root;
  struct Node *z;

  z=(struct Node *)malloc(sizeof(struct Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x != NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }else {
      x=x->right;
    }
  }

  z->parent=y;
  if(y==NIL){
    root=z;
  }else {
    if(z->key < y->key){
      y->left=z;
    }else{
      y->right=z;
    }
  }
}

void inorder(struct Node *u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(struct Node *u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  char c[10];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",c);
    if('f'==c[0]){
      scanf("%d",&x);
      struct Node *t = find(root,x);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    }
    else if(strcmp(c,"insert")==0){
      scanf("%d",&x);
      insert(x);
    }
    else if(strcmp(c,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  
  return 0;
  
}



Measured memory_bytes: 20448
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e10
)

var sc = bufio.NewScanner(os.Stdin)

func next() 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 nextFloat() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)

	one := 0
	n := nextInt()
	m := make(map[int]int)
	sl := make([]int, n)
	for i := 0; i < n; i++ {
		a := nextInt()
		if a == 1 { one++ }
		m[a] += 1
		sl[i] = a
	}
	if one > 1 {
		fmt.Println(0)
		return
	}
	if one == 1 {
		fmt.Println(1)
		return
	}

	count := 0
	for _, v := range sl {
		if m[v] > 1 { continue }
		i := 2
		flag := true
		for i*i <= v {
			if v%i == 0 {
				if _, ok := m[i]; ok {
					flag = false
					break
				}
				if _, ok := m[v/i]; ok {
					flag = false
					break
				}
			}
			i++
		}
		if flag { count++ }
	}
	fmt.Println(count)
}

func intSlicePrint(el ...int) {
	first := true
	for _, v := range el {
		if v < 0 {
			continue
		}
		if !first {
			fmt.Printf(" ")
		}
		fmt.Printf("%v", v)
		first = false
	}
	fmt.Println("")
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}


Measured memory_bytes: 14536
def main():
    n = int(input())
    ss = list(input())

    ans = ''
    for s in ss:
        ans_temp = ord(s) + n
        if ord('A') <= ans_temp <= ord('Z'):
            ans += chr(ans_temp)
        if ans_temp < ord("A"):
            ans += chr(ord('Z') - (ord("A") - ans_temp) - 1)
        if ans_temp > ord('Z'):
            ans += chr(ord("A") + (ans_temp - ord('Z')) - 1)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#define SIZE 100005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

struct UF
{
	int par[SIZE],rank[SIZE];
	
	void init(int n)
	{
		for(int i=0;i<n;i++)
		{
			par[i]=i;
			rank[i]=1;
		}
	}
	int find(int x)
	{
		if(x==par[x]) return x;
		return par[x]=find(par[x]);
	}
	void unite(int x,int y)
	{
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y])
		{
			par[x]=y;
		}
		else
		{
			par[y]=x;
			if(rank[x]==rank[y]) rank[x]++;
		}
	}
	bool same(int x,int y)
	{
		return find(x)==find(y);
	}
}uf;
int deg[SIZE];

int main()
{
	int n=4;
	uf.init(n+2);
	for(int i=0;i<n-1;i++)
	{
		int a,b;
		scanf("%d %d",&a,&b);a--,b--;
		deg[a]++,deg[b]++;
		uf.unite(a,b);
	}
	for(int i=0;i<n;i++)
	{
		if(!uf.same(0,i))
		{
			puts("NO");
			return 0;
		}
		if(deg[i]>=3)
		{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
const int MOD = 1e9+7;
const int MOOD = 998244353;
#define PI 3.14159265359
typedef long long ll;
using namespace std;

int dp[11][2001];

int main(){
	int d, g;
	cin >> d >> g;
	vector<int> p(d+1), c(d+1);

	for (int i = 1; i <= d; i++){
		cin >> p[i] >> c[i];
	}

	for (int i = 0; i <= 10; i++){
		for (int j = 0; j <= 2000; j++){
			dp[i][j] = -1;
		}
	}

	dp[0][0] = 0;

	for (int i = 1; i <= d; i++){
		for (int j = 0; j <= 1000; j++){
			if (dp[i-1][j] != -1){
				for (int k = 0; k < p[i]; k++){
					dp[i][j+k] = max(dp[i][j+k], dp[i-1][j] + 100*i*k);
				}
				dp[i][j+p[i]] = max(dp[i][j+p[i]], dp[i-1][j] + 100*i*p[i] + c[i]);
			}
		}
	}

	int ans = MOD;
	for (int i = 1; i <= 10; i++){
		for (int j = 0; j <= 1000; j++){
			if (dp[i][j] >= g){
				ans = min(ans, j);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3660
#![allow(dead_code)]
use crate::scanner::Scanner;
fn main() {
    let mut scan = Scanner::new();
    let n = scan.read::<i64>();
    let mut sum = 0;
    for i in 1..=n {
        if i % 3 != 0 && i % 5 != 0 {
            sum += i;
        }
    }
    println!("{}", sum);
}
mod scanner {
    use std::io::{stdin, BufReader, Bytes, Read, Stdin};
    use std::str::FromStr;
    pub struct Scanner {
        buf: Bytes<BufReader<Stdin>>,
    }
    impl Scanner {
        pub fn new() -> Scanner {
            Scanner {
                buf: BufReader::new(stdin()).bytes(),
            }
        }
        pub fn read_next<T: FromStr>(&mut self) -> Option<T> {
            let token = self
                .buf
                .by_ref()
                .map(|c| c.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect::<String>();
            token.parse::<T>().ok()
        }
        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_next().unwrap()
        }
        pub fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read::<T>()).collect()
        }
        pub fn chars(&mut self) -> Vec<char> {
            self.read::<String>().chars().collect()
        }
        pub fn char(&mut self) -> char {
            self.read::<String>().chars().next().unwrap()
        }
    }
}



Measured memory_bytes: 2128
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    long INF = 999999999999L;
    public void solve() {
    	long N = Long.parseLong(sc.next());
    	long ans = INF;
    	for (long i = 2; i * i <= N; i++) {
			if(N % i == 0) {
				ans = Math.min(ans, (i - 1) + (N / i - 1));
			}
		}
    	if(ans == INF)	ans = N - 1;
    	out.println(ans);
    }
}



Measured memory_bytes: 22736
import sys

sys.setrecursionlimit(10000)
mod = 1000000007


def mul(a, b):
    return ((a % mod) * (b % mod)) % mod


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y / 2) ** 2 % mod
    else:
        return power(x, y / 2) ** 2 * x % mod


def div(a, b):
    return mul(a, power(b, mod - 2))


# def gcd(a_gcd, b_gcd):
#     while b_gcd != 0:
#         a_gcd, b_gcd = b_gcd, a_gcd % b_gcd
#     return a_gcd
#
#
# def lcm(a_lcm, b_lcm):
#     return a_lcm * b // gcd(a_lcm, b_lcm)
#
#
# def max_sum(N_max_sum, a_max_sum):
#     dp = [0] * (N_max_sum + 1)
#     for i in range(N_max_sum):
#         dp[i + 1] = max(dp[i], dp[i] + a_max_sum[i])
#     return dp[N]
#
#
# def knapsack(N_knapsack, W, weight, value):
#     inf = float("inf")
#     dp = [[-inf for _ in range(W+1)] for j in range(N_knapsack + 1)]
#     for i in range(W+1):
#         dp[0][i] = 0
#
#     for i in range(N_knapsack):
#         for w in range(W+1):
#             if weight[i] <= w:
#                 dp[i+1][w] = max(dp[i][w-weight[i]]+value[i], dp[i][w])
#             else:
#                 dp[i+1][w] = dp[i][w]
#     return dp[N_knapsack][W]
#
#
# class UnionFind:
#     def __init__(self, n):
#         self.par = [i for i in range(n+1)]
#         self.rank = [0] * (n+1)
#
#     # 検索
#     def find(self, x):
#         if self.par[x] == x:
#             return x
#         else:
#             self.par[x] = self.find(self.par[x])
#             return self.par[x]
#
#     # 併合
#     def union(self, x, y):
#         x = self.find(x)
#         y = self.find(y)
#         if self.rank[x] < self.rank[y]:
#             self.par[x] = y
#         else:
#             self.par[y] = x
#             if self.rank[x] == self.rank[y]:
#                 self.rank[x] += 1
#
#     # 同じ集合に属するか判定
#     def same_check(self, x, y):
#         return self.find(x) == self.find(y)


ans = 0

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

if K == 1:
    print("0")
else:
    print(N - K)


Measured memory_bytes: 38332
#include <bits/stdc++.h>
using namespace std;
#define PUTS(x) cout << (x) << endl;
#define PB push_back
#define ALL(v) (v).begin(), (v).end()
int main() {
    int x;
    cin >> x;
    auto primes = vector<int>();
    primes.PB(2);
    for (int n = 3; n <= 100005; n += 2) {
        auto isPrime = true;
        for (auto p : primes) {
            if (p * p > n) break;
            if (n % p == 0) {
                isPrime = false;
                break;
            }
        }
        if (isPrime) primes.PB(n);
    }
    auto itr = lower_bound(ALL(primes), x);
    PUTS(*itr);
}


Measured memory_bytes: 384