akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)n; i++)
#define PI 3.14159265358979323846
#define vll vector<long long>
#define vvll vector<vector<long long>>
#define pll pair<long long, long long>
using namespace std;
using ll = long long;
using ld = long double;

// ----本問について----
// 問題：単一始点最短経路
// 問題文URL：https://onlinejudge.u-aizu.ac.jp/problems/GRL_1_A
// 所要時間：
// 学んだこと：
// ------------------

// ----ここから本問のソースコード----

const ll INF = (ll)pow(10, 11);

// グローバル変数（入力）
ll v, e, r;
vector<vector<pll>> E; // 隣接リスト．pairは(終点,重み)．大きさv

// 入力
void input() {
  cin >> v >> e >> r;
  E.resize(v);
  rep(i, e) {
    ll s, e, w;
    cin >> s >> e >> w;
    E[s].push_back(make_pair(e, w)); // (sに接続する頂点，重み)
  }
  /*
  rep(i, v) {
    cout << "E[" << i << "] = {";
    rep(j, E[i].size()) {
      cout << "{" << E[i][j].first << ", " << E[i][j].second << "}";
      if (j != (ll)E[i].size()-1) { cout << ", "; }
    }
    cout << "}" << endl;
  }
  */
}

// ダイクストラ法
void solve() {
  vll d(v);
  rep(i, v) { d[i] = INF; }
  d[r] = 0;
  // 比較関数（昇順）
  auto comp = [](pll a, pll b) { return a.first > b.first; };
  // ↓pairは(始点からの距離,頂点番号)
  priority_queue<pll, vector<pll>, decltype(comp)> Q{comp};
  vll s(v, 0);                // 確定したら1にする
  Q.push(make_pair(d[r], r)); // 始点を追加
  while (!Q.empty()) {
    ll u = Q.top().second;
    // cout << "u:" << u << endl;
    Q.pop();
    if (s[u] == 0) { // 未確定なら
      rep(i, E[u].size()) {
        ll V = E[u][i].first;
        if (s[V] == 0) { // uと接続する頂点が未確定なら
          d[V] = min(d[V], d[u] + E[u][i].second); // 緩和
          // cout << "d[" << V << "]:" << d[V] << endl;
          Q.push(make_pair(d[V], V));
        }
      }
    }
    s[u] = 1;
  }
  rep(i, v) {
    if (d[i] == INF) {
      cout << "INF" << endl;
    } else {
      cout << d[i] << endl;
    }
  }
}

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



Measured memory_bytes: 20132
# フェルマーの小定理
N, K = map(int, input().split())
A = list(map(int, input().split()))

m = 1000000007


def make_factorial_table(n):
    result = [0] * (n + 1)
    result[0] = 1
    for i in range(1, n + 1):
        result[i] = result[i - 1] * i % m
    return result


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m


fac = make_factorial_table(N)

A.sort(reverse=True)
maxX = 0
for i in range(N - K + 1):
    maxX += A[i] * mcomb(N - (i + 1), K - 1)
    maxX %= m

A.sort()
minX = 0
for i in range(N - K + 1):
    minX += A[i] * mcomb(N - (i + 1), K - 1)
    minX %= m

print((maxX - minX) % m)


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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long long int A,B,C,K;
	cin>>A>>B>>C>>K;
	if(K&1)	cout<<B-A<<endl;
	else	cout<<A-B<<endl;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────


int main() {
	string s; cin >> s;
	rep(i, s.size()) cout << "x";
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <numeric>

using namespace std;

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

    int N;
    cin >> N;

    vector<int> a(N, 0);
    int64_t total = 0;
    for (int i=0; i<N; i++) {
      long long c;
      cin >> c;
      a[i] = c;
      total += c;
    }

    int64_t current = 0;
    int64_t diff = INT64_MAX;

    for (int i=0; i<a.size()-1; i++) {
      current += a[i];
      diff = min(diff, abs(total - 2 * current));
    }

    cout << diff << endl;
    return 0;
}


Measured memory_bytes: 1024
import sys

N = int(input())
A = list(map(int, input().split()))

ans = 1

for a in A:
    if a == 0:
        print(0)
        sys.exit()

for a in sorted(A, reverse=True):
    ans *= a
    if 10**18 < ans:
        print(-1)
        sys.exit()


print(ans)


Measured memory_bytes: 21440
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
	int a,b;
	int d,r;
	double f;
	cin>>a>>b;
	d=a/b;
	r=a%b;
	f=(double)a/b;
	
	printf("%d %d %lf\n",d,r,f);
    return 0;
}



Measured memory_bytes: 3196
#include <stdio.h>

int main(){
    int n, i, s;
    scanf("%d\n", &n);
    int* a = new int[n];
    for(i = 0; i < n; i++){
        scanf("%d ", &a[i]);
    }
    if((n % 2) == 0){
        for(i = 0; i < (n / 2); i++){
            s = a[n-(i+1)];
            a[n-(i+1)] = a[i];
            a[i] = s;
        }
    }
    else{
        for(i = 0; i < (n / 2); i++){
            s = a[n-(i+1)];
            a[n-(i+1)] = a[i];
            a[i] = s;
        }
    }
    for(i = 0; i < n; i++){
        if(i == (n - 1)){
            printf("%d\n", a[i]);
        }
        else{
            printf("%d ", a[i]);
        }
    }
    delete[] a;
    return 0;
}

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

signed main(){
    int n;
    //ofstream cout("out.txt");
    while(cin>>n){
        if(n == 0)break;
        string s[n];
        for(int i=0;i<n;i++){
            cin>>s[i];
        }
        for(int i=0;i<n;i++){
            if(s[i][0]!='.')continue;
            for(int j=1;j<s[i].size();j++){
                if(s[i][j] != '.'){
                    s[i][j-1] = '+';
                    break;
                }
            }
        }

        for(int i=1;i<n;i++){
            for(int j=0;j<s[i].size();j++){
                if(s[i][j] == '.')s[i][j] = ' ';
            }
        }
        for(int i=1;i<n;i++){
            for(int j=0;j<s[i].size();j++){
                if(s[i][j] == '+'){
                    int now = i-1;
                    while(now>0 && s[now][j]==' '){
                        s[now][j] = '|';
                        now--;
                    }
                }
            }
        }
        for(int i=0;i<n;i++)cout << s[i] << "\n";
    }
}


Measured memory_bytes: 3796
#include <iostream>

using namespace std;

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

int main()
{

    int K;

    cin >> K;

    int sum = 0;

    for (int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int k=1;k<=K;k++){
                int g = gcd(i, j);
                sum += gcd(g, k);
            }
        }
    }

   cout << sum << endl;

   return 0;
}

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

int main(void){
    int a[3], b[3];
    int i;
    for(i = 0; i<3; i++) cin >> a[i] >> b[i];
    int c[4] = {0, 0, 0, 0};
    bool f = true;
    for(i=0; i<3; i++){
        c[a[i]]++;
        c[b[i]]++;
        if(c[a[i]]==3 || c[b[i]]==3){
            f = false;
            break;
        }
    }
    if(f) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}


map<pair<string, string>, ll> s1l, s2l;



void solve(ll num, ll depth, string S) {

	if (depth >= S.size()) {

		string s1="", s2="";
		rep(i, S.size()) {
			if ( (num >> i) % 2) {
				s1.push_back(S[i]);
			}
			else {
				s2.push_back(S[i]);
			}

			
		}
		s1l[{s1, s2}] += 1;
		return;
	}


	solve(num, depth + 1, S);
	solve(num + (1LL << depth), depth + 1, S);

}


ll solve2(ll num, ll depth, string S) {

	if (depth >= S.size()) {

		string s1 = "", s2 = "";
		rep(i, S.size()) {
			if ((num >> i) % 2) {
				s1.push_back(S[i]);
			}
			else {
				s2.push_back(S[i]);
			}


		}
		
		return s1l[{s1, s2}];
	}


	return solve2(num, depth + 1, S) + solve2(num + (1LL << depth), depth + 1, S);

}


int main() {
	ll N;

	cin >> N;
	string S1, S2;
	rep(i, N) {
		char c;
		cin >> c;
		S1.push_back(c);
	}
	rep(i, N) {
		char c;
		cin >> c;
		S2.push_back(c);
	}
	
	reverse(S2.begin(), S2.end());

	solve(0, 0, S1);
	



	cout << solve2(0, 0, S2) << endl;
	return 0;
}

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

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



def main():
    A, B = map(int, input().split())

    print((A+B)%24)

if __name__ == "__main__": main()


Measured memory_bytes: 3828
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;   
}

int main() {
    int s;
    cin>>s;
    vector<int> vec(s);
    rep(i,s){
        cin>>vec.at(i);
    }
    vector<int> vecb(s);
    rep(i,s){
        cin>>vecb.at(i);
    }
    vector<int> vecc(s-1);
    rep(i,s-1){
        cin>>vecc.at(i);
    }
    int sum=0;
    int count=-2;
    rep(i,s){
        sum+=vecb.at(vec.at(i)-1);
        if(count+1==vec.at(i)){
            sum+=vecc.at(vec.at(i)-2);
            count=vec.at(i);
        }
        else{
            count=vec.at(i);
        }
    }
        cout<<sum<<endl;
        
}





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

using namespace std;

void Solve() {
	int n;
	cin >> n;

	vector<int> a(n+1), b(n+1);

	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}

	for (int i = n; i >= 1; --i) {
		if ((n-i)&1) {
			b[n - (n-i)/2] = a[i];
		} else {
			b[(n-i)/2 + 1] = a[i];
		}
	}

	for (int i = 1; i <= n; ++i) {
		cout << b[i] << " ";
	}
	cout << "\n";
}

int main() {
	int tests = 1;
	for (;tests; --tests) {
		Solve();
	}
}

Measured memory_bytes: 3712
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem in C++
// MAIN IDEA   :
//============================================================================
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define rw freopen("graphs_as_a_service.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (ll i=a;i<=(ll)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define rep(i,a) lp(i,0,a-1)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace __gnu_pbds;
using namespace std;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int N = 1e3 + 3, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
int n, m;
bool vis[N][N][10] = { };
ll x[N], y[N], z[N], dp[N][N][10] = { };
ll solve(int idx, int rem, int mask) {
	if (!rem)
		return 0;
	if (idx >= n)
		return -1e15;
	ll &ret = dp[idx][rem][mask];
	if (vis[idx][rem][mask])
		return ret;
	vis[idx][rem][mask] = true;
	vi bit;
	lp(i,0,2)
	{
		if (mask & (1 << i))
			bit.pb(1);
		else
			bit.pb(-1);
	}
	ll c1 = solve(idx + 1, rem, mask);
	ll c2 = solve(idx + 1, rem - 1, mask) + bit[0] * x[idx] + bit[1] * y[idx]
			+ z[idx] * bit[2];
	return ret = max(c1, c2);
}
int main() {
#ifdef ONLINE_JUDGE
	FAST
#endif
	cin >> n >> m;
	lp(i,0,n-1)
		cin >> x[i] >> y[i] >> z[i];
	ll ans = -1e15;
	lp(i,0,7)
		ans = max(ans, solve(0, m, i));
	f(ans);
	return 0;
}

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

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

	int64_t n = s.size(), mod = 1000000007;

	vector<vector<int64_t>> dp(n + 1, vector<int64_t>(13, 0));
	dp[0][0] = 1;

	for (int64_t i = 0; i < n; i++)
	{
		for (int64_t j = 0; j < 13; j++)
		{
			if (s[i] == '?')
			{
				for (int64_t d = 0; d <= 9; d++)
				{
					(dp[i + 1][(10 * j + d) % 13] += dp[i][j]) %= mod;
				}
			}
			else
			{
				int64_t d = (s[i] - '0');
				(dp[i + 1][(10 * j + d) % 13] += dp[i][j]) %= mod;
			}
		}
	}

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

	return 0;
}

Measured memory_bytes: 13696
/*

        /////////  /////      ////      ///
        //        //   //    //  //  // //
        //////   //    //   //    //   //
            //  // /// //  //         //
      //////// //      // //         //
      
         

*/

#include<bits/stdc++.h>
#include<assert.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
#define Fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(0);
#define fo(i,s,n) for(int i=s;i<n;i++)
#define mod 1000000007
#define umap unordered_map
#define pb(x) push_back(x)
#define all(x) (x).begin(), (x).end()
#define lb() lower_bound()
#define ub() upper_bound()
#define PI 3.14159265
#define S second
#define F first 
//fill(all(vec), 1);to fill vector with a number
//if (S.count(key)) returns 1 if set or map contain key else return 0
ll nCr(ll n,ll r)
{
	r = min(r,n-r);
	if(r<0)
		 return 0;
	if(r == 0)
		return 1;
	ll ans = 1;
	for(ll i = 1;i<=r;i++)
	{
		ans = ans*(n-i+1)/i;
    }
	return ans;
 		
}


ll logn(int n, int r) 
{ 
     return (n > r - 1) ? 1 + logn(n / r, r) : 0; 
} 


ll power(ll a,ll b) {
	if(b == 1) return a;
	if(b == 0) return 1;
	ll m1 = power(a,b/2);
	if(b%2) return m1*m1*a;
	return m1*m1;
}


bool isprime(ll a)
{
    if(a<=1)
        return false;
    if(a==2||a==3)
        return true;
    if(a%2==0||a%3==0)
        return false;
    for(ll i=5;i*i<=a;i=i+6)
    {
        if(a%i==0||a%(i+2)==0)
            return false;
    }
    return true;

}
/*********************//*********************///*********************///*********************//
ll t;

void solve()
{
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll w=0,r=0;
    fo(i,0,n)
    {
        if(s[i]=='R')
            r++;
        else
        {
            w++;
        }
        
    }
    ll ans=min(r,w);
    ll pr=0,pw=0;
    fo(i,0,n)
    {
        if(s[i]=='W')
        {
            pw++;
            r--;
        }
        else
        {
            pr++;
            w--;
        }
        //if(pr-w>=0)
            ans=min(ans,pr+w);
            //ans=min(ans,pr)
        
    }
    ll hw=0,hr=0;
    int i=0,j=n-1;
    while(i<n&&j>=0&&i<j)
    {
        if(s[i]!='W')
        {
            i++;
        }
        if(s[j]!='R')
            j--;
        if(s[i]=='W'&&s[j]=='R')
        {
            i++;
            j--;
            hr++;
        }
    }
    ans=min(ans,hr);
    cout<<ans<<endl;
}



int main()
{
    Fast
/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
*/
    //cin>>t;
    t=1;
    for(ll i=1;i<=t;i++)
    {
      solve();
    }

    
    return 0;
}

Measured memory_bytes: 3756
#include <cstdio>
#include <cstring>
#include<iostream>

using namespace std;


char s[200];
int k = 0;
int n = 0;
int main(void) {
	
	cin >> s;


	int Len = strlen(s)-8;

	char ans[200];
	for (int i = 0; i < Len; i++) {
		ans[i] = s[i];
	}	
	ans[Len] = '\0';
	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
#include <assert.h>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;


void Main(){
    ll N;
    sll(N);
    if(N>=30){
        cout << "Yes"<<endl;
    }else{
        cout << "No"<<endl;

    }

}

int main(){
    Main();
}

Measured memory_bytes: 3188
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    s=readline().strip()

    ans=0
    for i in range(n):
        res=z_algorithm(s[i:])
        for j in range(n-i):
            ans=max(ans,min(res[j],j))

    print(ans)

def z_algorithm(s):
    n=len(s)
    z=[0]*n
    z[0]=n
    i=1
    j=0

    while i<n:
        while i+j<n and s[j]==s[i+j]:
            j+=1
        z[i]=j
        if j==0:
            i+=1
            continue
        k=1
        while i+k<n and k+z[k]<j:
            z[i+k]=z[k]
            k+=1
        i+=k
        j-=k
    return z

if __name__=="__main__":
    main()

Measured memory_bytes: 48348
let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  List.rev (doit str [])

let rec repl () =
  let l = read_line () in
  match List.map int_of_string (split l ' ') with
  | [] | [_] -> exit 1
  | x :: y :: _ ->
      if (x = 0) && (y = 0) then ()
      else begin
        Printf.printf "%d %d\n" (min x y) (max x y);
        repl ()
      end

let () =
  try repl () with End_of_file -> ()

Measured memory_bytes: 3364
a, b, c = list(map(int, input().split()))
list_yakusuu = []
for i in range(1, c+1):
  if c % i == 0:
    list_yakusuu.append(i)
  else:
    continue
list_ans = []
for j in list_yakusuu:
  if a <= j <= b:
    list_ans.append(j)
  else:
    continue
print(len(list_ans))


Measured memory_bytes: 5600
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
    int n,m,v;
    cin>>n>>m;
    int a[n][m];
    int b[m];

    int i;
    for (i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin>>v;
            a[i][j]=v;
        }

    }
    for (int j = 0; j < m; ++j) {
        cin>>v;
        b[j]=v;
    }

    for (i = 0; i < n; ++i) {
        int sum=0;
        for (int j = 0; j < m; ++j) {
            sum+=b[j]*a[i][j];
        }
        cout<<sum<<endl;
    }

        return 0;

}


Measured memory_bytes: 3124
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i = ll(a); i <= ll(b); i++)
int main()
{
    ll n,m,c,sum=0,cnt=0;
    cin>>n>>m>>c;
    ll a[n+1][m+1],b[m+1];
    REP(i,1,m)
        cin>>b[i];
    REP(i,1,n)
        REP(j,1,m)
            cin>>a[i][j];
    REP(i,1,n)
    {
        sum=0;
        REP(j,1,m)
            sum+=a[i][j]*b[j];
        if(sum+c>0)
            cnt++;
    }
    cout<<cnt;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
typedef long long ll;
using namespace std;

int gcd(int a, int b, int c)
{
	while (a!=b)
	{
		if (a>b) a-=b;
		else b-=a;
	}
	while (a!=c)
	{
		if (a>c) a-=c;
		else c-=a;
	}
	return a;
}
int main()
{
	int k;
	cin >> k;
	ll sum=0;
	for (int i=1; i<=k; i++)
		for (int j=1; j<=k; j++)
			for (int f=1; f<=k; f++)
				sum+=gcd(i,j,f);
	cout << sum;
	return 0;
}

Measured memory_bytes: 3588
#include<iostream>
    #include<math.h>
    #include<iomanip>
    #include<vector>
    using namespace std;
    #define PI 3.14159265358979

    inline void ten(int a,vector<int>& b,int N)
    {
        b[a]++;
    }

    int main(void)
    {
        int N,K,Q;
     

        cin>>N>>K>>Q;

        vector<int>p(N,0);


        for(int i=0;i<Q;i++)
        {
            int mc;
            cin>>mc;
            int mc1=mc-1;
            ten(mc1,p,N);
   
        }
       
        
        
        for(int j=0;j<N;j++)
        {       
            if(Q-p[j]<K) cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
        }
}




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

using namespace std;

#define ll long long

int bin_pow(int a, int pow) {
    if (pow == 0) return 1;
    if (pow == 1) return a;
    if (pow % 2 == 0) {
        int tmp = bin_pow(a, pow / 2);
        return tmp * tmp;
    }
    return a * bin_pow(a, pow - 1);
}

int fact(int x) {
    int ans = 1;

    for (int i = 1; i <= x; i++) ans *= i;
    return ans;
}

int count(vector<int> a) {
    int ans = 0;
    unordered_set<int> was;
    for (int i = 0; i < a.size(); i++) {
        int count = a[i] - 1;
        for (int j = 1; j < a[i]; j++) {
            count -= was.count(j);
        }
        ans += count * fact(a.size() - i - 1);
        was.insert(a[i]);
    }

    return ans;
}

ll m = 1000000007;

int main() {
    cin.tie();
    ios_base::sync_with_stdio(false);
    ll a, b, c;
    cin >> a >> b >> c;

    if (a > c) {
        cout << (a - c) << " " << b;
        return 0;
    }

    c -= a;
    cout << 0 << " " << (b - c > 0 ? b-c : 0 );
    return 0;
}

Measured memory_bytes: 256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1) { res = res * a%MOD; }
		a = a * a%MOD;
		b >>= 1;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑


int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << a - (b + c - d) << endl;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
using namespace std;

int main(){
    int x; cin >> x;
    rep(i,1000){
        rep(j,1000){
            if(pow(i,5)+pow(j,5)==x){
                cout << i << ' ' << -j << endl;
                return 0;
            }
            if(pow(i,5)-pow(j,5)==x){
                cout << i << ' ' << j << endl;
                return 0;
            }
        }
    }
    
return 0;
}
 

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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){

  string s;cin>>s;
  int k;cin>>k;

  set<string>se;
  int n=s.size();
  rep(i,0,n){
    rep(j,1,min(5,n)+1){
      se.insert(s.substr(i,j));
    }
  }

  int count=0;
  for(set<string>::iterator itr=se.begin();itr!=se.end();itr++){
    // out(*itr);
    count++;
    if(count==k){
      out(*itr);
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 1664
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j,k;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		HashMap<Integer, Integer> map = new HashMap<>();
//		int[] a = new int[1000000000+1];
		int a = 0;
		for(i=0; i<n; i++) {
//			a[parseInt(sc.next())]++;
			a = parseInt(sc.next());
			if(map.containsKey(a)) {
				map.put(a, map.get(a)+1);
			} else {
				map.put(a, 1);
			}
		}
		int b;
		int c;
		for(i = 0; i < m; i++) {
			b = parseInt(sc.next());
			c = parseInt(sc.next());
			if(map.containsKey(c)) {
				map.put(c, map.get(c)+b);
			} else {
				map.put(c, b);
			}
//			a[c] += b;
		}
		sc.close();
//		out.println(Arrays.toString(a));
		Integer[] keys = map.keySet().toArray(new Integer[map.size()]);
		Arrays.sort(keys, Comparator.reverseOrder());
		int cnt = 0;
		long sum = 0;
		for(Integer ii: keys) {
			if(map.get(ii) == 0) continue;
//			out.printf("%d:%d%n", ii, map.get(ii));
			if(map.get(ii) + cnt > n ) {
				sum += (long)ii*(n-cnt);
				break;
			} else {
				sum += (long)ii*map.get(ii);
			}
			cnt += map.get(ii); 
		}
		out.println(sum);
	}
}


Measured memory_bytes: 72548
using System;
class Program
{
	static void Main(string[] args)
	{
        int tryNum = int.Parse(Console.ReadLine());
        string inputS = Console.ReadLine();
        int x = 0;
        int maxX = 0;
        for(int i=0; i<tryNum; i++){
            if(inputS[i] == 'I'){
                x++;
            }else{
                x--;
            }
            if(x > maxX)
                maxX = x;
        }
        Console.WriteLine(maxX);
	}
}

Measured memory_bytes: 2776
import java.util.*;
 import java.math.BigInteger;
public class Main
{
	static int ans[];
	public static  void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		String h[]=sc.nextLine().split(" ");
		int n=Integer.parseInt(h[0]);
		int m=Integer.parseInt(h[1]);
		int x=Integer.parseInt(h[2]);
		ArrayList<Pair>arr=new ArrayList<>();
		for(int i=0;i<n;i++)
		{
			String hh[]=sc.nextLine().split(" ");
			ArrayList<Integer>arr1=new ArrayList<>();
			for(int j=1;j<hh.length;j++)
			{
				arr1.add(Integer.parseInt(hh[j]));
			}
			arr.add(new Pair(Integer.parseInt(hh[0]),arr1));
		}
		int f=dfs4(new int[(int)Math.pow(2,n+1)],arr,0,new int[m],0,x,0);
		f=f==Integer.MAX_VALUE?-1:f;
		System.out.println(f);

	}
	static int dfs4(int dp[], ArrayList<Pair>arr, int state, int gg[], int i, int x, int cost)

	{
		if(i==arr.size()){for(int j=0;j<gg.length;j++){if(gg[j]<x){return Integer.MAX_VALUE;}}return cost;}
		if(dp[state]!=0){return dp[state];}
		int a=dfs4(dp,arr,state,gg,i+1,x,cost);
		int aa[]=new int[gg.length];
		System.arraycopy(gg,0,aa,0,aa.length);
		for(int j=0;j<arr.get(i).b.size();j++)
		{
			aa[j]+=arr.get(i).b.get(j);
		}
		// System.out.println(Arrays.toString(aa));
		state=state+(int)Math.pow(2,i);
		int b=dfs4(dp,arr,state,aa,i+1,x,cost+arr.get(i).a);
		dp[state]=Math.min(a,b);
		return Math.min(a,b);
	}
	static long get3(double n, int steps)
	{
		if(n<1){return Integer.MAX_VALUE;}
		if(n==1){return steps;}

		System.out.println(n);
		return get3(n/2.0-1,steps+1);
	}
	static String get(long a, long b)
	{long y=1;
		while(true)
		{

			long z=y-a;
			long q=get2(y,z);
			// System
			if(q==b){return y+" "+z;}
			else if(q>b){return "-1";}
			y+=1;
		}
		// return "-1";
	}
	static long get2(long y, long z)
	{
		return (long)(Math.pow(y,4)+Math.pow(y,3)*z+Math.pow(y,2)*Math.pow(z,2)+y*Math.pow(z,3)+Math.pow(z,4));
	}
	static void get(ArrayList<ArrayList<Integer>>arr, int i , int p,int val[], int arr1[], int len)
	{
		for(int j=0;j<arr.get(i).size();j++)
		{
			if(ans[arr.get(i).get(j)]==0 && arr.get(i).get(j)!=p){
			if(val[arr.get(i).get(j)]>arr1[len-1])
			{
				arr1[len]=val[arr.get(i).get(j)];
				ans[arr.get(i).get(j)]=len+1;
				get(arr,arr.get(i).get(j),i,val,arr1,len+1);
				
			}
			else
			{
				int index=bin(arr1, val[arr.get(i).get(j)], len-1);
				ans[arr.get(i).get(j)]=len;
				// int g=arr1[index];
				arr1[index]=val[arr.get(i).get(j)];
				get(arr,arr.get(i).get(j),i,val,arr1,len);
				// arr1[index]=g;
			}}

		}
	}
	static int bin(int arr[], int val, int len)
	{
		if(arr[0]>=val){return 0;}
		int l=0;
		int r=len;
		while (r - l > 1) { 
            int m = l + (r - l) / 2; 
            if (arr[m] >= val) 
                r = m; 
            else
                l = m; 
        } 
  
        return r; 
		// return l;
	}
	
	

}
class Pair
{
	int a;
	ArrayList<Integer>b;
	Pair(int e,ArrayList<Integer> f){
		a=e;
		b=f;
		
	}
}



	


Measured memory_bytes: 38996
#include <stdio.h>

int check[2];

int main() {

	int N;

	scanf("%d", &N);

	int i;

	for (i = 0; i < N; i++) {
		int A;
		scanf(" %d", &A);
		A %= 2;
		check[A]++;
	}
	if (check[0] > 0) {
		check[0] = 1;
	}
	if (check[1] > 1) {
		check[1] -= (check[1] / 2) * 2;
		check[0]++;
	}

	if (check[0] == 2) { check[0] = 1; }

	if (check[0] + check[1] == 1) {
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}

	return 0;
}

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

int main(){
    double a,b,x;
    cin >> a >> b >> x;
    double ans;
    if(x<a*a*b/2.0){
        double l = x/a/b*2;
        ans = 90 - 180*atan(l/b) / M_PI; 
    }else{
        double l = x/a/a*2-b;
        ans = 90 - 180*atan(a/(b-l))/M_PI;
    }
    printf("%.10lf",ans); 
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		//input
			// each coin num
			// amount
		// pattern num
		//logic
			//1.(総当たり式)amoutから各パターン(各coinの合計)を引いて、0になったら有効なパターンとしてカウント。
				//(各コインの枚数分試行する必要があるので、三重ループ)
				//一番値が大きいcoinから決め打ちにする
				//問題
					//三重ループだと重い
			//2.
		Scanner scan = new Scanner(System.in);
		
		int num_500Coin = scan.nextInt();
		int num_100Coin = scan.nextInt();
		int num_50Coin = scan.nextInt();
		int target_amount = scan.nextInt();
		
		int n_pattern=0;
		
		//条件check
		if(num_500Coin<0 || num_500Coin > 50) return;
		if(num_100Coin<0 || num_100Coin > 50) return;
		if(num_50Coin<0 || num_50Coin > 50) return;
		if((num_500Coin + num_100Coin + num_50Coin)<1) return;
		if(target_amount<50 || target_amount>20000) return;
		if(target_amount%50 !=0) return;
		
		//caluc
		int y;
		
		for(int i = 0;i <= num_500Coin;i++) {
			y = target_amount - 500*i;
			if(y<0) continue;
			if(y==0) {//他のコインが0枚のパターン
				n_pattern++;
				continue;
			}
			
			for(int j = 0;j <= num_100Coin;j++) {
				int tmp1;
				tmp1 = y - 100*j;
				if(tmp1<0) continue;
				if(tmp1==0) {
					n_pattern++;
					continue;
				}
				
				for(int k = 0;k <= num_50Coin;k++) {
					int tmp2;
					tmp2 = tmp1 - 50*k;
					if(tmp2<0) continue;
					if(tmp2==0) {
						n_pattern++;
						continue;
					}
					
				}
			}
		}
		System.out.println(n_pattern);
	}

}


Measured memory_bytes: 21972
n = list(map(int, input().split()))

for i in range(len(n)):
  if n[i] == 1:
    n[i] = 1
  elif n[i] == 7:
    n[i] = 10
  elif n[i] == 9:
    n[i] = 100
  elif n[i] == 4:
    n[i] = 1000
    
if sum(n) == 1111:
  print("YES")
else:
  print("NO")

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N, M;
    cin >> N >> M;

    vector<ll> A(N, 0);

    REP(i, M){
        ll a, b;
        cin >> a >> b;
        a--;
        b--;

        A[a]++;
        A[b]++;
    }
    REP(i, N){
        if(A[i]%2 != 0){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 4060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
inline bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
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; }


ll binpow(ll x,ll n,ll m){
	ll ret = 1;
	while(n){
		if(n % 2 == 1) ret = ret * x % m;
		x = x * x % m;
		n /= 2;
	}
	return ret;
}



int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a,b;cin >> n >> a >> b;
	ll ans = binpow(2, n, mod) - 1;
	ll k1 = 1, k2 = 1, t1 = 1, t2 = 1;
	for(ll i = n; i >= n - a + 1; i--){
		k1 *= i;
		k1 %= mod;
	}
	for(ll i = n; i >= n - b + 1; i--){
		k2 *= i;
		k2 %= mod;
	}
	for(ll i = 1; i <= a; i++){
		t1 *= i;
		t1 %= mod;
	}
	for(ll i = 1; i <= b; i++){
		t2 *= i;
		t2 %= mod;
	}
	ans = ans - k1 * binpow(t1, mod - 2, mod) % mod + mod;
	ans = ans - k2 * binpow(t2, mod - 2, mod) % mod + mod;
	cout << ans % mod << endl;
}

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

int main(){
    set<int> s;
    for(int i=0;i<3;i++){
        int a;cin>>a;
        s.insert(a);
    }
    if(s.size()==2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> P(N, 0);
    for (int i = 0; i < N; i++)
    {
        cin >> P[i];
    }
    int ans = 0;
    vector<int> A(N, 0);
    A[0] = P[0];
    for (int i = 1; i < N; i++)
    {
        A[i] = min(A[i - 1], P[i]);
    }
    for (int i = 0; i < N; i++)
    {
        if (A[i] == P[i])
        {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1920
from statistics import mean, median,variance,stdev
import sys
import math

#a = input().split()
#y = input().split()


#y = int(input())
x = int(input())
a = []
for i in range(x):
    a.append(int(input()))
a = sorted(a,reverse=1)
a[0]/=2
print(int(sum(a)))


Measured memory_bytes: 5404
#include<stdio.h>
    
int main(){
    
int a,i,j,amari[10]={0},end;
int weight[10]={1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  
while(scanf("%d\n", &a)!=EOF){
    
   for(j=0;j<10;j++){
     amari[j]=a%2; 
     a=a/2;
     //if(a==0)break;
   }
   for(i = 0; i < 10; i++)
   {if (amari[i] == 1) end = i;}
 
   for(j=0;j<10;j++){
 
   if (j == end)
      {printf("%d\n", weight[j]);
       break; }
 
     if(amari[j]==1) 
        printf("%d ",weight[j]);
    }
  }
    
    return 0;
}

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

using namespace std;

#define int long long
#define PB push_back
#define PPB pop_back
typedef pair<int, int> pii;
static const int INF = 1LL<<61;
static const int MAX_N = 100005;

struct E {
  int to, cost;
  E(){}
  E(int p1, int p2) {
    to = p1;
    cost = p2;
  }
};

int n, m, x, H[MAX_N], d[MAX_N];
vector<E> G[MAX_N];
priority_queue<pii, vector<pii>, greater<pii> > q;

void dijkstra() {
  fill(d, d + MAX_N, INF);
  d[1] = 0;
  q.push(pii(0, 1));

  while (q.size()) {
    pii p = q.top();
    q.pop();
    int v = p.second;
    if (d[v] < p.first) continue;
    int h = max(0LL, x - p.first);

    for (int i = 0; i < G[v].size(); ++i) {
      int to = G[v][i].to, cost = G[v][i].cost, ncost = cost + p.first;
      if (h < cost) ncost += cost - h;
      else if (H[to] < h - cost) ncost += h - H[to] - cost;

      if (d[to] <= ncost) continue;
      d[to] = ncost;
      q.push(pii(ncost, to));
    }
  }

  cout << ((d[n] == INF) ? -1 : d[n] + (H[n] - max(0LL, x - d[n]))) << endl;
}

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

  cin >> n >> m >> x;
  for (int i = 1; i <= n; ++i) {
    cin >> H[i];
  }

  for (int i = 0; i < m; ++i) {
    int a, b, t;
    cin >> a >> b >> t;
    if (0 <= H[a] - t) G[a].PB(E(b, t));
    if (0 <= H[b] - t) G[b].PB(E(a, t));
  }

  dijkstra();

  return 0;
}

Measured memory_bytes: 21380
n = int(input())
a = list(map(int, input().split()))

b = list(set(a))

if a.count(0) == n:
    print("Yes")
elif len(b) == 2 and a.count(0) == n / 3:
    print("Yes")
elif len(b) == 3 and b[0] ^ b[1] ^ b[2] == 0 and a.count(b[0]) == n / 3 and a.count(b[0]) == n / 3:
    print("Yes")
else:
    print("No")
        


Measured memory_bytes: 14212
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b; cin >> a >> b;
    if(b < a) OUT(a-1);
    else OUT(a);

    return 0;
}

Measured memory_bytes: 256
//// Journey of Harry Singh from Diploma in Cse to Red Coder of India.///////////////////////////////////////////////////
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
int n,m;cin>>n>>m;
int sum=0;
int a[n+1][m+1];
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cin>>a[i][j];

vector<pair<pair<int,int>,pair<int,int> > > vc;
for(int i=1;i<=n;i++)
{
	
	for(int j=1;j<=m;j++)
	{
		if(j + 1 <=m and a[i][j]%2!=0) {
		a[i][j+1]++;
		a[i][j]--;
		vc.push_back({{i,j},{i,j+1}});}
	}
}

for(int i=1;i<=n;i++)
{
	if(i + 1 <=n and a[i][m]%2!=0) {
		a[i+1][m]++;
		a[i][m]--;
		vc.push_back({{i,m},{i+1,m}});}
}
cout<<vc.size()<<"\n";
for(auto sd:vc)
cout<<sd.first.first<<" "<<sd.first.second<<" "<<sd.second.first<<" "<<sd.second.second<<"\n";

}


Measured memory_bytes: 5232
#include <bits/stdc++.h>
     
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair
     
using namespace std;
     
typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <ll> vll;
     
int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  char ch;
  cin >> ch;
  cout << char(ch + 1) << '\n';
  return (0);
}


Measured memory_bytes: 384
#include <iostream>
#include <queue>

#define REP(i, n) for (int i = 0; i < n; i++)
#define debug(x) cerr << #x << " = " << (x) << endl;

using namespace std;

int main() {
	while (1) {
		int n, j, count, i, ans;
		const int rule[5] = {5, 7, 5, 7, 7};
		string w[41];
		queue<pair<int, int> > kouho;
		
		cin >> n;
		if (n == 0) break;
		REP(i, n) cin >> w[i];
		ans = 0;
		
		while(ans<n){
			j = 0;
			count = 0;
			i = ans;
			while (i < n) {
				count += w[i].length();
				//if (w[i].length() <= 5) kouho.push(make_pair(i,i));
				//debug(i);
				if (count == rule[j]) {
					//debug(count);
					//debug(j);
					if (j >= 4) {
						cout << ans+1 << endl;
						ans = n;
						break;
					}
					count = 0;
					j++;
					i++;
				} else if (count > rule[j]) {
					ans++;
					break;
				} else {
					i++;
				}
			}
		}
		//cout << "------------" << endl;
	}
	return 0;
}



Measured memory_bytes: 3148
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	ll r;cin>>r;
	cout<<pow(r,2);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x)     memset(x,0,sizeof(x))
#define all(a)      a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

/*---------------------------------------------------------------------------------------------------*/

void solve()
{
  int x;
  cin >> x;
  if(x>=400 && x<=599)
    cout << "8\n";
  if(x>=600 && x<=799)
    cout <<"7\n";
  if(x>=800 && x<1000)
    cout << "6\n";
  if(x>=1000 && x<1200)
    cout << "5\n";
  if(x>=1200 && x<1400)
    cout << "4\n";
  if(x>=1400 && x<1600)
    cout << "3\n";
  if(x>=1600 && x<1800)
    cout  << "2\n";
  if(x>=1800 && x<2000)
    cout << "1\n";
  return;
} 

signed main()
{
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  FAST
  int T=1;
  // cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 1; i < (n); ++i)
void Main() {
    ll N;
    cin >> N;
    rep(h, 3501) {
        rep(n, 3501) {
            if ((4 * h * n - N * n - N * h) == 0) continue;
            ll x = (N * h * n);
            ll y = (4 * h * n - N * n - N * h);
            if (x > 0 && y > 0 && x % y == 0) {
                cout << h << ' ' << n << ' ' << x / y << endl;
                return;
            }
        }
    }
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt(),k=sc.nextInt(),min=1;
    for(int i=1;i<=n;i++){
      min=(int)Math.min(2*min,min+k);
    }
    System.out.print(min);
  }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 5000
#define MOD 1000000007

int main(){
  ll N;
  cin>>N;
  int minus=0;
  int zero=0;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    ll a;
    cin>>a;
    if(a<0){
      minus++;
      a=-a;
    }else if(a==0){
      zero=1;
    }
    A.at(i)=a;
  }
  sort(A.begin(),A.end());

  minus%=2;
  ll sum=0;
  for(int i=0;i<N;i++){
    sum+=A.at(i);
  }
  if(minus==0||zero==1){
    cout<<sum<<endl;
  }else{
    cout<<sum-2*A.at(0)<<endl;
  }
}


Measured memory_bytes: 1024
package main

import (
	"fmt"
	"log"
	"strconv"
)

func main() {
	var (
		S string
		sum, start, retSum int
	)
	fmt.Scan(&S)
	l := len(S)
	for bit := 0; bit < (1 << (l-1)); bit++ {
		for i := 0; i < l-1; i++ {
			if (bit >> i) & 1 == 1 {
				num, err := strconv.Atoi(S[start:i+1])
				if err != nil {
					log.Fatalln(err)
				}
				sum += num
				start = i+1
			}
		}
		num, _ := strconv.Atoi(S[start:l])
		retSum += sum + num
		sum, start = 0, 0
	}
	fmt.Println(retSum)
}


Measured memory_bytes: 1840
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        int[] era = new int[100000001];
        for(int i = 2; i <= 100000000; i++){
            if(era[i] == 0){
                era[i] = 1;
                if(i <= 10000){
                    int j = 2*i;
                    while(j <= 100000000){
                        if(era[j] == 0){
                            era[j] = -1;
                        }
                        j += i;
                    }
                }
            }
        }
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
    	int cnt = 0;
        for(int i = 0; i < n; i++){
            int x = scan.nextInt();
            if(era[x] > 0){
                cnt++;
            }
        }
    	System.out.println(cnt);
    }
}


Measured memory_bytes: 435024