akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int AB, BC, CA;

int main() {
	cin >> AB >> BC >> CA;
	cout << AB*BC / 2 << endl;
	return 0;
}

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

using namespace std;

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

    int n, x, y;
    cin >> n >> x >> y;
    int ans[n] = {};

    for (int i = 1; i < n; i++)
        for (int j = i + 1; j <= n; j++) {
            int cur = 2e9;
            cur = min(j - i, abs(j - y) + abs(x - i) + 1);
            ans[cur]++;
        }

    for (int i = 1; i < n; i++)
        cout << ans[i] << '\n';

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define vi vector<int>
#define pb push_back
using namespace std;
const int N=2e5+5;
int n,a[N],x[N],y[N];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=n;i++)
	{
		x[i]=max(x[i-1],a[i]);
	}
	for(int i=n;i>=1;i--)
	{
		y[i]=max(y[i+1],a[i]);
	}
	for(int i=1;i<=n;i++)
	{
		cout<<max(x[i-1],y[i+1])<<endl;
	}
	return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FOD(i,a,b) for(ll i=(a);i>=(b);--i)
#define name "a"
#define pb push_back
typedef pair < ll , ll > ii;
const ll maxn=4e5+7,oo=1e18,mod=1e9+7;
ll x,y,A,B,C,a[maxn],b[maxn],c[maxn],sa[maxn],sb[maxn],sc[maxn],kq,res[maxn],nr;
bool cmp(ll i, ll j)
{
    return i>j;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen(name".inp","r",stdin);
    //freopen(name".out","w",stdout);
    cin>>x>>y>>A>>B>>C;
    FOR(i,1,A)
        cin>>a[i];
    sort(a+1,a+1+A,cmp);
    FOR(i,1,B)
        cin>>b[i];
    sort(b+1,b+1+B,cmp);
    FOR(i,1,C)
        cin>>c[i];
    sort(c+1,c+1+C,cmp);
    FOR(i,1,x)
        res[++nr]=a[i];
    FOR(i,1,y)
        res[++nr]=b[i];
    FOR(i,1,C)
        res[++nr]=c[i];
    sort(res+1,res+1+nr,cmp);
    ll p=1;
    FOR(i,1,x+y)
    {
        kq+=res[i];
    }
    cout<<kq;
    return 0;
}


Measured memory_bytes: 12544
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    r, d, start = mi()
    prev = start
    for _ in range(10):
        current = r * prev - d
        print(current)
        prev = current

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
while True:
	n = int(input())
	if n == 0: break
	arr = [[0 for r in range(n+2)] for c in range(n+2)]

	for r in range(n):
		arr[r] = list(map(int, input().split()))
		arr[r].append(sum(arr[r]))

	for c in range(n+1):
		s = 0
		for r in range(n): s += arr[r][c]
		arr[n][c] = s

	for r in range(n+1):
		for c in range(n+1): print(format(arr[r][c], '5d'), end='')
		print()


Measured memory_bytes: 5636
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=3*100005;
const int MOD=1e9+7;
LL cal(LL n)
{
	LL ans=1;
	for(int i=1;i<=n;i++)
	{
		ans=(ans%MOD*i%MOD)%MOD;
	}
	return ans%MOD;
}
int main()
{
    LL n,m;
    scanf("%lld%lld",&n,&m);
    if(llabs(m-n)>=2)
	{
		cout<<0<<endl;
	}
	else
	{
		int k;
		if(llabs(m-n)==1)
		{
			k=1;
		}
		else
			k=2;
		cout<<((cal(n)*cal(m))*k)%MOD<<endl;
	}
    
    return 0;

}


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

int main() {
  int n;
  cin>>n;
  int a[n];
  for (int i=0; i<n; i++) cin>>a[i];
  int k = 0;
  int idx = 1;
  for (int i=0; i<n; i++) {
    if (a[i] == idx) {
      ++idx;
      continue;
    }
    ++k;
  }
  if (k == n) {
    cout<<-1<<endl;
  } else {
    cout<<k<<endl;
  }
}

Measured memory_bytes: 1024
#include "iostream"
using namespace std;

int a,b,c;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>a>>b>>c;
	if(a == b)
		cout<<c;
	else if(a == c)
		cout<<b;
	else if(b == c)
		cout<<a; 
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String[] str = sc.nextLine().split("[\\s]");
		
		boolean first_flag = false;
		
		for(String tmp:str){
			if(!first_flag){
				System.out.print(tmp.toUpperCase());
				first_flag = true;
			}
			else {
				System.out.print(" "+tmp.toUpperCase());
			}
		}
		System.out.println();
	}
}

Measured memory_bytes: 17148
#include <stdio.h>

int main() {
	int s;
	short a[4];
	int abcd;
	scanf("%d", &abcd);
	for (int i = 3; i >= 0; i--) {
		a[i] = abcd % 10;
		abcd /= 10;
	}


	int i;
	int f[4];
	for (i = 0; i < 8; i++) {
		s = a[0];
		if (i & 4) {s -= a[1]; f[1] = 1;} else {s += a[1]; f[1] = 0;}
		if (i & 2) {s -= a[2]; f[2] = 1;} else {s += a[2]; f[2] = 0;}
		if (i & 1) {s -= a[3]; f[3] = 1;} else {s += a[3]; f[3] = 0;}
		if (s == 7) {break;}
	}
	printf("%d", a[0]);
	for (int j = 1; j < 4; j++) {
		if (f[j]==1) printf("-"); else printf("+");
		printf("%d", a[j]);
	}
	printf("=7\n");
	return 0;
}

Measured memory_bytes: 128
/*  -*- coding: utf-8 -*-
 *
 * a.cc: C: AtCoDeerくんと選挙速報 / AtCoDeer and Election Report
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 1000;

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

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

  ll pt = 1, pa = 1;
  for (int i = 0; i < n; i++) {
    ll t, a;
    cin >> t >> a;

    ll mt = (pt + t - 1) / t, ma = (pa + a - 1) / a;
    ll m = max(mt, ma);
    pt = t * m, pa = a * m;
  }
  printf("%lld\n", pt + pa);
  return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    string b=a;
    reverse(a.begin(),a.end());
    for(int i=0;i<a.size();++i)
      {
          if(a[i]=='b') a[i]='d';
          else if(a[i]=='d') a[i]='b';
          else if(a[i]=='p') a[i]='q';
          else if(a[i]=='q') a[i]='p';
      }
    if(a==b) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <tuple>
#include <string>
#include <vector>
using namespace std;

const long P = 1e9+7;
tuple<long,long,long> ext_gcd(long a, long b) {
  if (b==0)
    return make_tuple(a,1,0);
  auto gxy = ext_gcd(b,a%b);
  auto y = get<2>(gxy);
  return make_tuple(get<0>(gxy),y,get<1>(gxy)-a/b*y);
}
long invmod(long a) {
  auto gxy = ext_gcd(a,P);
  return (get<1>(gxy)+P) % P;
}
long powmod(long a,long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long c = powmod(a, b/2);
  c = c*c%P;
  if (b%2) c = c*a%P;
  return c;
}
long N, M;
string S;
int main() {
  cin >> N;
  cin >> S;
  M = S.size();
  vector<long> dp(N+1,0);
  dp[0] = 1;
  for (int n=0; n<N; ++n) {
    vector<long> ndp(N+1,0);
    for (int m=max(0l,M-(N-n)); m<=min(1l*n,M+(N-n)); ++m) {
      auto c = dp[m]%P;
      ndp[max(0,m-1)] += c;
      ndp[m+1] += c*2;
    }
    dp.swap(ndp);
  }
  cout << (1ll*dp[M]*invmod(powmod(2,M)))%P << endl;
}


Measured memory_bytes: 384
def main():
    n,m=map(int,input().split())
    ab = {}
    ab1 = {}
    for _ in range(m):
        a,b=map(int,input().split())
        ab.setdefault(a,set()).add(b)
        ab.setdefault(b,set()).add(a)
        ab1.setdefault(a,set()).add(b)
        ab1.setdefault(b,set()).add(a)
    g = []
    g.append(set([1]))
    marked = set()
    marked.add(1)
    while ab:
        g_add = set()
        for k in g[-1]:
            for x in ab[k]:
                if x not in marked:
                    g_add.add(x)
                    marked.add(x)
            del ab[k]
        g.append(g_add)
    if len(marked) < n:
        print('No')
        return
    print('Yes')
    result = [None] * n
    for i,s in enumerate(g):
        if not i:
            continue
        for k in s:
            result[k-1] = (g[i-1]&ab1[k]).pop()
    for i in range(1,n):
        print(result[i])

main()

Measured memory_bytes: 123380
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		int x1 = p[0];
		int y1 = p[1];
		int x2 = p[2];
		int y2 = p[3];
		
		//int l = 0;
		int x3 = 0;
		int y3 = 0;
		int x4 = 0;
		int y4 = 0;
		
		int ox = x2 - x1;
		int oy = y2 - y1;
		
		
		
		//x' = (xcos45 - ysin45) * sqrt(2)
		//y' = (xsin45 + ycos45) * sqrt(2)
		x3 = ox - oy + x1;
		y3 = ox + oy + y1;
		
		
		//x' = xcos90 - ysin90
		//y' = xsin90 + ycos90
		x4 = -oy+x1;
		y4 = ox+y1;
		/*
		if(y1==y2)
		{
			l = Math.Abs(x1-x2);
		
			x3 = x2;
			y3 = y2-l;
			x4 = x1;
			y4 = y3;
		}
		else if(x1==x2)
		{
			l = Math.Abs(y1-y2);
			Console.WriteLine("a");
			x3 = x2 - l;
			y3 = y2;
			x4 = x3;
			y4 = y1;
		}
		*/
		Console.WriteLine("{0} {1} {2} {3}", x3, y3, x4, y4);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		int[] r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
	
}

Measured memory_bytes: 13268
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
const ll INF = 1e9 + 10 ;
const ll N = 1e5 + 10 ;
ll p[N] ; 
ll r[N] ;
vector<ll> cnt(N);
ll Find(ll x){
    if ( p[x] == x ) return x; 
    p[x] = Find(p[x]) ; 
    return p[x] ; 
}
void unite(ll x,ll y){
    ll Px = Find(x) ; 
    ll Py = Find(y) ; 
    if ( Px == Py ) return ; 
    if ( r[Px] == r[Py] ){
        cnt[Px] += cnt[Py];
        p[Py] = Px ;
        r[Px] += 1 ;
    }
    else if ( r[Px] < r[Py] ){
        cnt[Py] += cnt[Px] ; 
        p[Px] = Py;
    }
    else {
        cnt[Px] += cnt[Py];
        p[Py] = Px ; 
    }
}
int main(){
    fastio 
    for(ll i = 0; i < N; i++){
        p[i] = i ; 
        cnt[i] = 1;
    }
    ll n , m ;
    cin >> n >> m ;
    vector<ll> ans(m) ; 
    ans[m - 1] = n * (n - 1) / 2 ;
    vector<pair<ll, ll> > v(m) ; 
    for(ll i = 0; i < m; i++){
        cin >> v[i].first >> v[i].second ; 
    }
    for(ll i = m - 1; i > 0; i--){
        ll Px = Find(v[i].first) , Py = Find(v[i].second);
        debug() << imie(Px) imie(Py) ;
        if ( Px == Py ) {
            ans[i - 1] = ans[i] ;
        }
        else{
            ans[i - 1] = ans[i] - (cnt[Px] * cnt[Py]);
            unite(Px, Py) ; 
        }
    }
    for(ll i = 0; i < m; i++){
        cout << ans[i] << endl;
    }
    return 0 ;
}

Measured memory_bytes: 6016
N = input()
data = str(N)
iti = data[len(data)-1]
if iti == "2" or iti == "4" or iti == "5" or iti == "7" or iti == "9":
  print("hon")
elif iti == "0" or iti == "1" or iti == "6" or iti == "8":
  print("pon")
else:
  print("bon")

Measured memory_bytes: 9120
#include <iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<limits.h>

#define MOD 1000000007
#define DEBUG 0


using namespace std;

long long int modpow(long long int a, int n) {

	if (n == 0)return 1;
	if (n == 1) return a;

	long long int wk = modpow(a, n / 2);

	long long int ret = 0;
	if (n % 2 == 0) {
		ret = 1;
	}
	else {
		ret = a;
	}

	return (((ret * wk) % MOD) * wk) % MOD;

}

long long int gcd(long long int a, long long int b) {
	long long int tmp;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	long long int r = a % b;

	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

long long int lcm(long long int a, long long int b) {

	long long int wk_int;

	wk_int = (a * b) % MOD;
	
	long long int ret;

	ret = (wk_int * modpow(gcd(a, b), MOD - 2)) % MOD;

	return ret;

}

bool isPrime(int n) {
	if (n == 1)return false;
	if (n == 2)return true;

	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}

	return true;
}


int main()
{

	string str;
	cin >> str;

	vector<int> a(str.size());
	for (int i = 0; i < a.size(); i++) {
		a[i] = str[i] - '0';
	}

	long long int ans = 0;
	long long int wk;
	long long int wkans;
	for (int i = 0; i < (1 << (a.size()-1)); i++) {
		wkans = 0;
		wk = a[0];

		for (int j = 0; j < a.size() - 1; j++) {
			if (1 & (i >> j)) {
				//＋があった場合。
				wkans += wk;
				wk = a[j + 1];
			}
			else {
				//+が無かった場合。
				wk *= 10;
				wk += a[j + 1];
			}



		}
		wkans += wk;

		ans += wkans;
		


	}



	cout << ans << endl;

	return 0;

}



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

int main() {
    int k;
    ll ans=0;
    vector<int> a(3);
    cin>>a[0]>>a[1]>>a[2]>>k;
    sort(a.begin(),a.end());
    rep(i,k) a[2]*=2;
    rep(i,3) ans+=a[i];
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int n, w[20100], cnt;
int main() {
	scanf("%d", &n);
	int i, j, k;
	if (n == 3) {
		printf("%d %d %d\n", 2, 5, 63);
		return 0;
	}
	if (n == 4) {
		printf("%d %d %d %d\n", 2, 5, 20, 63);
		return 0;
	}
	int pv1 = 2, pv2 = 3, pv3 = 6, ck = 1;
	if(n%2==1)w[++cnt] = 6, pv3 += 6;
	while (cnt < n && ck) {
		ck = 0;
		if (pv1 + 2 <= 30000 && cnt+2 <= n) {
			w[++cnt] = pv1;
			w[++cnt] = pv1 + 2;
			pv1 += 6;
			ck = 1;
		}
		if (pv2 + 6 <= 30000 && cnt+2 <= n) {
			w[++cnt] = pv2;
			w[++cnt] = pv2 + 6;
			pv2 += 12;
			ck = 1;
		}
	}
	while (cnt < n) {
		w[++cnt] = pv3;
		pv3 += 6;
	}
	for (i = 1; i <= cnt; i++)printf("%d ", w[i]);
}

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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())
#define endl '\n'

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//#ifndef ONLINE_JUDGE
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
//	#endif
	int n,a;
	cin>>n>>a;
	if(n%500 <= a)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool a,b,c,d;
int main()
{
    int k;
    for(int i=1;i<=4;i++)
    {
        scanf("%d",&k);
        if(k==1)a=true;
        else if(k==9)b=true;
        else if(k==7)c=true;
        else if(k==4)d=true;
    }
    if(a&&b&&c&&d)printf("YES");
    else printf("NO");
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
// use std::collections::BinaryHeap;

fn main() {
  let mut n = read::<i64>();
  let mut ans = 0;
  let mut ans_max = 0;

  for i in 1..n + 1 {
    let mut k = i.clone();
    let mut cnt = 0;
    while k % 2 == 0 && k != 1 && k != 0 {
      k /= 2;
      cnt += 1;
    }
    if ans_max < cnt {
      ans = i;
      ans_max = cnt;
    }
  }

  if n == 1 {
    println!("{}", 1);
  } else {
    println!("{}", ans);
  }

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N ;
    string str = to_string(N);
    int length= str.size();
    int div=0;

    for(int i=0; i<length; i++){
        div+=(int)(str[i] - '0');
    }
    if(N%div == 0){
        cout<< "Yes" <<endl;
    }else{
        cout<< "No" <<endl;
    }
}

Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main()
{
	int N;
	string S;
	cin >> N;
	cin >> S;

	for (int i = 0; i < S.size(); ++i) {
		int t = S[i] + N;
		t -= (int)'A';
		t = t % 26;
		t += (int)'A';
		S[i] = t;
		
	}
	
	cout << S << endl;
	return 0;
}


Measured memory_bytes: 3616
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
 
class Main{
 
static final PrintWriter out=new PrintWriter(System.out);
 
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int ans=0;
int n=Integer.parseInt(line);
int[] a=new int[n];
StringTokenizer st1=new StringTokenizer(br.readLine());
for(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());
int m=Integer.parseInt(br.readLine());
StringTokenizer st2=new StringTokenizer(br.readLine());
/**
for(int i=0;i<m;i++){
int b=Integer.parseInt(st2.nextToken());
if(binarySearch(a,b)>=0) ans++;
}
*/
for(int i=0;i<m;i++){
int b=Integer.parseInt(st2.nextToken());
if(Arrays.binarySearch(a,b)>=0) ans++;
}
out.println(ans);
out.flush();
}
}
 
/**
private static int binarySearch(int[] a,int b){
int lb=0;
int ub=a.length;
while(ub>lb){
int mid=(lb+ub)/2;
if(a[mid]==b) return mid;
else if(a[mid]>b) ub=mid;
else lb=mid+1;
}
return -1;
}
*/
}

Measured memory_bytes: 36020
s = input()  # "3 2"
n, m = s.split()  # ("3", "2")
n = int(n)  # 3
m = int(m)  # 2

a = []
for i in range(0, n):
    a.append(input())

b = []
for i in range(0, m):
    b.append(input())

def same(a, b, i, j):
    for k in range(0, len(b)):
        if a[i + k][j:j + len(b)] != b[k]:
            return False
    return True

is_same = False
for i in range(0, n - m + 1):
    for j in range(0, n - m + 1):
        if same(a, b, i, j):
            is_same = True
            break
    else:
        continue
    break

print("Yes" if is_same else "No")


Measured memory_bytes: 3064
def greatest_common_divisor(a, b):
  if a == 0 or b == 0:
    return max(a, b)

  return greatest_common_divisor(max(a, b) - min(a, b), min(a, b))

a, b = map(int, input().split())
print(greatest_common_divisor(a, b))

Measured memory_bytes: 7724
[N,D] = list(map(int,input().split()))

XY = []
for i in range(N):
    XY.append(list(map(int,input().split())))

cnt=0
for i in range(N):
    x = XY[i][0]
    y = XY[i][1]
    dis = (x**2 + y**2) ** (1/2)
    if dis <= D:
        cnt+=1

print(cnt)

Measured memory_bytes: 107656
#include <algorithm>
#include <bitset>
#include <complex>
#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 <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


int main() {
    int a,b,c,d;
    cin >>a >> b >> c >> d;
    int l = a + b;
    int r = c +d;
    if(l > r){
        cout << "Left" << endl;
    }else if(l < r){
        cout << "Right" << endl;
    }else{
        cout << "Balanced" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(void)
{
	int x = 0,f = 1; char ch = getchar();
	while(!isdigit(ch)){f = ch == '-' ? -1 : 1; ch = getchar();}
	while(isdigit(ch)){x = (x << 3) + (x << 1) + ch - '0'; ch = getchar();}
	return x * f;
}
signed main(signed argc, char *argv[])
{
	int n = read(), m = read();
	if (n == 1 && m == 1) printf("1\n");
 	else if (n == 1)
		printf("%lld\n",m-2);
	else if (m == 1) printf("%lld\n",n-2);
	else printf("%lld\n",n*m-(n+m)*2+4);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int a = sc.nextInt();

		n = n % 500;

		if(a>=n){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
	}
}



Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;

int main() {
	ll n,tmp;
	ll ans=0;
	cin >> n;
	vector<pair<ll, ll>> children;
	int front = 1, end = n;
	for (int i = 1;i <= n;i++) {
		cin >> tmp;
		children.push_back(make_pair(tmp, i));
	}
	sort(children.begin(), children.end(),greater<pair<ll,ll>>());
	ll **dp = new ll*[n];
	for (int i = 0;i < n;i++) {
		dp[i] = new ll[i + 2];
	}
	//dp[0]の構成
	dp[0][0] = children[0].first * (children[0].second-1);
	dp[0][1] = children[0].first * (n - children[0].second);
	for (int i = 1;i < n;i++) {
		dp[i][0] = dp[i - 1][0] + children[i].first * abs(children[i].second - i - 1);
		for (int j = 1;j <= i;j++) {
			dp[i][j] = max(dp[i - 1][j] + children[i].first * abs(children[i].second - (i - j) - 1), dp[i - 1][j - 1] + children[i].first * abs(n - j  + 1 - children[i].second));
		}
		dp[i][i + 1] = dp[i - 1][i] + children[i].first * abs(n - i - children[i].second);
	}

	for (int i = 0;i <= n;i++) {
		ans = max(ans, dp[n - 1][i]);
	}
	cout << ans << endl;
}

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

#define MOD_1_000_000_007 (1000000007LL)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep2(i, n)  for (long long i = 2; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)
#define repc2(n, i) for (long long i = (long long)(n); i >= 2; i--)

namespace solver {
  using namespace std;
  typedef long long ll;

  string S;

  void init() {
    cin >> S;
  }

  bool is_palindrome(string s) {
    string s2 = s;
    reverse(s2.begin(), s2.end());
    return s == s2;
  }

  void solve() {
    int n = S.size();
    int nn = (n-1)/2;
    if(is_palindrome(S) && is_palindrome(S.substr(0, nn)) && is_palindrome(S.substr((n+1)/2, nn))) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

int main() {
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7

def permutation(n, x, mod=10**9+7):
    # nPx 順列　ex) permutaion(5, 2) = 20
    tmp = 1
    for i in range(n, n-x, -1):
        tmp = (tmp * i) % mod
    return tmp

N, K = lr()
graph = [[] for _ in range(N+1)] # 1-indexed
for _ in range(N-1):
    a, b = lr()
    graph[a].append(b)
    graph[b].append(a)

answer = K # rootの色の塗り方
answer *= permutation(K-1, len(graph[1])) % MOD
root = 1
stack = []
for child in graph[1]:
    if len(graph[child]) > 1:
        stack.append((child, 1))
while stack:
    cur, p = stack.pop()
    l = len(graph[cur])
    if l > 1:
        answer *= permutation(K-2, len(graph[cur])-1) % MOD
    for child in graph[cur]:
        if child == p:
            continue
        if len(graph[child]) > 1:
            stack.append((child, cur))
    answer %= MOD

print(answer%MOD)
# 10


Measured memory_bytes: 37144
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ass 1e18
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;
#define debug2(x,y) cout<<#x<<": "<< x<< ", "<< #y<< ": "<< y<< endl;
#define debug3(x,y,z) cout<<#x<<": "<< x<< ", "<< #y<< ": "<< y<<" "<<#z<<" : "<<z<< endl;
using namespace std;
typedef long long int ll;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
ll arr[100005],weight[100005],dp[105][100005],n,w;

ll dfs(ll x,ll c)
{
	ll ans1,ans2;
	if(x==n)
		return 0;
	if(dp[x][c]!=-1)
		return dp[x][c];
	if(c+weight[x]>w)
	{
		dp[x][c]=dfs(x+1,c);
		return dp[x][c];
	}	
	ans1=arr[x]+dfs(x+1,c+weight[x]);
	ans2=dfs(x+1,c);
	dp[x][c]=max(ans1,ans2);
	return dp[x][c];
}

int main()
{
	boost
	cin>>n>>w;
	memset(dp,-1,sizeof(dp));
	for(ll i=0;i<n;i++)
		cin>>weight[i]>>arr[i];
	cout<<dfs(0,0);
	return 0;
}


Measured memory_bytes: 82304
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,T;
cin >> n >>T;
int t[n],c[n];
  int ans = 10000;
for(int i  = 0;i < n;i++){
  cin >> c[i] >> t[i];
  if(t[i] <= T){
    ans =min(c[i],ans);
  }
}
if(ans == 10000){cout << "TLE" <<endl;}
else{cout<< ans <<endl;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T, typename U, typename V>
ostream &operator<<(ostream &os, const tuple<T, U, V> &t){
  os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef tuple<int, int, int> TT;
typedef pair<int, TT> PT;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);

signed main(){
  int n;cin >> n;
  cout << (n/2)*((n+1)/2) << endl;
  return 0;
}






Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;

int main(void){
  long long a[3],m[3];
  while(cin>>a[0]>>m[0],a[0]+m[0]){
    for(int i = 1 ; i  < 3 ; i ++){
      cin>>a[i]>>m[i];
    }
    for(int i = 0 ; i < 3 ; i ++){
      long long co = 0,d = 1;
      while(true){
	co ++;
	d = (a[i] * d) % m[i];
	if(d==1)break;
      }
      a[i]=co;
    }
    long long d = a[1]*a[2]/__gcd(a[1],a[2]);
    cout<<d*a[0]/__gcd(a[0],d)<<endl;

  }
  for(int i = 1 ; i  < 3 ; i ++)cin>>a[i]>>m[i];
}

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

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		char[] input = br.readLine().toCharArray();
		StringBuffer sb = new StringBuffer();

		for (int i = 0; i < input.length; i++) {
			char target = input[i];
			if (Character.isUpperCase(target)) {
				sb.append(String.valueOf(target).toLowerCase());
			} else if (Character.isLowerCase(target)) {
				sb.append(String.valueOf(target).toUpperCase());
			} else {
				sb.append(String.valueOf(target));
			}
		}
		System.out.println(sb.toString());

	}
}

Measured memory_bytes: 24616
#include <stdio.h>

int main() {
  int a,b;
  scanf("%d %d\n", &a, &b);
  if (a - 1 >= b) {
    printf("%d\n", 2 * a - 1);
  } else if (b - 1 >= a) {
    printf("%d\n", 2 * b - 1);
  } else {
    printf("%d\n", a + b);
  }
  return 0;
}


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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


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

  for(int i=0;i<=n;i++) {
    for(int j=0;j<=m;j++) {
      if(i*m+j*n-2*i*j == k) {
        cout << "Yes\n";
        return 0;
      }
    }
  }

  cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
/**
 * Title: B - 1%
 * Url: https://atcoder.jp/contests/abc165/tasks/abc165_b
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
    ll x; cin >> x;
    ll yokin = 100;
    int cnt = 0;
    while(yokin<x) {
        yokin = floor((double)yokin*1.01);
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3744
import itertools, math

n = int(input())
x = [None] * n
y = [None] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

p = 0
q = 0
for tpl in itertools.permutations(range(n)):
    total = 0
    for i in range(n - 1):
        total += math.hypot(x[tpl[i]] - x[tpl[i + 1]], y[tpl[i]] - y[tpl[i + 1]])
    p += total
    q += 1
print(p / q)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include <vector>
using namespace std;
int main(){
	int N;
	cin>>N;
	vector<long long>a(N);
	vector<long long>b(N);
	vector< pair<int,int> >p(N);
	for(int i=0;i<N;i++){
		cin>>a[i]>>b[i];
		p[i]=make_pair(b[i],a[i]);
	}
	sort(p.begin(),p.end());
	
	long long sum=0;
	bool ans=true;
	for(int i=0;i<N;i++){
		sum+=p[i].second;
		if(p[i].first<sum){
			ans=false;
		}
	}
	
	if(ans)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


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

int main() {
	int x1, y1, x2, y2;
	scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
	printf("%d %d %d %d\n", x2 + y1 - y2, y2 + x2 - x1, x1 + y1 - y2, y1 + x2 - x1);
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b==c || b+c==a || c+a==b)cout <<"Yes" <<endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n, m = map(int, input().split())
ans = 0
if n >= 2:
    ans += cmb(n, 2)

if m >= 2:
    ans += cmb(m, 2)

print(ans)

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

int square(int n) {
    return n * n;
}

bool IsSquare(int n) {
    for(int i = sqrt(n) + 1;i * i >= n;i--) {
        if(i * i == n) {
            return true;
        }
    }
    return false;
}

int main() {
    int N,D;
    cin >> N >> D;
    vector<vector<int>> X(N,vector<int> (D));
    for(int i = 0;i < N;i++) {
        for(int j = 0;j < D;j++) {
            cin >> X.at(i).at(j);
        }
    }
    int count = 0;
    for(int i = 0;i < N;i++) {
        for(int j = i + 1;j < N;j++) {
            int sum = 0;
            for(int k = 0;k < D;k++) {
                sum += square(X.at(i).at(k) - X.at(j).at(k));
            }
            if(IsSquare(sum)) {
                count++;
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();

            while (true)
            {
                input = input.Substring(0, input.Length - 1);

                if ((input.Length) % 2 != 0) continue;

                string a = input.Substring(0,input.Length/2);
                string b = input.Substring(a.Length,a.Length);

                if (a.Equals(b)) break;
            }

            Console.WriteLine(input.Length);
        }
    }
}


Measured memory_bytes: 13140
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(intl i=0,nn=(intl)(n);i<nn;++i)
#define Rep1(i,n) for(intl i=1,nn=(intl)(n)+1;i<nn;++i)
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define SortA(v) sort(v.begin(), v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(intl ii=0,nn=(intl)(a.size());ii<nn;ii++){cin>>(a).at(ii);}
#define Input2(a,b) for(intl ii=0,nn=(intl)(a.size());ii<nn;ii++){cin>>(a).at(ii);cin>>(b).at(ii);}
#define mp make_pair
using intl = int64_t;
using vi = vec<intl>;
using vb = vec<bool>;
using vvi = vec<vi>;
using pi = pair<intl,intl>;
using vpi = vec<pi>;
using si = set<intl>;
using vsi = vec<si>;
using mii = map<intl,intl>;
using vmii = vec<mii>;
vec<intl> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<intl> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr intl INF = 9223372036854775807;



int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  
  intl N,M,K;
  
  cin >>N>>M>>K;
  
  si unoperated;
  Rep1(i,N){
    unoperated.emplace(i);
  }
  
  vvi friends(N+1);
  intl A,B;
  Rep(i,M){
    cin >>A>>B;
    friends[A].eb(B);
    friends[B].eb(A);
  }
  
  vi fnum(N+1);
  Rep1(i,N){
    fnum[i] = friends[i].size();
  }
  
  vi island(N+1,0);
  vi inum(N+1,0);
  intl n;
  intl j=0;
  while(!unoperated.empty()){
    ++j;
    n = *unoperated.begin();
    unoperated.erase(n);
    inum[n] = j;
    ++island[j];
    
    deque<int> next;
    next.eb(n);
    while(!next.empty()){
      n = next.front();
      next.pop_front();
      for(auto&& f :friends[n]){
        if(inum[f]==0){
          inum[f] = j;
          next.eb(f);
          ++island[j];
          unoperated.erase(f);
        }
      }
    }
    
  }
   
  
  vi bnum(N+1,0);
  intl C,D;
  Rep(i,K){
    cin >>C>>D;
    if(inum[C]==inum[D]){
      ++bnum[C];++bnum[D];
    }
  }
  
  Rep1(i,N){
    //cout <<inum[i]<<" "<< island[inum[i]] <<" "<< fnum[i] <<" "<<bnum[i]<<'\n';
    cout << island[inum[i]] - fnum[i] -bnum[i] -1<<' ';
  }
  
}
    
      

Measured memory_bytes: 20008
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<utility>
#include<queue>
#include<iostream>

using namespace std;
typedef long long ll;
int x,y;
int main(){
	scanf("%d%d",&x,&y);
	if(x % y == 0) puts("-1");
	else printf("%d\n",x);
	return 0;
}

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

int main() {
  //vector<int> b(101);
  //b.at(0)=1;
  int A, B, K;
  cin >> A >> B >> K;
  int i=min(A,B)+1;
  while (K > 0) {
    i--;
    if ((A % i==0) and (B % i ==0)) K--;
  }
  cout << i << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

typedef complex<double> Point, Vector;
typedef pair<Point, Point> Segment, Line;
typedef vector<Point> Polygon;
typedef pair<Point, double> Circle;

#define X real()
#define Y imag()
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

namespace std{
    bool operator<(const Point &a, const Point &b){
        return !equals(a.X, b.X) ? a.X < b.X : a.Y < b.Y;
    }
}

double dot(Vector a, Vector b){
    return a.X * b.X + a.Y * b.Y;
}

double cross(Vector a, Vector b){
    return a.X * b.Y - a.Y * b.X;
}

double norm(Vector a){
    return a.X * a.X + a.Y * a.Y;
}

double abs(Vector a){
    return sqrt(norm(a));
}

Point project(Segment s, Point p){
    Vector base = s.second - s.first;
    double r = dot(p - s.first, base) / norm(base);
    return s.first + base * r;
}

double getDistanceLP(Line l, Point p){
    return abs(cross(l.second - l.first, p - l.first) / abs(l.first - l.second));
}

pair<Point, Point> getCrossPoints(Circle c, Line l){
    Vector pr = project(l, c.first);
    Vector e = (l.second - l.first) / abs(l.second - l.first);

    if(equals(getDistanceLP(l, c.first), c.second)){
        return make_pair(pr, pr);
    }

    double base = sqrt(c.second * c.second - norm(pr - c.first));
    return make_pair(pr + e * base, pr - e * base);
}

vector<Line> tangent(Circle c1, Circle c2){
    vector<Line> l1;
    if(c1.second < c2.second) swap(c1, c2);
    double g = norm(c1.first - c2.first);
    if(equals(g, 0)) return l1;
    Point u = (c2.first - c1.first) / sqrt(g);
    Point v = {-u.Y, u.X};

    for(int i=1; i>=-1; i-=2){
        double h = (c1.second + i * c2.second) / sqrt(g);

        if(equals(1 - h * h, 0)){
            l1.emplace_back(c1.first + u * c1.second, c1.first + (u + v) * c1.second);
        }
        else if(1 - h * h > EPS){
            Point uu = u * h;
            Point vv = v * sqrt(1 - h * h);
            l1.emplace_back(c1.first + (uu + vv) * c1.second, c2.first - (uu + vv) * c2.second * Point(i, i));
            l1.emplace_back(c1.first + (uu - vv) * c1.second, c2.first - (uu - vv) * c2.second * Point(i, i));
        }
    }

    return l1;
}

int main(){
    double c1x, c1y, c1r; cin>>c1x>>c1y>>c1r;
    double c2x, c2y, c2r; cin>>c2x>>c2y>>c2r;

    Circle c1 = {Point(c1x, c1y), c1r};
    Circle c2 = {Point(c2x, c2y), c2r};

    vector<Line> l1 = tangent(c1, c2);

    Polygon pol;
    for(auto i : l1){
        pol.emplace_back(getCrossPoints(c1, i).first);
    }

    sort(pol.begin(), pol.end());

    for(auto i : pol){
        printf("%.10f %.10f\n", i.X, i.Y);
    }
}


Measured memory_bytes: 3292
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

bool isPrime(int n){
  if(n <= 1) return false;
  if(n == 2) return true;
  if(n % 2 == 0) return false;
  for(ll i = 3; i*i <= n; i += 2){
    if(n % i == 0) return false;
  }
  return true;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  int ans = 0;
  REP(i, n){
    int a; cin >> a;
    if(isPrime(a)) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3128
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()
ans = 0
w_cnt = 0
for i in range(len(s)):
    if s[i] == "W":
        ans += i - w_cnt  # その W の場所までにあった B の数
        w_cnt += 1

print(ans)


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



int getMax(vector<int>&ar, vector<int>&dp,  int n){
	if(n==1)return 0;
	int a1=INT_MAX, a2=INT_MAX;
	if(dp[n] != -1)
		return dp[n];
	if(n>1)
		a1 = getMax(ar, dp, n-1) + abs(ar[n]-ar[n-1]);
	if(n>2)
		a2 = getMax(ar, dp, n-2) + abs(ar[n]-ar[n-2]);
	dp[n]=min(a1,a2);
	return dp[n];
}

int main(){
#ifndef ONLING_JUDGE
//	freopen("input.txt","r",stdin);
#endif
	     int n;
	     cin >> n;
	     vector<int>arr(n+1);
	     for(int i=1;i<=n;i++)cin >> arr[i];
	     vector<int>dp(n+1,-1);
	     int ans =  getMax(arr, dp, arr.size()-1);
		cout << ans << endl;
	
	return 0;
}


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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if(a + b > c + d) cout << "Left" << endl;
  else if(a + b == c + d) cout << "Balanced" << endl;
  else cout << "Right" << endl;
  
  return 0;
}

Measured memory_bytes: 764
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//String tmp = sc.next();
		//int tmp = sc.nextInt();
		//Long tmp = sc.nextLong();
      int N = sc.nextInt();
      int M = sc.nextInt();
      Set<Integer> oneList = new HashSet<>();
      Set<Integer> NList = new HashSet<>();
      for(int i = 0; i < M; i++){
        int mae = sc.nextInt();
        int ato = sc.nextInt();
        if(mae == 1){
          oneList.add(ato);
        }
        if(ato == N){
          NList.add(mae);
        }
      }
      if(oneList.isEmpty() || NList.isEmpty()){
        System.out.println("IMPOSSIBLE");
        return;
      }
      for(int i = 2; i < N; i++){
        if(oneList.contains(i) && NList.contains(i)){
          System.out.println("POSSIBLE");
          return;
        }
      }
      System.out.println("IMPOSSIBLE");
	}
}


Measured memory_bytes: 108048