akhauriyash/Code-Regression huggingface dataset:
class Dice
  #   1
  # 4 2 3 5
  #   6
  attr_reader :pips
  def initialize(*pips)
    @pips = pips
  end

  TN = [
    [0, 1, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 1],
    [0, 0, 1, 0, 0, 0],
    [0, 0, 0, 1, 0, 0],
    [1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 1, 0],
  ]
  TE = [
    [0, 0, 0, 1, 0, 0],
    [0, 1, 0, 0, 0, 0],
    [1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 1],
    [0, 0, 0, 0, 1, 0],
    [0, 0, 1, 0, 0, 0],
  ]
  TW = [
    [0, 0, 1, 0, 0, 0],
    [0, 1, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 1],
    [1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 1, 0],
    [0, 0, 0, 1, 0, 0],
  ]
  TS = [
    [0, 0, 0, 0, 1, 0],
    [1, 0, 0, 0, 0, 0],
    [0, 0, 1, 0, 0, 0],
    [0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 1],
    [0, 1, 0, 0, 0, 0],
  ]
  TZ = [
    [1, 0, 0, 0, 0, 0],
    [0, 0, 1, 0, 0, 0],
    [0, 0, 0, 0, 1, 0],
    [0, 1, 0, 0, 0, 0],
    [0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 1],
  ]

  def rotate!(direction)
    pips = case direction
    when :n then TN
    when :e then TE
    when :w then TW
    when :s then TS
    when :z then TZ
    end
    @pips = pips.map do |pips_j|
      @pips.zip(pips_j).map {|i, j| i * j }.inject(:+)
    end
    self
  end

  def rotate_to_top!(index)
    case index
    when 1 then self
    when 2 then self.rotate!(:n)
    when 3 then self.rotate!(:w)
    when 4 then self.rotate!(:e)
    when 5 then self.rotate!(:s)
    when 6 then self.rotate!(:n).rotate!(:n)
    end
  end

  def ==(other)
    other.pips.each.with_index(1) do |pip, idx|
      next unless pip == @pips[0]
      other.rotate_to_top!(idx)
      return true if other.pips == @pips
      3.times do
        other.rotate!(:z)
        return true if other.pips == @pips
      end
    end
    return false
  end
end

n = gets.to_i

dices = n.times.map { Dice.new(*gets.split.map(&:to_i)) }
puts dices.combination(2).any? { |a, b| a == b } ? 'No' : 'Yes'

Measured memory_bytes: 6108
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.rbegin(),a.rend())
#define lb(a,b) lower_bound(a.begin(),a.end(),b)
#define ub(a,b) upper_bound(a.begin(),a.end(),b)
#define MOD ((int)(1e9+7  ))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
#define sqrt sqrtl
#define cbrt cbrtl
#define endl '\n'
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<float,int> fi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<fi> vfi;
typedef vector<vi> vvi;
typedef vector<vf> vvf;
typedef vector<vii> vvii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<fi> pqfi;
typedef priority_queue <int, vector<int>, greater<int> > rpqi; 
typedef priority_queue <ii, vector<ii>, greater<ii> > rpqii; 
typedef priority_queue <fi, vector<fi>, greater<fi> > rpqfi;

const int N=200000;
int par[N+1];
int mx[N+1];
int mn[N+1];
int root(int v){return par[v] < 0 ? v : (par[v] = root(par[v]));}
void merge(int x,int y){	//	x and y are some tools (vertices)
    if((x = root(x)) == (y = root(y)) )    return ;
	if(par[y] < par[x])	// balancing the height of the tree
		swap(x, y);
	par[x] += par[y];
	par[y] = x;
	mx[x]=max(mx[x],mx[y]);
	mn[x]=min(mn[x],mn[y]);
}



int32_t main()
{
	IOS
	int a, b , c  ; cin >> a >> b >> c;
	swap(a,b);
	swap(a,c);
	cout << a << " " << b << " "  << c << endl;
	
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

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

    if (s[0] == '9' || s[1] == '9') {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int N, K, L;
    scan(N, K, L);

    auto uf1 = UnionFind(N);

    foreach (i ; 0 .. K) {
        int u, v;
        scan(u, v);
        u--, v--;
        uf1.merge(u, v);
    }

    auto uf2 = UnionFind(N);

    foreach (i ; 0 .. L) {
        int u, v;
        scan(u, v);
        u--, v--;
        uf2.merge(u, v);
    }

    alias Pair = Tuple!(int, "a", int, "b");
    auto ps = new Pair[](N);
    int[Pair] map;

    foreach (i ; 0 .. N) {
        ps[i] = Pair(uf1.findRoot(i), uf2.findRoot(i));
        map[ps[i]]++;
    }
        
    auto ans = new int[](N);
    foreach (i ; 0 .. N) {
        ans[i] = map[ps[i]];
    }

    writefln("%(%s %)", ans);
}


struct UnionFind {
    private {
        int _size;
        int[] _parent;
    }

    this(int N) 
    in {
        assert(N > 0);
    }
    body {
        _size = N;
        _parent = new int[](_size);
        foreach (i ; 0 .. _size) {
            _parent[i] = i;
        }
    }

    int findRoot(int x)
    in {
        assert(0 <= x && x < _size);
    }
    body {
        if (_parent[x] != x) {
            _parent[x] = findRoot(_parent[x]);
        }

        return _parent[x];
    }

    bool same(int x, int y)
    in {
        assert(0 <= x && x < _size);
        assert(0 <= y && y < _size);
    }
    body {
        return findRoot(x) == findRoot(y);
    }

    void merge(int x, int y)
    in {
        assert(0 <= x && x < _size);
        assert(0 <= y && y < _size);
    }
    body {
        int u = findRoot(x);
        int v = findRoot(y);

        if (u == v) return;

        _parent[v] = u;
    }
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 22524
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
#define Icin(s) ll (s);cin>>(s);
#define Scin(s) ll (s);cin>>(s);
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
//ここから
template< typename flow_t >
struct FordFulkerson {
  struct edge {
    int to;
    flow_t cap;
    int rev;
    bool isrev;
    int idx;
  };

  vector< vector< edge > > graph;
  vector< int > used;
  const flow_t INF;
  int timestamp;

  FordFulkerson(int n) : INF(numeric_limits< flow_t >::max()), timestamp(0) {
    graph.resize(n);
    used.assign(n, -1);
  }

  void add_edge(int from, int to, flow_t cap, int idx = -1) {
    graph[from].emplace_back((edge) {to, cap, (int) graph[to].size(), false, idx});
    graph[to].emplace_back((edge) {from, 0, (int) graph[from].size() - 1, true, idx});
  }

  flow_t dfs(int idx, const int t, flow_t flow) {
    if(idx == t) return flow;
    used[idx] = timestamp;
    for(auto &e : graph[idx]) {
      if(e.cap > 0 && used[e.to] != timestamp) {
        flow_t d = dfs(e.to, t, min(flow, e.cap));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  flow_t max_flow(int s, int t) {
    flow_t flow = 0;
    for(flow_t f; (f = dfs(s, t, INF)) > 0; timestamp++) {
      flow += f;
    }
    return flow;
  }

  void output() {
    for(int i = 0; i < graph.size(); i++) {
      for(auto &e : graph[i]) {
        if(e.isrev) continue;
        auto &rev_e = graph[e.to][e.rev];
        cout << i << "->" << e.to << " (flow: " << rev_e.cap << "/" << e.cap + rev_e.cap << ")" << endl;
      }
    }
  }
};
/*使い方:
    FordFulkerson(V):= 頂点数 Vで初期化する。
    add_edge(from,to,cap):=頂点fromからtoに容量capの辺を張る。
    max_flow(s,t,f):= 頂点sからtに最大流を流し、その流量を返す。
    int main() {
        int V, E;
        scanf("%d %d", &V, &E);
        FordFulkerson< int > g(V);
        for(int i = 0; i < E; i++) {
            int a, b, c;
            scanf("%d %d %d", &a, &b, &c);
            g.add_edge(a, b, c);
        }
    printf("%d\n", g.max_flow(0, V - 1));
}
*/
int main(){
    ll V,e;
    cin>>V>>e;
    FordFulkerson<ll> g(V);
    rep(i,e){
        ll u,v,c;cin>>u>>v>>c;
        g.add_edge(u,v,c);
    }
    cout<<g.max_flow(0,V-1)<<endl;
}


Measured memory_bytes: 3208
def f(x, y):
    i = 1
    while x < y: i *= 2; x *= 2
    return 1 / i

n, k = map(int, input().split())
p = (max(0, n - k + 1) +
     sum(f(i, k) for i in range(1, min(k, n + 1)))) / n
print(p)


Measured memory_bytes: 2940
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
	auto data = readln.split;
	auto H = data[0].to!int, W = data[1].to!int;
	data = readln.split;
	auto h = data[0].to!int, w = data[1].to!int;
	
	writeln(H*W - h*W - w*H + h*w);
}

Measured memory_bytes: 256
list = []

gets.to_i.times do
	com = gets.chomp.split

	if com[0] == "deleteFirst"
		list.shift
	elsif com[0] == "deleteLast"
		list.pop
	elsif com[0] == "insert"
		list.unshift(com[1].to_i)
	else
		idx = list.index(com[1].to_i)
		list.delete_at(idx) if idx != nil
	end
end

puts list.join(" ")



Measured memory_bytes: 21396
//package com.company;

import java.io.*;
import java.util.*;
public class Main {
//public class lowelements {
    public static void main(String[] args) {

        out = new PrintWriter(new BufferedOutputStream(System.out));
        MyScanner sc = new MyScanner();//start
        int n=sc.nextInt();
        String[] input = new String[n];
        input=sc.nextLine().split(" ");
        int[] arr=new int[n];
        for (int i = 0; i <n; i++) {
            arr[i]=Integer.parseInt(input[i]);
        }
        int sum=1,low=arr[0];
        for (int i = 1; i < n; i++) {
            if(arr[i]<low){sum++;low=arr[i];}//0>1
        }
        out.println(sum);
        out.close();
    }


    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------

}


Measured memory_bytes: 51240
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInt2() (int, int) {
	return nextInt(), nextInt()
}

func nextInt3() (int, int, int) {
	return nextInt(), nextInt(), nextInt()
}

func nextInt4() (int, int, int, int) {
	return nextInt(), nextInt(), nextInt(), nextInt()
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	s, t := next(), next()

	ans := 0
	for i := range s {
		if s[i] != t[i] {
			ans++
		}
	}
	puts(ans)
}


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

int H, A;

void Main() {
  cin >> H >> A;

  if (H % A == 0) {
    cout << H / A << endl;
  } else {
    cout << H / A + 1 << endl;
  }
}

int main() {
  Main();
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]
a.append(0)

res = 0
for i in range(n):
    # a[i] と a[i+1]
    res += a[i] // 2
    a[i] %= 2
    if a[i]==1 and a[i+1]!=0:
        res += 1
        a[i] -= 1
        a[i+1] -= 1
print(res)


Measured memory_bytes: 7072
def cmb(N, r, mod):
    if ( r<0 or r>N ):
        return 0
    r = min(r, N-r)
    return g1[N] * g2[r] * g2[N-r] % mod

g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
mod = 10 ** 9 + 7

n = int(input())
lis = list(map(int,input().split()))
li = [-1] * n

for i in range( 2, n + 2 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

for i in range(n+1):
    if li[lis[i]-1] != -1:
        left = li[lis[i]-1]+1
        right = i+1
        break
    else:li[lis[i]-1] = i

for k in range(1,n+2):
  #     print(nCr(n+1,k,mod),nCr(left+n-right,k-1,mod))
    ans = cmb(n+1,k,mod)-cmb(left+n-right,k-1,mod)
    if ans < 0:
        ans += mod
    print(ans)

Measured memory_bytes: 25596
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	int S;
	int W;
	cin >> S >> W;
	if (W - S >= 0) {
		cout << "unsafe" << endl;
	}
	else {
		cout << "safe" << endl;
	}
	}

Measured memory_bytes: 3132
S = input()
N =len(S)

ans = True
for j in range(3):
    for i in range(1,N//2 +1):
        if S[i-1] != S[N- i]:
            ans = False
            break
    if j ==0:
        S1 = S[:(N-1)//2]
        S2 = S[(N-1)//2+1:]
        S =S1
    elif j==1:
        S =S2

    N =len(S) 
            
if ans==True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;

#define MAXN 100
char A[MAXN+5],B[MAXN+5];

int main(){
    int N,Ans=2*MAXN;
    scanf("%d%s%s",&N,A+1,B+1);
    for(int i=1;i<=N;i++){
        int j=1;
        while(i+j-1<=N&&j<=N&&A[i+j-1]==B[j])
            j++;
        Ans=min(Ans,2*N-j+1);
    }
    printf("%d",Ans);
}


Measured memory_bytes: 128
#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 VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const ll mod = 1e9 + 7;

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

    string s;
    cin >> s;
    REP(i, 3) {
        if (s[i] == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  int n = 0;
  cin >> n;
  vector<int> num(n);
  for(int i = 0;i < n;i++)cin >> num[i];
  int res = 0;
  for(int i = 0;i < n;i++)res ^= num[i];
  if(res == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 640
/**
 * Author: Behradm
 * Created: 27-04-2020 20:49:56
 * In the Name of God
**/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;

#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define LOCAL

#ifdef LOCAL
	#define debugi(x) cerr << "{" << #x << "}: " << (x) << '\n'
	#define debug(v, begin, end) cerr << "{ | "; for(auto i = begin; i < end; i++){cerr << #v << "[" << i << "]: " << v[i] << " | ";} cerr << " }\n"
	#define debugp(a, b) cerr << "\n{ " << a << " " << b << " }\n"
#else
	#define debugi(x) 42
	#define debug(v, begin, end) 42
	#define debugp(a, b) 42 
#endif

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	cout.tie(0);
	cout.precision(6);
	int h1, s1, h2, s2;
	cin >> h1 >> s1 >> h2 >> s2;
	int i = 0;
	while (h1 > 0 && h2 > 0){
		if (!(i & 1))
			h2 -= s1;
		else
			h1 -= s2;
		++i;
	}

	if(h1 <= 0)
		cout << "No\n";
	else
		cout << "Yes\n";
	return 0;
}



Measured memory_bytes: 3664
import collections
N, Q = map(int, input().split())
G = [set() for i in range(N)]

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].add(b)
    G[b].add(a)

d = collections.defaultdict(int)

for i in range(Q):
    p, x = map(int, input().split())
    p -= 1
    d[p] += x

q = collections.deque()

r = [-1]*N
r[0] = d[0]
q.append(0)
while(q):
    x = q.popleft()
    c = r[x]
    for y in G[x]:
        if r[y] < 0:
            r[y] = c+d[y]
            q.append(y)

print(*r)


Measured memory_bytes: 104772
#coding=UTF-8

N=int(input())

def waricount(num):
    kaeshi=0
    while num%2==0:
        kaeshi+=1
        num=num//2

    return kaeshi


ans=None
ans_val=-1
for idx in range(1,N+1,1):
    val=waricount(idx)
    if val > ans_val:
        ans=idx
        ans_val=val

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <deque>
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    //input
    long long x; cin >> x;
    long long ans = 0;

    if(x % 11 == 0){
        ans = 2 * ( x / 11 ) ;
    }else if(x - 11 * (x / 11) <= 6){
        ans = 2 * ( x / 11 ) + 1;
    }else{
        ans = 2 * ( x / 11) + 2;
    }

    //output
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	int a, b;
 	cin >> a >> b;
 	int ans = a*b;
 	
 	if(ans%2){
 		cout << "Odd" << endl;
 	}else{
 		cout << "Even" << endl;
 	}
 	
 	return 0;
 }

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,W; cin >> N >> W;
    vector<int> w(N), v(N);
    rep(i,N) cin >> w[i] >> v[i];
    
    vector<vector<int>> dp(N+1, vector<int>(100001,W+1));
    dp[0][0] = 0;
    rep(i,N) {
        rep(j,100001) {
            dp[i+1][j] = dp[i][j];
            if (j < v[i]) continue;
            chmin(dp[i+1][j],dp[i][j - v[i]] + w[i]);
        }
    }
    int ans;
    rep(j,100001) {
        if (dp[N][100000-j] <= W) {
            ans = 100000 - j;
            break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 40192
import bisect

N,Q = map(int,input().split())
S = input()
L = []
for i in range(N):
    if S[i:i+2] == 'AC':
        L.append(i)
for i in range(Q):
    l,r = map(int,input().split())
    a = bisect.bisect_left(L,l-1)
    b = bisect.bisect_right(L,r-2)
    print(b-a)

Measured memory_bytes: 5748
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
using namespace std;
 
    
    
int main(){
  long int yokin,x;
  int i=0;
  cin>>x;
  yokin=100;
  while (1)
  {
    yokin=yokin+yokin/100;
    i++;
    if (yokin>=x)
    {
      break;
    }  
  }
  cout<<i<<endl;
  
    return 0;
}

Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define u128 __int128
#define ss second
#define pb push_back

#define N 200010
#define MOD 1000000007

ll n, m, k;

ll bexp(ll a, ll b)
{
	ll res = 1;
	while(b)
	{
		if(b & 1)
			res = res * a;
		a *= a;
		b >>= 1;
	}
	return res;
}

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

// 	int n, m, k;
// 	cin >> n >> m >> k;
// 	if(n <= m && k <= m)
// 		cout << "Yes\n";
// 	else
// 		cout << "No\n";
// 	return 0;
// }
// int main()
// {
// 	ios::sync_with_stdio(false);
// 	cin.tie(NULL);

// 	ll n, m;
// 	cin >> n >> m;
// 	ll k1 = (n + 1) / 3, k2 = (m + 1)/ 2, k3 = (n + 1)/ 2, k4 = (m + 1) / 3;
// 	ll m1 = k1 * k2, m2 = k3 * k4;
	
// 	if(n % 3 == 1)
// 	{
// 		m1 += (m + 1)/3;
// 	}
// 	if(m % 3 == 1)
// 		m2 += (n + 1)/3;
// 	cout << max(m1, m2);
// 	return 0;
// }

int main()
{
	
	int a, b, c;
	cin >> a >> b >> c;
	cout << min(b /a , c);
	return 0;
}

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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(A.rbegin(), A.rend());

    if (N == 2) {
        cout << A[0] << endl;
        return 0;
    }

    ll ans = A[0];
    N -= 2;
    int tmp = N/2;
    int cur = 1;
    for (int i = 0; i < tmp; ++i) {
        ans += A[cur++]*2;
    }
    if (N%2 > 0) {
        ans += A[cur];
    }

    cout << ans << endl;
}


Measured memory_bytes: 4756
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
 
namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine().ToCharArray();


            int count = 0;
            var isRBefore = false;

            foreach (var s in S)
            {
                if (s == 'R')
                {
                    if (isRBefore || count == 0)
                    {
                        count++;
                    }
                    isRBefore = true;
                }
                else
                {
                    isRBefore = false;
                }
            }

            Console.WriteLine(count);
 
        }
    }
}

Measured memory_bytes: 25924
n,m = map(int,input().split())
a = [0 for _ in range(m)]
b = [0 for _ in range(m)]

for i in range(m):
    a[i],b[i] = map(int,input().split())

go = []
goal = []

for i in range(len(a)):
    if a[i] == 1:
        go.append(b[i])
    if b[i] == n:
        goal.append(a[i])

count = [0 for i in range(n)]
for i in range(len(go)):
    count[go[i]-1] = 1
for i in range(len(goal)):
    count[goal[i]-1] += 1
for i in range(len(count)):
    if count[i] > 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Measured memory_bytes: 20528
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
const int MAXN = (1 << 20);

int n;
int a[MAXN];

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

int dp[MAXN], f[MAXN], s[MAXN];

void solve()
{
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        if(i == 1 || a[i] < a[i - 1]) f[i] = i - 1;
        else f[i] = f[i - 1];

        if(i == 1 || a[i] > a[i - 1]) s[i] = i - 1;
        else s[i] = s[i - 1];
    }

    dp[0] = 0;
    for(int i = 1; i <= n; i++)
        dp[i] = 1 + min(dp[f[i]], dp[s[i]]);

    cout << dp[n] << endl;
}

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

	read();
	solve();
	return 0;
}


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

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

    vector<int> dp_count(N + 1, 1);
    vector<bool> dp_exist(N + 1, false);
    dp_exist[1] = true;

    int x, y;
    for (int i = 0; i < M; i++)
    {
        cin >> x >> y;
        if (dp_exist[x])
        {
            dp_exist[y] = true;
            if (dp_count[x] == 1)
            {
                dp_exist[x] = false;
            }
        }
        dp_count[x]--;
        dp_count[y]++;
    }

    int ans = 0;
    for (auto b : dp_exist)
    {
        if (b)
        {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($L,$N) = explode(" ",trim(fgets(STDIN)));
//$a = explode(" ",trim(fgets(STDIN)));
$h = explode(" ",trim(fgets(STDIN)));

$dp = array_fill(0,$N,PHP_INT_MAX);

$dp[0]=0;
for($i=0;$i<$N;$i++) {
  $dp[$i+1]=min($dp[$i+1],$dp[$i]+abs($h[$i]-$h[$i+1]));
  $dp[$i+2]=min($dp[$i+2],$dp[$i]+abs($h[$i]-$h[$i+2]));
}
printf("%d\n",$dp[$N-1]);


Measured memory_bytes: 35372
#coding:utf-8


# a,b,c =map(str,raw_input().split())  # 2 3  # 二つの数字
#
# print a,b,c
# print ty

S=map(str, raw_input().split())   # 2 3  # 二つの数字
a=S[0]
b=S[1]
c = S[2]
# print a,b,c
# list.append(S[0][0].upper(),S[1][0].upper(),S[2][0].upper())
print S[0][0].upper()+S[1][0].upper()+S[2][0].upper()


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

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

    int s_len = int(s.size());

    if (s_len % 2 == 0)
    {
        int answer = 0;
        for (int i = 0; i < s_len / 2; i++)
        {
            if (s.at(i) != s.at(s_len - 1 - i))
            {
                answer++;
            }
        }
        cout << answer << endl;
        return 0;
    }
    else
    {
        int answer = 0;
        for (int i = 0; i < (s_len - 1) / 2; i++)
        {
            if (s.at(i) != s.at(s_len - 1 - i))
            {
                answer++;
            }
        }
        cout << answer << endl;
        return 0;
    }
}

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

int main() { 
  string S,T;
  cin>>S>>T;
  int n=0;
  for(int i=0;i<S.size();i++){
    if(S.at(i)!=T.at(i)){
      n++;
    }
  }
  cout << n << endl;
}

Measured memory_bytes: 3848
N = int(input())
a_lst = list(map(int, input().split()))

avr = sum(a_lst) / N

ans = 0
x = -1
for i in range(N):
    if x == -1 or x > abs(a_lst[i] - avr):
        x = abs(a_lst[i] - avr)
        ans = i

print(ans)

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

lli n;

int main(void){
    cin >> n;
    vector<lli> x(n), y(n), h(n);
    rep(i, n){
        cin >> x[i] >> y[i] >> h[i];
    }
    lli id = -1;
    rep(i, n){
        if(h[i] > 0){
            id = i;
            break;
        }
    }
    assert(id != -1);
    rep(cx, 101){
        rep(cy, 101){
            lli H = h[id]+abs(x[id]-cx)+abs(y[id]-cy);
            bool ok = true;
            rep(i, n){
                if(max(0LL, H-abs(x[i]-cx)-abs(y[i]-cy)) != h[i]) ok = false;
            }
            if(ok){
                cout << cx << " " << cy << " " << H << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int N;cin>>N;
 vector <int> price(N);
  for(int i =0;i<N;i++)
  {
  cin>>price[i];
  }
  sort(price.begin(),price.end());
  
  int sum=0;
  for(int i=0;i<N;i++)
  {
   sum=sum+price[i];
  }
  sum=sum-(price[N-1]/2);
    cout<<sum<<endl;
}

Measured memory_bytes: 256
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>

using namespace std;

typedef long long LL;

int main() {
	int k;
	string s;
	cin >> k;
	cin >> s;
	string ans = s;
	if (s.length() > k) {
		ans = s.substr(0, k) + "...";
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3624
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Set<Integer> s = new HashSet<Integer>();
		for (int i = 0; i < 3; i++) {
			s.add(in.nextInt());
		}
		System.out.println(s.size());
	}
}


Measured memory_bytes: 9044
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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; }

const long long INF = 1LL << 60;

int N;

long long a[100010][3];

long long dp[100010][3];

int main(){
  int N; cin >> N;
  rep(i, N) rep(j, 3) cin >> a[i][j];

  rep(i, N){
    rep(j, 3) rep(k, 3) if(j != k){
      chmax(dp[i+1][j], dp[i][k] + a[i][j]);
    }
  }

  long long res = 0;
  rep(j, 3) chmax(res, dp[N][j]);
  
  cout <<  res << endl;

  return 0;
}


Measured memory_bytes: 4992
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    const tmp = readln.split.to!(long[]);
    const N = tmp[0], M = tmp[1];
    auto as = readln.split.to!(long[]);
    as = 0 ~ as;
    foreach (i; 0..N) as[i+1] += as[i];

    long[long] cnt;
    foreach (a; as) {
        const key = a % M;
        if (key !in cnt) cnt[key] = 0;
        cnt[key]++;
    }

    cnt.values.map!(c => c * (c-1)/2).sum.writeln;
}



Measured memory_bytes: 8400
#include<queue>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j,k;
  int w,h;
  while(cin>>w&&w){
    int n;
    cin>>h>>n;
    int sx[20],sy[20];
    for(i=0;i<n;i++){
      cin>>sx[i]>>sy[i];
      sx[i]--;
      sy[i]--;
    }
    int m;
    cin>>m;
    for(;i<n+m;i++){
      cin>>sx[i]>>sy[i];
      sx[i]--;
      sy[i]--;
    }
    unsigned a[100][100][20];
    memset(a,-1,sizeof(a));
    for(i=0;i<n+m;i++){
      queue<pair<pair<int,int>,int> > b;
      b.push(make_pair(make_pair(sx[i],sy[i]),0));
      while(b.empty()==0){
	int x,y,z;
	x=b.front().first.first;
	y=b.front().first.second;
	z=b.front().second;
	b.pop();
	if(0<=x&&x<w&&0<=y&&y<h&&a[x][y][i]>(unsigned)z){
	  a[x][y][i]=z;
	  b.push(make_pair(make_pair(x-1,y),z+1));
	  b.push(make_pair(make_pair(x+1,y),z+1));
	  if(y%2){
	    b.push(make_pair(make_pair(x+1,y+1),z+1));
	    b.push(make_pair(make_pair(x,y+1),z+1));
	    b.push(make_pair(make_pair(x+1,y-1),z+1));
	    b.push(make_pair(make_pair(x,y-1),z+1));
	  }else{
	    b.push(make_pair(make_pair(x-1,y+1),z+1));
	    b.push(make_pair(make_pair(x,y+1),z+1));
	    b.push(make_pair(make_pair(x-1,y-1),z+1));
	    b.push(make_pair(make_pair(x,y-1),z+1));
	  }
	}
      }
    }
    unsigned c[100][100];
    memset(c,-1,sizeof(c));
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	for(k=0;k<n;k++)
	  c[j][i]=min(c[j][i],a[j][i][k]);
      }
    }
    int mx=0;
    for(i=n;i<n+m;i++){
      int ct=0;
      for(j=0;j<h;j++){
	for(k=0;k<w;k++){
	  if(a[k][j][i]<c[k][j])
	    ct++;
	}
      }
      mx=max(mx,ct);
    }
    cout<<mx<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
//
//  main.cpp
//  A - Rating Goal
//
//  Created by wenhan on 2017/10/28.
//  Copyright © 2017年 wenhan. All rights reserved.
//

#include <iostream>
#include <cstdio>
using namespace std;
int main() {
    int a,b;
    cin>>a>>b;
    cout<<2*b-a<<endl;
    // insert code here...
    //std::cout << "Hello, World!\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin>>N;
  string A, B, C;
  cin>>A>>B>>C;

  int ans = 0;
  for(int i=0;i<N;i++){
    set<char> S;
    S.insert(A[i]);
    S.insert(B[i]);
    S.insert(C[i]);
    ans += ((int)S.size()) - 1;
  }
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector.Unboxed           as V

main :: IO ()
main = do
  [a, b] <- map read . words <$> getLine
  case a > b of
    True -> print (a + max (a - 1) b)
    _    -> print (b + max a (b - 1))


Measured memory_bytes: 508
N = int(input())
A = list(map(int,input().split()))
ave = sum(A)/N
B = [0]*N
for i in range(N):
  B[i] = abs(A[i]-ave)
m = min(B)
for i in range(N):
  if B[i] == m:
    print(i)
    exit()

Measured memory_bytes: 9076
#include <stdio.h>
int main(){
    int n;
    int c[3];
    scanf("%d",&n);
    c[0] = n%10;
    c[1] = (n/10)%10;
    c[2]= (n/100)%10;
    for(int i = 0; i<3;i++){
        switch (c[i]){
        case 1:
            c[i] = 9;break;
        case 9:
            c[i] = 1;break;
        default:
            break;
        }
        }
    printf("%d\n",100*c[2]+10*c[1]+c[0]);
    return 0;
}

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

// 最大公約数
int64_t gcd(int64_t a, int64_t b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
int64_t lcm(int64_t a, int64_t b) {
  return a * b / gcd(a, b);
}

int main(){
  int64_t n,a,b;
  cin >> n >> a >> b;
  int mi = min(a*n, b);
  cout << mi << endl;
  return 0;
}



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

int A[20]={0};
int n,m,q;

int solve(int i,int m){
	if(m==0){return 1;}
	if(i>=n){return 0;}
	int res=solve(i+1,m)||solve(i+1,m-A[i]);
	return res;
}

int main(){
    cin>>n;
    for(int i=0;i<n;++i){
        cin>>A[i];
    }
    cin>>q;
    for(int i=0;i<q;++i){
        cin>>m;
        if(solve(0,m)){
            cout<<"yes\n";
        }
        else{
            cout<<"no\n";
        }
    }
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

int main()
{
  long long S;
  cin >> S;
  long long X1, Y1, X2, Y2, X3, Y3;
  long long billion = pow(10, 9);
  X1 = 0;
  Y1 = 0;
  X2 = billion;
  Y2 = 1;
  X3 = billion - (S % billion);
  if (X3 >= billion)
    X3 = 0;
  Y3 = (S + X3) / billion;

  cout << X1 << " " << Y1 << " " << X2 << " " << Y2 << " " << X3 << " " << Y3 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int v[8];
int g[200][200];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, r;
    cin >> n >> m >> r;
    for (int i = 0; i < r; ++i)
        cin >> v[i], v[i]--;

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            g[i][j] = g[j][i] = (i == j ? 0 : 1e9);

    for (int i = 0; i < m; ++i)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        g[a][b] = g[b][a] = c;
    }
    for (int k = 0; k < n; ++k)
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                g[i][j] = min(g[i][j], g[i][k] + g[k][j]);

    int sol = 1e9;
    sort(v, v + r);
    do
    {
        int cost = 0;
        for (int i = 1; i < r; ++i)
            cost += g[v[i - 1]][v[i]];
        sol = min(sol, cost);
    } while (next_permutation(v, v + r));
    cout << sol;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}

void PrimeFactorization(vector<pair<ll, int>>& f, ll x) {
	ll p = 2;
	ll y = x;
	do
	{
		if (y % p == 0) {
			pair<ll, int> temp;
			temp.first = p;
			while (y % p == 0)
			{
				temp.second++;
				y /= p;
			}
			f.push_back(temp);
		}
		else {
			p++;
		}
		if (y == 1) {
			break;
		}
		if (p * p > x) {
			if (y > 1) {
				pair<ll, int> temp;
				temp.first = y;
				temp.second++;
				f.push_back(temp);
			}
			break;
		}
	} while (true);
}

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

	ll g = gcd(a, b);
	ll x = g;
	ll p = 2;
	ll cnt = 0;

	vector<pair<ll, int>> f;
	PrimeFactorization(f, g);
	cout << f.size() + 1 << endl;

	return 0;
}

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


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
 
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    ll dp[n+1][5]={};
    for(int i=1;i<=n;i++){
        for(int j=0;j<5;j++){
            dp[i][j]=1e18;
        }
    }
    for(int i=0;i<n;i++){
        bool pos = (a[i]==0);
        for(int j=0;j<5;j++){
            for(int k=0;k<=j;k++){
                if(k==0) dp[i+1][j] = min(dp[i+1][j],dp[i][0]+a[i]);
                if(k==1) dp[i+1][j] = min(dp[i+1][j],dp[i][1]+(a[i])%2+pos*2);
                if(k==2) dp[i+1][j] = min(dp[i+1][j],dp[i][2]+(a[i]+1)%2);
                if(k==3) dp[i+1][j] = min(dp[i+1][j],dp[i][3]+(a[i])%2+pos*2);
                if(k==4) dp[i+1][j] = min(dp[i+1][j],dp[i][4]+a[i]);
            }
            //cerr << i << " " << j << " " << dp[i+1][j] << endl;
        }
    }
    ll ans = 1e18;
    for(int i=0;i<5;i++) ans = min(ans,dp[n][i]);
    cout << ans << endl;
}

Measured memory_bytes: 9728
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) {
		int i=0,j=0,k=0;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int[] a = new int[n];
		int x2=0;
		int x4=0;
		for(i=0;i<n;i++) {
			a[i] = parseInt(sc.next());
			if(a[i]%4==0) {
				x4++;
				continue;
			}
			if(a[i]%2==0) {
				x2++;
				continue;
			}
		}
		sc.close();
		out.println(x2/2+x4>=n/2?"Yes":"No");
	}
}


Measured memory_bytes: 48916
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mxn = 2e5 + 5;

class DisjointSet{ 
public:
    
    vector<int> parent;
    
    DisjointSet(int n): parent(n){
        for(int i=0; i<n; i++){
            parent[i] = i;
        }
    }
    
    void join(int a, int b){
        parent[find(b)] = find(a);
    }
    
    int find(int a){
        return a == parent[a] ? a : parent[a] = find(parent[a]);
    }
    
    bool check(int a, int b){
        return find(a) == find(b);
    }
    
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i, n, x, t1, t2;
    cin >> n >> x;
    DisjointSet dsu(n);
    for(i=0; i<x; i++){
        cin >> t1 >> t2;
        t1--;
        t2--;
        dsu.join(t1, t2);
    }
    int ans = 0;
    int t = dsu.find(0);
    for(i=0; i<n; i++){
        int temp = dsu.find(i);
        if(temp != t){
            ans++;
            dsu.join(0, i);
        }
    }
    cout << ans;
    return 0;
}


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	int m,d;cin>>m>>d;
	int cnt=0;
	for(int i=1;i<=m;i++){
		for(int j=10;j<=d;j++){
			int a=j/10,b=j%10;
			if(a>=2&&b>=2&&a*b==i)cnt++;
		}
	}
	cout<<cnt<<endl;
}

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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
#define PRINT_ENTER() cout << endl;
#define ll long long

int main() {
    /* code */
    int n;
    ll y;
    cin >> n >> y;
    for (int a = 0; a <= n; ++a) {
        for (int b = 0; a + b <= n; ++b) {
            int c = n - a - b;
            int total = 10000 * a + 5000 * b + 1000 * c;
            if (total == y) {
                cout << a << " " << b << " " << c << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

N = I()
S = input()

if N % 2 == 1:
    print("No")
else:
    if S[0 : int(N / 2)] == S[int(N / 2) :]:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 43376
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<string> vs;
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);

int main() {
    while (true){
        int n, x;
        cin >> n >> x;
        if (n == 0 && x == 0) return 0;
        int ans = 0;
        rep2(i, 1, n - 1){
            rep2(j, i + 1, n){
                rep2(k, j + 1, n + 1){
                    if (i + j + k == x) ans++;
                }
            }
        }
        cout << ans << endl;
    }
    
}


Measured memory_bytes: 3080
//Jai Shree Ram
//#include <iostream>
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define loopi(stop) for(int i=0; i<stop; i++)
#define loopj(stop2) for(int j=0; j<stop2; j++)
#define loopk(stop3) for(int k=0; k<stop3; k++)
#define loopi1(stop) for(int i=1; i<=stop; i++)
#define loopj1(stop2) for(int j=1; j<=stop2; j++)
#define loopk1(stop3) for(int k=1; k<=stop3; k++)
#define loopse(kt,sstart, eend) for(int kt = sstart; kt<eend; kt++)
#define faster_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define file_io_cf freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define p_b push_back
#define pii pair<int,int>
#define fi first
#define se second
#define prec_10 << fixed << setprecision(10)
#define DEB cout<<"DEBUG"<<'\n';
#define SRAND srand(time(0));

using namespace std;

int mod = 1000000007;

template <typename T>
void O(T x) {
	cout << x << '\n';
}

///////////////////////////////////CODE STARTS HERE///////////////////////////////////////////

int32_t main() {

	faster_io
	// file_io_cf

	int n; cin >> n;
	int a[n];
	loopi(n) {
		cin >> a[i];
	}

	int sum = 0;

	int ans = 0;

	loopi(n) {
		if (i > 0) {
			ans += (sum * a[i])%mod;
			ans = ans % mod;

		}
		sum += a[i];
		sum = sum % mod;
	}

	O(ans);


	return 0;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int a,b;
	cin >> a;
	string c,d;
	vector<string> v,v2;
	for (int i=0; i<a; ++i){
		cin >> c;
		v.emplace_back(c);
	}
	cin >> b;
	for (int i=0; i<b; ++i){
		cin >> d;
		v2.emplace_back(d);
	}
	int ret = 0;
	for (int i=0; i<a; ++i){
		int crt=0;
		for (int j=0; j<a; ++j){
			if (v[i] == v[j]){
				crt++;
			}
		}
		for (int j=0; j<b; ++j){
			if (v[i] == v2[j]){
				--crt;
			}
		}
		ret = max(ret,crt);
	}
	cout << ret;
	return 0;
}

Measured memory_bytes: 256
<?php

$s = trim(fgets(STDIN));
$len = strlen($s);
$sum = 0;
for ($i = 0; $i < $len; $i++) {
    $sum += $s[$i];
}
if ($sum % 9 == 0) {
    echo 'Yes', PHP_EOL;
} else {
    echo 'No', PHP_EOL;
}

Measured memory_bytes: 16588
#include<stdio.h>

int main(){
  int o,n,k,i,j;
  int key;
  int A[110];
  scanf("%d",&n);
  for(i=1;i<=n;i++)scanf("%d",&A[i]);

  /*for(o=1;o<=n;o++)
    {
      if(o == n){printf("%d\n",A[o]);}
      else printf("%d ",A[o]);
    }
  */
  for(j=1;j<=n;j++)
    {   
	      key = A[j];		
	      i = j-1;
	      while(i>0 && A[i]>key)
		{
		  A[i+1]=A[i];  
		  i = i-1;
		}
	      A[i+1] = key;
	      for(k=1;k<=n;k++){
		if(k == n)printf("%d\n",A[k]);
		else printf("%d ",A[k]);
	      }
    }
  
  return 0;
}



Measured memory_bytes: 2056