akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve()
{
	ll d,s,t;
	cin>>d>>s>>t;
	if(s*t>=d)
	{
		cout<<"Yes"<<endl;
		return;
	}
	cout<<"No"<<endl;
	return;
}





int main()
{
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif

	int t = 1;
	//cin >> t;

	while (t--)
	{
		solve();
	}


	return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a[10000],b[10000];
ll MOD=1000000007;
ll A,B,ans,d[1000],cnt;
map<ll,ll> mp;
vector<ll> v,so;
ll f(ll x,ll y){
    if(y==0)return 1;
    if(y%2==0)return f(x,y/2)*f(x,y/2)%MOD;
    return x*f(x,y-1)%MOD;
}
ll gcd(ll x,ll y){
    if(y==0)return x;
    return gcd(y,x%y);
}
int main(){
    for(int i=2;i<1000;i++){
        if(d[i]==0)so.push_back(i);
        for(int j=1;j*i<1000;j++){
            d[i*j]=1;
        }
    }
    cin>>n;
    for(int i=0;i<n;i++){
      cin>>a[i];
      A=a[i];
     for(auto x:so){
        if(A%x==0&&A!=x){
            cnt=0;
          while(A%x==0){
                A/=x;
                cnt++;
          }
            mp[x]=max(mp[x],cnt);
            }
        }
        if(A!=1)
            mp[A]=max(mp[A],1LL);
    }
    B=1;
    for(auto x:mp){
        B*=f(x.first,x.second);
        B%=MOD;
    }
    for(int i=0;i<n;i++){
        ans+=B*f(a[i],MOD-2);
        ans%=MOD;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4168
N = int(input())
As = list(map(int, input().split()))
r = sum(As)
nAs = {}
for A in As:
  if A not in nAs:
    nAs[A] = 0
  nAs[A] += 1
Q = int(input())
for i in range(Q):
  B, C = map(int, input().split())
  if B not in nAs:
    print(r)
    continue
  n = nAs[B]
  if C not in nAs:
    nAs[C] = 0
  r += (C-B)*n
  nAs[B] = 0
  nAs[C] += n
  print(r)


Measured memory_bytes: 20992
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

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 ALL(x) x.begin(),x.end()
#define debug(output) cout<<#output<<"= "<<output<<endl

using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=1000000007;
struct UnionFind {
    int n;
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> group;
    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
        n=N;
    }
    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    void calc(){
        group.resize(n,0);
        for(int i=0;i<n;i++){
            group[root(i)]++;
        }
    }
    int size(int x){
        return group[root(x)];
    }
    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }
 
    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
 
};

signed main(){
  int n,m;cin>>n>>m;
  UnionFind tree(n+1);
  rep(i,m){
    int a,b;cin>>a>>b;
    tree.unite(a,b);
  }
  map<lint,int> memo;
  rep1(i,n){
    memo[tree.root(i)]+=1;
  }
  cout<<memo.size()-1<<"\n";
  return 0;
}


Measured memory_bytes: 9288
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque


from fractions import gcd

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
    
def lcm(x, y):
    return (x * y) // gcd(x, y)

def main():
    a,b,c,d = LI()
    c_d_gcd = lcm(c,d)
    s = b//c + b//d - b//c_d_gcd
    t = (a-1) // c + (a-1) // d - (a-1) // c_d_gcd
    print(b - a + 1 - (s-t))
main()




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

cnt=1##文字数
tmp=26

while n>tmp:
    cnt+=1
    tmp+=26**cnt
 
num=n-(tmp//26)
 
alp=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
 
if n<=26:
    ans=alp[n-1]
    print(ans)
else:
    ans=["0"]*cnt
    for i in range(cnt):
        j=num%26
        ans[-i-1]=alp[j]
        num//=26
    
    print(*ans, sep='')

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

int main() {
  string s, t;
  vector<string> o;
  cin >> s >> t;
  for(int i = 0; i < s.size() + 1 - t.size(); i++) {
    int f = 1;
    for(int j = 0; j < t.size(); j++)
      if(s.at(i + j) != t.at(j) && s.at(i + j) != '?')
        f = 0;
    if(f) {
      string u;
      for(int k = 0; k < s.size(); k++) {
        if(i <= k && k < i + t.size())
          u.push_back(t.at(k - i));
        else if(s.at(k) == '?')
          u.push_back('a');
        else
          u.push_back(s.at(k));
      }
      o.push_back(u);
    }
  }
  if(o.size()) {
    sort(o.begin(), o.end());
    cout << o.front() << endl;
  } else
    cout << "UNRESTORABLE" << endl;
}

Measured memory_bytes: 256
#import<iostream>
#define l long
using namespace std;l N,M,c,n=1,i,o=1e9+7;l m(l a){l g=1,h=2*o-4;while(h/=2){if(h&1)g=g*a%o;a=a*a%o;}return g;}l C(l b){l r=1,d=1;for(;b;--b){r=r*(N-1+b)%o;d=d*b%o;}return r*m(d)%o;}main(){cin>>N>>M;for(i=2;i*i<=M;++i){c=0;while(!(M%i)){++c;M/=i;}n=n*C(c)%o;}cout<<n*(M^1?N:1)%o<<endl;}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq


def solve(N, As, Q, BCs):
    # print(N, ",", As, ",", Q, ",", BCs)
    counter = collections.Counter(As)
    current_sum = sum(As)
    ans = []
    for b, c in BCs:
        if b in counter:
            original = counter[b] * b
            to = counter[b] * c
            diff = to - original
            current_sum += diff
            if c not in counter:
                counter[c] = 0
            counter[c] += counter[b]
            del counter[b]
        ans.append(str(current_sum))
    return "\n".join(ans)


# print(solve(4, [1, 2, 3, 4], 3, [(1, 2), (3, 4), (2, 4)]))

if __name__ == "__main__":
    N = int(input())
    As = list(map(int, input().split(" ")))

    Q = int(input())
    BCs = [tuple(map(int, input().split(" "))) for _ in range(Q)]

    print(solve(N, As, Q, BCs))


Measured memory_bytes: 39136
#include <stdio.h>
#include <stdlib.h>

int main(void){
  int n,r,x;
  scanf("%d",&n);
  scanf("%d",&r);
  if(n>=10){
    printf("%d",r);
  }else{
    x=r+(100*(10-n));
    printf("%d",x);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define MOD 1000000007
using namespace std;
vector<vector<int> > g;
vector<bool> visited;

map<pair<int, int>, int> edge_colours;
void dfs(int node, int colour, int max_colours)
{
    // cout<<node<<'\n';
    // cout<<colour<<'\n';
    visited[node] = true;
    // colour all edges leading out of this node colours except the colour that your parent  had
    int colour_val = 1;
    for(auto neighbour: g[node])
    {
        if(!visited[neighbour])
        {
            if(colour_val == colour)
                colour_val++;
            edge_colours[{node, neighbour}] = colour_val;
            dfs(neighbour, colour_val, max_colours);
            colour_val++;
        }
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    g.resize(n+1);
    visited.resize(n+1);
    vector<int> degrees(n+1);
    int max_colours = 0;
    vector<pair<int, int> > edges;
    for(int i=0;i<n-1;i++)
    {
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
        degrees[a]++;
        degrees[b]++;
        edges.push_back({a,b});
        max_colours = max(max_colours, degrees[a]);
        max_colours = max(max_colours, degrees[b]);
    }
    vector<set<int> > colours(n+1);
    dfs(1,0,max_colours);
    cout<<max_colours<<'\n';
    for(auto edge: edges)
    {
        if(edge_colours.find(edge)!=edge_colours.end())
        {
            cout<<edge_colours[edge]<<'\n';
        }
        else
        {
            cout<<edge_colours[{edge.second, edge.first}]<<'\n';
        }
    }
}

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

int main(){
  int aa, bb, cc;
  cin >> aa >> bb >> cc;
  int buf;
  if(aa>bb){
      buf =aa;
      aa = bb;
      bb = buf;
  }
  if(bb>cc){
      buf = bb;
      bb = cc;
      cc = buf;
  }
  if(aa>bb){
      buf = aa;
      aa = bb;
      bb = buf;
  }
  string s = to_string(aa)+" "+to_string(bb)+" "+to_string(cc);
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3236
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
// Points/Vectors - Projection
// status:

#define SUBMIT

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <sstream>
#include <cmath>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const double eps = 1e-10;

bool almost_equals(double a, double b) { return std::abs(a - b) < eps; }

class point2d {
public:
    point2d() : point2d(0.0, 0.0) {}

    point2d(double x, double y) : x_(x), y_(y) {}

    point2d operator+(const point2d& rhs) const { return {x_ + rhs.x_, y_ + rhs.y_}; }

    point2d operator-(const point2d& rhs) const { return {x_ - rhs.x_, y_ - rhs.y_}; }

    point2d operator*(double rhs) const { return {x_ * rhs, y_ * rhs}; }

    point2d operator/(double rhs) const { return {x_ / rhs, y_ / rhs}; }

    bool operator==(const point2d& rhs) const { return almost_equals(x_, rhs.x_) && almost_equals(y_, rhs.y_); }

    double l2_norm() const { std::sqrt(squared_l2_norm()); }

    double squared_l2_norm() const { return x_ * x_ + y_ * y_; }

    double x() const noexcept { return x_; }

    double y() const noexcept { return y_; }

    friend double dot(const point2d& lhs, const point2d& rhs);

    friend double cross(const point2d& lhs, const point2d& rhs);

private:
    double x_;
    double y_;

private:
};

double dot(const point2d& lhs, const point2d& rhs) {
    return lhs.x_ * rhs.x_ + lhs.y_ * rhs.y_;
}

double cross(const point2d& lhs, const point2d& rhs) {
    return lhs.x_ * rhs.y_ - lhs.y_ * rhs.x_;
}

bool is_orthogonal(const point2d& lhs, const point2d& rhs) {
    return almost_equals(dot(lhs, rhs), 0.0);
}

bool is_parallel(const point2d& lhs, const point2d& rhs) {
    return almost_equals(cross(lhs, rhs), 0.0);
}

class segment {
public:
    segment() : segment(point2d(), point2d()) {}

    segment(const point2d& p1, const point2d& p2) : p1_(p1), p2_(p2) {}

    const point2d& p1() const noexcept { return p1_; }

    const point2d& p2() const noexcept { return p2_; }

private:
    point2d p1_;
    point2d p2_;
};

point2d project(const segment& s, const point2d& p) {
    auto base = s.p2() - s.p1();
    auto r = dot(p - s.p1(), base) / base.squared_l2_norm();
    return s.p1() + base * r;
}

int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    string program_input_str = R"(0 0 5 -3
8
0 1
2 0
4 -1
6 -2
-1 -1
1 -2
3 -3
5 -4
)";
    stringstream stream(program_input_str);
#endif
    double x1, y1, x2, y2;
    stream >> x1 >> y1 >> x2 >> y2;
    segment s(point2d(x1, y1), point2d(x2, y2));
    int q;
    stream >> q;
    for (int i = 0; i < q; ++i) {
        int px, py;
        stream >> px >> py;
        auto proj = project(s, point2d(px, py));
        cout << setprecision(13) << proj.x() << " " << proj.y() << endl;
    }

    return 0;
}


Measured memory_bytes: 3280
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

struct Mod {
    static ll BASE;
    ll value = 0;
    static ll residue(ll value) { return (value % BASE + BASE) % BASE; }
    Mod(ll value)
    : value(residue(value)) {}
    Mod operator+(const Mod& rhs) const { return Mod(value + rhs.value); }
    void operator+=(const Mod& rhs) { *this = *this + rhs; }
    Mod operator-(const Mod& rhs) const { return Mod(value - rhs.value); }
    void operator-=(const Mod& rhs) { *this = *this - rhs; }
    Mod operator*(const Mod& rhs) const { return Mod(value * rhs.value); }
    void operator*=(const Mod& rhs) { *this = *this * rhs; }
};
ll Mod::BASE = 1000000007;

int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> xs(N);
    for (ll i = 0; i < N; i++) {
        cin >> xs[i];
    }
    vector<ll> ys(M);
    for (ll i = 0; i < M; i++) {
        cin >> ys[i];
    }
    Mod ans_x = 0;
    for (ll i = 0; i < N - 1; i++) {
        ans_x += ((Mod)xs[i+1] - (Mod)xs[i]) * ((Mod)N-1-(Mod)i) * ((Mod)i+1);
    }
    Mod ans_y = 0;
    for (ll i = 0; i < M - 1; i++) {
        ans_y += ((Mod)ys[i+1] - (Mod)ys[i]) * ((Mod)M-1-(Mod)i) * ((Mod)i+1);
    }
    Mod ans = ans_x * ans_y;
    cout << ans.value << endl;
}


Measured memory_bytes: 1792
// 問題URL
// https://atcoder.jp/contests/abc164/tasks/abc164_c

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer a = Integer.parseInt(scanner.next());
        Set<String> x= new HashSet<>();

        for(int i = 0; i < a; i++) {
            x.add(scanner.next());
        }
        System.out.println(x.size());
    }
}


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

int main() {
  int N,A,X,Y;
  cin >> N;
  Y=512;
  for (int i=0;i<N;i++) {
    cin >> A;
    X=0;
    for (int j=0;A%2==0;j++) {
      A/=2;
      X++;
    }
    if (X==0) {
      cout << 0 << endl;
      break;
    }
    else if (X<Y) {
      Y=X;
    }
    if (i==N-1) {
      cout << Y << endl;
    }  
  }
}


Measured memory_bytes: 3592
use proconio::*;

fn run() {
    input! {
        x: u64,
    }
    let mut now = 100;
    let mut cnt = 0;
    while now < x {
        now += now / 100;
        cnt += 1;
    }
    println!("{}", cnt);
}

fn main() {
    run();
}

Measured memory_bytes: 2156
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
    long long a;
    cin>>a;
    cout<<a/2+a%2<<endl;
}





Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	ss := strings.Fields(sc.Text())

	A, _ := strconv.Atoi(ss[0])
	B, _ := strconv.ParseFloat(ss[1], 64)
	BB := int(B*100 + 0.5)

	result := A * BB / 100

	fmt.Print(result)
}


Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n, s;
    while (1) {
        cin >> n >> s;
        if (!(n || s))break;
        map<int, int> map;
        eFOR(i, 0, 1 << 10) {
            int cnt = 0, sum = 0;
            eFOR(j, 0, 10)if (i & (1 << j)) {
                cnt++;
                sum += j;
            }
            if (cnt == n)map[sum]++;
        }
        cout << map[s] << "\n";
    }
}



Measured memory_bytes: 3244
#include <cstdio>
#include <cstring>

using namespace std;

void swap(char *a, char *b){
  char tmp = *a;
  *a = *b;
  *b = tmp;
}

int main()
{
  char str[32];
  scanf("%s", str);
  int len = strlen(str);
  for(int i=0;i<len/2;i++)
    swap(&str[i], &str[len-i-1]);

  puts(str);
  return 0;
}

Measured memory_bytes: 944
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  int a, b, c;
  cin>>a>>b>>c;
  vector<int> x = {a,b,c};
  sort(x.begin(), x.end());
  if (x[0] == 5 && x[1] == 5 && x[2] == 7) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

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

#include <stdio.h>
using namespace std;

int main(void) {
	string sentence;
	getline(cin, sentence);
	for (int i = 0; i < sentence.length(); i++) {
		int ascii = (int) sentence[i];
		if (65 <= ascii && ascii <= 90)
			sentence[i] += 32;
		if (97 <= ascii && ascii <= 122)
			sentence[i] -= 32;
		cout << sentence[i];
	}
	cout << endl;
	return 0;
}



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


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,W,w1;cin>>n>>W;
  vector<int> a[4];
  rep(i,n){
    int w,v;cin>>w>>v;
    if(i==0)w1=w;
    a[w-w1].push_back(v);
  }
  rep(i,4){
    sort(a[i].begin(),a[i].end());
    a[i].push_back(0);
    reverse(a[i].begin(),a[i].end());
    for(int j=1;j<a[i].size();j++)a[i][j]+=a[i][j-1];
  }
  ll ans=0;
  for(int i=0;i<a[0].size();i++){
    for(int j=0;j<a[1].size();j++){
      for(int k=0;k<a[2].size();k++){
        for(int l=0;l<a[3].size();l++){
          ll fact=i*w1+j*(w1+1)+k*(w1+2)+l*(w1+3);
          if(fact<=W)ans=max(ans,ll(a[0][i]+a[1][j]+a[2][k]+a[3][l]));
        }
      }
    }
  }
  cout<<ans<<endl;
  return 0;
  }


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn square(x: i64) -> i64 {
    x * x
}
fn main() {
    let n = read::<usize>();
    let d = read::<usize>();
    let mut ps = vec![vec![0; d]; n];
    for i in 0..n {
        for j in 0..d {
            ps[i][j] = read::<i64>();
        }
    }
    let mut ans = 0;
    for i in 0..n {
        for j in i + 1..n {
            let mut sum = 0;
            for k in 0..d {
                sum += square(ps[i][k] - ps[j][k])
            }
            let sqsum = (sum as f64).sqrt() as i64;
            if sum == sqsum * sqsum {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


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

int main()
{
    int N;
    cin >> N;
    for (int i = 1; i <= 9; i++)
    {
        for (int j = 1; j <= 9; j++)
        {
            if (N == i * j)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }

const int maxn = 1e6 + 7;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    ll n,x,t;
    cin >> n >> x >> t;

    ll tot = (n+(x-1))/x;
    ll ans = tot*t;
    out(ans);
    
    
    return 0;
}


Measured memory_bytes: 3596
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,A,B;
	string s;
	while(cin>>N>>A>>B>>s) {
		ll a=0,b=0;
		REP(i, N) {
			ll c=0;
			if(s[i]=='a') {
				c=a+b<A+B;
				if(c)a++;
			}
			if(s[i]=='b') {
				c=a+b<A+B&&b+1<=B;
				if(c)b++;
			}
			cout<<YN(c)<<endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 848
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    N = int(inputs[0])
    S = inputs[1]
    new_s = []
    ord_a = ord('A')
    ord_z = ord('Z')
    for c in S:
        ordc = ord(c)
        ordc += N
        if ordc > ord_z:
            d = ordc - ord_z - 1
            ordc = ord_a + d
        new_s.append(chr(ordc))
    return "".join(new_s)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)


Measured memory_bytes: 39280
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, M): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };
    let A: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    fn bis<P: Fn(i64) -> bool>(ok: i64, ng: i64, p: P) -> i64 {
        let mid = (ok + ng) / 2;
        if (ok - ng).abs() == 1 {
            ok
        } else if p(mid) {
            bis(mid, ng, p)
        } else {
            bis(ok, mid, p)
        }
    }

    let B = {
        let mut B = A.clone();
        B.sort();
        B.reverse();
        B
    };
    let mut acc = vec![0];
    for i in 0..N {
        let s = acc[i] + B[i];
        acc.push(s);
    }
    let f = |m| {
        (0..N).fold((0, 0), |(c, s), i| {
            let j = bis(i as i64 - 1, N as i64, |k| {
                k == i as i64 - 1 || B[i as usize] + B[k as usize] >= m
            });
            if j == i as i64 - 1 {
                (c, s)
            } else {
                let q = j - i as i64;
                (
                    (c as i64 + 2 * q + 1) as usize,
                    s + 2 * q * B[i] + 2 * (acc[(j + 1) as usize] - acc[i]),
                )
            }
        })
    };
    const INF: i64 = 1e12 as i64;
    let L = bis(1, INF, |m| {
        let (c, _) = f(m);
        c >= M
    }) as i64;
    let (c, s) = f(L);
    let ans = s - (c - M) as i64 * L;

    println!("{}", ans);
}


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

using namespace std;

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

    vector<int> a(n);

    for (int &x : a)
        cin >> x;

    int gcd = a[0];

    for (int x : a)
        gcd = __gcd(gcd, x);

    int maximum = *max_element(a.begin(), a.end());

    if (k <= maximum and k % gcd == 0)
        cout << "POSSIBLE" << endl;
    else
        cout << "IMPOSSIBLE" << endl;

    return 0;
}

Measured memory_bytes: 3736
# D - Line++
def main():
    N, X, Y = map(int, input().split())
    dist_cnt = [0] * N
    calc_min_dist = lambda x, y: min(y - x, abs(X - x) + abs(Y - y) + 1)  # assume x < y
    for i in range(1, N + 1):
        for j in range(i + 1, N + 1):
            dist_cnt[calc_min_dist(i, j)] += 1
    print("\n".join(map(str, dist_cnt[1:])))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef int FLOW;
const int MAX_V =210;
const FLOW INF = 10000;

struct Edge{
   int rev,from,to;
   FLOW cap,icap;
   Edge(int r,int f,int t,FLOW c):rev(r),from(f),to(t),cap(c),icap(c){}
};
struct Graph{
   int V;
   vector<Edge> list[MAX_V];
   
   Graph(int n=0):V(n){rep(i,MAX_V)list[i].clear();}
   void init(int n=0){
      V=n;
      rep(i,MAX_V)
        list[i].clear(); 
   }
   void resize(int n=0){V=n;}
   void reset(){
      rep(i,V)
        rep(j,list[i].size())
          list[i][j].cap=list[i][j].cap; 
   }
   inline vector<Edge>& operator [](int i){
      return list[i]; 
   }
   Edge &redge(Edge e){
      if(e.from != e.to)
        return list[e.to][e.rev]; 
      else
        return list[e.to][e.rev+1]; 
   }
   void addedge(int from,int to,FLOW cap){
      list[from].push_back(Edge((int)list[to].size(),from,to,cap)); 
      list[to].push_back(Edge((int)list[from].size()-1,to,from,0));
   }
};
int level[MAX_V], iter[MAX_V];
void bfs(Graph G,int s){
  memset(level,-1,sizeof(level));
  level[s]=0;
  queue<int> q;
  level[s]=0;
  q.push(s);
  while(!q.empty()){
    int v=q.front();
    q.pop();
    rep(i,G[v].size()){
      Edge &e=G[v][i];
      if(e.cap>0&&level[e.to]<0){
        level[e.to]=level[v]+1;
        q.push(e.to);
      }
    }
  }
}
int dfs(Graph &G,int v,int t,int f){
   if(v==t)
     return f;
   for(int &i=iter[v];i<(int)G[v].size();i++) {
      Edge &e=G[v][i],&re=G.redge(e);;
      if(e.cap>0&&level[v]<level[e.to]){
        FLOW d=dfs(G,e.to,t,min(f,e.cap));
        if(d>0){
           e.cap-=d;
           re.cap+=d;
           return d; 
        }
      } 
   }
   return 0;
}
int maxflow(Graph &G,int s,int t){
   int flow=0;
   while(true){
      bfs(G,s);
      if(level[t]<0)
        return flow;
      memset(iter,0,sizeof(iter));
      int f;
      while((f=dfs(G,s,t,INF))>0) 
        flow+=f;
   }
   return 0;
}
int main() {
  int n,x,y;
  cin>>n;
  Graph G(n+n+2);
  vector<pair<int,int>> red(n);
  rep(i,n)
    cin>>red[i].first>>red[i].second;
  rep(i,n){
     cin>>x>>y;
     rep(j,n)
       if(red[j].first<x&&red[j].second<y)
         G.addedge(i,j+n,1); 
  }
  rep(i,n){
    G.addedge(n+n,i,1);
    G.addedge(i+n,n+n+1,1);
  }
  printf("%d",maxflow(G,n+n,n+n+1));
  return 0;
}

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

void main()
{
    auto np = readln.split.to!(long[]);
    auto N = np[0];
    auto P = np[1];
    auto S = readln.chomp;

    if (P == 2 || P == 5) {
        long r;
        foreach (i, c; S) if ((c-'0')%P == 0) r += i.to!long + 1;
        writeln(r);
        return;
    }

    auto DP = new long[](P);
    DP[0] = 1;
    long s, d = 1, r;
    foreach_reverse (c; S) {
        (s += (c - '0').to!long * d) %= P;
        r += DP[s];
        ++DP[s];
        (d *= 10) %= P;
    }
    writeln(r);
}

Measured memory_bytes: 3076
N, M = map(int,input().split())
a = [ list(map(int,input().split())) for i in range(N) ]
b = [ list(map(int,input().split())) for j in range(M) ]
for i in range(N):
    ans = 0
    d = 10**9
    for j in range(M):
        tmp = abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])
        if tmp<d:
            d = tmp
            ans = j+1
    print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

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

  int n;
  cin >> n;
  vector<int> s(n);
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  long sum = 0;
  for(int i = n - 1; i >= 0; i--){
    sum += s[i];
  }
  for(int i = 0; i < n; i++){
    if(sum % 10 != 0){
      cout << sum << endl;
      return 0;
    }
    if(s[i] % 10 != 0 ) sum -= s[i];
  }
  cout << 0 << endl;  
}

Measured memory_bytes: 256
S = input()

lst = []
for i in range(0, len(S)):
    for k in range(0, len(S)):
        if i > k:
            pass
        else:
            lst.append(S[i:k+1])
lst.append("")
lst_AGCT = []
for i in range(len(lst)):
    if "B" in lst[i] or "D" in lst[i] or "E" in lst[i] or "F" in lst[i] or "H" in lst[i] or "I" in lst[i] or "J" in lst[i] or "K" in lst[i] or "L" in lst[i] or "M" in lst[i] or "N" in lst[i] or "O" in lst[i] or "P" in lst[i] or "Q" in lst[i] or "R" in lst[i] or "S" in lst[i] or "U" in lst[i] or "V" in lst[i] or "W" in lst[i] or "X" in lst[i] or "Y" in lst[i] or "Z" in lst[i]:
        pass
    else:
        lst_AGCT.append(lst[i])

if lst_AGCT == [""]:
    print(0)
else:
    print(len(max(lst_AGCT, key=len)))

Measured memory_bytes: 3064
import heapq

N,M=map(int,input().split())
A=list(map(int,input().split()))

for i in range(0,N):
    A[i]=-A[i]

heapq.heapify(A)
for i in range(0,M):
    x=heapq.heappop(A)
    x=-x
    x=x//2
    heapq.heappush(A,-x)

ans=0
for i in range(0,N):
    ans-=A[i]
print(ans)


Measured memory_bytes: 14180
#include<bits/stdc++.h>
using namespace std;
#define int long long
char S[105];int K,las=1;
vector<int> vec;
signed main(){
	cin>>(S+1)>>K;
	int n=strlen(S+1);
	if(n==1) return cout<<n*K/2,0;
	for(int i=2;i<=n;++i)
		if(S[i]!=S[i-1]) vec.push_back(i-las),las=i;
		else if(i==n) vec.push_back(i-las+1);
	//for(auto v:vec) cout<<v<<endl;
	if(vec.size()==1) return cout<<n*K/2,0;
	if(S[1]==S[n]){
		int ans=0;
		for(int i=1;i<vec.size()-1;++i)
			ans+=vec[i]/2;ans*=K;
		ans+=(vec.front()+vec.back())/2*(K-1);
		ans+=vec.front()/2+vec.back()/2;
		cout<<ans;
	}
	else{
		int ans=0;
		for(auto v:vec)
			ans+=v/2*K;
		cout<<ans;
	}
	return 0;
} 

Measured memory_bytes: 3596
#include<stdio.h>
#include <algorithm>

struct sushi
{
	long long x, v;
};

const int MAXN = 100005;

const bool cmpx(sushi &a, sushi &b) {
	return a.x < b.x;
}

sushi f[MAXN];
long long sum[MAXN];
long long inv[MAXN];
long long b1[MAXN], r1[MAXN], b2[MAXN], r2[MAXN];


int main () {

	long long n, c;

	scanf("%lld %lld", &n, &c);

	for(int i = 1; i <= n; i++) {
		scanf("%lld %lld", &f[i].x, &f[i].v);
	}

	std::sort(f, f + n, cmpx);

	sum[0] = 0;
	b1[0] = 0;
	b2[0] = 0;
	for(int i = 1; i <= n; i++) {
		sum[i] = sum[i - 1] + f[i].v;
		b1[i] = std::max(b1[i - 1], sum[i] - f[i].x);
		b2[i] = std::max(b2[i - 1], sum[i] - 2 * f[i].x);
	}

	inv[0] = 0;
	r1[0] = 0;
	r2[0] = 0;
	for(int i = 1; i <= n; i++) {
		inv[i] = inv[i - 1] + f[n + 1 - i].v;
		r1[i] = std::max(r1[i - 1], inv[i] - (c - f[n + 1 - i].x));
		r2[i] = std::max(r2[i - 1], inv[i] - 2 * (c - f[n + 1 - i].x));
	}
/*
	for(int i = 0; i <= n; i++) {
		printf("%lld ", sum[i]);
	}
	printf("\n");

	for(int i = 0; i <= n; i++) {
		printf("%lld ", inv[i]);
	}
	printf("\n");

	for(int i = 0; i <= n; i++) {
		printf("%lld ", b1[i]);
	}
	printf("\n");

	for(int i = 0; i <= n; i++) {
		printf("%lld ", b2[i]);
	}
	printf("\n");

	for(int i = 0; i <= n; i++) {
		printf("%lld ", r1[i]);
	}
	printf("\n");

	for(int i = 0; i <= n; i++) {
		printf("%lld ", r2[i]);
	}
	printf("\n");
*/

	long long xim = 0;

	for(int i = 0; i <= n; i++) {
		xim = std::max(xim, b1[i]);
		xim = std::max(xim, r1[i]);
		xim = std::max(xim, b1[i] + r2[n - i]);
		xim = std::max(xim, r1[i] + b2[n - i]);
	}

	printf("%lld\n", xim);

	return 0;
}

Measured memory_bytes: 6400
/******* all required header files *******/
#include<iostream>
#include<algorithm>
#include<cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;

/*****All definitions*******/
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int>
#define vs vector<string>
#define mp make_pair
#define ll long long int
/***************************/

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	string str;
	cin >> str;
	int n = str.size();
	if (str[n - 1] == '2' || str[n - 1] == '4' || str[n - 1] == '5' || str[n - 1] == '7' || str[n - 1] == '9')
		cout << "hon" << "\n";
	if (str[n - 1] == '0' || str[n - 1] == '1' || str[n - 1] == '6' || str[n - 1] == '8')
		cout << "pon" << "\n";
	if (str[n - 1] == '3')
		cout << "bon" << "\n";
	return 0;
}


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

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

    int cnt = 0;
    for (int i = 0; i <= a; i++)
        for (int j = 0; j <= b; j++)
            for (int k = 0; k <= c; k++)
                if (500 * i + 100 * j + 50 * k == x)
                    cnt++;

    cout << cnt << endl;
}

Measured memory_bytes: 3628
n = int(input())
B_li = list(map(int,input().split()))

A_li = [0 for i in range(n)]

A_li[0] = B_li[0]
A_li[n-1] = B_li[n-2]
for i in range(1,n-1):
    A_li[i] = min(B_li[i-1],B_li[i])

ans = sum(A_li)
print(ans)

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

int main(void){
    ll n;
    cin >> n;

    ll x[n], y[n];
    rep(i, n){
        cin >> x[i];
        y[i] = x[i];
    }

    sort(x, x + n);

    rep(i, n){
        if(y[i] < x[n / 2]){
            cout << x[n / 2] << endl;
        }else{
            cout << x[n / 2 - 1] << endl;
        }
    }
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amax(T& a,T b){if(a < b) a = b;}



int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n >>k;
	VI p(n);
	rep(i, n) cin >>p[i];
	
	vector<double> dt(n), sm(n+1);
	rep(i, n){
		dt[i] = (p[i] + 1) / 2.0;
	}
	rep(i, n) sm[i+1] = sm[i] + dt[i];
	double ans = 0;
	rep(i, n+1-k){
		ans = max(ans, sm[i+k] - sm[i]);
		
	}
	printf("%.14f\n", ans);
	return 0;
}


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

using namespace std;
typedef long long LL;

int main(){
  int N;
  cin >> N;
  vector<int> a(N*3);
  rep(i,N*3) cin >> a[i];
  sort(a.begin(),a.end(),greater<int>());
  LL ans=0;
  rep(i,N) ans+=a[i*2+1];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();

#define MAXX 500005
#define PI 3.14159265358979323846264338327950
#define F first
#define S second
#define ll   long long int
#define mod  1000000007



int main()
{
	FAST;
	ll t;
	
		ll n, m;
		cin >> n >> m;
		if(n <= 2 * m){
			cout << 0;
		}
		else{
			cout << n - (2*m);
		}
		cout << endl;
	
}

Measured memory_bytes: 3660
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

Scanner vd = new Scanner(System.in);

		int n = vd.nextInt();
		vd.close();
		if(n%2==1) System.out.println(2*n);
		else System.out.println(n);


	}

}


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

int main() { 
    int N; cin >> N;
    vector<int> H;
    for(int i=0; i<N; i++) {
        int h; cin >> h;
        H.push_back(h);
    }

    int ct = 1;
    int minH = H[0];
    for (int i=1; i<N; i++) {
        if (H[i] >= minH) {
            ct++;
            minH = H[i];
        }
    }

    cout << ct << endl;

    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int[] a = new int[N];
        int i = 0;
        while(i < N){
            a[i] = sc.nextInt();
            i++;
        }
        int j = 1;
        boolean flag = false;
        while(true){
            double div = Math.pow(2, j);
            for(int c: a){
                if(c % div != 0){
                    flag = true;
                    break;
                }
            }
            if(flag){
                break;
            }
            j++;
        }
        System.out.println(j - 1);
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
long long gcd(long long  a,long long  b)
{
	if(b == 0)
		return a;
	return gcd(b,a%b);
}
int main()
{
	int N;
	while(~scanf("%d",&N))
	{
		long long a[200];
		for(int i=0;i<N;++i)
		{
			scanf("%lld",&a[i]);
		}
		long long k;
		sort(a,a+N);
		long long  temp = a[0];
		for(int i=1;i<N;++i)
		{
			/*if(a[i]>=temp && a[i]%temp == 0)
			{
				temp=a[i];
			}
			else
			{*/
				k = gcd(temp,a[i]);
				temp = temp/k;
				temp*=a[i];
			//}
		}
		printf("%lld\n",temp);
	}
}

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

int main() {
  int N,kisuu=0;
  cin >> N;
  for(int i=0; i<N; i++){
    int a;
    cin >> a;
    if(a%2 == 1){
      kisuu++;
    }
  }
  if(kisuu%2 == 1){
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
}


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

void Main()
{
    long n, a, b;
    cin >> n >> a >> b;
    long blue = n / (a + b) * a;
    long hasu = n % (a + b);
    if(hasu <= a) blue += hasu;
    else blue += a;
    cout << blue << endl;
}

int main(int argc, char **argv)
{
    Main();
    return 0;
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
char s[100];
int main(){
    scanf("%s",s);
    int n = strlen(s);

    REP(i,n){
        printf("%c",s[n - 1 - i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 3072
//************************************************************************//
//*Author : Handsome How                                                 *//
//************************************************************************//
//#pragma comment(linker, "/STA    CK:1024000000,1024000000")
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <ctime>
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define foreach(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define fur(i,a,b) for(int i=(a);i<=(b);i++)
#define furr(i,a,b) for(int i=(a);i>=(b);i--)
#define cl(a) memset((a),0,sizeof(a))
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#ifdef HandsomeHow
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define dbg(x) cerr << #x << " = " << x << endl
#else
#define debug(...)
#define dbg(x)
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
const int inf=0x3f3f3f3f;
const double eps=1e-8;
const int mod=1000000007;
const double pi=acos(-1.0);
inline void gn(long long&x){
    int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
    while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;
}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
ll gcd(ll a,ll b){return a? gcd(b%a,a):b;}
ll powmod(ll a,ll x,ll mod){ll t=1ll;while(x){if(x&1)t=t*a%mod;a=a*a%mod;x>>=1;}return t;}
// (づ°ω°)づe★
//-----------------------------------------------------------------
ll a[2222],x;
ll best[2222];
int n;
int main(){
#ifdef HandsomeHow
    //freopen("data.in","r",stdin);
    //freopen("data.out","w",stdout);
    time_t beginttt = clock();
#endif
	cin>>n>>x;
	ll ans = 0;
	fur(i,0,n-1){
		cin>>a[i];
		ans+=a[i];
		best[i]=a[i];
	}
	//dbg(ans);
	fur(i,1,n){
		ll now = x*i;
		fur(j,0,n-1){
			best[j]=min(best[j],a[(j-i+n)%n]);
			//dbg(best[j]);
			now+=best[j];
		}
		//dbg(now);
		ans=min(ans,now);
	}
	cout<<ans<<endl;
#ifdef HandsomeHow
	time_t endttt = clock();
    debug("time: %d\n",(int)(endttt - beginttt));
#endif
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <cstdio>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
int n;
map<int,int>mmp;
int main()
{
    scanf("%d",&n);
    int _max=0;
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d",&x);
        mmp[x]++;
        mmp[x+1]++;
        mmp[x-1]++;
        _max=max(_max,max(mmp[x],max(mmp[x+1],mmp[x-1])));
    }
    printf("%d\n",_max);
    return 0;
}


Measured memory_bytes: 4736
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN  reverse replace stringstream string::npos length substr front priority_queue
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
const ll mod = 1e9 + 7 ;
const ll inf =
 1e9 + 5 ;
 //1e18L + 5;
const ll nax = 55;
void min_self(ll&a , ll b){a=min(a,b);}
void max_self(ll&a , ll b){a=max(a,b);}
void add_self(ll&a , ll b){a=(a+b)%mod;}
//#define (x)  get<0>(x) 
//#define (x)  get<1>(x)
//#define (x)  get<2>(x)
vector<pair<ll,ll>> edges[nax]  ;

vector<ll> path , found ; 

void dfs ( ll u , ll v , ll parent ){

	if( u == v){
		found = path ;
	}
	for(auto child : edges[u]){
		ll b = child.first ; 
		ll e = child.second ;

		if(b == parent )continue ; 
		path.push_back( e) ; 
		dfs(b , v,  u ) ; 
		path.pop_back();
	}



}

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

ll n ; cin >> n ;
for(ll i = 0 ; i< n -1 ; i++){
	ll a , b ; 
	cin >> a >> b; 
	edges[a].emplace_back(b,i);
	edges[b].emplace_back(a,i) ;

} 
ll m  ; cin >> m ; 
vector<ll> containME(n-1) ; 
for(ll j = 0 ; j<m ; j++){
	ll a , b ; 
	cin >> a >> b; 
	found.clear(); 
	path.clear() ; 

	dfs(a , b , -1);
	ll mask = 0 ; 
	for(auto i : found){
		// cout << i << endl;
		containME[i] |= (1<<j ) ;
	}
	// cout << containME[j] << endl;

}

vector<ll> dp(1<<m); 
dp[0] = 1 ;
	// for(auto i:dp)cout << i<<" " ;cout<<endl;

for(ll e = 0 ; e<n-1 ; e++){
	vector<ll> new_dp(1<<m) ; 

	for(ll mask  = 0 ; mask <(1<<m)  ; mask ++){
		new_dp[mask] += dp[mask] ;
		new_dp[mask | containME[e]] += dp[mask] ;
	}

	dp = new_dp ;
	// for(auto i:dp)cout << i<<" " ;cout<<endl;


}

cout << dp[(1<<m) - 1 ] ;



	
}

Measured memory_bytes: 16764
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <cstdio>
//#include <iomanip>//"cout<<fixed<<setprecision(n)<<sth<<endl;"
//#include <string>//"reverse(s's it,s's it)"
//#include <functional>//"greater<T>" "sort(a,a+n,greater<int>());""
//#include <cmath>//"abs" "sqrt"
//#include <numeric>//"accumulate(inputit,inputit,init,(optional) object)"
//#include <algorithm>//"lower_bound(it,it,v)" "next_permutation(a,a+n)"
//"reverse(v's it,v's it)"(v: vector)
using namespace std;
#define pb push_back//also for STRING
#define fi first
#define sc second
#define mp make_pair
#define is insert
#define ps push//TMP//stack,(priority) queue,
#define fr front//TMP//queue//for priority, use top().
typedef long long ll;//not necessarily
typedef pair<int,int> pii;
//Add other types in the same way.
const ll M=1000000007;//can be changed
int mod(int a){	return (a+M)%M;	}//M can be a variable
void plmod(ll &a,ll b){	a=(a+b+M)%M;	return;	}
void mnmod(ll &a,ll b){	a=(a-b+M)%M;	return;	}
void mlmod(ll &a,ll b){	a=(a*b)%M;  	return;	}
//Caution! you may need sth larger than "+M"!
void chmax(int &a,int b){	a=max(a,b);	return;	}
void chmin(int &a,int b){	a=min(a,b);	return;	}
//These 2 could be better in long long

int main(){
	ll a[4],b[4],n;
	cin>>a[0]>>a[1]>>a[2]>>a[3]>>n;
	a[0]*=8;
	a[1]*=4;
	a[2]*=2;
	n*=4;
	bool f[4];
	fill(f,f+4,false);
	for(int i=0;i<4;++i){
		int mni=0;
		for(int j=1;j<4;++j) if((!f[j])&&(f[mni]||a[j]<a[mni])) mni=j;
//		cout<<mni<<endl;
		f[mni]=true;
		ll d=1<<mni;
		b[mni]=d*(n/d);
		n%=d;
	}
	ll ans=0;
	for(int i=0;i<4;++i) ans+=a[i]*b[i];
	cout<<ans/8<<endl;
}

Measured memory_bytes: 256