akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int                 long long
#define FF(i,a,b)           for(int i=a;i<b;i++)
#define BF(i,a,b)           for(int i=a;i>=b;i--)
#define vi                  vector<int>
#define MAP                 map<int,int>
#define pb                  push_back
#define MP                  make_pair
#define F                   first
#define S                   second
#define pi                  pair<int,int>
#define all(v)              v.begin(),v.end()
#define PIE                 3.1415926535897932384626433832795
#define FastIO              ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
#define ordered_set         tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
/*

    order_of_key (k) : Number of items strictly smaller than k .
    find_by_order(k) : K-th element in a set (counting from zero).

*/
/**************************************************************************************/
                       /*Global Variables*/
const int mod = 1e9+7;
const int N = 2e5+10;
const int inf = 3e18;

/**************************************************************************************/
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
int Power(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)res*=a;
        a*=a;
        b>>=1;
    }
    return res;
}
signed main()
{
    FastIO;
    int T=1;
    //cin>>T;
    while(T--)
    {
       int n;
       cin>>n;
       int x=n%10;
       if(x==2||x==4||x==5||x==7||x==9)
       {
           cout<<"hon\n";
       } 
       else if(x==3)
       {
           cout<<"bon\n";
       }
       else{
           cout<<"pon\n";
       }
    }

}
/*
|| Do what you can with all you have,wherever you are. ||

|| Knowing is not enough, we must apply. Wishing is not enough, we must do. ||

|| A goal is a dream with deadline. ||

|| Whether you think you can or you think you can't, you're right. ||

|| A year from now you may wish you had started today ||
*/



Measured memory_bytes: 3692
from sys import stdin
X,Y = [int(x) for x in stdin.readline().rstrip().split()]
if X == 1 and Y == 1:
    print(300000*2 + 400000)
elif X < 4 and Y < 4:
    ans = 0
    ans += (4 - X)*100000
    ans += (4 - Y)*100000
    print(ans)
    
elif X < 4:
    ans = 0
    ans += (4 - X)*100000
    print(ans)
elif Y < 4:
    ans = 0
    ans += (4 - Y)*100000
    print(ans)
else:
    print(0)

Measured memory_bytes: 3064
n = int(input())
taro = 0
hanako = 0
for _ in range(n):
    t,h = input().split()
    if t == h:
        taro += 1
        hanako += 1
    elif t < h:
        hanako += 3
    else:
        taro += 3
print("%i %i" % (taro, hanako))




Measured memory_bytes: 5596
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()
f = True
for i in range(X + 1, Y + 1):
    if x[-1] < i <= y[0]:
        f = False
        break
if f:
    print("War")
else:
    print("No War")

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>

using namespace std;
int main(){
	char s1,s2,s3,s4;

	scanf("%c%c%c%c",&s1,&s2,&s3,&s4);

	if(s1==s2 || s2==s3 || s3==s4)printf("Bad");
	else printf("Good");

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59

int main(){
    ll i,j;
    ll n;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++) cin>>a[i];
    ll an[n];
    
    i=0;
      ll x=0;
      for(j=0;j<n;j++){
        if(j%2==0) x+=a[(i+j)%n];
        else x-=a[(i+j)%n];
      }
      an[i]=x;
      x=0;
      i=1;
      ll xy=0;
      for(j=0;j<n;j++){
        if(j%2==0) x+=a[(i+j)%n];
        else x-=a[(i+j)%n];
      }
      an[i]=x;
    for(i=2;i<n;i++){
      an[i]=an[i-2]+2*(a[i-1]-a[i-2]);
    }
    for(i=0;i<n;i++) cout<<an[i]<<endl;
}

Measured memory_bytes: 2816
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
	int i,n,j=1,k=0;
	cin>>n;
	string a,b;
	char c[2*n];
	cin>>a>>b;
	for(i=0;i<2*n;i=i+2){
	    c[i]=a[k];
	    c[j]=b[k];
	    k++;
	    j=j+2;
	    
	}
    for(i=0;i<2*n;i++){
        cout<<c[i];
        
    }
 }


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  ll sp = a[0];
  for (int i = 0; i < n; ++i) {
    sp = gcd(sp, a[i]);
  }
  bool setwise = (sp == 1ll);
  vector<int> map(1000001);
  bool pairwise = true;
  for (int i = 0; i < n; ++i) {
    ll val = a[i];
    for (ll j = 2; j * j <= val; ++j) {
      int cnt = 0;
      while (val % j == 0) {
        cnt++;
        val /= j;
        if (map[j]) {
          pairwise = false;
        }
      }
      map[j] = cnt;
    }
    if (val != 1ll) {
      if (map[val]) {
        pairwise = false;
      }
      map[val] = 1;
    }
  }
  if (pairwise) {
    cout << "pairwise coprime" << '\n';
  } else if (setwise) {
    cout << "setwise coprime" << '\n';
  } else {
    cout << "not coprime" << '\n';
  }
  return 0;
}

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

int main()
{
	

	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<set<int>> poss(26);
	for (int i = 0; i < n; ++i) 
	{
		poss[s[i] - 'a'].insert(i);
	}
	
	int q;
	cin >> q;
	while(q--) 
	{
		int type;
		cin >> type;
		if (type == 1) 
		{
			int pos;
			char c;
			cin >> pos >> c;
			--pos;
			poss[s[pos] - 'a'].erase(pos);
			s[pos] = c;
			poss[s[pos] - 'a'].insert(pos);
		} 
		else 
		{
			int l, r;
			cin >> l >> r;
			--l, --r;
			int cnt = 0;
			for (int c = 0; c < 26; ++c) 
			{
				auto it = poss[c].lower_bound(l);
				if (it != poss[c].end() && *it <= r) ++cnt;
			}
			cout << cnt << "\n";
		}
	}

	
	return 0;
}


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

int main(){

	int a,b;

	cin >> a >> b;

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

		cout << "a > b" << endl;

	}
	else if(a == b){

		cout << "a == b" << endl;
	}

	return 0;
}

Measured memory_bytes: 3088
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

signed main()
{
  string S;
  cin >> S;

  bool is_coffee = (S[2] == S[3]) && (S[4] == S[5]);
  cout << (is_coffee ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
string s;
cin >> s;
int mini,maxi;
for (int i = 0;i < s.size();i++) {
  if (s.at(i) == 'A') {
    mini = i;
    break;
  }
}
for (int i = 0;i < s.size();i++) {
  if (s.at(i) == 'Z') {
    maxi = i;
  }
}
cout << maxi - mini + 1 << endl;
return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k,ans=1;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		if(ans<k)  ans+=ans;
		else  ans+=k;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//typedef tree < int , null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> TREE;
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define pld pair<long double,long double >
#define ld long double
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
#define pll pair<ll,ll>
#define speed ios::sync_with_stdio(false);cin.tie();cout.tie();
#define M_PI 3.14159265358979323846
//#define int long long
const int mod=1000000007;
//const int mod=1009;
//const int mod=998244353;
const int inf=1000000009;
const long long INF=1000000000000000009;
const long long big=1000000000000000;
const long double eps=0.000000000000000000001;
using namespace std;
int main()
{
    speed
    string s,t;
    int a,b;
    string u;
    cin>>s>>t>>a>>b>>u;
    if(s==u)
        a--;
    else
        b--;
    cout<<a<<" "<<b;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  int a[n][m];
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++)cin>>a[i][j];
  }
  int ans=100000;
  bool used[m+1];
  fill(used,used+m+1,false);
  int cnt[n];
  fill(cnt,cnt+n,0);
  for(int k=0;k<m;k++){
    int cn[m+1];
    fill(cn,cn+m+1,0);
    for(int i=0;i<n;i++){
      if(cnt[i]==m)continue;
      cn[a[i][cnt[i]]]++;
    }
    int ma=0,num;
    for(int i=1;i<=m;i++){
      if(cn[i]>ma){
        ma=cn[i];
        num=i;
      }
    }
    ans=min(ans,ma);
    used[num]=true;
    for(int i=0;i<n;i++){
      while(cnt[i]<m&&used[a[i][cnt[i]]])cnt[i]++;
    }
  }
  cout<<ans<<endl;
}
    
        
      
    

Measured memory_bytes: 640
#include<iostream>
#include<string>
using namespace std;
int main(){
  	ios::sync_with_stdio(false);
  	cin.tie(nullptr);
	string s;
  	int sum=0;
  	cin>>s;
  	for(int i=0;i<s.length();i++){
    	sum+=s[i]-'0';
      	sum%=9;
    }
  	if(sum==0)
      	cout<<"Yes\n";
  	else
      	cout<<"No\n";
  	return 0;
  	
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, Q;
    cin >> N >> Q;
    vector<int> kind(Q), x(Q);
    vector<vector<bool>> P(2, vector<bool>(N, false));
    for (int i = 0; i < Q; ++i) {
        cin >> kind[i] >> x[i];
        --kind[i];
        --x[i];
        P[kind[i]][x[i]] = true;
    }
    long long ans = (long long)(N - 2) * (long long)(N - 2);
    int right = N - 1, down = N - 1;
    for (int i = 0; i < Q; ++i) {
        if (P[kind[i]][x[i]]) {
            if (kind[i] == 0) {
                int new_right = x[i];
                for (int j = new_right; j < right; ++j) {
                    if (P[0][j]) {
                        P[0][j] = false;
                        // cout << 0 << " " << j << " : " << down - 1 << '\n';
                        ans -= (down - 1); // 1 ~ down - 1
                    }
                }
                right = new_right;
            } else {
                int new_down = x[i];
                for (int j = new_down; j < down; ++j) {
                    if (P[1][j]) {
                        P[1][j] = false;
                        // cout << 1 << " " << j << " : " << right - 1 << '\n';
                        ans -= (right - 1);
                    }
                }
                down = new_down;
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 4776
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <functional>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <string>

using namespace std;

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)

ll const INF = 1000000000000000000;
int const I_MAX = 2147483647;
ll const MOD = 1e9 + 7;
int const POW_MAX = 1e5;

// nCr
ll po[POW_MAX + 2];
ll mod_pow(ll x, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
ll mod_inv (ll x) {
  return mod_pow(x, MOD - 2) % MOD;
}
ll comb(int n, int r) {
  return (((po[n] * mod_inv(po[r])) % MOD) * mod_inv(po[n - r])) % MOD;
}
// greatest common divisor
ll gcd(ll a, ll b) {
  while (a % b != 0) {
    ll tmp = a;
    a = b;
    b = tmp % b;
  }
  return b;
}

char const R = '1';

int N, K;
string S;
vector<P> v;

int main() {
  scanf("%d %d", &N, &K);
  cin >> S;

  int e_count = 0;
  int r_count = 0;
  char bef = R;
  int idx = 0;
  for (char c : S) {
    if (c == bef) {
      if (c == R) {
        r_count++;
      } else {
        e_count++;
      }
    } else {
      if (c == R) {
        r_count++;
      } else {
        v.push_back(P(e_count + r_count, r_count));
        e_count = 1;
        r_count = 0;
        idx++;
      }
    }
    bef = c;
  }
  v.push_back(P(e_count + r_count, r_count));
  idx++;

  vector<P> sums(idx);
  sums[0] = v[0];
  FOR(i, 1, idx) {
    P s = sums[i - 1];
    P vs = v[i];
    sums[i] = P(s.first + vs.first, vs.second);
  }

  int count = sums[0].first;
  if (K >= idx) {
    count = sums[idx - 1].first;
  }
  for (int i = 0; i + K < idx; i++) {
    int w = i + K;
    P sw = sums[w];
    P si = sums[i];
    int cnt = sw.first - si.first + si.second;
    count = max(count, cnt);
  }
  printf("%d\n", count);
}


Measured memory_bytes: 1272
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

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

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin - 1; end <= i; i--)		// repeat reverse

#endif


int main(void)
{
	double w, h, x, y;
	cin >> w >> h >> x >> y;
	
	ll ans = 0;
	if (x * 2 == w && y * 2 == h)
		ans = 1;

	cout << w * h / 2.0 << " " << ans;
	return 0;
}


Measured memory_bytes: 256
def main():
    S = input()
    T = set("dream dreamer erase eraser".split())
    
    p = ""
    for i in range(len(S)):
        p = S[~i] + p
        if p in T:
            p = ""
        elif len(p) > 7:
            print("NO")
            return

    print("YES")

main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
int n, g;
int a[N];
int pre[N], suf[N] ;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i] , g = __gcd(a[i], g);
    for(int i = 1; i <= n; i++) pre[i] = __gcd(pre[i - 1], a[i]) ;
    for(int i = n; i >= 1; i--) suf[i] = __gcd(suf[i + 1], a[i]) ;
    for(int i = 1; i <= n; i++) {
        g = max(g, __gcd(suf[i + 1], pre[i - 1])) ;
    }
    cout << g;
    return 0;
}


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

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define __ fflush(stdout)
#define FILENAME ""

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef LOCAL
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		//freopen(FILENAME".in", "r", stdin);
		//freopen(FILENAME".out", "w", stdout);
	#endif
}

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 3001, inf = 1e9 * 2;

const ll MOD = 1e9 + 7ll, INF = 1e18;

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

int dp[N][N];

int main() {
	FREOPEN();
	int n;
	cin >> n;
	string s;
	cin >> s;
	s = '$' + s;
	dp[1][1] = 1;
	for (int i = 2; i <= n; i++) {
		for (int j = 1; j <= i; j++) {
			if (s[i - 1] == '<') {
				dp[i][j] = dp[i - 1][j - 1];
			}
			else {
				dp[i][j] = (dp[i - 1][i - 1] - dp[i - 1][j - 1] + MOD) % MOD;
			}
			dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
		}
	}
	printf("%d ", dp[n][n]);
	return 0;
}


Measured memory_bytes: 34176
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>

using namespace std;
typedef long long ll;

int main(){
  int a,b; cin>>a>>b;
  if(a==2||b==2){
    cout<<"No"<<endl;
  }else{
    if(a==4||a==6||a==9||a==11){
      a = 100;
    }else{
      a = 200;
    }

    if(b==4||b==6||b==9||b==11){
      b = 100;
    }else{
      b = 200;
    }
    if(a==b){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }

  }
}

Measured memory_bytes: 256
import sys

a=[-1,-1,-1]
n,m = map(int,input().split())
for i in range(m):
    x,y = map(int,input().split())
    if a[x-1]!=-1 and a[x-1]!=y:
        print("-1")
        sys.exit()
    a[x-1]=y
if n!=1 and a[0]==0:
    print("-1")
    sys.exit()
if n==1 and a[0]==-1: a[0]=0
if n!=1 and a[0]==-1: a[0]=1 
for i in range(n):
    if a[i]==-1: print("0",end="")
    else: print(a[i],end="")

Measured memory_bytes: 3064
#include <stdio.h>

const char* map[]={
	"       ",
	"       ",
	"   7   ",
	"  8 I  ",
	" 9 6 H ",
	"  1 5  ",
	" A 0 G ",
	"  2 4  ",
	" B 3 F ",
	"  C E  ",
	"   D   ",
	"       ",
	"       ",
	NULL
};
const int map_d[7][2]={
	{ 2, 0},
	{ 1, 1},
	{ 1,-1},
	{ 0, 0},
	{-1, 1},
	{-1,-1},
	{-2, 0}
};

int get_func(const char *func,const int id[],int input) {
	int idx=0;
	int i;
	for(i=0;i<7;i++) {
		if((input>>id[i])&1)idx|=1<<i;
	}
	return func[idx]-'0';
}

int main(void) {
	char input[256];
	int taiou[100][7];
	const char* map_chars="0123456789ABCDEFGHI";
	int map_num;
	int i,j,k;
	int search_max;
	for(map_num=0;map_chars[map_num]!='\0';map_num++) {
		for(i=0;map[i]!=NULL;i++) {
			for(j=0;map[i][j]!='\0';j++) {
				if(map[i][j]==map_chars[map_num]) {
					for(k=0;k<7;k++) {
						char m=map[i+map_d[k][0]][j+map_d[k][1]];
						if(m<='9') {
							taiou[map_num][k]=m-'0';
						} else {
							taiou[map_num][k]=m-'A'+10;
						}
					}
				}
			}
		}
	}
	search_max=1<<map_num;
	while(scanf("%s",input)==1 && input[0]!='#') {
		int ok=1;
		int search;
		for(search=0;search<search_max;search++) {
			int new_input=0;
			for(i=0;i<7;i++) {
				new_input|=get_func(input,taiou[i],search)<<i;
			}
			if(get_func(input,taiou[0],new_input)!=(new_input&1)) {
				ok=0;
				break;
			}
		}
		puts(ok?"yes":"no");
	}
	return 0;
}

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

long long V[58],N,ncr[55][55],A;

bool allsame()
{
	int i;
	
	long long x=V[1];
	
	for (i=2;i<=A;i++)
	{
		if(V[i]!=x)
		return false;
	}
	
	return true;
}

long long cal(int n,int r)
{
	if(r>n)
	return 0;

	if(r==0 || r==n)
	return 1;
	
	if(n==1)
	return 1;
	
	if(ncr[n][r]!=-1)
	return ncr[n][r];
	
	ncr[n][r]=cal(n-1,r)+cal(n-1,r-1);
	
	return ncr[n][r];
	
}

int main()
{
	int B;
	
	cin>>N>>A>>B;
	
	
	int i;
	
	for (i=1;i<=N;i++)
	{
		cin>>V[i];
	}
	
	if(A>B)
	{
		printf("0\n0");
		return 0;
		
	}
	
	sort(V+1,V+N+1);
	
	reverse(V+1,V+N+1);
	
	
	double ans=0;
	
	memset(ncr,-1,sizeof(ncr));
	long long ways=0;
	
	if(allsame())
	{	
		int cnt=A;
		for (i=A+1;i<=N;i++)
		{
			if(V[i]!=V[1])
			break;
			cnt++;
		}
		
		for (i=A;i<=min(cnt,B);i++)
		ways+=cal(cnt,i);		
		
		cout<<V[1]<<endl<<ways;
		return 0;
	}
	
	for (i=1;i<=A;i++)
	{
		ans+=V[i];
	}
	
	ans=ans/(double)A;
	
	int freq=0,first;
	for (i=1;i<=N;i++)
	{
		if(V[i]>V[A])
		first=i;
		
		if(V[i]==V[A])
		freq++;
	}
	
	ways=cal(freq,A-first);
	
	printf("%0.8f\n%lld",ans,ways);
	
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int k;
    string s;

    cin>>k;
    cin>>s;
    if(s.size()>k)
       s=s.substr(0,k)+"...";
    cout<<s<<endl;

    return 0;

}


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


void solve(long long A, long long B, long long C, long long D, long long E){
    vector<long long> data;
    if(A%10 != 0) data.push_back((A / 10 + 1) * 10 - A);
    else data.push_back(0);
    if(B%10 != 0) data.push_back((B / 10 + 1) * 10 - B);
    else data.push_back(0);
    if(C%10 != 0) data.push_back((C / 10 + 1) * 10 - C);
    else data.push_back(0);
    if(D%10 != 0) data.push_back((D / 10 + 1) * 10 - D);
    else data.push_back(0);
    if(E%10 != 0) data.push_back((E / 10 + 1) * 10 - E);
    else data.push_back(0);
    sort(data.begin(), data.end());
    cout << data[0]+data[1]+data[2] + data[3]+ A + B + C + D + E << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    long long E;
    scanf("%lld",&E);
    solve(A, B, C, D, E);
    return 0;
}


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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int x,y; cin >> x >> y;
    for(int i=0;i<=x;i++){
        if((2*i+4*(x-i))==y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
using namespace std;
int a[100005];
int n,ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	  scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
	  if(a[i]==i) swap(a[i],a[i+1]),ans++;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 640
// Hovalhagh
// Ya Aziz & Hakim
// AliReza Kaboli

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 100;

int a[N], dp[N];

int main() {
	int n;
	cin >> n >> a[1] >> a[2];
	dp[1] = 0;
	dp[2] = abs(a[1] - a[2]);
	for (int i = 3; i <= n; ++i) {
		cin >> a[i];
		dp[i] = min(dp[i - 1] + abs(a[i - 1] - a[i]), dp[i - 2] + abs(a[i - 2] - a[i]));
	}
	cout << dp[n] << '\n';
}


Measured memory_bytes: 1024
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
using pint = pair<int,int>;
using vec = vector<int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
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; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
const int mod = 1000000007;
struct mint {
    int64_t x;
    mint(int64_t x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    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 { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int64_t 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) {return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

ll n,w;
ll weight[100];
ll v[100];
ll dp[101][100005] = {0};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    
    double l = 0,r = *max_element(all(a))+1;
    
    while(r - l>1){
        ll mid = (r+l)/2;
        ll cut = 0;
        rep(i,n) cut += a[i]/mid +(a[i]%mid!=0)-1;
        if(cut>k) l = mid;
        else r=mid;
    }

    cout<<ll(ceil(r))<<endl;

}

Measured memory_bytes: 4784
# include <stdio.h>
//# include <stdlib.h>
# define MAX 100001
int main()
{
    long n;
    char d[MAX];
    long sum=1;
    char index;
    //char c;
    scanf("%ld",&n);
    while (getchar()!='\n')
    {
        continue;
    }
    
    for (int i = 0; i < n; i++)
    {
        scanf("%c",&d[i]);
    }
    index = d[0];

    //printf("%c",index);
    for (int i = 1; i < n; i++)
    {
        //printf("%c %c\n",index, d[i]);
        if (index!=d[i])
        {
            sum++;
            index = d[i];
        }
    }
    printf("%ld", sum);
    //system("pause");
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
#include<math.h>
using namespace std;

int  main()
{
    int n, m;
    cin >> n >> m;
    vector<int> s(m);
    vector<int> c(m);
    for (int i = 0; i < m; i++) {
        cin >> s[i] >> c[i];
    }
    vector<int> ans(n);
    if (n == 1) {
        ans[0] = 0;
    }
    else {
        ans[0] = 1;
        for (int i = 1; i < n; i++) {
            ans[i] = 0;
        }
    }
    bool f = true;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
            if (s[i] == s[j] && c[i] != c[j]) {
                f = false;
            }
        }
    }
    if (n > 1) {
        for (int i = 0; i < m; i++) {
            if (s[i] == 1 && c[i] == 0) {
                f = false;
            }
        }
    }
    if (f == false) {
        cout << -1 << endl;
    }
    else {
        for (int i = 0; i < m; i++) {
            ans[s[i] - 1] = c[i];
        }
        for (int i = 0; i < n; i++) {
            cout << ans[i];
        }
        cout << endl;
    }
    return 0;
}

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

const ll MAX = 200000;
const ll INF = 1001001001;
const ll MOD = 1000000007;

ll N, T, ans=0, tmp=INF, mc=0;
vector<ll> A, M;

signed main(){
    cin >> N >> T;
    for(int i=0;i<N;i++) {
        ll a;
        cin >> a;
        tmp = min(tmp, a);
        A.push_back(a);
        M.push_back(tmp);
        mc = max(mc, a-tmp);
    }
    for(int i=0;i<N;i++) {
        if(A[i]-M[i]==mc) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5032
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    string s,t;
    cin>>s>>t;
    int ans=0;
    for(int i=0;i<s.length();i++){
        if(s[i]!=t[i]) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3852
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
using namespace std;

bool cmp(int a, int b)
{
	return (a < b);
}

int main()
{
	int n, k;
	while (scanf("%d%d", &n, &k) != EOF) {
		int i, j;
		int a[1005];
		for (i = 0; i < n; i ++) {
			scanf("%d", &a[i]);
		}
		
		sort(a, a + n, cmp);
		
		int cnt = 0;
		for (i = 0; i < k && i < n; i ++) {
			cnt += a[i];
		}
		
		printf("%d\n", cnt);
	}
	return (0);
}


Measured memory_bytes: 1744
#include <iostream>

int main() {
	int n; std::cin >> n;
	int debt = 100000;
	for (int i=0; i<n; i++) {
		debt *= 1.05;
		if (debt % 1000 > 0)
			debt = debt - (debt % 1000) + 1000;
	}
	std::cout << debt << std::endl;
	return 0;
}


Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long n, k, a[200005];
  	cin >> n >> k;
  	for (int i = 0; i < n; i++) cin >> a[i];
  	sort(a, a + n);
  	long long ans = 0;
  	for (int i = 0; i < n - k; i++) ans += a[i];
  	cout << ans << endl;
}


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

public class Main {
    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner scanner = new Scanner(System.in);
        final int N = scanner.nextInt();
        final int Y = scanner.nextInt() / 1000;
        for (int x = 0; x <= N; x++) {
            for (int y = 0; y <= N; y++) {
                if (x + y > N) continue;
                int z = N - x - y;
                if (10 * x + 5 * y + z == Y) {
                    System.out.printf("%d %d %d\n", x, y, z);
                    return;
                }
            }
        }
        System.out.printf("%d %d %d\n", -1, -1, -1);
    }
}

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

int func (string, string);

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

  for( i=0; i<=N; i++){
    int tmp;
    tmp = func(s.substr(0,i), s.substr(i)); //0 to i and i to final
    ans = max(ans, tmp);
  }

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

int func(string s, string t){
  int ans, i;
  char c;
  for (c='a'; c<='z'; c++){
    bool found_s = false, found_t = false;
    for(i=0; i<s.length(); i++){
      if(s[i]==c){
        found_s = true;
      }
    }
    for(i=0; i<t.length(); i++){
      if(t[i]==c){
        found_t = true;
      }
    }
  if (found_s && found_t ==1)
    ans++;
  }
  return ans;
}



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

int main(){
    string str;
    int alpha[26]={}, i;
    while(getline(cin, str)){
        for(i = 0; i < str.size();i++){
            if(str[i] >= 'a'&& str[i] <= 'z') alpha[str[i] - 'a']++;
            else if(str[i] >= 'A' && str[i] <= 'Z') alpha[str[i] - 'A']++;
        }
    }
    for(i = 0; i<26; i++){
        cout << (char)('a'+ i) << " : " << alpha[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3156
import itertools

s = input()
n = [i for i in s]
ans = 0

# +の個数
for i in range(len(n)):
    for j in itertools.combinations(range(len(n)-1), i):
        temp = [i for i in s]
        for k in j[::-1]:
            temp.insert(k+1, "+")
        temp = "".join(temp)
        temp = temp.split("+")
        temp = map(int, temp)
        ans += sum(temp)

print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MX = 2002, MOD = 1e9+7;
ll C[MX][MX], ans[MX];
int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	for(int n=0; n<MX; n++) {
		C[n][0] = C[n][n] = 1;
		for(int m=1; m<n; m++) {
			C[n][m] = C[n-1][m] + C[n-1][m-1];
			C[n][m] %= MOD;
		}
	}
	int n, k;
	cin >> n >> k;
	int a = k, b = n-k;
	ans[1] = b+1;
	for(int x=1; x<=b; x++) {
		for(int y=1; y<=x; y++) {
			if(y > a-1) break;
			//printf("invested %d ones to %d bunch, ans is %lld(split x=%d into y=%d bunch) * %lld(select y=%d position in a-1=%d)%d(rest x)\n", x, y, C[x-1][y-1], x, y, C[a-1][y], y, a-1, b-x+1);
			ll add = C[x-1][y-1]*(b-x+1);
			add %= MOD;
			add *= C[a-1][y];
			ans[y+1] += add%MOD;
		}
	}
	for(int i=1; i<=k; i++) {
		cout << ans[i]%MOD << '\n';
	}
}

Measured memory_bytes: 30208
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {
			double velocity = sc.nextDouble();
			double time = velocity / 9.8;

			double a = time * time;

			double height = 4.9 * a;

			int kai = 1;

			while (true) {
				if (height < 5 * kai - 5) {
					break;
				} else {
					kai++;
				}
			}
			System.out.println(kai);
		}

	}

}

Measured memory_bytes: 27976
k, n = map(int, input().split())
a_i = list(map(int, input().split()))
a_i.append(a_i[0] + k)
disList = []
for x in range(n):
    disList.append(a_i[x + 1] - a_i[x])
print(sum(disList) - max(disList))

Measured memory_bytes: 25804
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
class Pair implements Comparable<Pair>
{
	int n;
	int dis;
	public Pair(int x,int d)
	{
		this.n=x;
		this.dis=d;
	}
	public int compareTo(Pair p)
	{
		if(this.dis>p.dis)
			return 1;
		else if(this.dis<p.dis)
			return -1;
		return 0;
	}
}
public class Main{
	static BufferedReader br;
	static int cin() throws Exception
	{
		return Integer.valueOf(br.readLine());
	}
	static int[] split() throws Exception
	{
		String[] cmd=br.readLine().split(" ");
		int[] ans=new int[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Integer.valueOf(cmd[i]);
		}                                              
		return ans;
	} 
    public static void main(String[] args) throws Exception {
        br = new BufferedReader(new InputStreamReader(System.in));
        int n=cin();
        int st=7;
        int ans=1;
        int[]check=new int[1000001];
        int bool=0;
        while(true)
        {
        	int mod=st%n;
        	if(mod==0)
        		break;
        	if(check[mod]==1)
        	{
        		bool=1;
        		break;
        	}
        	check[mod]=1;
        	st=mod*10+7;
        	ans++;
        }
        if(bool==1)
        	System.out.println(-1);
        else
        System.out.println(ans);
    }
}


Measured memory_bytes: 36408
#include<algorithm>
#include<cstdio>
using namespace std;

const int MAX_N = 1e5;
int n;
int a[MAX_N];

int main() {
    scanf("%d", &n);
    int m = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        m = max(m, a[i]);
    }

    sort(a, a + n, [&](const int &i1, const int &i2)->bool {
        int a1 = (2 * i1 > m) ? m - i1 : i1;
        int a2 = (2 * i2 > m) ? m - i2 : i2;
        return a1 < a2;
    });
    
    printf("%d %d\n", m, a[n - 1]);
    return 0;
}


Measured memory_bytes: 512
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n";
#define int long long
#define mod 1000000007

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
	double x;
	cin >> x;
	int ans = 0;
	double curr = 100.0;
	while (curr < x) {
		curr = floor(1.01 * curr);
		ans++;
	}
	cout << ans;
}

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}


Measured memory_bytes: 3740
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

a,b,c=MI()
k=I()
ans=a+b+c+max(a,b,c)*(2**k-1)
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
int main(){ 
	int N, X; 
	cin >> N >> X; 
	long long int A[100010] = {}; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; 
	}
	long long int ans = 0; 
	for(int i = 0; i < N; i++){
		if(A[i] > X){
			ans += A[i] - X, A[i] = X; 
		}
	}
	for(int i = 0; i < N - 1; i++){
		if(A[i] + A[i+1] > X){
			ans += A[i] + A[i+1] - X, A[i+1] = X - A[i]; 
		}
	}
	cout << ans << endl; 
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

def main():
  N = readInts()[0]
  counts = {}
  for i in range(N):
    s = input()
    ss = "".join(sorted(s))
    if not ss in counts:
      counts[ss] = 0
    counts[ss] += 1

  ans = 0
  for count in counts.values():
    if count > 1:
      combi = ((count - 1) * count) // 2
      ans += combi
  print(ans)

if __name__ == "__main__":
  main()


Measured memory_bytes: 17888
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  Ws = list(map(int, input().strip().split()))
  
  sl = 0
  sr = sum(Ws)
  min = 10**9
  for i in range(n):
    sl += Ws[i]
    sr -= Ws[i]
    if min > abs(sr - sl):
      min = abs(sr - sl)
      
  print(min)
  
if __name__=='__main__':
  main()



Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys


def solve(N: int, K: int):
    if K!=0:
        ans = 0
        for j in range(K+1,N+1):      
            ans += (j-K) * (N//j)
            if N%j >=K:
                ans += N%j - K + 1
    else:
        ans = N * N

    print(ans)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		for(int i = 0; i < n; i++) {
			int k = stdIn.nextInt();
			int p = stdIn.nextInt();
			System.out.println((k-1) % p+1);
		}
	}
}

Measured memory_bytes: 20484
/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define mp make_pair
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n==1) return x;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                              //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

template<typename T>
T maxx(T a,T b)
{
  if(a<b) re b;
  re b;
}
template<typename T, typename... Args>
T maxx(T a,T b, Args... args)
{
    re(maxx(maxx(a,b),args...));
}

template<typename T>
T minn(T a,T b)
{
  if(a<b) re a;
  re b;
}
template<typename T, typename... Args>
T minn(T a,T b, Args... args)
{
    re(minn(minn(a,b),args...));
}

int gcd(int a, int b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=(ans*(n-i)/(i+1))%N;
  }
  re ans;
}

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

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    cin>>n;
    ll z=0;
    m=0;

    forf(i,1,n+1)
    {
      forf(j,1,n+1)
      {
        forf(k,1,n+1)
        {
          m+=__gcd(i,gcd(j,k));
        }
      }

    }

    cout<<m;




  }


  return 0;
}


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

using namespace std;

const double PI = 3.141592;
const int MAX_N = 1e5+5;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

const bool dbgEnabled = true;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
typedef pair<string, ll> psi;
typedef pair<ll, string> pis;
typedef vector<pii> vpii;
typedef vector<psi> vpsi;
typedef vector<pis> vpis;
typedef vector<vi> vvi;

// Debug macros
#define dbg(x) do { \
	if (dbgEnabled) { cerr << #x << ": " << x << "\n"; } \
} while (0)

#define dbgv(x) do { \
	if (dbgEnabled) { cerr << #x << ": [ "; for (auto& _ : x) cerr << _ << " "; cerr << "]\n"; } \
} while (0)

#define dbgvv(x) do { \
	if (dbgEnabled) { cerr << #x << ":\n[\n"; for (auto& __ : x) dbgv(__); cerr << "]\n";} \
} while (0)

void solve() {
	map<ll, ll> primeFreq;
	ll n; cin >> n;
	ll gcd = 0;
	for (ll i = 0; i < n; i++) {
		ll a; cin >> a;
		gcd = __gcd(gcd, a);
		if (a % 2 == 0) primeFreq[2]++;
		while (a % 2 == 0) a /= 2;
		for (ll j = 3; j <= sqrt(a); j++) {
			if (a % j == 0) primeFreq[j]++;
			while(a % j == 0) a /= j;
		}
		if (a > 2) primeFreq[a]++;
	}
	
	bool isPairwiseCoprime = true;
	for (auto& [key, value] : primeFreq) {
		if (value != 1) {
			isPairwiseCoprime = false;
			break;
		}
	}
	
	if (isPairwiseCoprime) {
		cout << "pairwise coprime" << endl;
	} else if (gcd == 1) {
		cout << "setwise coprime" << endl;
	} else {
		cout << "not coprime" << endl;
	}
}

int main() {
	if (!dbgEnabled) {
		ios_base::sync_with_stdio(false);
		cin.tie(nullptr); cout.tie(nullptr);
	}
	
	ll t = 1;
	//cin >> t;
	while(t--) {
		solve();
	}    
    return 0;
}



Measured memory_bytes: 8492
#include<bits/stdc++.h>
#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000001
#define MAXN        400005
#define mod         1000000007
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<min({a+b,b+c,c+a});
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val s = sc.next().toCharArray()

  var countA = 0
  var countB = 0
  var countC = 0
  for (c in s) {
    if(c == 'a') countA++
    if(c == 'b') countB++
    if(c == 'c') countC++
  }

  val array = arrayOf(countA, countB, countC)
  val min = array.min()!!
  val max = array.max()!!

  if (max - min <= 1) {
    println("YES")
    return
  }
  println("NO")

}


Measured memory_bytes: 43780
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 1e5+6;
void solve(){
	int n; 
	cin>>n; 
	vector<ll>a(n);
	for(int i=0;i<n;i++)cin>>a[i];
	for(ll i=0;i<n;i++)a[i]-=(i+1);
	sort(a.begin(),a.end());
	ll b = a[n/2];
	ll ans = 0;
	for(int i=0;i<n;i++){
		ans+=abs(a[i]-b);
	}
	cout<<ans<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 4736