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

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] ABC = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            for(int i = 0; i < ABC.Length;i++){
                if(ABC.Count(x=>x==ABC[i])==1){
                    Console.WriteLine(ABC[i]);
                }
            }
        }
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int N = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] s = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
        
        // //最小公倍数
        // static long Lcm(long a, long b)
        // {
        //     return a/Gcd(a,b)*b;
        // }

        // //最大公約数
        // static long Gcd(long m, long n)
        // {
        //     if(n==0)return m;
        //     return Gcd(n,m%n);
        // }
    }
}

Measured memory_bytes: 11220
S=input()
N=len(S)+1

A=[0]*N
B=[0]*N

for k in range(N-1):
    if S[k]=="<":
        A[k+1]=A[k]+1

for k in range((N-1)-1,-1,-1):
    if S[k]==">":
        B[k]=B[k+1]+1
        
print(sum(map(lambda x:max(A[x],B[x]),range(N))))


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

int main() {
  int A,B,number=0;
  cin >> A >> B;
  for (int i=A; i<=B; i++) {
    int man = i/10000;
    int sen = (i%10000)/1000;
    int hyaku = (i%10000)%1000/100;
    int juu = (i%10000)%1000%100/10;
    int iti = (i%10000)%1000%100%10;
    if (man == iti) {
      if (sen == juu) {
        number++;
      }
      else
        continue;
    }
    else
      continue;
  }
  cout << number << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
using namespace std;
int main() {
	string s, t;
	cin >> s >> t;
	if (t.substr(0, s.size()) == s) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
using namespace std;

int main() {
	int x, y, z;
	cin >> x >> y >> z;
	int res = 0;
	for (int i = y + 2 * z; i <= x; i += y + z) {
		res++;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define sqr(x) (x) * (x)
#define cube(x) (z) * (z) * (x)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define itn int

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

template <class T = int>
int in() {
  T x;
  cin >> x;
  return x;
}

signed main() {
  int N, M;
  cin >> N >> M;
  int sum = 0;
  rep(i, M) {
    int temp = in();
    sum += temp;
  }
  if (sum > N) {
    cout << -1 << endl;
  } else {
    cout << N - sum << endl;
  }
}


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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    vector<ll> A(a),B(b),C(c);
    for(auto & t: A) cin>>t;
    for(auto & t : B)cin>>t;
    for(auto & t: C) cin>>t;
    sort(A.rbegin(),A.rend());
    sort(B.rbegin(),B.rend());
    vector<ll> ret;
    for(int i=0;i<x;++i)ret.push_back(A[i]);
    for(int i=0;i<y;++i)ret.push_back(B[i]);
    for(auto t : C){
        ret.push_back(t);
    }
    sort(ret.rbegin(),ret.rend());
    ll r = 0;
    for(int i=0;i<x+y;++i){
        r += ret[i];
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 8816
#include <stdio.h>

int main() {
  int N;
  scanf("%d", &N);

  int colors[9] = {};
  for (int i = 0; i < N; i++) {
    int tmp;
    scanf("%d", &tmp);
    int color = tmp / 400;
    if (color > 8) color = 8;
    colors[color]++;
  }

  int nmin = 0;
  for (int i = 0; i <= 7; i++) {
    if (colors[i] > 0) nmin++;
  }

  int nmax = nmin + colors[8];
  if (nmin == 0 && colors[8] > 0) nmin = 1;
  
  printf("%d %d\n", nmin, nmax);

  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <queue>
#include <set>
#include <cassert>
using namespace std;
using ll = long long;
using plong = pair<ll,ll>;
ll MOD=998244353;

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


int main(){
    ll N,K;cin>>N>>K;
    ll a = N%K;
    ll res=min(abs(a),abs(a-K));
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  if(-1000<=a && b<=1000){
      if(a<b){
        printf("a < b\n");
      }
      if(a>b){
        printf("a > b\n");
      }
      if(a==b){
        printf("a == b\n");
      }
  }
  return 0;
}

Measured memory_bytes: 580
from collections import defaultdict


def dfs(s, t):
    visited = 0
    q = [(s, 0)]
    while q:
        v, used = q.pop()
        if v == t:
            return used
        visited |= used
        for lb, u in graph[v]:
            if lb & visited:
                continue
            q.append((u, used | lb))


n = int(input())
graph = [[] for _ in range(n + 1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    lb = 1 << i
    graph[a].append((lb, b))
    graph[b].append((lb, a))

conditions = []
m = int(input())
for i in range(m):
    u, v = map(int, input().split())
    conditions.append(dfs(u, v))

link_conditions = [int(''.join(b), 2) for b in zip(*map(('{:0' + str(n - 1) + 'b}').format, conditions))]

dp = defaultdict(int)
dp[0] = 1
for lc in link_conditions:
    for fulfilled, pattern in list(dp.items()):
        dp[fulfilled | lc] += pattern
print(dp[(1 << m) - 1])


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

int main(){
	
	int i,j,n,x,countA=0,countB=0;
	char TARO[100],HANAKO[100];
	
	scanf("%d",&n);	
	
	for(i=0;i<n;i++){
		scanf("%s%s",TARO,HANAKO);
		x = strcmp(TARO,HANAKO);
		if(x==0){
			countA++;
			countB++;
		}else if(x<0){
			countB+=3;
		}else if(x>0){
			countA+=3;
		}
	}
	printf("%d %d\n",countA,countB);
	return 0;
}

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

void solve() {
    int a, b;
    std::cin >> a >> b;
    std::string sa = std::string(b, '0' + a),
                sb = std::string(a, '0' + b);
    std::cout << std::min(sa, sb) << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#define maxn 200005
#define mod 1000000007
#define INF 1e16
#define Pair PII
#define MP PII
#define fi first
#define se second
#define N n
using namespace std;
typedef pair<int,int> PII;
int n,ans,date[maxn],l[maxn],r[maxn],f[maxn],s[maxn];
double t[maxn];
PII q[maxn];
struct node { int x,v,i,l,r; } a[maxn];
bool cmp(node p,node q) { return p.v>q.v; }
bool cmp2(node p,node q)
{
	if(p.r!=q.r) return p.r<q.r;
	return p.l<q.l;
}
void getl()
{
	int cnt=0;
	for(int i=1;i<=n;i++) q[++cnt]=PII(a[i].x,a[i].i);
	sort(q+1,q+cnt+1);
	for(int i=1;i<=n;i++)
		while(cnt)
		{
			if(a[i].x>q[cnt].first) break;
			l[q[cnt--].second]=i;
		}
}
void getr()
{
	int cnt=0;
	for(int i=1;i<=n;i++) q[++cnt]=PII(a[i].x,a[i].i);
	sort(q+1,q+cnt+1);
	reverse(q+1,q+cnt+1);
	for(int i=n;i;i--)
		while(cnt)
		{
			if(a[i].x<q[cnt].first) break;
			r[q[cnt--].second]=i;
		}
}
int dp()
{
	for(int i=1;i<=n;i++) a[i].l=n-r[i]+1,a[i].r=n-l[i]+1;
	sort(a+1,a+n+1,cmp2);
	int ans=0;
	for(int i=1,j=1;i<=n;i++)
	{
		while(a[j].r<a[i].l-1) j++;
		f[i]=(s[i-1]-s[j-1]+mod)%mod;
		if(a[i].l==1) f[i]++;
		if(a[i].r==n) ans=(ans+f[i])%mod;
		s[i]=(s[i-1]+f[i])%mod;
	}
	return ans;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) 
	{
		scanf("%d%d",&a[i].x,&a[i].v);
		a[i].i=i,date[i]=a[i].v;
	}
	sort(date+1,date+n+1);
	int c=unique(date+1,date+n+1)-date-1;
	for(int i=1;i<=n;i++) a[i].v=lower_bound(date+1,date+c+1,a[i].v)-date;
	sort(a+1,a+n+1,cmp);
	getl(); getr();
	printf("%d\n",dp());
}

Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> a(N);
	for (auto &x : a) {
		cin >> x;
	}
	auto s = accumulate(a.begin(), a.end(), 0);
	
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (abs(a[i] * N - s) < abs(a[ans] * N - s)) {
			ans = i;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_ll.hpp>
//using boost::multiprecision::cpp_ll; // use cpp_ll as data type for large numbers 
using namespace std;

#define int ll
#define ll long long
#define pb push_back
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL); 
#define mod 1000000007
#define mp make_pair
#define ff first
#define ss second
#define vi vector<ll>
#define vll vector<long long>
#define log2(X) (63ll - __builtin_clzll(X))
#define test ll t; cin>>t; while(t--)
#define modInv(n) po(n,mod-2)%mod
#define ncr(n,r) (((fact[n]*modInv(fact[r]))%mod)*modInv(fact[n-r]))%mod

ll po(ll a, ll b)
{
    ll res=1;
    while(b)
    {
        if(b&1)
        {
            res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return res%mod;
}

vll adj[100005+5];
int visited[100005];
ll n,m;
ll ans[100005];
int c;
int dfs(int i)
{
    if(visited[i]) return ans[i];
    
    int c=0;
    visited[i]=1;
    for(auto v: adj[i])
    {
        
        c=max(c,dfs(v)+1);
    }
    return ans[i]=c;
}

signed main() 
{
    fast()
    //test
    {
        cin>>n>>m;
        while(m--)
        {
            ll u,v;
            cin>>u>>v;
            adj[u].pb(v);
            //adj[v].pb(u);
        }
        /*for(int i=1; i<=n; i++)
        {
            c=0;
            int res=dfs(i);
            ans[i]=res;
            memset(visited,0,sizeof(visited));
        }*/
        ll ass=INT_MIN;
        for(int i=1;i<=n; i++)  ass=max(ass,dfs(i));
        
        cout<<ass<<"\n";
    }   
}


Measured memory_bytes: 12588
//
//  main.cpp
//  1
//
//  Created by RISHAV SINGH MEHTA on 10/01/20.
//  Copyright © 2020 RISHAV SINGH MEHTA. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(int argc, const char * argv[]) {
    // insert code here...
    ll int i,j,k,l,M,T,K;
    cin>>K>>M;
    i=K*500;
    if (M <= i) {
        cout<<"Yes";

    }else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;


int main() {
    int x, y; cin >> x >> y;
    int ans = 0;
    for (int i = x; i <= 3; i++) {
        ans+=100000;
    }
    for (int i = y; i <= 3; i++) {
        ans += 100000;
    }
    if (x == 1 && y == 1) {
        ans+=400000;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque
def main():
    N = int(input())
    edge = [[] for _ in range(N)]
    for _ in range(N-1):
        u, v, w = map(int, input().split())
        edge[u-1].append([u-1, v-1, w])
        edge[v-1].append([v-1, u-1, w])
    
    
    c = [-1 for _ in range(N)]
    c[0] = 0
    que = deque(edge[0])
    while que:
        f, t, w = que.pop()
        if w%2 == 0:
            c[t] = c[f]
        else:
            c[t] = abs(1 - c[f])
        
        directions = edge[t]
        for d in directions:
            if c[d[1]] == -1:
                que.append(d)
            else:
                continue
    for ans in c:
        print(ans)
main()

Measured memory_bytes: 51736
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException{
		NotFound solver = new NotFound();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class NotFound {
		private String s;
		private String output;
		private Scanner scanner;
		public NotFound() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			s = scanner.next();
		}

		public void solve() {
			boolean set[] = new boolean[26];
			for(char c:s.toCharArray()) {
				set[c- 'a'] = true;
			}
			for(int i=0; i<26; i++) {
				if(!set[i]) {
					output = String.valueOf((char)(i+'a'));
					return;
				}
			}
			output = "None";
		}

		public void writeOutput() {
			System.out.println(output);
		}
	}
}


Measured memory_bytes: 25556
import fractions

A, B, C, D = map(int, input().split())
lcm = C * D // fractions.gcd(C, D)

num = B - A + 1


# e = num // lcm

if A % C == 0:
    first_c = A
else:
    first_c = A + (C - A % C)
if A % D == 0:
    first_d = A
else:
    first_d = A + (D - A % D)
if A % lcm == 0:
    first_e = A
else:
    first_e = A + (lcm - A % lcm)

c = (B - first_c) // C + 1
d = (B - first_d) // D + 1
e = (B - first_e) // lcm + 1

print(num - c - d + e)


Measured memory_bytes: 5048
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		
		int n = Integer.parseInt(scanner.nextLine());
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		scanner.close();
		
		int q = partition(a, 0, n - 1);
		for (int i = 0; i < q; i++) {
			sb.append(a[i] + " ");
		}
		sb.append("[");
		sb.append(a[q]);
		sb.append("] ");
		for (int i = q + 1; i < n - 1; i++) {
			sb.append(a[i] + " ");
		}
		sb.append(a[n - 1]);
		System.out.println(sb);
	}

	static int partition(int[] a, int p, int r) {
		int x = a[r];
		int i = p - 1;
		int tmp;
		for (int j = p; j < r; j++) {
			if (a[j] <= x) {
				i = i + 1;
				tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
		tmp = a[i + 1];
		a[i + 1] = a[r];
		a[r] = tmp;
		return i + 1;
	}
}

Measured memory_bytes: 68500
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int t, n, m, k, a[300010], q, l, r;


int32_t main(){
INIT
cin>>n;
for(int i=1; i<=n; i++){
    cin>>a[i];
}
sort(a+1, a+1+n);
int cnt=0;
for(int i=1; i<=(n-2); i++){
    for(int j=i+1; j<=(n-1); j++){
        for(int k=j+1; k<=n; k++){
            if( ((a[i]+a[j])>a[k]) && (a[i]!=a[j])&& (a[j]!=a[k]) ){
                cnt++;
            }
        }
    }
}
cout<<cnt;
return 0;
}





Measured memory_bytes: 3664
<?php
$num = trim(fgets(STDIN));
$sum = 0;

$s = trim(fgets(STDIN));
$s = str_replace(array("\r\n","\r","\n"), '', $s);
$s = explode(" ", $s);

rsort($s);

for ($i = 0; $i < $num; $i++) {
	if ($i % 2 == 0) {
    	$sum += $s[$i];
    } else {
    	$sum -= $s[$i];
    }
}

echo $sum;
?>

Measured memory_bytes: 3576
#include<iostream>
#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
int main(){
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b && b==c)
  { cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] arsg){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] l = new int[N];
        int ans = 0;
        int c = l[0];
        for(int i = 0;i < N;i++){
            l[i] = sc.nextInt();
        }
        
        for(int i = 0;i < N;i++){
            if(c <= l[i]){
                ans += 1;
                c = l[i];
            }
        }

       System.out.println(ans);
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;

ll maisus[51];
ll pmaisu[51];


ll func(int n, ll x)
{
    if (n==0) return 1;
    if (x==0) return 0;
    if (x<=maisus[n-1])
    {
        return func(n-1, x-1);
    }
    else if (x == maisus[n-1]+1)
    {
        return pmaisu[n-1]+1;
    }
    else
    {
        // cout <<"n: " << n<< endl;
        // cout <<"x: " << x<< endl;

        return pmaisu[n-1]+1+func(n-1, x-maisus[n-1]-2);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    maisus[0] = 1;
    REP(i,1,51)
    {
        maisus[i] = maisus[i-1] * 2 + 3;
    }
    pmaisu[0] = 1;
    REP(i,1,51)
    {
        pmaisu[i] = 2 * pmaisu[i-1] + 1;
    }
    int n;
    ll x;
    cin >> n >> x;

    ll ans = func(n,x-1);
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections;

class Program {
  static int INFTY = 1000000;

  static void Main(string[] args) {
    int N, M;
    int[,] cost;
    ArrayList pathchk;
    Stack[] pathstk; // Path of i to j, cannot pass directly
    string[] str = Console.ReadLine().Split(' ');
    N = int.Parse(str[0]);
    M = int.Parse(str[1]);
    cost = new int[N,N];
    pathchk = new ArrayList(N);
    pathstk = new Stack[N*N];

    for(int i = 0; i < N; ++i) {
      cost[i,i] = 0;
      pathstk[i*N] = new Stack();
      for(int j = i+1; j < N; ++j) {
        cost[i,j] = cost[j,i] = INFTY;
        pathstk[i*N+j] = new Stack();
      }
    }

    for(int k = 0; k < M; ++k) {
      int i, j;
      str = Console.ReadLine().Split(' ');
      i = int.Parse(str[0]) - 1;
      j = int.Parse(str[1]) - 1;
      cost[i,j] = cost[j,i] = int.Parse(str[2]);
      pathchk.Add( Position2DTurn(i, j, N) );
    }

    for(int k = 0; k < N; ++k) {
      for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
          int wc = cost[i,k] + cost[k,j];
          if(wc < cost[i,j]) {
            if(pathstk[Position2DTurn(i, j, N)].Count == 0) {
              pathstk[Position2DTurn(i, j, N)].Push(Position2DTurn(i, k, N));
            }
            cost[i,j] = wc;
            pathstk[Position2DTurn(i, j, N)].Push(Position2DTurn(k, j, N));
          }
        }
      }
    }

    for(int i = 0; i < N; ++i) {
      for(int j = i+1; j < N; ++j) {
        if(pathstk[i*N+j].Count == 0) {
          pathchk.Remove(i * N + j);
          // Console.WriteLine("Removed ({0}, {1})", i+1, j+1);
        } else {
          while(pathstk[i*N+j].Count == 0) {
            pathchk.Remove(pathstk[i*N+j].Pop());
            // Console.WriteLine("Removed from stack");
          }
        }
      }
    }

    Console.WriteLine(pathchk.Count);
  }

  static int Position2DTurn(int i, int j, int c) {
    return i < j ? i * c + j : j * c + i;
  }
}


Measured memory_bytes: 13296
def main():
    n = int(input())
    dp = [None]*(n+1)
    dp[0] = 0
    dp[1] = 1
    nl = list(sorted([6**i for i in range(10) if (6**i)<=n]+[9**i for i in range(1, 10) if (9**i)<=n]))
    for i in range(2, n+1):
        d = 10**15
        for j in nl:
            if j > i:
                break
            d = min(d, 1+dp[i-j])
        dp[i] = d
    print(dp[n])

if __name__ == "__main__":
    main()

Measured memory_bytes: 40944
#include<iostream>
using namespace std;
int main(){
  int n,i,j,ans =0;
  cin >> n;
  for(i=1;i<=n;i=i+2){
 int count=0;
    for(j=1;j<=i;j++){
      if(i%j==0){
        count++;
      }
    }
    if(count==8){
      ans++;
    }
  }
  cout << ans << endl;
}

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

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

    int n;
    cin >> n;
    int a;
    cin >> a;
    vector<int> x(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }

    const int MAX_N = 50;
    const int MAX_A = 50;
    const int MAX_SUM = MAX_A * MAX_N;

    vector<vector<long long>> dp[2];
    int curPtr = 0;
    dp[curPtr].assign(MAX_N + 1, vector<long long>(MAX_SUM + 1, 0));
    dp[curPtr][0][0] = 1;
    for (int i = 0; i < n; ++i) {
        int nxtPtr = 1 - curPtr;
        dp[nxtPtr] = dp[curPtr];

        for (int c = 0; c < n; ++c) {
            for (int s = 0; s <= (n - 1) * MAX_A; ++s) {
                dp[nxtPtr][c + 1][s + x[i]] += dp[curPtr][c][s];
            }
        }

        swap(curPtr, nxtPtr);
    }

    long long result = 0;
    for (int i = 1; i <= n; ++i) {
        result += dp[curPtr][i][a * i];
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
	fast;
	lli n,i,sum=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		if(i%3!=0&&i%5!=0)
			sum+=i;
	}
	cout<<sum;
	
	return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

const int MAX = 100;

int main(){
    long long X,K,D;
    long long ans = 0;
    int sign = 0;

    cin >> X >> K >> D;

    X = abs(X);

    if(X > D){
        long long x = X / D;

        if(x < K){
            if((K - x) % 2)x++;
            ans = X - D * x;
        }else{
            ans = X - D * K;
        }
    }else{
        if(K % 2)ans = X - D;
        else ans = X;
    }

    cout << abs(ans) << endl;

    return 0;
}

Measured memory_bytes: 3160
n,m,l=map(int,input().split())

a=[list(map(int,input().split())) for i in range(n)]
b=[list(map(int,input().split())) for i in range(m)]  
c=[[0]*l for i in range(n)]
    
for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j]+=a[i][k]*b[k][j]
    print(*c[i])


Measured memory_bytes: 7032
s = input()

def check(s):
    flag = True
    for i in range(len(s)):
        if s[i] != s[-i-1]:
            flag = False
    return flag

s1 = s[:(len(s)-1)//2]
s2 = s[(len(s)+3)//2-1:]
# print(s1)
# print(s2)

if check(s) and check(s1) and check(s2):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import math
N=list(map(int,input().split()))



if N[2]<=N[0]**2*N[1]/2:   
 a=N[1]
 b=N[2]/N[0]/N[1]*2
 print(90-math.degrees(math.atan(b/a)))
else: 
 c=N[0]**2*N[1]-N[2]
 a=N[1]
 b=c/N[0]/N[0]*2

 print(math.degrees(math.atan(b/N[0])))
 

Measured memory_bytes: 3060
import sys
import math
input = lambda: sys.stdin.readline()
exec("try:sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w')\nexcept:pass")

length = lambda x: len(str(int(x)))

n = int(input())
ans = []
for i in range(1, int(math.sqrt(n)) + 1):
    if n % i == 0:
        if n // i == i:
            ans.append(length(n // i))
        else:
            ans.append(max(length(i), length(n // i)))
print(min(ans))


Measured memory_bytes: 9200
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        a: i64,
        b: i64,
    }
    println!("{}", max(a+b, max(a-b, a*b)));
}


Measured memory_bytes: 4352
import collections
n = int(input())
v = [int(i) for i in input().split()]

dummy = [(-1, 0)]
(av1, ak1), (av2, ak2) = (collections.Counter(v[::2]).most_common(2) + dummy)[:2]
(bv1, bk1), (bv2, bk2) = (collections.Counter(v[1::2]).most_common(2) + dummy)[:2]

if av1 != bv1:
    print(n-ak1-bk1)
elif ak1 < bk1:
    print(n-ak2-bk1)
elif ak1 > bk1:
    print(n-ak1-bk2)
elif ak1+bk2 > bk1+ak2:
    print(n-ak1-bk2)
else:
    print(n-ak2-bk1)

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
string S;
ll dp[4040][8];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	dp[0][0]=1;
	
	cin>>N>>S;
	
	FORR(c,S) {
		if(c=='R') c=0;
		if(c=='G') c=1;
		if(c=='B') c=2;
	}
	
	FOR(i,N) {
		FOR(j,8) {
			dp[i+1][j]+=dp[i][j];
			if((j&(1<<S[i]))==0) dp[i+1][j|(1<<S[i])]+=dp[i][j];
		}
	}
	ll ret=dp[N][7];
	FOR(i,N) {
		for(j=1;j<=N;j++) {
			x=i-j;
			y=i+j;
			if(x<0 || y>=N) break;
			if(S[i]!=S[x]&&S[i]!=S[y]&&S[x]!=S[y]) ret--;
		}
	}
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 3760
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

class SegmentTree
{
private:
	const long long inf = 1e18;
	int n;
	vector<long long> dat;
public:
	SegmentTree(int n_) {
		n = 1;
		while (n < n_) {
			n *= 2;
		}

		dat.assign(n * 2 - 1, inf);
	};
	~SegmentTree() {
		dat.clear();
	};

	void update(int k, int a) {
		k += n - 1;
		dat[k] = a;
		while (k > 0) {
			k = (k - 1) / 2;
			dat[k] = min(dat[k*2 + 1], dat[k*2 + 2]);
		}
	}

	long long query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) {
			return inf;
		}

		if (a <= l && r <= b) {
			return dat[k];
		} else {
			long long vl = query(a, b, k*2 + 1, l, (l+r)/2);
			long long vr = query(a, b, k*2 + 2, (l+r)/2, r);
			return min(vl, vr);
		}
	}

	int size() {
		return n;
	}

	void show() {
		int i = 0;
		for (auto e: dat) {
			printf("%3d: %6lld\n", i, e);
			i++;
		}
	}
};

int main() {
	int n, t;

	cin >> n >> t;
	vector<int> a(n);
	SegmentTree st(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		st.update(i, a[i]);

	}

	int max_diff = 0;
	int count = 0;


	for (int i = 0; i < n; i++) {
		int val = a[i] - st.query(0, i+1, 0, 0, st.size());
// printf("i %d a %d query %d\n", i, a[i], st.query(0, i+1, 0, 0, st.size()));
		if (val == max_diff) {
// printf("add\n");
			count++;
		} else if (val > max_diff) {
			max_diff = val;
			count = 1;
// printf("new %d\n", max_diff);
		}
		// printf("a[%2d] %4d, val %4d\n", i, a[i], val);
	}

	cout << count << endl;
	return 0;
}


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

const int MAX = 1000;
int h, w, tt[MAX][MAX];
queue<P> q;

void check(int r, int c){
    auto f = [&](int i, int j){
        if(i < 0 || h <= i) return;
        if(j < 0 || w <= j) return;
        if(tt[i][j] >= 0) return;
        q.push(P(i,j));
        tt[i][j] = tt[r][c] + 1;
        return;
    };
    f(r+1, c); f(r-1, c);
    f(r, c+1); f(r, c-1);
    return;
}

int main(){
    cin >> h >> w;
    rep(i, h) rep(j, w){
        tt[i][j] = -1;
        char ch;
        scanf(" %c", &ch);
        if(ch == '#'){
            q.push(P(i, j));
            tt[i][j] = 0;
        }
    }
    int ans = 0;
    while(!q.empty()){
        int r = q.front().first;
        int c = q.front().second;
        q.pop();
        ans = tt[r][c];
        check(r, c);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12304
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
using namespace std;


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

  vector<vector<int>> to(n); //edge nのグラフ
  for(int i=0; i<m; i++){
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  
  vector<int> find(n, 1); // きたら0
  int ans = 0;
  
  queue<int> q;
  
  for (int j=0; j<n; j++) {
    if(find[j]==1) {
      ans++;
      find[j] = 0;
      q.push(j);
    }
    
    while(!q.empty()) {
      int x = q.front(); // 先頭要素の参照
      q.pop(); // 先頭要素の削除
      for(int i=0; i<to[x].size(); i++) { // edge v につながっている辺i=0, 1, ...を見る
        int y = to[x][i]; //つながっている先のedge
        if(find[y]==1) {
          find[y] = 0;
          q.push(y); // 着目先に追加
        }
      }
    }

  }
  
  cout << ans << endl;
}

Measured memory_bytes: 6904
import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		while (sc.hasNext()) {
			double x = sc.nextDouble();
			double h = sc.nextDouble();
			if (x==0) {break;}
			double area = x*x;
			area += 4*Math.sqrt(Math.pow(x/2,2)+Math.pow(h,2))*x/2;
			out.println(area);
		}
	}
}


Measured memory_bytes: 28192
#include<stdio.h>
#include<stdbool.h>
#define N 8
#define free -1
#define nfree 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];

bool X[N][N];

void initialize(){
  int i;
  for(i=0;i<N;i++){
    row[i] = free;
    col[i] = free;
  }

  for(i=0;i<2*N-1;i++){
    dpos[i] = free;
    dneg[i] = free;
  }
}

void PrintBoard(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(X[i][j]){
        if(row[i] != j)return;
      }
    }
  }

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i] == j)printf("Q" );
      else printf(".");
    }
    printf("\n" );
  }
}

void recursive(int i){
  if(i==N){
    PrintBoard();
    return;
  }

  for(int j =0;j<N;j++){
    if(nfree == col[j] ||
       nfree == dpos[i+j] ||
       nfree == dneg[i-j+N-1])continue;
       row[i] = j;
       col[j] = dpos[i+j] = dneg[i - j + N -1] = nfree;
       recursive(i+1);
       col[j] = dpos[i+j] = dneg[i - j + N -1] = free;
   }
}


int main(){
  initialize();

  for(int i = 0;i<N;i++){
    for(int j = 0;j < N;j++){
      X[i][j] = false;
    }
  }

  int k,r,c;
  scanf("%d",&k);

  for(int i;i<k;i++){
    scanf("%d%d",&r,&c);
    X[r][c] = true;
  }
  recursive(0);

  return 0;
}



Measured memory_bytes: 2108
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			int[] dict = new int[26];
			while(sc.hasNextLine()) {
				String line = sc.nextLine().toLowerCase(); // 小文字に変換
				for(int i = 0; i < line.length(); i++) {
					char c = line.charAt(i);
					if(Character.isAlphabetic(c)) {
						dict[c - 'a']++;
					}
				}
			}
			for(int i = 0; i < dict.length; i++) {
				System.out.println((char)('a' + i) + " : " + dict[i]);
			}
		}
	}


}



Measured memory_bytes: 25920
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int d;
    cin>>d;
    vector<int>c(26),t(d),nod(26);
    rep(j,26)cin>>c[j];
    vector<vector<int>>s(d,vector<int>(26));
    rep(i,d)rep(j,26)cin>>s[i][j];
    //rep(i,d)cin>>t[i];
    int pt=0,mx,tx;
    rep(i,d){
        mx=-1000000;
        rep(j,26){
            tx=max(s[i][j],nod[j]*c[j]*10);
            if(tx>mx){
                mx=tx;
                t[i]=j+1;
            }
        }
        
        rep(j,26){
            if(t[i]-1==j){
                pt+=s[i][j];
                nod[j]=0;
            }
            else{
                nod[j]++;
                pt-=c[j]*nod[j];
            }
        }
        //cout<<pt<<endl;
        
    }
    rep(i,d)cout<<t[i]<<endl;
	return 0;
}


Measured memory_bytes: 3672
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String p = sc.nextLine();
        String s = sc.nextLine();
        sc.close();

        String nP = p + p;
        if(nP.contains(s)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}



Measured memory_bytes: 26340
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  if(n == m) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    while(ans < c && b >= a){
        ans++;
        b -= a;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def p(n):
    l = [1]*(n+1)
    l[0] = l[1] = 0
    for i in range(2,int(n ** 0.5) + 1):
        if l[i]:
            for j in range(2*i, n+1, i):
                l[j] = 0
    return l
n = input()
ans = n
l = set()
from itertools import compress
P = p(int(n ** 0.5))
for i in compress(xrange(0,n), P):
    while n % i == 0:
        n /= i
        l.add(i)
if n != 1: l.add(n)
for i in l:
    ans = ans * (i - 1) / i
print ans

Measured memory_bytes: 7308
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> anys;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(anys{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int A, B, M;
	cin >> A >> B >> M;
	vector<int> a(A), b(B), x(M), y(M), c(M);
	for(int i=0; i<A; i++) cin >> a[i];
	for(int i=0; i<B; i++) cin >> b[i];
	for(int i=0; i<M; i++) cin >> x[i] >> y[i] >> c[i];

	int min_a = a[0];
	for(int i=0; i<A; i++) min_a = min(min_a, a[i]);
	int min_b = b[0];
	for(int i=0; i<B; i++) min_b = min(min_b, b[i]);

	int min_m = a[x[0]-1]+b[y[0]-1]-c[0];
	for(int i=0; i<M; i++) min_m = min(min_m, a[x[i]-1]+b[y[i]-1]-c[i]);

	cout << min(min_a+min_b, min_m) << endl;

	return 0;
}


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

int main(){
    long long  N ; cin >> N;
    long long n = N;
    int div = 0;
    while (n > 0)
    {
        div += n % 10;
        n /= 10;
    }

    if(N % div == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

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

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int n;
vvll f, p;

ll solve(vector<bool> sel) {
  if(SZ(sel) == 10) {
    bool zero = true;
    REP(i, 10) if(sel[i]) zero = false;
    if(zero) return -1000000000;
    vector<int> c(n);
    REP(i, n) {
      REP(j, 10) {
        if(sel[j] && f[i][j] == 1) c[i]++;
      }
    }
    ll ans = 0;
    REP(i, n) {
      ans += p[i][c[i]];
    }
    return ans;
  } else {
    sel.pb(1);
    ll tmp1 = solve(sel);
    sel[SZ(sel)-1] = 0;
    ll tmp2 = solve(sel);
    return max(tmp1, tmp2);
  }
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  cin >> n;

  f.resize(n);
  REP(i, n) {
    f[i].resize(10);
    REP(j, 10) {
      cin >> f[i][j];
    }
  }

  p.resize(n);
  REP(i, n) {
    p[i].resize(11);
    REP(j, 11) {
      cin >> p[i][j];
    }
  }

  vector<bool> sel;
  cout << solve(sel) << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define CMAX(m, x)  m = max(m,x);
#define CMIN(m, x)  m = min(m,x);
#define itn int
typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
int main(){
    int n,k;
    cin >> n >> k;
    int cnt = 0;
    vector<vector<int>> okasi(k);
    vector<bool> sunuke(n);
    REP(i,k){
        int d;
        cin >> d;
        REP(j,d){
            int a;
            cin >> a;
            sunuke[a - 1] = true;
        }
    }
    REP(i,n){
        if(!sunuke[i])
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;

int main() {
  int N, X, M[110];
  cin >> N >> X; for (int i = 0; i < N; i++) cin >> M[i];
  int sum = 0, min = M[0];
  for (int i = 0; i < N; i++) {
    sum += M[i];
    if (M[i] < min) min = M[i];
  }
  int donutCount = (X - sum) / min + N;
  cout << donutCount << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

struct UnionFindTree {
    size_t n;
    vector<int> tree;
    UnionFindTree(size_t n): n(n) {
        tree = vector<int>(n, -1);
    }
    size_t find_root(size_t v) {
        if (tree[v] < 0) return v;
        return tree[v] = find_root(tree[v]);
    }
    bool unite(size_t x, size_t y) {
        x = find_root(x);
        y = find_root(y);
        if (x == y) return false;
        if (rank(x) < rank(y)) swap(x, y);
        tree[x] += tree[y];
        tree[y] = x;
        return true;
    }
    bool connected(size_t x, size_t y) {
        return find_root(x) == find_root(y);
    }
    int rank(size_t v) {
        return -tree[find_root(v)];
    }
};

int main() {
    size_t N, K, L;
    scanf("%zu %zu %zu", &N, &K, &L);

    UnionFindTree g(N);
    for (size_t i=0; i<K; ++i) {
        size_t p, q;
        scanf("%zu %zu", &p, &q);
        --p, --q;

        g.unite(p, q);
    }

    UnionFindTree h(N);
    for (size_t i=0; i<L; ++i) {
        size_t r, s;
        scanf("%zu %zu", &r, &s);
        --r, --s;

        h.unite(r, s);
    }

    vector<size_t> ar(N), br(N);
    for (size_t i=0; i<N; ++i) {
        ar[i] = g.find_root(i);
        br[i] = h.find_root(i);
    }

    map<pair<size_t, size_t>, int> dict;
    for (size_t i=0; i<N; ++i)
        ++dict[make_pair(ar[i], br[i])];

    for (size_t i=0; i<N; ++i)
        printf("%d%c", dict[make_pair(ar[i], br[i])], i<N-1? ' ':'\n');

    return 0;
}


Measured memory_bytes: 16640
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;
int main(){
   int n;
   cin>>n; 
   string s;
   cin>>s;
   int x=0;
   int ans=0;
   rep(i,n){
      s[i]=='I'? x++:x--;
      ans=max(x,ans);
   }
   cout<<ans;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <float.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <set>
#include <stdlib.h>
#include <time.h>
#include <list>
#include <stack>
#include <queue>
#include <sstream>

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;

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

int main() {
	int h, w;
	cin >> h >> w;
	map<char, int> mp;
	rep(i, h*w) {
		char tmp;
		cin >> tmp;
		mp[tmp]++;
	}


	if (h == 1 && w == 1) {
		cout << "Yes" << endl;
		return 0;
	}

	bool ok = true;
	if (h % 2 == 0 && w % 2 == 0) {
		Fe(it, mp) {
			if (it.second % 4 != 0)
				ok = false;
		}
	}
	else if ((h % 2 == 1 && w % 2 == 0) ) {
		int count = 0;
		Fe(it, mp) {
			count += it.second / 4;
		}
		if (count < (h - 1) / 2 * w / 2)
			ok = false;
		Fe(it, mp) {
			if (it.second % 2 == 1) {
				ok = false;
			}
		}
	}
	else if (h % 2 == 0 && w % 2 == 1) {
		int count = 0;
		Fe(it, mp) {
			count += it.second / 4;
		}
		if (count < (w - 1) / 2 * h / 2)
			ok = false;
		Fe(it, mp) {
			if (it.second % 2 == 1) {
				ok = false;
			}
		}
	}
	else {
		int count = 0;
		Fe(it, mp) {
			count += it.second / 4;
		}
		if (count < (w - 1) / 2 * (h - 1) / 2)
			ok = false;	
		bool first = false;
		Fe(it, mp) {
			if (!first && mp[it.first] % 2 == 1) {
				first = true;
				continue;
			}
			if (first && mp[it.first] % 2 == 1) {
				ok = false;
			}
		}
	}

	if (ok)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;



}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define INF = numeric_limits<long long>::max();
#define intf int_fast64_t
int main(){
    intf k,a,b;
    cin >>k >>a >>b;
    for(intf i=a;i<b+1;i++){
        if(i%k==0){
            cout << "OK" <<endl;
            return 0;
        }
    }
    cout << "NG" <<endl;
}

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

#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;


void solve(){
    string s;
    cin>>s;
    int cnt = 0,m = 0;
    rep(i,0,s.size()){
        if(strchr("ACGT", s[i]))
            cnt++;
        else{
            m = max(m, cnt);
            cnt=0;
        }
    }
    cout << max(m, cnt) << endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
     t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=1e18;
int n;
ll ans=1;
int main(){
	ll a,b;
	string s;
	cin>>a>>s;
	b=(s[0]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
	ans=a*b;
	ans/=100;
	cout<<ans<<endl;
}

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

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

    int K_element[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin>>k;
    cout<<K_element[k-1];

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
constexpr long long INF = 1e18;

signed main(){
	int N;
	cin>>N;
	FOR(i,1,10){
		FOR(j,1,10){
			if(i*j==N){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 256