akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const ll mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, y;
    cin >> n >> y;
    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= n; ++j){
            if(i + j > n)   break;
            if(10000 * i + 5000 * j > y)    continue;
            if(1000 * (n - i - j) == y - 10000 * i - 5000 * j){
                cout << i << " " << j << " " << n - i - j << "\n";
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << "\n";
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

string keys[4] = {"AC", "WA", "TLE", "RE"};

int main() {
    int N;
    cin >> N;
    map<string, int> cnt;
    for_(i,0,N) {
        string S;
        cin >> S;
        ++cnt[S];
    }

    for_(i,0,4) cout << keys[i] << " x " << cnt[keys[i]] << endl;
}

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

namespace Number {
    typedef long long int LL;
    // 求取 a, b 的最大公因數
    LL gcd(LL a, LL b) {
        if (a % b == 0) {
            return b;
        }
        return gcd(b, a % b);
    }
    // 求取 a, b 的最大公因數 gcd
    // 以及 x, y 使得 a*x + b*y = gcd
    LL gcd_extend(LL a, LL b, LL *x, LL *y) { 
        if (a == 0) { 
            *x = 0, *y = 1; 
            return b; 
        } 
    
        LL x1, y1; // To store results of recursive call 
        LL gcd = gcd_extend(b%a, a, &x1, &y1); 
    
        *x = y1 - (b/a) * x1; 
        *y = x1; 
    
        return gcd; 
    }
    // 求 a_inv 使得 (a * a_inv) % m = gcd(a, m)
    // 若 a, m 互質，即求 a 在 mod m 群的反元素 a_inv 
    LL mod_inv(LL a, LL m) { 
        LL x, y; 
        LL g = gcd_extend(a, m, &x, &y); 
        // 處理 x 爲負的情形 
        LL a_inv = (x%m + m) % m; 
        return a_inv;
    }
    // 求 x^n % m
    LL mod_pow(LL x, LL n, LL m) {
        if (n == 0) {
            return 1;
        } else if (n & 1) {
            LL half = mod_pow(x, n/2, m);
            return (half * half % m) * x % m;
        } else {
            LL half = mod_pow(x, n/2, m);
            return half * half % m;
        }
    }
    // 連乘
    LL mul(LL from, LL to, LL m) {
        LL ret = 1;
        for (LL i = from; i <= to; i++) {
            ret *= i;
            ret %= m;
        }
        return ret;
    }
    // 求 (C n 取 k) % m
    LL mod_comb(LL n, LL k, LL m) {
        LL mi = k < n-k ? k : n-k;
        LL up = mul(n - mi + 1, n, m);
        LL down = mul(1, mi, m);
        return (up * mod_inv(down, m)) % m;
    }
}

unordered_map<int, int> m;

int main() {
    int N, P; scanf("%d %d", &N, &P);
    char S[200002]; scanf("%s", S);
    long long ans = 0;
    LL cur = 0;
    if (P == 2 || P == 5) {
        for (int i = 0; i < N; ++i) {
            if ((S[i] - '0') % P == 0) {
                ans += (i + 1);
            }
        }
        cout << ans << endl;
        return 0;
    }
    m[0] = 1;
    for (int i = N - 1; i >= 0; --i) {
        cur += (S[i] - '0') * Number::mod_pow(10, i - (N - 1), P); 
        cur %= P;
        if (m.find(cur) != m.end()) {
            ans += m[cur];
            m[cur]++;
        } else {
            m[cur] = 1;
        }
        /*
        for (auto x : m1) {
            printf("(%d, %d)\n", x.first, x.second);
        }
        printf("==============\n");
        */
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 896
from math import *

def trycut(val):
	if val == 0 : return float('inf')
	ret = 0
	for i in range(n):
		ret += (a[i]+val-1)//val -1
	return ret 

n,k=map(int,input().split())
a = [int(i) for i in input().split()]

low = 0
high = 1000000000
ans  =-1

while low <= high:
	mid = (low + high)//2
	cut = trycut(mid)
	if cut <= k:
		high = mid-1
		ans = mid
	else:
		low =  mid+1
print(ans)




Measured memory_bytes: 31100
#include <stdio.h>
#include <string.h>

int main(void)
{
    int flag=0;
    char s[101]={};
    scanf("%s",s);
    for(int i=0;i<strlen(s);i++){
        if(i%2==0){
            if(s[i]=='L') break;
        } else {
            if(s[i]=='R') break;
        }
        if(i==strlen(s)-1){
            flag=1;
        }
    }
    if(flag==1) printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*
*/
using Graph = vector<bitset<10>>;
ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main(){
  int N;
  cin >> N;
  vector<ll> X(N);
  rep(i,N){
    cin >> X[i];
  }
  sort(X.begin(),X.end());
  ll mini = X[0];
  ll maxim = X[N-1];

  ll ans = 10000000000;
  for(ll p = mini ;p<=maxim ;p++){
    ll sum = 0;
    for(int j = 0;j<N;j++){
      sum += (X[j] - p)*(X[j] - p);
    }
    ans = min(ans,sum);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar (char ch)
{
	if (ch=='A') return 1;
	else if (ch=='C') return 2;
	else if (ch=='G') return 3;
	else if (ch=='T') return 4;
	else return 0;
}

long long getKey(char str[])
{
	long long sum=0,p=1,i;
	for (i=0;i<strlen(str);i++)
	{
		sum+=p*(getChar(str[i]));
		p*=5;
	}
	return sum;
} 

int h1(int key)
{
	return key%M;
}

int h2(int key)
{
	return 1+(key%(M-1));
}

int find (char str[])
{
	long long key,i,h;
	key=getKey(str);
	for(i=0;;i++)
	{
		h=(h1(key)+i*h2(key))%M;
		if (strcmp(H[h],str)==0) return 1;
		else if (strlen(H[h])==0) return 0;
	} 
	return 0;
}

int insert (char str[])
{
	long long key,i,h;
	key=getKey(str);
	for (i=0;;i++)
	{
		h=(h1(key)+i*h2(key))%M;
		if (strcmp(H[h],str)==0) return 1;
		else if (strlen(H[h])==0)
		{
			strcpy(H[h],str);
			return 0;
		}
	}
}
int main ()
{
	int i,n,h;
	char str[L],com[9];
	for (i=0;i<M;i++) H[i][0]='\0';
	scanf ("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf ("%s %s",com,str);
		if (com[0]=='i')
		{
			insert(str);
		}
		else {
			if (find(str)) printf ("yes\n");
			else printf ("no\n");
		}
	}
	return 0;
}


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

int main() {
  int64_t N,K; cin>>N>>K;
  vector<int64_t> S(40,0),T(N);
  rep(i,N){
    int64_t A; cin>>A;
    T.at(i)=A;
    rep(j,40){
      if((A>>j)&1LL) S[j]++;
    }
  }
  int64_t ans=0,x=0;
  for(int i=39;i>=0;i--){
    if(S[i]<=N-S[i] && (x+(1LL<<i)<=K)){
      x+=(1LL<<i);
    }
  }
  rep(i,N) ans+=(x^T.at(i));
  cout<<ans<<endl;
}


Measured memory_bytes: 3952
using System;

namespace ITP1_1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] num = Console.ReadLine().Split();

            int leftSide, rightSide, top, bottom = 0;

            leftSide = int.Parse(num[2]) - int.Parse(num[4]);
            rightSide = int.Parse(num[2]) + int.Parse(num[4]);
            top = int.Parse(num[3]) + int.Parse(num[4]);
            bottom = int.Parse(num[3]) - int.Parse(num[4]);

            if (0 <= leftSide && 0 <= bottom && rightSide <= int.Parse(num[0]) && top <= int.Parse(num[1]))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}



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

int main()
{
  string sa, sb, sc, s;
  char tmp;
  int status;
  cin >> sa >> sb >> sc;
  tmp = sa[0];
  s = sa.erase(0, 1);
  while (true)
  {
    if (tmp == 'a')
    {
      tmp = sa[0];
      sa = sa.erase(0, 1);
      s = sa;
      status = 0;
    }
    else if (tmp == 'b')
    {
      tmp = sb[0];
      sb = sb.erase(0, 1);
      s = sb;
      status = 1;
    }
    else if (tmp == 'c')
    {
      tmp = sc[0];
      sc = sc.erase(0, 1);
      s = sc;
      status = 2;
    }
    else if (s == "")
    {
      break;
    }
  }
  if (status == 0)
    cout << "A" << endl;
  if (status == 1)
    cout << "B" << endl;
  if (status == 2)
    cout << "C" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll t;
ll ret = 0;
ll A = 0, B = 0, C = 0;
string s;


void input() {
  IN(A);
  IN(B);
}

void solve() {
  PRINT((A==B)?"Yes":"No");
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
typedef long long ll;
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
long long modpow(long long a,long long n,long long p)
{
    if(n==1)
    {
        return a%p;
    }
    if(n%2==1)
    {
        return a*modpow(a,n-1,p)%p;
    }
    long long t = modpow(a,n/2,p);
    return t*t%p;
}


int main()
{
    /*A
    int n;
    cin>>n;
    if(n%2==1)
    {
        cout<<n/2+1<<endl;
    }
    else
    {
        cout<<n/2<<endl;
    }
    */
    int c[3][3]={0};
    int a[3][3];
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>a[i][j];
        }
    }

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

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<3;k++)
            {
                if(b[i]==a[j][k])
                {
                    c[j][k]=1;
                }
            }
        }
    }
    int sum;
    for(int i=0;i<3;i++)
    {
        sum+=c[0][i];
        if(sum==3)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    sum=0;
    for(int i=0;i<3;i++)
    {
        sum+=c[1][i];
        if(sum==3)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    sum=0;
    for(int i=0;i<3;i++)
    {
        sum+=c[2][i];
        if(sum==3)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    sum=0;
    for(int i=0;i<3;i++)
    {
        sum+=c[i][0];
        if(sum==3)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    sum=0;
    for(int i=0;i<3;i++)
    {
        sum+=c[i][1];
        if(sum==3)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    sum=0;
    for(int i=0;i<3;i++)
    {
        sum+=c[i][2];
        if(sum==3)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    sum=0;
    for(int i=0;i<3;i++)
    {
        sum+=c[i][i];
        if(sum==3)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    sum=0;
    for(int i=0;i<3;i++)
    {
        sum+=c[i][2-i];
        if(sum==3)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    sum=0;
    
    cout<<"No"<<endl;

    return 0;
}

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

using namespace std;

const int MOD = 2019;

int main() {
  int L, R;
  scanf("%d %d", &L, &R);
  if (R - L > 2019) {
    puts("0");
    return 0;
  }
  int ans = 1e9;
  for (int i = L % MOD; i <= R % MOD; i++) {
    for (int j = i + 1; j <= R % MOD; j++) {
      ans = min(ans, (i * j) % MOD);
    }
  }
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200000




int main() {
	vector<pair<long long,long long> >a;
	long long n, k;
	long long x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%lld", &n);
	f(i, n) {
		scanf("%lld %lld", &x, &y);
		a.push_back(make_pair(y, x));
	}
	sort(a.begin(), a.end());
	s = 0;
	f(i, n) {
		s += a[i].second;
		if (s > a[i].first)v = false;
	}


	if(v)printf("Yes\n");
	else printf("No\n");


	return 0;
}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int a[200000],b[200000];
  int n;
  cin>>n;
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  bool flag=true;
  int ans=0;
  while(flag){
    flag=false;
    rep(i,n){
      if(b[(i+n-1)%n]+b[(i+1)%n] <= b[i]-a[i]){
	ans+=(b[i]-a[i])/(b[(i-1+n)%n]+b[(i+1)%n]);
	b[i]=((b[i]-a[i])%(b[(i-1+n)%n]+b[(i+1)%n]))+a[i];
	
	flag=true;
      }
    }
  }
  rep(i,n){
    if(a[i]!=b[i]){cout<<-1<<endl;return 0;}
  }
  //cout<<-1 % 3 <<endl;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3328
/*
                                                  __          __
      /\   |   |     /\   |  | |  |     /\   | / |  )   /\   |  )
     /__\  |   |    /__\  |--| |  |    /__\  |<  |-<   /__\  |-<
    /    \ |__ |__ /    \ |  | \__/   /    \ | \ |__) /    \ |  \

*/

#import<bits/stdc++.h>
typedef long long ll;
#define forl(n) for(int i=0; i<n; i++)
#define forll(i,a,b,c) for(int i=a; i<b; i+=c)
#define pb(n) push_back(n)

using namespace std;

int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b<<"\n";
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define LIMIT 1000000007 //10^9+7
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

int main(){
	int N,K;cin>>N>>K;
  vi A(N);
  rep(i,N)cin>>A[i];

  for(int i=K; i<N; i++){
    cout<<(A[i-K]<A[i] ? "Yes" : "No")<<endl;
  }
}

Measured memory_bytes: 3972
M=998244353
N=gets.to_i
S=gets.chomp
a=[0]*6
p (0...N*3).inject((1..N).inject(1){|s,i|(s*i)%M}){|s,i|
	c=S[i]=="R"?0:S[i]=="G"?1:2
	if a[c+3]>0 then
		a[c+3]-=1
		(s*(a[c+3]+1))%M
	elsif a[t=(c+1)%3]>0 then
		a[t]-=1
		a[3+(c+2)%3]+=1
		(s*(a[(c+1)%3]+1))%M
    elsif a[t=(c+2)%3]>0 then
		a[t]-=1
		a[3+(c+1)%3]+=1
		(s*(a[(c+2)%3]+1))%M
	else
		a[c]+=1
		s
	end
}

Measured memory_bytes: 2572
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#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=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    string a, b;
    cin >> a >> b;
    if (a.size() < b.size()) {
        cout << "LESS" << endl;
        return 0;
    } else if (a.size() > b.size()) {
        cout << "GREATER" << endl;
        return 0;
    } else {
        REP(i, a.size()) {
            if (a[i] < b[i]) {
                cout << "LESS" << endl;
                return 0;
            } else if (a[i] > b[i]) {
                cout << "GREATER" << endl;
                return 0;
            }
        }
    }
    cout << "EQUAL" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <string>

using namespace std;

template <class T>
using lp_queue=priority_queue<T, vector<T>, greater<T>>;

int main() {
    int N, L;
    scanf("%d %d", &N, &L);

    lp_queue<string> q;
    for (int i=0; i<N; ++i) {
        char buf[128];
        scanf("%s", buf);
        string S(buf);
        q.push(S);
    }

    while (!q.empty()) {
        printf("%s", q.top().c_str());
        q.pop();
    }

    printf("\n");

    return 0;
}


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

signed main(){

  string s; cin >> s;
  int bcnt = 0;
  int ans = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'B') bcnt++;
    else ans += bcnt;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
//============================================================================
// Name        : ITP_1_4_D.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

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

int main() {
	int n,max=-1000000,min=1000000,a;
	long sum=0;
	cin >> n;
	for(int i=0;i<n;++i) {
		scanf("%d",&a);
		if (a>max) max = a;
		if (a<min) min = a;
		sum += a;
	}
	printf("%d %d %ld\n",min, max, sum);
	return 0;
}

Measured memory_bytes: 3212
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String str = sc.next();
		String[] strArray = str.split("");

		boolean rightTurn = true;
		int leftCount = 0;
		int rightCount = 0;
		// System.out.println("strArray.length " + strArray.length);
		for (int i = 0; i < strArray.length; i++) {
			String s = strArray[i];
			boolean isRight = s.equals("R");
			// System.out.println("s " + s);

			if(rightTurn && isRight){
				rightCount ++;
			} else if (!rightTurn && !isRight){
				leftCount ++;
			} else if (rightTurn && !isRight) {
				leftCount++;
				rightTurn = false;
			} else {
				rightTurn = true;
				// ここが区切り

				if((leftCount + rightCount)%2 == 0 ){
					int sum = leftCount + rightCount;
					for (int j = 0; j < rightCount-1; j++) {
						System.out.print("0 ");
					}
					System.out.print((sum/2) + " ");
					System.out.print((sum/2) + " ");
					for (int j = 0; j < leftCount-1; j++) {
						System.out.print("0 ");
					}
				} else {
					// 奇数は面倒
					int sum = leftCount + rightCount;
					for (int j = 0; j < rightCount-1; j++) {
						System.out.print("0 ");
					}
					if(rightCount % 2 == 0){
						int result = sum/2;
						System.out.print(result + " ");
					}else{
						int result = sum/2 +1;
						System.out.print(result + " ");
					}


					if(leftCount % 2 == 0){
						int result = sum/2;
						System.out.print(result + " ");
					}else{
						int result = sum/2 +1;
						System.out.print(result + " ");
					}
					for (int j = 0; j < leftCount-1; j++) {
						System.out.print("0 ");
					}
				}
				leftCount = 0;
				rightCount = 1;
			}
		}


		// System.out.println();
		// System.out.println("rightCount " + rightCount);
		// System.out.println("leftCount " + leftCount);
		if((leftCount + rightCount)%2 == 0 ){
			int sum = leftCount + rightCount;
			for (int j = 0; j < rightCount-1; j++) {
				System.out.print("0 ");
			}
			System.out.print((sum/2) + " ");
			System.out.print((sum/2) + " ");
			for (int j = 0; j < leftCount-1; j++) {
				System.out.print("0 ");
			}
		} else {
			// 奇数は面倒
			int sum = leftCount + rightCount;
			for (int j = 0; j < rightCount-1; j++) {
				System.out.print("0 ");
			}
			if(rightCount % 2 == 0){
				int result = sum/2;
				System.out.print(result + " ");
			}else{
				int result = sum/2 +1;
				System.out.print(result + " ");
			}


			if(leftCount % 2 == 0){
				int result = sum/2;
				System.out.print(result + " ");
			}else{
				int result = sum/2 +1;
				System.out.print(result + " ");
			}
			for (int j = 0; j < leftCount-1; j++) {
				System.out.print("0 ");
			}
		}

	}

}


Measured memory_bytes: 45556
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
  int N,K;cin>>N>>K;
  vector<ll> num(K+1,0);
  ll ans = 0;
  for (int x = K;x > 0;x--) {
    //    cout << x << endl;
    ll cnt = 0, kind = 1;
    int now = x + x;
    while(now <= K) {
      kind++;
      cnt = (cnt + num[now]) % MOD;
      now += x;
    }
    ll gap = ((modpow(kind,N,MOD) - cnt + MOD) % MOD);
    ans += (gap * x) % MOD;
    ans %= MOD;
    num[x] = gap;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4016
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

struct edge{
  int to,cost;
};

int A,B,C,N,W,H,ans,dp[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	if(A % 3 && B % 3 && (A+B) % 3){
		cout << "Impossible\n";
	}else{
		cout << "Possible\n";
	}
}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> A >> B;
	
	solve();
	#ifdef DEBUG
	debug();
	#endif
	// answer();

	return 0;
}

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

namespace HABIT{
    #define f(a,b,c,d) for(register int a=b,c=d;a<=c;a++)
    #define g(a,b,c,d) for(register int a=b,c=d;a>=c;a--)
    #define LOCAL
    typedef int i32;
    typedef unsigned int u32;
    typedef long long int i64;
    typedef unsigned long long int u64;
    const i32 MAXN=4096;
    typedef i64 ar[MAXN];
    
    template<typename T> inline T Max(T a) { return a; }
    template<typename T,typename... Args> inline T Max(T a,Args... args){
        T b=Max(args...);
        return (a>b)?a:b;
    }
    template<typename T> inline T Min(T a) { return a; }
    template<typename T,typename... Args> inline T Min(T a,Args... args){
        T b=Min(args...);
        return (a<b)?a:b;
    }

    #ifdef LOCAL
        inline char gc() { return getchar(); }
    #else
        inline char gc() {
            static char s[1<<20|1]={0},*p1=s,*p2=s;
            return (p1==p2)&&(p2=(p1=s)+fread(s,1,1<<20,stdin),p1==p2)?EOF:*(p1++);
        }
    #endif
    inline i64 read(){
        register i64 ans=0;register char c=gc();register bool neg=0;
        while(c<48||c>57) neg^=!(c^'-'),c=gc();
        while(c>=48&&c<=57) ans=(ans<<3)+(ans<<1)+(c^48),c=gc();
        return neg?-ans:ans;
    }

    char Output_Ans[1<<20|1],*Output_Cur=Output_Ans;
    inline void output() { Output_Cur-=fwrite(Output_Ans,1,Output_Cur-Output_Ans,stdout); }
    inline void print(char c){
        if(Output_Cur-Output_Ans+1>>20) output();
        *(Output_Cur++)=c;
    }
    inline void print(char *s) { while(*s) print( *(s++) ); }
    inline void print(u64 x){
        if(!x) { print('0'); return ; }
        char buf[30]={0},*p=buf+28;
        while(x) *(p--)=x%10+48,x/=10;
        print(p+1);
    }
    inline void print(u32 x) { print( (u64)x ); }
    inline void print(i64 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
    inline void print(i32 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
}
using namespace HABIT;

i32 d_N;
char s[4096];
ar ar_d_Cntr,ar_d_Cntg,ar_d_Cntb;
inline void pre(){
    d_N=read();
    scanf("%s",s+1);
    g(i,d_N,I,1){
        ar_d_Cntr[i]=ar_d_Cntr[i+1]+(s[i]=='R');
        ar_d_Cntg[i]=ar_d_Cntg[i+1]+(s[i]=='G');
        ar_d_Cntb[i]=ar_d_Cntb[i+1]+(s[i]=='B');
    }
}

inline i64 fri(){
    i64 d_Ans=0;
    f(i,1,I,d_N)
        f(j,i+1,J,d_N) if(s[j]!=s[i]){
            if(s[i]=='R'&&s[j]=='G') d_Ans+=ar_d_Cntb[j];
            else if(s[i]=='G'&&s[j]=='R') d_Ans+=ar_d_Cntb[j];
            else if(s[i]=='R'&&s[j]=='B') d_Ans+=ar_d_Cntg[j];
            else if(s[i]=='B'&&s[j]=='R') d_Ans+=ar_d_Cntg[j];
            else if(s[i]=='G'&&s[j]=='B') d_Ans+=ar_d_Cntr[j];
            else if(s[i]=='B'&&s[j]=='G') d_Ans+=ar_d_Cntr[j];
        }
    return d_Ans;
}

inline i64 sec(){
    i64 d_Ans=0;
    f(i,1,I,d_N)
        f(j,i+1,J,d_N) if(s[i]!=s[j]&&2*j-i<=d_N)
            d_Ans+=(s[2*j-i]!=s[i]&&s[2*j-i]!=s[j]);
    return d_Ans;
}

int main(){
    pre();
    print( fri()-sec() );
    output();
    return 0;
}

Measured memory_bytes: 3868
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
if a%10==0:
    A=a
else:
    A=((a//10)+1)*10
if b%10==0:
    B=b
else:
    B=((b//10)+1)*10
if c%10==0:
    C=c
else:
    C=((c//10)+1)*10
if d%10==0:
    D=d
else:
    D=((d//10)+1)*10
if e%10==0:
    E=e
else:
    E=((e//10)+1)*10
    
time=A+B+C+D+E
muda=[]
muda.append(A-a)
muda.append(B-b)
muda.append(C-c)
muda.append(D-d)
muda.append(E-e)
print(time-max(muda))

Measured memory_bytes: 9100
#include <bits/stdc++.h>
using namespace std;
#define REP(asd,fgh) for(int asd=0;asd<fgh;asd++)

const int dx[] = { 0, 1, 0, -1};
const int dy[] = {-1, 0, 1,  0};
int H, W;
int f[100][100];
bool used[100][100];

bool isField(int y, int x){
  return 0 <= x && x < W && 0 <= y && y < H;
}

void dfs(int y, int x){
  if(used[y][x]) return;
  used[y][x] = true;
  REP(i, 4){
    int nx = x + dx[i], ny = y + dy[i];
    if(!isField(ny, nx)) continue;
    if(f[ny][nx] == f[y][x]){
      dfs(ny, nx);
    }
  }
  return;
}

int main(void){
  while(cin >> H >> W, H || W){
    int ans = 0;
    REP(i, 100) REP(j, 100) used[i][j] = false;
    REP(i, H){
      string tmp;
      cin >> tmp;
      REP(j, W){
        f[i][j] = tmp[j];
      }
    }
    
    REP(i, H){
      REP(j, W){
        if(used[i][j]) continue;
        dfs(i, j);
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1724
//Author: Pakhomovee 
#include <iostream> 
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <deque>
#include <assert.h>

using namespace std;
using namespace std::chrono;

void solve()
{
	int x, y;
	cin >> x >> y;
	bool ok = false;
	for (int i = 0; i <= x; ++i)
	{
		if (i * 2 + (x - i) * 4 == y)
		{
			ok = true;
		}
	}
	if (ok)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	auto start = system_clock::now();

	solve();

	auto end = system_clock::now();
	cerr << "Time: " << duration_cast<milliseconds> (end - start).count() << "ms" << endl;
}

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


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

    int N;
    cin >> N;
    int h[N];
    for(int i=0; i<N; i++){
        cin >> h[i];
    }

    int cnt = 0;
    while(true){
        int mx = 0;
        for(int i=0; i<N; i++){
            mx = max(mx, h[i]);
        }
        if(mx == 0) break;
        bool x[N];
        memset(x, false, sizeof(x));
        for(int i=0; i<N; i++){
            if(h[i] == mx) x[i] = true;
        }
        int l = -1;
        int r = -1;
        for(int i=0; i<N; i++){
            if(l == -1){
                if(x[i]){
                    l = i;
                    r = i;
                }
            }else{
                if(x[i]){
                    r = i;
                }else{
                    break;
                }
            }
        }
        for(int i=l; i<=r; i++){
            h[i]--;
        }
        cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define bn "\n"

int main(){
  string s;
  cin>>s;
  for(int i=0;i<3;i++){
    if(s[i]=='7'){
      cout<<"Yes"<<bn;
      return 0;
    }
  }
  cout<<"No"<<bn;
  return 0;
}

Measured memory_bytes: 3592
using System;

class Program
{
  static void Main(string[] args)
  {
    int N = int.Parse(Console.ReadLine());
    for (int i = 1; i <= 9; ++i)
    {
      for (int j = 1; j <= 9; ++j)
      {
        if (i * j == N)
        {
          Console.WriteLine("Yes");
          return;
        }
      }
    }
    Console.WriteLine("No");
  }
}


Measured memory_bytes: 27460
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1ll << 60;

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 N;
ll a[410];
ll memo[410][410];

void init() {
    rep(i, 1, N) a[i] += a[i - 1];
    rep(i, 0, N + 1) rep(j, 0, N + 1) memo[i][j] = INF;
}

ll get(int l, int r) {
    ll rsl = a[r];
    if(l) rsl -= a[l - 1];
    return rsl;
}

ll dp(int l, int r) {
    if(l == r) return 0;
    if(memo[l][r] != INF) return memo[l][r];

    ll rsl = INF;
    rep(i, l, r) chmin(rsl, dp(l, i) + dp(i + 1, r) + get(l, r));
    return memo[l][r] = rsl;
}

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

    cin >> N;
    rep(i, 0, N) cin >> a[i];
    init();
    cout << dp(0, N - 1) << endl;

}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX_V 26
 
int res;
bool found;
vector<int> G[MAX_V];
int visited[MAX_V],num[MAX_V];
 
void dfs(int v,int c){
  visited[v] = 0; num[v] = c;
  for(int i = 0 ; i < (int)G[v].size() ; i++){
    int to = G[v][i];
    if(visited[to] == -1){
      dfs(to,c+1);
    }else if(visited[to] == 0){
      res = max(res,num[v]-num[to]+1);
    }
  }
  visited[v] = 1;
}
 
int getLargestCycle(){
  res = 0;
  memset(num,-1,sizeof(num));
  memset(visited,-1,sizeof(visited));
  for(int i = 0 ; i < 26 ; i++){
    if(visited[i] == -1){
      dfs(i,1);
    }
  }
  return res;
}
 
void init(){
    found = false;
    for(int i = 0 ; i < MAX_V ; i++){
        G[i].clear();
    }
}
 
bool valid(string &a, string &b){
    int A = a.size(),B = b.size();
    if(A <= B) return true;
    for(int i = 0 ; i < B ; i++){
        if(a[i] != b[i]) return true;
    }
    return false;
}
 
bool check(vector<string> &v){
    int N = v.size();
    for(int i = 0 ; i < N-1 ; i++){
        if(!valid(v[i],v[i+1])) return false;
        int a = v[i].size(),b = v[i+1].size();
        for(int j = 0 ; j < min(a,b) ; j++){
            if(v[i][j] != v[i+1][j]){
                G[v[i][j]-'a'].push_back(v[i+1][j]-'a');
                break;
            }
        }
    }
    return (getLargestCycle() < 2);
}
 
int main(){
    int N;
    while(cin >> N, N){
        vector<string> v(N);
        for(int i = 0 ; i < N ; i++){
            cin >> v[i];
        }
        init();
        cout << (check(v) ? "yes" : "no") << endl;
    }
    return 0;
}

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

int main(){
    int n, m, ans;

    std::cin >> n >> m;

    std::vector<int> l(m), r(m);

    for(int i = 0; i < m; i++){
        std::cin >> l.at(i) >> r.at(i);
    }

    // lの最大値を見つける
    auto max = *std::max_element(l.begin(), l.end());

    // rの最小値を見つける
    auto min = *std::min_element(r.begin(), r.end());

    // max以上min以下かつnに含まれるものの個数を出力
    if(min > n){
        min = n;
    }
    ans = min - max + 1;
    // ansが負数になった時0にする
    if(ans < 0){
        ans = 0;
    }

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

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  int ans = 1;
  for (int i = 1; i < N; i++)  {
    vector<int> b(i);
      for (int j = 0; j < i; j++) b[j] = a[j];
    sort(b.begin(), b.end());
    
        if (a[i] >= b[i-1]) ++ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MD = 1e9 + 7;
map<pair<ll, ll>, int> ma;
int quick_pow(int x, int y) {
    int ans = 1;
    while(y) {
        if(y & 1) ans = 1LL * ans * x % MD;
        y >>= 1;
        x = 1LL * x * x % MD;
    }
    return ans;
}
int main() {
    int n, s = 0;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        ll a, b;
        scanf("%lld%lld", &a, &b);
        ll d = __gcd(a, b);
        if(d == 0) {
            s++;
            continue;
        }
        a /= d, b /= d;
        if(a < 0) a = -a, b = -b;
        ma[{a, b}]++;
    }
    ll ans = 1;
    for(auto it : ma) {
        if(it.second == 0) continue;
        ll a = it.first.first, b = it.first.second;
        ll d = quick_pow(2, ma[{a, b}]);
        b = -b;
        if(b < 0) a = -a, b = -b;
        if(ma.count({b, a})) {
            d = (d + quick_pow(2, ma[{b, a}]) - 1) % MD;
            ma[{b, a}] = 0;
        }
        ans = ans * d % MD;
    }
    ans = (ans - 1 + s + MD) % MD;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 16044
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	string s;
	map<char,int> mp;

	cin>>s;
	int l=s.length();
	FORD(i,l,0){
		mp[s[i]]++;
	}
	if(mp['N']&&mp['S']==0)cout<<"No";
	else if(mp['S']&&mp['N']==0)cout<<"No";
	else if(mp['W']&&mp['E']==0)cout<<"No";
	else if(mp['E']&&mp['W']==0)cout<<"No";
	else cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			int[] num = new int[n];
			for (int i = 0; i < n; i++) {
				num[i] = scanner.nextInt();
			}
			Arrays.sort(num);
			int[] memo = new int[n];
			long sum = 0;
			for (int i = 1; i < n; i++) {
				memo[i] = memo[i - 1] + num[i - 1];
				sum += memo[i];
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 45092
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;

int main() {
	int N,K;
	cin >> N >> K;
	vector<int> a(N);
	int ind[Nmax]={0};
	REP(i,N){
		cin >> a[i];
		ind[a[i]]++;
	}
	int cnt=0;
	REP(i,Nmax){
		if(ind[i]>=1) cnt++;
		else ind[i] = MOD;
	}
	sort(ind,ind+Nmax);
  	int ans=0;
	REP(i,cnt-K) ans+=ind[i];
	cout << ans << endl;
	
	return 0;
}

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

#define lint long long
#define P pair<int, int>

int main() {
    int N, M;
    cin >> N >> M;
    
    vector<int> X(M);
    
    for(int i = 0; i < M; ++i){
        cin >> X[i];
    }
    
    sort(X.begin(), X.end());
    
    vector<int> dif(M - 1);
    
    for(int i = 0; i < M - 1; ++i){
        dif[i] = X[i + 1] - X[i];
    }
    
    sort(dif.begin(), dif.end());
    
    int ans = 0;
    
    for(int i = 0; i < M - N; ++i){
        ans += dif[i];
    }
    cout << ans << endl;
}

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

int main(){
    string S, T;
    cin >> S >> T;
    int N = S.size(), M = T.size();
    vector<int> SS(N+1), TT(M+1);
    for(int i=0; i<N; i++) SS[i+1] = SS[i] + S[i] - 'A' + 1;
    for(int i=0; i<M; i++) TT[i+1] = TT[i] + T[i] - 'A' + 1;
    int Q;
    cin >> Q;
    for(int i=0; i<Q; i++){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--; c--;
        int s = SS[b] - SS[a] - TT[d] + TT[c];
        cout << (s%3 ? "NO" : "YES") << endl;
    }
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
int main()
{
    ll n;
    cin>>n;
    ll ans=1;
    for(int i=2; i<=n; i++)
    {
        ans=(ans*i)%MOD;
    }
    cout<<ans%MOD<<endl;
	return 0;
}


Measured memory_bytes: 256
fn main() {
    let n = readln();
    let a: Vec<i64> = readln();
    let mut ans = VecDeque::with_capacity(n);
    for i in 0..n {
        if n % 2 != i % 2 {
            ans.push_front(a[i]);
        }
    }
    for i in 0..n {
        if n % 2 == i % 2 {
            ans.push_back(a[i]);
        }
    }
    let answer: Vec<String> = ans.iter().map(|x| x.to_string()).collect();
    println!("{}", answer.join(" "));
}

// --- template ---
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashSet, VecDeque};

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n { vs.push(readln()); }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(String, bool, f32, f64, isize, i8, i16, i32, i64, usize, u8, u16, u32, u64);
impl<T> FromLn for Vec<T> where T: FromLn {
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);

Measured memory_bytes: 20720
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
typedef long long ll;
#define FOR(i,n) for(int i=0;i<n;i++)

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

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

int main()
{
	char s[100001];
	scanf("%s", s);
	int l = strlen(s);
	int min = l;
	for (int i = 1; i < l; i++) {
		if (s[i - 1] != s[i]) {
			int t = i > l - i ? i : l - i;
			min = min > t ? t : min;
		}
	}
	printf("%d\n", min);
	return  0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int64_t> LN(87);
  LN.at(0) = 2;
  LN.at(1) = 1;
  for (int i = 2; i <= n; i++) {
  LN.at(i) = LN.at(i-1) + LN.at(i-2);
  }
  cout << LN.at(n) << endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
from collections import defaultdict
n = int(input())
li = defaultdict(list)
for i in range(n):
    s, p = list(input().split())
    li[s].append((int(p), i+1))
ks = sorted(li)
for k in ks:
    kk = sorted(li[k], key=lambda x: x[0],  reverse=True)
    for i in kk:
        print(i[1])

Measured memory_bytes: 3316
def gcd(x, y):
    """
    ユークリッドの互除法を用いてxとyの最大公約数を求める。
    """
    while True:
        r = x%y
        if r == 0:
            break
        x = y
        y = r
    return y
    
def prime_factorize(x):
    """
    素因数分解
    """
    res = []
    while x%2 == 0:
        res.append(2)
        x = x//2
    p = 3
    while p*p <= x:
        while x%p == 0:
            res.append(p)
            x = x//p
        p += 2
    if x != 1:
        res.append(x)
    return res

A, B = map(int, input().split())
print(len(set(prime_factorize(gcd(A, B)))) + 1)

Measured memory_bytes: 3064
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	string s, ans = ""; cin >> s;
	forl(i, 0, s.length()) ans += 'x';
	println(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastIO;
    int n, x;
    cin >> n >> x;

    int cnt = 0;
    int min_cost = 1000000;
    rep(i, n) {
        int cost;
        cin >> cost;

        min_cost = min(min_cost, cost);
        x -= cost;
        cnt++;
    }

    while (true) {
        if (x - min_cost >= 0) {
            x -= min_cost;
            cnt++;
        } else {
            break;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
ll pow1(ll a, ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
		{
			ans=ans*a;
		}
		a=a*a;
		b=b>>1;
	}
	return ans;
}
long double dp[3001][3001];
// dp[i][j] stores i heads with j coins
int main()
{
	int n,i,j;
	cin>>n;
	long double arr[n+1];
	for(i=1;i<=n;i++)
		cin>>arr[i];
	dp[0][0] = 1.000;
	for(i=1;i<=n;i++)
	{
		dp[0][i] = ((1.000-arr[i])*dp[0][i-1]);
		for(j=1;j<=i;j++)
		{
			dp[j][i] += (arr[i]*dp[j-1][i-1]);
			dp[j][i] += ((1.000-arr[i])*dp[j][i-1]);
		}
	}
	long double sum = 0;
	for(i=(n/2)+1;i<=n;i++)
		sum += dp[i][n];
	printf("%0.10Lf\n", sum);
	return 0;
}

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





int main(void){
    // 自分の得意な言語で
    // Let's チャレンジ！！
    int a,b;
    cin>>a>>b;
    int c;
    c=b-a;
    int Ra,Rb;
    Rb = c*(c+1)/2;


    int ans = Rb-b;

    cout<<ans<<endl;




    return 0;
}


//3 人は同時に、他の 2 人の持っている整数の和を求める。
//その後、自分の持っている整数を求めた整数で置き換える。

Measured memory_bytes: 256
import math
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np

# n,k = map(int, input().split())
# n = int(input())
# p = list(map(int, input().split()))

a =[ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k-1])

Measured memory_bytes: 3060