akhauriyash/Code-Regression huggingface dataset:
// Charan Sriramula
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long int ll;
 
const ll lg=22;
const ll N=2e5+5;
const ll M=5e8;
const ll INF=1e18;
const ll mod=1e9+7;
const double PI = 3.14159265358979323846;
 
#define is(n) scanf("%d",&n)
#define io(n) printf("%d\n",n)
#define ls(n) scanf("%lld",&n)
#define lo(n) printf("%lld\n",n)
 
#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
 
inline ll mul(ll a, ll b, ll p){ return (a * 1ll * b) % p; }
inline ll sub(ll a, ll b, ll p){ ll c = a - b; if(c < 0) c += p; return c; }
inline ll add(ll a, ll b, ll p){ ll c = a + b; if(c > p) c -= p; return c; }
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

ll n,k,fac[N];

ll nCr(ll m,ll r)
{
    if(m<r){return 0;}
    ll num=fac[m]%mod;
    ll den=((fac[m-r]%mod)*(fac[r]%mod))%mod;
    ll minv=power(den,mod-2,mod);
    ll fin=((num%mod)*(minv%mod))%mod;
    return fin;
}

int main()
{
    cin>>n>>k;
    fac[0]=1;
    for(ll i=1;i<=4005;i++){fac[i]=((fac[i-1]%mod)*(i%mod))%mod;}
    for(ll i=1;i<=k;i++)
    {
        ll x=nCr(n-k+1,i);
        ll y=nCr(k-1,i-1);
        x=mul(x,y,mod);
        cout<<x<<endl;
    }
}

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

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    if (b >= a) {
        cout << "unsafe" << endl;
    }
    else {
        cout << "safe" << endl;
    }
}


Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long K = long.Parse(Console.ReadLine());
		long a = 100;
		long y = 0;
		while(true){
			y++;
			a = a + a / 100;
			if(a >= K){
				break;
			}
		}
		Console.WriteLine(y);
	}
}

Measured memory_bytes: 17640
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		no3();
	}

	private static void no3() {
		try (Scanner sc = new Scanner(System.in)) {
			String str = sc.next();
			int a = Character.getNumericValue(str.charAt(0));
			int b = Character.getNumericValue(str.charAt(1));
			int c = Character.getNumericValue(str.charAt(2));
			int d = Character.getNumericValue(str.charAt(3));

			if (a + b + c + d == 7) {
				str = "+++";
			}
			if (a + b + c - d == 7) {
				str = "++-";
			}
			if (a + b - c - d == 7) {
				str = "+--";
			}
			if (a + b - c + d == 7) {
				str = "+-+";
			}
			if (a - b + c + d == 7) {
				str = "-++";
			}
			if (a - b - c + d == 7) {
				str = "--+";
			}
			if (a - b - c - d == 7) {
				str = "---";
			}
			if (a - b + c - d == 7) {
				str = "-+-";
			}
			System.out.println(String.valueOf(a) + str.charAt(0) + String.valueOf(b) + str.charAt(1) + String.valueOf(c)
					+ str.charAt(2) + String.valueOf(d) + "=7");
		}
	}

	static void no2() {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();

			BigInteger f0 = new BigInteger("2");
			BigInteger f1 = new BigInteger("1");
			BigInteger f2 = null;

			if (n == 1) {
				System.out.println(f1);
				return;
			}

			for (int i = 3; i <= n + 1; i++) {
				f2 = f0.add(f1);
				f0 = f1;
				f1 = f2;
			}

			System.out.println(f2);
		}
	}
}

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

typedef long long ll;

int main(){
	string str;
	cin>>str;
	string s;
	ll ans=0;
	for(int i=0;i<1<<(str.size()-1);i++){
		ll tmp=0;
		for(int j=0;j<str.size();j++){
			tmp+=str[j]-'0';
			if((i>>j&1) || j==str.size()-1){
				ans+=tmp;
				tmp=0;
			}
			tmp*=10;
		}
	}
	cout<<ans<<endl;
}


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

using namespace std;
using vi=vector<int>;
using ull=unsigned long long;

typedef long long ll;

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

	int n, m; scanf("%d %d", &n, &m);
	int ml, mr;
	ml = 0;
	mr = 999999999;
	
	for (int i = 0; i < m; i++){
		int l, r; scanf("%d %d", &l, &r);
		ml = max(ml, l);
		mr = min(mr, r);
	}

	printf("%d\n", max(mr - ml + 1, 0));
		
    return 0;
}


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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    
    ll ans = 0;
    if(k%2){
        ans +=(n/k)*(n/k)*(n/k);
    }
    else {
        ans += (n / k) * (n / k) * (n / k);
        ll x = n / (k / 2) - n / k;
        ans += x * x * x;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) ((a>b)? a:b)
int main()
{
  int x;
  cin>>x;
  int ans=0;
  for(int i=1;i<32;i++){
    for(int j=2;j<10;j++){
      if(pow(i,j)>x) break;
      ans=ans>pow(i,j)?ans:pow(i,j);
    }
  }
  cout<<ans;
}

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

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        char x=fsc.next().charAt(0);
        char y=fsc.next().charAt(0);
        fsc.close();
        if(x<y) System.out.println('<');
        else if(x>y) System.out.println('>');
        else System.out.println('=');
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 20948
n,k=map(int,input().split())
A=list(map(int,input().split()))

ans=float("inf")
for i in range(2**n):
    num=format(i,"b").zfill(n)
    if num.count("1")!=k:continue
    height,money=0,0
    for j in range(n):
        if num[j]=="1":
            if A[j]<=height:
                money +=height-A[j]+1
                height +=1
            else:height=A[j]
        else:
            if A[j]>height:height=A[j]
    ans=min(ans,money)
print(ans)

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

int main()
{
	string a,b;
	int x;
	int zh(string s);
	cin>>a>>b;
	x=zh(a+b);
    if(int(sqrt(x))==sqrt(x))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}
int zh(string s)
{
	int tmp=0;
	for(int i=0;i<s.size();i++)
	    tmp=tmp*10+(s[i]-'0');
	return tmp;
}

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

using namespace std;

int main(){
  ll n,i,j,w,ans;
  scanf("%lld %lld",&n,&w);
  vector<pair<ll,ll>>a(n);
  vector<ll>dp(100005,w+1);
  vector<ll>tmp(100005,w+1);
  for(i=0;i<n;i++){
    scanf("%lld %lld",&a[i].first,&a[i].second);
  }
  dp[0] = 0;
  for(i=n-1;i>=0;i--){
    for(j=0;j<100005;j++){
      if(j>=a[i].second){
        tmp[j] = min(dp[j],dp[j-a[i].second]+a[i].first);
      }
      else tmp[j] = dp[j];
    }
    for(j=0;j<100005;j++){
      dp[j] = tmp[j];
    }
  }
  ans = 0;
  for(i=100004;i>=0;i--){
    if(dp[i]<=w){
      ans = i;
      break;
    }
  }
  printf("%lld",ans);
}

Measured memory_bytes: 1792
#include<stdio.h>

long long int gcd(long long int a,long long int b)
{
	long long int r;
	r=1;
	while(r!=0){
		r=a%b;
		a=b;
		b=r;
	}
	return a;
}

int main(void)
{
	long long int a,b,c,d;
	long long int ans;
	long long int lcm;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	lcm=c*d/gcd(c,d);
	ans=b-a+1-(b/c-(a-1)/c+b/d-(a-1)/d-b/lcm+(a-1)/lcm);
	printf("%lld",ans);
	return 0;
}
	

Measured memory_bytes: 128
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int t = sc.nextInt();

        if (t <= 1) {
            System.out.println(--k);
            return;
        }

        long sum = 0;
        PriorityQueue<Integer> queue = new PriorityQueue<>(Comparator.reverseOrder());
        for (int i = 0; i < t; i++) {
            int v = sc.nextInt();
            sum += v;
            queue.add(v);
        }

        int parent = queue.poll();
        if (parent < sum / 2) {
            System.out.println(0);
            return;
        }
        while (!queue.isEmpty()) {
            int target = queue.poll();
            parent = Math.abs(parent - target);
        }

        System.out.println(--parent);
    }
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
using ll = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;};
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;};

namespace Geometry{
  typedef long double D;
  typedef complex<long double> P;
  typedef pair<P, D> C;


  const D EPS = 1e-9;
  const D INF = 1e18;

  D dot(P p1, P p2){return p1.real() * p2.real() + p1.imag() * p2.imag();}

  D distLP (P vec, P x){return abs((x / vec).imag()) * abs(vec);}
  D distLP(P p1, P p2, P x){return distLP(p2 - p1, x - p1);}
  
  D distSP(P p1, P p2, P x){
    if(dot(p2 - p1, x - p1) < -EPS) {return abs(x - p1);}
    if(dot(p1 - p2, x - p2) < -EPS) {return abs(x - p2);}
    return distLP(p1, p2, x);
  }
}

using namespace Geometry;


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  ll n1;
  cin>>n1;
  n1+=2;
  vector<P> A(n1);
  A[0]={0,0};
  A[n1-1]={1000,0};
  for(int i=1;i+1<n1;i++){
    D x,y;
    cin>>x>>y;
    A[i]={x,y};
  }
  ll n2;
  cin>>n2;
  n2+=2;
  vector<P> B(n2);
  B[0]={0,1000};
  B[n2-1]={1000,1000};
  for(int i=1;i+1<n2;i++){
    D x,y;
    cin>>x>>y;
    B[i]={x,y};
  }
  D ans=INF;
  for(auto &I:A){
    for(int j=1;j<n2;j++){
      ans=min(ans,distSP(B[j-1],B[j],I));
    }
  }
  for(auto &I:B){
    for(int j=1;j<n1;j++){
      ans=min(ans,distSP(A[j-1],A[j],I));
    }
  }
  cout<<fixed<<setprecision(12)<<ans<<endl;
  
  return 0;
}



Measured memory_bytes: 3364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0; i<(n); 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; }
int main(){
    ll a,b; cin>>a>>b;
    if(a>0) cout<<"Positive"<<endl;
    else if(a<=0 && 0<=b) cout<<"Zero"<<endl;
    else if((b-a)%2==0) cout<<"Negative"<<endl;
    else cout<<"Positive"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int N;
    scanf("%d",&N);
    int A[N+5],E[N+5];//A为第几个人进来的数组 E为数组A元素和结果交换的数组
    for(int i=1;i<=N;i++){
    scanf("%d",&A[i]);
    E[A[i]]=i;
    }
    for(int i=1;i<=N;i++)
    printf("%d ",E[i]);
    return 0;
}


Measured memory_bytes: 1536
#include<stdio.h>

int main(){
        long int sum=0;
        int i,n,max=-1000001,min=1000001,a[10010];
        scanf("%d",&n);
        for(i=0;i<n;i++){
                scanf("%d",&a[i]);
                if(a[i]>max)max=a[i];
                if(a[i]<min)min=a[i];
                sum+=a[i];
        }

        printf("%d %d %ld\n",min,max,sum);
        return 0;
}


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

using namespace std;

int main(){
    int n;
    cin>>n;
    for (int i = 0; i < n; ++i) {
        int x,y,b,p;
        cin>>x>>y>>b>>p;
        int q=x*b+y*p;
        int w=x*5+y*2;
        w-=w/5;
        int e=5,r=2;
        while(e<b||r<p){
            if(e<b){
                w+=(x-x/5);
                ++e;
            }
            if(r<p){
                w+=(y-y/5);
                ++r;
            }
        }
        cout<<min(q,w)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3108
#include "bits/stdc++.h"

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

using namespace std;
using ll = long long;
using P = pair<ll, int>;

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) (__VA_ARGS__)

map<ll, int> F;
void factor(ll n) {
  int num = (ll)sqrt(n)+1;
  vector<ll> A;
  REP(k, 2, num+1) {
    while (n % k == 0) {
      A.push_back(k);
      n /= k;
    }
  }
  if (n != 1) A.push_back(n);
  for (ll a : A) {
    F[a]++;
  }
}

void Main() {
  ll n;
  cin >> n;
  if (n==2) {
    cout << 1 << endl;
    return;
  }
  ll ans = 1;
  int num = (int)sqrt(n) + 1;
  REP(k, 2, num+1) {
    if ( n % k == 0 ) {
      ll x = n / k;
      while( x%k==0 ) x/=k;
      if (x % k == 1) ans++; 
    }
  }
  factor(n-1);
  ll a = 1;
  for(auto itr=F.begin(); itr!=F.end(); ++itr) a *= itr->second+1;
  a--;
  ans += a;
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    
    val arr = Array<Array<Int>>(n, { Array<Int>(3, { cin.nextInt() }) })

    val points = Array<Array<Int>>(n, { Array<Int>(3, { 0 }) })

    for (i in 0..n-1) {
        if (i == 0) {
            points[i][0] = arr[i][0]
            points[i][1] = arr[i][1]
            points[i][2] = arr[i][2]
        } else {
            points[i][0] = Math.max(points[i - 1][1] + arr[i][0], points[i - 1][2] + arr[i][0])
            points[i][1] = Math.max(points[i - 1][2] + arr[i][1], points[i - 1][0] + arr[i][1])
            points[i][2] = Math.max(points[i - 1][0] + arr[i][2], points[i - 1][1] + arr[i][2])
        }
    }
    println(Math.max(points[n-1][0], Math.max(points[n-1][1], points[n-1][2])))
}

Measured memory_bytes: 123212
#include<bits/stdc++.h>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
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; }

int main(){
  ll a,b,c; cin >> a >> b >> c;
  set<int> st;
  for(int i = 1; st.count((a*i)%b) == 0; i++){
    st.insert((a*i)%b);
  }
  if(st.count(c)) cout << "YES";
  else cout << "NO";
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3604
n = int(input())
a = list(map(int, input().split()))
num = [0] * n
cnt = 0

for i in a:
    num[i - 1] += 1

for i in num:
    cnt += i * (i - 1)//2

for i in range(n):
    tmp = num[a[i]-1]
    ans = cnt - (tmp * (tmp-1) // 2)
    ans += ((tmp-2) * (tmp-1) // 2)
    print(ans)


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

int main(){
  int n,a,b,c;
  cin>>n>>a>>b>>c;
  int l[n];
  rep(i,0,n) cin>>l[i];
  int ans=114514;
  rep(i,0,1<<(2*n)){
    int cur=i;
    int d=0;
    int e=0;
    int f=0;
    int mp=0;
    rep(j,0,n){
      if(cur%4==1){
        if(d!=0) mp+=10;
        d+=l[j];
      }
      else if(cur%4==2){
        if(e!=0) mp+=10;
        e+=l[j];
      }
      else if(cur%4==3){
        if(f!=0) mp+=10;
        f+=l[j];
      }
      cur/=4;
    }
    if(d!=0 && e!=0 && f!=0){
      mp+=abs(a-d);
      mp+=abs(b-e);
      mp+=abs(c-f);
      ans=min(ans,mp);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define erep(i, a, b) for (int i = a; i <= (int)(b); i++)
#define per(i, a, b) for (int i = (b)-1; i > (a); i--)
#define eper(i, a, b) for (int i = ((int)(a)); i >= b; i--)
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
const int INF = (1 << 30) - 1;
const int MOD = 1000000007;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

ll H, W, ans = INF;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> H >> W;
  if (W % 3 == 0 || H % 3 == 0) {
    ans = 0;
    cout << 0 << endl;
    return 0;
  }
  rep(i, 1, H) {
    ll w = ceil(W / 2), s_max, s_min;
    s_max = max(i * W, w * (H - i));
    s_max = max(s_max, (W - w) * (H - i));
    s_min = min(i * W, w * (H - i));
    s_min = min(s_min, (W - w) * (H - i));
    // printf("%d %d %d\n", s_max, s_min, w);
    ans = min(ans, s_max - s_min);
    ans = min(ans, min(H, W));
  }
  rep(i, 1, W) {
    ll h = ceil(H / 2), s_max, s_min;
    s_max = max(i * H, h * (W - i));
    s_max = max(s_max, (H - h) * (W - i));
    s_min = min(i * H, h * (W - i));
    s_min = min(s_min, (H - h) * (W - i));
    ans = min(ans, s_max - s_min);
    ans = min(ans, min(H, W));
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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; }

int main(){
  bool ans = true;
  ll n, m;
  cin >> n >> m;
  ll num = 0;
  ll fin = 9;
  if (n == 2){
    num = 10;
    fin = 99;
  }
  else if(n==3){
    num = 100;
    fin = 999;
  }
  vi s(m);
  vi c(m);
  rep(i,m){
    cin >> s[i] >> c[i];
  }
  ll num1 = 0;
  ll num2 = 0;
  ll num3=0;
  for (ll i = num; i <= fin; i++){
    bool x = true;
    if (n == 1){
      num1 = i;
    }
    else if(n==2){
      num1 = i / 10;
      num2 = i % 10;
    }
    else if(n==3){
      num1 = i / 100;
      num2 = (i - 100 * num1) / 10;
      num3 = i % 10;
    }
    rep(j,m){
      if(s[j]==1&&num1!=c[j]){
        x = false;
        break;
      }
      else if(s[j]==2&&num2!=c[j]){
        x = false;
        break;
      }
      else if(s[j]==3&&num3!=c[j]){
        x = false;
        break;
      }
    }
    if(x){
      print(i);
      ans = false;
      break;
    }
  }
  if(ans){
    print(-1);
  }
}

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

int main() {
    int x;
    cin >> x;
    cout << 10 - x/200 << endl;
}

Measured memory_bytes: 3592
// https://atcoder.jp/contests/abc054/tasks/abc054_b
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <set>
using namespace std;

#define FOR(i, n) for (int i = 0; i < n; i++)
#define EACH(i, n) for (auto &i: n)

struct Line {
  int from, to;
  bool used;
};

int scan(int n, int p, vector<Line> lines, set<int> used) {
  if (used.size() == n) return 1;

  int sum = 0;
  EACH(l, lines) {
    if (l.used) continue;
    int to = -1;
    if (l.from == p) {
      to = l.to;
    } else if (l.to == p) {
      to = l.from;
    }
    if (to == -1) continue;

    if (used.find(to) != used.end()) continue;

    l.used = true;
    used.insert(to);
    sum += scan(n, to, lines, used);
    used.erase(to);
    l.used = false;
  }
  return sum;
}

int solv(int n, int m) {
  vector<Line> lines;
  FOR(i, m) {
    Line l;
    cin >> l.from >> l.to;
    l.used = false;
    lines.push_back(l);
  }

  set<int> used;
  used.insert(1);

  return scan(n, 1, lines, used);
}

int main() {
  int n, m;

  while (cin >> n >> m) {
    cout << solv(n, m) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = 998244353;
const long long INF_LL = 1e18+11; const int INF_int = 1e9+11;
#define ll long long
#define ld long double
#define mp std::make_pair
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto x:a) cout << x << " ";cout << endl;
bool ok(vector<ld> a,ll middle,int k){
    int cnt = 0;
    rep(i,a.size()){
        cnt+=floor((a[i]-0.1)/middle);
    }
    if(cnt<=k) return true;
    else return false;
}
int main(){
    int n,k;
    cin >> n >> k;
    vector<ld> a(n);
    rep(i,n){
        cin >> a[i];
    }
    ll left = 0;
    ll right = 1e9+6;
    while((right-left)>1){
       ll middle = (right+left)/2;
       if(ok(a,middle,k)){
           right = middle;
       } 
       else left = middle;
    }
    cout << right << endl;
}

Measured memory_bytes: 9660
import java.io.*;

class Main {
   public static void main(String[] args)throws java.io.IOException  {
   int x;
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   x = Integer.parseInt(br.readLine());
   x = x * x * x;
   System.out.println(x);
}
}

Measured memory_bytes: 24204
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0); cout.tie(0);
	int L; cin >> L;
	double a = 27;
	printf("%.10lf", L * L * L / a);
	//cout << L * L * L / a << '\n';
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from copy import deepcopy
def inpl(): return tuple(map(int, input().split()))

N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))

T0 = [0 for _ in range(10001)]
T1 = [0 for _ in range(10001)]
T0[0] = 1
T1[0] = 1

for s in S:
    for i, t in enumerate(T0):
        if t:
            T1[i+s] = 1
    T0 = deepcopy(T1)

for i in range(10, 10001, 10):
    T0[i] = 0 

print(10000 - T0[::-1].index(1))

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

#define PB          push_back
#define PF          push_front
#define MP          make_pair
#define FI          first
#define SE          second
#define SIZE( A )   int( ( A ).size( ) )
#define ALL( A )    ( A ).begin( ), ( A ).end( )
#define ALLR( A )   ( A ).rbegin( ), ( A ).rend( )

using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         lf;
typedef pair< int, int >    pii;
typedef pair< ll, ll >      pll;
typedef vector< bool >      vb;
typedef vector< lf >        vd;
typedef vector< ll >        vll;
typedef vector< int >       vi;
typedef vector< pii >       vpii;

const int MAXN = int( 5e1 )+10;
const int MOD  = int( 1e9 )+7;
const int oo   = INT_MAX;
const int dx[ 2 ] = {0,1};
const int dy[ 2 ] = {1,0};

int n;
string m[ 2 ];

bool check( int x, int y ) {
  return 0 <= x && x <= 1 && 0 <= y && y < n;
}

ll mul( ll a, ll b ) {
  return (a*b >= MOD ? (a*b)%MOD : a*b);
}

ll solve( int a, int b, int c, int d ) {
  if( !check(c,d+1) ) return 1LL;
  if( a == c ) { //same X
    if( d+2 < n && m[0][d+1] == m[0][d+2] ) return mul( ((a == b && a == 0) ? 6LL : 3LL ), solve(0,d+1,0,d+2) );
    else if( d+1 < n ) {
      return mul( ( (a == b && a == 0) ? 2LL : 1LL ), solve(0,d+1,1,d+1) );
    }
    return 1LL;
  }
  else if( b == d ) { // same Y
    if( d+2 < n && m[0][d+1] == m[0][d+2] ) return mul( 2LL, solve(0,d+1,0,d+2) );
    else if( d+1 < n ) return mul( 2LL, solve(0,d+1,1,d+1) );
    return 1LL;
  }
}

int main( ) {

  #ifdef LOCAL
    freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
  #else
    //freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
    ios_base::sync_with_stdio( 0 );
    cin.tie( 0 );
  #endif
  while( cin >> n ) {
    cin >> m[0] >> m[1];
    if( n == 1 ) {
      cout << 3 << '\n';
    }
    else if( n == 2 ) {
      cout << 6 << '\n';
    }
    else {
      for( int i = 0; i < 2; ++i ) {
        if( m[0][0] == m[dx[i]][dy[i]] ) {
          cout << mul( 3LL, solve( 0,0,dx[i],dy[i] ) ) << '\n';
        }
      }
    }
  }

  return 0;
}


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

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int x;
    cin >> x;
    int count = 0;
    for(int i = 0;i < a + 1;i++) {
        for(int j = 0;j < b + 1;j++) {
            if((x - 500 * i - 100 * j) >= 0 && (x - 500 * i - 100 * j) % 50 == 0 && (x - 500 * i - 100 * j) / 50 <= c) {
                count++;
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    long long int i = a * x + b * y,j,k;
    if(x>y){
        swap(x, y);
        swap(a, b);
    }
    j = x * 2 * c + (y - x) * b;
    k = y * 2 * c;
    cout << min(i, min(j, k)) << endl;
    
}


Measured memory_bytes: 256
#include <stdio.h>
#include<ctype.h>
int swapUpDown(int c){
    if(islower(c)){
        c=toupper(c);
    }
    else if(isupper(c)){
        c=tolower(c);
    }
    return c;
}

int main(void){
    int c;
    while((c=getchar())!=EOF){
        putchar(swapUpDown(c));
    }
    return 0;
}


Measured memory_bytes: 1812
#include<bits/stdc++.h>
using namespace std;
string s;
long long l;
int main()
{
	cin>>s;
    l=s.size();
    for(register int i=0;i<l;i++)
    {
        if(s[i]=='C')
        {
            for(register int j=i+1;j<l;j++)
            {
                if(s[j]=='F')
                {
                    cout<<"Yes"<<endl;;
                    return 0;
                }
            }
        }
    }
    cout<<"No"<<endl;;
    return 0;
} 

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

int main()
{
    string a;
    cin >> a;
    int b;
    b = a.length();
    string c;
    for (int i = 0; i < b; ++i)
    {
        c = a.at(i);
    }
    if (c == "s")
    {
        cout << a << "es" << endl;
    }
    else
    {
        cout << a << "s" << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long
#define BASE 3000
using namespace std;
inline int read(){
    int res=0;
    char c;
    bool zf=0;
    while(((c=getchar())<'0'||c>'9')&&c!= '-');
    if(c=='-')zf=1;
    else res=c-'0';
    while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0';
    if(zf)return -res;
    return res;
}
struct op{
	int a,b;
}data[200005];
int dp[6005][6005];
int frac[10005],inv[10005];
inline int C(int a,int b){
	return frac[a]*inv[a-b]%mod*inv[b]%mod;
}
inline int solve(int x,int y=mod-2,int MOD=mod){
	int res=1;
	while(y){
		if(y&1)res=res*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return res;
}
signed main(){
	int n=read();
	for(register int i=1;i<=n;i++)data[i].a=read(),data[i].b=read();
	for(register int i=1;i<=n;i++)dp[BASE-data[i].a][BASE-data[i].b]++;
	int Maxx=-2e9,Maxy=-2e9;
	for(register int i=1;i<=n;i++)Maxx=max(Maxx,data[i].a),Maxy=max(Maxy,data[i].b);
	for(register int i=-Maxx;i<=Maxx;i++)for(register int j=-Maxy;j<=Maxy;j++)dp[BASE+i][BASE+j]=(dp[BASE+i][BASE+j]+dp[BASE+i-1][BASE+j]+dp[BASE+i][BASE+j-1])%mod;
	int ans=0;
	for(register int i=1;i<=n;i++)ans=(ans+dp[BASE+data[i].a][BASE+data[i].b])%mod;
	int temp=(Maxx+Maxy)<<1;
	frac[1]=1;for(register int i=2;i<=temp;i++)frac[i]=frac[i-1]*i%mod;
	inv[temp]=solve(frac[temp]);for(register int i=temp-1;i>=1;i--)inv[i]=inv[i+1]*(i+1)%mod;
	for(register int i=1;i<=n;i++)
		ans=(ans-C((data[i].a+data[i].b)<<1,data[i].a<<1)+mod)%mod;
	cout<<ans*solve(2)%mod;
	return 0;
} 

Measured memory_bytes: 195328
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

a.sort()

if n%2==0:
    for i in range(n//2):
        if a[i*2]!=i*2+1 or a[i*2+1]!=i*2+1:
            print(0)
            exit()
    
    print((2**(n//2))%mod)


else:
    if a[0]!=0:
        print(0)
        exit()
    
    b=a[1:]

    for i in range(n//2):
        if b[i*2]!=i*2+2:
            print(0)
            exit()
        
        if b[i*2+1]!=i*2+2:
            print(0)
            exit()

    print((2**(n//2))%mod)

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

int n,a[200005],p[200005];
int main() {
	cin>>n;
	for (int i=1;i<=n;i++) {
		cin>>a[i];
		p[a[i]]=i;
	}
	int ans=1,s=1;
	for (int i=2;i<=n;i++) if (p[i-1]<p[i]) {
		s++; ans=max(ans,s);
	} else s=1;
	ans=n-ans;
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

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

    char out = 'C';
    if (s == 'A') {
        out = 'T';
    }
    else if (s == 'T') {
        out = 'A';
    }
    else if (s == 'C') {
        out = 'G';
    }

    cout << out << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<int,int>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//符号反転
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(int n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }
    mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
mint dp[(1<<21)+5];
int main(){
int n;cin>>n;
V<V<int>> a(n,V<int>(n));
for(int i=0;i<n;i++)for(int j=0;j<n;j++)cin>>a[i][j];
dp[0]=1;
for(int S=1;S<(1<<n);S++){
   int cnt=0;
   for(int i=0;i<n;i++)if(S&(1<<i))cnt++;
   for(int i=0;i<n;i++)if(S&(1<<i)&&a[cnt-1][i])dp[S]+=dp[S^(1<<i)];
}
cout<<dp[(1<<n)-1]<<endl;
}

Measured memory_bytes: 16640
#include <stdio.h>
int main(void){
    int i,j,a,b;
     
while(1){
    scanf("%d %d",&a,&b);
    if(a==0&&b==0)break;
    for(i=0;i<a;i++){
        for(j=0;j<b;j++){
             if(i%2==1){
                 if(j%2==1)printf("#");
                 else printf(".");
        }else{
            if(j%2==1)printf(".");
            else printf("#");
        }
        }
 printf("\n");
}
    printf("\n");
}
return(0);
}


Measured memory_bytes: 2048
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int f(char c){
  return (c - '0' + 2) % 3;
}

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

  string in;
  while(cin>>in, in!="#"){
	int ans = 123456789;
	const int N = SZ(in);

	REP(k,2){
	  int st = k;
	  int prv = f(in[0]), cnt = 0;
	  for(int i=1;i<N;++i){
		if(st == 0){
		  if(f(in[i]) < prv)
			++cnt;
		  else
			st = 1;
		}
		else{
		  if(prv < f(in[i]))
			++cnt;
		  else
			st = 0;
		  
		}
		prv = f(in[i]);
	  }
	  ans = min(ans, cnt);
	}
	cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1324
n,m=map(int,input().split())
dp=[float("inf")]*(1<<n)
b=[True]*(1<<n)
p=[]
k=0
for i in range(m):
    k=0
    a,_=map(int,input().split())
    c=list(map(int,input().split()))
    for cc in c:
        k+=1<<(cc-1)
    if b[k]:
        b[k]=False
    dp[k]=min(dp[k],a)
    p.append(k)
while True:
    d=[]
    for i in p:
        for j in p:
            if dp[i|j]>dp[i]+dp[j]:
                dp[i|j]=dp[i]+dp[j]
                if b[i|j]:
                    b[i|j]=False
                    d.append(i|j)
    if len(d)==0:
        break
    for oo in d:
        p.append(oo)
if dp[-1]==float("inf"):
    print(-1)
else:
    print(dp[-1])

Measured memory_bytes: 46696
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int m,d;
	cin>>m>>d;
	int ans=0;
	range(i,1,m+1){
		range(j,1,d+1){
			int da=j/10;
			int db=j%10;
			if(da>1&&db>1&&da*db==i){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
# A - Shrinking

s = input()
N = len(s)
ans = 1000

for i in range(N):
    count = count_max = 0
    for j in range(1,N+1):
        if s[i]==s[N-j]:
            count = 0
        else:
            count += 1
        count_max = max(count, count_max)
    ans = min(count_max, ans)

print(ans)

Measured memory_bytes: 9128
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		int n=sc.I;
		long ans=0;
		int[][] a=new int[n][];
		int[][] b=new int[n][];
		int[] h=new int[n];
		for(int i = 0;i<n;i++) {
			a[i]=sc.Ia2(2);
			a[i][2]=i;
			b[i]=new int[3];
			Array.Copy(a[i],b[i],3);
		}
		Array.Sort(a,(u,v)=>u[0]-v[0]);
		Array.Sort(b,(u,v)=>u[1]-v[1]);
		long p=0;
		int k=0;
		for(int i=0,j=n-1,l=0;l<=(n>>1);l++) {
			while(h[i]!=0&&i<j){i++;}
			if(k>b[i][1]&&h[i]==0){
				p+=Math.Abs(k-b[i][1]);
				k=b[i][1];
			}
			h[i]=1;
			while(h[j]!=0&&i<j){j--;}
			if(k<a[j][0]&&h[j]==0){
				p+=Math.Abs(k-a[j][0]);
				k=a[j][0];
			}
			h[j]=1;
		}
		p+=Math.Abs(k-0);
		ans=p;
		p=0;k=0;
		for(int i=0,j=n-1,l=0;l<=(n>>1);l++) {
			while(h[j]!=1&&i<j){j--;}
			if(k<a[j][0]&&h[j]==1){
				p+=Math.Abs(k-a[j][0]);
				k=a[j][0];
			}
			h[j]=2;
			while(h[i]!=1&&i<j){i++;}
			if(k>b[i][1]&&h[i]==1){
				p+=Math.Abs(k-b[i][1]);
				k=b[i][1];
			}
			h[i]=2;
		}
		p+=Math.Abs(k-0);
		ans=Math.Max(ans,p);
		Console.WriteLine("{0}",ans);
	}
}

public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return a[n];}}
	public string Sz{get{return Console.ReadLine();}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2(int b){return Array.ConvertAll((((b&1)!=0?"0 ":"")+Console.ReadLine()+((b&2)!=0?" 0":"")).Split(),int.Parse);}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public string[] Sa2{get{return ("# "+Console.ReadLine()).Split();}}
}


Measured memory_bytes: 30648
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		StringBuilder sb = new StringBuilder();
		int[] op = new int[q];
		for (int i = 0; i < q; i++) {
			op[i] = sc.nextInt();
		}
		for (int i = 0; i < op.length; i++) {
			if (Arrays.binarySearch(array, op[i]) >= 0) {
				sb.append(1);
			} else {
				sb.append(0);
			}
			sb.append('\n');
		}
		
		System.out.print(sb.toString());
	}
}



Measured memory_bytes: 105036
#include <iostream>
using namespace std;
string a;
int i, c[30];
int main() {
	cin>>a;
	for(i=0; a[i]; i++) c[a[i]-'a']++;
	for(i=0; i<26; i++) if(c[i]%2) break;
	cout<<(i==26 ? "Yes":"No");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;
const auto MOD = 1000000007;
const int INF = 1e9;
const long long LINF = 1e18;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef vector<int> VI;
typedef vector<long long> VLL;

// index が条件を満たすかどうか vector<>maeに検索したいvectorを入れる keyを超える最小の要素番号を返す
bool isOK(int index, int key, vector<int>&mae) {
	if (mae[index] >= key) return true;
	else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(int key, vector<int>&mae) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)mae.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key, mae)) right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}

int n, m;
long long k;
string s;

int main() {
	cin >> n >> k;
	VI a(n);
	VI mem[200001];//iの番号を保存
	int me[2][200001];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		mem[a[i]].push_back(i);
	}
	if (n == 1){
		for (int i = 0; i < k % 2; i++)
		{
			cout << a[0] << endl;
		}return 0;
	}
	long long cnt = 0;
	int ite = 0;
	long long matagi = 0;
	int fla = 0;
	if (mem[a[0]].size() == 1)fla = 1;
	while (1) {
		//次番検索
		me[0][cnt] = ite;
		me[1][cnt] = matagi;
		if (fla == 1&&cnt==0) {
			ite = 1;
			matagi = 1;
			cnt++;
			continue;
		}
		long long temp = 0;
		/*for (int j = 0; j < mem[a[ite]].size(); j++)
		{
			temp = j;
			if (mem[a[ite]][temp] == ite)break;
		}
		*/
		temp=binary_search(ite, mem[a[ite]]);
		if (temp == mem[a[ite]].size() - 1) {
			ite = mem[a[ite]][0];matagi++;
		}
		else {
			ite = mem[a[ite]][temp + 1];
		}
		if (ite == n - 1)break;
		ite++;
		cnt++;
	}
	long long p = k % (matagi+1);
	if (!p){cout << endl;return 0;
	}
	int sear = 0;
	for (int i = 0; i < cnt+1; i++)
	{
		sear = i;
		if (me[1][sear] == p)break;
	}
	sear--;
	VI ans;
	for (int i = me[0][sear]; i < n; i++)
	{
		int va = 0;
		int bin = binary_search(i, mem[a[i]]);
		if (bin == 0 || mem[a[i]][bin - 1] < me[0][sear]) { ans.push_back(a[i]); continue; }
		for (int j = ans.size()-1; j >= 0; j--)
		{
			int siz = ans.size();
			if (ans[j] == a[i]) {
				for (int l = siz-1; l >= j; l--)
				{
					ans.pop_back();
				}
				va = 1;
				break;
			}
		}
		if(va==0)ans.push_back(a[i]);
	}
	for (int i = 0; i < ans.size(); i++)
	{
		cout << ans[i] << ' ';
	}
}


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

using namespace std;

using Graph = vector<vector<int> >;
Graph G;

void dfs(int v, vector<bool> &seen, int &res){
    bool end = true;
    rep(i, seen.size()){
        if(!seen.at(i) && i != v) end = false;
    }
    if(end){
        res++;
        return;
    }
    seen.at(v) = true;
    for(int nv : G.at(v)){
        if(seen.at(nv)) continue;
        dfs(nv, seen, res);
    }
    seen.at(v) = false;
}

int main(){
    int N, M;
    cin >> N >> M;
    G.assign(N, vector<int>());
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G.at(a).push_back(b);
        G.at(b).push_back(a);
    }
    vector<bool> seen(N, false);
    int res = 0;
    dfs(0, seen, res);
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

void ok(){
    cout << "First" << endl;
    exit(0);
}

void ng(){
    cout <<  "Second" << endl;
    exit(0);
}

Int dep[216000];
vector<Int> edge[216000];
Int n, a, b;
void dfs(int x, int last = -1){
    if(last == -1)dep[x] = 0;
    for(auto to:edge[x]){
        if(to == last)continue;
        dep[to] = dep[x] + 1;
        dfs(to, x);
    }
}
int main(){
    cin >> n;
    for(int i = 0;i < n-1;i++){
        cin >> a >> b;a--,b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    dfs(0);
    int to = 0;
    for(int i = 0;i < n;i++){
        if(dep[to] < dep[i])to = i;
    }
    dfs(to);
    int from = 0;
    for(int i = 0;i < n;i++){
        if(dep[from] < dep[i])from = i;
    }
    if(dep[from] % 3 == 1)ng();
    else ok();
    return 0;
}

Measured memory_bytes: 22528