akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**8)

from fractions import gcd

n, x = map(int, input().split())

X = list(map(int,input().split()))
X = [abs(i-x) for i in X]
# print(X)

# def gcd(m,n):
#     mx = max(m,n)
#     mn = min(m,n)
#     tmp = mx%mn
#     if tmp == 0:
#         return mn
#     else:
#         return gcd(mn, tmp)

def gcd_list(data):
    # if len(data)==1:
    #     return data[0]
    # tmp = gcd(data[0], data[1])
    # if len(data)==2:
    #     return tmp
    # else:
    #     new_data = [tmp]+data[2:]
    #     return gcd_list(new_data)
    ret = data[0]
    for d in data[1:]:
        ret = gcd(ret, d)
    return ret
# print(gcd_list([2,4,8]))
print(gcd_list(X))

Measured memory_bytes: 16276
#include <iostream>

int main()
{
    std::ios_base::sync_with_stdio(0);
    std::string w;
    std::cin >> w;
    if (w == "Sunny") std::cout << "Cloudy";
    if (w == "Cloudy") std::cout << "Rainy";
    if (w == "Rainy") std::cout << "Sunny";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define endl "\n"
#include "string"

int32_t main() {
	boost;
	int n, ans = 0;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++) {
		for(int j = i + 1; j < n; j++) {
			for(int k = j + 1; k < n; k++ ) {
				if(a[i] == a[j] or a[j] == a[k] or a[i] == a[k])
					continue;
				int cnt = (a[i] < a[j] + a[k]);
				cnt += (a[j] < a[i] + a[k]);
				cnt += (a[k] < a[i] + a[j]);
				ans += (cnt  == 3);
			}
		}
	} 			
	cout << ans << endl;	
}

Measured memory_bytes: 3612
N, M = map(int, input().split())
X = [[0]*N for _ in range(M)]

for i in range(M):
    k, *S = map(int, input().split())
    for s in S:
        X[i][s-1] = 1

P = list(map(int, input().split()))
ans = 0
for i in range(1<<N):
    for j in range(M):
        s = P[j]
        for k in range(N):
            if (i & (1<<k)) and X[j][k]:
                s ^= 1
        if s:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 41456
N = gets.to_i
T, A = gets.split.map(&:to_i)
ary = gets.split.map(&:to_i)
min_diff = 1000
min_place = 0
ary.each_with_index do |h, i|
    avg = T - h * 0.006
    diff = (A - avg).abs
    if diff < min_diff
        min_diff = diff
        min_place = i + 1
    end
end
puts min_place

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

public class MainClass
{
	public const long Giri = 1000000007;
	
	public static void Main(string[] args)
	{
		string[] o = Input();
		int n = int.Parse(o[0]);
		int d = int.Parse(o[1]);
		
		int m = (d * 2+1);
		int r = n/m;
		if(n % m != 0) {
			r++;
		}
		Console.WriteLine(r);
	}

	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

}



Measured memory_bytes: 13140
num, num_of_coordinates = map(int, input().split(" "))
if num >= num_of_coordinates:
  print ("0")
else:
  coordinates = list(map(int, input().split(" ")))
  total = 0
  abs_distance = []
  coordinates.sort()
  for i in range(0, len(coordinates)-1):
    dist = abs(coordinates[i] - coordinates[i+1])
    total += dist
    abs_distance.append(dist)  

  #でかいやつ順に並べる
  abs_distance.sort()
  abs_distance.reverse()
  for i in range(num-1):
    total -= abs_distance[i]

  print(total)

Measured memory_bytes: 13968
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;

template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);


int main(){
  FAST_IO  

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

  if(a + b >= c) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;

const int N = 41;

int n;
char a[N][N];
ll dp[N][N][N], dp2[N][N][N][N], dp3[N][N][N];

ll dfs2(int l1, int r1, int l2, int r2);

ll dfs(int l, int m, int r) {
  if (dp[l][m][r] != -1)
    return dp[l][m][r];
  if (l == r)
    return dp[l][m][r] = 1;
  dp[l][m][r] = 0;
  for (int i = l; i < m; i += 2)
    for (int j = r; j > m; j -= 2)
      dp[l][m][r] += dfs2(l, i, j, r) * dfs(i + 1, m, j - 1);
  return dp[l][m][r];
}

ll dfs3(int p, int l, int r) {
  if (dp3[p][l][r] != -1)
    return dp3[p][l][r];
  dp3[p][l][r] = 0;
  for (int i = l; i <= r; ++i)
    if (a[p][i])
      dp3[p][l][r] += dfs(l, i, r);
  return dp3[p][l][r];
}

ll dfs2(int l1, int r1, int l2, int r2) {
  if (dp2[l1][r1][l2][r2] != -1)
    return dp2[l1][r1][l2][r2];
  dp2[l1][r1][l2][r2] = 0;
  for (int i = l1; i <= r1; ++i)
    dp2[l1][r1][l2][r2] += dfs(l1, i, r1) * dfs3(i, l2, r2);
  return dp2[l1][r1][l2][r2];
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
#endif

  scanf("%d", &n);
  for (int i = 0; i < n * 2; ++i)
    scanf("%s", a[i]);
  for (int i = 0; i < n * 2; ++i)
    for (int j = 0; j < n * 2; ++j)
      a[i][j] -= '0';
  
  memset(dp, -1, sizeof(dp));
  memset(dp2, -1, sizeof(dp2));
  memset(dp3, -1, sizeof(dp3));
  printf("%lld\n", dfs3(0, 1, n * 2 - 1));

  return 0;
}


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

def to_b(arr):
    ret = 0
    for i in arr:
        ret |= (1<<(i-1))
    return ret

def bc(num):
    return bin(num).count("1")

def main():
    N,M = [int(a) for a in input().split()]
    KS = [[int(a) for a in input().split()] for i in range(M)]
    P = [int(a) for a in input().split()]
    
    masks = [to_b(ks[1:]) for ks in KS]
    ans = 0
    for i in range(2**N):
        if all([bc(i&mask)%2==p for mask, p in zip(masks, P)]):
            ans+=1
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 41456
import java.util.*;

import static java.lang.System.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long N = ni();
        long M = ni();
        String S = ns();
        String T = ns();

        long L = lcm(N, M);

        Map<Integer, Character> map = new HashMap<>();
        for (int i = 0; i < N; i++) {
            int index = (int)(L / N) * i + 1;
            map.put(index, S.charAt(i));
        }

        boolean flag = true;
        for (int i = 0; i < M; i++) {
            int index = (int)(L / M) * i + 1;

            if(map.containsKey(index) && T.charAt(i) != map.get(index)){
                flag = false;
                break;
            }
        }

        if(flag){
            out.println(L);

        } else {
            out.println(-1);
        }
    }

    //参考: https://www.suzushin7.jp/entry/2016/11/05/calculate-least-common-multiple-in-java/
    //最大公約数 ユークリッドの互除法 O(logN)
    public static long gcd(long m, long n) {
        if (m < n) return gcd(n, m);
        if (n == 0) return m;
        return gcd(n, m % n);
    }

    //最小公倍数lcm ユークリッドの互除法 O(logN)
    public static long lcm(long m, long n) {
        return m * (n / gcd(m, n));  //m*nでlong型のオーバフローを発生させないため、先に割り算から行う
    }

    static int ni() {
        return sc.nextInt();
    }

    static long nl() {
        return sc.nextLong();
    }

    static String ns() {
        return sc.next();
    }

    static int[] niarr(int N) {
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }
        return a;
    }

    static long[] nlarr(int N) {
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextLong();
        }
        return a;
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s; cin >> s;
    const ll n = s.size();
    if ((s[0] == s[n-1]) ^ (s.size() % 2 == 0)) {
        cout << "Second" << endl;
    }
    else {
        cout << "First" << endl;
    }
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

const char *name[15]={
  "Rock",
  "Fire",
  "Scissors",
  "Snake",
  "Human",
  "Tree",
  "Wolf",
  "Sponge",
  "Paper",
  "Air",
  "Water",
  "Dragon",
  "Devil",
  "Lightning",
  "Gun"
};

int main(){
  map<string,int> m;
  REP(i,15) m[name[i]] = i;

  int n;
  while(cin>>n, n){
    bool win[15];
    bool exe[15];
    REP(i,15) win[i] = true;
    REP(i,15) exe[i] = false;
    REP(i,n){
      string str;
      cin >> str;
      assert(m.find(str) != m.end());
      int v = m[str];
      REP(j,7) win[(v+j+1)%15] = false;
      exe[v] = true;
    }
    bool ansed = false;
    REP(i,15) if(exe[i] && win[i]){
      bool tmp = false;
      REP(j,7){
        if(exe[(i+j+1)%15]){
          tmp = true;
          break;
        }
      }
      if(tmp){
        ansed = true;
        cout << name[i] << endl;
        break;
      }
    }
    if(!ansed){
      cout << "Draw" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 920
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n;
    int a[51];

    cin >> n;

    int ma = INT_MIN;
    int mi = INT_MAX;

    REP(i, n)
    {
        cin >> a[i];
        ma = max(ma, a[i]);
        mi = min(mi, a[i]);
    }

    if (ma > 0 && 0 > mi)
    {
        cout << 2 * n - 1 << endl;

        if (ma > -mi)
        {
            int i = 0;
            while (a[i] != ma)
                i++;

            REP(j, n)
            {
                cout << i + 1 << " " << j + 1 << endl;
                a[j] += ma;
            }
        }
        else
        {
            int i = 0;
            while (a[i] != mi)
                i++;

            REP(j, n)
            {
                cout << i + 1 << " " << j + 1 << endl;
                a[j] += mi;
            }
        }
    }
    else
    {
        cout << n - 1 << endl;
    }

    bool c = false;

    REP(i, n)
    c |= a[i] < 0;

    if (c)
    {
        for (int i = n - 1; i > 0; i--)
            cout << i + 1 << " " << i << endl;
    }
    else
    {
        for (int i = 2; i <= n; i++)
            cout << i - 1 << " " << i << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int A[2000000],B[2000000];
int n,C[10000];
void CountingSort(int A[],int B[],int k){
    for(int i=0;i<k;i++){
        C[i]=0;
    }
    
    for(int j=1;j<=n;j++){
        C[A[j]]++;
    }
    
    for(int i=1;i<k;i++){
        C[i]+=C[i-1];
    }
    
    for(int j=n;j>0;j--){
        B[C[A[j]]]=A[j];
        C[A[j]]--;
    }
    return ;
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>A[i];
    CountingSort(A,B,10000);
    for(int i=1;i<=n;i++){
        cout<<B[i];
        if(i!=n) cout<<" ";
    }
    cout<<endl;
    return 0;
}



Measured memory_bytes: 18716
#include <bits/stdc++.h>
#define endl '\n'
#define sync_cin                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
using namespace std;

#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;



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

    vector<int> h(n);
    for (int i = 0; i < n; i++) cin >> h[i];

    int ans = 1;
    int maxi = h[0];
    for (int i = 1; i < n; i++)
        if (h[i] >= maxi) 
        {
            ans++;
            maxi = h[i];
        }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
  System.out.print("Christmas");
  for(int i = 0;i < 25-n;i++){
    System.out.print(" Eve");
  }
  System.out.println("");
}}

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

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll left = a + b + ll(sqrtl(a*b)*2);
    if (left < c) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

const int MAXN = 200001;

int n;
int p[MAXN];
vector<int> nxt[MAXN];
vector<int> cycle;

int vis[MAXN];
void find_cycle(int v) {
	vis[v] = 1;
	for(int w : nxt[v]) {
		if(vis[w] == 1) {
			cycle.push_back(w);
		}	
		if(!vis[w]) find_cycle(w);
	}
	vis[v] = 2;
}

bool marked[MAXN];
int mark[MAXN];
bool in_cycle[MAXN];

void build(int v) {
	set<int> used;
	for(int w : nxt[v]) {
		if(in_cycle[w]) continue;
		build(w);
		used.insert(mark[w]);
	}		
	for(int x = 0;; x++) {
		if(used.find(x) == used.end()) {
			mark[v] = x;
			break;
		}
	}
	marked[v] = used.size() > 0;
}



int main() {
	
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> p[i];
		nxt[p[i]].push_back(i);
	}
	
	for(int v = 1; v <= n; v++) {
		if(!vis[v]) find_cycle(v);
	}
	
	in_cycle[cycle[0]] = 1;
	
	for(int i = 0; i < (int)cycle.size(); i++) {
		int pv = p[cycle[i]];
		if(pv != cycle[0]) {
			cycle.push_back(pv);
			in_cycle[pv] = 1;
		}
	}
	
	for(int v : cycle) {
		build(v);
	}
	
	int m = cycle.size();
	for(int i = 0; i < m; i++) cycle.push_back(cycle[i]);

	int pv = 0;
	for(int v : cycle) {
		if(marked[v]) pv = v;
	}
		
	if(!pv && (n&1)) {
		cout << "IMPOSSIBLE\n";
		return 0;
	}
	
	int v = p[pv];
	for(int i = 0; i < 3*m; i++) {
		int pmark = mark[v];
		set<int> used;
		for(int w : nxt[v]) used.insert(mark[w]);
		for(int x = 0;; x++) {
			if(used.find(x) == used.end()) {
				mark[v] = x;
				break;
			}
		}
			
		if(i > 2*m && mark[v] != pmark) {
			cout << "IMPOSSIBLE\n";
			return 0;
		}
		v = p[v];
	}
	
	
	cout << "POSSIBLE\n";
	
	return 0;
}

Measured memory_bytes: 22900
#include<stdio.h>
int main(){
  int i,j=100,n;
  scanf("%d",&n);
  for(i=1;i<10;i++){
    if(n%i==0)
      j=n/i;
    
    if(j < 10)
      break;
  }
  if(i==10)
    printf("No");
  else
    printf("Yes");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
const int magic = 2500;
const long long inf = 4e18;
 
bool np[magic];
vector<int> prm;
 
void sieve() {
	np[0] = np[1] = 1;
	for (int i = 2; i < magic; ++i) if (!np[i]) {
		prm.push_back(i);
		for (int j = i + i; j < magic; j += i) np[j] = 1;
	}
}
 
int n;
long long a[100005];
map<long long,int> f, was;
 
void calc(int id) {
	for (int x : prm) {
		long long cub = 1ll * x * x * x;
		if (cub > a[id]) break;
		while (a[id] % cub == 0) a[id] /= cub;
	}
}
 
long long mul(long long x,long long y) {
	if (x > inf / y) return inf;
	return x * y;
}
 
long long needMul(long long x) {
	long long ret = 1;
	for (int v : prm) if (x % v == 0) {
		int cnt = 0;
		while (x % v == 0) cnt++, x /= v;
		for (int i = 1; i <= 3 - cnt; ++i) {
			ret = mul(ret, v);
		}
	}
	long long y = sqrt(x);
	if (y * y == x) ret = mul(ret, y);
	else ret = mul(ret, mul(x, x));
	return ret;
}
 
int main() {
	ios_base::sync_with_stdio(false);
	sieve();
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i], calc(i);
		f[a[i]]++;
	}
	
	int ans = f.count(1);
	for (int i = 1; i <= n; ++i) if (a[i] != 1 && !was.count(a[i])) {
		long long tmp = needMul(a[i]);
		if (f.count(tmp)) {
			ans += max(f[a[i]], f[tmp]);
			was[tmp] = 1;
		} 
		else {
			ans += f[a[i]];
		}
		was[a[i]] = 1;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 13568
#include <iostream>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int solve(const int n)
{
  int ret = 1;
  while (true) {
    if (ret * ret > n) {
      return (ret - 1) * (ret - 1);
    }
    ret++;
  }
}

int main()
{
  int n;
  cin >> n;
  cout << solve(n) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

int main(){
    int N, M;
    cin >> N >> M;
    int ans = (1 << M) - 1;
    for(int i = 0; i < N; i++){
        int K;
        cin >> K;
        int like = 0;
        for(int j = 0; j < K; j++){
            int A;
            cin >> A;
            A--;
            like += (1 << A);
        }
        ans &= like;
    }
    cout << bitcount(ans) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int N; cin >> N;
  int ans = 0;
  for(int i = 1; i <= N; i++){
    int cnt = 0, tmp = i;
    while(tmp != 0){
      cnt++; tmp /= 10;
    }
    if(cnt % 2 != 0) ans++;
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
    string A, B, C;
    cin >> A >> B >> C;

    if (A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) puts("YES");
    else puts("NO");

    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
input = sys.stdin.readline

n, k = map(int, input().split())
*a, = map(int, input().split())
*f, = map(int, input().split())

a_sort = np.array(sorted(a))
f_sort = np.array(sorted(f, reverse=True))

def check(x):
    cost = np.maximum(0, a_sort-x//f_sort).sum()
    return cost <= k

left = -1
right = 10**12

while left+1 < right:
    mid = (left+right)//2
    if check(mid):
        right = mid
    else:
        left = mid
print(right)



Measured memory_bytes: 43524
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    vector<vector<char>> C(2,vector<char>(3));
    rep(i,2){
        rep(j,3) cin >> C.at(i).at(j);
    }
    if(C.at(0).at(0)==C.at(1).at(2)&&C.at(0).at(1)==C.at(1).at(1)&&C.at(0).at(2)==C.at(1).at(0))cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>

#define HW 160
using namespace std;

int main(int argc, char const *argv[])
{
	int h,w;

	map<int,set<pair<int,int> > > mp;

	for(int i1=1;i1<HW;i1++){
		for(int i2=i1+1;i2<HW;i2++){
			mp[i1*i1+i2*i2].insert(make_pair(i1,i2));
		}
	}

	while(1){
		cin>>h>>w;
		if(h+w==0) break;

		map<int,set<pair<int,int> > >::iterator it=mp.lower_bound(h*h+w*w);
		if(it!=mp.end()) {
			set<pair<int,int> >::iterator is=(*it).second.upper_bound(make_pair(h,w));

			if(is!=(*it).second.end()) {
				cout<<(*is).first<<" "<<(*is).second<<endl;
			}
			else {
				it++;
				is=(*it).second.begin();
				cout<<(*is).first<<" "<<(*is).second<<endl;	
			}
		}


	}
	return 0;
}

Measured memory_bytes: 2604
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
using namespace std;

int main() {
    string A, B, C;
    cin >> A >> B >> C;
    if(A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

int main(){
    int N,a=0,sum=0;
    cin>>N;
    vector<int> p(N);
    for(int i=0;i<N;i++){
        cin>>p[i];
        a=max(a,p[i]);
        sum+=p[i];
    }

    cout<<sum-a/2<<endl;
}

Measured memory_bytes: 256
// ABC178B - 

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

typedef unsigned long long int ull;
typedef long long int ll;

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

	ll ans = -1000000000000000000;

	ans = max(ans, a * c);
	ans = max(ans, a * d);
	ans = max(ans, b * c);
	ans = max(ans, b * d);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<int, int>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin, n, m;
    vector<int> a(n);
    int sum = 0;
    REP(i, 0, n) {
        cin, a[i];
        sum += a[i];
    }
    int cnt = 0;
    REP(i, 0, n) {
        cnt += (4 * m * a[i] >= sum);
    }
    cout << (cnt >= m ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifndef LOCAL
#pragma GCC optimize(3)
#define lld "%lld"
#else
#define lld "%I64d"
#endif
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int maxn=1e5;
ll p[maxn];
bool vis[maxn];
map<ll, int>cnt;
int pCnt;
void init() {
    for (int i=2; i<maxn; i++) {
        if (!vis[i]) p[pCnt++]=i;
        for (int j=0; j<pCnt && p[j]*i<maxn; j++) {
            vis[i*p[j]]=1;
            if (i%p[j]==0) break;
        }
    }
}
ll da1[maxn], da2[maxn];
void deal(int id) {
    ll ans1=1, ans2=1;
    ll tmp=da1[id];
    for (int i=0; p[i]*p[i]*p[i]<=tmp; i++) {
        int tot=0;
        while (tmp%p[i]==0) {
            tot++;
            tmp /= p[i];
        }
        tot%=3;
        if (tot==1) {
            ans1*=p[i];
            ans2*=p[i]*p[i];
        } else if (tot==2) {
            ans1*=p[i]*p[i];
            ans2*=p[i];
        }
    }
    ll sqrTmp=sqrt(tmp);
    if (sqrTmp*sqrTmp==tmp) {
        ans1*=tmp;
        ans2*=sqrTmp;
    } else {
        ans1*=tmp;
        ans2*=tmp*tmp;
    }
    da1[id]=ans1; da2[id]=ans2;
    cnt[ans1]++;
}
int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    int n; 
    init();
    scanf("%d", &n);
    for (int i=0; i<n; i++) {
        scanf(lld, da1+i);
        deal(i);
    }
    int ans=0;
    if (cnt[1]) ans++, cnt[1]=0;
    for (int i=0; i<n; i++) {
        ans += max(cnt[da1[i]], cnt[da2[i]]);
        cnt[da1[i]]=cnt[da2[i]]=0;
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 14464
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            
            String strSplit[] = br.readLine().split("/");
            StringBuffer sb = new StringBuffer();
            sb.append("2018/").append(strSplit[1]).append("/").append(strSplit[2]);
            
            System.out.println(sb);
            
        }catch(Exception e){
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 32628
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <int, ii> iii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
#ifdef VC
#define scanf scanf_s
#endif
#define iINF (1<<30)
#define INF (1LL<<59)
#define forn(i) for(int i = 0;i < n; ++i)
#define form(i,n) for(int i = 0 ;i < n; ++i)
#define NIL -1

const int mod = 1e9+7;
int n;
ll a[200000+10];
map<ll, int> mp;

int main(){
	cin >> n;
	a[0] = 0;
	mp[0]++;
	for (int i = 1; i <= n;i++) {
		cin >> a[i];
		a[i] += a[i - 1];
		mp[a[i]]++;
	}
	ll ans = 0LL;
	for (int i = 0; i <= n; i++) {
		ans += mp[a[i]]-1;
	}
	cout << ans / 2LL << endl;
	return 0;
}

Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
#define LL long long
int main()
{
	string s,c;
	cin>>s>>c;
	int ans=0;
	int l=s.length();
	for(int i=0;i<l;i++)
	{
		if(s[i]!=c[i])ans++;
	}
	cout<<ans<<endl;
}

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

int main (){
	string O,E;
	cin >> O >> E;
  if(O.size() == E.size()){
	for(int i=0;i<O.size();i++){
		cout << O.at(i) << E.at(i) ;
	}
    cout << endl;
    return 0;
  }
  else {
    for(int i=0;i<E.size();i++){
      cout << O.at(i) << E.at(i);
    }
    cout << O.at(O.size()-1) << endl;
    return 0;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	int n, a, b;
	cin>>n>>a>>b;
	vi t(n);
	int ans = 0;
	rep(i, n){
		cin>>t[i];
		if(a<=t[i]&&t[i]<b);
		else ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
object Main extends App {
  val src: List[Int] = io.Source.stdin.getLines.map(_.toInt).toList

  val countedList: List[Int] = (for (i <- 1 to src.max) yield (src.count(_ == i))).toList

  println(countedList.zipWithIndex.collect { case (a, b) if a == countedList.max => b + 1 }.mkString("\n"))
}

Measured memory_bytes: 44184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long MOD = 998244353;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

template< typename T >
T mod_pow(T x, T n) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= MOD;
    (x *= x) %= MOD;
    n >>= 1;
  }
  return ret;
}

void solve(long long N, long long M, long long K){
    COMinit();
    ll ans = 0;
    for(int i=0;i<=K;i++){
        ll temp  = ((M * COM(N-1,i)) %MOD) * mod_pow(M-1,N-1-i);
        temp %= MOD;
        ans += temp;
        ans %= MOD;
    }
    cout << ans << endl;

}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long K;
    scanf("%lld",&K);
    solve(N, M, K);
    return 0;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> map(H,vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++)
    {cin >> map.at(i).at(j);}
  }
  vector<int> Wind,Hind;
  for (int i=0;i<H;i++){
    int Wcount=0;
    for (int j=0;j<W;j++){
      if(map.at(i).at(j)=='.')Wcount++;
    }
    if(Wcount==W){
      for (int j=0;j<W;j++){
          map.at(i).at(j)='x';
        }}
  }
  for (int i=0;i<W;i++){
    int Hcount=0;
    for (int j=0;j<H;j++){
      if(map.at(j).at(i)!='#')Hcount++;
    }
    if(Hcount==H){
      for (int j=0;j<H;j++){
          map.at(j).at(i)='x';
        }
      }
  }

  for (int i=0;i<H;i++){
    int xflag=0;
    for (int j=0;j<W;j++){
    if(map.at(i).at(j)!='x'){
    cout<<map.at(i).at(j);
  }else xflag++;
    if(j==W-1){
      if(xflag<W)cout<<endl;
    }


    }
  }

}


Measured memory_bytes: 256
n, k = map(int, input().split())
R, S, P = map(int, input().split())
t = input()
prev = {}

ans = 0
for i in range(k):
    if t[i] == 'r':
        ans += P
        prev[i] = 'p'
    elif t[i] == 's':
        ans += R
        prev[i] = 'r'
    elif t[i] == 'p':
        ans += S
        prev[i] = 's'

for i in range(k, n):
    a = i % k
    if t[i] == 'r':
        if prev[a] != 'p':
            ans += P
            prev[a] = 'p'
        else:
            if i + k < n and t[i + k] != 's':
                prev[a] = 'r'
            else:
                prev[a] = 's'
    elif t[i] == 's':
        if prev[a] != 'r':
            ans += R
            prev[a] = 'r'
        else:
            if i + k < n and t[i + k] != 'p':
                prev[a] = 's'
            else:
                prev[a] = 'p'
    elif t[i] == 'p':
        if prev[a] != 's':
            prev[a] = 's'
            ans += S
        else:
            if i + k < n and t[i + k] != 'r':
                prev[a] = 'p'
            else:
                prev[a] = 'r'
print(ans)

Measured memory_bytes: 19184
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main(void)
{
  int x,k;

  cin >> k >> x;

  if(k == 1) cout << x << endl;
  else{
    for(int i = x - (k - 1);i != x + k;i++){
      cout << i << ' ';
    }
  }
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    A = sorted(map(int, input().split()), reverse=True)
    print(A[0] + sum(A[1:(N - 2) // 2 + 1]) * 2 + A[(N - 2) // 2 + 1] * (N % 2))


if __name__ == "__main__":
    main()


Measured memory_bytes: 94396
#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-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define INF 999999999

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef unordered_map<ll, ll> ump;

const ll mod = 1e9+7;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<LP> ab(n);
	vector<LP> cd(n);
	REP(i, n){cin >> ab[i].first >> ab[i].second;}
	REP(i, n){cin >> cd[i].first >> cd[i].second;}
	sort(cd.begin(), cd.end());
	vector<bool> used(n, false);
	ll ans = 0;
	REP(i, n){
		ll temp = -1; // 条件を満たすabの最大値
		ll k = -1;
		REP(j, n){
			if ((!used[j]) && (cd[i].first > ab[j].first) && (cd[i].second > ab[j].second)){
				if (ab[j].second > temp){
					temp = ab[j].second;
					k = j;
				}
			}
		}
		if (k >= 0){
		ans++;
		used[k]=true;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+20;
int n,m;
vector<int> e[N];
//题意:n<=1e5的图 找到path满足 每个点只经过一次 && 和endpoint相邻的点都包含在路径中
//任意两个点作为endpoint,若 
int q[N],f,r; //deque,保存起点和终点 
int vis[N];
int check(int u)
{
	for(int i=0;i<e[u].size();i++)
	{
		int v=e[u][i];
		if(!vis[v])
			return v;//更改v作为起点 
	}
	return -1;	
}
int main()
{
	while(cin>>n>>m)
	{
		bool flag=true;//first
		for(int i=1;i<=n;i++)
			e[i].clear(),vis[i]=0;
		int u,v;
		f=1e5;//
		r=1e5+1;
		while(m--)
		{
			scanf("%d%d",&u,&v);
			e[u].push_back(v);
			e[v].push_back(u);
			if(flag)
			{
				flag=false;
				vis[u]=vis[v]=1;
				q[f]=u;
				q[r]=v;		
			}
		}
	
		while(true)
		{
			int u=check(q[f]);
			if(u==-1)
				break;
			else
			{
				q[--f]=u;
				vis[u]=1;
			}
		}
		while(true)
		{
			int u=check(q[r]);
			if(u==-1)
				break;
			else
			{
				q[++r]=u;
				vis[u]=1;
			}
		}
		cout<<r-f+1<<endl;
		while(f<=r)
			printf("%d ",q[f++]);
		cout<<endl;	
	}
	return 0;
}

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

int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='A'&&s[i+1]=='C'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
map<ll,int> s;
map<ll,bool> h;
const int maxn=100000+10,maxd=2200;
int id[maxn],pri[maxn],f[maxn],p[maxn][2],sta[maxn];
ll a[maxn],b[maxn];
bool bz[maxn];
int i,j,l,n,m,tot,top,cnt,ans,ca;
ll k,t;
int main()
{
	fo(i,2,maxn-10)
	{
		if (!bz[i]) pri[++top]=i,f[i]=i;
		fo(j,1,top)
		{
			if ((ll)i*pri[j]>maxn-10) break;
			bz[i*pri[j]]=1;
			f[i*pri[j]]=pri[j];
			if (i%pri[j]==0) break;
		}
	}
	scanf("%d",&n);
	fo(i,1,n)
	{
		scanf("%lld",&a[i]);
		k=a[i];
		a[i]=b[i]=1;
		fo(j,2,maxd)
		{
			if (k==1) break;
			if (bz[j]) continue;
			t=(ll)j*j*j;
			while (k%t==0) k/=t;
			t=j*j;
			if (k%t==0)
			{
				a[i]*=t;
				b[i]*=j;
			}
			else if (k%j==0)
			{
				a[i]*=j;
				b[i]*=t;
			}
			while (k%j==0) k/=j;
		}
		if (k>1)
		{
			t=ll(sqrt(k));
			if (t*t==k)
			{
				a[i]*=k;
				b[i]*=t;
			}
			else
			{
				a[i]*=k;
				b[i]*=k*k;
			}
		}
	}
	fo(i,1,n) s[a[i]]++;
	fo(i,1,n)
	if (!h[a[i]])
	{
		h[a[i]]=1;
		if (a[i]==b[i]) ans++;
		else
		{
			ans+=max(s[a[i]],s[b[i]]);
			h[b[i]]=1;
		}
	}
	printf("%d\n",ans);
}

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

using namespace std;

int main()
{
	int a, b, c;
    cin >> a >> b >> c;
    if((a==b && b==c) || (a!=b && b!=c && c!=a)) {
    cout << "No" << endl;}
   
    else{ cout <<"Yes" << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        int score = 0;
        for (int i = 0; i < s.Length; ++i)
        {
            if ((i & 1) == 0)
            {
                score += s[i] == 'g' ? 0 : -1;
            }
            else
            {
                score += s[i] == 'g' ? 1 : 0;
            }
        }
        Console.WriteLine(score);
    }
}


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

using namespace std;

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

	if ((a + b) % 2 == 0) {
		cout << (a + b) / 2 << endl;
	}
	else {
		cout << (a + b) / 2 + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import math
N,D = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for _ in range(N)]
n = 0 
for i in range(N-1):
    for j in range(i+1, N):
        dis = math.sqrt(sum([(xi-xj)**2 for xi,xj in zip(X[i], X[j])]))
        if dis == math.floor(dis):
            n+=1
print(n)

Measured memory_bytes: 3060
#include<stdio.h>

int main(void){
  int i,num;
  int s,sums=0;
  int m;

  for(i=0;i<4;i++){
    scanf("%d",&s);
    sums+=s;
  }
  m=sums/60;
  sums%=60;
  printf("%d\n%d\n",m,sums);

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
unordered_map<int,int>mp;
int main(){
	int n;cin>>n;
	for(int i=1;i<=n;i++){
		int x=i; 
		for(int j=2;j*j<=x;j++){
			if(x%j==0){
				while(x%j==0) mp[j]++,x/=j;
			}
		}
		if(x!=1) mp[x]++;
	}
	ll ans=1;
	for(auto p:mp){
		ans=ans*(p.se+1)%mod;
	}
	printf("%lld\n",ans%mod);
	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    ll a, b;
    cin >> n >> a >> b;
    ll town[n];
    rep(i, n) cin >> town[i];
    ll sum = 0;
    rep(i, n - 1)
    {
        sum += min((town[i + 1] - town[i]) * a, b);
    }

    OP(sum);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    ll a;long double b;cin>>a>>b;
    ll bb=round(b*100);
    ll res=a*bb;
    res/=100;
    cout<<res<<endl;
}


Measured memory_bytes: 3768
#!/usr/bin/env python
from collections import deque, defaultdict

def comb(a, b):
    result = 1
    for i in range(b):
        result *= (a - i) / (i + 1)
    return result


def main():
    N = int(input())

    counter = defaultdict(int)

    max_value = 0
    for i in range(N):
        S = input().strip()
        counter[S] += 1

        if max_value < counter[S]:
            max_value = counter[S]

    most_freq_string = []
    for S in counter:
        if counter[S] == max_value:
            most_freq_string.append(S)

    most_freq_string = sorted(most_freq_string)
    for S in most_freq_string:
        print(S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 99416
#include "bits/stdc++.h"
#include <random>
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define SQR(X)  ( (X)*(X) )
#define CUBE(X) ( (X)*(X)*(X) )
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;
 
 
void reader(int &a){scanf("%d",&a);}
void reader(double &a){scanf("%lf",&a);}
void reader(char a[]){scanf("%s",a);}
void reader(ll &a){scanf("%lld",&a);}
void reader(ull &a){scanf("%llu",&a);}
// void reader(string& a){cin >> a;};
template<class T,class U> void reader(T& t,U& u){reader(t); reader(u);}
template<class T,class U,class V> void reader(T& t,U& u,V& v){reader(t); reader(u); reader(v);}
 
void writer(int a,char c) {printf("%d",a); putchar(c);}
void writer(ll a,char c) {printf("%lld",a); putchar(c);}
void writer(double a,char c) {printf("%.20lf",a); putchar(c);}
void writer(char a[]) {printf("%s",a);};
void writer(char a[],char c) {printf("%s",a);putchar(c);};
void writer(char a,char c) {putchar(a); putchar(c);};
template<class T>void writerLn(T t){writer(t,'\n');}
template<class T,class U>void writerLn(T t,U u){writer(t,' ');writer(u,'\n');}
template<class T,class U,class V> void writerLn(T t,U u,V v){writer(t,' ');writer(u,' ');writer(v,'\n');}
template<class T> void writerArr(T x[], int n){int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');}
template<class T> void writerVec(vector<T> x){int n=x.size();int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');}
 
vector<std::string> split(const std::string &str, char sep){std::vector<std::string> v;std::stringstream ss(str);std::string buffer;while(std::getline(ss,buffer,sep)){v.push_back(buffer);}return v;}
 
// #define int ll
bool test = 1;
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };

//..................
ull mod = (int)1e9 + 7;
signed main(){
  int i,j,k,l;
  string s;
  while(1) {
	int N,K;
	vector<int> connect[100];
	int l[100];
	cin >> N;
	if(N == 0) return 0;
	rep(i,N) {
	  int M;
	  cin >> M;
	  rep(j,M) {
		int p;
		cin >> p;
		connect[i].push_back(p);
	  }
	}
	cin >> K;
	rep(i,K) cin >> l[i];
	int ans = -1;
	rep(i,N) {
	  bool correct = true;
	  rep(j,K) {
		rep(k,connect[i].size()) {
		  if(connect[i][k] == l[j]) break;
		}
		if(k == connect[i].size()) correct = false;
	  }
	  if(ans != -1 && correct) {
		ans = -1;
		break;
	  }
	  else if(ans == -1 && correct) ans = i;
	}
	if(ans == -1) cout << -1 << endl;
	else cout << ans+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 3184
a,b = map(int,input().split())
s = input()
if len(s) == a + b + 1:
    if s[a] == "-":
        s = s.replace("-","")
        if s.isdecimal() and len(s) == a + b:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 9168
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define ioi exit(0);
 
#define f first
#define s second
 
#define inf (ll)1e18 + 7
 
#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
 
#define mp(x,y) make_pair(x,y)
 
#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)
 
#define pb push_back
#define ppb pop_back
 
#define bitcoin __builtin_popcount
 
#define endl "\n"
 
#define in(x) insert(x)
 
#define sz(x) (int)x.size()
 
#define all(x) x.begin(),x.end()
 
#define pw2(x) (1ll<<x) //2^x
 
#define forit(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it)
 
#define sqr(x) ((x) * 1ll * (x))
 
#define UpdateRandom srand (time(NULL));
 
using namespace std;
 
const int N = (int)5e5 + 7, MOD = (int)1e9 + 7;

ll n,W;
ll w[N],v[N],dp[N];
bool was[N];
int main(){
		
	NFS

	cin >> n >> W;
	
	for(int i=1;i<=n;i++){
		cin >> w[i] >> v[i];
	}
	
	memset(dp,-1,sizeof(dp));
	
	dp[0]=0;
	
	for(int i=1;i<=n;i++){
		for(int j=(int)1e5;j>=v[i];j--){
			if(dp[j-v[i]]!=-1){
				was[j]=1;
				if(dp[j]==-1)dp[j]=dp[j-v[i]]+w[i];
				else dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
			}
		}
	}
	
	ll ans=0;
	
	for(int i=(int)1e5;i>=1;i--){
		if(was[i] && dp[i]<=W){
			ans=i;
			break;
		}
	}

	cout << ans << endl;
	
	//cout << dp[W] << endl;
	
	ioi
}

Measured memory_bytes: 8064