akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int64_t dp[1 << 14];
int main() {
	int n, m; cin >> n >> m;
	int a[m], b[m];
	int c[m] = {};
	rep(i,m) {
		cin >> a[i] >> b[i];
		rep(j,b[i]){
			int cc; cin >> cc; cc--;
			c[i] |= (1 << cc);
		}
	}
	for(int i = 0; i < (1 << n); ++i) {
		dp[i] = LINF;
	}
	dp[0] = 0;
	for(int mask = 0; mask < (1 << n); ++mask) {
		for(int i = 0; i < m; ++i) {
			// cout << (mask | c[i]) << endl;
			// if(dp[mask | c[i]] == LINF) continue;
			dp[mask | c[i]] = min(dp[mask | c[i]], dp[mask] + a[i]);
		}
	}
	cout << (dp[(1 << n) - 1] >= INF ? -1 : dp[(1 << n) - 1]) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll Q,H,S,D,N;
    ll cost = 0;
    cin >> Q >> H >> S >> D >> N;
    ll min2 = min(D,min(S * 2,min(H * 4,Q * 8)));
    cost += (N/2) * min2;
    N = N % 2;
    ll min1 = min(S,min(H * 2,Q * 4));
    cost += N * min1;
    cout << cost << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#define INF 100000000000
#define N 200000
#define ll long long
using namespace std;

int main(){
    ll a,b,h,m;
    cin>>a>>b>>h>>m;
    
    double p=30*h+m*0.5;
    double q=m*6;
    
    double r;
    
    if (p>=q) r=p-q;
    else r=q-p;
    

    
    double pi     =3.141592653589793238462643383279502884;
	double unit   = pi / 180.0; 
	
	double deg=r*pi/180;
	
	ll x,y;
	double z;
	x=a*a;
	y=b*b;
	z=2*a*b*cos(deg);
	
	//cout<<x<<endl;
	
	double ans=x+y-z;
	double pp=pow(ans,0.5);
	double qq=sqrt(ans);

	//cout<<fixed<<setprecision(15)<<pow(ans,0.5)<<endl;
	cout<<fixed<<setprecision(15)<<qq<<endl;
	

}

Measured memory_bytes: 4372
import itertools
N,M,Q = map(int,input().split())
n_list = list()
l = list()
d = list()
d_sum = list()
for i in range(1,M+1):
    l.append(i)
A_list = list(itertools.combinations_with_replacement(l,N))
for i in range(Q):
    n_list.append(list(map(int,input().split())))
for A in A_list:
    for i in range(Q):
        if A[n_list[i][1]-1]-A[n_list[i][0]-1] == n_list[i][2]:
            d.append(n_list[i][3])
        else:
            d.append(0)
    d_sum.append(sum(d))
    d.clear()
print(max(d_sum))

Measured memory_bytes: 25076
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
#define Imax 1e9+5
#define LLmax 1e18
#define Imin -1e9-5
#define LLmin -1e18
string day [] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
vector <string> v;
bool sortByFirst(const pair<int,int>&a,const pair<int,int>&b){
    return a.first>b.first;
}
void dfs (string str, string t = "", int cnt = 0) {
    if (cnt == 2) {
        v.push_back (t);
        return;
    } else {
        for (int i = 0; i <str.size (); i ++) {
            dfs (str, t + str [i], cnt + 1);
        }
    }
}
int main () {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    while(cin>>n){
        string str;
        cin>>str;
        if(n==0)cout<<str<<endl;
        else{
            for(int i=0;i<str.length();i++){
                int t=(str[i]-'A');
                cout<<(char)('A'+((t+n)%26));
            }
            cout<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

		Scanner keyboard = new Scanner(System.in);

		long A = keyboard.nextLong();
		String B = keyboard.next();
		
		long NB = 0;
		String nb = "";
		
		for(int b = 0;b<4; b++) {
			if( B.charAt(b)!= '.') {
				nb += B.charAt(b);
			}
		}
		NB = Integer.parseInt(nb);
		
		System.out.println(NB*A/100);
		keyboard.close();
	}
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

int main() {
    int ans = 0;
    string s;
    cin>>s;

    REP(i,s.size()) {
        if (s[i] == '+') ans++;
        else ans--;
    }


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

Measured memory_bytes: 256
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import Data.Bool
import Data.Maybe

main :: IO ()
main = do
  [a,b,c,d] <- readInts
  print . showAnswer $ solve (a,b,c,d)

type Input  = (Int, Int, Int, Int)
type Output = Bool

solve :: Input -> Output
solve (a,b,c,d) = abs (a-c) <= d || cond
  where
    cond = abs (a-b) <= d && abs (b-c) <= d

showAnswer :: Output -> Answer
showAnswer = YesNo

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

data Answer
  = YesNo Bool
  | YESNO Bool
  | AB Bool
  | Number Int
  | String String
  | Compare Ordering
  | Compare2 Ordering

instance Show Answer where
  show (YesNo b)    = bool "No" "Yes" b
  show (YESNO b)    = bool "NO" "YES" b
  show (AB b)       = bool "B"  "A" b
  show (Number i)   = show i
  show (String s)   = s
  show (Compare o)  = ordering "<" "=" ">" o
  show (Compare2 o) = ordering "Right" "Balanced" "Left" o

ordering :: a -> a -> a -> Ordering -> a
ordering lt eq gt o = case o of
  LT -> lt
  EQ -> eq
  GT -> gt

Measured memory_bytes: 380
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <vector>
using namespace std;
#define ll long long
int gcd(ll a, ll b) {
	if (a == 0)
		return b;
	return gcd(b % a, a);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll a, b;
	cin >> a >> b;
	cout << (a * b) / gcd(a, b);
	system("pause>0");
	return 0;
}


Measured memory_bytes: 504
#!/usr/bin/env ruby

N = gets.chomp.to_i

S = gets.chomp

i = 0

j = N - 1

ans = 0

loop do
  while S[i] == 'R' && i < j
    i += 1
  end

  break if i >= j

  while S[j] == 'W' && i < j
    j -= 1
  end

  break if i >= j

  S[i], S[j] = S[j], S[i]

  ans += 1
end

puts ans


Measured memory_bytes: 14708
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M, K;
string S;
vi va, vb;
const int MAX = MX;
long long fac[MAX], finv[MAX], inv[MAX];
void com_init() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int 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;
  }
}

long long com(int n, int k) {
  if (n < k) {
    return 0;
  }
  if (n < 0 || k < 0) {
    return 0;
  }
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void input() {
  cin >> N >> K;
  va.resize(N);
  rep(i, 0, N - 1) {
    cin >> va[i];
  }

  ;
  ;
}
int ans;
void solve() {
  sort(all(va));
  com_init();

  rep(i, 0, N - 1) {
    int c = com(N, K) - com(i + 1, K) - com(N - (i + 1), K);
    c += MOD * 2;
    c %= MOD;
    ans += c * (va[i + 1] - va[i]);
    ans += MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  // debug(va[N]);
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

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



int main() {
    ll N;
    cin>>N;
    vector<ll> A(N),B(N+1),C(N+1);
    rep(i,N){
        cin>>A.at(i);
        B.at(A.at(i))++;
    }
    ll al=0;
    rep(i,N+1){
        C.at(i)=B.at(i)*(B.at(i)-1)/2;
        al+=C.at(i);
    }
    rep(i,N){
        ll ans=al;
        ans-=C.at(A.at(i));
        ans+=(B.at(A.at(i))-1)*(B.at(A.at(i))-2)/2;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
#define mx 100001
using namespace std;
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
void show(ll x){cout<<x<<" ";}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mkp make_pair
//#define d double
void solve(){
	ll n,k;
	cin>>n>>k;
	vl vec(n);
	cin>>vec;
	vl dp(n,inf);
	dp[0]=0;
	for(int i=1;i<n;i++){
		for(int j=i-1;j>=max(0,i-k);j--){
			dp[i]=min(dp[i],dp[j]+Abs(vec[j]-vec[i]));
		}
	}
	cout<<dp[n-1]<<endl;
	
}
int32_t main(){
int t=1;
//cin>>t;
while(t--){
	solve();
}
 
}

Measured memory_bytes: 1792
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef pair<int,int> P;
typedef long long int lnt;
lnt a,ans,tens[11],len,nums[11],K; //1463 nums[0]=3 [1]=6 [2]=4 [3]=1
int main()
{
	cin>>a;
	tens[0]=1;
	ans=a;
	for(int i=1;i<=10;i++) tens[i]=tens[i-1]*10;
	while(tens[len]<=a) len++;
	for(lnt i=0;i<len;i++) nums[i]=(a/tens[i])%10;
	for(lnt i=1;i<1<<(len-1);i++){
		lnt res=0;
		K=1;
		res+=nums[0];
		for(lnt j=0;j<len-1;j++){
			if((i>>j)%2) K=0;
			res+=nums[j+1]*tens[K++];
			
		}
		ans+=res;
	}
	cout<<ans<<endl;
}

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

int main() {
  int n, m, k, a;
  cin >> n >> m;
  int b[m]={0};
  for (int i=0;i<n;i++){
    cin >> k;
    for (int j=0;j<k;j++){
      cin >> a;
      b[a-1]++;
    }
  }
  int cl=0;
  for (int i=0;i<m;i++){
    if (b[i] == n)cl++;
  }
  cout << cl << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s1=sc.nextLine();
    String s2=s1.toLowerCase();
    String s3=s1.toUpperCase();
    for(int i=0;i<s1.length();i++){
      if(s1.charAt(i)==s2.charAt(i)){
        System.out.print(s3.charAt(i));
      }else if(s1.charAt(i)==s3.charAt(i)){
        System.out.print(s2.charAt(i));
      }
    }
    sc.close();
    System.out.print("\n");
  }
}


Measured memory_bytes: 26840
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.numeric;

void main()
{
  string line;
  while ((line = readln) !is null) {
    auto rd = line.split.to!(int[]), a = rd[0], b = rd[1];
    auto g = gcd(a, b);
    writefln("%d %d", g, a / g * b);
  }
}

Measured memory_bytes: 2360
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    cin >> n;
    n %= 10;
    if (n == 3) cout << "bon";
    else if (n == 0 || n == 1 || n == 6 || n == 8) cout << "pon";
    else cout << "hon";
    return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ull res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
ll gcd(ll x,ll y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
bool comp(pair<int,int> x,pair<int,int> y)
{
    return x.first<y.first;
}
bool comp_pairs_by_s(pair<ll,ll> &x ,pair<ll,ll> &y)
{
    return x.second<y.second;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}

class cmp      //comparator for priority_queue 
{               //declaration: priority_queue<int,vector<int>,cmp>
public:         
    bool operator()(pair<int,int> A,pair<int,int> B)
    {
        if(abs(A.first-A.second)==abs(B.first-B.second))
            return A.first>B.first;
        return abs(A.first-A.second)<abs(B.first-B.second);
    }
};
// int prime[10000007]={0};
// void sieve(void)
// {
//  int i,j;
//  for(i=0;i<10000007;i++)
//         prime[i]=1;
//  prime[0]=0,prime[1]=0;
//  for(i=2;i<=sqrt(10000007);i++){
//      if(prime[i]==i){
//          for(j=i*i;j<10000007;j+=i){
//             if(!prime[j])
//                 prime[j]=0;
//          }
//      }
//  }
    
// }
void swap(ll &x,ll &y){
    int temp=x;
    x=y;
    y=temp;
}
  
unsigned int onesComplement(unsigned int n) 
{ 
   // Find number of bits in the given integer 
   int number_of_bits = floor(log2(n))+1; 
  
   // XOR the given integer with poe(2,  
   // number_of_bits-1 and print the result  
   return ((1 << number_of_bits) - 1) ^ n; 
}

void solve()
{   
    int n;
    cin>>n;
    map<string,int> m;
    for(int i=0;i<n;++i){
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<"AC"<<' '<<'x'<<' '<<m["AC"]<<'\n';
    cout<<"WA"<<' '<<'x'<<' '<<m["WA"]<<'\n';
    cout<<"TLE"<<' '<<'x'<<' '<<m["TLE"]<<'\n';
    cout<<"RE"<<' '<<'x'<<' '<<m["RE"]<<'\n';
}

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


Measured memory_bytes: 3668
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int sh = sc.nextInt() - 1;
		int sw = sc.nextInt() - 1;
		int th = sc.nextInt() - 1;
		int tw = sc.nextInt() - 1;
		char[][] map = new char[H][];
		for (int i = 0; i < H; i++) {
			map[i] = sc.next().toCharArray();
		}
		int[][] d = new int[H][W];
		for (int i = 0; i < H; i++) {
			Arrays.fill(d[i], 1 << 25);
		}
		PriorityQueue<int[]> Q = new PriorityQueue<>(1000, (a, b) -> a[2] - b[2]);
		Q.add(new int[] {sh, sw, 0});
		d[sh][sw] = 0;
		int[] dx = new int[] {1, 0, -1, 0};
		int[] dy = new int[] {0, 1, 0, -1};
		while (!Q.isEmpty()) {
			int x = Q.peek()[0];
			int y = Q.poll()[1];
			if (x == th && y == tw) {
				System.out.println(d[x][y]);
				return;
			}
			for (int i = 0; i < 4; i++) {
				if (x + dx[i] < 0 || x + dx[i] >= H || y + dy[i] < 0 || y + dy[i] >= W || map[x + dx[i]][y + dy[i]] == '#') continue;
				if (d[x][y] < d[x + dx[i]][y + dy[i]]) {
					Q.add(new int[] {x + dx[i], y + dy[i], d[x][y]});
					d[x + dx[i]][y + dy[i]] = d[x][y];
				}
			}
			for (int i = -2; i <= 2; i++) {
				for (int j = -2; j <= 2; j++) {
					if (x + i < 0 || x + i >= H || y + j < 0 || y + j >= W || map[x + i][y + j] == '#') continue;
					if (d[x][y] + 1 < d[x + i][y + j]) {
						Q.add(new int[] {x + i, y + j, d[x][y] + 1});
						d[x + i][y + j] = d[x][y] + 1;
					}
				}
			}
		}
		System.out.println(-1);
	}
}

Measured memory_bytes: 64508
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);

     ll a,b,c,d;
     cin>>a>>b>>c>>d;
     ll mi=min(b,d);
     ll ma=max(a,c);
     ll m=mi-ma;
    if(m>=0) cout<<m;
    else cout<<"0";
}








Measured memory_bytes: 3596
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        long ans = 0;
        for (int i = 1; i <= N; i++) {
            for (int j = 1; i * j <= N; j++) {
                ans += i * j;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35788
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<cstdlib>
using namespace std;
long long f[100006][15];
int a[100006];
char ch[100006];
int n;
int main()
{
	cin>>ch;
	n=strlen(ch);
	a[0]=1;a[1]=10;
	for(int i=2;i<=n-1;i++)
	  a[i]=(a[i-1]*10)%13;
	if(ch[n-1]=='?') 
        for(int i=0;i<=9;i++)
        	f[0][i]=1;
    else 
      f[0][ch[n-1]-48]=1;
   // for(int i=1;i<=12;i++)
//     printf("%d ",f[0][i]);
  // printf("\n%c\n",ch[n-1]);
	for(int i=1;i<=n-1;i++)
	{
	//	printf("%c",ch[n-1-i]);
	  for(int j=0;j<=12;j++)
	  {
		if(ch[n-1-i]=='?')
		{		
			{
				for(int k=0;k<=9;k++)
				{
				f[i][j]+=f[i-1][(j-((k*a[i])%13)+13)%13];
				f[i][j]=f[i][j]%1000000007;
			     }
			}
		}
		else 
		{
		//           	printf("NO\n");
		     f[i][j]+=f[i-1][(j-(((ch[n-1-i]-48)*a[i])%13)+13)%13];
		     f[i][j]=f[i][j]%1000000007;
		}
	  }
	}
	printf("%lld",f[n-1][5]%1000000007);
} 

Measured memory_bytes: 12416
R , G , B , N = (int(x) for x in input().split())
count = 0
r = 0
g = 0
while R * r <= N:
  g = 0
  while R * r + G * g <= N:
    if (N - (R * r + G * g)) % B == 0 or R * r + G * g == N:
      count += 1
    g += 1
  r += 1
print(count)

Measured memory_bytes: 40556
import numpy as np
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

c=[]
need=sum(a)-sum(b)
ans=0
for i in range(n):
    c.append(a[i]-b[i])
    
c=sorted(c)
arr=np.array(c)
arr2=arr[arr>=0]
d=arr2.tolist()
#print(need,d)
for i in range(len(d)):
    need-=d[i]
    if need>=0:
        ans+=1
#print(ans)
if sum(a)<sum(b):
    print(-1)
else:
    print(n-ans)

Measured memory_bytes: 27288
import sys
input = sys.stdin.readline
n = int(input())
chk = []
for i in range(n):
  a = int(input())
  chk.append(a)
chk.sort()
if n%2 == 0:
  l = [i*2 for i in chk[:n//2]]
  r = [i*2 for i in chk[n//2:]]
  print(sum(r)-sum(l)+chk[n//2-1]-chk[n//2])
else:
  l = [i*2 for i in chk[:(n-1)//2]]
  r = [i*2 for i in chk[(n-1)//2+1:]]
  p = sum(r)-sum(l)+chk[(n-1)//2-1]-chk[(n-1)//2]
  q = sum(r)-sum(l)+chk[(n-1)//2]-chk[(n-1)//2+1]
  print(max(p,q))

Measured memory_bytes: 11620
s = gets.chomp.chars
q = gets.to_i

rev = false
q.times do
  t, f, c = gets.split
  if t == '1'
    rev = !rev
  else
    if f == '1' && rev || f == '2' && !rev
      s.push(c)
    else
      s.unshift(c)
    end
  end
end
puts rev ? s.reverse.join : s.join


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,a[250010],dist[510][510],rem[510][510],ans=0,dx[]={1,-1,0,0},dy[]={0,0,1,-1};

bool out(int x,int y)
{
	return x<1||x>n||y<1||y>n;
}

bool upd(int x,int y)
{
	int sv=dist[x][y];
	rep(i,4)
	{
		int xx=x+dx[i],yy=y+dy[i];
		if(out(xx,yy)) continue;
		dist[x][y]=min(dist[x][y],dist[xx][yy]+rem[xx][yy]);
	}
	return dist[x][y]!=sv;
}

void dfs(int x,int y)//一开始每个位置的举例都在n左右，所有操作完成后都变成0，所以总复杂度O(n^3) 
{
	rep(i,4)
	{
		int xx=x+dx[i],yy=y+dy[i];
		if(out(xx,yy)|| !upd(xx,yy)) continue;
		dfs(xx,yy);
	}
}

int main()
{
	cin>>n;
	rep(i,n*n) scanf("%d",&a[i]);
	repn(i,n) repn(j,n)
	{
		rem[i][j]=1;
		dist[i][j]=min(min(i-1,n-i),min(j-1,n-j));
	}
	rep(i,n*n)
	{
		int x=(a[i]-1)/n+1,y=(a[i]-1)%n+1;
		ans+=dist[x][y];
		rem[x][y]=0;
		dfs(x,y);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 17920
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,x,k,kotae=0,ichi=0,i;
  cin>>n>>x;
  for(i=0;i<n;i++){
    cin>>k;
    ichi+=k;
    kotae++;
        if(ichi>x){break;}
    if(i==n-1){kotae++;}
  }
  cout<<kotae;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

H,W=list(map(int,input().split()))

num_ac = H*W
if H>=2 and W>=2:
    num_hd = 2*W+2*(H-2)
elif (H == 1 and W>= 2) or ( H>=2 and W==1):
    num_hd = 2

else:
    num_hd = 0

print(num_ac-num_hd)


Measured memory_bytes: 9164
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		if(S.charAt(0)==(S.charAt(1))&&S.charAt(1)==S.charAt(2)){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
		{
			
		}
	}
}

Measured memory_bytes: 22868
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

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

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

    long long ans = std::numeric_limits<long long>::max();

    for (int i = 0; i < n - k + 1; i++) {
        ans = std::min(ans, std::abs(x[i]) + std::abs(x[i + k - 1] - x[i]));
    }

    for (int i = n - 1; i >= k - 1; i--) {
        ans = std::min(ans, std::abs(x[i]) + std::abs(x[i] - x[i - k + 1]));
    }

    std::cout << ans << std::endl;
}


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

typedef long double ld;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;

#define FOR(i, b, e) for (int i = b; i <= e; i++)
#define FORD(i, b, e) for (int i = b; i >= e; i--)
#define SIZE(x) ((int)(x).size())
#define pb push_back
#define st first
#define nd second
#define all(a) begin(a), end(a)
#define watch(x) cerr << (#x) << " is " << (x) << '\n';

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

    ll n;
    cin >> n;
    cout << n * (n - 1) / 2;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 +7;


ll gcd(ll a,ll b){
    if(b ==0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g =gcd(a,b);
    return a/g*b;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,num[100010],x[100010],y[100010];
    bool red[100010];
    cin>>n>>m;
    rep(i,m){
        cin>>x[i]>>y[i];
    }
    for(int i=1;i<=n;i++){
        num[i]=1;
        red[i]=false;
    }
    red[1]=true;
    rep(i,m){
        if(red[x[i]]) red[y[i]]=true;
        num[x[i]]--;
        num[y[i]]++;
        if(num[x[i]]==0) red[x[i]]=false;   
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
        if(red[i]) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> //required
// #include <ext/pb_ds/tree_policy.hpp> //required

// using namespace __gnu_pbds; 
using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
// template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;  // ordered_set <long long> s; // order_of_key(value)

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define st first
#define nd second


const long long N = 100100;
long long n, k, m, a[N], b, x, ans;

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

	cin >> n >> x;
	for(long long i = 1; i <= n; i++) {
		cin >> a[i];
		long long g = max(0LL, a[i] + a[i - 1] - x);
		ans += g;
		a[i] -= g;
	}
	cout << ans << '\n';
}	


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int ans;
int n, a[maxn];

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

  cin>>n;
  vector<pair<int,int>> v;
  for (int i=1; i<=n; i++) {
    int x; cin>>x;
    v.push_back({x,i});
  }
  sort(v.begin(), v.end());
  for (auto p: v) cout<<p.second<<" ";
  cout<<endl;
  

  return 0;
}


Measured memory_bytes: 1780
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<vector>
using namespace std;
#define N 33000
bool prime[N];
//vector<int> primes;

void init(){
	//primes.clear();
	memset(prime,true,sizeof(prime));
	prime[0] = prime[1] = false;
	for(int x=2;x<N;++x){
		if(prime[x]){
			//primes.push_back(x);
			for(int i=x+x;i<N;i+=x){
				prime[i] = false;
			}
		}
	}
}

int main(){
	init();
	int c;
	while(cin>>c,c){
		int cnt = 0;
		for(int x=0;x<c/2+1;++x){
			if(prime[x] && prime[c-x]){
				cnt++;
				//cout<<x<<":"<<c-x<<endl;
			}
		}
		cout<<cnt<<endl;	
	}
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;

int MOD=1e9+7;
ll INF=1e18;

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

int dp[10010];

int main(){
    int n, w; cin>>n>>w;
    int val[n+10], wei[n+10], m[n+10];
    for(int i=0; i<n; i++) cin>>val[i]>>wei[i]>>m[i];

    for(int i=0; i<n; i++){
        for(int k=0; m[i]>0; k++){
            int key=min(m[i], (int)(1<<k));
            m[i]-=key;

            for(int j=w; j>=key*wei[i]; j--){
                dp[j]=max(dp[j], dp[j-key*wei[i]]+key*val[i]);
            }
        }
    }

    int ans=0;
    for(int i=0; i<=w; i++) ans=max(ans, dp[i]);
    cout << ans << endl;
}


Measured memory_bytes: 3068
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<climits>
#include<map>
#define ll long long
using namespace std;
int main() {
	string s;
	cin >> s;
	set<ll>a;
	for (ll i = 0; i < s.size(); i++) {
		a.insert(s[i]);
	}
	if (a.size() == s.size()) {
		cout << "yes" << endl;
	}
	else {
		cout << "no" << endl;
	}
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    int k = sc.nextInt();
    if (e - a > k) {
      System.out.println(":(");
    } else {
      System.out.println("Yay!");
    }
  }
}


Measured memory_bytes: 22740
#include <iostream>
#include <string>
#include <cctype>
#include <memory>
#include <vector>
#include <array>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <math.h>

//auto in = freopen("input", "r", stdin);

using namespace std;

struct Value{
	Value(long long v, long long count=1) : count(count), v(v){};
	int count;
	long long v;
};

int main(){
	cout << setprecision(20);
	while(true){
		long long n, m, k, sum = 0;
		cin >> n >> m >> k;
		if(n==0 && m==0 && k==0) break;
		stack<Value> s;
		
		s.push(Value(0,0));

		while(!s.empty()){
			auto v = s.top(); s.pop();
			if(v.count==n){
				sum += v.v-k>0 ? v.v-k : 1;
				continue;
			}
			for(int i=1; i<=m; ++i){
				auto nv = v.v + i;
				s.push(Value(nv, v.count+1));
			}
		}
		cout << sum/pow((long double)m,n) << endl;
	}
}

Measured memory_bytes: 1456
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

// 因数分解
inline vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

//階乗
inline ll factorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

inline ll vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
        
        
    }
    else { // 発見できなかったとき
        return 0;
    }
}

void recursive_comb(ll *indexes, ll s, ll rest, std::function<void(ll *)> f) {
    if (rest == 0) {
        f(indexes);
    } else {
        if (s < 0) return;
        recursive_comb(indexes, s - 1, rest, f);
        indexes[rest - 1] = s;
        recursive_comb(indexes, s - 1, rest - 1, f);
    }
}

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

int main(){
    ll ans = 0;
    ll h, n;
    cin >> h >> n;
    priority_queue<ll> a;
    rep(i, n){
        ll x;
        cin >> x;
        a.push(x);
    }
    
    rep(i, n){
        ans += a.top();
        a.pop();
    }
    
    if(ans >= h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    vector <int> A(no_of_elements + 1);
    for(int i = 1; i <= no_of_elements; i++)
        cin >> A[i];

    const int oo = 1e9;
    int negative_count = 0, minimum_element = oo;
    long long sum = 0;
    for(int i = 1; i <= no_of_elements; i++)
    {
        sum += abs(A[i]);

        negative_count += (A[i] < 0);

        minimum_element = min(minimum_element, abs(A[i]));
    }

    if(negative_count%2 == 1)
    {
        sum -= 2*minimum_element;
    }

    cout << sum;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(){
    int M, D;
    while(cin >> M >> D){
        int res = 0;
        for(int i=10;i<=D;i++){
            int d1 = (i/10);
            int d10 = (i%10);
            if(d1 < 2 || d10 < 2) continue;
            if(d1 * d10 <= M) ++res;
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

static const int N1 =1000;
void trace(int A[], int n){
  int i;
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main()
{
  int N, i, j, swap, minj, count = 0;
  int A[N1];
  scanf("%d", &N);
  for(i = 0; i < N; i++) scanf("%d", &A[i]);

  for(i = 0; i < N-1; i++){

    minj = i;
    for(j =i; j <= N-1; j++){
      if( A[j] < A[minj] ){
	minj = j;
      }
    }
	if(minj != i){
	swap = A[i];
	A[i] = A[minj];
	A[minj] = swap;
	minj = i;
	count++;
	
      }
     
    }
  trace(A, N);
  printf("%d\n", count);  
  
  return 0;
}

  

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

namespace ABC167
{
    public class Solve
    {
        public static void Main(string[] args)
        {
            new ABC_A();
        }
    }
    public class ABC_A
    {
        public ABC_A()
        {
            var s = Ex.Read;
            var t = Ex.Read;

            bool b = s.Length + 1 == t.Length;
            int i = 0;
            while (b && i < s.Length)
            {
                b &= s[i] == t[i];
                i++;
            }

            (b ? "Yes" : "No").Cw();
        }
    }
    public class ABC_B
    {
        public ABC_B()
        {
        }
    }
    public class ABC_C
    {
        public ABC_C()
        {
        }
    }
    public class ABC_D
    {
        public ABC_D()
        {
        }
    }
    public class ABC_E
    {
        public ABC_E()
        {
        }
    }
    public class ABC_F
    {
        public ABC_F()
        {
        }
    }
    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }

        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static string yesno(this bool b) { return b ? "yes" : "no"; }
        public static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        public static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public static int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public static long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


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

int main() {
    ll a, b, k;
    cin >> a >> b >> k;
    if (a >= k) {
        cout << a - k << " " << b << endl;
    } else if (b-(k-a) >= 0) {
        cout << 0 << " " << b-(k-a) << endl;
    } else {
        cout << "0 0" << endl;
    }
    return 0;
}

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

#define DIV 1000000007
long long n, k;

long long kaidan[10000005];

void kaical(long long n){
	kaidan[0] = 1;
	for(long long i = 1; i < n; i++){
		kaidan[i] = kaidan[i-1] * i;
		kaidan[i] %= DIV;
	}
}

long long modpow(long long ori, long long po){
	long long res = 1;
	while(po > 0){
		if(po&1){
			res *= ori;
			res %= DIV;
		}
		ori *= ori;
		ori %= DIV;
		po >>= 1;
	}
	return res;
}

//nCk
long long combination(long long n, long long k){
	if(n == 0 && k == 0)return 1;
	if(n < k || n < 0)return 0;
	long long n_kai = kaidan[n];
	long long k_kai = kaidan[k];
	long long nmk_kai = kaidan[n-k];

	long long ans = n_kai * modpow(k_kai, DIV - 2);
	ans %= DIV;
	ans *= modpow(nmk_kai, DIV-2);
	ans %= DIV;
	return ans;
}

int main(){
	cin >> n >> k;
	kaical(n + 5);

	long long ans = 0;
	for(long long zero = 0; zero <= min(n-1, k); zero++) {
		long long hako = n - zero;
		ans += combination(zero + hako-1, zero) * combination(n, zero);
		ans %= DIV;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5204
#include <bits/stdc++.h>
using namespace std;
  
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

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

    ll a, b, n;
    cin >> a >> b >> n;

    cout << min(n, (b - 1)) * a / b;

    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define forn for(int i=0;i<n;i++)
#define pb push_back
#define pr pair<int,int>
#define mp make_pair
#define ll long long int
const int mod=1e9+7;
int main(){
    ll n;
    cin>>n;
    ll a[n];
    map<ll,ll>m;
    for(ll i=0;i<n;i++){cin>>a[i];m[a[i]]++;}
    ll ans=0;
    for (auto itr=m.begin(); itr!=m.end();++itr){
            ll x=itr->second;
            if(x<2)ans+=0;
            else ans+=(x*(x-1)/2);
        }
    for(ll i=0;i<n;i++){
     ll q=m[a[i]];
     ll w=q-1;
     //cout<<q<<" "<<w;
     ll sol;
     if(q<2)sol=ans-0;
      else sol= ans-(q*(q-1)/2);
      //cout<<sol;
     if(w<2)sol+=0;
      else sol+=(w*(w-1)/2);
     cout<<sol<<endl;
    }
    
}

Measured memory_bytes: 11008
/*
ABHIJEET BISWAS
CSE (2017-2021)
MNNIT ALLAHBAD
*/

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e15
#define ll long long
#define ld long double
#define int ll
#define pii pair<int,int>
#define pli pair<long long,int>
#define pll pair<long long,long long>
#define MAX 1000009
#define pb push_back
#define mp map<int,int>
#define F first
#define S second
#define popi __builtin_popcount
#define popll __builtin_popcountll
#define grp vector<int> graph[MAX];
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

//////////////////////TEMPLATE ENDS///////////////////////////////////////////////////////////////////////
ll power(ll,ll);
ll mpower(ll,ll);
//////////////////////////////////////////////////////////////////////////////////////////////////////////
int n,k;
int dp[101][100008];
int pref[101][100008];
int arr[100003];




int32_t main() {
	fastIO

	cin >> n >> k;

	for(int i=1;i<=n;i++) cin >> arr[i];
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=k;j++)
		{
			if(j>arr[i])
				dp[i][j] = (dp[i-1][j] - dp[i-1][j-arr[i]-1]+MOD)%MOD; 
			else
				dp[i][j] = (dp[i-1][j]);
			if(j>0)
			dp[i][j] = (dp[i][j]+dp[i][j-1])%MOD;
		}
	}
	

	cout << dp[n][k] << endl;

	return 0;
}







/*_________________________________________________Utility Functions HERE_______________________________*/

ll power(ll a,ll b)
{
	ll res=1;
	while(b>0)
	{
		if(b%2==1)
		res=res*a;
		a=a*a;
		b=b/2;
	}
	return res;
}
ll mpower(ll a ,ll b)
{
	ll res=1;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%MOD;
		}
		a=(a*a)%MOD;
		b=b/2;
	}
	return res;
}

Measured memory_bytes: 81024
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

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

int N,M;
int A[SIZE],B[SIZE];
vector<int> G[SIZE];
string S;

int main()
{
	cin >> N >> M >> S;
	rep(i,0,M){
		int a,b;
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
		if(S[b-1]=='A'){
			A[a]++;
		}else{
			B[a]++;
		}
		if(S[a-1]=='A'){
			A[b]++;
		}else{
			B[b]++;
		}
	}
	int cnt = 0;

	queue<int> Q;
	rep(i,1,N+1){
		if(A[i]==0 || B[i]==0){
			Q.push(i);
			cnt++;
		}
	}

	while(!Q.empty()){
		int v = Q.front();Q.pop();
		for(int c : G[v]){
			if(S[v-1]=='A'){
				A[c]--;
				if(A[c]==0 && B[c]>0){
					Q.push(c);
					cnt++;
				}
			}else{
				B[c]--;
				if(B[c]==0 && A[c]>0){
					Q.push(c);
					cnt++;
				}
			}
		}
	}
	if(N != cnt){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 12420
#include <iostream>

using namespace std;

int main()
{
    while(true){
        double xa, ya, xb, yb, xc, yc, xd, yd;
        if(!(cin>>xa)) break;
        cin.ignore();
        cin>>ya;
        cin.ignore();
        cin>>xb;
        cin.ignore();
        cin>>yb;
        cin.ignore();
        cin>>xc;
        cin.ignore();
        cin>>yc;
        cin.ignore();
        cin>>xd;
        cin.ignore();
        cin>>yd;
    
        double pc = (xb-xd)*(yc-yd)-(yb-yd)*(xc-xd);
        double qc = (xa-xd)*(yc-yd)-(ya-yd)*(xc-xd);
        double  m = (xa-xc)*(yb-yd)-(ya-yc)*(xb-xd);
        
        double p=pc/m, q=qc/m;
        if(0<=p&&p<=1 && 0<=q&&q<=1) cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}

Measured memory_bytes: 3148
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            var asciiCodeOfZ = (int)'Z';
            var sb = new StringBuilder(N);
            
            foreach (var c in S)
            {
                var asciiCode = (int)c + N;
                if (asciiCode > asciiCodeOfZ)
                {
                    asciiCode -= 26;
                }

                sb.Append((char)asciiCode);
            }

            Console.WriteLine(sb.ToString());
        }
    }
}


Measured memory_bytes: 13184
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    int A,B;
    cin>>A>>B;

    if(A<=8&&B<=8){
        cout<<"Yay!"<<endl;
    }
    else{
        cout<<":("<<endl;
    }
}


Measured memory_bytes: 256