akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Io.Read<int>();
            var S = Io.Read();

            var output = new List<char>();
            foreach (var c in S)
            {
                var newC = c + N;
                if (newC > (int)'Z') newC -= 26;

                output.Add((char)newC);
            }

            Console.WriteLine(string.Join("", output));
        }

        static int NumberOfDigits(long x)
        {
            if (x < 10) return 1;

            var result = 0;
            while (x > 0)
            {
                result++;
                x /= 10;
            }

            return result;
        }

        static int SumOfDigits(int x)
        {
            var sum = 0;
            while (x > 0)
            {
                sum += x % 10;
                x /= 10;
            }

            return sum;
        }

        class Io
        {
            public static string Read()
            {
                return Console.ReadLine();
            }

            public static IEnumerable<string> ReadRepeat(int count)
            {
                return Enumerable.Range(0, count).Select(_ => Read());
            }

            public static T Read<T>()
            {
                return (T)Convert.ChangeType(Read(), typeof(T));
            }

            public static IEnumerable<T> ReadRepeat<T>(int count)
            {
                return Enumerable.Range(0, count).Select(_ => Read<T>());
            }

            public static string[] ReadList(char devide = ' ')
            {
                return Read().Split(devide);
            }

            public static T[] ReadList<T>(char devide = ' ')
            {
                return ReadList(devide)
                    .Select(s => (T)Convert.ChangeType(s, typeof(T)))
                    .ToArray();
            }

            public static IEnumerable<T[]> ReadListRepeat<T>(int count, char devide = ' ')
            {
                return Enumerable.Range(0, count).Select(_ => ReadList<T>(devide));
            }

            public static void Write(string value)
            {
                Console.WriteLine(value);
            }
        }
    }
}


Measured memory_bytes: 13376
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(void){
    int n, a[200020], ans = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) {
        if (a[a[i]] == i) ans++;
    }
    cout << ans / 2 << endl;
    return 0;
}


Measured memory_bytes: 640
import itertools


N = int(input())
S = [input() for i in range(N)]
count = [0 for i in range(5)]
for s in S:
    if s[0] == 'M':
        count[0] += 1
    elif s[0] == 'A':
        count[1] += 1
    elif s[0] == 'R':
        count[2] += 1
    elif s[0] == 'C':
        count[3] += 1
    elif s[0] == 'H':
        count[4] += 1

ans = 0
for i, j, k in list(itertools.combinations(range(5), 3)):
    ans += count[i] * count[j] * count[k]
print(ans)


Measured memory_bytes: 9772
N, Q =map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N-1)]

g = [[] for _ in range(N+1)]
for a, b in ab:
    g[b].append(a)
    g[a].append(b)
cnt = [0]*(N+1)

for _ in range(Q):
    p, x = map(int, input().split())
    cnt[p] += x

temp = [1]
visited = [0]*(N+1)
visited[1] = 1

while temp:
    q = temp.pop()   
    for i in g[q]:
        if visited[i] == 0:
            temp.append(i)
            visited[i] = 1
            cnt[i] += cnt[q]
print(*cnt[1:])

Measured memory_bytes: 82556
import numpy as np

def main():
    h, w = map(int, input().split())
    a = [input() for i in range(h)]

    for i in range(h):
        if a[i].count("#") == 0:
            a[i] = a[i].replace(".", "x")

    a = np.array([list(i) for i in a])
    a = a.transpose()
    a = ["".join(i) for i in a]

    for i in range(w):
        if a[i].count("#") == 0:
            a[i] = a[i].replace(".", "x")

    a = np.array([list(i) for i in a])
    a = a.transpose()
    a = ["".join(i) for i in a]

    for i in a:
        if i.replace("x", "") == "":
            continue
        print(i.replace("x", ""))

if __name__ == "__main__":
    main()

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

using namespace std;
int main (){
    string s;
    int ap[26]={};
    cin >> s;
    for (int i = 0; i < s.size(); i++){
        ap[s[i]-'a']++;
    }
    bool j=true;
    for (int i = 0; i < 26; i++)
    {
        if(ap[i]>1) j=false;
    }
    if(j) cout << "yes\n";
    else cout << "no\n";
}

Measured memory_bytes: 256
// Problem : A - Not
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// $%U%$
// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
ll nCr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
void solve()
{
	int t;
	cin >> t;
	cout << 1-t << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}


Measured memory_bytes: 3636
intX, length = map(int, input().split())
intList = input().split()
intList = [int(x) for x in intList]

for i in range(intX + 1):
    if intX - i not in intList:
        print(intX - i)
        break
    elif intX + i not in intList:
        print(intX + i)
        break


Measured memory_bytes: 9108
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 3005
#define ll long long
#define mod 1000000007
#define inv2 500000004
void Read(int &p)
{
	p = 0;
	char c = getchar();
	for (; c < '0' || c > '9'; c = getchar());
	for (; c >= '0' && c <= '9'; c = getchar())p = p * 10 + c - '0';
}
int n, q;
int f[N][N], A[N];
int main()
{
	Read(n), Read(q);
	for (int i = 1; i <= n; i++)
		Read(A[i]);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			f[i][j] = (A[i] > A[j]);
	int ans = 1;
	for (; q--; )
	{
		ans = (ans << 1) % mod;
		int x, y;
		Read(x), Read(y);
		for (int i = 1; i <= n; i++)
		{
			if (i != x && i != y)
			{
				f[i][x] = f[i][y] = (ll)(f[i][x] + f[i][y]) * inv2 % mod;
				f[x][i] = f[y][i] = (ll)(f[x][i] + f[y][i]) * inv2 % mod;
			}
		}
		f[x][y] = f[y][x] = (ll)(f[x][y] + f[y][x]) * inv2 % mod;
	}
	int sum = 0;
	for (int i = 1; i <= n; i++)
		for (int j = i + 1; j <= n; j++)
			sum = (sum + f[i][j]) % mod;
	ans = (ll)sum * ans % mod;
	printf("%d\n", ans);
}


Measured memory_bytes: 35456
package main

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

func main() {
	sc := NewScanner()

	s := sc.NextLine()
	stk := []string{}
	cnt := 0
	for i := 0; i < len(s); i++ {
		if len(stk) == 0 {
			stk = append(stk, string(s[i]))
			continue
		} else {
			l := len(stk)
			tmp := string(s[i])
			top := stk[l-1]
			if tmp == top {
				stk = append(stk, string(s[i]))
				continue
			}
			cnt += 2
			//
			stk = stk[0 : l-1]
			for {
				l = len(stk)
				if l < 2 {
					break
				}
				if stk[l-1] == stk[l-2] {
					break
				}
				cnt += 2
				stk = stk[0 : l-2]
			}
		}
	}
	fmt.Printf("%v\n", cnt)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 10496
#include <stdio.h>
#define N 100

int main(){
  int M[N][N];
  int n, u, k, v, i, j;

  scanf("%d", &n);
  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      M[i][j] = 0;
    }
  }
  for(i = 0;i < n;i++){
    scanf("%d%d", &u, &k);
    u--;
    for(j = 0;j < k;j++){
      scanf("%d", &v);
      v--;
      M[u][v] = 1;
    }
  }
  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      if(j){
	printf(" ");
      }
      printf("%d", M[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 636
def b_path(Road):
    # (グラフを作り、4つの街の訪れる順番を決め、移動ができるか調べてもよいが)
    appear_num = [0] * 4
    for a, b in Road:
        appear_num[a - 1] += 1
        appear_num[b - 1] += 1
    ans = 'NO' if [1 for v in appear_num if v >= 3] else 'YES'
    return ans

Road = [[int(i) for i in input().split()] for j in range(3)]
print(b_path(Road))

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

int main() {
  int n,ans;
  ans=1;
  string s;
  cin >> n >> s;
  for(int i=0;i<n;i++) {
    if (i!=0) {
      if (s.at(i)!=s.at(i-1)) ans++;
    };
  };
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define N first
#define D second
using namespace std;

typedef long long ll;

const int MAXN = 50;


int main() {
	ios_base::sync_with_stdio(0);
	
	int n;
	int x[MAXN], y[MAXN];
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}
	int ans = n;
	for(int i = 1; i < n; i++) {
		for(int j = 0; j < i; j++) {
			int p = x[i] - x[j];
			int q = y[i] - y[j];
			int cnt = 0;
			for(int ii = 0; ii < n; ii++) {
				for(int jj = 0; jj < n; jj++) {
					if(x[ii] - x[jj] == p && y[ii] - y[jj] == q) {
						cnt++;
					}
				}
			}
			ans = min(ans, n - cnt);
		}
	}

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def make_divisors(n):
    divisors = []
    for i in range(1, int(pow(n, 0.5)) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    divisors.sort()
    return divisors


def resolve():
    n, k = map(int, input().split())
    A = sorted(list(map(int, input().split())))

    div = make_divisors(sum(A))
    res = 1
    for x in div:
        B = sorted([a % x for a in A])
        M, P = [0], [0]
        for i in range(n):
            M.append(M[-1] + B[i])
            P.append(P[-1] + x - B[i])
        M.pop(0)
        P.pop(0)
        for i in range(n - 1):
            m = M[i]
            p = P[n - 1] - P[i]
            if m <= k and p <= k and m % x == p % x:
                res = max(res, x)
    print(res)


if __name__ == '__main__':
    resolve()


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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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




LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)x += mod1;
    return x;
}

const LL mod=1e9+7;
LL a[100002],fact[100002];

void find_fact()
{
    LL i;
    fact[0]=1LL;
    for(i=1LL;i<=100000;i++)fact[i]=(fact[i-1]*i)%mod;
}

int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    find_fact();
    LL i,k,n,ans=0LL;
    cin >> n >> k;
    for(i=1;i<=n;i++)cin >> a[i];
    sort(a+1,a+n+1,greater<LL>());
    for(i=1;i<=n;i++)
    {
        if(n-i >= k-1LL)ans=(ans+((fact[n-i]*(mod_inverse(fact[k-1]*fact[n-i-k+1] % mod,mod))) % mod *a[i]) % mod)%mod;
        if(i >= k)ans=(ans-((fact[i-1]*(mod_inverse(fact[k-1]*fact[i-k] % mod,mod))) % mod *a[i])%mod) % mod;
        if(ans < 0) ans += mod;
        ans%=mod;
    }
    if(ans < 0) ans += mod;
    cout << ans;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  cout<<N*(N-1)/2-N/2<<endl;
  int c=(N%2?N:N+1);
  FOR(i,1,N+1)FOR(j,i+1,N+1){
    if(i+j==c)continue;
    cout<<i<<" "<<j<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

vin par(100050);
vin deep(100050);
vin sizee(100050);
void init(int n);
int root(int x);
void unite(int x,int y);
bool same(int x,int y);

int main(){
    ll n,m;cin>>n>>m;
    vll a(m),b(m);
    rep(i,m)cin>>a[i]>>b[i];
    ll ans=n*(n-1)/2;
    reverse(all(a));reverse(all(b));
    stack<ll> s;s.push(ans);
    init(n);
    ll tmpa,tmpb;
    rep(i,m-1){
        if(same(a[i],b[i]))unite(a[i],b[i]);
        else{
            tmpa=sizee[root(a[i])];
            tmpb=sizee[root(b[i])];
            ans+=tmpa*(tmpa-1)/2+tmpb*(tmpb-1)/2;
            unite(a[i],b[i]);
            ans-=(tmpa+tmpb)*(tmpa+tmpb-1)/2;
        }
        s.push(ans);
    }
    while(s.size()){
        cout<<s.top()<<endl;
        s.pop();
    }
}

void init(int n){
    rep(i,n+1){
        par[i]=i;
        deep[i]=0;
        sizee[i]=1;
    }
}
int root(int x){
    if(par[x]==x)return x;
    else return par[x]=root(par[x]);
}
void unite(int x,int y){
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(deep[x]<deep[y]){
        par[x]=y;
        sizee[y]+=sizee[x];
    }
    else{
        par[y]=x;
        sizee[x]+=sizee[y];
        if(deep[x]==deep[y])deep[x]++;
    }
}
bool same(int x,int y){
    return root(x)==root(y);
}

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

int dis[100009];
vector <int> adj[100005];
int cal(int i){
    if(dis[i]!=-1)
        return dis[i];
    dis[i]=0;
    for(int j=0;j<adj[i].size();j++)
        dis[i]=max(dis[i], 1+cal(adj[i][j]));
    return dis[i];
}
int main() {
    int x,y,n,m;
    cin>>n>>m;
    memset(dis, -1, sizeof(dis));
    while(m--){
        cin>>x>>y;
        adj[x].push_back(y);
    }
    int maxi=0;
    for(int i=1;i<=n;i++){
        if(dis[i]==-1)
            cal(i);
        maxi=max(maxi, dis[i]);
    }
    cout<<maxi<<endl;
}


Measured memory_bytes: 8192
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    public class Prog
    {
        public static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Prog().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            var n = cin.ReadInt;
            var m = cin.ReadInt;

            var max = 0;
            var min = Int32.MaxValue;
            for (int i = 0; i < m; i++)
            {
                var l = cin.ReadInt;
                var r = cin.ReadInt;

                max = Math.Max(max, l);
                min = Math.Min(min, r);
            }
            var ans = min - max + 1;
            ans = Math.Max(0, ans);
            Console.WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; } }
    }
}


Measured memory_bytes: 17352
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9 + 7
void max_self(long long&a,long long b){
    a = max(a,b);
}
int main(){
    int n,W;
    cin>>n>>W;
    vector<long long>KS(W+1);
    for(int i = 0;i<n;i++){
        int w,v;
        cin>>w>>v;
        for(int w_base=W-w;w_base>=0;w_base--){
            max_self(KS[w_base+w],KS[w_base]+v);
        }
    }
    cout<<KS[W];

}

Measured memory_bytes: 1024
import numpy as np

N, K = map(int,input().split())
A = np.array(list(map(int,input().split())))
A.sort()
posi = A[A > 0]
zero = A[A == 0]
nega = A[A < 0]

# 積がx以下の組を求める
def check(x):
    count = 0  # 積がx以下の組
    if x >= 0:
        count += len(zero) * N  # zero * N
    count += np.searchsorted(A, x // posi, side = 'right').sum()  # posi * N
    count += (N - np.searchsorted(A, (-x - 1) // (-nega), side = 'right')).sum()  # nega * N
    count -= np.count_nonzero(A * A <= x)  # 自分自身との組
    return count // 2  #重複を消す

# 二分探索
low = -10 ** 18
high = 10 ** 18
while low + 1 < high:
    mid = (low + high) // 2
    if check(mid) < K:  # OK
        low = mid
    else:               # NG
        high = mid

print(high)


Measured memory_bytes: 32316
#include <stdio.h>
#include <stdlib.h>



int main(){
    int n,i;
    int a[55],b[55],c[55],count = 0;

    scanf("%d",&n);
    for(i = 1; i<= n; i++){
        scanf("%d",&a[i]);
        b[i] = i;
    }
    for(i = 1; i <= n ; i++){
        if(a[i] == b[i]){
            c[i] = 0;
        }else{
            c[i] = 1;
        }
        if(c[i] == 1){
            count++;
        }
    }

    if(count == 2 || count == 0){
        printf("YES");
    }else{
        printf("NO");
    }
    return 0;
}

Measured memory_bytes: 128
s = gets.chomp.split("")
t = gets.chomp.split("")
spots = Array.new(26) { Array.new }

s.each_with_index do |char, index|
  spots[char.ord - 97] << index + 1
end

current_spot = 0
loop_times = 0

t.each do |char|
  num = char.ord - 97
  if spots[num].empty?
    puts -1
    exit
  end
  current_spot = spots[num].bsearch { |item| item > current_spot }
  unless current_spot
    current_spot = spots[num].first
    loop_times += 1
  end
end

puts s.length * loop_times + current_spot


Measured memory_bytes: 13308
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007
//#define mod 998244353

//union find
struct union_find{
    int *parent; //parent[i]=parent of i
    int N;
    union_find(int N):N(N){
        parent=new int[N];
        rep(i,N)parent[i]=i; //init
    }
    int root(int x){ // take the root of x 
        if(parent[x]==x) return x;
        parent[x]=root(parent[x]); // recursion
        return parent[x];
    }
    void unite(int x,int y){// unite tree y to tree x
        int rx=root(x);
        int ry=root(y);
        if(rx==ry) return;
        parent[ry]=rx;
    }
    bool same(int x,int y){
        int rx=root(x);
        int ry=root(y);
        return rx==ry;
    }
    bool IsAllSameTree(){
        int rt=parent[0];
        rep(i,N){
            if(rt!=parent[i])return false;
        }
        return true;
    }
    int countmax(){//破壊的
        rep(i,N)root(i);
        sort(parent,parent+N);
        //rep(i,N)printf("%lld-",parent[i]);
        int maxcnt=1;
        int cnt=1;
        rep(i,N-1){
            if(parent[i]!=parent[i+1]){
                maxcnt=max(cnt,maxcnt);
                cnt=1;
            }else{
                cnt++;
            }
        }
        maxcnt=max(cnt,maxcnt);
        return maxcnt;
    }
};

int N,M;
signed main(){
    scanf("%lld %lld",&N,&M);
    union_find uf(N);
    rep(i,M){
        int a,b;
        scanf("%lld %lld",&a,&b);
        a--;b--;
        uf.unite(a,b);
    }
    int ans=uf.countmax();
    printf("%lld\n",ans);
}

Measured memory_bytes: 5044
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,h,a[100005],b[100005],c[100005],d[100005],in[405],ou[405],u[405],cnt;
vector<int> v[405];
bool ok=1;
bool dfs(int x){
    bool ok=0;
    if(u[x]) return 0;
    u[x]=1;
    if(in[x]!=ou[x])ok=1;
    for(int i=0;i<v[x].size();++i)ok|=dfs(v[x][i]);
    return ok;
}
int main(){
    scanf("%d%d",&n,&h);
    for(int i=1;i<=n;++i){
        scanf("%d%d%d%d",a+i,b+i,c+i,d+i);
        int x=c[i]?200+c[i]:a[i];
        int y=d[i]?d[i]:200+b[i];
        v[x].pb(y);
        v[y].pb(x);
        ++ou[x],++in[y];
    }
    bool ok=1;
    for(int i=1;i<=200;++i)if(ou[i]<in[i])ok=0;
    for(int i=201;i<=400;++i)if(in[i]<ou[i])ok=0;
    if(!ok){
        puts("NO");
        return 0;
    }
    for(int i=1;i<=400;++i){
        if(!u[i]&&(in[i]||ou[i])){
            if(!dfs(i)){
                puts("NO");
                return 0;
            }
        }
    }
    puts("YES");
    //system("pause");
    return 0;
}


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

int cmp(void *a,void *b)
{
    return *(int *)a-*(int *)b;
}

int main()
{
    int n,i,s=0;
    int l[200];
    scanf("%d",&n);
    for(i=0;i<2*n;i++)
    {
        scanf("%d",&l[i]);
    }
    qsort(l,2*n,sizeof(int),cmp);
    for(i=0;i<2*n;i+=2)
    {
        s+=l[i];
    }
    printf("%d\n",s);
    return 0;
}

Measured memory_bytes: 128
N,K = gets.chomp.split(" ").map(&:to_i)

combis = (1..N).to_a.map{|num| num%K}
count = 0

count = Hash.new(0)
combis.each do |elem|
  count[elem] += 1
end
ans = {}
count.each{|key, value|
  if (key+key)%K == 0
    ans[key] = value
  end
}
ans_count = 0
ans.each{|key, value|
  ans_count += value**3
}

p ans_count


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

using namespace std;

#define PRIME 1000000007

int match[21][21],n;
long int dp[22][1<<22];

long int pairs(int i,int state)
{
	if(i == n)
	{	
		if(state == (1<<n)-1)
		return 1;
		return 0;
	}
	if(dp[i][state] == -1)
	{
		dp[i][state] = 0;
		for(int j=0;j<n;++j)
		{
			if(match[i][j] == 1)
			{
				
				if((1 << j & state) == 0)
				dp[i][state] = (dp[i][state] + pairs(i+1,state | (1 << j)))%PRIME;
			}
		}
	}
	return dp[i][state];
	
}

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		scanf("%d",match[i]+j);
	}
	//printf("%d\n",1 << n+1);
	/*for(int i=n;i>=0;i--)
	{
		for(int j=(1<<n)-1;j>=0;j--)
		{
			dp[i][j] = 0;
			for(int k=0;k<n;++k)
			{
				if(i == n && j == (1<<n)-1)
				dp[i][j] = 1;
				else if(i == n || j == (1<<n)-1)
				dp[i][j] = 0;
				else if((1 << k)&j == 0 && match[i][k] == 1)
				dp[i][j] = (dp[i][j] + dp[i+1][(1 << k)|j])%PRIME; 
				 
			}
		}
	}*/
	memset(dp,-1,sizeof dp);
	printf("%ld\n",pairs(0,0));
	return 0;
}


Measured memory_bytes: 721152
#include <iostream>
#include "math.h"
#include "stdio.h"

using namespace std;

int main(){
    double a,b,c,area,l,h,radian;
    int degree;
    cin >> a >> b >> degree;
    
    radian = degree * M_PI / 180;
    h = sin(radian) * b;
    area = a * b * sin(radian) / 2;
    c = sqrt((b * b) + (a * a) - 2 * a * b * cos(radian));
    l = a + b + c;
    
    printf("%.8lf\n",area);
    printf("%.8lf\n",l);
    printf("%.8lf\n",h);
}



Measured memory_bytes: 3496
#create date: 2020-07-03 10:10

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    a, b, c, k = na()
    if k <= a:
        print(k)
    elif k <= a + b:
        print(a)
    else:
        print(a-(k-(a+b)))

if __name__ == "__main__":
    main()

Measured memory_bytes: 8808
#include<cstdio>

#define ran 505

int n;
int dur[ran], st[ran], gap[ran];

int main() {
	scanf("%d", &n);
	for(int i=0;i<n-1;i++) scanf("%d%d%d", &dur[i], &st[i], &gap[i]);
	
	for(int i=0;i<n-1;i++) {
		int t = 0;
		for(int j=i;j<n-1;j++) {
			if (t<st[j]) t = st[j];
			else 
			if (t%gap[j]) {
				t -= t%gap[j];
				t += gap[j];
			}
			t += dur[j];
		}
		printf("%d\n", t);
	}
			
	puts("0");
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define ll long long
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vector<int>,greater<int>>
const double pi = acos(-1.0);
const double eps = 1e-6;
using namespace std;




void solve(){   
    ll x, p;
    cin >> x >> p;
    if (x % 2 == 0){
        cout << (x / 2) * (100. / p) << endl;
    }else{
        cout << ((x + 1) / 2) * (100. / p) << endl;
    
    }
}       
int main(){
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(5);
    //freopen("input.txt", "r", stdin);//freopen("output1.txt", "w", stdout);
    //freopen("icecream.in","r",stdin);// freopen("exam.out", "w", stdout);
    int step;
    step = 1;
    //cin >> step;
    for (int i = 1; i <= step; i++){
         solve();
    }
}

Measured memory_bytes: 3768
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
    int x=0,k=1; char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')k=-1;c=getchar();}
    while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x*k;
}
#define maxn 2510
#define maxm 5010
#define inf 1234567890
int n,m,p,tot,dis[maxn],head[maxn];
int cnt[maxn],vis[maxn];
struct Edge{
    int next,to,w;
}h[maxm];
vector<int>e[maxn],g[maxn];
void add(int u,int v,int w){
    h[++tot].next=head[u];h[tot].to=v;
    h[tot].w=w;head[u]=tot;
}
queue<int> q;
int ok1[maxn],ok2[maxn];
bool flag=1;
void spfa(){
    for(int i=1;i<=n;i++)dis[i]=-inf;
    int u,v;
    q.push(1);
    dis[1]=0;cnt[1]++;
    while(!q.empty()){
        u=q.front();
        q.pop();vis[u]=0;
        for(int i=head[u];i;i=h[i].next){
            v=h[i].to;
            if(!ok1[v]||!ok2[v])continue;   
            if(dis[v]<dis[u]+h[i].w){
                dis[v]=dis[u]+h[i].w;
            	if(!vis[v]){
					cnt[v]++;
            		if(cnt[v]>n){flag=0;return;}
                	q.push(v);vis[v]=1;
            	}
			}
        }
    }
}
void dfs(int x){
	ok1[x]=1;
	for(int i=0;i<e[x].size();i++){
		int y=e[x][i];if(vis[y])continue;
		vis[y]=1;dfs(y);
	}
}
void Dfs(int x){
	ok2[x]=1;
	for(int i=0;i<g[x].size();i++){
		int y=g[x][i];if(vis[y])continue;
		vis[y]=1;Dfs(y);
	}
}
signed main(){
    n=read(),m=read(),p=read();
    for(int i=1,u,v,w;i<=m;i++){
        u=read(),v=read(),w=read();
        w-=p;
        add(u,v,w);
        e[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(1);memset(vis,0,sizeof(vis));
    Dfs(n);memset(vis,0,sizeof(vis));
    
    spfa();
    if(!flag)puts("-1");
    else{
    	if(dis[n]<0)dis[n]=0;
		printf("%lld\n",dis[n]);
	}
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main () 
{
    ll n;cin>>n;
     string s[n];
    map<string,ll>m;
    for (ll i=0;i<n;i++) {cin>>s[i];m[s[i]]++;}
    ll count=0;
    for (ll i=0;i<n;i++) {
        if (m[s[i]]!=0) {count++;m[s[i]]=0;}
        
    }
    cout<<count<<endl;

}

Measured memory_bytes: 25372
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;cin>>N>>K;
  vector<int>X(N);for(int i=0;i<N;i++)cin>>X[i];
  
  vector<int> sgn(N);
  for(int i=i;i<N;i++)sgn[i]=(X[i]==0?0:(X[i]>0)*2-1);
  
  int m=INT_MAX;
  
  //start位置でルー
  for(int s=0;s<N;s++){
    int tmp;
    if(sgn[s]<0){
      if(s+K-1>=N)continue;
      if(sgn[s+K-1]>0)tmp=abs(X[s])+2*X[s+K-1];
      else tmp=abs(X[s]);
    }
    else if(sgn[s]>0){   
      if(s-K+1<0)continue;
      if(sgn[s-K+1]<0)tmp=X[s]+2*abs(X[s-K+1]);
      else tmp=abs(X[s]);
    }
    else{
      tmp=min((s+K-1>=N?INT_MAX:2*abs(X[s+K-1])),
          (s-K+1<0?INT_MAX:2*abs(X[s-K+1])));
    }
    m=min(m,tmp);
  }
  cout<<m;
}



Measured memory_bytes: 1024
#include<cstdio>
int n,m,i,l,r,a[1<<21];int f(){for(i=1;i<n;i++){if(a[n+i-1]>m==a[n+i]>m)return a[n+i]>m;if(a[n-i+1]>m==a[n-i]>m)return a[n-i]>m;}return a[1]>m;}main(){scanf("%d",&n);for(i=1;i<n+n;i++)scanf("%d",a+i);for(l=1,r=n+n-1;l<=r?1:!printf("%d",l);f()?l=m+1:r=m-1)m=(l+r)/2;}

Measured memory_bytes: 896
N = int(input())
p = list(map(int, input().split()))

ans = 0
c = 0
for i in range(N):
    if p[i] == i+1:
        if c == 1:
            c = 0
            continue
        ans += 1
        c = 1
    else:
        c = 0

print(ans)

Measured memory_bytes: 14008
#include <stdio.h>

int main(void) {
	char s[4]; scanf("%s",s);
	char t[4]; scanf("%s",t);
	int cnt = 0;
	for (int i=0; i<3; i++) {
		if (s[i] == t[i]) cnt++;
	}
	printf("%d\n",cnt);
	
	return 0;
}


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

int main(){
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    rep(i,n){
        cin >> s.at(i);
    }
    //　これだけで辞書順でソートできる
    sort(s.begin(),s.end());
    rep(i,n){
        cout << s.at(i);
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<string>
#include<vector>
#include<queue>
#include<utility>
#include<ctype.h>

#define f(i,n) for(int i=0;i<n;++i)
long long int  memo[100001] = {};
const int inf = 1 << 30;
	int a[100001],b[100000][2],ac[100000];
int main() {
	int n;
	std::cin >> n;
	for (int i = 2; i *i< 100000; ++i) {
		if (a[i] == 0)
		for (int j = 2; j*i < 100000; ++j) {
			a[i*j] = inf;
		}
	}

		for (int j = 3; j < 100000; ++j) {
			if (a[j]==0&&a[(j+1)/2] == 0)ac[j] ++;
		}
		for (int j = 3; j < 100000; ++j) {
			ac[j] += ac[j - 1];
		}
	
	for (int i = 0; i < n; ++i) {
		std::cin >> b[i][0] >> b[i][1];
		std::cout << ac[b[i][1]]-ac[b[i][0]-1]<< std::endl;
	}

	return 0;
}

Measured memory_bytes: 2176
#include<stdio.h>
#include<string.h>

#define M 1000003
#define L 14

char H[M][L];

int getChar(char ch) {
	if (ch == 'A') {
		return 1;
	}
	else if (ch == 'C') {
		return 2;
	}
	else if (ch == 'G') {
		return 3;
	}
	else if (ch == 'T') {
		return 4;
	}
	return 0;
}

long long getKey(char str[]) {
	long long sum = 0, p = 1, i;
	for (i = 0; i < strlen(str); i++) {
		sum += p * (getChar(str[i]));
		p *= 5;
	}
	return sum;
}

int hash1(int key) {
	return key % M;
}

int hash2(int key) {
	return 1 + key % (M - 1);
}

int getHashValue(char str[], int i) {
	return (hash1(getKey(str)) + i * hash2(getKey(str))) % M;
}

int find(char str[]) {
	int hashval, i = 0;

	while (1) {
		hashval = getHashValue(str, i);
		if (!strcmp(H[hashval], str)) return 1;
		if (!strcmp(H[hashval], "\0")) return 0;
		i++;
	}
}

void insert(char str[]) {
	int hashval, i = 0;

	while (1) {
		hashval = getHashValue(str, i);
		if (!strcmp(H[hashval], "\0")) {
			strcpy(H[hashval], str);
			break;
		}
		i++;
	}
}

int main() {
	int i, n;
	char str[L], com[9];

	for (i = 0; i < M; i++) {
		H[i][0] = '\0';
	}

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%s %s", com, str);

		if (com[0] == 'i') {
			insert(str);
		} else {
			if (find(str)) {
				printf("yes\n");
			} else {
				printf("no\n");
			}
		}
	}

	return 0;
}

Measured memory_bytes: 14280
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, AB):
    c = Counter()
    for a, b in AB:
        c[a] += 1
        c[b] += 1
    for v in c.values():
        if v % 2 != 0:
            return 'NO'
    return 'YES'


def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(M)]
    print(slv(N, M, AB))


if __name__ == '__main__':
    main()


Measured memory_bytes: 35172
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while (true) {
			String str[] = br.readLine().split(" ");
			int n = Integer.parseInt(str[0]);
			int m = Integer.parseInt(str[1]);

			if (n == 0 && m == 0)
				break;

			ArrayList<Integer> tarou = new ArrayList<>();
			ArrayList<Integer> hanako = new ArrayList<>();

			int tarouSum = 0;
			int hanakoSum = 0;

			for (int i = 0; i < n; i++) {
				int num = Integer.parseInt(br.readLine());
				tarou.add(num);
				tarouSum += num;
			}

			for (int i = 0; i < m; i++) {
				int num = Integer.parseInt(br.readLine());
				hanako.add(num);
				hanakoSum += num;
			}

			// int diff = Math.max(tarouSum, hanakoSum) == tarouSum ? tarouSum - hanakoSum :
			// hanakoSum - tarouSum;

			ArrayList<Cards> ans = new ArrayList<>();

			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					int tSum = tarouSum - tarou.get(i);
					int hSum = hanakoSum + tarou.get(i);
					hSum -= hanako.get(j);
					tSum += hanako.get(j);
					if (hSum == tSum) {
						ans.add(new Cards(tarou.get(i), hanako.get(j)));

					}
				}
			}
			Collections.sort(ans);
			if (ans.size() != 0) {
				System.out.println(ans.get(0).t + " " + ans.get(0).h);
			} else {
				System.out.println(-1);
			}
		}
	}
}

class Cards implements Comparable<Cards> {

	int t;
	int h;

	public Cards(int t, int h) {
		this.t = t;
		this.h = h;
	}

	@Override
	public int compareTo(Cards o) {
		return (this.t + this.h) - (o.t + o.h);
	}
}


Measured memory_bytes: 25212
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
  int a, b;
  std::string s;
  
  cin >> a >> s >> b;

  if(s == "+")
    cout << (a + b) <<endl;
  else
    cout << (a - b) <<endl;
 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 500010;
typedef long long ll;
typedef long double ld;

string s,t;
int k;

int kk(string s, int st=0) {
	int i = st, ans=st;
	while (i < (int)s.length()-1) {
		if (s[i] == s[i + 1]) {
			ans++;
			i += 2;
		}
		else ++i;
	}
	return ans;
}
bool klz(string s, int st=0) {
	int i = st;
	while (i < (int)s.length() - 1) {
		if (s[i] == s[i + 1]) i += 2;
		else ++i;
	}
	return i == (int)s.length();
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> s >> k;
	t = s + s[0];
	if (klz(t)) {
		if (klz(t, 1)) {
			cout << 1LL * kk(s, 1)*(k - 1) + kk(s);
		}
		else cout << 1LL * kk(s)*((k + 1) / 2) + 1LL * kk(s, 1)*(k / 2) << endl;
	}
	else {
		cout << kk(s) + 1LL * kk(t)*(k - 1) << endl;
	}
}

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

int main() {
    int a[3];

    cin >> a[0] >> a[1] >> a[2];

    sort(a, a + 3, greater<int>());

    cout << a[0] * 10 + a[1] + a[2] << endl;

    return 0;
}


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

using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    int x = n / 100;
    if (100 * x <= n && 105 * x >= n) {
        cout << 1 << EOL;
    } else {
        cout << 0 << EOL;
    }
}


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

if len(hitachi) % 2 == 1:
    print("No")

else:
    H = True
    for i in range(len(hitachi)):
        if i % 2 == 0:
            if hitachi[i] != "h":
                H = False
        else:
            if hitachi[i] != "i":
                H = False

    if H == True:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define per(i,n) for (int i=n-1; i>=0; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
using P  = pair<int,int>;
using vi = vector<int>;
using vv = vector<vi>;
const int mod = 1000000007;
//const int mod = 998244353;

int main(){
    int n, i;
    cin >> n >> i;
    cout << n-i+1 << endl;
    
    return 0;
}

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

#define mod 1e9+7

typedef long long ll;


int main()
{
    //freopen("in.txt", "r", stdin);
    ios_base::sync_with_stdio(false);	
    cin.tie(NULL);

    ll a,b,k;
    cin>>a>>b>>k;

    if(k<=a){
        cout<<a-k<<" "<<b;
    }
    else if(k>a){

        if(k-a>=b)
            cout<<0<<" "<<0;
        else
            cout<<0<<" "<<(b-(k-a));
    }


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  char s[11];
  char t[11];
  int i,j,k,len,len2;
  scanf("%s",s);
  len=strlen(s);
  j=0;
 
  for(i=0;i<len;i++){
    if(s[i]=='0'){
      t[j]='0';
      j++;
   
    }
    else if(s[i]=='1'){
      t[j]='1';
      j++;
  
    }
    else if(s[i]=='B'){
      if(j!=0)j--;
     
    }
  }
  
  for(k=0;k<j;k++)printf("%c",t[k]);
printf("\n");
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  char *s;
  int count = 0;
  s = (char *)malloc(sizeof(char));
  scanf("%s", s);
  while (*s != '\0') {
    if (count % 2 == 0) printf("%c", *s);
    s++;
    count++;
  }
  printf("\n");
  return 0;
}

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

using namespace std;
const int N = 1e5 + 10;
int par[N], st[N], fn[N], h[N], timer = 0;
vector <int> g[N];

void dfs(int v, int p = 0, int height = 0)
{
    par[v] = p;
    h[timer] = height;
    st[v] = timer++;
    for (int u : g[v]) if (u != p) dfs(u, v, height + 1);
    fn[v] = timer;
}

int32_t main()
{
    int n, A, T; cin >> n >> T >> A;
    for (int i = 0; i < n - 1; i++) {
        int u, v; cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(A);
    int t = (h[st[T]] + 1) / 2 - 1;
    while (t--) T = par[T];
    int ans = 0;
    for (int i = st[T]; i < fn[T]; i++) ans = max(ans, h[i] - 1);
    cout << ans << "\n";
}


Measured memory_bytes: 12416
#include <stdio.h>

#define JUDGE(x, y) ((cards[x] == cards[y]) ? 1 : 0)
#define SJUDGE(x, y) ((cards[x] + y - x == cards[y]) ? 1 : 0)

int main(){
  int cards[5], i, j, min;

  while(scanf("%d,%d,%d,%d,%d", &cards[0], &cards[1], &cards[2], &cards[3], &cards[4]) != EOF){
    for(i = 0;i < 5;i++){
      min = i;
      for(j = i + 1;j < 5;j++)
	min = cards[j] > cards[min] ? min : j;
      if(min != i){
	cards[min] += cards[i];
	cards[i] = cards[min] - cards[i];
	cards[min] -= cards[i];
      }
    }

    if(JUDGE(1, 2) && JUDGE(2, 3) && (JUDGE(0, 1) || JUDGE(3, 4))) puts("four card");
    else if(JUDGE(0, 1) && JUDGE(3, 4) && (JUDGE(1, 2) || JUDGE(2, 3))) puts("full house");
    else if(SJUDGE(1, 2) && SJUDGE(2, 3) && SJUDGE(3, 4) && (SJUDGE(0, 1) || (cards[0] == 1 && cards[4] == 13))) puts("straight");
    else if((JUDGE(0, 1) && JUDGE(1, 2)) || (JUDGE(1, 2) && JUDGE(2, 3)) || (JUDGE(2, 3) && JUDGE(3, 4))) puts("three card");
    else if((JUDGE(0, 1) && JUDGE(2, 3)) || (JUDGE(1, 2) && JUDGE(3, 4)) || (JUDGE(0, 1) && JUDGE(3, 4))) puts("two pair");
    else if(JUDGE(0, 1) || JUDGE(1, 2) || JUDGE(2 ,3) || JUDGE(3, 4)) puts("one pair");
    else puts("null");
  }
  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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 (b<a) { a=b; return 1; } return 0; }
typedef pair<int,int> P;

vector<int> to[100005];
vector<bool> d(100005);
vector<bool> visited(100005,0);
bool flag = 1;
void dfs(int v, int p=-1) {
  for (auto u : to[v]) {
    if(visited[u]){
      if(d[u]==d[v])flag=0;
      continue;
    }
    visited[u]=1;
    d[u] = 1-d[v];
    dfs(u,v);
  }
}

int main() {
  ll n,m;
  cin >> n >> m;
  rep(i,m) {
    int u,v;
    cin >> u >> v;
    --u; --v;
    to[u].push_back(v);
    to[v].push_back(u);
  }
  d[0]=0;
  //flag=1;
  visited[0]=1;
  dfs(0);
  if(flag){
    ll c0 =0,c1=0;
    rep(i,n){
      if(d[i]==0)c0++;
      else c1++;
    }
    ll ans = c0*c1-m;
    cout << ans << endl;
  }else{
    ll ans= n*(n-1)/2LL - m;
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define base 31
#define MOD 1e9+7
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Read_ freopen("input.inp", "r", stdin)
#define Write_ freopen("output.out", "w", stdout);
using namespace std;
typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define N  52
int x;
void process(){

}
int main(){
    _io; 
    cin>>x;
    if (x) cout<<0; else cout<<1;

}




Measured memory_bytes: 3600