akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

typedef struct{
  int id;
  int k;
  int *v;
}Graph;

Graph *G;
int n;
int **Adj;


void getDef(){
  int i,j;

  Adj = malloc(sizeof(int*) * (n+1));
  for(i=1;i<=n;i++){
    Adj[i] = malloc(sizeof(int) * (n+1));
    for(j=1;j<=n;j++){
      Adj[i][j] = 0;
    }
  }
}

void getAdj(int id){
  int i,j;

  //printf("in getAdj\n");
  for(j=1; j<=G[id].k; j++){
    for(i = 1; i <= n; i++){
      //printf("Adj[%d][%d]->G[id].v[j]:%d\n",id,i,G[id].v[j]);
      if(G[id].v[j]==i){
        Adj[id][i]=1;
      }
      //printf("Adj[%d][%d]->%d\n",id,i,Adj[id][i]);
    }
    //printf("%d\n",Adj[id-1][i]);
  }
}

void printer(){
    int i, j;

    for(i=1; i<=n; i++){
      for(j=1; j<=n; j++){
        printf("%d",Adj[i][j]);
        if(j!=n){
          printf(" ");
        }
      }
      printf("\n");
    }
}

int main() {
  int i, j;
  int id;
  //-----各種入力処理------
  scanf("%d",&n);
  G = malloc(sizeof(Graph) * (n+1));
  getDef();
  for (i = 1; i <= n; i++) {
    scanf("%d",&id);
    G[id].id = id;
    scanf("%d",&G[id].k);
    G[id].v = (int*)malloc(sizeof(int) * (G[id].k+1));
    for(j = 1; j <= G[id].k; j++){
      scanf("%d",&G[id].v[j]);
    }
    getAdj(id);
  }
  //printf("fin enter\n");
  //---------------------
  printer();

  free(G);
  free(Adj);
  return 0;
}



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

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

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

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;

int main() {
    int n, m; cin >> n >> m;
    vector<ll> x(n), y(m);
    rep(i, n) cin >> x[i];
    rep(i, m) cin >> y[i];

    ll xsum = 0;
    rep(i, n-1) {
        xsum += (x[i+1] - x[i]) * (i+1) % MOD * (n-i-1) % MOD;
        xsum %= MOD;
    }
    ll ysum = 0;
    rep(i, m-1) {
        ysum += (y[i+1] - y[i]) * (i+1) % MOD * (m-i-1) % MOD;
        ysum %= MOD;
    }

    ll ans = xsum * ysum % MOD;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
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 cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 	
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }
  

 void solve() {
        int n;
        cin>>n;
        string s;
        cin>>s;
        
        int r=0,b=0,g=0;
        
        rep(i,0,n) {
			  if(s[i]=='R') r++;
			  else if(s[i]=='G') g++;
			  else b++;
			}
       int ans=r*g*b;
       
       rep(i,0,n ) {
		     rep(j,1,n) {
				    if(i+2*j<n && s[i]!=s[i+j] && s[i]!=s[i+2*j] && s[i+j]!=s[i+2*j]) ans--;
				 }
		   }
		   cout<<ans<<endl;
		   
        
 }

    
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	solve();


return 0;	   
}


Measured memory_bytes: 3648
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        const long Mod = 1000000007;
        public static void Main (string[] args)
        {
            new Program ().Solve (new ConsoleInput (Console.In, ' '));
        }

        public void Solve (ConsoleInput cin)
        {
            string S = cin.Read;

            if(S[S.Length-1]=='s') S+="es";
            else S+="s";

            Console.WriteLine(S);
        }

        public static long CombinationMod (long m, long n)
        {
            var a = 1L;
            var b = 1L;
            for (long i = 1; i <= n; i++)
            {
                a = (a * (m - i + 1)) % Mod;
                b = (b * i) % Mod;
            }

            return ModDiv (a, b) % Mod;
        }
        static long ModDiv (long x1, long x2)
        {
            long bb = ModPow (x2, Mod - 2);
            return (x1 * bb) % Mod;
        }

        static long ModPow (long x1, long x2)
        {
            long ans = 1;
            while (x2 > 0)
            {
                if (x2 % 2 == 1)
                {
                    ans = (ans * x1) % Mod;
                }
                x2 /= 2;
                if (x2 == 0) break;
                x1 = (x1 * x1) % Mod;
            }
            return ans % Mod;
        }
    }

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

Measured memory_bytes: 26256
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    
    if temp != 1:
        arr.append([temp, 1])
    if not arr:
        arr.append([n, 1])
    
    return arr


def solve():
    N, P = map(int, rl().split())
    
    facts = factorization(P)
    ans = 1
    for p, exp in facts:
        if N <= exp:
            ans *= p ** (exp // N)
    print(ans)


if __name__ == '__main__':
    solve()


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

using namespace std;
using ll = long long;
using ld = long double;

struct UnionFind{
    vector<int> d;
    UnionFind(int n): d(n,-1) {}
    int find(int x){
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return false;
        if(d[x] < d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return -d[find(x)];
    }
};

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    vector<int> p(n);
    for(int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    UnionFind uf(n);
    for(int i = 0; i < m; i++) {
        int x,y;
        cin >> x >> y;
        --x;
        --y;
        uf.unite(x,y);
    }

    map<int,vector<int>> mp;
    for(int i = 0; i < n; i++) {
        int pr=uf.find(i);
        mp[pr].emplace_back(i);
        mp[pr].emplace_back(p[i]);
    }

    int ans=0;
    for(auto itr=mp.begin() ; itr!=mp.end() ; itr++) {
        int k=itr->first;
        sort(mp[k].begin(),mp[k].end());
        int s=mp[k].size();
        int cnt=0;
        for(int i = 1; i < s; i++) {
            if(mp[k][i-1]==mp[k][i]) cnt++;
        }
        ans+=cnt;
    }
    cout << ans << "\n";

    return 0;
}

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

int main(){
  int A, B;
  cin >> A >> B;
  
  if(A%3==0 or B%3==0 or (A+B)%3==0){
    cout << "Possible" << endl;
  }
  else{
    cout << "Impossible" << endl;
  }
}

Measured memory_bytes: 384
import sys
import math

M = 10001
size = (M-1)//2
l = [1] * size
b = int(math.sqrt(M)+1)
for i in range(3,b,2):
    index = (i-3)//2
    if l[index]:
        l[index+i::i] = [0] * len(l[index+i::i])

m = []
for i in range(size):
    if l[i]:
        m.append(i)

s = ""
p = [0,0,0,1]
for i in sys.stdin:
    n = int(i)
    if n <= 3:
        print(p[n])
    elif n % 2 == 0:
        if l[(n-3)//2]:
            print(2)
        else:
            print(0)
    else:
        ct = 0
        n2 = (n-5)//2
        for j in m:
            if j > n2:
                break
            if l[n2-j]:
                ct += 1
        print(ct)

Measured memory_bytes: 7736
/**
 *    author:  FromDihPout
 *    created: 2020-08-12
**/

#include <bits/stdc++.h>
using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int q;
    cin >> q;
    vector<int> l(q), r(q);
    int high = 0;
    for (int i = 0; i < q; i++) {
        cin >> l[i] >> r[i];
        high = max(high, r[i]);
    }
    
    vector<bool> comp(high + 1);
    comp[0] = true; comp[1] = true;
    for (int i = 2; i <= high; i++) {
        if (!comp[i]) {
            for (int j = i + i; j <= high; j += i) {
                comp[j] = true;
            }
        }
    }
    
    vector<int> cnt(high + 1);
    cnt[0] = 0;
    for (int i = 1; i <= high; i++) {
        cnt[i] = cnt[i-1];
        if (!comp[i] && !comp[(i + 1) / 2]) {
            cnt[i]++;
        }
    }

    for (int i = 0; i < q; i++) {
        cout << cnt[r[i]] - cnt[l[i] - 1] << '\n';
    }
    return 0;
}

Measured memory_bytes: 4528
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N, a, b, c, d, e, f, g, h, i;
    
    cin >> N;
    a = N % 10;
    b = N % 100 / 10;
    c = N % 1000 / 100;
    d = N % 10000 / 1000;
    e = N % 100000 / 10000;
    f = N % 1000000 / 100000;
    g = N % 10000000 / 1000000;
    h = N % 100000000 / 10000000;
    i = N % 1000000000 / 100000000;
    
    int ans = a+ b+ c+ d+ e+ f+ g+ h+ i;
    
    if(N % ans == 0)
    cout << "Yes" << endl;
    
    else
    cout << "No" << endl;
}


Measured memory_bytes: 3596
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

long long n, k;
long long memo[11][5];
long long sumi[11];

int main(){
	cin >> n >> k;
	for(int i = 1; i <= 11; i++){
		for(int j = 1; j <= 5; j++){
			memo[i-1][j-1] = (7*i+j+1)*9;
			memo[i-1][j-1] = memo[i-1][j-1] % 11;
			if(memo[i-1][j-1] == k){
				sumi[i-1]++;
			}
		}
	}

	n-=2;

	long long ans = 0;
	for(int i = 0; i < 11; i++){
		long num = n/11;
		if(n%11 > i){
			num++;
		}
		ans += sumi[i]*num;
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
# frozen_string_literal: true

n, m = gets.split.map(&:to_i)
a = Array.new(n) { gets.chomp.chars }
b = Array.new(m) { gets.chomp.chars }

(n - m + 1).times do |i|
  (n - m + 1).times do |j|
    if b.each_with_index.all? { |row, idx| row == a[i + idx][j...(j + m)] }
      puts :Yes
      exit
    end
  end
end

puts :No

Measured memory_bytes: 2044
#include <stdio.h>

static const int monthDays[13]={
	0,31,59,90,120,151,181,212,243,273,304,334,365
};

static long long getDays(int year) {
	long long result;
	if(year<0)return -getDays(-year)-366+365;
	else if(year==0)return 0;
	result=(long long)year*365;
	result+=year/4;
	result-=year/100;
	result+=year/400;
	return result;
}

static long long getDays2(int fromYear,int toYear) {
	return getDays(toYear)-getDays(fromYear);
}

static int getLeapYearNum(int year) {
	int result;
	if(year<0)return -getLeapYearNum(-year)-1;
	else if(year==0)return 0;
	result=year/4;
	result-=year/100;
	result+=year/400;
	return result;
}

static int getLeapYearNum2(int fromYear,int toYear) {
	return getLeapYearNum(toYear)-getLeapYearNum(fromYear);
}

static int isLeapYear(int year) {
	return (year%400==0 || (year%4==0 && year%100!=0));
}

long long date2dayCount(int year,int month,int date) {
	long long result;
	if(month<1 || month>12)return 0;
	result=getDays2(1969,year-1);
	result+=monthDays[month-1];
	if(isLeapYear(year)) {
		if(month>=3)result++;
	}
	result+=date-1;
	return result;
}

void dayCount2date(int* year,int* month,int* date,long long days) {
	int i;
	int yearNum;
	int amariDays;
	int daySeconds;
	int hoseiYear;
	int is2_29;
	if(days>=0) {
		yearNum=1970+(int)(days/365);
		amariDays=(int)(days%365);
	} else {
		days=-days;
		yearNum=1970-(int)(days/365)-1;
		amariDays=365-(int)(days%365);
	}
	amariDays-=getLeapYearNum2(1969,yearNum-1);
	while(1) {
		if((amariDays>=0 && amariDays<365) ||
			(amariDays==365 && isLeapYear(yearNum)))break;
		if(amariDays<0) {
			hoseiYear=(-amariDays)/365+1;
			amariDays+=hoseiYear*365;
			amariDays+=getLeapYearNum(yearNum-1)-
				getLeapYearNum(yearNum-hoseiYear-1);
			yearNum-=hoseiYear;
		} else if(amariDays>=365) {
			hoseiYear=amariDays/365;
			amariDays=amariDays%365;
			amariDays-=getLeapYearNum(yearNum+hoseiYear-1)-
				getLeapYearNum(yearNum-1);
			yearNum+=hoseiYear;
		} else break;
	}
	is2_29=0;
	if(isLeapYear(yearNum) && amariDays>=59) {
		if(amariDays==59)is2_29=1;
		amariDays--;
	}
	for(i=1;i<=12;i++) {
		if(amariDays>=monthDays[i-1] && amariDays<monthDays[i])break;
	}
	amariDays-=monthDays[i-1];
	if(is2_29)amariDays++;
	*year=yearNum;
	*month=i;
	*date=amariDays+1;
}

int main(void) {
	char input[1024];
	long long days_origin=date2dayCount(2012,12,21);
	while(fgets(input,sizeof(input),stdin)) {
		long long days;
		int b,ka,t,w,ki;
		int y,m,d;
		int sscret;
		sscret=sscanf(input,"%d.%d.%d.%d.%d",&b,&ka,&t,&w,&ki);
		if(sscret==5) {
			/* maya -> seireki */
			days=b;
			days=days*20+ka;
			days=days*20+t;
			days=days*18+w;
			days=days*20+ki;
			dayCount2date(&y,&m,&d,days+days_origin);
			printf("%d.%d.%d\n",y,m,d);
		} else if(sscret==3) {
			/* seireki -> maya */
			y=b;m=ka;d=t;
			days=date2dayCount(y,m,d)-days_origin;
			ki=days%20;days/=20;
			w=days%18;days/=18;
			t=days%20;days/=20;
			ka=days%20;days/=20;
			b=days%13;
			printf("%d.%d.%d.%d.%d\n",b,ka,t,w,ki);
		} else break;
	}
	return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
#define endl '\n'
#define INF (1 << 21)
const int MOD = 1000000009;
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int cnt;
  int num[1005], p[1005], q[1005], r[1005];
  int P, Q, R, C;
  
  cin >> n;
  while(n != 0){
    cnt = 0;

    for(int i = 0;i < n;i++){
      cin >> num[i] >> p[i] >> q[i] >> r[i];
    }
    cin >> P >> Q >> R >> C;

    for(int i = 0;i < n;i++){
      if(p[i] <= P && q[i] <= Q && r[i] <= R && p[i] * 4 + q[i] * 9 + r[i] * 4 <= C){
	cnt++;
	cout << num[i] << endl;
      }
    }
    if(cnt == 0){
      cout << "NA" << endl;
    }
    cin >> n;
  }
  return 0;
}




Measured memory_bytes: 3156
#include<bits/stdc++.h>                                                      
using namespace std;
int main()
{
  int N;
  cin >> N;
  int count=0;
  int ans=0;
  for(int i=1; i<=N; i+=2){
    for(int j=1; j<=N; j++){
      if(i%j==0)
        count++;
    }
    if(count==8)
      ans++;
    count=0;
  }
  cout << ans << endl;
}

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

int main() {
	int n;
	cin >> n;
	ll c = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0)c += i;
	}
	cout << c << endl;
	return 0;
}


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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  vector<int> v(n);
  REP(i,n){
    int tmp;
    cin >> tmp;
    v[i] = tmp - (i+1);
  }
  SORT(v);
  int diff = -1*v[v.size()/2];
  ll ans = 0;
  REP(i,n) {
    ans += abs(v[i]+diff);
  }
  cout << ans;
  
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 1024
#include "bits/stdc++.h"

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

using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

int main() {
	int N, M; cin >> N >> M;

	int num1 = 1;
	rep(i, M)num1 *= 2;
	int count = 1;
	long long ans = ((N - M) * 100 + 1900 * M) * num1;
	cout << ans;
}


Measured memory_bytes: 3620
def sum(lst):
	a = 0
	for i in range(0, len(lst)):
		a += lst[i]
	return a

def judge(score):
	s = sum(score)
	if s % 10 != 0:
		return s
	for i in range(0, len(score)):
		if score[i] % 10 != 0:
			return s - score[i]
	return 0

n = int(raw_input())
score = []
for i in range(0, n):
	score.append(int(raw_input()))
score.sort()
print judge(score)


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int K; std::cin >> K;
  int ans = 0;
  rrep(i, K) rrep(j, K) {
    int tmp = gcd(i, j);
    rrep(k, K) {
      ans += gcd(tmp, k);
    }
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <tuple>
#include <bitset>
#include <random>
#define REP(i,n) for(int i=0;i<n;i++)
#define INF 100000000000007
using namespace std;
using pii=pair<int,int>;
using LL=int64_t;



vector<pair<int64_t, int64_t>> fs;//素因数分解の素数，指数のペア
 
void prime_factorize(LL N){
   //vector<pair<LL, LL>> res;
   for (LL a = 2; a * a <= N;a++) {
	   if(N % a == 0){
	   LL ex = 0; //指数
 
	   //割れる限り割り続ける
	   while (N % a == 0) {
		   ++ex;
		   N /= a;
	   }
 
	   fs.push_back(make_pair(a, ex));
       }
   }
 
   //最後に残った数について
   if ( N != 1) fs.push_back(make_pair(N, 1));
   
}
	
void factorization(int64_t base){//baseを素因数分解
    //base未満のiが約数か
    for(int64_t i=2;i*i<=base;i++){
        //iで割り切れるなら限界まで割る
        
        if(base%i==0){
            int64_t cnt=0;
            while(base%i==0){
                base/=i;
                cnt++;
            }
            fs.push_back(make_pair(i,cnt));
        }
    }
    //baseが素数
    if(base>1){
        fs.push_back(make_pair(base,1));
    }
}
int main(){
    int64_t n;
    cin>>n;
    
    
    factorization(n);
    //prime_factorize(n);
    int64_t ans=0;
    for(auto p : fs){
        int64_t e;
        e=p.second;
        int k=1;
        while(e-k>=0){
            e-=k;
            k++;
            ans++;
        }
    }

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

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

const int mod = 1e9 + 7;

using ll = long long;

int solve(const vector<ll>& A, ll n)  {
    ll sum = A[0];
    ll res = 0;
    for(int i=1; i<n; i++) {
        res = (res + (sum * A[i]) % mod) % mod;
        sum = (sum + A[i]) % mod;
    }
    return res;
} 
int32_t main() 
{ 
    ll n;
    cin >> n;
    vector<ll> arr(n);
    for(ll& i : arr) cin >> i;
    cout << solve(arr, n) << '\n';
} 


Measured memory_bytes: 4784
def bfs(field,H,W,start_x,start_y,tmp_N):
    direction = [[-1,0],[1,0],[0,-1],[0,1]]
    que = []
    que.append([start_x,start_y])
    INF = 1000000
    min_path = [[INF] * W for i in range(H)]
    min_path[start_y][start_x] = 0
    while len(que) != 0:
        current = que.pop(0)
        for d in direction:
            nx = current[0] + d[0]
            ny = current[1] + d[1]
            if 0 <= nx < W and 0 <= ny < H and field[ny][nx] != "X" and min_path[ny][nx] == INF:
                min_path[ny][nx] = min_path[current[1]][current[0]] + 1
                if field[ny][nx] == tmp_N:
                    return nx,ny,min_path[ny][nx]
                else:
                    que.append([nx,ny])

def getField():
    matrix = []
    first = input().strip()
    H,W,N = map(int,first.split())
    for i in range(H):
        row = list(input().strip())
        for j in range(W):
            if row[j].isdigit():
                row[j] = int(row[j])
        matrix.append(row)
    return matrix,H,W,N

def getStart(field):
    for y in range(len(field)):
        for x in range(len(field[0])):
            if field[y][x] == "S":
                return x,y

def main():
    matrix,H,W,N = getField()
    sx,sy = getStart(matrix)
    distance = 0
    tmp_x,tmp_y,tmp_dist = bfs(matrix,H,W,sx,sy,1)
    distance += tmp_dist
    tmps = [tmp_x,tmp_y]
    for k in range(N-1):
        tmp_x,tmp_y,tmp_dist = bfs(matrix,H,W,tmps[0],tmps[1],k+2)
        distance += tmp_dist
        tmps = [tmp_x,tmp_y]
    print(distance)

if __name__=='__main__':
    main()

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

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

    if(a + b > c + d) cout << "Left";
    else if(a + b < c + d) cout << "Right";
    else cout << "Balanced";
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ll long long
using namespace std;
int main()
{
    map<int, ll> mp;
    int n;
    cin >> n;
    for (int i = 2; i <= n; i++)
    {
        int t = i, p = 2;
        while (t != 1)
        {
            if (t % p == 0)
            {
                mp[p]++;
                t /= p;
                continue;
            }
            p++;
        }
    }
    int ans = 0;
    for (int i = 0; i <= n - 3; i++)
        for (int j = i + 1; j <= n - 2; j++)
            for (int k = j + 1; k <= n - 1; k++)
            {
                int a = mp[i];
                int b = mp[j];
                int c = mp[k];
                int l[] = {a, b, c};
                if (l[0] >= 2 and l[1] >= 4 and l[2] >= 4)
                    ans++;
                if (l[1] >= 2 and l[2] >= 4 and l[0] >= 4)
                    ans++;
                if (l[2] >= 2 and l[0] >= 4 and l[1] >= 4)
                    ans++;
                //if (l[0] >= 2 and l[2] >= 4 and l[1] >= 4)
                //    ans++;
                // if (l[2] >= 2 and l[1] >= 4 and l[0] >= 4)
                //ans++;
                //if (l[1] >= 2 and l[0] >= 4 and l[2] >= 4)
                //ans++;
            }
    for (int i = 0; i <= n - 2; i++)
        for (int j = i + 1; j <= n - 1; j++)
        {
            int a = mp[i];
            int b = mp[j];
            int l[] = {a, b};
            if (l[0] >= 24 and l[1] >= 2)
                ans++;
            if (l[0] >= 14 and l[1] >= 4)
                ans++;
            if (l[1] >= 24 and l[0] >= 2)
                ans++;
            if (l[1] >= 14 and l[0] >= 4)
                ans++;
        }
    for (int i = 0; i <= n - 1; i++)
    {
        int a = mp[i];
        if (a >= 74)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = 0;
    if(a < b) ans += a;
    else ans += b;
    if(c < d) ans += c;
    else ans += d;
    cout << ans << endl;
}

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

template<class T, T Op(T, T), T E()>
struct SegmentTree {
  const int n;
  vector<T> t;
  SegmentTree(int _n) : n(_n), t(2 * n, E()) {}
  T& operator[](int i) { return t[n + i]; }
  void build() { for (int i = n - 1; i >= 1; --i) t[i] = Op(t[2 * i], t[2 * i + 1]); }
  T acc(int l, int r) const {
    l = max(l, 0);
    r = min(r, n);
    T a = E(), b = E();
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) a = Op(a, t[l++]);
      if (r & 1) b = Op(t[--r], b);
    }
    return Op(a, b);
  }
  void set(int i, const T& a) {
    t[i += n] = a;
    while (i >>= 1) t[i] = Op(t[2 * i], t[2 * i + 1]);
  }
};
template<class T> T _min(T a, T b) { return b < a ? b : a; }
pair<int, int> inf() { return {0x3f3f3f3f, -1}; }

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  SegmentTree< pair<int, int>, _min, inf > dp(n + 1);
  dp.set(n, {0, n});
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == '0') {
      dp.set(i, {1 + dp.acc(i + 1, i + 1 + m).first, i});
    }
  }
  if (dp[0].first > n) {
    cout << "-1\n";
    return 0;
  }
  vector<int> res;
  int i = 0;
  while (i < n) {
    int ni = dp.acc(i + 1, i + 1 + m).second;
    res.push_back(ni - i);
    i = ni;
  }
  m = res.size();
  for (int j = 0; j < m; ++j) {
    cout << res[j] << " \n"[j == m - 1];
  }
}


Measured memory_bytes: 2632
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ABC118C
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.SetIn(new StreamReader(args[0]));
            }

            new Program().calc();
        }

        void calc()
        {
            var n = int.Parse(Console.ReadLine()); // 使わない
            var hpList = Console.ReadLine().Split(' ').Select(int.Parse); // モンスターの体力
            Console.WriteLine(attack(hpList));
        }

        int attack(IEnumerable<int> hpList)
        {
            Console.Error.WriteLine(string.Join(",", hpList));

            // 最も体力の少ないモンスターが、周りを攻撃する
            var min = hpList.Min();

            // 体力をちょうどゼロにできるかどうかを確かめる
            hpList = hpList.Select(hp => hp % min).Where(hp => hp > 0);

            if (hpList.Count() == 0)
            {
                // 全モンスターの体力をちょうどゼロにできたら終了
                return min;
            }
            else
            {
                // そうでない場合は自分の体力を元に戻して攻撃を繰り返す
                // Enumerable.Appendは.NET Framework 4.7.1/.NET Core 1.0以降が必要なので、Concatを使う
                return attack(hpList.Concat(new[] { min }));
            }
        }
    }
}


Measured memory_bytes: 30172
using System;
using System.Linq;
using System.Collections.Generic;

class Cmondai
{
    static void Main()
    {
        var S = Console.ReadLine();
        var T = Console.ReadLine();
        //対応表
        var dicST = new Dictionary<char, char>();
        var dicTS = new Dictionary<char, char>();
        var ans = "Yes";
        for (int i=0; i<S.Length;++i)
        {
            if (!dicST.ContainsKey(S[i])) dicST.Add(S[i], T[i]);
            else
            {
                if (T[i] != dicST[S[i]])
                {
                    ans = "No";
                    break;
                }
            }
            if (!dicTS.ContainsKey(T[i])) dicTS.Add(T[i], S[i]);
            else
            {
                if (S[i] != dicTS[T[i]])
                {
                    ans = "No";
                    break;
                }
            }
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 14688
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
#define fst first
#define snd second

int main() {
#ifdef LOCAL_EXEC
  //	freopen("sample.in", "r", stdin);
  //	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#endif

  ll d, t, s;
  cin >> d >> t >> s;
  cout << (d <= t * s ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 3600
N = int(input())
S = input()
answer = 0
for i in range(1,N-1):
  X = S[:i]
  Y = S[i:]
  Z = 0
  for c in 'abcdefghijklmnopqrstuvwxyz':
    if c in X and c in Y:
      Z += 1
  answer = max(answer,Z)
print(answer)

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

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

    int a, b, c;
    cin >> a >> b >> c;

    cout << c << " " << a << " " << b << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int N1 = sc.nextInt();  
  int N2 = sc.nextInt();
  int N3 = sc.nextInt();
  int N4 = sc.nextInt();
  
  int a1 = (N1-1)*(N2-1)*(N3-1)*(N4-1);
  int a4 = (N1-4)*(N2-4)*(N3-4)*(N4-4);
  int a7 = (N1-7)*(N2-7)*(N3-7)*(N4-7);
  int a9 = (N1-9)*(N2-9)*(N3-9)*(N4-9);
  
if(a1==0 && a4 == 0 && a7==0 && a9==0){
  System.out.println("YES");
}else{
  System.out.println("NO");
}

}
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int R;
  cin >> R;
  string ans;
  if (R < 1200)
    ans = "ABC";
  else if (R < 2800)
    ans = "ARC";
  else
    ans = "AGC";
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define _ << " _ " <<
#define TRACE(x) cerr << #x << " = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
//#define debug
//#define TRACE(x)

using namespace std;

typedef long long llint;

const int MAXN = 100010;

int n, c, k, t[MAXN], sol;

int main(void) {
  scanf("%d %d %d",&n,&c,&k);
  REP(i, n) scanf("%d",&t[i]);
  sort(t, t + n);

  int i = 0;
  while (i < n) {
    int bus = t[i] + k, tot = 0;
    for (; i < n && bus >= t[i] && bus <= t[i] + k && tot < c; ++i, ++tot);
    ++sol;
  }
  
  printf("%d\n",sol);

  return 0;
}


Measured memory_bytes: 640
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<int> p(n);
	rep(i,n) std::cin >> p[i];
	std::reverse(all(p));
	// take ac later
	std::vector<int> ad(n,0),bd(n,0);

	int cnt = 0;
	for(int x:p) {
		cnt++; x--;
		if(x!=0) bd[x-1]+=cnt;
		if(x!=n-1) ad[x+1]+=cnt;
	}
	debug(ad,bd);
	rep(i,n-1) ad[i+1]+=ad[i];
	rep(i,n-1) bd[n-i-2]+=bd[n-i-1];
	rep(i,n) {
		std::cout << ad[i]+i+1 << ' ';
	} std::cout << ENDL;
	rep(i,n) {
		std::cout << bd[i]+n-i << ' ';
	} std::cout << ENDL;

	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  string n;
  cin>>n;
  int cnt=0;
  rep(i,3){
    cnt++;
    if(n[i]!=n[i+1])cnt=0;
    if(cnt==2)break;
  }
  string ans="No";
  if(cnt>=2)ans="Yes";
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 125568
#include <bits/stdc++.h>
using namespace std;
const int mod =  1000000007;
const int LIM = 100005;
#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(a) a.begin() , a.end()
#define vvi vector<vector<int>>
//#define double long double
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define endl '\n'
#define pb push_back
#define sp <<" "<<
#define ss second
#define ff first
int power(int x, int n){
    int res = 1;
    while(n){
          if(n&1){
                res = res * x % mod;
          }
          x = x * x % mod;
          n>>=1;
    }
    return res;
}

int32_t main()
{     //IOS;
      int tt=1,n,k,x,y,z,i,j;
      //cin>>tt;
      while(tt--)
      {
        cin>>n;
        if(n>=30)
        cout<<"Yes";
        else
        cout<<"No";
      }
}


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

// void frog1(int i, int n, int *h, int& cost){
//     //cout << cost << " ";
//     if(i == n-1) return;
//     if(i == n-2) {
//         int diff = abs(h[i] - h[n-1]);
//         cost = cost + diff;
//         return;
//     }
//     else{
//         int sum1moves = abs(h[i] - h[i+2]);
//         int sum2moves = abs(h[i] - h[i+1]) + abs(h[i+1] - h[i+2]);
//         if(sum2moves <= sum1moves ) {
//             cost += abs(h[i] - h[i+1]);
//             frog1(i+1, n, h, cost);
//         }
//         //else if(sum2moves == sum1moves ) 
//         else{
//             cost += sum1moves;
//             frog1(i+2, n, h, cost);
//         }
        
//     }
// }

int frog1(int n, int *h){
    int cost[n] = {};
    cost[0] = 0;
    cost[1] = abs(h[1]-h[0]);
    
    for(int i = 2; i < n; i++){
        cost[i] = min( (cost[i-2] + abs(h[i] - h[i-2])), (cost[i-1] + abs(h[i]-h[i-1])));
    }
    
    return cost[n-1];
}

int main() {
	int n; cin >> n;
	int h[n] = {};
	for(int i = 0; i<n; i++) cin >> h[i];
 	cout << frog1(n,h);
	return 0;
}

Measured memory_bytes: 4328
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
typedef long long ll;
using namespace std;
int n;
int main(void){
    cin>>n;
    ll res=0;
    ll c[10][10];
    rep(i,10){
        rep(j,10){
            c[i][j]=0;
        }
    }
    rep(i,n+1){
        int x=i;
        int p1=x%10;
        while(x>=10) x/=10;
        c[p1][x]++;
    }
    rep(i,10){
        rep(j,10){
            res+=c[i][j]*c[j][i];
        }
    }
    cout<<res-1<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n,ans;
int main(){
	rep(i,0,15){
		char c=0;
		scanf("%c",&c);
		if(c=='x')ans++;
		
	}
	puts(15-ans>=8?"YES":"NO");
}

Measured memory_bytes: 128
#include <iostream>
#include <unordered_set>

int main()
{
	int n;
	std::cin >> n;
	
	std::unordered_set<int> set;
	for (int i = 0; i < n; ++i)
	{
		int x;
		std::cin >> x;
		if (set.find(x) == set.end())
			set.insert(x);
		else
			set.erase(x);
	}
	
	std::cout << set.size();
}

Measured memory_bytes: 4388
//============================================================================
// Name        : ATcoder.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>
using namespace std;
typedef long long ll;
int main() {


	int n,a,b;

	cin>>n>>a>>b;

	if((b-a)%2==0){
		cout<<"Alice"<<endl;
	}
	if((b-a)%2>0){
		cout<<"Borys"<<endl;
	}


	return 0;
}



Measured memory_bytes: 256
from collections import deque
n=int(input())-10
q=deque(range(1,10))
while n>=0:
    a=str(q.popleft())
    a=int(a+a[-1])
    for i in range(a-1,a+2):
        if str(i)[-2]==str(a)[-1]:
            q.append(i)
            n-=1
print(q[n])
#print(q,n)

Measured memory_bytes: 11648
H, W, K = map(int, input().split())
K -= 1
fibbonacci = [1, 1]
for i in range(8):
    fibbonacci.append(fibbonacci[-1] + fibbonacci[-2])
dp = [[0] * W for i in range(H + 1)]
dp[0][0] = 1
for i in range(H):
    for j in range(W):
        dp[i + 1][j] += dp[i][j] * fibbonacci[j] * fibbonacci[W - j - 1]
        if j > 0:
            dp[i + 1][j - 1] += dp[i][j] * fibbonacci[j - 1] * fibbonacci[W - j - 1]
        if j < W - 1:
            dp[i + 1][j + 1] += dp[i][j] * fibbonacci[j] * fibbonacci[W - j - 2]
print(dp[H][K]%(10**9 + 7))


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,m,x;
    cin >> n >> m >> x;
    int L=0,H=0;
    int a[100];
    
    for(int i=0;i<m;i++){
        cin >> a[i];
    }
    
    for(int i=0;i<m;i++){
        if(a[i] < x)
         L++;
        else
         H++;
    }
    
    if(L<=H) cout << L << endl;
    else if(L>H) cout << H << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		
	Scanner scanner = new Scanner(System.in);
		
	 String str = scanner.next();
	int a = Integer.parseInt(str);
	

    str = scanner.next();
    int b = Integer.parseInt(str);
    
    System.out.println((a*b) +" "+(a+b+a+b));
    
	}
}

Measured memory_bytes: 26008
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import copy

sys.setrecursionlimit(10**9)
mod = 10**7+9
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

n = I()
print(math.ceil(n/2))

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

int main(){
//srandom((unsigned long)time(NULL));

long long x,y;
cin>>x>>y;
long long shou=y;
long long ref=x;

for(long long i=1;i<=y/x;i++){
    ref=ref*2;
if(ref>shou){
    if(i==1){
        cout<<1<<endl;
        return 0;
    }
    cout<<i<<endl;
    return 0;
}

}


return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 10000000000000000
int main(){
	int n;cin>>n;
	vector<string> s(n),ins;
	vector<pair<int,string>> Pair(n);
	map<pair<int,string>,int> MAP;

	for(int i=0;i<n;i++){
		int p;
		cin>>s[i]>>p;

		Pair[i]=make_pair(p,s[i]);
		MAP[Pair[i]]=i+1;
	}

	sort(s.begin(),s.end());
	sort(Pair.begin(),Pair.end(),greater<pair<int,string>>());

	ins.push_back(s[0]);
	for(int i=0;i<n-1;i++){
		if(s[i+1]!=s[i]){ins.push_back(s[i+1]);}
	}

	int num=0;
	while(num<ins.size()){
		for(int i=0;i<n;i++){
			if(ins[num]==Pair[i].second){
				cout<<MAP[Pair[i]]<<endl;
			}
		}
		num++;
	}
	return 0;
}

Measured memory_bytes: 256
/**
 *    author        : Sudipta Banik Trisha 
 *    created       : August 13, 2020 6:03 PM
 *    Problem Name  : -X-
 *    Problem Limit : NULL , NULL
 *    Problem Url   : -X-
 *    @genarated by : ai-virtual-assistant
**/

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll nax = 100005;

vector<vector<ll> >graph(nax ,vector<ll>());
vector<ll>dp(nax,0);

void dfs(ll src, bool vis[])
{
    vis[src] = true;

    for(ll i=0; i<graph[src].size(); i++){
        ll x = graph[src][i];
        if(!vis[x]){
            dfs(x,vis);
        }

        dp[src] = max(dp[src], 1+dp[x]);
    }
}

int main(){
    ios_base::sync_with_stdio(false);

    ll n,m;
    cin >> n >> m;

    for(ll i=0; i<m; i++){
        ll u,v;
        cin >> u >> v;

        graph[u].push_back(v);
    }
    
    //ll dp[n+2];
    //memset(dp, 0, sizeof(dp));

    bool vis[n+2];
    memset(vis, false, sizeof(vis));

    for(ll i=1; i<=n; i++){
        if(!vis[i]){
            dfs(i,vis);
        }
    }

    ll maxx = *max_element(dp.begin(), dp.end());
    cout << maxx << endl;

    return 0 ;
}


Measured memory_bytes: 12964
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
char s[10];
int main() {
	//freopen("1.txt","r",stdin);
	scanf("%s",s+1);
	if (s[1]==s[2]||s[2]==s[3]||s[3]==s[4]) printf("Bad\n");
	else printf("Good\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int N,M,ans;
vector<bool> seen;
void dfs(vector<vector<int>> &G,int v,int cnt){
  seen[v]=true;
  cnt++;
  for(auto nv:G[v]){
    if(seen[nv]!=false) continue;
    dfs(G,nv,cnt);
  }
  seen[v]=false;
  if(cnt==N){
    ans++;
  }
}

int main()
{
  cin >> N >> M;
  ans=0;
  vector<P> A(M);
  vector<vector<int>> List(N,vector<int> ());
  REP(i,M){
    cin >> A[i].first >> A[i].second;
    A[i].first--;
    A[i].second--;
    List[A[i].first].push_back(A[i].second);
    List[A[i].second].push_back(A[i].first);
  }
  
  seen.assign(N,false);
  dfs(List,0,0);

  cout << ans << endl;
}

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

int n=1, x=1, c=0, h, d, m;

int main() {
    for (;n+x!=0;) {
        cin >> n >> x;
        for (int i=0; i<x/3 && i<n; i++) {
            h=x-2-i;
            d=min(h/2-1-i,n-((h/2)+(h%2)));
            c+=max(d,0);
        }
        if (n+x!=0) {
            cout << c << endl;
        }
        c=0;
    }
}


Measured memory_bytes: 3124
object Main extends App {
	override def main(args: Array[String]) = {
		val sc = new java.util.Scanner(System.in);
		val a,b,c = sc.nextInt();
		
		val res = solve(a,b,c);
		println(res);
		
	}
	
	def solve(a:Int,b:Int,c:Int):String = {
		(a,b,c) match{
			case (x:Int , y:Int, z:Int) if x < y && y < z =>
				"Yes"
			case _ =>
				"No"
		} 
	}
	
	
}

Measured memory_bytes: 45072