akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
)

func gcd(a int64, b int64) int64 {
	if a < b {
		a, b = b, a
	}
	for b > 0 {
		a, b = b, a%b
	}
	return a
}

func lcm(a int64, b int64) int64 {
	return (a / gcd(a, b)) * b
}

func main() {
	var n int
	var m int64
	fmt.Scan(&n)
	fmt.Scan(&m)
	var b []int64
	lcmAll := int64(1)
	for i := 0; i < n; i++ {
		var a int64
		fmt.Scan(&a)
		bi := a / 2
		b = append(b, bi)
		lcmAll = lcm(lcmAll, bi)
		if lcmAll > m {
			fmt.Println(0)
			return
		}
	}
	for i := 0; i < n; i++ {
		if (lcmAll/b[i])%2 == 0 {
			fmt.Println(0)
			return
		}
	}
	var ans int64
	ans = (m/lcmAll + 1) / 2
	fmt.Println(ans)
}


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

int main()
{
    int N;
    cin >> N;
    int cnt = 0;
    string ans = "No";
    for (int i=0; i<N; i++)
    {
        int D1, D2;
        cin >> D1 >> D2;
        if (D1==D2) cnt++;
        else cnt = 0;

        if (cnt == 3)
        {
            ans = "Yes";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <bitset>
#include <cstring>
#include <queue>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int n,m; cin >> n >> m;
		if(n==0&&m==0)break;
		vector<pair<int,pair<int,int>>> v(m);
		for(int i=0;i<m;i++){
			cin >> v[i].first >> v[i].second.first >> v[i].second.second;
		}
		sort(v.begin(),v.end());
		int ans=1;
		vector<bool> a(n+1);
		a[1]=1;
		for(int i=0;i<m;i++){
			if(a[v[i].second.first]){
				if(!a[v[i].second.second]){
					a[v[i].second.second]=1;
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3360
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s1,s2,u;
  cin>>s1>>s2;
  int a,b;
  cin>>a>>b;
  cin>>u;
  if(u==s1)	a--;
  else if(u==s2)	b--;
  cout<<a<<" "<<b<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;cin >> x;
    ll now=100;
    int ans=0;
    while(now<x){
        now+=now/100;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
/*zxj*/
#include<iostream> 
#include<string>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<sstream>
#define sf scanf
#define pf printf
#define pfn printf("\n");
#define pfk printf(" ");
#define pf0 printf("0");
#define pf1 printf("1");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfdd(n,m) scanf("%d%d",&n,&m);
#define sfld(n) scanf("%lld",&n);
#define sfldd(n,m) scanf("%lld%lld",&n,&m);
#define sflf(n) scanf("%lf",&n);
#define sflff(n,m) scanf("%lf%lf",&n,&m);
#define sfc(n) scanf("%c",n);
#define sfcc(n,m) scanf("%c%c",n,m);
#define sfs(n) scanf("%s",n);
#define sfss(n,m) scanf("%s%s",n,m);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);
using namespace std;
#define csh(a,n) memset(a,n,sizeof(a));
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
int main(){
	int n;
	cin>>n;
	long long sum=1;
	for(int i=0;i<n;i++){
		long long b;
		cin>>b;
		sum=sum/GCD(sum,b)*b;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;

const int N=2e5+10;
vector<int>g[N];
int main(){
	int n, m;
	cin>>n>>m;
	string s;
	cin>>s;
	vector<int>a(n);
	vector<int>b(n);
	
	int u, v;
	for(int i=0;i<m;i++){
		cin>>u>>v;
		u--,v--;
		g[u].push_back(v);
		g[v].push_back(u);
		if(s[u]==s[v]){
			if(s[u]=='A')a[u]++,a[v]++;
			else b[u]++,b[v]++;
		}
		else{
			if(s[u]=='A')b[u]++,a[v]++;
			else a[u]++,b[v]++;
		}
	}
	queue<int>q;
	vector<int>d(n);
	for(int i=0;i<n;i++)
		if(!a[i]||!b[i]){
			q.push(i);
			d[i]=1;
		}
	while(q.size()){
		int u=q.front();q.pop();
		for(auto v:g[u])
			if(!d[v]){
				if(s[u]=='A')a[v]--;
				else b[v]--;
				if(!a[v]||!b[v]){
					d[v]=1;
					q.push(v);
				}
			}
	}
	for(int i=0;i<n;i++)
		if(!d[i]){
			cout<<"Yes\n";
			return 0;
		}
	cout<<"No\n";
	
}




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

#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;


int main()
{
	string A;
	string B;
	cin>>A>>B;
	int lenA=A.length();
	int lenB=B.length();
	
	if(A==B){
			cout<<"EQUAL"<<endl;
			return 0;
		}
	
	if(lenA==lenB){
	
		REP(i,101){
		
			if(A[i]!=B[i]){
				if(A[i]>B[i]){
					cout<<"GREATER"<<endl;
					break;
				}else{
					cout<<"LESS"<<endl;
					break;
				}
			}	
		}
	}else{
		if(lenA>lenB){
			cout<<"GREATER"<<endl;
		}else{
			cout<<"LESS"<<endl;
		}
	}
}

Measured memory_bytes: 256
import math
def findAngle(h,m):
	hour=(h*360)/12+(m*360)/(12*60)
	mint=(m*360)/60
	angle=abs(hour-mint)
	if(angle>180):
		angle=360-angle
	return angle
def dist(a,b,h,m):
  x=a**2+b**2-2*a*b*math.cos(math.radians(findAngle(h,m)))
  return x**0.5
a,b,h,m=map(int,input().split())
print(dist(a,b,h,m))


Measured memory_bytes: 62652
S = input()
mid = list(S[2:-1])
try:
    mid.remove('C')
except:
    pass
mid = ''.join(mid)
three = S[1] + mid + S[-1]

if (S[0] == 'A') and (S[2:-1].count('C') == 1) and (three.islower()):
    print('AC')
else:
    print('WA')

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
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;}
typedef pair<ll,ll> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]
int main(){
    string s; cin >> s;
    int n=s.size();
    rep(i,n) cout << 'x';
}


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

int main() {
  const vector<vector<int>> groups = {
    {1, 3, 5, 7, 8, 10, 12},
    {4, 6, 9, 11},
    {2}};
  vector<int> xs(13);
  for (int i = 0; i < 2; ++i) {
    int x;
    cin >> x;
    ++xs[x];
  }
  for (const auto& group : groups) {
    int n_members = 0;
    for (const auto& x : group) {
      n_members += xs[x];
      if (n_members >= 2) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n;
ll a[4],b[4],c[4],d[4];
int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
    n=read();
    rep(i,1,3) a[i]=read();
    rep(i,1,3) b[i]=read();
    int i,j,k;ll ans=n;
    for (i=0;i*a[1]<=n;i++)
    {
        for (j=0;i*a[1]+j*a[2]<=n;j++)
        {
            int rest=n-i*a[1]-j*a[2];
            ll got=i*b[1]+j*b[2];
            ans=max(ans,rest+got);
            k=(n-i*a[1]-j*a[2])/a[3];
            rest=n-i*a[1]-j*a[2]-k*a[3];
            got=i*b[1]+j*b[2]+k*b[3];
            ans=max(ans,rest+got);
        }
    }
    //cout << ans << endl;
    if (n==ans)
    {
    for (i=0;i*b[1]<=n;i++)
    {
        for (j=0;i*b[1]+j*b[2]<=n;j++)
        {
            int rest=n-b[1]*i-b[2]*j;
            ll got=a[1]*i+a[2]*j;
            ans=max(ans,got+rest);
            k=(n-i*b[1]-j*b[2])/b[3];
            rest=n-b[1]*i-b[2]*j-b[3]*k;
            got=a[1]*i+a[2]*j+a[3]*k;
            ans=max(ans,got+rest);
        }
    }
    }
    else 
    {
        int cnt=0;
        rep(i,1,3) if (a[i]>b[i]) {d[++cnt]=a[i];c[cnt]=b[i];}
        if (!cnt) {printf("%lld",ans);return 0;}
        n=ans;
        //rep(i,1,cnt) cout << c[i] << " " << d[i] << endl;
        if (cnt==1)
        {
            ll now=n/c[1];
            ans=(n-now*c[1])+now*d[1];
        }
        else
        {
            int i,j;
            for (i=0;i*c[1]<=n;i++)
            {
                j=(n-c[1]*i)/c[2];
                ll rest=n-c[1]*i-c[2]*j;
                ll got=rest+d[1]*i+d[2]*j;
                ans=max(got,ans);
            }
        }
    }   
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 384
import sys
from collections import deque
sys.setrecursionlimit(10 ** 6)
def input():
    return sys.stdin.readline()[:-1]

def dfs(s):
    stack = [s]
    visited = [False]*N
    while stack:
        v = stack.pop()
        if visited[v]:
            continue
        visited[v] = True
        for u in graph[v]:
            if not visited[u]:
                point[u] += point[v]
                stack.append(u)

N, Q = list(map(int,input().split()))
graph = [deque([]) for _ in range(N)]
point = [0]*N

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

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

dfs(0)
print(*point)


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

template <class t>
using vc = vector<t>;
template <class t>
using vvc = vector<vector<t>>;
typedef long long ll;
typedef vc<int> vi;
typedef vvc<int> vvi;
typedef pair<int, int> pi;

#define endl "\n"

#define k first
#define v second
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()

#define ALL(a) a.bg, a.ed

template <class t, class u>
ostream &operator<<(ostream &os, const pair<t, u> &p) {
    return os << "( " << p.k << ", " << p.v << " )";
}

template <class t>
ostream &operator<<(ostream &os, const vc<t> &v) {
    os << "[ ";
    for (int i = 0; i < v.size(); i++) {
        os << v[i];
        if (i != v.size() - 1) {
            os << ", ";
        }
    }
    return os << " ]";
}

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout << fixed << setprecision(18);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution

    string s;
    cin >> s;
    string ref = "keyence";
    int si = 0;
    bool end = false;
    for (int i = 0; i < ref.size(); i++) {
        if (ref[i] == s[si]) {
            si++;
        } else {
            if (end) {
                cout << "NO\n";
                return 0;
            }
            end = true;
            i--;
            si = s.size() - ref.size() + i + 1;
        }
    }
    cout << "YES\n";
    // vector<vector<string>> meme;
    // for (int i = 1; i < ref.size(); i++) {
    //     auto left = ref.substr(0, i);
    //     auto right = ref.substr(i);
    //     meme.push_back({left, right});
    // }
    // if (s.find(ref) != string::npos) {
    //     cout << "YES\n";
    //     return 0;
    // }
    // for (auto &m : meme) {
    //     bool bad = false;
    //     for (int i = 0; i < m[0].size(); i++) {
    //         if (m[0][i] != s[i]) {
    //             bad = true;
    //             break;
    //         }
    //     }
    //     if (bad) {
    //         continue;
    //     }
    //     for (int i = m[1].size() - 1; 0 <= i; i--) {
    //         if (m[1][i] != s[i]) {
    //             bad = true;
    //             break;
    //         }
    //     }
    //     if (!bad) {
    //         cout << "YES\n";
    //         return 0;
    //     }
    // }
    // cout << "NO\n";
}


Measured memory_bytes: 384
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    h,w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    b = [list(map(int, input().split())) for _ in range(h)]
    c = [[0]*w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            c[i][j] = abs(a[i][j] -b[i][j])

    # 80*160//2 xbit目が1→数値x-6400を取る
    mid = 6400
    dp = [[0]*w for _ in range(h)]
    dp[0][0] = (1<<(mid+c[0][0])) | (1<<(mid-c[0][0]))
    for x in range(h):
        for y in range(w):
            for dx, dy in [[0, 1], [1, 0]]:
                nx = x + dx
                ny = y + dy
                if 0<=nx<h and 0<=ny<w:
                    dp[nx][ny] = dp[nx][ny] | (dp[x][y]<<c[nx][ny])
                    dp[nx][ny] = dp[nx][ny] | (dp[x][y]>>c[nx][ny])
    
    for i in range(mid+1):
        if dp[-1][-1] & 1:
            res = mid - i
        dp[-1][-1] >>= 1
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 15340
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let mut aa = get!(String).split_whitespace().map(|i| i.parse::<i32>().unwrap()).collect::<Vec<_>>();
    aa.sort();
    println!("{}", aa[0] + aa[1]);
}

Measured memory_bytes: 4352
#include<iostream>
int main()
{
	int n, m;
	std::cin >> n >> m;
	int**A = new int*[n];
	for(int i = 0; i < n; i++)
	{
		A[i] = new int[m];
	}
	int*b = new int[m];
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			std::cin >> A[i][j];
		}
	}
	for(int i = 0; i < m; i++)
	{
		std::cin >> b[i];
	}
	for(int i = 0; i < n; i++)
	{
		int product = 0;
		for(int j = 0; j < m; j++)
		{
			product += A[i][j] * b[j];
		}
		std::cout << product << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3116
var lines = []; var result = 0;
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
})

rl.on('close', function () {
    var N = n(lines[0], 0)
    var M = n(lines[0], 1)

    var A = lines[1].split(" ").map(value => Number(value));

    var sum = []; sum[0] = 0;
    
    // 累積和
    // Mで割った余りがが一致している部分集合は(区間は)Mで割り切れる
    for (var i = 0; i < N; i++) { sum[i + 1] = (sum[i] + A[i]) % M; }

    var ans = 0; counter = {}
    
    // 取りうる部分集合の組み合わせは，1+2+3...+nで表される
    for (var i = 0; i < sum.length; i++) {
        if (counter[sum[i]] === undefined) { counter[sum[i]] = 0 ;}
        
        ans += counter[sum[i]];
        counter[sum[i]]++;
    }

    console.log(ans);
});

function n(s, n) {
    return (Number(s.split(" ")[n]));
}

Measured memory_bytes: 37068
A, B, C, D, E, F = map( int, input().split() )

concent = 0
answeight = 100*A
anssugar = 0
for i in range( F//(100*A) + 1 ):
    for j in range( (F - 100*A*i)//B + 1 ):
        water = 100 * (A*i + B*j)
        maxsugar = min( E * (A*i + B*j), F - water )
        if 0 < water:
            for k in range( maxsugar//C + 1 ):
                sugar = C*k + D*((maxsugar - C*k)//D)
                if concent < sugar/(water + sugar):
                    concent = sugar/(water + sugar)
                    answeight = water + sugar
                    anssugar = sugar             

print( answeight, anssugar )

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);


int main(){

	IOS
	ll k,a,b;
	cin>>k>>a>>b;
	FOR(i,a,b){
		if(i%k==0){
			cout<<"OK"<<endl;
			return 0;
		}

	}
	cout<<"NG"<<endl;


}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        int[] w = new int[n];
        int s1 = in.ni(), s2 = 0;
        for (int i = 1; i < n; i++) {
            w[i] = in.ni();
            s2 += w[i];
        }
        int min = Math.abs(s1-s2);
        for (int i = 1; i < n; i++) {
            s1 += w[i];
            s2 -= w[i];
            min = Math.min(min, Math.abs(s1-s2));
        }
        out.println(min);
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;
using ll = long long int;

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};
const ll mod = 1e9+7;
using modint = ModInt< mod >;


int N;
string S;
void input(){
  #ifdef __LOCAL
      fs::path p = __FILE__;
      fs::path input,output;
      input = output = p.parent_path();
      input += string("/input/") + string(p.stem()) + string(".txt");
      output += string("/output/") + string(p.stem()) + string(".txt");
      freopen(input.c_str(), "r", stdin);
      freopen(output.c_str(), "w", stdout);
  #endif
  cin >> N >> S;
}

int solve(){
  vector<vector<modint> > dp(N+1);
  dp[0].resize(N);
  for (int i = 0; i < N; i++) dp[0][i] = 1;
  for (int i = 0; i < N-1; i++)
  {
    dp[i+1].resize(N-i);
    if(S[i]=='<'){
     // 累積和にする。
      // for (int j = 0; j < N-i; j++) dp[i+1][j] += (acc[i][j+1]);
      dp[i+1][0] += dp[i][0];
      for (int j = 1; j < N-i; j++) dp[i+1][j] += dp[i+1][j-1]+dp[i][j];
    }
    else{
      for (int j = N-i-1; j >= 1; j--) dp[i+1][j-1] += dp[i+1][j]+dp[i][j];
    }
  }
  
  cout << dp[N-1][0] << endl;

  return 0;
}

int main()
{
  input();
  solve();
  return 0;
}


Measured memory_bytes: 17920
<?php
$N = trim(fgets(STDIN));
$n = str_split($N);

if($n[0] == $n[1] && $n[1] == $n[2]){
    echo $N;
}else{
    if($N > ($n[0]*100 + $n[0]*10 + $n[0])){
        echo ($n[0]+1)*100 + ($n[0]+1)*10 + ($n[0]+1);
    }else{
        echo $n[0]*100 + $n[0]*10 + $n[0];
    }
}
?>

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

using namespace std;

const int N = 1e3 + 5;
vector<int> adj[N];
int vis[N] , n;

bool cycle(int node , int lim) {
    if (vis[node])
        return vis[node] == 1;

    if (!lim)
        return 0;

    vis[node] = 1;
    for (int c : adj[node])
        if (cycle(c , lim - 1))
            return 1;
    vis[node] = 2;

    return 0;
}

vector<int> sec;
void find_ans(int node , int lim) {
    if (vis[node] == 2)
        return;

    if (vis[node] == 1) {
        for (int c : sec)
            cout << c << '\n';
        exit(0);
    }

    if (!lim)
        return;

    sec.push_back(node);
    vis[node] = 1;

    for (int c : adj[node])
        find_ans(c , lim - 1);

    vis[node] = 2;
    sec.pop_back();
}

bool good(int lim) {
    for (int st = 1 ; st <= n ; st++) {
        memset(vis , 0 , sizeof vis);
        if (cycle(st , lim))
            return 1;
    }
    return 0;
}

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

    int m;
    cin >> n >> m;

    while (m--) {
        int u , v;
        cin >> u >> v;
        adj[u].push_back(v);
    }

    int l = 2 , r = n , ans = -1;
    while (l <= r) {
        int mid = (l + r) / 2;
        if (good(mid)) {
            ans = mid;
            r = mid - 1;
        } else {
            l = mid + 1;
        }
    }

    cout << ans;
    if (~ans) {
        cout << '\n';
        for (int st = 1 ; st <= n ; st++) {
            memset(vis , 0 , sizeof vis);
            if (cycle(st , ans)) {
                memset(vis , 0 , sizeof vis);
                find_ans(st , ans);
                return 0;
            }
        }
    }
}

Measured memory_bytes: 384
from sys import stdin
from itertools import permutations 


def get_time(nums):
    time = 0
    for i, n in enumerate(nums):
        time = time + n
        if i < len(nums) - 1 and time % 10 != 0:
            time = time + (10 - time % 10)
    return time


def solve(nums):
    min_time = 0
    for p in permutations(nums, len(nums)):
        t = get_time(p)
        if min_time > t or min_time == 0:
            min_time = t
    return min_time

def main():
    nums = [int(l) for l in stdin.readlines()]
    ans = solve(nums)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include<stdio.h>

#define MAX 10000
#define NIL -1

struct Node
{
	int p;
	int left;
	int right;
};

Node T[MAX];

// 先行順巡回（節点 -> 左部分木 -> 右部分木）
void preParse(int u)
{
	if (u == NIL) return;
	printf(" %d", u);
	preParse(T[u].left);
	preParse(T[u].right);
}

// 中間順巡回（左部分木-> 節点 -> 右部分木）
void inParse(int u)
{
	if (u == NIL) return;
	inParse(T[u].left);
	printf(" %d", u);
	inParse(T[u].right);
}

// 後行順巡回（左部分木 -> 右部分木-> 節点）
void postParse(int u)
{
	if (u == NIL) return;
	postParse(T[u].left);
	postParse(T[u].right);
	printf(" %d", u);
}

/*
(出力)
Preorder
 0 1 2 3 4 5 6 7 8
Inorder
 2 1 3 0 6 5 7 4 8
Postorder
 2 3 1 6 7 5 8 4 0
*/
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		T[i].p = NIL;
	}


	int p, l, r;
	for (int i = 0; i < n; i++)
	{
		scanf("%d%d%d", &p, &l, &r);
		T[p].left = l;
		T[p].right = r;
		if (l != NIL) T[l].p = p;
		if (r != NIL) T[r].p = p;
	}

	int root;
	for (int i = 0; i < n; i++)
	{
		if (T[i].p == NIL)
		{
			root = i;
			break;
		}
	}

	printf("Preorder\n");
	preParse(root);
	printf("\n");

	printf("Inorder\n");
	inParse(root);
	printf("\n");

	printf("Postorder\n");
	postParse(root);
	printf("\n");
}

/*
	  3
	／ ＼
   4     0		先行順 : 3 4 0 1 2
	   ／ ＼	中間順 : 4 3 1 0 2
	  1     2	後行順 : 4 1 2 0 3

				※重要なのは巡回先を部分木単位で捉えること
*/


Measured memory_bytes: 2728
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
/*  TLE
typedef struct{
    ll sum; ll a[30];
}DATA;

ll yesANAGRAM(DATA d, ll str[30]){
    rep(i, 26) if(str[i]!=d.a[i]) return 0;
    return 1;
}

int main(void){
    //your code here!
    DATA d[100100];
    ll ans=0, N, idx=0;
    char s[11];
    scanf("%lld", &N);
    rep(_, N){
        scanf("%s", s);
        ll noANA=1, str[30]={0};
        rep(i, 10) str[s[i]-'a']++;
        rep(i, idx){
            if(yesANAGRAM(d[i], str)){
                d[i].sum++;
                noANA=0;
                break;
            }
        }
        if(noANA){
            rep(i, 26) d[idx].a[i] = str[i];
            d[idx].sum = 1;
            idx++;
        }
    }
    rep(i, idx) if(d[i].sum > 1) ans += d[i].sum*(d[i].sum -1)/2;
    printf("%lld\n", ans);
    return 0;
}
*/
int cmpchar(const void *a, const void *b){
    return *(char *)a - *(char *)b;      //文字順ソートa,b,....z
}
int cmps(const void* a, const void* b){
	return strcmp((char*)a, (char*)b);   //辞書順ソートa,b,....z
}

int main(void){
    ll N, ans=0, sum=0;
    char S[100100][11];
    scanf("%lld", &N);
    rep(i, N){
        scanf("%s", S+i);
        qsort(S[i], 10, sizeof(S[i][0]), cmpchar);
    }
    qsort(S, N, sizeof(S[0]), cmps);
    rep(i, N-1){
        if(strcmp(S[i], S[i+1])==0) sum++;
        else if(sum){
            ans += sum*(sum+1)/2;
            sum=0;
        }
    }
    printf("%lld\n", ans+sum*(sum+1)/2);
    return 0;
}


Measured memory_bytes: 2300
#include<iostream>
#include<cstdint>
#include<algorithm>
using namespace std; // 575

const int MAX = 100000;
int main() {
	int N, A, B;
	static int p[MAX];
	int64_t ans = 0;
	cin >> N;
	for (int i = 0;i < N;++ i) {
		cin >> A >> B;
		p[i] = -(A + B);
		ans -= B;
	}
	sort(p, p+N);
	for (int i = 0;i < N;i += 2) ans -= p[i];
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

*/

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  string s;
  cin >> s;
  ll cnt = 0;
  string t = "keyence";
  for (int i = 0; i < 7; ++i) {
    if (s[i] == t[i]) {
      cnt++;
    } else {
      break;
    }
  }

  int j = 6;
  for (int i = s.size() - 1; i >= s.size() - 8; --i) {
    if (s[i] == t[j]) {
      j--;
      cnt++;
    } else {
      break;
    }
  }

  if (cnt >= 7) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


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

# 大きく求めて引く
ans = S.count("R") * S.count("G") * S.count("B")

for i in range(N-2):
    for j in range(i+1, (N+i-1)//2+1):
        if set([S[i], S[j], S[2*j-i]]) == {"R", "G", "B"}:
            ans -= 1

print(ans)


Measured memory_bytes: 9080
#include <iostream>
using namespace std;
int main (int argc, const char * argv[])
{
    int a,b;
    cin >>a>>b;
    if(a<b){
        cout <<"a < b"<<endl;
    }else if (a>b){
        cout<<"a > b"<<endl;
    }else{
        cout<<"a == b"<<endl;
    }
    // insert code here...
    //cout << "Hello, World!\n";
    return 0;
}

Measured memory_bytes: 1156
n,m = map(int,input().split())
pS = [list(input().split()) for i in range(m)]

for _ in range(m) :
    pS[_][0] = int(pS[_][0])

ac = [0]*n
wa = [0]*n

for i in range(m) :
    if pS[i][1] == "AC" :
        if ac[pS[i][0]-1] == 0 :
            ac[pS[i][0]-1] += 1
    elif pS[i][1] == "WA" :
        if ac[pS[i][0]-1] == 0 :
            wa[pS[i][0] - 1] += 1

awa=0
for i in range(n) :
    if ac[i] == 1 :
        awa += wa[i]

print(sum(ac),awa)


Measured memory_bytes: 34980
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <set>
#include <map>
using namespace std;
int d[4][2] = {{1,0},{0,-1},{-1,0},{0,1}};
int n;
int m;
int w;
int sx,sy;
int Map[1550][1550];
bool isPrime[1000001];
int Log[1550][1550];

void sieve(int M){
	for(int i=2;i<M;i++) isPrime[i] = true;
	for(int i=2;i*i<M;i++){
		if(!isPrime[i]) continue;
		for(int j=i*i;j<M;j+=i) isPrime[j] = false;
	}
}

void setMap(){
	int i,j;
	memset(Map, 0, sizeof(Map));
	memset(Log, 0, sizeof(Log));
	for(w=0;w*w<m;w++);
	int px=w/2+2,py=w/2+2;
	int dn = 1, dt=0;
	Map[px][py] = 0;
	Log[px][py] = 1;
	if(n==1){
		sx = px;
		sy = py;
	}
	for(i=1;i<m;){
		for(int j=0;j<dn;j++){
			px = px + d[dt][0];
			py = py + d[dt][1];
			Map[px][py] = isPrime[++i];
			Log[px][py] = i;
			if(i==n){sx=px;sy=py;}
			if(i==m){return;}
		} dt=(dt+1)%4;
		for(int j=0;j<dn;j++){
			px = px + d[dt][0];
			py = py + d[dt][1];
			Map[px][py] = isPrime[++i];
			Log[px][py] = i;
			if(i==n){sx=px;sy=py;}
			if(i==m){return;}
		} dt=(dt+1)%4;
		dn ++;
	}
}

void get(){
	int i,j;	
	for(i=w+4;i;i--)
		for(j=w+4;j;j--){
			int tox, toy = i+1;
			pair<int, int> a,b,c;
			a.first  = Map[j+1][i+1];
			a.second = Log[j+1][i+1];
			b.first  = Map[j][i+1];
			b.second = Log[j][i+1];
			c.first  = Map[j-1][i+1];
			c.second = Log[j-1][i+1];

			if(a > b && a > c){
				tox = j+1;
			}else if(b > c){
				tox = j;
			}else{
				tox = j-1;
			}
			Map[j][i] += Map[tox][toy];
			if(Log[tox][toy]) Log[j][i] = Log[tox][toy];
			if(!Map[j][i]) Log[j][i] = 0;
		//	if(i==sy && j==sx) return Map[j][i];
		}
}

main(){
	int i,j;
	sieve(1000000);
	while(cin >> m >> n, m||n){
		setMap();
		int ans=0;
	/*	for(i=0;i<=w+1;i++){
			for(j=0;j<=w+1;j++){
				printf("%2d ", Log[j][i]);
			}
			printf("\n");
		}
	*///	cout << sx << " " << sy << endl;
		get();
		cout << Map[sx][sy] << " " << Log[sx][sy] << endl;
	/*	for(i=0;i<=w+1;i++){
			for(j=0;j<=w+1;j++){
				printf("%4d ", Log[j][i]);
			}
			printf("\n");
		}
		for(i=0;i<=w+1;i++){
			for(j=0;j<=w+1;j++){
				printf("%4d ", Map[j][i]);
			}
			printf("\n");
		}
*/	}
	return 0;
}

Measured memory_bytes: 20912
#include<bits/stdc++.h>							
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;



vector<bool> mark(100005, 0);
int wa[100005];
void solve() {
	int n, k;
	cin >> n >> k;
	map<string,ll> m;
	m["AC"] = 0;
	int ac_cnt = 0, wa_cnt = 0;
	m["WA"] = 0;
	int t = 0;
	for(int i = 0; i < k; ++i) {
		int x;
		string s;
		cin >> x >> s;	
		if(mark[x]) continue;
		if(s == "AC") {
			mark[x] = 1;
			ac_cnt++;
			wa_cnt += wa[x];
			}
			else wa[x]++;
		}
		cout << ac_cnt <<" "<< wa_cnt << endl;
		cout << endl;
}


int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	solve();
	return 0;
}
 
 
 



Measured memory_bytes: 4016
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

d = make_divisors(N)
# print(d)

Ans_min = 1+N-2

for x in d:
  y = N/x
  Ans = x+y-2
  if Ans < Ans_min:
    Ans_min = Ans
    
print(int(Ans_min))


Measured memory_bytes: 3268
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;

    int open = 0;
    int close = 0;

    for (int i = 0; i < N; i++) {
        if (S[i] == '(') {
            open++;
        } else {
            if (open > 0) {
                open--;
            } else {
                close++;
            }
        }
    }
    for (int i = 0; i < close; i++) {
        cout << "(";
    }
    cout << S;
    for (int i = 0; i < open; i++) {
        cout << ")";
    }
    cout << endl;

    return 0;
}


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

ans = 0
for ai in a:
    cnt = sum(aij * bi for aij, bi in zip(ai, b))
    ans += (cnt > -c)
print(ans)


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

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

	int n;
	cin >> n;

	int answer = 0;

	for (int i=0; i<n; i++) {
		string Ring;
		cin >> Ring;
		Ring = Ring + Ring;

		for (int j=0; j<10; j++) {
			int l=0;

			for (int k=0; k<m.size(); k++) {
				if (m[k] == Ring[k+j]) {
					l++;
				}

			}
			if (l == m.size()) {
				answer++;
				break;
			}
		
		}

	}

	cout << answer << endl;

	return 0;
}



Measured memory_bytes: 3148
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<limits>
#include<vector>
using namespace std;
const int Max_INF=numeric_limits<int>::max();
int n,q;
vector<int> range_min;

int Min(int a,int b)
{
    return a<b?a:b;
}

int find_min(int left,int right,int node,int nodeleft,int noderight)
{
    if(right < nodeleft ||left > noderight)
      return Max_INF;
    if(right >= noderight && left <= nodeleft)
      return range_min[node];
    int mid=(nodeleft+noderight)/2;
    int minleft=find_min(left,right,node*2,nodeleft,mid);
    int minright=find_min(left,right,node*2+1,mid+1,noderight);
    return Min(minleft,minright);
}

int find_min(int x,int y)
{
    return find_min(x,y,1,0,n-1);
}

int update(int position,int new_value,int node,int nodeleft,int noderight)
{
    if(nodeleft > position || noderight < position) return range_min[node];
    if(nodeleft == noderight) return range_min[node]=new_value;
    int mid=(nodeleft+noderight)/2;
    int minleft=update(position,new_value,node*2,nodeleft,mid);
    int minright=update(position,new_value,node*2+1,mid+1,noderight);
    return range_min[node]=Min(minleft,minright);
}

int update(int x,int y)
{
    return update(x,y,1,0,n-1);
}

int main()
{
    // freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
    scanf("%d%d",&n,&q);
    range_min.resize(4*n,Max_INF);
    while(q--)
    {
        int command,x,y;
        scanf("%d%d%d",&command,&x,&y);
        if(command == 0) update(x,y);
        if(command == 1) printf("%d\n",find_min(x,y));
    }
    return 0;
}

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

int main()
{
    int n;
    int an;
    long long sum = 0;
    int max_n = -1000001;
    int min_n = 1000000;
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> an;
        max_n = max(max_n,an);
        min_n = min(min_n,an);
        sum+=an;

    }
    cout << min_n << " " << max_n << " " << sum << endl;
    return 0;
}

Measured memory_bytes: 1168
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

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


int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  cout << min(c, b / a) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 100000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
using namespace std;

struct Node {
public:
	int myindex;
	int parent = -1;
	int forbid = -1;
	int degree;
	vector<pair<int, int>> to_child; // first is the index of child node second is i-th node; add_by pushback
};

int main() {
	int N; cin >> N;
	vector<Node> nodes(N);
	for (int i = 0; i < N-1; i++) {
		int a, b; cin >> a >> b;
		a--; b--;
		nodes[a].degree++;
		nodes[a].to_child.push_back({ b,i });
		nodes[b].degree++;
		nodes[b].to_child.push_back({ a,i });
	}
	int Maxdeg = 0,indexdeg = 0;
	for (int j = 0; j < N; j++) {
		nodes[j].degree > Maxdeg ? Maxdeg = nodes[j].degree, indexdeg = j : 1;
		nodes[j].myindex = j;
	}
	
	//
	nodes[indexdeg].parent = indexdeg;
	vector<int> Ans(N - 1, -1);
	stack<Node> st;
	st.push(nodes[indexdeg]);

	while (!st.empty()) {

		Node u = st.top(); st.pop(); // u is parent node
		int color = 0;
		for (int t = 0; t < u.to_child.size(); t++) {
			int child_index = u.to_child[t].first;
			if (child_index != u.parent) {
				// paint the edge from u to child
				if (color== u.forbid) {
					// if color is forbid +1
					color++;
					Ans[u.to_child[t].second] = color;
					// process child
					nodes[child_index].parent = u.myindex;
					nodes[child_index].forbid = color;
					color++;
				}
				else {
					Ans[u.to_child[t].second] = color;
					nodes[child_index].parent = u.myindex;
					nodes[child_index].forbid = color;
					color++;
				}
				//and enqueue
				st.push(nodes[child_index]);
			}
		}

	}
	cout << Maxdeg << endl;

	for (int elem : Ans) {
		cout << elem +1 << endl;
	}
}

Measured memory_bytes: 8800
n,d=map(int,input().split())
L=[]
ans=0
for _ in range(n):L.append(list(map(int,input().split())))
for i in range(n):
    for j in range(n):
        if i==j:pass
        else:
            p=0
            for k in range(d):p+=(L[i][k]-L[j][k])**2
            if p**0.5==int(p**0.5):ans+=1
print(ans//2)

Measured memory_bytes: 3188
n = int(input())
L = tuple(map(int, input().split()))
L = sorted(L)

counts = 0
for i in range(n-2):
    a = L[i]
    ci = i+2
    for bi in range(i+1, n-1):
        while ci < n and L[ci] <  a + L[bi]:
            ci += 1
        counts += ci - 1 - bi
print(counts)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 ll n ;
 vector<ll> A(n) ;
 bool flag[405][405] ;
 ll   dp[405][405] ;

 ll f(ll a, ll b ){
  if(flag[a][b]) return dp[a][b] ;
  else{
     if(a==b){
       flag[a][b]=0 ;
       dp[a][b]= 0 ;
       return 0 ;
     }
     else if(a==b-1){
      flag[a][b]=1 ;
      dp[a][b]=A[a]+A[b] ;
      return A[a]+A[b] ;
    }
  else{
    ll ans= INF ;
    rep2(i,a,b-1){
     chmin(ans, f(a,i)+f(i+1,b)) ;
    }
    rep2(i,a,b) ans+= A[i] ;
    flag[a][b]=1 ;
  dp[a][b]=ans ;
    return ans ;
  }
  
  }
}

 int main(){
   cin>> n ;
  A.assign(n,0) ;
  rep(i,n){
   cin>>A[i] ;
  }
   rep(i,405){
    rep(j,405){
      flag[i][j]=0 ;
      dp[i][j]=0 ;
    }
  }
  
   cout<< f(0,n-1)<<endl ; 

   return 0 ;
 }



Measured memory_bytes: 5000
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#include <cstring>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long lolong;

inline int input() { int x; scanf("%d", &x); return x; }

const int maxn = 105;
char s[maxn];

int main() {
	scanf("%s", s + 1);
	int n = int(strlen(s + 1));
	int k = input();

	if(s[1] != s[n]) {
		int l = 0;
		lolong ans = 0;
		for(int i = 1; i <= n; i ++) {
			if(s[i] != s[i - 1]) {
				ans += l >> 1;
				l = 0;
			}
			l ++;
		}
		ans += l >> 1;
		printf("%lld\n", ans * k);
	}

	else {
		int a = 0;
		int l = 0;
		lolong ans = 0;
		for(int i = 1; i <= n; i ++) {
			if(s[i] != s[i - 1]) {
				if(!a) a = l;
				else ans += l >> 1;
				l = 0;
			}
			l ++;
		}

		if(a) {
			ans += (a + l) >> 1;
			printf("%lld\n", ans * k - ((a + l) >> 1) + (a >> 1) + (l >> 1));
		}

		else {
			printf("%lld\n", 1ll * k * l >> 1);
		}
	}
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD1			998244353
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//find_by_order kth largest  order_of_key <
const int tam = 100010;
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n, m, a, b;
	cin>>n>>m>>a>>b;
	if(a <= m / 2 && b <= n / 2)
	{
		fore(i, 0, b)
		{
			fore(i, 0, m)
			{
				if(i < a) cout<<1;
				else cout<<0; 
			}
			cout<<'\n';

		}
		fore(i, b, n)
		{
			fore(i, 0, m)
			{
				if(i < a) cout<<0;
				else cout<<1; 
			}
			cout<<'\n';

		}
	}
	else
		cout<<"-1\n";
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline void fastio () {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
}

#define whats(x) cerr << #x << " = " << (x) << "\n"; 

using LL = long long;
using LD = long double;

const LL INF = LLONG_MAX;
const LL MOD = static_cast<LL>(1e9+7);
const LL N = 1e6+1;

int main() {
	fastio();

	LL n;
	cin >> n;

	vector<LL> a(n);

	static LL mp[N] = {0};

	for (auto &e : a) {
		cin >> e;
		mp[e]++;
	}

	bool dp[N];
	for (LL i = 0; i < N; ++i) {
		dp[i] = true;
	}

	sort(a.begin(), a.end());

	for (LL i = 0; i < N; ++i) {
		if (mp[i] && dp[i]) {
			for (LL j = 2*i; j < N; j += i) {
				dp[j] = false;
			}
		}
	}

	LL ans = 0;

	for (LL i = 0; i < n; ++i) {
		if (mp[a[i]] == 1 && dp[a[i]]) {
			ans++;
		}
	}
	cout << ans << "\n";


}

Measured memory_bytes: 13396