akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
map<int,int>mp,mp2;
string s;
vector<pair<int,int> >v[20];
vector<int>v1;
int main()
{
        IO;
        int i, j, n, m, k=0, l=0, r,t=1, q,sum,mod, l1,mn1,mn2,cnt2,mx=0;
        cin>>n;
        for(i=1; i<=n; i++){
            cin>>k;
            while(k--){
                cin>>j>>l; v[i].push_back({j,l});
            }
        }
        for(i=1; i<=n; i++) t*=2;
        //cout<<t;
        for(i=0; i<t; i++){
            k=0; l=i; int key=1;
            while(l!=0){
                r=l%2; l/=2; k++;
                if(r==1)
                   mp[k]=1;
            }
            k=0; l=i;
            while(l!=0){
                r=l%2; l/=2; k++;
                if(r==1){
                    l1=v[k].size();
                    for(int ii=0; ii<l1; ii++){
                        int k1, k2;
                        k1=v[k][ii].first; k2=v[k][ii].second;
                        if((mp[k1]+k2)==1) { key=0; break; }
                    }
                }
                if(key==0) break;
            }
            if(key==1)  mx=max(mx,__builtin_popcount(i));
            mp.clear();
        }
        cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as B
import Control.Monad
import Data.List
import qualified Data.Vector as V

t2 [a,b]=(a-1,b-1)
main=do
    [n,m] <- map read.words<$>getLine
    xys <- V.replicateM m $ t2.unfoldr (B.readInt.B.dropWhile(<'!'))<$>B.getLine
    print $ g n xys

g n xys = V.maximum v where
    ve = V.accumulate (flip (:)) (V.replicate n []) xys
    v = V.generate n m
    m i = (+1) $ maximum $ ((-1):) $ map (v V.!) (ve V.! i) 

Measured memory_bytes: 49788
import java.util.Scanner;

public class Main {
	
	private static int a[];
	private static int N = 10;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner( System.in );
		
		a = new int[N];
		
		//入力
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}
		
		//最大値選択法
		for (int i = 0; i < N; i++) {
			int max = i;
			for (int j = i+1; j < N; j++) {
				if(a[j] > a[max]) {
					max = j;
				}
			}
			int t = a[i];
			a[i] = a[max];
			a[max] = t;
		}
		
		//出力
		for (int i = 0; i < 3; i++) {
			System.out.println(a[i]);
		}
	}
}

Measured memory_bytes: 17164
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define upperlimit 1000100
#define INF 1000000100
#define INFL 1000000000000000100
#define eps 1e-8
#define endl '\n'
#define sd(n) scanf("%d",&n)
#define slld(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define plld(n) printf("%lld",n)
#define pds(n) printf("%d ",n)
#define pllds(n) printf("%lld ",n)
#define pdn(n) printf("%d\n",n)
#define plldn(n) printf("%lld\n",n)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define mp make_pair
#define pb push_back
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define F first
#define S second
#define clr(a) memset(a,0,sizeof(a))
using namespace std;
 
ll gcd(ll n1,ll n2){
    if(!n1)return n2;
    if(!n2)return n1;
    if(n1%n2==0)return n2;
    return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent){
    base%=mod;
    ll ans=1;
    while(exponent){
        if(exponent&1)ans=(ans*base)%mod;
        base=(base*base)%mod;
        exponent/=2;
    }
    ans%=mod;
    return ans;
}
int main()
{
    string s;
    int r=0;
    cin>>s;
    
    if(s=="111")r=3;
    if(s=="110" || s=="101" || s=="011")r=2;
    if(s=="001" || s=="010" || s=="100")r=1;
    
    
    cout<<r<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  ll m;cin>>m;
  ll num=n*2+m;
  cout<<min(m/2,num/4)<<endl;

  return 0;

}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

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

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;

fn main() {
    let mut s:String = read();
    let t:String = read();

    for i in 0..s.len() {
        let s2 = format!("{}{}", &s[s.len()-1..s.len()], &s[0..s.len()-1]);
        //debug!(s2);
        if s2 == t {
            println!("Yes");
            return ();
        }
        s = s2;
    }
    println!("No");

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int n,ans=0,res[100004];
vector<int>g[100004];
vector<int>w[100004];
void dfs(int x,int par,int nos){
	int cnt=0;
	for (int i=0;i<g[x].size();i++) if (g[x][i]!=par){
		cnt++;
		if (cnt==nos) cnt++;
		res[w[x][i]]=cnt;
		dfs(g[x][i],x,cnt);
	}
}
int main(){
	cin>>n;
	for (int i=0;i<n-1;i++){
		int x,y;cin>>x>>y;
		g[x].push_back(y);g[y].push_back(x);
		w[x].push_back(i),w[y].push_back(i);
	}
	for (int i=1;i<=n;i++) ans=max(ans,(int)g[i].size());
	cout<<ans<<"\n";
	dfs(1,-1,-1);
	for (int i=0;i<n-1;i++) cout<<res[i]<<"\n";
}

Measured memory_bytes: 13440
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;

/*
ll f(ll n){
    if(n<2){
        return 1;
    }else{
        return n*(f(n-1));
    }
}
*/


int main(){
    ll n;
    cin >> n;
    if(n%2==1){
        cout<<0<<endl;
        return 0;
    }
    ll ans=0;
    ans+=n/10;
    ll p=10;
    while(n/p>0){
        p*=5;
        ans+=n/p;
    }
    
    cout<<ans<<endl;
    return 0;
}



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

int main() {
  int N;
  cin >> N;
  vector<tuple<string, int, int>> p(N);
  
  for(int i = 0; i < N ; i++){
    string a;
    int b;
    cin >> a >> b;
    int c = i+1;
    p.at(i) = make_tuple(a, b*(-1), c);
  }

  sort(p.begin(), p.end());
    
  for(int i = 0; i < N ; i++){
    string a;
    int b;
    int c;
    tie(a, b, c) = p.at(i);
    cout << c << endl;
  }
}

Measured memory_bytes: 256
for c in range(input()):
  n = input()
  A = [list(' '*n) for _ in [0]*n]
  for i in range((n+3)/4):
    i2 = i*2
    if i2>0: A[n-i2][i2]='#'
    for j in range(i2, n-i2):
      A[j][i2]='#'
      A[i2][j]='#'
      if j<n-i2-1: A[j][n-i2-1]='#'
      if j>i2+1: A[n-i2-1][j]='#'
  if c: print
  for e in A: print "".join(e)

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

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;

    bool can = true;
    for (size_t i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a%2 == 0) {
            if (a%3 != 0 && a%5 != 0) {
                can = false;
            }
        }
    }

    if (can) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
    return 0;
}


Measured memory_bytes: 3608
from sys import stdin
inp = lambda : stdin.readline().strip()

n = int(inp())
mod = 10**9 + 7
a =[int(x) for x in inp().split()]
s = [a[0]]
for i in range(1,n):
    s.append(s[i-1]+a[i])
ans = 0
for i in range(n):
    ans +=  ((a[i]%mod) * (s[-1] - s[i])%mod)%mod
    ans %= mod
print(ans)

Measured memory_bytes: 107184
#include <iostream>

using namespace std;
const int MAX_N = 13;
const char* const LANK = "SHCD";

int main() {
  int n, a, inx;
  char b;

  bool cards[4][MAX_N];
  for (int i = 0; i < 4; ++i)
    {
      for (int j = 0; j < MAX_N; ++j)
        {
          cards[i][j] = true;
        }
    }

  cin >> n;
  for (int i = 0; i < n; ++i)
    {
      cin >> b >>a;
      if (b=='S') inx = 0;
      else if (b=='H') inx =1;
      else if (b=='C') inx =2;
      else if (b=='D') inx =3;
      cards[inx][a-1] = false;
    }

  for (int i = 0; i < 4; ++i)
    {
      for (int j = 0; j < MAX_N; ++j)
        {
          if(cards[i][j]==true)
            cout << LANK[i] << " " << j+1 << endl;
        }
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
       int n;
       cin>>n;
       if(n%10==0 || n%10==6 || n%10==1 || n%10==8) cout<<"pon"<<endl;
       else if(n%10==2 || n%10==4 || n%10 ==5 || n%10==7 || n%10==9) cout<<"hon"<<endl;
       else if(n%10==3) cout<<"bon"<<endl;
}

Measured memory_bytes: 3604
import math,cmath
e=1e-6
j=1j
def f(m):
  c=j*math.acos(a/2)
  p1=cmath.exp(b+c)+p0
  p2=cmath.exp(b-c)+p0
  s1,s2=2,2
  for k in N:
    if k==i or k==i1:continue
    if abs(X[k]-p1)<1+e:s1+=1
    if abs(X[k]-p2)<1+e:s2+=1
  return max(m,s1,s2)

while 1:
  n=input()
  if n==0:break
  N=range(n)
  X=[]
  for i in N:
    x,y=map(float,input())
    X+=[x+j*y]
  m=1
  for i in N:
    p0=X[i]
    for i1 in range(i+1,n):
      p=X[i1]-p0
      a,b=cmath.polar(p)
      b*=j
      if a<=2:m=f(m)
  print m

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


int main(){
  int N,X;
  cin >>N>>X;
  vector<int>L(N);
  for(int i=0;i<N;i++){
    cin >>L.at(i);
  }
  int ans=1;
  int x=0;
  for(int i=0;i<N;i++){
    x+=L.at(i);
    if(x<=X){
      ans++;
    }
  }
  cout<< ans << endl;
}
      


Measured memory_bytes: 256
import java.util.*

fun main(vararg args: String) {
    val scanner = Scanner(System.`in`)
    val a = scanner.nextInt()
    val b = scanner.nextInt()
    val diff = Math.abs(a - b)
    if (diff % 2 == 1) {
        println("IMPOSSIBLE")
        return
    }
    val k = Math.min(a, b) + diff / 2
    println(k)
}


Measured memory_bytes: 31276
import sys
input = sys.stdin.readline
from itertools import combinations
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(m)]
g2d = [[1 for i in range(n+1)] for j in range(n+1)]
for i in range(1,n+1):
  g2d[i][i] = 0
for a,b in ab:
  g2d[a][b] = 0
  g2d[b][a] = 0
graph = [[] for i in range(n+1)]
for i in range(1,n+1):
  for j in range(1,n+1):
    if g2d[i][j]:
      graph[i].append(j)
      graph[j].append(i)
vis = [-1]*(n+1)
oddeven = []
for i in range(1,n+1):
  if vis[i] == -1:
    stack = [i]
    vis[i] = 0
    odd = 0
    even = 1
    while stack:
      x = stack.pop()
      for y in graph[x]:
        if vis[y] == -1:
          vis[y] = vis[x]+1
          if vis[y]%2:
            odd += 1
          else:
            even += 1
          stack.append(y)
        elif (vis[y]-vis[x])%2 == 0:
          print(-1)
          exit()
    oddeven.append(abs(odd-even))
t = len(oddeven)
s = sum(oddeven)
dp = 1<<s
for x in oddeven:
  dp = (dp<<abs(x)) | (dp>>abs(x))
for i in range(s+1):
  if (dp&1<<(s-i))|(dp&1<<(s+i)):
    ex = i
    break
A,B = (n+ex)//2,(n-ex)//2
print(A*(A-1)//2+B*(B-1)//2)

Measured memory_bytes: 86492
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#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())
#define PB push_back
#define MP make_pair
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() {
  int N;
  scanf("%d", &N);
  ll a[N],b[N];
  for (int i = 0; i < N; ++i) {
    scanf("%lld%lld", &a[i],&b[i]);
  }

  FOR(i,0,N-2){
    if(a[i+1]<a[i] || b[i+1]<b[i]){
        ll ref = max(ceil((long double)a[i]/(long double)a[i+1]),ceil((long double)b[i]/(long double)b[i+1]));
        a[i+1] *= ref;
        b[i+1] *= ref;
        // cout << ref << endl;
      }
    }
    // cout << a[i+1] << " " << b[i+1] << endl;

  cout << a[N-1]+b[N-1] << endl;

}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,cnt=0;
    map<int ,int> M;
    cin >> n;
    for(int i=0;i<n;i++){
        int x; cin >> x;
        M[x]++;
    }
    for(auto itr = M.begin();itr!=M.end();itr++) if(itr->second % 2 == 1) cnt++;
    cout<<cnt;
}


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

const int M = 1000000001;

int main()
{
    int n, s;
    int Min = M, Max = -M, ans = -M;
    cin >> n;
    cin >> s;
    Min = s;
    for(int i=1; i<n; i++)
    {
        cin >> s;
        ans = s - Min;
        if(ans > Max)
            Max = ans;
        if(s<Min)
            Min = s;
    }
    cout << Max << endl;
    return 0;
}



Measured memory_bytes: 3124
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
S = input().rstrip()

ans = 0
for i in range(1,N):
    l,r = set(),set()
    for s in S[:i]:
        l.add(s)
    for s in S[i:]:
        r.add(s)
    ans = max(ans,len(l&r))

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <algorithm>
using namespace std;
const int N=1e3+10;
int main(){
    int n,a[N],temp,cnt;
    double ans=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    sort(a,a+n);
    for(int i=0;i<n;i++)for(int j=i+1;j<n;j++){
        temp=cnt=0;
        for(int k=n-1;k>=0;k--){
            if(k!=i&&k!=j){
                cnt++;
                temp+=a[k];
            }
            if(cnt>=2)break;
        }
        ans=max(ans,(double)temp/(a[j]-a[i]));
    }
    printf("%lf\n",ans);
}


Measured memory_bytes: 2808
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>  // sort, 二分探索, etc
#include <iomanip>  // setprecision (浮動小数点の出力の誤差)
#include <map>
#include <queue>
#include <set>
#include <stack>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a,i##_len=(b);i<i##_len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define cauto const auto&
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

using namespace std;
using ui = unsigned int;
using ll = long long;
using ull = unsigned long long;

template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return true;}return false;}

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll comb(int n, int r) {
    vector<vector<ll> > v(n+1, vector<ll>(r+1, 0));
    for(int i=0;i<n+1;i++) {v[i][0]=1; if(i < r+1)v[i][i]=1; }
    for(int i=1;i<n+1;i++) {for(int j=1;j<min(i,r+1);j++) {v[i][j]=v[i-1][j-1]+v[i-1][j];}}
    return v[n][r];
}

// CHAR_MAX  = 127
// INT_MAX   = 2.1e+09 (2147483647)
// LONG_MAX  = 9.2e+18 (9223372036854775807)
// LLONG_MAX = 9.2e+18 (9223372036854775807)


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

    ll total = 0;
    rep(i, 1, n+1) {
        if (i % 3 == 0) {
            continue;
        }
        if (i % 5 == 0) {
            continue;
        }
        total += i;
    }

    cout << total << endl;
    return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;


int main()
{
    int N,K;
    cin >> N >> K;
    int prices [N];
    for (int i=0; i<N; i++){
        cin >> prices[i];
    }
    sort(prices, prices+N);
    int sum = 0;
    for (int j=0; j<K; j++){
        sum += prices[j];
    }
    cout << sum;
}



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

using namespace std;

#define ll long long
#define ull unsigned long long
#define PI acos(-1.0)
#define eps 1e-12
#define fi first
#define se second
#define pb push_back
#define MEM(a,b) memset((a),(b),sizeof(a))
#define mod(x) ((x)%MOD)
#define pii pair<int,int>
#define wz cout<<"-----"<<endl;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;

const ll maxn = 1e5 + 10, MOD = 1e9 + 7;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
const int Move_[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};

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


void init() {

}

map<int,int> m;

int main(){
//    freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);
//    freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout);
//    ios_base::sync_with_stdio(0);
    init();
    int n; cin >>n;
    for (int i = 0; i <n; i++) {
        int x; cin >>x;m[x]++;
    }
    int  cnt = 0;
    for (auto it : m) {
        if (it.se & 1) cnt++;
    }
    cout <<cnt <<endl;
    return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;
#define mod 1000000007
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() {
  int N; cin >> N;
  vector<int> d(N);
  rep(i, 0, N) cin >> d[i];
  sort(d.begin(), d.end());
  int ans = N;
  rep(i, 1, N) if(d[i] == d[i - 1]) ans--;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
  int i,l,c,n;
  char s[50000],t[50000];
  while(1){
    scanf("%d",&n);
    if(!n)
      break;
    scanf("%s",s);
    while(n--){
      l=i=0;
      while(s[i]){
	c=1;
	while(s[i]==s[i+1]){
	  c++;
	  i++;
	}
	sprintf(t+l,"%d%c",c,s[i++]);
	l=strlen(t);
      }
      sprintf(s,"%s",t);
      memset(t,0,sizeof(t));
    }
    printf("%s\n",s);
  }
  return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  int ans = 0;
  ans += n*(n-1)/2;
  ans += m*(m-1)/2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import math
a,b,x=[int(_) for _ in input().split()]
if x/a > a*b/2:
    s=a*b-x/a
    e=2*s/a
    print(math.degrees(math.atan(e/a)))
else:
    s=x/a
    e=2*s/b
    print(math.degrees(math.atan(b/e)))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N, L;
    cin >> N >> L;
    // 全てのリンゴを使った時の味の合計
    int sum = 0;
    for (int i =1; i <= N; i ++) {
        sum += (L + i - 1);  
    }
    // 食べたりんごのindexと、その合計値
    int min_rest = 99999999;
    int apple_index, tmp_sum = 0;
    int tmp = 0;
    // i番目のリンゴを食べた時
    for (int i =1; i <= N; i++) {

        for (int j = 1; j<= N; j ++) {
            if (i == j) {
                continue;
            }
            tmp += (L + j - 1);  
        }
        int rest = abs(sum - tmp);
        if (rest <= min_rest) {
            min_rest = rest;
            apple_index = i;
            tmp_sum = tmp;
        }
        tmp = 0;
    }
    cout << tmp_sum << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	int N, M;
	while (cin >> N, N) {
		vector<vector<int>> masu(21, vector<int>(21, 0));
		for (int i = 0; i < N;i++) {
			int x, y; cin >> x >> y;
			masu[x][y] = 1;
		}
		cin >> M;
		pair<int, int> now = { 10,10 };
		for (int i = 0; i < M;i++) {
			char d; int l; cin >> d >> l;
			int& X = now.first, &Y = now.second;
			if (d == 'N') {
				for (int j = 1; j <= l;j++) {
					if (masu[X][Y + j] == 1) masu[X][Y + j] = 0;
				}
				Y = Y + l;
			}
			if (d == 'E') {
				for (int j = 1; j <= l;j++) {
					if (masu[X + j][Y] == 1) masu[X + j][Y] = 0;
				}
				X = X + l;
			}
			if (d == 'S') {
				for (int j = 1; j <= l;j++) {
					if (masu[X][Y - j] == 1) masu[X][Y - j] = 0;
				}
				Y = Y - l;
			}
			if (d == 'W') {
				for (int j = 1; j <= l;j++) {
					if (masu[X - j][Y] == 1) masu[X - j][Y] = 0;
				}
				X = X - l;
			}
			//cout << "point: " << now.first << " " << now.second << endl;
		}
		bool f = false;
		for (int i = 0; i <= 20;i++) {
			for (int j = 0; j <= 20;j++) {
				if (masu[i][j] == 1)f = true;
			}
		}
		if (f) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
}

Measured memory_bytes: 3096
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		if (N%4==0) {
			System.out.println(3*N/4+" "+3*N/4+" "+3*N/4);
			return ;
		}
		for (long h =1;h<=3500;h++) {
			for (long w=1;w<=3500;w++) {
				long temp= N * h * w;
				long t = 4*h*w-N*(h+w);
				if (t>0&&temp%t==0) {
					System.out.println(h+" "+w+" "+temp/t);
					return ;
				}
			}
		}
	}
}

Measured memory_bytes: 39540
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	
	var t, x, y int
	pt, px, py := 0, 0, 0
	
	for i := 0; i < n; i++ {
		fmt.Scan(&t, &x, &y)
		ht := t - pt
		d := abs(x - px) + abs(y - py)
		if !(d <= ht && d % 2 == ht % 2) {
			fmt.Println("No")
			return
		}
    	pt, px, py = t, x, y
    }
	fmt.Println("Yes")

}

func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

Measured memory_bytes: 5504
#include <stdio.h>

int main(void){
    int s[3];
    int value;
    int x = 0;

    scanf("%d", &value);
    s[0] = (value % 10); value /= 10;
    s[1] = (value % 10); value /= 10;
    s[2] = (value % 10); value /= 10;
    if(s[0] == 1) x++;
    if(s[1] == 1) x++;
    if(s[2] == 1) x++;
    
    printf("%d", x);
    return 0;
}

Measured memory_bytes: 128
from collections import defaultdict
class UnionFind:
    def __init__(self, n=0):
        self.d = [-1 for _ in range(n)]
    
    def find(self, x): # find root
        if self.d[x] < 0: return x
        self.d[x] = self.find(self.d[x])
        return self.d[x]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y: return False
        if -self.d[x] < -self.d[y]: # swap
            t = x
            x = y
            y = t
        self.d[x] += self.d[y]
        self.d[y] = x
        return True

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def size(self, x):
        return -self.d[self.find(x)]
    

def main():
    N, M, K = map(int, input().split())
    uf = UnionFind(N)

    deg = [0 for _ in range(N)]
    for _ in range(M): # friends
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        deg[a] += 1
        deg[b] += 1
        uf.unite(a, b)
    # print(uf.d)

    to = [[] for _ in range(N)]
    for _ in range(K): # block
        c, d = map(int, input().split())
        c -= 1
        d -= 1
        to[c].append(d)
        to[d].append(c)

    ret = []
    for i in range(N):
        ans = uf.size(i) - 1 - deg[i]
        for u in to[i]:
            if uf.same(i, u): ans -= 1
        ret.append(str(ans))

    print(' '.join(ret))


main()

Measured memory_bytes: 34016
package main

import (
	"fmt"
	"math"
)

func permutation(n int, k int) int {
	v := 1
	if 0 < k && k <= n {
		for i := 0; i < k; i++ {
			v *= (n - i)
			v = v % int(math.Pow10(9)+7)
		}
	} else if k > n {
		v = 0
	}
	return v
}

func factorial(n int) int {
	return permutation(n, n-1)
}

func main() {
	// Code for C - Reconciled?
	var N, M int
	fmt.Scanf("%d %d", &N, &M)

	var count int
	var flag int = 0
	if N == M {
		count = count + 2
	} else if int(math.Abs(float64(N-M))) == 1 {
		count++
	} else {
		flag = 1
	}

	if flag == 0 {
		count *= factorial(N) % int(math.Pow10(9)+7)
		count *= factorial(M) % int(math.Pow10(9)+7)
		count = count % int(math.Pow10(9)+7)
		fmt.Println(count)
	} else {
		fmt.Println("0")
	}
}


Measured memory_bytes: 1836
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  for(int i = 0; i < n; i++) {
    cin >> h.at(i);
  }
  sort (h.begin(), h.end());
  double ans = h.at(0);
  for(int i = 1; i < n; i++) {
    ans = (ans + h.at(i)) / 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#define Read_Fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define all(a) a.begin(),a.end()
#define f first
#define s second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define f0(i,n) for(i=0;i<n;i++)
#define f1(i,n) for(i=1;i<n;i++)
#define f1n(i,n) for(i=1;i<=n;i++)
#define szf sizeof()
#define sz size()
#define ln length()
using namespace std;
using ll=long long;
const int N=2e5+5;
//ll cum[N+4];
int main()
{
    string str;
    cin>>str;
    int l=str.size();
    if(str[l-1]=='2' || str[l-1]=='4' || str[l-1]=='5' || str[l-1]=='7' || str[l-1]=='9')
    {
         cout<<"hon"<<endl;
    }
    else if(str[l-1]=='0' || str[l-1]=='1' || str[l-1]=='6' || str[l-1]=='8')
    {
         cout<<"pon"<<endl;
    }
    else
    {
        cout<<"bon"<<endl;
    }
    return 0;

}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int N, S;
    cin >> N >> S;
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];

    const int INF = 1000000;
    int minl = INF;
    int l = 0, r = 1, sum = 0;
    for (; r <= N; r++) {
        sum += a[r - 1];
        if (sum >= S) {
            minl = min(minl, r - l);
            for (l++; l < r; l++) {
                sum -= a[l - 1];
                if (sum < S) break;
                minl = min(minl, r - l);
            }
        }
    }
    if (minl == INF) cout << 0 << endl;
    else cout << minl << endl;

    return 0;
}

Measured memory_bytes: 3124
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

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

typedef long long ll;
const ll mod=1000000007;
#define MAX 50 



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

   
    ll n;
    cin>>n;
    ll a[n];
    map<ll,ll>m;
    ll sum=0;
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
        sum+=a[i];
    }
    ll q;
    cin>>q;
    while(q--)
    {
        ll c=0;
        ll x,y;
        cin>>x>>y;
        //cout<<m[x]<<" "<<m[y];
        sum-=(m[x]*x);

        sum+=(m[x]*y);
        m[y]+=m[x];
        m[x]=0;

        /*for(int i=0;i<n;i++)
        {
            if(a[i]==x)
            a[i]=y;
            c+=a[i];
            
        }*/
        cout<<sum<<endl;
        
    }
    

    return 0;
}


Measured memory_bytes: 10292
a,b = map(int,input().split())
c,d = map(int,input().split())

if (a,b,c,d) == (1,31,2,1) or (a,b,c,d) ==(2,28,3,1) or (a,b,c,d) ==(3,31,4,1) or (a,b,c,d) ==(4,30,5,1) or (a,b,c,d) == (5,31,6,1) or (a,b,c,d) ==(6,30,7,1) or (a,b,c,d) ==(7,31,8,1) or (a,b,c,d) ==(8,31,9,1) or (a,b,c,d) ==(9,30,10,1) or (a,b,c,d) ==(10,31,11,1) or (a,b,c,d) ==(11,30,12,1):
    print(1)
else:
    print(0)

Measured memory_bytes: 3064
def ex_sum(num)
  return 0 if num < 1
  num_succ = num + 1
  if num_succ.even?
    return (num_succ % 4).zero? ? 0 : 1
  end
  x = (num % 4).zero? ? 0 : 1
  x ^ num
end

a, b = STDIN.gets.split.map(&:to_i)
STDOUT.puts ex_sum(a-1) ^ ex_sum(b)

Measured memory_bytes: 1788
N = int(input())
S = list(input())

e, w = 0, 0
right, left = [], []
for s in S:
    if s == 'E':
        e += 1
    else:
        w += 1
    left.append([e, w])
ss = list(reversed(S))
e, w = 0, 0
for s in ss:
    if s == 'E':
        e += 1
    else:
        w += 1
    right.append([e, w])
right.reverse()
ans = 10**6

for i in range(N):
    if i == 0:
        ans = min(ans, right[1][0])
    elif i == N - 1:
        ans = min(ans, left[-2][1])
    else:
        ans = min(ans, right[i + 1][0] + left[i - 1][1])
print(ans)


Measured memory_bytes: 88308
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
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;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

vector<ll> fac(MAX), finv(MAX), inv(MAX);

void comInit(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(ll i=2; i<MAX; i++){
		fac[i] = fac[i-1]*i % mod;
		inv[i] = mod - inv[mod%i] * (mod/i) % mod;
		finv[i] = finv[i-1] * inv[i] % mod;
	}
}


ll com(ll n, ll k){
	if(n < k) return 0;
	if(n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

int main(){
	comInit();
	ll n,k; cin >> n >> k;
	vl a(n); rep(i,n) cin >> a[i];
	sort(all(a));
	ll mx = 0;
	for(ll i=n-1; i>=k-1; i--){
		ll tmp = a[i]*com(i,k-1);
		if(tmp<0){
			tmp = -tmp;
			tmp %= mod;
			mx -= tmp;
			if(mx<0) mx += mod;
		}else{
			mx += tmp%mod;
			mx %= mod;
		}
	}
	ll mn = 0;
	rep(i,n-k+1){
		ll tmp = a[i]*com(n-1-i,k-1);
		if(tmp<0){
			tmp = -tmp;
			tmp %= mod;
			mn -= tmp;
			if(mn<0) mn += mod;
		}else{
			mn += tmp%mod;
			mn %= mod;
		}
	}
	ll ans = mx-mn;
	while(ans<0) ans += mod; 
	cout << ans << endl;
}

Measured memory_bytes: 14976
n=int(input())
s=input()
for p in range(4):
    l=[p//2,p%2]+[0]*(n-2)
    for i in range(1,n):
        l[(i+1)%n]=[l[i-1],1-l[i-1]][::(-1)**int(s[i]=="o")][l[i]]
    for i in range(n):
        if s[i]!="ox"[int(l[(i-1)%n]==l[(i+1)%n])-l[i]]:break
    else:print("".join("WS"[x] for x in l));exit()
print(-1)

Measured memory_bytes: 5476
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  string S;
  cin>>S;
  int ans=1,C=0;
  if(S[0]!='A'||S[1]=='C'||S[S.size()-1]=='C') ans=0;
  rep(i,S.size()){
    if(i){
      if(S[i]-'A'>=0&&S[i]-'A'<26){
        if(S[i]!='C') ans=0;
        else C++;
      }
    }
  }
  cout<<((ans&&C==1)?"AC":"WA")<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		String inputId = sc.nextLine();
		String inputAddId = sc.nextLine();

		int flag = 0;

		for (int i = 0; i < inputId.length(); i++) {

			if (inputId.charAt(i) != inputAddId.charAt(i)) {
				flag++;
			}
		}

		if (flag == 0 && (inputAddId.length() - inputId.length() == 1)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();

	}
}


Measured memory_bytes: 35800
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007;

vector<vector<int>> to;
vector<int> tdis,adis;

void tfs(int v,int p=-1,int d=0){
    tdis.at(v)=d;
    for(int u:to[v]){
        if(u==p)continue;
        tfs(u,v,d+1);
    }
    return;
}

void afs(int v,int p=-1,int d=0){
    adis.at(v)=d;
    for(int u:to[v]){
        if(u==p)continue;
        afs(u,v,d+1);
    }
    return;
}

int main() {
    int N,U,V;
    cin>>N>>U>>V;
    --U;--V;
    to.resize(N,vector<int>(0));
    tdis.resize(N);
    adis.resize(N);
    rep(i,N-1){
        int a,b;
        cin>>a>>b;
        --a;--b;
        to[a].pb(b);
        to[b].pb(a);
    }
    tfs(U);
    afs(V);
    int ans=0;
    rep(i,N){
        int me=adis.at(i)-tdis.at(i);
        if(me>=0){chmax(ans,adis.at(i)-1);}
    }
    cout<<ans<<endl;
    /*rep(i,N)cout<<tdis.at(i)<<" ";
    cout<<endl;
    rep(i,N)cout<<adis.at(i)<<" ";
    cout<<endl;*/
}

Measured memory_bytes: 13216
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

string solve(ll n){
  if (n == 0)
    return "";

  string t = {(char)('a' + (n + 25)%26)};
  return solve((n-1)/26) + t;
}

int main(void){
  ll n;
  cin >> n;
  
  cout << solve(n) << endl;

  return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>
#define Max 500000
#define SENTINEL 1000000000
void Merge(int *,int, int,int);
void MergeSort(int *,int,int);

int cnt=0;
int main(){
  int Data[Max],n,i;

  scanf("%d",&n);


 for(i=0;i<n;i++){
   scanf("%d",&Data[i]);
 }
 MergeSort(Data,0,n);

 for(i=0;i<n;i++){
  printf("%d",Data[i]);
  if(i!=n-1){
    printf(" ");
  }
 }
 printf("\n%d\n",cnt);


return 0;
}

void Merge(int *Data,int left,int mid,int right){
 int n1,n2,i,j,k,L[Max/2+2],R[Max/2+2];
 n1=mid-left;
 n2=right-mid;


 for(i=0;i<n1;i++){
   L[i]=Data[left+i];
 }
 for(i=0;i<n2;i++){
   R[i]=Data[mid+i];
 }
  L[n1]=SENTINEL;
  R[n2]=SENTINEL;
  i=0;
  j=0;

 for(k=left;k<right;k++){
   cnt++;
   if(L[i]<=R[j]){
     Data[k]=L[i];
     i++;
   }else{
     Data[k]=R[j];
     j++;
   }
 }
 
}

void MergeSort(int *Data,int left,int right){
  int mid;

  if(left+1<right){//leftがrigthtより小さい時入る
   mid = (left + right)/2;
    MergeSort(Data, left, mid);
    MergeSort(Data, mid, right);
    Merge(Data, left, mid, right);
  }
}


Measured memory_bytes: 5600
/**
*  author: rits1272
*  created: Aug 22, 2020
**/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define print(x) cout << "[" << #x << ":" << x << "] "; 
#define println(x) cout << "[" << #x << ":" << x << "]\n";

const int mxN = 1e3 + 1;
int h, w;
int sx, sy;
int dx, dy;
string grid[mxN];
int vis[mxN][mxN];

int dirx[]={1,-1,0,0};
int diry[]={0,0,-1,1};

bool is_valid(int x, int y){
    return (x>=0 && y>=0 && x<h && y<w && !vis[x][y] && grid[x][y] != '#');
}


void bfs(){
    memset(vis, false, sizeof(vis));
    deque<pair<pair<int, int>, int>> q;
    q.push_front({{sx, sy}, 0});
    while(!q.empty()){
	pair<int, int> p = q.front().first;
	int cost = q.front().second;
	int x = p.first, y = p.second;
	//println(cost)
	q.pop_front();

	if(x == dx && y == dy){
	    cout << cost << "\n";
	    return;
	}

	if(vis[x][y])
	    continue;
	    
	vis[x][y] = true;

	for(int i=0; i<4; i++){
	    int new_x = x + dirx[i];
	    int new_y = y + diry[i];
	    if(is_valid(new_x, new_y)){
		
		q.push_front({{new_x, new_y}, cost});
	    }
	}

	// do magic
	for(int i=-2; i<=2; i++){
	    for(int j=-2; j<=2; j++){
		int new_x = x + i;
		int new_y = y + j;
		if(is_valid(new_x, new_y)){
		    q.push_back({{new_x, new_y}, cost+1});
		}
	    }
	}
    }
    cout << -1 << "\n";
    return;
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >> w >> sx >> sy >> dx >> dy;
    --sx, --sy, --dx, --dy;
    for(int i=0; i<h; i++)
	cin >> grid[i];
    bfs();
    return 0;
}


Measured memory_bytes: 13800
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fr first
#define sc second
#define N 200009
#define pi pair<ll,ll>
#define pb push_back
using namespace std;
typedef long long ll;
int main()
{
    //FAST;
    ll l,r,d;
    cin>>l>>r>>d;
    ll ans=0;
    for(ll i=1; ;i++)
    {
        ll x=i*d;
        if(x>r) break;
        if(x>=l && x<=r)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<min(c, b/a)<<endl;
}


Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

bool solve() {
    auto s = readln.split.map!(to!int);
    auto H = s[0];
    auto W = s[1];
    auto S = s[2];
    if (H == 0 || W == 0) return false;
    auto A = H.iota.map!(_ => readln.split.map!(to!int).array).array;

    auto B = new int[][](H+1, W+1);
    foreach (i; 0..H) foreach (j; 0..W) B[i+1][j+1] = A[i][j];
    foreach (i; 0..H+1) foreach (j; 0..W) B[i][j+1] += B[i][j];
    foreach (j; 0..W+1) foreach (i; 0..H) B[i+1][j] += B[i][j];

    int sum(int r1, int c1, int r2, int c2) {
        return B[r2+1][c2+1] - B[r2+1][c1] - B[r1][c2+1] + B[r1][c1];
    }

    int total_cost = B[H][W];

    auto mem = new Tuple!(int, int)[][][][](H, W, H, W);
    foreach (i; 0..H) foreach (j; 0..W) foreach (k; 0..H) mem[i][j][k][] = tuple(-1, -1);

    Tuple!(int, int) solve(int r1, int c1, int r2, int c2) {
        if (mem[r1][c1][r2][c2][0] >= 0) return mem[r1][c1][r2][c2];
        int rest = total_cost - sum(r1, c1, r2, c2);
        if (rest > S) return tuple(-1, -1);

        auto ret = tuple(1, rest);

        foreach (i; r1..r2) {
            auto ret1 = solve(r1, c1, i, c2);
            auto ret2 = solve(i+1, c1, r2, c2);
            if (ret1[0] == -1 || ret2[0] == -1) continue;
            int a = ret1[0] + ret2[0];
            int b = max(ret1[1], ret2[1]);
            if (a > ret[0] || (a == ret[0] && b < ret[1])) {
                ret = tuple(a, b);
            }
        }

        foreach (j; c1..c2) {
            auto ret1 = solve(r1, c1, r2, j);
            auto ret2 = solve(r1, j+1, r2, c2);
            if (ret1[0] == -1 || ret2[0] == -1) continue;
            int a = ret1[0] + ret2[0];
            int b = max(ret1[1], ret2[1]);
            if (a > ret[0] || (a == ret[0] && b < ret[1])) {
                ret = tuple(a, b);
            }
        }

        mem[r1][c1][r2][c2] = ret;
        return ret;
    }

    auto ans = solve(0, 0, H-1, W-1);
    writeln(ans[0], " ", S - ans[1]);

    return true;
}

void main() {
    while (solve) {}
}



Measured memory_bytes: 39332
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define ii pair<int, int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define ld long double
#define iii tuple<int, int, int>
#define N 1000005
#define sc scanf
#define pb push_back


ll a[200005];

int main() {

    ll k, n;
    sc("%lld %lld", &n, &k);

    ll sum = 0;

    for(int i=1; i<=n; i++) {
        sc("%lld", &a[i]);

        if(i <= k) {
            sum += a[i];
        }
    }

    for(int i=k+1, j=1; i<=n; i++, j++) {

        ll s = sum - a[j];
        s += a[i];

        if(s > sum) {
            printf("Yes\n");
        }
        else {
            printf("No\n");
        }
    }
}


Measured memory_bytes: 5320
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(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 sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define scan2() int n,k; cin>>n>>k ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005

void solve(){
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int x=h1*60+m1;
    int y=h2*60+m2;
    int d=y-x;
    int ans=y-x-k;
    if(ans<0)ans=0;
    cout << ans << '\n';


}


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

        int t;
        t=1;
       // cin >> t;
        while(t--){
            solve();
        }
        

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
const int64_t INF = 1000000000000000;
const int64_t MOD = 1000000007;

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

int64_t n; cin >> n;
VI cnt(26, INF);
rep(i, 0, n) {
    string S; cin >> S;
    VI tmp(26, 0);
    for(char c:S) ++tmp[c - 'a'];
    rep(j, 0, 26)  cnt[j] = min(cnt[j], tmp[j]);
}

string ans = "";
rep(i, 0, 26)
    rep(j, 0, cnt[i]) ans += (char)(i + 'a');

cout <<  ans << endl;



}
// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり



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

using namespace std;

int ctos, son;
int A[10005];
int D[50005];

int main(){
    ios::sync_with_stdio(false);

    cin>>ctos>>son;
    for(int i=1; i<=son; i++){
        cin>>A[i];
    }
    for(int i=1; i<=ctos; i++){
        D[i]=50001;
    }

        for(int k=1; k<=son; k++){
    for(int i=1;  i<=ctos; i++){
            if(A[k] > i)
                continue;
            D[i] = min(D[i], 1 + D[i - A[k]]);
        }
    }
    cout<<D[ctos]<<endl;
    return 0;
}

Measured memory_bytes: 3332
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


class union_find_t {
public:
  union_find_t(int T) : T_(T), parent_(new int[T]), rank_(new int[T]) {
    for (int i = 0; i < T_; i++) {
      parent_[i] = i;
      rank_  [i] = 0;
    }
  };

  ~union_find_t() {
    delete[] parent_;
    delete[] rank_;
  };

public:
  int find(int x) {
    if (parent_[x] == x) {
      return x;
    }
    else {
      return parent_[x] = find(parent_[x]);
    }
  };

  void unite(int x, int y) {
    x = find(x);
    y = find(y);

    if (x == y)
      return;

    if (rank_[x] < rank_[y]) {
      parent_[x] = y;
    }
    else {
      parent_[y] = x;

      if (rank_[x] == rank_[y])
        rank_[x] ++;
    }
  };

  bool same(int x, int y) {
    return find(x) == find(y);
  };

private:
  int T_;

  int* parent_;
  int* rank_;
};


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, M;

  std::cin >> N >> M;

  union_find_t uf(N);

  for (int i = 0; i < M; i ++) {
    int X, Y, Z;

    std::cin >> X >> Y >> Z;

    X --;
    Y --;

    uf.unite(X, Y);
  }

  int c = 0;

  for (int i = 0; i < N; i ++)
    if (uf.find(i) == i)
      c ++;

  std::cout << c << std::endl;

  return 0;
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	int d, t, s;
	cin >> d >> t >> s;
	if (s * t >= d) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 3608
//cofee

#include<iostream>
#include<string>
using namespace std;

int main (){
    string S,Ans = "No";
    cin >> S;
    if(S[2]==S[3]){
        if(S[4]==S[5]){
            Ans = "Yes";
        }
    }
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 256