akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;

namespace AOJ
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Trim().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }


        //15.5最小全域木 kruskal
        static long kruskal(int N, List<Edge> edges)
        {
            int totalcost = 0;
            edges.Sort((l, r) => l.cost - r.cost);
            DisjointSet dest = new DisjointSet(N);
            for (var i = 0; i < edges.Count; ++i)
            {
                if (!dest.same(edges[i].source, edges[i].target))
                {
                    totalcost += edges[i].cost;
                    dest.unite(edges[i].source, edges[i].target);
                }
            }
            return totalcost;
        }

        static void Main(string[] args)
        {
            var VE = Sarray();
            var V = VE[0];
            var E = VE[1];

            var edges = new List<Edge>();
            for (var i = 0; i < E; ++i)
            {
                var stw = Sarray();
                edges.Add(new Edge((int)stw[0], (int)stw[1], (int)stw[2]));
            }
            WriteLine(kruskal((int)V,edges));
        }
        public struct Edge
        {
            public int source, target, cost;
            public Edge(int s,int t, int c)
            {
                source = s;
                target = t;
                cost = c;
            }
        }
        public class DisjointSet
        {
            int[] p, rank;
            public DisjointSet(int n)
            {
                p = new int[n];
                rank = new int[n];
                for (var i = 0; i < n; ++i)
                    makeSet(i);
            }
            public void makeSet(int x)
            {
                p[x] = x;
                rank[x] = 0;
            }
            public bool same(int x, int y)
            {
                return findSet(x) == findSet(y);
            }
            public void unite(int x, int y)
            {
                link(findSet(x), findSet(y));
            }
            void link(int x, int y)
            {
                if (rank[y] < rank[x])
                { p[y] = x; }
                else
                {
                    p[x] = y;
                    if (rank[x] == rank[y])
                        ++rank[y];
                }
            }
            int findSet(int x)
            {
                if (x != p[x])
                    p[x] = findSet(p[x]);
                return p[x];
            }
        }
    }
}


Measured memory_bytes: 24940
#include <stdio.h>
int main()
{
    int n;
    int p[4][3][10] = {0};
    scanf("%d", &n);

    for (int i = 0; i < n; i++)
    {
        int b, f, r, v;
        scanf("%d %d %d %d ", &b, &f, &r, &v);
        p[b - 1][f - 1][r - 1] += v;
    }
    for (int b = 0; b < 4; b++)
    {
        for (int f = 0; f < 3; f++)
        {
            for (int r = 0; r < 10; r++)
            {
                printf(" %d", p[b][f][r]);
            }
            printf("\n");
        }
        if(b != 3){
        printf("####################\n");
    }
    }
    return 0;
}


Measured memory_bytes: 2108
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = Integer.parseInt(sc.next());
        double hen = (double) l / 3;
        double ans = hen * hen * hen;
        System.out.println(ans);

        sc.close();
    }
}

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

int main() {
  int h, w, k, ans = 0;
  cin >> h >> w >> k;

  char c[10][10];
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) cin >> c[i][j];
  }

  for (int i = 0; i < (1 << h); i++) {
    bitset<6> hh(i);
    for (int j = 0; j < (1 << w); j++) {
      bitset<6> ww(j);
      int num = 0;
      for (int ii = 1; ii <= h; ii++) {
        for (int jj = 1; jj <= w; jj++) {
          if (hh.test(ii - 1) && ww.test(jj - 1) && c[ii][jj] == '#') num++;
        }
      }
      if (num == k) ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3596
#入力受け取り
N, K, C=map(int, input().split())
S='x'+input() #インデックスと日数を合わせるために先頭に'x'を追加

#前詰めな働き方の場合で働く日を求める
A=[] #前詰めで働く場合の働く日リスト
i=1 #1日目から判定スタート
while len(A)<K:
  if S[i]=='o':
    #i日目に働けるなら、リストにiを追加し、iをC+1だけ進める
    A.append(i)
    i+=(C+1)
  else:
    #i日目に働けないならその日は働けないので(小泉構文)、iに1足すのみ
    i+=1
    
#後ろ詰めな働き方の場合で働く日を求める
B=[]
i=N #N日目から判定スタート
while len(B)<K:
  if S[i]=='o':
    #i日目に働けるなら、リストにiを追加し、iをC+1だけ戻す
    B.append(i)
    i-=(C+1)
  else:
    #i日目に働けないならその日は働けないので(小泉構文)、iから1引くのみ
    i-=1
    
B=B[::-1] #Bは降順に追加されているので、昇順にする
for i in range(K):
  #i番目に働くのが前詰めと後ろ詰めで同じ日であれば出力
  if A[i]==B[i]:
    print(A[i])



Measured memory_bytes: 20836
A,B,C,X,Y=map(int,input().split())
if X>=Y:
    if C<A/2:
        print(2*X*C)
    elif C<(A+B)/2:
        print(2*Y*C+(X-Y)*A)
    else:
        print(X*A+Y*B)
else:
    if C<B/2:
        print(2*Y*C)
    elif C<(A+B)/2:
        print(2*X*C+(Y-X)*B)
    else:
        print(X*A+Y*B)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
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; }
using Graph = vector<vector<int>>;
struct edge{int from,to,cost;};
signed main(){
  int a;
  cin>>a;
  vector<int> b(a);
  rep(i,a)
    cin>>b[i];
  vector<int> c(200010,0);
  rep(i,a){
  c[b[i]-1]++;
  }
  int d=0;
  rep(i,200010){
  d+=c[i]*(c[i]-1)/2;
  }
  rep(i,a){
    cout<<d-c[b[i]-1]+1<<endl;
  }
    
}

Measured memory_bytes: 5760
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>

inline void read(int &T) {
	int x=0;bool f=0;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=!f;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	T=f?-x:x;
}

int x,y;

int main() {
	read(x),read(y);
	for(int i=0;i<=x;++i) {
		int j=x-i;
		if(i*2+j*4==y) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> tree(n);
    for(int i=0;i<n;i++) cin>>tree[i];
    sort(tree.begin(),tree.end());
    
    long long ans=9999999999;
    for(int i=0;i<n-k+1;i++){
        ans=min(ans,(long long)tree[i+k-1]-(long long)tree[i]);
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
using namespace std;
const int N = 100001;
int main() {
	int A,B,C,a;
	scanf("%d%d%d",&A,&B,&C);
	if(B/A>C)a=C;
	else a=B/A;
	printf("%d",a);
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
int main(){
    ll n,k;
    cin >> n >> k;
    ll a[n];
    for(ll i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a,a+n);
    ll price = 0;
    for(ll i = 0; i < k; i++)
        price+=a[i];
    cout << price << '\n';
}


Measured memory_bytes: 3640
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

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

  int64_t H, W;
  cin >> H >> W;
  vector<vector<bool>> is_open(H, vector<bool>(W, true));
  int64_t count_black = 0;
  for (int64_t i = 0; i < H; ++i) {
    string s;
    cin >> s;
    for (int64_t j = 0; j < W; ++j) {
      const char ch = s.c_str()[j];
      if (ch == '#') {
        is_open[i][j] = false;
        ++count_black;
      }
    }
  }

  // BFS preparation
  queue<Pair> q;
  vector<vector<int64_t>> distances(H, vector<int64_t>(W, kInf));
  auto Update = [&](const Pair target, const int64_t distance) -> void {
    if (distances[target.first][target.second] != kInf) {
      return;
    }
    distances[target.first][target.second] = distance;
    q.emplace(target);
  };

  // BFS
  Update(Pair(0, 0), 0);
  const int64_t d_nexts[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
  while (!q.empty()) {
    const Pair target = q.front();
    q.pop();
    for (const auto &d : d_nexts) {
      const int64_t next_row = target.first + d[0];
      const int64_t next_col = target.second + d[1];
      if (next_row >= 0 && next_row < H && next_col >= 0 && next_col < W) {
        if (is_open[next_row][next_col]) {
          Update(Pair(next_row, next_col), distances[target.first][target.second] + 1);
        }
      }
    }
  }

  int64_t result = 0;
  if (distances[H - 1][W - 1] == kInf) {
    result = -1;
  } else {
    result = H * W - count_black - (distances[H - 1][W - 1] + 1);
  }
  cout << result << endl;
  return 0;
}


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

int main() {
	string s;
	cin >> s;

	if (s.at(0) == s.at(1) || s.at(1) == s.at(2) || s.at(2) == s.at(3)) {
		cout << "Bad" << endl;
	}
	else {
		cout << "Good" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int x,y,z,l=0,r,m;
  cin>>x>>y>>z;
  r=x/y+1;
  while(l+1<r){
    m=(l+r)/2;
    if(m*(y+z)+z<=x)l=m;
    else r=m;
  }
  cout<<l;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n,t,c,ti,min=0;
	scanf("%d %d",&n,&t);
	for(int i=0;i<n;i++){
		scanf("%d %d",&c,&ti);
		if(t>=ti){
			if(min==0||min>c){
				min=c;
			}
		}
	}
	if(min==0)printf("TLE\n" );
	else printf("%d\n", min);
	return 0;
}


Measured memory_bytes: 128
n, a, b = gets.strip.split.map(&:to_i)
ans = 0

def digest_sum(n)
  sum = 0
  while n > 0
    # 下一桁を加算
    sum += n % 10
    # 元の整数の下一桁を削除
    # 最後の一桁のときはnが0になるのでループが終了する
    n /= 10
  end
  sum
end

(1..n).each do |m|
  res = digest_sum(m)
  ans += m if a <= res && res <= b
end

puts ans

Measured memory_bytes: 1788
using System;

namespace ABC103_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] array = Console.ReadLine().Split(' ');
            int[] a = new int[array.Length]; 

            int max = a[0]; 
            
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = int.Parse(array[i]);
                if (max <= a[i])
                {
                    max = a[i];
                }
            }
            int min = a[0];
            for(int i = 0; i < a.Length; i++)
            {
                a[i] = int.Parse(array[i]);
                if (a[i] < min)
                {
                    min = a[i];
                     
                }
            }
            Console.WriteLine(max - min);
            
        }

    }
}


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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

struct SCC {
  private:
    const V<V<int>> &g;
    V<V<int>> gg, rg;
    V<int> comp, order;
    V<bool> used;
    inline void dfs(const int &idx) {
        if(used[idx]) return;
        used[idx] = true;
        for(const int &to : gg[idx])
            dfs(to);
        order.push_back(idx);
    }
    inline void rdfs(const int &idx, const int &cnt) {
        if(comp[idx] != -1) return;
        comp[idx] = cnt;
        for(const int &to : rg[idx])
            rdfs(to, cnt);
    }

  public:
    inline SCC(const V<V<int>> &g)
        : g(g), gg(g.size()), rg(g.size()), comp(g.size(), -1), used(g.size()) {
        for(int i = 0; i < g.size(); i++)
            for(const int &e : g[i]) {
                gg[i].emplace_back(e);
                rg[e].emplace_back(i);
            }
    }
    inline int operator[](const int &k) const { return comp[k]; }
    inline void build(V<V<int>> &t) {
        for(int i = 0; i < gg.size(); i++)
            dfs(i);
        reverse(order.begin(), order.end());
        int ptr = 0;
        for(const int &i : order)
            if(comp[i] == -1) {
                rdfs(i, ptr);
                ptr++;
            }
        t.resize(ptr);
        for(int i = 0; i < g.size(); i++)
            for(const int &to : g[i]) {
                int x = comp[i], y = comp[to];
                if(x == y) continue;
                t[x].push_back(y);
            }
    }
};

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

    int v, e, q;
    cin >> v >> e;
    V<V<int>> g(v), buff;
    rep(i, e) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
    }
    SCC scc(g);
    scc.build(buff);
    cin >> q;
    while(q--) {
        int a, b;
        cin >> a >> b;
        cout << (scc[a] == scc[b]) << endl;
    }

    return 0;
}


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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll n,y,i,j,ans[3]={-1,-1,-1},s;
	cin>>n>>y;
	for (i=0;i<=n;i++){
		for (j=0;j<=n-i;j++){
			s=i*10000+j*5000+(n-i-j)*1000;
			if (s==y){
				ans[0]=i;
				ans[1]=j;
				ans[2]=n-i-j;
				break;
			}
		}
	}
	cout<<ans[0]<<" "<<ans[1]<<" "<<ans[2];
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int val[]={0,1,2,4,7,12,20,29,38,52,73};
int n,p[20];long long mxv,ans[20][20];
int main()
{
	cin>>n;
	for(int i=2;i<=n;i++)
	{
		mxv=0;
		for(int j=1;j<i;j++) p[j]=j;
		do{
			long long s=0;
			for(int j=1;j<i-1;j++) s+=ans[p[j]][p[j+1]];
			mxv=max(mxv,s);
		}while(next_permutation(p+1,p+i));
		for(int j=1;j<i;j++) ans[i][j]=ans[j][i]=(mxv+1)*val[j];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++) printf("%lld ",ans[i][j]);
		putchar('\n');
	}
}

Measured memory_bytes: 3688
#include <iostream>
#include <vector>
#include <map>
using namespace std;

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int N;
map<long long, int> sisuu;

long long rec(map<long long, int>::iterator p, long long mul) {
    if (p == sisuu.end()) {
        if (mul == 1) return 1;
        else return 0;
    }
    long long res = 0;
    for (int i = 0; i < p->second + 1; ++i) {
        if (mul % (i+1) != 0) continue;
        res += rec(++p, mul / (i+1));
        --p;
    }
    return res;
}

int main() {
    cin >> N;
    for (int i = 2; i <= N; ++i) {
        auto ps = prime_factorize(i);
        for (auto it : ps) sisuu[it.first] += it.second;
    }
    cout << rec(sisuu.begin(), 75) << endl;
}


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

namespace competitive_programming
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            string[] words = new string[n];
            for(int i = 0;i < n;i++)
            {
                words[i] = Console.ReadLine();
            }

            var record = new List<string>();
            for(int i = 0;i < n;i++)
            {
                if (!record.Contains(words[i]) && (i == 0 || words[i][0] == words[i - 1][words[i - 1].Length - 1]))
                {
                    record.Add(words[i]);
                    continue;
                }
                else
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");
            return;

        }
    }

    struct Vector2
    {
        public Vector2(int x,int y)
        {
            this.x = x;
            this.y = y;
        }
        public int x;
        public int y;
    }

    struct Vector3
    {
        public int x;
        public int y;
        public int z;
    }
}


Measured memory_bytes: 11104
#include <bits/stdc++.h>
using namespace std;
int ABS(int a){return a>0?a:-a;}
int N,m[222222];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>N;
    int x=1;
    for(int i=0;i<N;i++){
        cin>>m[i];
        m[i]-=x;
        x++;
    }
    nth_element(m,m+N/2,m+N);
    long long ans=0;
    for(int i=0;i<N;i++)ans+=ABS(m[i]-m[N/2]);
    cout<<ans<<'\n';
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<int,pair<int,int>> iii;
typedef vector<pair<int,int>> vii;
typedef vector<vector<int>> vvi;

#define pb push_back
#define mp make_pair
#define fi first
#define se second

const int MAXN = 2e5+10;
ll a[MAXN];
ll eps = 2;
int n;

ll sad (ll b) {
    ll result = 0;
    for (int i = 1; i <= n; i++) {
        result += abs(a[i-1] - (b+i));
    }
    return result;
}

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

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

    ll lo = -1e10, hi = 1e10, result = 1e18;
    while (hi - lo > eps) {
        ll m1 = lo + (hi-lo) / 3;
        ll m2 = hi - (hi-lo+2) / 3;
        ll f1 = sad(m1);
        ll f2 = sad(m2);
/*
        cout << lo << " " << hi << " "
            << m1 << " " << m2 << " "
            << f1 << " " << f2 << endl;
*/
        if (f1 < f2) {
            hi = m2;
            result = min(result, f1);
        } else {
            lo = m1;
            result = min(result, f2);
        }
    }

    for (int i = -10; i <= 10; i++) {
        result = min(result, sad(lo+i));
    }
    cout << result << endl;

    return 0;
}


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

using namespace std;

int main() {

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    vector<int> a(n+1,0),dp(n+2,0);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    dp[1] = abs(a[1] - a[0]);

    for (int i = 0; i < n-1; i++) {

            dp[i + 1] = min(dp[i + 1], dp[i] + abs(a[i] - a[i + 1]));
            dp[i + 2] = dp[i] + abs(a[i] - a[i + 2]);
    }
    cout << dp[n - 1];

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,K;cin >> N >> K;
  vector<int> l(N);
  rep(i,N)cin >> l[i];
  sort(all(l),greater<int>());
  int sum = 0;
  rep(i,K) sum+=l[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
int a[110], b[110], c[110], d[110];

int V;
const int MAX_V = 210;
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(int u, int v) {
    G[u].push_back(v);
    G[v].push_back(u);
}

bool dfs(int v) {
    used[v] = true;
    for (int i = 0; i < G[v].size(); i++) {
	int u = G[v][i], w = match[u];
	if (w < 0 || (!used[w] && dfs(w))) {
	    match[v] = u;
	    match[u] = v;
	    return true;
	}
    }
    return false;
}

int bipartite_matching() {
    int res = 0;
    memset(match, -1, sizeof(match));
    for (int v = 0; v < V; v++) {
	if (match[v] < 0) {
	    memset(used, 0, sizeof(used));
	    if (dfs(v)) 
		res++;
	}
    }
    return res;
}

int solve() {
    V = 2 * n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i] < c[j] && b[i] < d[j]) {
                add_edge(i, j+n);
            }
        }
    }
    return bipartite_matching();
}

void input() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
    for (int i = 0; i < n; i++) cin >> c[i] >> d[i];
}

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

    input();
    cout << solve() << endl;
}


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

using Lint=long long;

Lint lcm(int a,int b)
{
   return (Lint)a*b/__gcd(a,b);
}

int main()
{
   int a,b; cin>>a>>b;
   cout<<lcm(a,b)<<endl;
   return 0;
}


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

int main() {
	// your code goes here
	int h,m,s,ss ;
	cin>>ss;
	h=ss/3600;
	m=(ss%3600)/60;
	s=ss%60;
	cout<<h<<":"<<m<<":"<<s<<endl;
	return 0;
}

Measured memory_bytes: 1164
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
      	int mnyHd = sc.nextInt();
      	int ckPr = sc.nextInt();
      	int dtPr = sc.nextInt();
      	
      	System.out.println((mnyHd - ckPr) %dtPr);
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 100010;
int q,n,len[N],val[N],ans[N],m;
void doit(int x,int v) {
  if (!x) return;
  int t = upper_bound(len+1,len+m+1,x) - len - 1;
  if (t == 0) ans[1] += v, ans[x+1] -= v;
  else {
    val[t] += (x / len[t]) * v;
    doit(x % len[t],v);
  }
}
signed main() {
  int x;
  scanf("%lld%lld",&n,&q);
  len[++m] = n;
  for (int i = 1 ; i <= q ; ++ i) {
    scanf("%lld",&x);
    while (m && len[m] >= x) -- m;
    len[++m] = x;
  }
  val[m] = 1;
  for (int i = m ; i >= 2 ; -- i) {
    val[i-1] += val[i] * (len[i] / len[i-1]);
    doit(len[i] % len[i-1],val[i]);
  }
  ans[1] += val[1];
  ans[len[1]+1] -= val[1];
  for (int i = 2 ; i <= n ; ++ i)
    ans[i] += ans[i-1];
  for (int i = 1 ; i <= n ; ++ i)
    printf("%lld\n",ans[i]);
  return 0;
}

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

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

	array<int, 4> d = {
		N / 1000 % 10,
		N / 100 % 10,
		N / 10 % 10,
		N % 10
	};

	if( d[0] == d[1] && d[0] == d[2] ) {
		cout << "Yes" << endl;
	}
	else if( d[1] == d[2] && d[1] == d[3] ) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdin);
    string str;
    while(cin>>str){
        if(str[2]==str[3] && str[4]==str[5])cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import sys
while 1:
	H,W=map(int,raw_input().split())
	if H==0 and W==0:
		break;
	else:
		for h in range(H):
			for w in range(W):
				if h == 0 or w == 0 or h == H-1 or w == W-1 :
					sys.stdout.write('#')
				else:
					sys.stdout.write('.')

			sys.stdout.write('\n')
	sys.stdout.write('\n')

Measured memory_bytes: 6400
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <functional>

using namespace std;

int main () {
    int n,count = 1;

    cin >> n;

    while(1){
        if(count * count > n){
            break;
        }
        count++;
    }

    cout << (count - 1) * (count - 1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

char judg(int, int, int);
int main() {
	char gd[BUFSIZ];

	int mid, lst, ret;

	int num;
	int i;
	for (i = 0; i < BUFSIZ - 1; i++) {

		fflush(stdin);
		scanf("%d %d %d", &mid, &lst, &ret);

		if (ret == -1 && mid == -1 && lst == -1)break;

		gd[i] = judg(mid, lst, ret);
		
	}
	gd[i] = '\0';
	num = i;

	for (i = 0; i < num; i++) {
		printf("%c\n", gd[i]);
	}
	

	return 0;
}
char judg(int m, int l, int r) {
	if (m == -1 || l == -1)return'F';

	int ml = m + l;
	if (ml >= 80)return'A';
	if (ml >= 65)return'B';
	if (ml >= 50)return'C';
	if (ml >= 30) {
		if (r >= 50)return'C';
		return'D';
	}
	return'F';
}

Measured memory_bytes: 2752
# coding: utf-8
# Here your code !
NM = map(int, raw_input().split(" "))
N = NM[0]
M = NM[1]
containRed = [True]
for i in xrange(N-1):
    containRed.append(False)

balles = [1]
for i in xrange(N-1):
    balles.append(1)

for i in xrange(M):
    xiyi = map(int, raw_input().split(" "))
    xi = xiyi[0] - 1
    yi = xiyi[1] - 1
    if containRed[xi]:
        if balles[xi] == 1:
            balles[xi] = 0
            containRed[xi] = False
            balles[yi] += 1
            containRed[yi] = True
        else:
            balles[xi] -= 1
            balles[yi] += 1
            containRed[yi] = True
    else:
        balles[xi] -= 1
        balles[yi] += 1
    
print sum(containRed)

Measured memory_bytes: 4360
n = int(input())
a_array = [int(x) for x in input().split()]
a_dict = {}

for a in a_array:
    a_dict.setdefault(a, 0)
    a_dict[a] += 1

if len(set(a_dict.keys())) == 1:
    print(1)
    exit()
# 種類数と枚数の関係
# 複数枚ある場合の他への影響？
# 2枚だったらほかの枚数が1枚減る
# 3枚だったら他への影響なし
# 4枚だったらほかの枚数が1枚減る
# 5枚だったら他への影響なし
# 6枚だったら他の枚数が1枚減る
# -> x//3+x%3の関係？

# 2枚ずつ減る(1枚残るため)


cnt = len(a_dict.keys())
tmp = 0
for a, a_num in a_dict.items():
    if a_num % 2 == 0:
        if tmp == 1:
            tmp = 0
        else:
            tmp += 1
    else:
        continue
else:
    print(cnt - tmp)


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

int dfs(vector<set<int>> &graph,bool visited[],int src,vector<int> &dp)
{
    if(visited[src])
    {
        return dp[src];
    }

    visited[src] = 1;
    // if(graph[src].size() == 0)
    // {
    //     return 1;
    // }
    int m = 0;
    for(int a : graph[src])
    {
        int b = dfs(graph,visited,a,dp);
        dp[a] = max(dp[a],b);
        m = max(m,b);
    }
    return m+1;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);

    // all the code goes here
    int n,m;cin>>n>>m;

    vector<set<int>> graph(n);
    vector<int> dp(n,0);

    for(int i = 0; i < m; i++)
    {
        int src,dest;cin>>src>>dest;src--,dest--;
        graph[src].insert(dest);
    }

    bool visited[n];
    memset(visited,0,sizeof(visited));

    for(int i = 0; i < n; i++)
    {
        if(!visited[i])
        {
            int v = dfs(graph,visited,i,dp);
            dp[i] = max(dp[i],v);
        }
    }

    int mv = *max_element(dp.begin(),dp.end());
    cout<<mv-1<<"\n";

    return 0;
}

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

int main() {
    int n, m; cin >> n >> m;
    long long h[100000+10] = {};
    for (int i = 1; i <= n; i++) cin >> h[i];
    int a[100000+10] = {}, b[100000+10] = {};
    for (int i = 0; i < m; i++) cin >> a[i] >> b[i];

    int result[100000+10] = {};
    for (int i = 0; i < m; i++) {
        if (h[a[i]] > h[b[i]]) {
            result[b[i]] = -1;
        } else if (h[a[i]] < h[b[i]]) {
            result[a[i]] = -1;
        } else if (h[a[i]] == h[b[i]]) {
            result[a[i]] = -1;
            result[b[i]] = -1;
        }
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
        if (result[i] == 0) {
            res++;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 5584
#include <bits/stdc++.h>
using namespace std;
typedef bool boool;
typedef long long ll;
#define vl vector<ll>
#define vb vector<boool>
#define vs vector<string>
#define vp vector<pair<ll, ll>>
#define vvl vector<vector<ll>>
#define vvp vector<vector<pair<ll, ll>>>
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define rep1(i, n) for (long long i=0; i<(long long)(n); i++)
#define rep2(i, s, e) for (long long i=(s); i<(long long)(e); i++)
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

const ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}

int main(){
  fac[0] = 1;
  ifac[0] = 1;
  for(ll i = 0; i<300000; i++){
    fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
    ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
  }
  
  ll n;
  cin >> n;
  if(n<3){
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  rep(i, 1, 1000){
    if(3*i>n) continue;
    ll tmp = comb(n-3*i+i-1, i-1)%M;
    ans += tmp;
    ans %= M;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7800
n,m= map(int, input().split())
a = list(map(int, input().split()))
l=[]
for _ in range(m):
    b=list(map(int, input().split()))
    l.append(b)
l.sort(key = lambda x: x[1],reverse=True) 
for k in l:
    if(len(a)<=2*n):
        for j in range(k[0]):
            a.extend([k[1]])
a.sort(reverse=True)
print(sum(a[:n]))

Measured memory_bytes: 34896
#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long a = 0;a < b;++a)
#define ALL(x) (x).begin(),(x).end()
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}
long long judge(long long n, long long now) {
    long long value = 0;
    while (now != 0 && n != 0) {
        value += now;
        now /= 2LL;
        n--;
    }
    return value;
}
void solve(){
    long long n, k;
    cin >> n >> k;
    long long bot = 1;
    long long top = k + 1;
    while (top - bot > 1) {
        long long mid = (top + bot) / 2LL;
        if (judge(n, mid) <= k) {
            bot = mid;
        }
        else {
            top = mid;
        }
    }
    cout << bot << endl;
}
int main() {
    init();
    solve();
}


Measured memory_bytes: 3212
import scala.io.StdIn
object Main extends App {
  val List(n, x) = StdIn.readLine().split(" ").map(_.toInt).toList
  val m = for {
    i <- 0 until n
    mi = StdIn.readLine()
  } yield mi.toInt

  println(n + (x - m.sum) / m.min)
}


Measured memory_bytes: 25544
#include <stdio.h>

int main() {
  int flg,N,v,k=0;
  int i,j;
  int A[100];

  scanf("%d", &N);

  for ( i = 0; i < N; i++) {
    /* code */
    scanf("%d", &A[i]);
  }

  flg=1;
  while (flg==1) {
    /* code */
  flg=0;
  for ( j = N-1; j >= 1 ; j--) {
    /* code */
    if(A[j]<A[j-1]){

      v=A[j];
      A[j]=A[j-1];
      A[j-1]=v;
      k++;
      flg=1;

    }
  }
}
    printf("%d", A[0]);

  for ( i = 1; i < N; i++) {
    /* code */

   printf(" %d", A[i]);
  }
  printf("\n");
  printf("%d\n", k);

  return 0;
}



Measured memory_bytes: 2108
#include<stdio.h>
int main(void){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    for(int i=0;i<100;i++)
    {
        if(c==(a*i)%b)
        {
            puts("YES");
            return 0;
        }
    }
    puts("NO");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
const int DX[4] = { 0, 0, +1, -1 };
const int DY[4] = { +1, -1, 0, 0 };
int main() {
    int N, M; cin >> N >> M;
    vector<Int> A(N), B(N), C(N), D(M), E(M), F(M);
    vector<Int> X, Y;
    X.push_back(0);
    Y.push_back(0);
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i] >> C[i];
        X.push_back(A[i]);
        X.push_back(B[i]);
        Y.push_back(C[i]);
    }
    for (int i = 0; i < M; i++) {
        cin >> D[i] >> E[i] >> F[i];
        X.push_back(D[i]);
        Y.push_back(E[i]);
        Y.push_back(F[i]);
    }
    sort(begin(X), end(X));
    X.erase(unique(begin(X), end(X)), end(X));
    sort(begin(Y), end(Y));
    Y.erase(unique(begin(Y), end(Y)), end(Y));
    int zero_x = 2 * (lower_bound(begin(X), end(X), 0) - begin(X));
    int zero_y = 2 * (lower_bound(begin(Y), end(Y), 0) - begin(Y));
    for (int i = 0; i < N; i++) {
        A[i] = 2 * (lower_bound(begin(X), end(X), A[i]) - begin(X));
        B[i] = 2 * (lower_bound(begin(X), end(X), B[i]) - begin(X));
        C[i] = 2 * (lower_bound(begin(Y), end(Y), C[i]) - begin(Y));
    }
    for (int i = 0; i < M; i++) {
        D[i] = 2 * (lower_bound(begin(X), end(X), D[i]) - begin(X));
        E[i] = 2 * (lower_bound(begin(Y), end(Y), E[i]) - begin(Y));
        F[i] = 2 * (lower_bound(begin(Y), end(Y), F[i]) - begin(Y));
    }
    vector<vector<char>> visited(X.size() * 2 + 1, vector<char>(Y.size() * 2 + 1));
    for (int i = 0; i < N; i++) {
        for (int x = A[i]; x <= B[i]; x++) {
            visited[x][C[i]] = 1;
        }
    }
    for (int i = 0; i < M; i++) {
        for (int y = E[i]; y <= F[i]; y++) {
            visited[D[i]][y] = 1;
        }
    }
    stack<pair<int, int>> S;
    visited[zero_x][zero_y] = 1;
    S.emplace(zero_x, zero_y);
    while (!S.empty()) {
        auto [x, y] = S.top(); S.pop();
        if (x == 0 || x == X.size() * 2 || y == 0 || y == Y.size() * 2) {
            cout << "INF\n";
            return 0;
        }
        for (int i = 0; i < 4; i++) {
            int nx = x + DX[i];
            int ny = y + DY[i];
            if (0 <= nx && nx < X.size() * 2 + 1 && 0 <= ny && ny < Y.size() * 2 + 1 && !visited[nx][ny]) {
                visited[nx][ny] = 1;
                S.emplace(nx, ny);
            }
        }
    }
    Int ans = 0;
    for (int i = 0; i < X.size() - 1; i++) {
        for (int j = 0; j < Y.size() - 1; j++) {
            if (visited[i * 2 + 1][j * 2 + 1]) {
                ans += (X[i + 1] - X[i]) * (Y[j + 1] - Y[j]);
            }
        }
    }
    cout << ans << '\n';
    return 0;
}


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

int main(){
    int flag=1;
    int n,m;
    string s;
    map<string, int> m1;
    map<string, int>::iterator p;
    int ans=0;

    cin >>n;
    for (int i = 0; i < n; i++){
        cin >>s;
        p = m1.find(s);

        if(p != m1.end()){
            m1[s]++;
        }else{
            m1[s]=1;
        }

    }
    
    cin >>m;
    for (int i = 0; i < m; i++){
        cin >>s;
        p = m1.find(s);

        if(p != m1.end()){
            m1[s]--;
        }
    }

    for (p = m1.begin(); p !=m1.end(); p++){
        ans = max(ans,p->second);
    }
    
    cout << ans <<endl;
    //cout <<fixed<<setprecision(16)<< ans <<endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
//bubble sort
//in ascending order
//return value: swapping times
#include <iostream>
#include <algorithm>
#define max_n 101
using namespace std;

//ver1.0 with flag
int bubbleSort(int* a, int n)
{
	int cnt_sw = 0;
	bool flag = 1;
	
	while(flag)
	{
		flag = 0;
		for(int j = 0; j < n - 1; j++)
		{
			if(a[j] > a[j + 1])
			{
				swap(a[j], a[j + 1]);
				
				++cnt_sw;
				flag = 1;	
			}				
		}
	}
	return cnt_sw;
}

//ver2.0 with flag & remark
//±ê¼ÇÁËÉÏÒ»´ÎÅÅÐòÍêÓÐÐòµÄÏÂ±ê£¬ÊÇÕë¶ÔÃ°ÅÝÅÅÐòµÄÌØÖÆÓÅ»¯ 
int bubbleSort_(int* a, int n)
{
	int cnt_sw = 0;
	int mem = n - 1;
	bool flag = 1;
	
	while(flag)
	{
		flag = 0;
		for(int j = 0; j < mem; ++j)
		{
			if(a[j] > a[j + 1])
			{
				swap(a[j], a[j + 1]);
				
				++cnt_sw;
				flag = 1;	
			}				
		}
		--mem;
	}
	return cnt_sw;
} 
 
int main(void)
{
	int n, a[max_n];
	
	cin >> n;
	for(int i = 0; i < n; ++i)
		cin >> a[i];
		
	int ans = bubbleSort_(a, n);
	for(int i = 0; i < n; ++i)
	{
		if(i)
			cout << " ";
		cout << a[i];
	}
	cout << endl;
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>

using namespace std;

typedef long long int ll;
typedef vector<ll> V;
typedef vector<V> VV;

int main() {
  // Happy hacking!
  ll a, b, k;
  V cd;
  cin >> a >> b >> k;

  for(ll i=1; i<=100; i++) {
    if(a % i == 0 && b % i == 0) {
      cd.push_back(i);
    }
  }

  ll cnt = 0;
  for(auto itr=cd.rbegin(); itr!=cd.rend(); itr++) {
    cnt++;
    if(cnt == k) {
      cout << *itr << endl;
      break;
    }
  }

  return 0;
}


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

using namespace std;

int main() {
	int N,x;
	scanf("%d", &N);
	vector<int> a(N);
	for (int i = 0; i < N; i++)scanf("%d", &a[i]);
	sort(a.begin(), a.end());
	x = abs(a[0]-a[N - 1]);
	printf("%d", x);
	return 0;
}

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

int main() {
	int loop;
	char w[101];
	int sum[26];
	int i = 0;
	int len;
	int loop1, loop2;

	scanf("%s", &w);
	len = strlen(w);
	for (loop = 0; loop < 26; loop++)
		sum[loop] = 0;

	for (loop1 = 0; loop1 < len; loop1++) 
		for (loop2 = 0; loop2 < 26; loop2++) {
			if (w[loop1] == loop2 + 97) sum[loop2]++;
		}
	
	for (loop = 0; loop < 26; loop++)
		if (sum[loop] % 2 != 0) i++;

	if (i == 0) printf("Yes");
	else printf("No");
	
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>

int main(){

    string a,b,c;
    cin >> a >> b >> c;
    char s1 = a[0];
    //s1 = s1 - 0x20;
    char s2 = b[0];
    //s2 = b[0] - 0x20;
    char s3 = c[0];
    //s3 = c[0] - 0x20;
    cout << s1 << s2 << s3 << 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 numA = sc.nextInt();
    int numB = sc.nextInt();
    int numC = sc.nextInt();
    
    int sum = numA + numB + numC;
    
    String res = "win";
    
    if (sum > 21){
      res = "bust";
    }
    
    System.out.println(res);
    
  }
}

Measured memory_bytes: 21972
#include <stdio.h>

int main(void)
{
	int a,b,i,tmp;

	for(i = 1;i <= 3000; i++)
	{
		scanf("%d %d",&a,&b);
		if(a == 0 && b == 0)
		{
			break;
		}else
		{
			if(a > b){
				tmp = a;
				a = b;
				b = tmp;
			}
			printf("%d %d\n",a,b);
		}
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

typedef complex<double> C;
typedef pair<C,C> pp;
typedef vector<C> VP;
typedef vector<pp> VPP;
#define eq(a,b) (fabs(a-b)<eps)
#define veq(a,b) (eq(a.real(),b.real())&&eq(a.imag(),b.imag()))
const C O{0,0};

void In(C& p){
	double x,y;
	cin>>x>>y;
	p=C(x,y);
}

void Out(C p){
	cout<<syosu(11)<<p.real()<<' '<<p.imag()<<endl;
}

double Dot(C p,C q){
	return p.real()*q.real()+p.imag()*q.imag();
}

double Det(C p,C q){
	return p.real()*q.imag()-q.real()*p.imag();
}

C Proj(C a,C b,C p){
	C A=p-a,B=b-a;
	double l=abs(B);
	return B*Dot(A,B)/(l*l)+a;
}

C Cross(C a,C b,C c,C d){
	C A=b-a,B=d-c;
	return a+A*Det(B,c-a)/Det(B,A);
}

C a,b,c;

double f(){
	C p=(b-a)/2.0,q=(c-a)/2.0,inn=Cross(a,a+p/abs(p)+q/abs(q),b,b+(a-b)/abs(a-b)+(c-b)/abs(c-b));
	double h=abs(inn-Proj(a,b,inn)),w=abs(p),l=0,r=w;
	for(int i=0;i<45;i++){
		double m=(l+r)/2,H=h*(w-m)/w;
		if(H>m) l=m;
		else r=m;
	}
	swap(a,b);
	swap(b,c);
	return l;
}

int main(){
	In(a);In(b);In(c);
	cout<<syosu(11)<<max({f(),f(),f()})<<endl;
}

Measured memory_bytes: 256
import sys
N,*A = map(int, open(0).read().split())
S = (N+1)*N//2
if sum(A)%S!=0:
  print('NO')
  sys.exit()
M = sum(A)//S
B = [A[(i+1)%N]-A[i]-M for i in range(N)]
X = 0
for c in B:
  if c%(-N)!=0 or M<c:
    print('NO')
    break
  X += c//(-N)
else:
  if X==M:
    print('YES')
  else:
    print('NO')

Measured memory_bytes: 69920
# -*- coding: utf-8 -*-

"""
参考：https://img.atcoder.jp/abc118/editorial.pdf
"""

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul, xor
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

print(gcd_list(A))


Measured memory_bytes: 16828
n = int(input())

adj = [[100001 for j in range(n)] for i in range(n)]

for u in range(n):
    x = list(map(int, input().split()))
    for v, c in zip(x[2::2], x[3::2]):
        adj[u][v] = c

isVisited = [False] * n

distance = [9900001] * n


def dijkstra(s):
    distance[s] = 0

    while True:
        mincost = 9900001
        for i in range(n):
            if (not isVisited[i]) and (distance[i] < mincost):
                mincost = distance[i]
                u = i

        if mincost == 9900001:
            break

        isVisited[u] = True

        for v in range(n):
            weight_uv = adj[u][v]
            if (not isVisited[v]) and (weight_uv != 100001):
                t_d = distance[u] + weight_uv
                if t_d < distance[v]:
                    distance[v] = t_d



dijkstra(0)

for v, d in enumerate(distance):
    print(v, d)

Measured memory_bytes: 7856
#include <iostream>
#include <cmath>

using namespace std;

int pw (int n, int p) {
  if (n == 0) return 0;
  if (p == 0) return 1;
  if (p == 1) return n;
  return n * pw(n, p-1);
}

int computeM (int e) {
  
  int ret = e;
  
  // zが最も自由度の小さい数なので、zから決定していく。

  for(int y = 0; y <= sqrt(e); y++) {
    for(int z = 0; z <= sqrt(e); z++) {
      int temp = pw(y, 2) + pw(z, 3);
      int x = e - temp;
      if (x < 0) x = 0;
      if (x + temp == e) ret = min(x + y + z, ret);
    }
  }
  

  return ret;
}

int main (void) {
  int e, m;

  while (1) {
    cin >> e; if (e == 0) break;
    m = computeM(e);
    cout << m << endl;
  }
  return 0;
}

Measured memory_bytes: 1156