akhauriyash/Code-Regression huggingface dataset:
// clang-format off
	#include <bits/stdc++.h>
	using namespace std; using ll = long long; using uint = unsigned int;
	#define SFINAE(x, ...)	template <class, class = void> struct x : false_type {}; template <class T> struct x<T, void_t<__VA_ARGS__>> : true_type {};
	SFINAE(DefaultIO, decltype(cout << declval<T &>()))
	SFINAE(IsTuple, typename tuple_size<T>::type)
	SFINAE(Iterable, decltype(begin(declval<T>())))
	template <class T> constexpr char Space(const T &) { return (Iterable<T>::value or IsTuple<T>::value) ? '\n' : ' '; }
	template <auto &os> struct Writer {
		template <class T> void Impl(T const &t) const {
			if constexpr (DefaultIO<T>::value) os << t;
			else if constexpr (Iterable<T>::value) { int i = 0; for (auto &&x : t) ((i++) ? (os << Space(x), Impl(x)) : Impl(x)); }
			else if constexpr (IsTuple<T>::value) apply([this](auto const &... args) { int i = 0; (((i++) ? (os << ' ', Impl(args)) : Impl(args)), ...);}, t);
			else static_assert(IsTuple<T>::value, "No matching type for print");
		}
		template <class F, class... Ts> auto &operator()(F const &f, Ts const &... ts) const { return Impl(f), ((os << ' ', Impl(ts)), ...), os << '\n', *this; }
	};
	template <auto &is> struct Reader {
		template <class T> auto& operator()(T &t) const {
			if constexpr (DefaultIO<T>::value) is >> t;
			else if constexpr (Iterable<T>::value) for (auto &x : t) (*this)(x);
			else if constexpr (IsTuple<T>::value) apply([this](auto &... args) { ((*this)(args), ...); }, t);
			else static_assert(IsTuple<T>::value, "No matching type for read");
			return *this;
		}
		template <class T> auto operator[](T t) const { (*this)(t); return t; }
	};
	#ifdef NARUT_LOCAL
	#define Debug(...) cerr << "\033[0;31m", Writer<cerr>{}(__VA_ARGS__), cerr << "\033[0m\n"
	#else
	#define Debug(...) 0
	#endif
	[[maybe_unused]] constexpr Reader<cin> Cin; [[maybe_unused]] constexpr Writer<cout> Cout;
	#define FOR(i, j, n) for (int i = int(j); i < int(n); ++i)
	#define ROF(i, j, n) for (int i = int(n) - 1; i >= int(j); --i)
// clang-format on





auto Main() {
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	
	while(a >= b) {
		if (k) --k, b*=2;
		else return false;		
	}	
	while(b >= c) {
		if(k) --k, c*=2;
		else return  false;
	}
	return true;	
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
#ifdef NARUT_LOCAL
	assert(freopen("io/test.in", "r", stdin));
	cin.exceptions(cin.badbit | cin.failbit);
	cerr << fixed << setprecision(10);
#endif

	cout << (Main() ? "Yes\n" : "No\n");
}


Measured memory_bytes: 3632
n = int(raw_input())
a = map(int,raw_input().split())

lp = [0]
nowlp = 0

for x in range( len(a) ):
  nowlp += a[x]
  lp.append(nowlp)

ans = 0
prev = [ [0,0] ]

for l in range(0,n-1):
  r = prev[l][1] + 1
  ans += prev[l][1]-l
  now = lp[r] - lp[l]

  while r <= n-1 and now^a[r] == now+a[r]:
    ans += 1
    now += a[r]
    r += 1
  prev.append( [l,r-1] )

ans += n
print ans


Measured memory_bytes: 49428
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <limits>
#include <set>
#include <map>

int main()
{
    long long n{}, a{}, b{};
    std::cin >> n >> a >> b;
    const auto rep = n / (a + b);
    const auto mod = n % (a + b);
    const auto result = rep * a + std::min(a, mod);
    std::cout << result << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<string>
	
using namespace std;
	        
	#define ll long long
	#define do long double
    #define ff first
    #define ss second
    #define FOR(a,n) for(ll ii=0;ii<n;ii++){    cin>>a[ii];}
    #define pb push_back
    #define mp make_pair
    #define inf LONG_LONG_MAX
    #define mod 1000000007
    #define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define N 100010    

ll d,x,y;
void extendedEuclid(ll A, ll B) 
{
    if(B == 0) 
    {
         d = A;
         x = 1;
         y = 0;
    }
    else 
    {
        extendedEuclid(B, A%B);
        int temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}

ll power(ll x,ll y, ll p) 
{ 
    ll res = 1; 
    x = x % p;
    while (y > 0) 
    {  // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p;
                    
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

ll IsPrime(ll n)
{
    if(n==0||n==1)
        return n;
    if(n%2==0)
        return (ll)2;
    if(n%3==0)
        return (ll)3;
    else
    {
        for(ll i=5;i*i<=n;i+=6)
        {
            if(n%i==0)
                return i;
            if(n%(i+2)==0)
                return (i+2);
        }
        return n;
    }
}
vector<ll> rt(N+10);
ll connect;

void ini(ll n)
{
	for(ll i=0;i<n+10;i++)
		rt[i]=i;

}

ll root(ll x)
{
	while(rt[x]!=x)
		{
			rt[x]=rt[rt[x]];
			x=rt[x];
		}

	return x;
}



void uni(ll a,ll b)
{
	ll x=root(a),y=root(b);
	rt[y]=x;
	//cout<<"C"<<connect<<"C";
	connect--;
}

vector<ll> fact(N),invfact(N);
ll inv(ll n)
{
	return power(n,mod-2,mod);
}

void pre()
{
	fact[0]=1;
	invfact[0]=inv(fact[0]);
	for(ll i=1;i<N;i++)
	{
		fact[i]=(fact[i-1]*i)%mod;
		invfact[i]=inv(fact[i]);
	}
}

ll comb(ll n,ll r)
{
	if(r>n)
		return 0;
	ll x=fact[n];
	x*=invfact[n-r];
	x%=mod;
	x*=invfact[r];
	x%=mod;
	return x;
}

bool cmp(pair<ll,ll> a,pair<ll,ll> b)
{
	return a.ss<b.ss;
}


int main()
{
	FAST
	ll n,m,i,j,k;
	cin>>n;

	ll ans=inf;
	for(i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			ll x=n/i,y=i;
			ll t=0;
			t=x-1+y-1;
			ans=min(ans,t);
		}
	}
	cout<<ans;


}

Measured memory_bytes: 2560
#Python

G1=[1,3,5,7,8,10,12]
G2=[4,6,9,11]
G3=[2]

N = map(int, raw_input().split())
#print N


if N[0] in G1 and N[1] in G1:
	print 'Yes'
elif N[0] in G2 and N[1] in G2:
	print 'Yes'
elif N[0] in G3 and N[1] in G3:
	print 'Yes'
else:
	print 'No'




Measured memory_bytes: 2568
import java.io.*;
import java.util.*;


public class Main {
    static long mod = 1000000000+7;
    static int maxn=2;
    static long[] f5ac, inv;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //String[] buf = reader.readLine().split(" ");
        int a = sc.nextInt(), p = sc.nextInt();
        p += a*3;
        System.out.println(p/2);
    }
}



Measured memory_bytes: 21844
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    char s1[16], s2[16], s3[16];

    scanf("%s%s%s", s1, s2, s3);

    printf("%c%c%c\n", s1[0]+'A'-'a', s2[0]+'A'-'a', s3[0]+'A'-'a');

    return 0;
}

Measured memory_bytes: 1684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(void)
{
    unsigned long long a,b;
    cin >> a >> b;

    a--;
    unsigned long long a_size = max(0,(int)log2(a) + 1);
    unsigned long long b_size = max(0,(int)log2(b) + 1);
    unsigned long long ansbit_size = max(a_size, b_size);

    vector<ll> abit(ansbit_size,0);
    vector<ll> bbit(ansbit_size,0);

    for (unsigned long long i = 0,pow2 = 1; i < a_size;i++){

        if(i == 0){
            abit[i] = (a / 2 + a % 2) % 2;
        }
        else if(a & pow2){
            if(a%2 == 0){
                abit[i] = 1;
            }
        }
        pow2 *= 2;
    }
    for (unsigned long long i = 0,pow2 = 1; i < b_size;i++){

        if(i == 0){
            bbit[i] = (b / 2 + b % 2) % 2;
        }
        else if(b & pow2){
            if(b%2 == 0){
                bbit[i] = 1;
            }
        }
        pow2 *= 2;
    }
    vector<ll> ansbit(ansbit_size);
    REP(i,ansbit_size){
        ansbit[i] = bbit[i] + abit[i];
    }

    unsigned long long ans = 0;
    for (unsigned long long i = 0, pow2 = 1; i < ansbit.size();i++){
        ans += (ansbit[i] % 2) * pow2;
        pow2 *= 2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
nums = []
sum_n = 0
for _ in range(N):
  num = int(input())
  nums.append(num)
  sum_n += num

if sum_n%10 != 0:
  print(sum_n)
else:
  nums.sort()
  idx = 0
  while True:
    if idx >= N:
      print(0)
      break
    ans = sum_n-nums[idx]
    if ans%10 != 0:
      print(ans)
      break
    idx += 1

Measured memory_bytes: 3064
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let n = nextInt()
    let b = nextIntArray()
    b.unshift(Number.POSITIVE_INFINITY)
    b.push(Number.POSITIVE_INFINITY)
    let ans = 0
    for(let i = 1; i<b.length;i++){
        ans += Math.min(b[i-1], b[i])
    }
    console.log(ans)
}
Main()



Measured memory_bytes: 30592
import math
n=int(input())
t,a=1,1
for i in range(n):
    ti,ai=map(int,input().split())
    m=max(math.ceil(t/ti), math.ceil(a/ai))
    while t > ti*m or a > ai*m:
        m+=1
    while t <= ti*(m-1) and a <= ai*(m-1):
        m-=1
    t,a=ti*m,ai*m
print(t+a)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            HashMap<Integer, Integer> map = new HashMap<>();
            int n = in.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = in.nextInt();
                map.put(arr[i], map.getOrDefault(arr[i], 0) + 1);
            }
            int mx = 0;
            for (int i = 0; i < n; i++) {
                int cur = map.get(arr[i]) + map.getOrDefault(arr[i] - 1, 0) + map.getOrDefault(arr[i] + 1, 0);
                mx = Math.max(mx, cur);
            }
            out.println(mx);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (this.numChars == -1) {
                throw new InputMismatchException();
            } else {
                if (this.curChar >= this.numChars) {
                    this.curChar = 0;

                    try {
                        this.numChars = this.stream.read(this.buf);
                    } catch (IOException ex) {
                        throw new InputMismatchException();
                    }

                    if (this.numChars <= 0) {
                        return -1;
                    }
                }

                return this.buf[this.curChar++];
            }
        }

        public int nextInt() {
            int c;
            for (c = this.read(); isSpaceChar(c); c = this.read()) {
            }

            byte sgn = 1;
            if (c == 45) {
                sgn = -1;
                c = this.read();
            }

            int res = 0;

            while (c >= 48 && c <= 57) {
                res *= 10;
                res += c - 48;
                c = this.read();
                if (isSpaceChar(c)) {
                    return res * sgn;
                }
            }

            throw new InputMismatchException();
        }

        public static boolean isSpaceChar(int c) {
            return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;
        }

    }
}



Measured memory_bytes: 30820
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")

#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;
typedef pair<int,int> P;
typedef long long ll;

ll n,m,k,ans;
string s;

int main(){
  cin >> n;
  map<int,int> mp;
  ans = 0;
  rep(i,n){
    cin >> m;
    mp[m]++;
  }
  for(auto i = mp.begin(); i != mp.end(); i++){
    if( (i->second) % 2 ) ans++;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 4864
ACGT = ["A","C","G","T"]
S = input()

moji= []
word = ""
#print(len(S))
for i in range(len(S)):
    #print(S[i])
    if S[i] in ACGT:
        word += S[i]
        moji.append(word)
    else:
        #moji.append(word)        
        word = ""    
#print(moji)

answer = ""
for i in range(len(moji)):
    
    if len(moji[i]) > len(answer):
        answer = moji[i]
print(len(answer))

Measured memory_bytes: 3064
n=int(input())
edgeList=[]
for i in range(n):
 a=list(map(int,input().split()))
 for j in range(i):
  if a[j]>=0:edgeList+=[(a[j],i,j)]
rootList=[-1]*n
sumLength=0
def getRoot(x):
 r=rootList[x]
 if r<0:rootList[x]=x
 elif r!=x:rootList[x]=getRoot(r)
 return rootList[x]
edgeList.sort(key=lambda x:x[0])
for e in edgeList:
 x=getRoot(e[1])
 y=getRoot(e[2])
 if x!=y:
  sumLength+=e[0]
  rootList[x]=rootList[y]=min(x,y)
print(sumLength)


Measured memory_bytes: 5984
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define M1 1000000007
#define M2 998244353

#define fl(i,a,b)  for(ll i=a;i<b;i++)
#define bfl(i,a,b) for(ll i=b-1;i>=a;i--)
#define f(i,n)     for(ll i=0;i<n;i++)
#define bf(i,n)    for(ll i=n-1;i>=0;i--)


#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define bn "\n"

//------------------------------------------------------------------------ 
// #define V(a) vector<a>
// #define vt() vector< tuple < ll ,ll ,ll > > ;
// #define vector< ll ,ll > pv;
// vector< pair <ll,ll> > vect;


//------------------------------------------------------------------------

ll modI(ll a,ll m);
ll gcd(ll a,ll b);
ll powM(ll x,ll y,ll m);
ll swap(ll a,ll b);

void swap(ll& a,ll& b)
{
    ll tp=a;
    a=b;
    b=tp;
}

ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powM(ll x,ll y,ll m)
{
    ll ans=1,r=1;
    x%=m;
    while(r>0&&r<=y)
    {
        if(r&y)
        {
            ans*=x;
            ans%=m;
        }
        r<<=1;
        x*=x;
        x%=m;
    }
    return ans;
}
 
ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

//---------------------------------------------------------------------------

// variable = Expression1 ? Expression2 : Expression3
// max = (n1 > n2) ? n1 : n2; 
// (n>m) ? cout<<"True"<<endl:cout<<"false"<<endl ;

// ---------------------------------------------------------------------------	

// ll n;cin>>n;ll a[n];for(ll i=0;i<n;i++)cin>>a[i];    
// for(ll i=0;i<n;i++)cout<<a[i];
// ll a,b;cin>>a>>b;   

//----------------------------------------------------------------------------

// vector< tuple < ll ,ll ,ll > > tv;
// vector< ll ,ll > pv;


//----------------------------------------------------------------------------
//const ll N=1e5+3;
//ll a[N];
int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	ll tt=1;
   // cin>>tt;
	while(tt--)
	{
	  ll n;
	  cin>>n;
	ll xx=0;
	 ll a[n];
	 f(i,n)
	 {cin>>a[i];xx=xx^a[i];}
	 f(i,n)
	 {
	     cout<<(a[i]^xx)<<" ";
	 }
	 cout<<bn;
	  
	}
	
	return 0;
}


Measured memory_bytes: 5140
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int W,H,N;
    cin >> W >> H >> N;
    int x,y,a;
    int lx=0,rx=W,uy=H,dy=0;
    REP(i,N){
        cin >> x >> y >> a;
        if(a==1) chmax(lx,x);
        if(a==2) chmin(rx,x);
        if(a==3) chmax(dy,y);
        if(a==4) chmin(uy,y);
    }
    int X = max(rx-lx,0);
    int Y = max(uy-dy,0);
    cout << X*Y << endl;
    return 0;
}

Measured memory_bytes: 256
from fractions import gcd
a,b,c,d = map(int, input().split())
def f(x):
  p = b//x
  q = a//x
  if a%x == 0:
    return(p-q+1)
  else:
    return(p-q)
  
k = f(c)+f(d)-f((c*d)//gcd(c,d))
print(b-a+1-k)

Measured memory_bytes: 5176
// practice with Dukkha
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
	string s; cin >> s;
	int n = s.length();
	int k = n;
	for (int i = 1; i < n; i++)
		if (s[i - 1] != s[i])
			k = min(k, max(i, n - i));
	cout << k << '\n';
	return 0;
}


Measured memory_bytes: 3732
n,m = list(map(int, input().split()))
li=[]
for i in range(m):
    li.append(list(map(int, input().split())))
p = list(map(int, input().split()))

ans=0
#全bit
for i in range(1<<n):
    #電球ごと
    every_on=True
    for j in range(m):
        #スイッチごと
        cnt=0
        for u in range(li[j][0]):
            if i>>(li[j][u+1]-1)&1:
                cnt+=1
        if cnt%2!=p[j]:
            every_on=False
    if every_on:
        ans+=1
print(ans)

Measured memory_bytes: 41584
a = int(input())
l = list(map(int,input().split()))
s = 1
t = 0
for i,j in zip(l,l[1:]):
    if i < j and t == -1:
        t=0
        s+=1
    elif i > j and t == 1:
        t = 0
        s+=1
    elif t ==0:
        if i < j:
            t = 1
        elif i > j:
            t = -1
        

    # print(i,j,s,t)
print(s)
    

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

int main(){
    int a = 0;
    int b = 0;
    int d = 0;
    int r = 0;
    double f = 0;
    
    cin >> a >> b;
    
    d = a / b;
    r = a % b;
    f = (double)a / (double)b;
    
    cout << d << " " << r << " " << fixed << setprecision(5) << f << endl;
    
    return 0;
}

Measured memory_bytes: 1244
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

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

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

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

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

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

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

	n, s := nextInt(), next()

	l, r := 0, 0
	for i := 0; i < n; i++ {
		if s[i] == ')' {
			if l == 0 {
				putf("(")
			} else {
				l--
			}
		} else {
			l++
		}
	}
	putf("%s", s)
	for i := n - 1; i >= 0; i-- {
		if s[i] == '(' {
			if r == 0 {
				putf(")")
			} else {
				r--
			}
		} else {
			r++
		}
	}
	putf("\n")
}


Measured memory_bytes: 640
def main():
    n,m = map(int, input().split())
    ans = 100000
    for i in range(5*m, 15*m):
        if int(i * 0.08) == n and int(i * 0.1) == m:
          ans = min(ans,i)
    print(-1) if ans == 100000 else print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
// Bismillahirrahmanirrahim
#include<bits/stdc++.h>
using namespace std;
#define int long long

const int mod = (int)1e9+7;

int fast_expo(int base, int pow) {
  int ans = 1;
  while(pow > 0){
    if(pow%2 == 1) {
      ans = (ans*base)%mod;
    }
    base = (base*base)%mod;
    pow /= 2;
  }
  return ans%mod;
}
int arr[(int)1e6+4];

int comb(int iki, int bir) {
  int tot = iki + bir;
  int t2 = fast_expo(arr[iki], mod-2) % mod;
  int t1 = fast_expo(arr[bir], mod-2)%mod;
  int alt = (t2*t1) % mod;
  return (arr[tot]*alt) % mod;

}

signed main() {
  int x, y; cin >> x >> y;
  int mn = min(x, y); int mx = max(x, y);
  arr[1] = 1;
  arr[0] = 1;
  for(int i = 2; i < 1e6+4;i++) {
    arr[i] = (arr[i-1]*i) % mod;
  }
  int fark = mx - mn;
  mx -= fark*2;
  mn -= fark;
  if(mx < 0) {cout << 0 << endl; return 0;}
  if(mx%3 != 0) {cout << 0 << endl; return 0;}
  int iki_sayisi = fark + mx/3;
  int bir_sayisi = mx/3;
  cout << comb(iki_sayisi, bir_sayisi) << endl;

}


Measured memory_bytes: 8064
h, w = raw_input().split(" ")
h, w = int(h), int(w)

a = []
for i in range(h):
   a.append([int(x) for x in raw_input().split(" ")])

#print(a)
move = []

for i in range(h):
    for j in range(w-1):
        if a[i][j] & 1:
            a[i][j], a[i][j+1] = 0, a[i][j] + a[i][j+1]
            move.append((i+1,j+1,i+1,j+1+1))

e = w-1
for i in range(h-1):
    if a[i][e] & 1:
        a[i][e], a[i+1][e] = 0, a[i][e] + a[i+1][e]
        move.append((i+1,e+1,i+1+1,e+1))
#print(a)
print(len(move))
#print(move)
for step in move:
    print("{} {} {} {}".format(*step))


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

namespace contest_Csharp
{
    class Program
    {
        static long power(long a, long b, long modulo)
        {
            long result = 1;
            long buff = a;
            for (long i = 1; i <= b; i *= 2)
            {
                result = result * ((b / i % (2) == 1) ? buff : 1) % modulo;
                buff = (buff * buff) % modulo;
            }
            return result % modulo;
        }
        static void Main(string[] args)
        {
            var vals = Console.ReadLine().Split(' ')
                .Select(x => int.Parse(x)).ToList();
            int K = vals[0];
            var vals2 = Console.ReadLine().Split(' ')
                .Select(x => int.Parse(x)).ToList();
            int A = vals2[0];
            int B = vals2[1];
            string ans = (((A + K - 1) / K) * K <= B) ? "OK" : "NG";
            Console.WriteLine(ans);
        }



    }
    
    
}


Measured memory_bytes: 28256
#create date: 2020-07-25 09:13

import sys
stdin = sys.stdin
mod = 10**9+7

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n, m = na()
    a = [0] * (10**5+1)
    for i in range(m):
        st = ni()
        a[st] = 1

    dp = [0] * (10**5+1)
    dp[0] = 1
    if a[1] == 0: dp[1] = 1
    for i in range(2, n+1):
        if a[i] == 1:
            dp[i] = 0
        else:
            dp[i] = (dp[i-2] + dp[i-1]) % mod
    print(dp[n])

if __name__ == "__main__":
    main()

Measured memory_bytes: 74544
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int N=207;

int n, m, k, u, v, x, y, t, a, b, ans, mod;
int F[N];
int dp[2][N][N][N];
int val[N][N][N];

inline void fix(int &x){
	if (x>=mod) x-=mod;
//	if (x<0) x+=mod;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	for (int j=0; j<N; j++) for (int k1=max(j-1, 0); k1<N; k1++) for (int k2=0; k2<N; k2++) dp[0][j][k1][k2]=1;
	cin>>n>>k>>mod;
	
	for (int i=1; i<N; i++){
		int cur=(i&1);
		for (int j=0; i+j<N; j++) for (int k1=0; k1<i+j; k1++) for (int k2=0; k2<i+j; k2++) dp[cur][j][k1][k2]=0;
		for (int k1=0; k1<i; k1++) for (int k2=i-1; k2<i; k2++) dp[cur][0][k1][k2]=1;
		for (int j=1; i+j<N; j++){
			for (int k1=j-1; k1<i+j; k1++) for (int k2=i-1; k2<i+j; k2++){
				if (k2) dp[cur][j][k1][k2]+=dp[cur][j-1][min(k1, i+j-2)][k2-1];
				if (k1) dp[cur][j][k1][k2]+=dp[cur^1][j][k1-1][min(k2, i+j-2)];
				fix(dp[cur][j][k1][k2]);
			}
		}
		for (int j=1; i+j<N; j++) for (int k=max(1, j-1); k<i+j; k++) for (int x=1; x<j && x<=k; x++){
			if (i-1+x<=k) fix(val[j][i][k]+=dp[cur^1][j-x][min(k-1, i+j-x-2)][min(k-x, i+j-x-2)]);
		}
		
//		if (i==1) debug2(cur, dp[cur][2][1][1])
//		if (i==1) debug2(cur, dp[cur][1][1][1])
		
		
	}
	F[0]=1;
	for (int i=1; i<N; i++) F[i]=F[i-1]*i%mod;
	
	if (k==n-1){
//		debug("dag")
		ans=1;
		for (int i=1; i<=n; i++) ans=1ll*ans*i%mod;
	}
	
	for (int t=0; t<=min(k, n-3); t++){
		for (int X=1; X<n-t; X++){
			int Y=n-X-t-1;
			ll tmp=1;
			for (int i=1; i<=n; i++) if (i!=n-t) tmp=tmp*i%mod;
			tmp=tmp*val[X+1][Y][min(k-t, X+Y)]%mod;
//			cerr<<t<<"  "<<X<<" "<<Y<<"   "<<tmp<<"\n";
			ans=(ans+tmp)%mod;
		}
	}
	if (ans<0) ans+=mod;
	cout<<ans<<"\n";
	
//	debug(val[2][3][2]) // should be 0
//	debug(val[3][1][1]) // should be 0
//	debug(val[3][2][2]) // should be 1
	
	return 0;
}
/*
5 2 1000000007
5 3 1000000007
5 4 1000000007

*/

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<long long> vl;
typedef pair<long long, long long> pl;
typedef vector<vector<long long>> matrix;

#define F 						first
#define S 						second
#define PB 						push_back
#define MP 						make_pair
#define all(c) 					c.begin(), c.end()
#define f(i,a,b) 				for(ll i=a; i<b; i++)
#define rep(i,n) 				f(i,0,n)
#define tr(c,i) 				for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) 			(c.find(x) != c.end())	//for set and map
#define cpresent(c,x) 			(find(all(c),x) != c.end())	//for vectors
#define w(t)					ll t; cin>>t; while(t--)
#define epsilon 				1e-9
#define MOD						(ll)1e9

void doublade() {
	ios::sync_with_stdio(false); cin.tie(0); cout.precision(10);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

int main() {
	doublade();
	// w(t) {
		ll n, k;
		cin >> n >> k;
		ll p = n/k;
		n -= p*k;
		ll ans = min(n, abs(n-k));
		cout<<ans<<"\n";
	// }
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  int ans = 0;
  for(int i = 0 ; i < n ; ++i){
    int l, r;
    cin >> l >> r;
    ans += (r - l + 1);
  }
  cout << ans << endl;
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define debug(x) cerr<<#x<<": "<<x<<'\n'

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const int inf = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
#define MAX_N 100100

int n,m;
int u[MAX_N] = {};
int r[MAX_N] = {};
void init(){
    rep(i, n){
        u[i] = i;
        r[i] = i;
    }
}
int find(int x){
    if (x == u[x]) return x;
    return u[x] = find(u[x]);
}
void unite(int x,int y){
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(r[x] < r[y]) u[x] = y;
    else u[y] = x;
    if(r[x] == r[y]) r[x]++;
}
bool same(int x,int y){
    return find(x) == find(y);
}

int main(){

  cin >> n >> m;
  init();
  int p[100100];
  rep(i,n) cin >> p[i],p[i]--;
  rep(i,m){
      int x,y;
      cin >> x >> y;
      x--;y--;
      unite(x,y);
  }
  int ans = 0;
  rep(i,n){
      if(same(p[i],i)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef pair<ll,ll> pll;

#define reps(i,f,n) for(int i = int(f); i <= int(n); i++)
#define rep(i,n) reps(i,0,int(n)-1)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)

#define all(x) (x).begin(),(x).end()
#define X first
#define Y second

#define sz size()
#define eb emplace_back


int main(void){
  int n,m;
  vector<string> u;
  string t;
  cin >> n;
  rep(i,n){cin >> t;u.eb(t);}
  cin >> m;
  bool s = true;
  rep(i,m){
    bool f=false;
    cin >> t;
    rep(i,n){
      if(t==u[i]){
        f=true;
      }
    }
    if(f){
      if(s) cout << "Opened by " << t << endl;
      else  cout << "Closed by " << t << endl;
      s ^= true;
    }else{
      cout << "Unknown " << t << endl;
    }
  }



  return 0;
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

int n;
const int N = 112345;
vvi g(N);
const ll mod = 1e9+7;
vvl dp(N, vl(2));

void dfs(int u=1, int p=1) {
  dp[u][0] = dp[u][1] = 1;
  for (auto v: g[u]) {
    if (v==p) continue;
    dfs(v, u);
  }

  for (auto v: g[u]) if (v != p) {
    dp[u][0] *= (dp[v][0] + dp[v][1]);
    dp[u][0] %= mod;
  }

  for (auto v: g[u]) if (v != p) {
    dp[u][1] *= dp[v][0];
    dp[u][1] %= mod;
  }
}

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  cin >> n;

  rep(i,0,n-1) {
    int u, v;
    cin >> u >> v;
    g[u].pb(v);
    g[v].pb(u);
  }

  dfs();
  cout << accumulate(all(dp[1]), 0LL)%mod << '\n';
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){

  vector<ll> six(8,1),nine(8,1);
  REP(i,7)six[i+1] = six[i]*6,nine[i+1] = nine[i]*9;
  int n;
  cin >> n;
  vector<int> dp(100100,INF);
  dp[0] = 0;
  for(ll i = 1;i < 100100;i++){
    for(int j = 0;j < 8;j++){
      if(i < six[j])continue;
      dp[i] = min(dp[i],dp[i-six[j]]+1);
    }
    for(int j = 0;j < 8;j++){
      if(i < nine[j])continue;
      dp[i] = min(dp[i],dp[i-nine[j]]+1);
    }
  }
  cout << dp[n] << endl;

  

  return 0;
}


Measured memory_bytes: 768
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

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

		int n = sc.nextInt();
		int W = sc.nextInt();
		long[] w = new long[n];
		int[] v = new int[n];

		ArrayList<Integer> arr0 = new ArrayList<>();
		ArrayList<Integer> arr1 = new ArrayList<>();
		ArrayList<Integer> arr2 = new ArrayList<>();
		ArrayList<Integer> arr3 = new ArrayList<>();

		arr0.add(0);
		arr1.add(0);
		arr2.add(0);
		arr3.add(0);

		for (int i = 0; i < n; i++) {
			w[i] = Long.parseLong(sc.next());
			v[i] = Integer.parseInt(sc.next());
			if (w[i] - w[0] == 0)
				arr0.add(v[i]);
			if (w[i] - w[0] == 1)
				arr1.add(v[i]);
			if (w[i] - w[0] == 2)
				arr2.add(v[i]);
			if (w[i] - w[0] == 3)
				arr3.add(v[i]);
		}

		Collections.sort(arr0, Collections.reverseOrder());
		Collections.sort(arr1, Collections.reverseOrder());
		Collections.sort(arr2, Collections.reverseOrder());
		Collections.sort(arr3, Collections.reverseOrder());

		ArrayList<Long> arrsum0 = new ArrayList<Long>();
		ArrayList<Long> arrsum1 = new ArrayList<Long>();
		ArrayList<Long> arrsum2 = new ArrayList<Long>();
		ArrayList<Long> arrsum3 = new ArrayList<Long>();

		arrsum0.add(0l);
		arrsum1.add(0l);
		arrsum2.add(0l);
		arrsum3.add(0l);
		long sum = 0;

		for (int i = 0; i < arr0.size(); i++) {
			sum += arr0.get(i);
			arrsum0.add(sum);
		}

		sum = 0;

		for (int i = 0; i < arr1.size(); i++) {
			sum += arr1.get(i);
			arrsum1.add(sum);
		}

		sum = 0;

		for (int i = 0; i < arr2.size(); i++) {
			sum += arr2.get(i);
			arrsum2.add(sum);
		}

		sum = 0;

		for (int i = 0; i < arr3.size(); i++) {
			sum += arr3.get(i);
			arrsum3.add(sum);
		}

		long max = 0;

		for (int i = 0; i < arr0.size(); i++) {
			for (int j = 0; j < arr1.size(); j++) {
				for (int k = 0; k < arr2.size(); k++) {
					for (int m = 0; m < arr3.size(); m++) {
						if (i * w[0] + j * (w[0] + 1) + k * (w[0] + 2) + m * (w[0] + 3) > W)
							continue;
						max = Math.max(max, arrsum0.get(i) + arrsum1.get(j) + arrsum2.get(k) + arrsum3.get(m));
					}
				}
			}
		}

		System.out.println(max);

	}

}


Measured memory_bytes: 25684
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int V,E;

struct GROUP{
	vector<int> nodes;
};

GROUP group[1000];
vector<int> G[1000];
vector<int> reverse_G[1000];
stack<int> S;

bool check[1000];
int table[1000];

int group_index = -1;

void dfs(int node_id){
	check[node_id] = true;

	for(int i = 0; i < G[node_id].size(); i++){
		if(!check[G[node_id][i]])dfs(G[node_id][i]);
	}
	S.push(node_id);
}

void reverse_dfs(int node_id){
	check[node_id] = true;

	group[group_index].nodes.push_back(node_id);
	table[node_id] = group_index;

	for(int i = 0; i < reverse_G[node_id].size(); i++){
		if(!check[reverse_G[node_id][i]])reverse_dfs(reverse_G[node_id][i]);
	}
}


int main(){

	scanf("%d %d",&V,&E);

	for(int i = 0; i < V;i++)check[i] = false;

	int from,to;

	for(int loop = 0; loop < E; loop++){
		scanf("%d %d",&from,&to);
		from--;
		to--;
		G[from].push_back(to);
		reverse_G[to].push_back(from);
	}

	for(int i = 0; i < V;i++){
		if(!check[i])dfs(i);
	}

	for(int i = 0; i < V;i++)check[i] = false;

	while(!S.empty()){
		if(!check[S.top()]){
			group_index++;

			reverse_dfs(S.top());
		}
		S.pop();
	}

	ll dp[group_index+1];
	for(int i = 0; i <= group_index; i++)dp[i] = 1;

	ll ans = 1;
	int count,next_group;
	bool visited[group_index+1];

	for(int loop = 0; loop <= group_index; loop++){

		for(int i = 0; i <= group_index; i++)visited[i] = false;

		visited[loop] = true;
		count = 0;

		for(int i = 0; i < group[loop].nodes.size(); i++){
			for(int k = 0; k < G[group[loop].nodes[i]].size(); k++){
				next_group = table[G[group[loop].nodes[i]][k]];

				if(visited[next_group] == false){
					visited[next_group] = true;
					count++;
					dp[next_group] = dp[next_group]*(dp[loop]+1)%MOD;
				}
			}
		}

		if(count == 0){
			ans = ans*(dp[loop]+1)%MOD;
		}
	}

	printf("%lld\n",ans%MOD);

	return 0;
}

Measured memory_bytes: 3364
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
  int i,a,b,c,d = 0;
  cin>>a>>b>>c;
  for(i=a;i<=b;i++){
      if(c%i==0){
         d= d + 1;
     
      }
  }
  cout<<d<<endl;
}


Measured memory_bytes: 3088
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;



int main() {

	int N, K, Q;
	cin >> N >> K >> Q;

	vector<int> A(Q);
	for (int i = 0; i < Q; i++)
		cin >> A.at(i);
	
	//ポイントを管理する配列を用意
	//先に全員にQだけマイナスする
	vector<int> point(N);
	for (int i = 0; i < N; i++)
		point.at(i) = K-Q;

	//for()でA0-AQまでloop
	//もしA(i)==その人なら＋
	for (int i = 0; i < Q; i++) 
		point.at(A.at(i) - 1) += 1;
	
	//最後までそれぞれ0以下かどうかで班別
	for (int i = 0; i < N; i++) {
		if (point.at(i) <= 0)
			cout << "No" << endl;
		else
			cout << "Yes" << endl;

	}


	
	//各問(Q)ごとの正解者配列:A(Q)
	//それぞれのメンバーN人のポイント管理配列:point(N)
	//まず全員に問題数だけ引く
	//各門毎に、正解者は＋1する
	//最後に、0以下か否かで判別

	return 0;
}

Measured memory_bytes: 1408
#include <cstdio>

int main(){
    int H, W;
    while(true){
        scanf("%d %d", &H, &W);
        if (H==0 && W==0){
            break;
        }
        for(int i = 0; i<H; i++){
            for(int j=0; j<W; j++){
                if((i + j) % 2 == 0){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2620
#![allow(dead_code, unused_imports, deprecated)]
use std::cmp::{max, min, Reverse};

use itertools::Itertools;

use maplit::*;

use proconio::{input, fastout};
use proconio::marker::*;

const INF: usize = 1_000_000_007;

#[fastout]
fn solve() {
  input! {
    k: usize,
    a: usize, b: usize,
  };
  
  if a <= b / k * k {
    println!("OK");
  } else {
    println!("NG");
  }
}

fn main() {
  std::thread::Builder::new()
    .name("big stack size".into())
    .stack_size(32 * 1024 * 1024)
    .spawn(|| {
      solve();
    })
    .unwrap()
    .join()
    .unwrap();
}


Measured memory_bytes: 2232
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define ld long double
#define MOD 1000000007
#define nl cout << bl
#define rt ll Q[100005] = {0}
#define mp make_pair
#define test() \
    ull t;     \
    cin >> t;  \
    while (t--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define s(ar, n) sort(ar, ar + n)
#define rs(ar, n) sort(ar, ar + n, greater<ll>())
#define oa(a, n)               \
    for (ll i = 0; i < n; i++) \
        cout << a[i] << " ";
#define cn(a, n)               \
    for (ll i = 0; i < n; i++) \
        cin >> a[i];
#define ov(a, n)                    \
    for (ll i = n - 1; i >= 0; i--) \
        cout << a[i] << " ";        \
    nl
#define ovp(a, n)              \
    for (ll i = 0; i < n; i++) \
        cout << a[i].ff << " " << a[i].ss << bl;
#define maxa(ar, N) *max_element(ar, ar + N)
#define mina(ar, N) *min_element(ar, ar + N)
#define present(c, x) ((c).find(x) != (c).end())
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
typedef pair<int, int> pii;
ll fast_exp(ll base, ll exp)
{
    ll res = 1;
    while (exp > 0)
    {
        if (exp % 2 == 1)
            res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return res % MOD;
}
ll fib(ll n)
{
    if (n < 2)
        return n;
    ll a = 0, b = 1, pre;
    int i = 1;
    while (i < n)
    {
        pre = (a + b) % MOD;
        a = b;
        b = pre;
        i++;
    }
    return pre;
}
ll fac(ll n)
{
    if (n % 2 == 0)
        return 2;

    for (ll i = 3; i * i <= n; i += 2)
    {
        if (n % i == 0)
            return i;
    }

    return n;
}
ll fact(ll n)
{
    if (n > 1)
        return n * fact(n - 1);
    else
        return 1;
}
bool sortbysec(const tuple<int, int, int> &a,
               const tuple<int, int, int> &b)
{
    return (get<1>(a) < get<1>(b));
}
int last_digit(int n)
{
    int ans = 0;
    while (n != 0)
    {
        ans = n % 10;
        n /= 10;
    }
    return ans;
}
int main()
{
    fastio();
    int n;
    cin >> n;
    int a[n];
    cn(a, n);
    sort(a, a + n);
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            for (int k = j + 1; k < n; k++)
            {
                if (a[i] == a[j] or a[j] == a[k] or a[k] == a[i])
                {
                    continue;
                }
                if ((a[i] + a[j]) > a[k])
                {
                    count++;
                }
            }
        }
    }
    cout << count << "\n";
}


Measured memory_bytes: 3652
def main():
    n,wmax = map(int,input().split())
    wv = [list(map(int,input().split())) for _ in range(n)]

    # min -> inf, max -> -1
    dp = [[-1]*(wmax+1) for _ in range(n+1)]

    # shoki joken
    dp[0] = [0]*(wmax+1)
    for i in range(n):
        w,v = wv[i]
        for j in range(wmax+1):
            # i select or not select
            if j-w >= 0:
                dp[i+1][j] = max(dp[i][j],dp[i][j-w]+v)
            else:
                dp[i+1][j] = dp[i][j]

    print(max(dp[-1]))

if __name__ == '__main__':
    main()


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

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)
    return divisors

N = int(input())

D = make_divisors(N)

ans = 10**12+1
for d in D:
    b = N//d
    if d + b < ans:
        ans = d + b
print(ans-2)


Measured memory_bytes: 3280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = 998244353;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e6) + 5;
constexpr double EPS = 1e-8;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int main(){
    int n, cnt = 0, k;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        int h;
        cin >> h;
        if(h >= k) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << x << endl;
#else 
    #define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int x[MX];
vi g[MX];

int ans[MX];
int sec[MX];
vi reqs[MX];
vi st;

void dfs(int v) {
    st.pb(v);
    fx(id, reqs[v]) {
        int b = sec[id];
        int l = 0;
        int r = siz(st) - 1;
        while (r - l > 1) {
            int mid = (r + l) / 2;
            if (st[mid] >= b)
                l = mid;
            else
                r = mid;
        }
        ans[id] = siz(st) - 1 - l;
    }
    fx(to, g[v]) 
        dfs(to);
    st.ppb;
}

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

    int n;
    cin >> n;
    fi(0, n)
        cin >> x[i];
    int l, q;
    cin >> l >> q;
    int it = n - 1;
    fi1(n - 1, 0) {
        while (x[it] - x[i] > l)
            --it;
        g[it].pb(i);
    }
    fi(0, q) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        if (a > b)
            swap(a, b);
        sec[i] = b;
        reqs[a].pb(i);
    }
    dfs(n - 1);
    fi(0, q)
        cout << ans[i] << '\n';
}

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

using namespace std;


void solve() {
    int M, D;
    cin >> M >> D;
    int cnt = 0;
    for (int i = 1; i <= M; i++) {
        for (int j = 1; j <= D; j++) {
            if (j < 20) continue;
            if ((j%10)<2) continue;
            if ((j/10) * (j%10) != i) continue;
            cnt++;
        }
    }
    cout << cnt;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


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

int main() {

  int N, M;
  int a[51], b[51];
  int c[51], d[51];
  int i, j;
  int ans[51];
  int min, tmp;
  
  scanf("%d %d", &N, &M);
  for(i = 0; i < N; i++) {
    scanf("%d %d", &a[i], &b[i]);
  }
  for(i = 0; i < M; i++) {
    scanf("%d %d", &c[i], &d[i]);
  }
  for(i = 0; i < N; i++) {
    min = 1000000000;
    for(j = 0; j < M; j++) {
      tmp = abs(a[i]-c[j]) + abs(b[i]-d[j]);
      if(tmp < min) {
	min = tmp;
	ans[i] = j+1;
      }
    }
  }

  for(i = 0; i < N; i++) {
    printf("%d\n", ans[i]);
  }
  
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main() {
    string youbi[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string s;
    cin >> s;
    int i = 0;
    while (youbi[i] != s) {
        i++;
    }
    cout << 7 - i << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    char c;
    cin >> c;
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){
      cout<<"vowel"<<endl;
    }else{
      cout<<"consonant"<<endl;
    }
}

Measured memory_bytes: 256