akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        N = cin.nextint;
        int K = cin.nextint;
        int sum = 0;
        for (int i = 0; i < N; i++)
        {
            int x = cin.nextint;
            sum += Min(x, Abs(K - x));
        }
        WriteLine(sum * 2);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
 
 
const int INF = 1000000;
 

int main(){
	int n, m;
	cin>>n>>m;
	vi v(n, 0);
	vi u(n, 0);
	for(int i = 0; i < n; i++) cin>>v[i];
	int a;
	for(int i = 0; i < m; i++){
		cin>>a;
		for(int i = 0; i < n; i++){
			if(v[i] <= a){
				//cout<<" "<<i;
				u[i]++;
				break;
			}
		}
	}
	//cout<<endl;
	int ans = 0;
	for(int i = 1; i < n; i++){
		if(u[ans] < u[i]) ans = i;
	}
	cout<<ans+1<<endl;
}

Measured memory_bytes: 1204
N, Q = map(int, input().split())

S = input()
D = [0]
s = 0
for i in range(len(S) - 1):
    if S[i:i + 2] == "AC":
        s += 1
    D.append(s)

for _ in range(Q):
    l, r = map(int, input().split())
    print(D[r - 1] - D[l - 1])


Measured memory_bytes: 6100
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]
#(ord('A'))でASCII出力 Aは65
import math
import statistics
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

def repeatsurplus(x,y,z): #xのy乗をzで割ったあまりを高速に求める
    ret = 1
    m = y
    tmp = x
    for i in range(100000):
        if m == 1:
            ret = (ret * tmp) % z
            break
        if m % 2 == 1:
            ret = (ret * tmp) % z
        m = m // 2
        tmp = (tmp * tmp) % z
    return(ret)

def factorialsurplus(x,y,z): #xからyまでの階乗をzで割ったあまりを求める
    ret = 1
    for i in range(x, y+1):
        ret = (ret * i) % z
    return(ret)
    
    
    
n,a,b = splitintinput()
de = 10 ** 9 + 7
ans = repeatsurplus(2,n,de) - 1
ansa = factorialsurplus(n-a+1, n, de) * repeatsurplus(factorialsurplus(1, a, de), de-2, de)
ansb = factorialsurplus(n-b+1, n, de) * repeatsurplus(factorialsurplus(1, b, de), de-2, de)
print((ans-ansa-ansb+2*de)%de)



Measured memory_bytes: 5640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	lint N, M;
	cin >> N >> M;
	lint ans = (N * 2 + M) / 4;
	ans = min(ans, M / 2);
	cout << ans << endl;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define INF 1e9
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

int main(void){
	ll r,D,x;
	scanf("%lld%lld%lld",&r,&D,&x);
	for(int i=0;i<10;i++){
		printf("%lld\n",r*x-D);
		x = r*x-D;
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2000000000
#define ninf -2000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int h[100005];
int dp[100005];
int n;
int compute(int i)
{
    if(i>n-1) return inf;
    if(i==n-1) return 0;
    if(dp[i]!=-1) return dp[i];
    int ans = inf;
    ans = MIN2(ans, abs(h[i] - h[i+1])+compute(i+1));
    ans = MIN2(ans, abs(h[i] - h[i+2])+compute(i+2));
    return dp[i] = ans;
}
int main()
{
    she_told_me_dont_worry
    cin>>n;
    int i;
    FOR0(i, n) cin>>h[i];
    FOR0(i, n) dp[i] = -1;
    cout<<compute(0);
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 5760
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;


public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskT solver = new TaskT();
        solver.solve(1, in, out);
        out.close();
    }
    
    

    static class TaskT {
    	static int counter = 0;
        public void solve(int testNumber, InputReader in, PrintWriter out) {

        	int K = in.nextInt();
        	String result = "";
        	String sub = "ACL";
        	for(int i = 0; i < K; i++){
        		result = result + sub;
        	}
        	out.println(result);
        	
        }
        
     
        
        

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 37320
#include<stdio.h>
int main(void)
{
    int  i,a,b,c,x,y;
	
	while(scanf("%d %d",&a,&b)!=EOF){
		x=a;	y=b;
		if(a<b){
			c=a;
			a=b;
			b=c;
		}
		c=a%b;
		while(c!=0){
			a=b;
			b=c;
			c=a%b;
		}
		i=x/b*y;
		printf("%d %d\n",b,i);
	}
	return 0;
}

Measured memory_bytes: 2624
mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
ans = 0
fact = [i for i in range(n+1)]
fact[0] = 1
for i in range(n):
  fact[i+1] *= fact[i]
  fact[i+1] %= mod
tmp = [None] * n
tmp[0] = 0
for i in range(1,n):
	tmp[i] = (tmp[i-1] + fact[n-1] * pow(i,mod-2,mod)) % mod
for i in range(1,n):
  ans += (a[i]-a[i-1]) * tmp[i]
  ans %= mod
print(ans)


Measured memory_bytes: 63384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;

typedef long long ll;
const int mod = 1e9 + 7;
int X, Y;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
    cin >> X >> Y;
    if ((X + Y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }

    int n = (X + Y) / 3;
    X -= n;
    Y -= n;
    if (X < 0 || Y < 0) {
        cout << 0 << endl;
        return 0;
    }

    combination c(X + Y);
    mint ans = c(X + Y, X);

    cout << ans.x << endl;
}

Measured memory_bytes: 10624
N = int(input())
A_list = list(map(int, input().split()))
ball = [0] * N
ans = 0

for A in A_list:
    ans += ball[A - 1]
    ball[A - 1] += 1
    

[print(ans - (ball[A_list[k] - 1]) + 1) for k in range(N)]
    



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

int main() {
  int n;
  cin>>n;
  string ans="No";
  for(int i=0;i<=15;i++){
    int x=n-i*7;
    if(x>=0 && x%4==0) ans="Yes";
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+10,K=2010,KK=2000,KK2=4000,KK4=8000;
const ll P=1e9+7;
int a[N],b[N];
ll dp[K<<1][K<<1];
ll fac[K<<2],inv[K<<2];
ll pwr(ll x,ll y){
	ll z=1;
	for(;y;y>>=1){
		if(y&1)z=z*x%P;
		x=x*x%P;
	}
	return z;
}
inline void getfac(int n){
	fac[0]=1;
	for(int i=1;i<=n;++i)
		fac[i]=fac[i-1]*i%P;
	inv[n]=pwr(fac[n],P-2);
	for(int i=n;i;--i)
		inv[i-1]=inv[i]*i%P;
}
inline ll C(int n,int m){
	return fac[n]*inv[m]%P*inv[n-m]%P;
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d%d",&a[i],&b[i]);
		(++dp[KK-a[i]][KK-b[i]])%=P;
	}
	for(int i=0;i<=KK2;++i)
		for(int j=0;j<=KK2;++j)
			(dp[i][j]+=dp[i-1][j]+dp[i][j-1])%=P;
	ll ans=0;
	for(int i=1;i<=n;++i)
		(ans+=dp[KK+a[i]][KK+b[i]])%=P;
	getfac(KK4);
	for(int i=1;i<=n;++i)
		ans=(ans-C((a[i]<<1)+(b[i]<<1),a[i]<<1)+P)%P;
	ans=ans*pwr(2,P-2)%P;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128128
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <limits>
#include <cmath>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

const double PI = 3.14159265358979323846;

int main()
{
    ll A, B, H, M;
    scanf("%lld %lld %lld %lld", &A, &B, &H, &M);

    double mt = (double)M * PI / 30.0;
    double ht = (double)H * PI / 6.0 + mt / 12.0;

    double x = (double)A * cos(ht) - (double)B * cos(mt);
    double y = (double)A * sin(ht) - (double)B * sin(mt);
    double ans = sqrt(x * x + y * y);

    printf("%.20lf\n", ans);
}


Measured memory_bytes: 4132
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

ll modd = 1000*1000*1000+7;

template<class T>
T fastpower(T a, long long n) {  // n must be >= 1
  if (n==0) {return 1;}
  if (n % 2 == 0) {  
      T halfpower = fastpower<T>(a, n/2);
      return (halfpower*halfpower) % modd;
  } else {
      if (n == 1) {  return a; } else {  
          T halfpower = fastpower<T>(a, n/2);
          return (((halfpower*halfpower) % modd)*a) % modd;
      }
  }
};


int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
 
//    auto start = chrono::steady_clock::now();
  
//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readll(n); readll(m);

        ll ret = 0;
        ll binn = 1, sign = 1;
        ll tot = 1;
        for(ll k = 0; k < n; ++k) {
            tot *= (m-k); tot = tot % modd;
        }
        tot = tot*tot; tot = tot % modd;
        for(ll k = 0; k <= n; ++k) {

            ll temp = tot * binn; temp = temp % modd; temp *= sign; temp = temp % modd;
            ret += temp; ret = ret % modd;

            if (sign==1) {sign=modd-1;} else {sign = 1;}
            binn *= (n-k); binn = binn % modd; binn *= fastpower<ll>((k+1), modd-2); binn = binn % modd;
            tot *= fastpower<ll>(m-k, modd-2); tot = tot % modd;
        }

        cout << ret << endl;
    }
 
//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;
 
    return 0;
}

Measured memory_bytes: 3604
/**
 *    AUTHOR:    crypter472                    
 *   CREATED:   21.04.2020 20:33:09  
**/

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEFINE
#include "../../DEBUG.hpp"
#endif

const double eps = 1e-3;

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(3);
  cout << fixed;
  double a, b, c, d, e, f;
  while (cin >> a >> b >> c >> d >> e >> f) {
    double x = (b * f - c * e) / (b * d - a * e);
    double y = (d * c - a * f) / (b * d - a * e);
    if (abs(x) <= eps) x = abs(x);
    cout << x << " " << y << '\n';
  }
  return 0;
}




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

int main() {
    int H, W; std::cin >> H >> W;
    std::vector<std::vector<char>> m(H, std::vector<char>(W));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            std::cin >> m[i][j];
        }
    }

    const std::vector<std::pair<int, int>> dd {{1,0}, {-1,0}, {0,1}, {0,-1}};

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (m[i][j] == '.') {
                continue;
            }

            bool ok = false;
            for (const auto& d: dd) {
                int di = i+d.first;
                int dj = j+d.second;
                if (di < 0 || H <= di || dj < 0 || W <= dj) {
                    continue;
                }
                if (m[di][dj] == '#') {
                    ok = true;
                    break;
                }
            }
            if (!ok) {
                std::cout << "No" << std::endl;
                return 0;
            }
        }
    }

    std::cout << "Yes" << std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final char[] s = scanner.nextLine().toCharArray();
        List<Long> words = new ArrayList<>();

        char current = s[0];
        long tmp = 0;
        for (final char c : s) {
            if (c == current) {
                tmp++;
            } else {
                words.add(tmp);
                current = c;
                tmp = 1;
            }
        }
        words.add(tmp);

        long result = 0;
        if (s[0] == '>') {
            result += words.get(0) * (words.get(0) + 1) / 2;
            words.remove(0);
        }
        for (int i = 1; i < words.size(); i = i + 2) {
            final long max = Math.max(words.get(i - 1), words.get(i));
            final long min = Math.min(words.get(i - 1), words.get(i));
            result += max * (max + 1) / 2;
            result += min * (min - 1) / 2;
        }

        if (s[s.length - 1] == '<') {
            final long end = words.get(words.size() - 1);
            result += end * (end + 1) / 2;
        }

        System.out.println(result);
    }
}


Measured memory_bytes: 35036
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i,a,b) for(int i=(a);i<=(b);++i)
#define FD(i,b,a) for(int i=(b);i>=(a);--i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;
constexpr int inv(LL x, int m) { return x > m ? inv(x % m, m) : x > 1 ? inv(m % x, m) * (m - m / x) % m : x; }
constexpr int mpow(LL a, LL k, int m) { int r(1); for (a %= m; k; k >>= 1, a = a * a % m) if (k & 1)r = r * a % m; return r; }

int main() {
    LL n, p;
    cin >> n >> p;
    if (n == 1) cout << p << endl;
    else {
        LL ans = 1;
        for (LL i = 2;; i++) {
            LL x = 1;
            bool ok = true;
            for (LL j = 1; j <= n; j++) {
                x *= i;
                if (x > p) {
                    ok = false;
                    break;
                }
            }
            if (!ok) break;
            if (p % x == 0) ans = i;
        }
        cout << ans << endl;
    }
}


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

#define ll long long
#define ld long double
#define FOR(x,y) for(ll i=x;i<=y;i++)
#define pb(x) push_back(x)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define matrix(x) vector<vector<x>>
#define vss vector<string>
#define PI (2*acos(0.0))
#define sqr(x) ((x)*(x))
#define sf(a)   scanf("%d",&a)
#define sfl(a)  scanf("%lld",&a)
#define sff(a,b)    scanf("%d %d",&a,&b)
#define sffl(a,b)   scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)    scanf("%lld %lld %lld",&a,&b,&c)
#define ms(a,b) memset(a, b, sizeof(a))
#define ff  first
#define ss  second
#define lcm(a, b)   ((a)*((b)/__gcd(a,b)))
#define all(a)  a.begin(),a.end()
#define readfile freopen("input.txt","r",stdin);
#define writefile freopen("output.txt","w",stdout);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define gap " "
#define mx 104
#define inf (ll)1e9
#define WHITE 1
#define GRAY 2
#define BLACK 3
#define EMPTY_VALUE -1
#define mod 1000000007
#define MOD(a,b) (a%b + b)%b

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

ll x,k;
vll a;

bool possible(ll mid)
{
    if(mid<=0) return false;
    ll cnt = 0;
    for(ll i=0;i<x;i++)
    {
        if(a[i]<=mid) continue;
        cnt += ceil(a[i]/(mid+0.0))-1;
        //cnt += (a[i]-1)/mid;
    }
    return cnt<=k;
}

int main()
{
    //fastio
    sffl(x,k);
    a.resize(x+1);
    for(ll i=0;i<x;i++) sfl(a[i]);
    ll mini = 0,maxi = 1e9+100;
    
    while (mini<maxi)
    {
        ll mid = (mini+maxi)/2;
        //cout<<mid<<endl;
        if(possible(mid))
        {
            maxi = mid;
        }
        else
        {
            mini = mid+1;
        }
    }
    cout<<mini<<endl;
    

    return 0;
}

Measured memory_bytes: 4872
#include <functional>
#include <iostream>
#include <vector>

#include <cstdint>

constexpr bool parity64(std::uint_fast64_t c) noexcept {
#ifdef _GNUC_
  return __builtin_parityll(c);
#else
  c ^= c >> 1;
  c ^= c >> 2;
  return ((c & 0x1111111111111111) * 0x1111111111111111 >> 60 & 0x1) != 0;
#endif
}

int main() {
  int n;
  std::cin >> n;
  std::vector<std::vector<int>> t(n);
  for (int i = 0; i != n - 1; i += 1) {
    int a, b;
    std::cin >> a >> b;
    a -= 1;
    b -= 1;
    t[a].push_back(b);
    t[b].push_back(a);
  }
  int m;
  std::cin >> m;
  const int s = 1 << m;
  std::vector<int> z(s, 0);
  {
    std::vector<int> x(n, 0);
    for (int i = 0; i != m; i += 1) {
      int u, v;
      std::cin >> u >> v;
      u -= 1;
      v -= 1;
      x[u] ^= 1 << i;
      x[v] ^= 1 << i;
    }
    std::function<void(int, int)> dfs = [&](int v, int p) {
      for (int e : t[v]) {
        if (e == p)
          continue;
        dfs(e, v);
        z[x[e]] += 1;
        x[v] ^= x[e];
      }
    };
    dfs(0, n);
  }
  for (int w = 1; w != s; w <<= 1) {
    for (int i = 0; i != s; i += w << 1) {
      for (int j = 0; j != w; j += 1) {
        z[i + j + w] += z[i + j];
      }
    }
  }

  long long ans = 0;
  for (int i = 0; i != 1 << m; i += 1) {
    auto res = 1LL << z[s - 1 ^ i];
    if (parity64(i))
      res = -res;
    ans += res;
  }
  std::cout << ans << std::endl;
}

Measured memory_bytes: 4352
using System;

namespace AOJ.Volume1
{
    public class MostPopularShop
    {
        public static int Main()
        {
            while (true)
            {
                var input = Console.ReadLine().Split(' ');
                int bef = int.Parse(input[0]);
                int aft = int.Parse(input[1]);
                if(bef == 0) { break; }

                char ans = 'A';
                int sales = bef + aft;
                for(char i = 'B'; i <= 'E'; i++)
                {
                    input = Console.ReadLine().Split(' ');
                    bef = int.Parse(input[0]);
                    aft = int.Parse(input[1]);
                    int tmp_sales = bef + aft;
                    if (tmp_sales > sales)
                    {
                        ans = i;
                        sales = tmp_sales;
                    }
                }

                Console.WriteLine(ans.ToString() + " " + sales);
            }
            return 0;
        }
    }
}

Measured memory_bytes: 9148
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
constexpr int MOD = 1000003;
int extgcd(int a, int b, int &x, int &y) {
  int d = a;
  if (b != 0) {
    d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  } else {
    x = 1; y = 0;
  }
  return d;
}

int mod_inv(int a) {
  int x, y;
  extgcd(a, MOD, x, y);
  return (MOD + x % MOD) % MOD;
}

int pow_mod(int x, int y) {
  int res = 1;
  for(; y > 0; y >>= 1, (x *= x) %= MOD) {
    if(y & 1) (res *= x) %= MOD;
  }
  return res;
}

int fact[MOD];
int inv[MOD];

void init() {
  fact[0] = 1;
  inv[0] = 0;
  for (int i = 1; i < MOD; i++) {
    fact[i] = (fact[i - 1] * i) % MOD;
    inv[i] = mod_inv(i);
  }
}

signed main() {
  init();
  int Q; cin >> Q;
  while(Q--) {
    int x, d, n; cin >> x >> d >> n;
    if (d == 0) {
      int ans = pow_mod(x, n);
      cout << ans << endl;
      continue;
    }
    int dn = pow_mod(d, n);
    int xd = (x * inv[d]) % MOD;
    if (xd <= MOD && MOD <= xd + n - 1) {
      cout << 0 << endl;
      continue;
    }
    int numer = fact[xd + n - 1];
    int denom = fact[xd - 1];
    int frac = (numer * inv[denom]) % MOD;
    int ans = (dn * frac) % MOD;
    cout << ans << endl;
  }
}


Measured memory_bytes: 16512
import java.io.PrintWriter
import java.math.BigDecimal
import java.util.*

val pw = PrintWriter(System.out)
val sc = Scanner(System.`in`)

fun main(args: Array<String>) {
    val n = sc.nextInt()
    val k = sc.nextInt()
    val q = sc.nextInt()
    val arr = Array(n){k - q}
    val points = Array(q){sc.nextInt()}
    abc141c(n,k,q,arr, points)
}

fun abc141c(n: Int, k: Int, q:Int, arr: Array<Int>, points: Array<Int>) {
    for (i in 0 until q){
        arr[points[i]-1] += 1
    }
    for(i in 0 until n){
        if(arr[i] > 0){
            println("Yes")
        }else{
            println("No")
        }
    }
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }



Measured memory_bytes: 67740
# include <bits/stdc++.h>
#define ll long long
using namespace std;


long long n,a,m,k,q,b,c,a1,a2,b1,b2;
float qq,ww,ff=2,qs;
string ss,s1,s2;
int main(){
    cin>>n;
    set<ll>st;
    for (int i=0; i<n; i++){
        cin>>a;
        st.insert(a);
    }
    if (st.size()==n){
        cout<<"YES";
    }
    else{
        cout<<"NO";
    }
}


Measured memory_bytes: 9600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

char s[100005];
char t[20] = " keyence";
int main() {
    scanf("%s", s + 1);
    int a = 7, b = 7;
    for (int i = 1; i <= 7; ++i) {
        if (s[i] != t[i]) {
            a = i - 1;
            break;
        }
    }
    int len = strlen(s + 1);
    for (int i = 0; i < 7; ++i) {
        if (s[len - i] != t[7 - i]) {
            b = i;
            break;
        }
    }
    if (a + b >= 7) puts("YES");
    else puts("NO");
    return 0;
}

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

int main()
{
	int num1,num2,num3,num4,num5,num6,num7,num8,num9,num10,num11,num12,num13;
	int sum;

	for(int i=0;i<150;i++){
	cin>>num1;
	if(num1==0){
		return 0;
	}
	num2=1000-num1;
	num3=num2/500;
	num4=num2%500;
	num5=num4/100;
	num6=num4%100;
	num7=num6/50;
	num8=num6%50;
	num9=num8/10;
	num10=num8%10;
	num11=num10/5;
	num12=num10%5;
	num13=num12/1;
	sum=num3+num5+num7+num9+num11+num13;
	cout<<sum;
	cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"

#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0);}

#define SHOW(x) std::cout << #x << " = " << x << std::endl;

inline int safe_mul(const int x, const int y) __attribute__ ((warn_unused_result));

int main()
{
//    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios_base::sync_with_stdio(false);

    int a = 0;
    for(int i = 0; i < 3; ++i)
    {
        a *= 10;
        int y;
        cin >> y;
        a += y;
    }
    cout << (a % 4 ? "NO" : "YES") << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int D = sc.nextInt();
		int X = sc.nextInt();
		
		int[] A = new int[N + 1];
		
		for(int i = 1; i <= N; i++) {
			A[i] = sc.nextInt();
		}
		
		int sum = 0;
		
		for(int i = 1; i <= N; i++) {
			for(int j = 0; j < 101; j++) {
				if(j * A[i] + 1 <= D) {
					sum++;
				} else {
					break;
				}
			}
		}
		System.out.println(sum + X);
	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
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;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int ans = 0, a[MAX];
bool used[MAX];

void dfs(int v){
    if(used[v]) return;
    used[v] = true;
    if(a[a[v]] == v){
        ++ans;
        used[a[v]] = true;
        return;
    }
}

int main(){
    int n;
    scanf("%d", &n);
    memset(used, false, sizeof(used));
    rep(i, n){
        scanf("%d", &a[i]);
        --a[i];
    }
    rep(i, n) dfs(i);
    printf("%d\n", ans);
}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 1000000007LL;
const int Maxn = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

ll n;
ll x[Maxn], y[Maxn];
map<pll, ll> mp;

ll solve(ll p, ll q){
	
	if(p == 0 && q == 0) return n;
	ll res = n;
	for(int i = 1; i <= n; i++){
		res -= (mp.count({x[i] + p, y[i] + q}));
	}
	return res;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> x[i] >> y[i];
		mp[{x[i],y[i]}] = 1;
	}
	ll ans = n;
	for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) ans = min(ans, solve(x[i] - x[j], y[i] - y[j]));
	cout << ans;
	return 0;
}
/*
1
5 1
20 21 22 23 24

1
4 2 
1 2 3 4

2 4 1 3

*/


Measured memory_bytes: 256
# coding: utf-8
#解法1 ABのK番まで　＋　CのK番まで
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

AB=[]

for i in range(X):
    for j in range(Y):
        AB.append(A[i]+B[j])

AB.sort(reverse=True)
C.sort(reverse=True)

ABC=[]

for i in range(min(K,X*Y)):
    for j in range(min(K,Z)):
        ABC.append(AB[i]+C[j])

ABC.sort(reverse=True)

for i in range(K):
    print(ABC[i])


Measured memory_bytes: 147936
#include<iostream>
    #include<string.h>
     
    using namespace std;
     
    int main(){
        char str[10000];
        int w;
        cin >> str;
        cin >> w;
        for(int a = 0; a < strlen(str); a = a + w)cout << str[a];
        cout << endl;
        return 0;
    }

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

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}

vector<int> p;
vector<int> r;

void init(int n) {
  p.reserve(n);
  r.reserve(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
    r[i] = 0;
  }
}

int root(int x) { return p[x] == x ? x : p[x] = root(p[x]); }

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

void unite(int x, int y) {
  x = root(x);
  y = root(y);
  if (x == y)
    return;

  if (r[x] < r[y])
    p[x] = y;
  else {
    p[y] = x;
    if (r[x] == r[y])
      r[x]++;
  }
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<long long> x(N), y(N), z(N);
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i] >> z[i];
  }

  int a[] = {1, -1, 1, -1, 1, -1, 1, -1};
  int b[] = {1, 1, -1, -1, 1, 1, -1, -1};
  int c[] = {1, 1, 1, 1, -1, -1, -1, -1};
  long long ans = LONG_LONG_MIN;
  for (int i = 0; i < 8; i++) {
    vector<long long> v(N);
    long long tmp = 0;
    for (int j = 0; j < N; j++) {
      v[j] = a[i] * x[j] + b[i] * y[j] + c[i] * z[j];
    }
    sort(v.begin(), v.end(), ::greater<long long>());
    tmp = 0;
    for (int j = 0; j < M; j++) {
      tmp += v[j];
    }
    if (ans < tmp)
      ans = tmp;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::cmp::{min, max};
use std::mem::swap;
use std::collections::HashMap;

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

static DX: &'static [i32] = &[0, 0, 1, -1];
static DY: &'static [i32] = &[1, -1, 0, 0];

fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let x: i32 = read();

    if a <= x && x <= a + b {
        println!("YES");
    } else {
        println!("NO");
    }
}

fn pow_mod(mut n: u64, mut exp: u64, m: u64) -> u64 {
    let mut t = 1;

    n %= m;

    while exp > 1 {
        if exp & 1 == 1 {
            t *= n;
            t %= m;
        }

        n *= n;
        n %= m;
        exp >>= 1;
    }

    (n * t) % m
}

Measured memory_bytes: 4352
h,w=map(int,input().split())
gf=[['.']+list(input())+['.'] for _ in range(h)]
gf=[['.']*(w+2)]+gf+[['.']*(w+2)]
for i in range(1,h+1):
  for j in range(1,w+1):
    if gf[i][j]!='#':
      gf[i][j]=str([gf[i+s][j+t] for s in range(-1,2) \
                    for t in range(-1,2) if i!=0 or j!=0].count('#'))
for i in range(1,h+1):
  print(''.join(gf[i][1:w+1]))

Measured memory_bytes: 9204
# coding: utf-8
# Here your code !

def func():
    try:
        ringstr=input().rstrip()
        instr=input().rstrip()
    except:
        return inputError()

    while(True):
        ringstr+=ringstr
        if(len(ringstr) >= len(instr)*2):
            break
    
    print("Yes" if (instr in ringstr) else "No")

def inputError():
    print("input Error")
    return -1
 
func()

Measured memory_bytes: 7500
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    string a[55], b[55];
    for( int i = 0; i < n; ++i ) cin >> a[i];
    for( int i = 0; i < m; ++i ) cin >> b[i];

    bool flg = false;
    for( int i = 0; i < n - m + 1; ++i ) {
        for( int j = 0; j < n - m + 1; ++j ) {
            if( a[i][j] == b[0][0] ) {
                bool tmp_flg = true;
                for( int k = 0; k < m; ++k ) {
                    for( int l = 0; l < m; ++l ) {
                        if( b[k][l] != a[i + k][j + l] ) {
                            tmp_flg = false;
                            break;
                        }

                    }
                }
                if( tmp_flg ) {
                    flg = true;
                    break;
                }
            }
        }
    }

    if( flg ) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      
      //入力
      String s = sc.next();
      int length = s.length();
      char[] kaibun = s.toCharArray();
      int hug = 0;
      
      //回文になっていない文字を探す
      for(int i = 0; i <length/2; i++){
            if(kaibun[i]!=kaibun[length-1-i]){
            hug++;
            }
      }
       //ハグの最小回数を出力
      System.out.print(hug);
    }
}
   

Measured memory_bytes: 22612
import static java.lang.Math.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Double[]> l = new ArrayList<>();
        while (sc.hasNext()) {
            Double[] p = Stream.of(sc.next().split(",")).map(Double::parseDouble).toArray(Double[]::new);
            l.add(p);
        }
        double area = 0;
        for (int i = 0; i < l.size() - 2; i++) {
            double a = sqrt(pow(l.get(i + 1)[0] - l.get(i)[0], 2) + pow(l.get(i + 1)[1] - l.get(i)[1], 2));
            double b = sqrt(pow(l.get(l.size() - 1)[0] - l.get(i + 1)[0], 2) + pow(l.get(l.size() - 1)[1] - l.get(i + 1)[1], 2));
            double c = sqrt(pow(l.get(i)[0] - l.get(l.size() - 1)[0], 2) + pow(l.get(i)[1] - l.get(l.size() - 1)[1], 2));
            double z = (a + b + c) / 2;
            area += sqrt(z * (z - a) * (z - b) * (z - c));
        }
        System.out.println(area);
    }
}


Measured memory_bytes: 32080
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
#define INF 2147483647
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;

int main(){
	string s;
	cin>>s;
	map<char,int> m;
	for(int i=0;i<26;i++)m['a'+i]=0;
	for(int i=0;i<s.size();i++)m[s[i]]++;
	for(int i=0;i<26;i++){
		if(m['a'+i]%2==1){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
}

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

using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> c(N), t(N);
  for (int i = 0; i < N; i++) {
    cin >> c[i] >> t[i];
  }
  int ans = (int) 1e9;
  for (int i = 0; i < N; i++) {
    if (t[i] <= T) {
      ans = min(ans, c[i]);
    }
  }
  if (ans == (int) 1e9) cout << "TLE" << endl;
  else cout << ans << endl; 
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		//int m = sc.nextInt();
		//String s = sc.next();
		long count=1;
		long l=0,x=0;
		//String buff="";
		long[] array=new long[n];

		for(int i=0;i<n;i++) {
			array[i]=sc.nextInt();
		}
		x=array[0];
		for(int i=1;i<n;i++) {
			if(array[i]<=x) {
				count++;
				x=array[i];
			}
		}
		if(count==0) {
			System.out.println(1);
		}else {
			System.out.println(count);
		}
	}
}




Measured memory_bytes: 86036
from collections import defaultdict
from itertools import permutations


def main():
    N, M = map(int, input().split())
    s = set()
    for _ in range(M):
        a, b = map(int, input().split())
        s.add((a, b))
        s.add((b, a))
    ans = 0
    for x in permutations(range(2, N + 1)):
        now = 1
        for i in range(len(x)):
            if (now, x[i]) not in s:
                break
            now = x[i]
        else:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
x = int(input())

if 400 <= x < 600:
    ans = '8'
elif 600 <= x < 800:
    ans = '7'
elif 800 <= x < 1000:
    ans = '6'
elif 1000 <= x < 1200:
    ans = '5'
elif 1200 <= x < 1400:
    ans = '4'
elif 1400 <= x < 1600:
    ans = '3'
elif 1600 <= x < 1800:
    ans = '2'
elif 1800 <= x < 2000:
    ans = '1'

print(ans)


Measured memory_bytes: 9180
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main()
{
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<long long> p(A), q(B), r(C);
    for (int i = 0; i < A; ++i)
    {
        long long ptemp;
        cin >> ptemp;
        p[i] = ptemp;
    }
    for (int i = 0; i < B; ++i)
    {
        long long qtemp;
        cin >> qtemp;
        q[i] = qtemp;
    }
    for (int i = 0; i < C; ++i)
    {
        long long rtemp;
        cin >> rtemp;
        r[i] = rtemp;
    }
    sort(p.begin(), p.end(), greater<long long>());
    p.erase(p.begin()+X, p.end());
    sort(q.begin(), q.end(), greater<long long>());
    q.erase(q.begin()+Y, q.end());
    p.insert(p.end(), q.begin(), q.end());
    p.insert(p.end(), r.begin(), r.end());
    sort(p.begin(), p.end(), greater<long long>());
    long long ans = 0;
    for (int i = 0; i < X + Y; ++i)
    {
        ans += p[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5744
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(i, n) a[idx][i] = v[i]; idx++; PER = a;} while(next_permutation(ALL(v)));} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int fact(int n)
{
  if (n == 0) return 1;
  return n * fact(n-1);
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<VB> G(n, VB(n, false));
  REP(i, m)
  {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a][b] = true;
    G[b][a] = true;
  }
  int ans = 0;
  VI v(n);
  iota(ALL(v), 1);
  do
  {
    if (!G[0][v[0]]) continue;
    bool flg = true;
    REP(i, n-2)
    {
      if (!G[v[i]][v[i+1]])
      {
        flg = false;
        break;
      }
    }
    if (flg) ans++;
  } while(next_permutation(ALL(v)));
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

lint N, A, B, C, D;

int main()
{
    cin >> N >> A >> B >> C >> D;
    lint diff = abs(B - A);
    lint margin = (D - C) * (N - 1);
    REP(i, N)
    {
        lint def = -D * i + C * (N - 1 - i);
        if (diff >= def && diff <= def + margin) cout << "YES" << endl, exit(0);
    }
    cout << "NO" << endl;
}


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

bool cmp(P i, P j) {
  return i.first / (double)i.second > j.first / (double)j.second;
}

int main() {
  int H, N;
  cin >> H >> N;

  vector<int> A(N);
  vector<int> B(N);
  rep(i, N) { cin >> A[i] >> B[i]; }

  vector<ll> dp(H + 1, INT_MAX);
  dp[0] = 0;

  rep(i, N) {
    int a = A[i];
    int b = B[i];

    rep(h, H) {
      int nh = min(h + a, H);
      dp[nh] = min(dp[nh], dp[h] + b);
    }
  }

  cout << dp[H] << endl;
}

Measured memory_bytes: 384