akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <map>
#include <climits>
#include <stack>
#include <string>
#include <random>
#include<set>
#include <iomanip>

long double calSub(const std::vector<long double> &prob, const int rest, const int sur, std::vector<std::vector<long double>> &memo) {
	if (rest < sur) return 0;
	else if (rest == 0) return 1;
	else if (sur == 0) return 1;
	else {
		if (memo[rest][sur] == -1) {
			memo[rest][sur] = prob[rest - 1] * calSub(prob, rest - 1, sur - 1, memo) + (1 - prob[rest - 1]) * calSub(prob, rest - 1, sur, memo);
		}
		return memo[rest][sur];
	}
}
long double cal(const std::vector<long double> &prob) {
	std::vector<std::vector<long double>> memo(prob.size() + 1);
	for (auto i = 0; i < memo.size(); ++i) {
		memo[i] = std::vector<long double>(i + 1, -1);
	}
	for (unsigned int  i = 0; i < prob.size(); i += 100) {
		for (auto j = 0; j < ((i > prob.size() / 2) ? prob.size() / 2 : i); j += 100) {
			calSub(prob, i, j, memo);
		}
	}
	return calSub(prob, prob.size(), prob.size() / 2 + 1, memo);
}
int main() {
	int n; std::cin >> n;
	std::vector<long double> prob(n);
	for (auto &p : prob) std::cin >> p;
	std::cout << std::setprecision(12) << std::fixed;
	std::cout << cal(prob) << std::endl;
}

Measured memory_bytes: 70912
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-12;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;



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

	cin >> N >> M;
	vector<long long int>p;
	vector<long long int>m;
	long long int z = 0;
	for (int i = 0; i < N; i++) {
		cin >> K;
		if (K > 0)p.push_back(K);
		else if (K < 0)m.push_back(-K);
		else z++;
	}
	sort(p.begin(), p.end());
	sort(m.begin(), m.end());
	z = z * (z - 1) / 2 + z*(N - z);
	L = -MOD * MOD;
	R = MOD * MOD;
	while (R - L > 1) {
		long long int mid = (R + L) / 2;
		long long int num = 0;
		if (mid >= 0)num += z;
		if (mid >= 0) {
			num += 1LL * p.size()*m.size();
			long long int add = 0;
			for (auto i : p) {
				add += upper_bound(p.begin(), p.end(), (mid) / i) - p.begin();
				if (i*i <= mid)add--;
			}
			for (auto i : m) {
				add += upper_bound(m.begin(), m.end(), (mid) / i) - m.begin();
				if (i*i <= mid)add--;
			}
			num += add / 2;
		}
		else {
			long long int add = 0;
			for (auto i : p) {
				add += m.end() - lower_bound(m.begin(), m.end(), (abs(mid)+i-1) / i);
			}
			num += add;
		}
		//cout << mid << " " << num << endl;
		if (num >= M)R = mid;
		else L = mid;
	}
	cout << R << endl;
	return 0;
}


Measured memory_bytes: 2420
import bisect

N = int(input())
L = sorted(map(int, input().split()))
ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        k = bisect.bisect_left(L, L[i] + L[j])
        if k > j:
            ans += k - j - 1
print(ans)


Measured memory_bytes: 74448
import math
n = int(input())
list_voc = [str(input()) for _ in range(n)]
list_mo = []
for i, s in enumerate(list_voc):
    list_n = list(s)
    list_n.sort()
    list_n = ''.join(list_n)
    list_mo.append(list_n)

ans = {}
for s in list_mo:
    if s in ans:
        ans[s] += 1
    else:
        ans[s] = 1


ans_val = []

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


for s in ans:
    if ans[s] != 1:
        ans_val.append(cmb(ans[s], 2))


print(sum(ans_val))


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

int main()
{
    int n, k, i, sum=0;
    cin >> n >> k;
    int arr[n];
    for(i=0; i<n; i++)
    {
        int x;
        cin >> x;
        arr[i]=x;
    }
    sort(arr, arr+n);
    for(i=0; i<k; i++) sum += arr[i];

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        int[] a = Read.ints();
        Array.Sort(a);Console.WriteLine(a[0]+a[1]);
    }

    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b)
    {
        return a * b / gcd(a, b);
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (long i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 13396
#include<stdio.h>
void insertionSort(int *a,int n){
    int i,v,j,k;
for(i=1;i<=n-1;i++){
v=*(a+i);
j=i-1;
while(j>=0 && *(a+j)>v){
*(a+j+1)=*(a+j);
j--;
*(a+j+1)=v;
}
for(k=0;k<n-1;k++){
        printf("%d ",*(a+k));
    }
    if(k==n-1) printf("%d\n",*(a+k));
}
}
int main(void){
    int N,i=0,a[100]={},v,j;
    scanf("%d",&N);
    while(scanf("%d",&a[i])==1){
        i++;
        if(i==N) break;
            }
        for(i=0;i<N-1;i++){
        printf("%d ",a[i]);
    }   
    if(i==N-1) printf("%d\n",a[i]);

    insertionSort(a,N);   
    return 0;
}


Measured memory_bytes: 2032
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint,dijkstra
    //graph g(n);で作成
    //g.add_edge(a,b,cost);
    //g.dijkstra(p);g.d[i]でpとiとの距離
    struct edge{
        ll to,cost;
    };
    
    struct graph{
        ll V;
        vector<vector<edge>> G;
        vl d;
        graph(ll n){
            init(n);
        }
        void init(ll n){
            V=n;
            G.resize(V);
            d.resize(V);
            rep(i,V){
                d[i]=INF;
            }
        }
        void add_edge(ll s,ll t,ll cost){
            edge e;
            e.to=t;
            e.cost=cost;
            G[s].pb(e);
        }
        void dijkstra(ll s){
            rep(i,V){
                d[i]=INF;
            }
            d[s]=0;
            priority_queue<pll,vector<pll>,greater<pll>> que;
            que.push(pll(0,s));
            while(!que.empty()){
                pll p=que.top();
                que.pop();
                ll v=p.second;
                if(d[v]<p.first)continue;
                for(auto e:G[v]){
                    if(d[e.to]>d[v]+e.cost){
                        d[e.to]=d[v]+e.cost;
                        que.push(pll(d[e.to],e.to));
                    }
                }
            }
        }
    };

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll n;
        cin>>n;
        graph G(n);
        rep(i,n-1){
            ll u,v,w;
            cin>>u>>v>>w;
            u--;v--;
            G.add_edge(u,v,w);
            G.add_edge(v,u,w);
        }
        G.dijkstra(0);
        rep(i,n){
            if(G.d[i]%2==0){
                cout<<0<<endl;
            }else{
                cout<<1<<endl;
            }
        }
    }

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

int t[1000001];

class Member{
public:
  int id,cnt;
  Member ( int id = 0,int cnt=0): id(id),cnt(cnt){}
  bool operator < ( Member a )const{
    return ( cnt<a.cnt || ( cnt==a.cnt && id>a.id ) );
  }
};

int main(){
  int n,q,a,b;
  Member s;
  priority_queue<Member> qu;
  cin>>n>>q;
  for(int i=1;i<=n;i++){
    t[i]=0;
    s.id=i;s.cnt=0;
    qu.push(s);
  }
  while(q--){
    cin>>a>>b;
    t[a]+=b;
    qu.push(Member(a,t[a]));

    while(1){
      if(qu.top().cnt == t[qu.top().id] )break;
      qu.pop();
    }
    cout<<qu.top().id<<" "<<qu.top().cnt<<endl;

  }
  return 0;
}

Measured memory_bytes: 22276
#include"iostream"
#include"cstdio"
#include"cmath"
#include"cstring"
#include"algorithm"
#include"stack"
#include"queue"
using namespace std;

#define read(x) scanf("%d",&x)
#define readl(x) scanf("%lld",&x)
#define ll long long 
#define ull unsigned long long
#define MAXN 1000005 

int n;
int a[1000005],ma=0;
int cnt[1000005];

inline void work(int n)
{
	for(register int i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			cnt[i]++,n/=i;
			while(n%i==0) n/=i; 
		}
	}
	if(n>1) cnt[n]++;
}

int main()
{
	scanf("%d",&n);
	for(register int i=1;i<=n;i++) scanf("%d",&a[i]),ma=max(ma,a[i]),work(a[i]);
	int f1=0,f2=0;
	for(register int i=1;i<=ma;i++)
	{
		if(cnt[i]!=0&&cnt[i]!=1) f1=1;
		if(cnt[i]==n) f2=1;
	}
	if(!f1) printf("pairwise coprime\n");
	else if(!f2) printf("setwise coprime\n");
	else printf("not coprime\n");
	return 0;
} 

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

using namespace std;

const long long mod = 1000000007; 

long long Pow(long long a, long long b) {
    long long cnt, ret; 
    cnt = a; 
    ret = 1; 
    while (b) {
        if (b & 1) ret = ret * cnt % mod;
        cnt = cnt * cnt % mod; 
        b >>= 1;  
    }
    return ret; 
}

long long inv(long long a) {
    return Pow(a, mod - 2); 
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15); 
    int n, m, a, b; 
    cin >> n >> m >> a >> b; 
    vector<long long> st, ed; 
    st.resize(m - b);
    ed.resize(m - b); 
    st[0] = 1;
    for (int i = n - a + b - 1; i >= n - a; --i) st[0] = st[0] * i % mod; 
    for (int i = 1; i <= b; ++i) st[0] = st[0] * inv(i) % mod; 
    for (int i = 1; i < m - b; ++i) {
        st[i] = st[i - 1] * (n - a + b + i - 1) % mod; 
        st[i] = st[i] * inv(b + i) % mod; 
    }
//    for (int i = 0; i < m - b; ++i)
//        cout << st[i] << endl; 
    ed[m - b - 1] = 1;
    for (int i = m - b - 2; i >= 0; --i) {
        ed[i] = ed[i + 1] * (a + m - b - 2 - i) % mod; 
        ed[i] = ed[i] * inv(m - b - 1 - i) % mod; 
    } 
//    for (int i = 0; i < m - b; ++i)
//        cout << ed[i] << endl; 
    long long sum = 0; 
    for (int i = 0; i < m - b; ++i) {
        sum = (sum + st[i] * ed[i] % mod) % mod; 
    }
    cout << sum << endl; 
    return 0; 
}

Measured memory_bytes: 1792
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra
xs,ys,xt,yt = map(int,input().split())
N=int(input())
xyr = [tuple(map(int,input().split())) for _ in range(N)]
xyr.append((xs,ys,0))
xyr.append((xt,yt,0))
b = [[-1]*(N+2) for _ in range(N+2)]
for i in range(N+2):
    x1, y1, r1 = xyr[i]
    for j in range(i+1,N+2):
        x2,y2,r2 = xyr[j]
        r = max(0, ((x1-x2)**2+(y1-y2)**2)**0.5-(r1+r2))
        b[i][j] = r
        b[j][i] = r
Graph = csgraph_from_dense(b, null_value=-1)
start = N
end = N+1
print(dijkstra(Graph, indices=start)[end])

Measured memory_bytes: 63580
N = int(input())
S = input()

def check(v):
    now = 0
    for i in S:
        if i == v[now]:
            now += 1
        if now >= 3:
            return True
    return False

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            t = str(i) + str(j) + str(k)
            if check(t):
                ans += 1
print(ans)


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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define in(x) cin>>x
#define ina(x, n) rep(x_i,n) cin>>x[x_i]
#define outa(x, n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);
const int MAX_C = 200000;

void add(ll &a, ll b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

int main() {
  int n, pc = 0; cin >> n;
  vl cs;
  rep(i,n) {
    int c; cin >> c;
    if (c != pc) {
      pc = c; cs.pb(c);
    }
  }
  n = cs.size();

  vl pos(MAX_C+1,-1), dp(n,0);
  pos[cs[0]] = 0; dp[0] = 1;
  REP(i,1,n) {
    add(dp[i], dp[i-1]);
    if (pos[cs[i]] != -1) {
      add(dp[i], dp[pos[cs[i]]]);
    }
    pos[cs[i]] = i;
  }
  cout << dp[n-1] << endl;
  return 0;
}


Measured memory_bytes: 5104
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define   mt         make_tuple
//#define   Y            imag()
//#define   X            real()
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define   angle(n)      atan2((n.imag()),(n.real()))
#define   vec(a,b)       ((b)-(a))
//#define   length(a)      hypot( (a.imag()),(a.real()) )
#define   normalize(a)      (a)/(length(a))
//#define    dp(a,b)          (((conj(a))*(b)).real())
//#define    cp(a,b)          (((conj(a))*(b)).imag())
#define    lengthsqrt(a)       dp(a,a)
#define    rotate0( a,ang)    ((a)*exp( point(0,ang) ))
#define    rotateA(about,p,ang)   (rotate0(vec(about,p),ang)+about)
#define    reflection0(m,v)         (conj((v)/(m))*(m))
#define     reflectionA(m,v,p0)     (conj( (vec(p0,v))/(vec(p0,m)) ) * (vec(p0,m)) ) + p0
//#define     same(p1,p2)               ( dp(  vec(p1,p2),vec(p1,p2)) < eps )
#define     point                    complex<int>
#define outfile freopen("out.out", "w", stdout);
#define infile  freopen("in.in", "r", stdin);
#define PI acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
using namespace __gnu_pbds;
int dcmp(double a,double b){   return fabs(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(int num, int idx) {return ((num >> idx) & 1) == 1;}
ll setBit1(ll num, int idx) {return num | (1ll<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(int num, int idx) {return num ^ (1<<idx);}
void FS(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
double a[109];
int n;
int main()
{
    cin>>n;
    double sum=0;
    for(int i=0;i<n;i++)
        cin>>a[i],sum+=(1.0/a[i]);

    cout<<fixed<<setprecision(12)<<1.0/sum<<endl;

}

















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

using namespace std;

int main()
{
  long long N, A, B, C, D;
  cin >> N >> A >> B;

  C = N / (A + B);

  D = N % (A + B);

  if (D > A)
  {
    cout << C * A + A << endl;
  }
  else
  {
    cout << C * A + D << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<60)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa
#define dbgs(x) cerr<<(#x)<<"[stl]: ";for(auto _:x)cerr<<_<<' ';cerr<<'\n',aaa
#define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa

using namespace std;

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int a, b; cin >> a >> b;
  cout << a*b;
  return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

vector<string> Split(char c,string s){
  vector<string> res(0);
  string str = "";
  rep(i,s.size()){
    if(s[i] == c){
      res.push_back(str);
      str.clear();
    }
    else{
      str += s[i];
    }
  }
  res.push_back(str);
  return res;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  while(getline(cin,s)){
    if(s[0] == '0') break;
    auto ss = Split(' ',s);
    vector<int> v(ss.size());
    int one = 0;
    rep(i,v.size()){
      v[i] = ston(ss[i],1);
      v[i] = (v[i]>10)?10:v[i];
      if(v[i] == 1){
        ++one;
      }
    }
    sort(all(v),greater<int>());
    int sc = 0;
    bool f = true;
    rep(i,v.size()){
      if(v[i] != 1){
        sc += v[i];
        if(sc > 21){
          sc = 0;
          f = false;
          cout << sc << endl;
          break;
        }
      }
    }
    if(f){
      while(one){
        if(sc + 11 + one-1 < 22){
          sc += 11;
          --one;
        }
        else{
          sc += 1;
          --one;
        }
      }

      if(sc > 21){
        sc = 0;
      }
      cout << sc << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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 long long ll;

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

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll N, K; std::cin >> N >> K;
  std::vector<ll> A(N); rep(i,N) std::cin >> A[i];

  std::vector<ll> S(N+1, 0);
  rep(i, N) {
    S[i+1] = S[i] + A[i];
    S[i+1] %= K;
  }

  ll ans = 0;
  std::queue<ll> q;
  std::unordered_map<ll, ll> mp;
  for(int r = 0; r < N+1; r++) {
    ll k = (S[r] - r) % K; if ( k < 0 ) k += K;
    ans += mp[ k ];
    mp[ k ]++;

    q.push(k);
    if ( sz(q) >= K ) {
      mp [ q.front() ]--;
      q.pop();
    }
  }
  std::cout << ans << std::endl;

  return 0;
}


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

int main()
{
	int64_t x;
	cin >> x;

	auto is_prime = [](int64_t n) {
		for (int64_t i = 2; i * i <= n; i++)
		{
			if (n % i == 0)
			{
				return false;
			}
		}
		return true;
	};

	for (int64_t n = x;; n++)
	{
		if (is_prime(n))
		{
			cout << n << endl;
			return 0;
		}
	}

	return 0;
}

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

using namespace std;

const int N = 100'009;

vector<int> g[N];
int w[N];
int pa[N];
int q[N];
int d[N];
int sum[N];
int best[N];
int fb[N];

int main() {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  --a;
  --b;
  for (int i = 0; i < n; ++i) {
    w[i] = 1;
    g[i].clear();
  }
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x;
    --y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  memset(pa, -1, sizeof pa);
  q[0] = b;
  for (int qh = 0, qt = 1; qh < qt; ++qh) {
    int x = q[qh];
    for (int y : g[x]) {
      if (y != pa[x]) {
        pa[y] = x;
        q[qt++] = y;
      }
    }
  }
  vector<int> path;
  for (int i = a; i != -1; i = pa[i]) {
    path.push_back(i);
  }
  int sz = (int)path.size();
  memset(d, -1, sizeof d);
  for (int i = 0; i < sz; ++i) {
    d[path[i]] = 0;
  }
  for (int i = 0; i < sz; ++i) {
    best[i] = 0;
    q[0] = path[i];
    int qt = 1;
    for (int qh = 0; qh < qt; ++qh) {
      int x = q[qh];
      for (int y : g[x]) {
        if (d[y] == -1) {
          d[y] = d[x] + w[y];
          q[qt++] = y;
          best[i] = max(best[i], d[y]);
        }
      }
    }
  }
  sum[0] = 0;
  for (int i = 0; i < sz; ++i) {
    sum[i + 1] = sum[i] + w[path[i]];
  }
  for (int i = sz - 1; i >= 0; --i) {
    fb[i] = sum[sz] - sum[i] + best[i];
  }
  int aa = (sz - 1) / 2, bb = (sz - 1) / 2 + 1;
  int ans = (sz - 1) - bb;
  if (sz % 2 == 1) {
    ++ans;
    --aa;
  }
  while (aa >= 0) {
    ans = max(ans, fb[aa] - 2);
    --aa;
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 7924
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const double pi = acos(-1);

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

    ll ans = INF;
    for(ll i = 1; i*i <= n; i++) {
        if(n%i == 0) {
            ans = i + n/i - 2;
        }
    }

    out(ans);
    re0;
}

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


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

    rep(i,s.length()){
        if(s[i]+n<='Z') s[i]+=n;
        else s[i] += n  -'Z'+'A'-1;
    }

    cout<<s<<endl;


    return 0;
}

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

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

const int SIZE = 1024;
bool used[SIZE][SIZE];

int main() {
  int H, W; cin>>H>>W;
  deque<pint> q[2];
  int cnt = H*W;
  REP(h,H) {
    string line; cin>>line;
    REP(w,W) {
      if(line[w] == '#') {
	cnt--;
	used[h][w] = true;
	q[0].push_back(make_pair(h,w));
      }
    }
  }
  int depth = 0;
  while(true) {
    int from = depth%2;
    int	to = 1-from;
    if(q[from].empty()) break;
    depth++;
    q[to].clear();
    REP(i,q[from].size()) {
      int ch = q[from][i].first;
      int cw = q[from][i].second;
      //      cout << depth << " " << ch << " " << cw << endl;                           
      REP(d,4) {
        const int dh[4] = {0,1,0,-1};
        const int dw[4] = {1,0,-1,0};
        int nh = ch+dh[d];
        int nw = cw+dw[d];
        if(nh<0) continue;
        if(nw<0) continue;
        if(nh>=H) continue;
        if(nw>=W) continue;
        if(used[nh][nw]) continue;
        used[nh][nw] = true;
        cnt--;
        q[to].push_back(make_pair(nh, nw));
      }
    }
  }
  //  cout << "Answer=";                                                                 
  cout << depth-1 << endl;
  return 0;
}


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

int n, k;
int x[110];
int ans;
int main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++)cin >> x[i];
	for (int i = 0; i < n; i++) {
		if ((k - x[i]) >= (x[i]))ans += 2 * x[i];
		else ans += 2 * (k - x[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  string a,b;
  cin>>a>>b;
  int check=0;
  if(a.length()==b.length()){
    rep(i,0,a.length()){
      if(ctoi(a[i])!=ctoi(b[i])){
        cout<<(ctoi(a[i])<ctoi(b[i])?"LESS":"GREATER");
        check++;
        break;
               }
               
               }
               
        
  }else{
    cout<<(a.length()<b.length()?"LESS":"GREATER");
    check++;
  }
               if(!check) cout<<"EQUAL"; 

}

// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FR(i,a,b) for(int i=a; i<b; ++i)
#define BR(i,a,b) for(int i=(b-1); i>=0; --i)
#define FA(i,a) for(auto i : a)
#define PB emplace_back
#define trace(x) cerr<<#x<<":"<<x<<'\n';
#define trace2(a,n) { cerr<<#a<<" = "; FR(_,0,n) cerr << a[_] << ' '; cerr <<'\n'; }


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

	int n,m,x,y;
	cin>>n>>m>>x>>y;
	vector<int> a(n);
	vector<int> b(m);
	for(int i=0; i<n; ++i){ cin>>a[i]; }
	for(int i=0; i<m; ++i){ cin>>b[i]; }
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	bool status = false;
	for(int i=x+1; i<=y; ++i){
		if( i > a[n-1] and b[0] >= i ){
			status = true;
			break;
		}
	}

	status ? cout<<"No War\n" : cout<<"War\n";

	#ifdef LOL
	    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	#endif
	return 0;
}


Measured memory_bytes: 256
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#endif

const double PI = acos(-1);
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

void solve() {
	cini(n);
	cini(m);
	vector<int> pen(n);
	vb solved(n);
	int spen = 0;
	int scnt = 0;
	for (int i = 0; i < m; i++) {
		cini(prob);
		prob--;
		cins(res);
		if (res == "WA" && !solved[prob])
			pen[prob]++;
		else if (res == "AC" && !solved[prob]) {
			solved[prob] = true;
			spen += pen[prob];
			scnt++;
		}
	}
	cout << scnt << " " << spen << endl;
}

int main() {
	cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	solve();
}



Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n;
const int INF =(1<<30);
int getl(ll x) {
	int ret=0;
	while(x) x/=10,ret++;
	return ret;
}
int main()
{
	scanf("%lld",&n); int ans=INF;
	for(ll i=1;i*i<=n;i++) if(n%i==0)
		ans=min(ans,max(getl(i),getl(n/i)));
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){

  string s;
  cin >> s;
  int x = 0;
  for (int i = 0; i < s.size(); i++){
    x += int(s[i]) - 48;
  }
  ll y;
  y = stol(s);

  if ((y % x) == 0){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> sw(m);
  vector<int> sum(m), p(m);
  int ans = 0;
  for (int i = 0; i < m; i++) {
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int x;
      cin >> x;
      x--;
      sw[i].push_back(x);
    }
  }
  for (auto&& u : p) cin >> u;

  for (int bit = 0; bit < 1 << n; bit++) {
    sum.assign(m, 0);
    for (int q = 0; q < m; q++) sum[q] = p[q];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (count(begin(sw[j]), end(sw[j]), i) > 0) sum[j] += (bit >> i & 1);
      }
    }

    int tmp = 0;
    for (int l = 0; l < m; l++) {
      if (sum[l] % 2 > 0) tmp++;
      // cout << endl;
    }
    if (tmp == 0) ans++;
    // cout << bit << " " << tmp << endl;
    // for (int i = 0; i < m; i++) cout << sum[i] << " " << p[i] << endl;
    // cout << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int C[200000];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(i, N) {
    int a;cin >> a;
    C[a]++;
  }
  int m = 0;
  for (int X=0; X<=100000; X++) {
    int t = C[X] + C[X+1];
    if (X>0) t += C[X-1];
    m = max(m, t);
  }
  cout << m << "\n";
  return 0;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N,M,K;
  cin>>N>>M>>K;
  for(int i=0;i<=N;i++){
    for(int j=0;j<=M;j++){
      if(i*M+j*N-2*i*j==K){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
b=[0]*n

for i in range(n-1):
  b[i]=h[i]-h[i+1]
  if b[i]>=0:
    b[i]=1
  else:
    b[i]=0
b=[str(x) for x in b]
c="".join(b)
d=c.split("0")
print(len(max(d)))


 

Measured memory_bytes: 69016
/*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1127
*/

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

struct UnionFind{
    vector<int> parent;
    vector<int> rank;
    UnionFind(int n):rank(n+1,0),parent(n+1){
        rep(i,n+1) parent[i]=i;
    }

    int find(int x){
        if (parent[x] == x) return x;
        else return parent[x] = find(parent[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if (x==y) return;
        else if(rank[x]<rank[y]) parent[x]=y;
        else{
            parent[y]=x;
            if (rank[x]==rank[y]){
                rank[x]+=1;
            }
        }
    }
};

int main(){
    vector<double> ans;
    while(1){
    int n;
    cin >> n;
    if(n==0) break;

    vector<double> x,y,z,r;
    vector<pair<double,P>> edge;
    rep(i,n){
        ld xx,yy,zz,rr;
        cin >> xx >> yy >> zz >>rr;
        x.push_back(xx);
        y.push_back(yy);
        z.push_back(zz);
        r.push_back(rr);
    }
    UnionFind uf(n);
    rep(i,n){
        for(int j=i+1; j<n; ++j){
            ld dist;
            dist = (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])+(z[i]-z[j])*(z[i]-z[j]);
            dist = sqrt(dist);
            dist = dist-r[i]-r[j];
            if(dist<=0.000) uf.unite(i,j);
            else{
                pair<double,P> p;
                p.first = dist;
                p.second.first = i;
                p.second.second = j;
                edge.push_back(p);
            }
        }
    }
    sort(edge.begin(),edge.end());

    double res = 0.000;
    rep(i,edge.size()){
        int p,q;
        p = edge[i].second.first; q = edge[i].second.second;
        //cout << "edge " << i << " "<<p<<":"<<q<<" ";
        //printf("%.3f\n",edge[i].first);
        if(uf.find(p)!=uf.find(q)){
            res += edge[i].first;
            uf.unite(p,q);
        }
    }

    ans.push_back(res);
    }
    for(auto a:ans) printf("%.3f\n",a);
}


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

int main()
{  
   int n,y;
   cin>>n>>y;
   for(int i=0;i<=n;i++){
       for(int j=0;j<=n;j++){
           if(i+j>n) break;
           if(10000*i+5000*j+1000*(n-i-j)==y){
               cout<<i<<" "<<j<<" "<<n-i-j<<endl;
               return 0;
           }
       }
   }
   cout<<-1<<" "<<-1<<" "<<-1<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

    int N;
    double in, sum = 0.0, mus = 0.0;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> in;
        sum += 1.0 / in;
    }
    mus = 1.0 / sum;
    printf("%0.10lf\n", mus);

    return 0;
}

Measured memory_bytes: 256
x = int(input())
ans = 0
for a in range(2*10**6):
    if x >= 500:
        x = x-500
        ans = ans + 1000
    else:
        break
for b in range(100):
    if x >= 5:
        x = x-5
        ans = ans + 5
    else:
        break
print(ans)

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

int main() {
	int n;
	long long a[100010];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long sa = 0, ans0 = 0, ans1 = 0;

	//偶数がマイナス
	for (int i = 0; i < n; i++) {
		sa += a[i];
		if (i % 2 == 0) {
			if (sa >= 0) {
				ans0 += sa - (-1);
				sa = -1;
			}
		}
		else {
			if (sa <= 0) {
				ans0 += 1 - sa;
				sa = 1;
			}
		}
	}
	sa = 0;
	//奇数がマイナス
	for (int i = 0; i < n; i++) {
		sa += a[i];
		if (i % 2 == 1) {
			if (sa >= 0) {
				ans1 += sa - (-1);
				sa = -1;
			}
		}
		else {
			if (sa <= 1) {
				ans1 += 1 - sa;
				sa = 1;
			}
		}
	}
	cout << min(ans0, ans1) << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import java.lang.Math;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	String s = sc.next();
      	int num = (int)s.charAt(0) - 48;
      	int nums[] = new int[3];
      	int sum = num;
    	char[] ops = {'+','+','+'};
      	boolean con = true;
		
      	for(int i = 0;i < 3;i++){
          nums[i] = (int)s.charAt(i+1) - 48;
          sum += nums[i];
        }
     
      	for(int i = 0; i < 2 && con;i++){
          	if(i == 1){
            	ops[0] = '-';
              	nums[0] = Math.abs(nums[0]) * (-1);
            } else {
                ops[0] = '+';
              	nums[0] = Math.abs(nums[0]);
                }
        	for(int j = 0; j < 2 && con;j++){
              	if(j == 1){
            		ops[1] = '-';
              		nums[1] = Math.abs(nums[1]) * (-1);
            	} else {
                  	ops[1] = '+';
              		nums[1] = Math.abs(nums[1]);
                }
            	for(int k = 0;k < 2 && con;k++){
   					if(k == 1){
            			ops[2] = '-';
              			nums[2] = Math.abs(nums[2]) * (-1);
            		} else {
            			ops[2] = '+';
              			nums[2] = Math.abs(nums[2]);
            		}
                 	sum = num + nums[0] + nums[1] + nums[2];
                 	if(sum == 7) con = false;
                }
            }
        }
      	
      	System.out.print(num);
      	for(int i = 0;i < 3;i++){
          System.out.print(ops[i]);
          System.out.print(Math.abs(nums[i]));
        }
      	System.out.println("=7");
	}
}


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

void main()
{
    auto S = readln.chomp.to!(wchar[]);
    auto T = readln.chomp.to!(wchar[]);

    foreach (_; 0..101) {
        if (S == T) {
            writeln("Yes");
            return;
        }
        S = [S[$-1]] ~ S[0..$-1];
    }
    writeln("No");
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int a = Integer.parseInt(str[1]);
		int b = Integer.parseInt(str[2]);

		int min = Math.min(n * a, b);

		System.out.println(min);
	}
}

Measured memory_bytes: 32732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <numeric>

int main()
{
	int n;
	std::cin >> n;

	std::vector<int> number(n);
	for (int i = 0; i < n; i++)
	{
		std::cin >> number[i];
	}

	auto min_max = std::minmax_element(number.cbegin(), number.cend());
	long long sum = std::accumulate(number.cbegin(), number.cend(), 0LL);

	std::cout << *min_max.first << " " << *min_max.second << " " << sum << std::endl;
	return 0;
}


Measured memory_bytes: 3128
import sys

def hantei(A, B, C, K):
  i = 0
  while A >= B:
    if i >= K:
      return False
      sys.exit()
    B *= 2
    i += 1
  while B >= C:
    if i >= K:
      return False
      sys.exit()
    C *= 2
    i += 1
  return True
 

A, B, C = map(int, input().split())
K = int(input())
if(hantei(A, B, C, K)):
  print('Yes')
else:
  print('No')

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

int main() {
	int h[3]{};
	int f[2]{};
	for(int i = 0; i < 3; i++){
		cin >> h[i];
		if(h[i] == 5)
			f[0]++;
		else if(h[i] == 7)
			f[1]++;
	}
	if(f[0] == 2 && f[1] == 1){
		cout << "YES";
	}else{
		cout << "NO";
	}
	return 0;
}


Measured memory_bytes: 256
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

n,k = inm()
s = [0] * n
for i in range(k):
    d = ini()
    a = inl()
    for b in a:
        s[b-1] += 1
ans = sum(s[i] == 0 for i in range(n))
print(ans)

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

int main() {
  int a, b;
  cin >> a >> b;
  if(a == b) cout << "Draw" << endl;
  else if( a == 13 && b == 1) cout << "Bob" << endl;
  else if( b == 13 && a == 1) cout << "Alice" << endl;
  else if( a < b) cout << "Bob" << endl;
  else cout << "Alice" << endl;

  
  return 0;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace ABC87_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            var a = new long[2][];
            a[0] = ReadLine().Split().Select(long.Parse).ToArray();
            a[1] = ReadLine().Split().Select(long.Parse).ToArray();
            long sum_0 = 0;
            long sum = 0;
            long ms = 0;
            for (int i = 0; i < n; i++)
            {
                sum_0 += a[0][i];
                sum = sum_0;
                for (int j = i; j < n; j++)
                {
                    sum += a[1][j];
                }
                ms = Math.Max(sum, ms); 
            }
            WriteLine(ms);
        }
    }
}


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

const int maxn = 2e6;
int val[maxn];
void init() {
	for(int k = 2; k < maxn; k*=2) {
		for(int i = k; i < maxn; i += k) val[i]++;
	}
	forsn(i, 1, maxn) val[i] += val[i-1];
}

int main() {
	init();
	int n;
	cin >> n;
	string s;
	cin >> s;
	
	vector<int> orig(n);
	bool ones = false;
	forn(i, n) if(s[i] == '2') ones = true;
	int total = 0;
	/*
	forn(i, n) {
		forn(j, i+1) cout << (val[i] - val[j] - val[i-j] == 0);
		cout << endl;
	}*/
	forn(i, n) total ^= (s[i] - '1') * int(val[n-1] == val[n-i-1] + val[i]);
	if(ones) total &= 1;
	cout << total << "\n";
}


Measured memory_bytes: 13060
#include<bits/stdc++.h>
#include<string>
 
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
 
int main(){
  string s;
  int p=0;
  int i,j;
  cin >> s;
  rep(i,s.size()){
    for(j=0;j<i;j++){
      if(s[j]==s[i]){
	p++;
      }
    }
  }
  if(p>0){
    cout << "no" << endl;
  }else{
    cout << "yes" << endl;
  }


 
  return 0;
} 


Measured memory_bytes: 256
function main(input) {
  const args = input.split('\n');
  const A = parseInt(args[0], 10),
        B = parseInt(args[1], 10),
        C = parseInt(args[2], 10),
        X = parseInt(args[3], 10);

  var count = 0;

  for (var a = 0; a <= A; ++a) {
      for (var b = 0; b <= B; ++b) {
          for (var c = 0; c <= C; ++c) {
              var sum = (a * 500) + (b * 100) + (c * 50);
              if (sum === X) ++count;
          }
      }
  }
  console.log(count);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 11468
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef vector<int> VI;
typedef vector<ll> VLL;

int main(){
    int n,m,ans=0;
    cin >> n >> m;
    VI g(m,0);

    for(int i=0; i<n; ++i){
        int tmp; cin >> tmp;
        for(int j=0; j<tmp ; ++j){
            int t; cin >> t;
            ++g[t-1];
        }
    }

    for(int i=0; i<m ; ++i){
        if(g[i] == n)++ans;
    }

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

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    string s;
    cin>>s;
    string year=s.substr(0,4);
    string month=s.substr(5,2);
    string day=s.substr(8,2);
    if(year<="2019"&&month<="04"&&day<="30")
        cout<<"Heisei"<<endl;
    else cout<<"TBD"<<endl;
    return 0;
}


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

int main() {
    Int n, m;
    cin >> n >> m;
    auto flags = vector<bool>(n, false);
    auto wacounts = vector<Int>(n, 0);
    auto a = 0LL;
    rep(i, m) {
        Int p;
        string s;
        cin >> p >> s;
        p--;
        auto flag = flags[p];
        if (!flag) {
            if (s == "AC") {
                flags[p] = true;
                a++;
            } else {
                wacounts[p]++;
            }
        }
    }
    auto b = 0LL;
    rep(i, n) {
        if (flags[i]) b += wacounts[i];
    }
    cout << a << " " << b << endl;
}


Measured memory_bytes: 1024