akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<stdio.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define _USE_MATH_DEFINES
#define f first
//#define s second
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define INF 1000000000000000000
#define MAXN (int)(1e7)+1
#define MOD 1000000007
 
using namespace std;
 
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pwi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vector<pair<ll,ll > > > wGraph;
typedef vector<vector<ll> > graph;
//typedef vector<vector<ll> > matrix;

int main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout<<std::fixed;
    cout<<std::setprecision(2);

    ll n;
    cin>>n;

    vi divs(MAXN+1,1);

    for(ll i = 2;i<divs.size();++i){
        for(ll j = i;j<divs.size();j+=i){
            //cout<<j<<endl;
            divs[j]++;
        }
    }

    ll sum = 0;
    for(ll i = 1;i<=n;++i){
        sum += (i*divs[i]);
    }

    cout<<sum<<endl;

    return 0;   
}


Measured memory_bytes: 42208
#include<bits/stdc++.h>
using namespace std;
int N,M,A,B,a,ans=0;
int main(){
    cin>>N>>M;
    int H[N];
    bool v[N];
    memset(v,true,sizeof v);
    for(int i=0;i<N;i++)cin>>H[i];
    for(int i=0;i<M;i++){
        cin>>A>>B;
        if(H[A-1]<H[B-1])v[A-1]=false;
        else if(H[A-1]==H[B-1])v[A-1]=v[B-1]=false;
        else v[B-1]=false;
    }
    //for(int i=0;i<N;i++)cout<<(v[i]?1:0)<<endl;
    for(int i=0;i<N;i++)if(v[i]==true)ans++;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4120
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    vector<ll> a(n);
    for(int i=0; i<n; i++) cin>>a[i];

    ll ans = 0;
    while(1){
        ll amax = 0;
        int maxid = -1;
        for(int i=0; i<n; i++){
            if(amax <= a[i]){
                amax = a[i];
                maxid = i;
            }
        }

        if(amax <= n - 1) break;

        ll cnt = amax / n;
        a[maxid] -= cnt * n;
        for(int i=0; i<n; i++){
            if(i == maxid) continue;
            a[i] += cnt;
        }

        ans += cnt;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 998244353
#define N 200005  //check the limits, man
int main()
{
    int i,n,k,x;
    in(k);
    string str;
    cin >> str;
    n=str.size();
    rep(i,n)
    {
        x=str[i]-'A';
        x+=k;
        x%=26;
        str[i]=x+'A';
    }
    llout(str);
}



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

using namespace std;

int main(void) {
    long n, m;
    long fans = 0;
    cin >> n >> m;
    vector<int> high(n + 1);
    vector<int> ans(n + 1, 1);

    for(int i = 1; i <= n; i++){
        long h;
        cin >> h;
        high[i] = h;
    }
    for(int i = 1; i <= m; i++){
        long a, b;
        cin >> a >> b;
        if(high[a] <= high[b]){
            ans[a] = 0;
        }
        if(high[b] <= high[a]){
            ans[b] = 0;
        }
    }
    for(int i = 1; i <= n; i++){
        if(ans[i] == 1){
            fans += 1;
        }
    }
    cout << fans << endl;
    return 0;
}


Measured memory_bytes: 4060
#include <iostream>
#include <math.h>
#include <algorithm>

using namespace std;

int main(){
  int n,k;
  int a[200005];
  cin >> n >> k;

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

  for(int i = k ;i < n; i++){
    if(a[i] > a[i-k]) cout << "Yes";
    else cout << "No";

    if(i != n - 1) cout << endl;
  }
  return 0;
}


Measured memory_bytes: 4356
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int k;
    cin >> k;
    if(k%2==0) cout << (k/2)*(k/2) << endl;
    else if(k%2==1) cout << (k/2)*((k+1)/2) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <string>
using namespace std;
int main(){

  int n,x,i;
  list <int> a;
  list<int>::iterator it;
  string com;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>com;
    if(com=="deleteFirst") a.pop_front();
    else if(com=="deleteLast") a.pop_back();
    else{
      cin>>x;
      if(com=="insert") a.push_front(x);
      else for(it=a.begin();it!=a.end();it++) if(*it==x){
	    a.erase(it);
	    break; 
	  }
    }
  }
  i=0;
  for(it=a.begin();it!=a.end();it++){
    if(i++) cout<<" ";
    cout<<*it;
  }
  cout<<endl;

  return 0;

}
	



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

using namespace std;

using ll = long long;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

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

  auto c2 = [](ll n) -> ll { return n * (n - 1) / 2 + n; };

  ll acc = 0, ans = 0;
  int l, r;
  l = r = 0;
  while (l < va.size()) {
    int cnt = 0, prev_r = r;
    while (r < va.size() && va[r] + acc == (va[r] ^ acc)) {
      acc ^= va[r];
      r++;
      cnt++;
    }

    ans += c2(r - l) - c2(prev_r - l);

    acc ^= va[l];
    l++;
  }

  cout << ans << '\n';
  return 0;
}

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

int main(){
    
    int n,q,x,t,inst;

    std::cin>>n>>q;
    std::vector<std::vector<int>> vec(n);

    for(int i=0;i<q;i++){
        std::cin>>inst;
        switch(inst){
            case 0:{
                std::cin>>t>>x;
                vec[t].push_back(x);
                break;
            }
            case 1:{
                int i;
                std::cin>>t;
                for(i=0;i<vec[t].size();i++){
                    if(i==vec[t].size()-1){
                         std::cout<<vec[t][i];
                    } else{std::cout<<vec[t][i]<<" ";}
                }
                std::cout<<std::endl;
                break;
            }
            case 2:{
                std::cin>>t;
                vec[t].clear();
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 5860
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws NumberFormatException, IOException{
        double r;
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            r = Double.parseDouble(br.readLine());
        }

        double s = Math.PI * r * r;
        double l = 2 * Math.PI * r;

        System.out.printf("%f %f%n", s, l);
    }
}



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

using namespace std;

#define ll                     long long int
#define endl                   '\n'

static const int maxn = 2e5 + 5;

vector <int> graph[maxn];
ll cost[maxn];
ll ans[maxn];

void dfs(int u = 1, int p = -1, ll cst = cost[1])
{
      ans[u] = cst;
      for (int v : graph[u])
      {
            if (v == p) continue;
            dfs(v, u, cst + cost[v]);
      }
}

signed main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(nullptr);
      cout.tie(nullptr);
      cout << fixed << setprecision(8);


      int tnode, tquery;
      cin >> tnode >> tquery;
      for (int e = 1; e < tnode; e++)
      {
            int u, v;
            cin >> u >> v;
            graph[u].push_back(v);
            graph[v].push_back(u);
      }
      while (tquery--)
      {
            int r, x;
            cin >> r >> x;
            cost[r] += x;
      }
      dfs();
      for (int i = 1; i <= tnode; i++) cout << ans[i] << " \n"[i == tnode];
}


Measured memory_bytes: 25600
N = [int(i) for i in input().split()][0]
P = [int(i) for i in input().split()]

flag=0
save=0
for i in range(N-1):
  if flag==0 and P[i]>P[i+1]:
    save=i
    flag=1
    continue
  if flag==1 and P[i]>P[i+1]:
    tmp=P[i+1]
    P[i+1]=P[save]
    P[save]=tmp
    break

flag=0
for i in range(N-1):
  if P[i]>P[i+1]:
    print('NO')
    flag=1
    break

if flag!=1:
  print('YES')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    string S, T;
    cin >> S >> T;
    vector<char> vS, vT;
    for (char c : S) vS.push_back(c);
    for (char c : T) vT.push_back(c);
    sort(vS.begin(), vS.end());
    sort(vT.begin(), vT.end(), greater<char>());
    string sortedS, sortedT;
    for (char c : vS) sortedS += c;
    for (char c : vT) sortedT += c;
    cout << (sortedS < sortedT ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M=2e5+5;
ll a[M],cs[M],cx[M];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;	
	vector<int> v;
	for(ll i=1;i<=n;i++)
	{
		cin>>a[i];
		cs[i]=cs[i-1]+a[i];
		cx[i]=(cx[i-1]^a[i]);
		if(a[i])
			v.pb(i);
	}
	v.pb(n);
	ll ans=0;
	int c=0;
	for(int i=1;i<=n;i++)
	{
		while(c<sz(v) && v[c]<i)
			c++;
		ll r;
		for(ll j=c;j<sz(v);j++)
		{
			r=v[j]-1;
			if(cs[v[j]]-cs[i-1]==(cx[v[j]]^cx[i-1]))
			{
				r=v[j];
			}
			else
				break;
		}
		ans+=r-i+1;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 8916
#include <stdio.h>

int main(void)
{
  int n;
  scanf("%d", &n);
  double invsum = 0;
  for (int i = 0; i < n; i++){
    int temp;
    scanf("%d", &temp);
    invsum += 1.0 / temp;
  }
  printf("%f\n", 1.0 / invsum);
  return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
const int N=5001,mod=1e9+7;typedef long long LL;
int n,m,x,y,o,cnt,a[N],head[N],sz[N],f[2][N],c[N][N],p[N][N],F[N];
struct xint{int to,next;}e[N*2];
void add(int x,int y){e[++cnt]=(xint){y,head[x]};head[x]=cnt;}
void Add(int x,int y){add(x,y);add(y,x);}
int solve(int M){
	memset(f,0,sizeof f);
	F[0]=1;
	ref(i,1,n)F[i]=(LL)F[i-1]*i%mod;
	ref(i,0,n)c[i][0]=p[i][0]=1;
	ref(i,1,n)ref(j,1,i)c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	ref(i,1,n)ref(j,1,i)p[i][j]=(LL)p[i][j-1]*(i-j+1)%mod;
	f[0][0]=1;int sum=0;
	ref(i,1,M){
		ref(j,0,sum){
			LL S=f[0][j];if(!S)continue;
			ref(k,0,a[i]){
				f[1][j+k]+=S*c[a[i]][k]%mod*p[a[i]][k]%mod;
				if(f[1][j+k]>=mod)f[1][j+k]-=mod;
			}
		}
		sum+=a[i];
		ref(j,0,sum)f[0][j]=f[1][j],f[1][j]=0;
	}
	int res=0;
	ref(i,0,sum)if(i&1)res=(res+mod-(LL)f[0][i]*F[sum-i]%mod)%mod;
		else res=(res+(LL)f[0][i]*F[sum-i]%mod)%mod;
	return res;
}
void work(int f,int x){
	for(int i=head[x];i;i=e[i].next){
		int y=e[i].to;if(y==f)continue;
		a[++m]=sz[y];
	}
	if(x!=1)a[++m]=n-sz[x];a[m+1]=1;
	int ans=(solve(m)+solve(m+1))%mod;
	//ref(i,1,m)ref(j,2,a[i])ans=(LL)ans*j%mod;
	printf("%d\n",ans);
	exit(0);
}
void dfs(int f,int x){
	bool flag=1;sz[x]=1;
	for(int i=head[x];i;i=e[i].next){
		int y=e[i].to;if(y==f)continue;
		dfs(x,y);sz[x]+=sz[y];if(sz[y]>n/2)flag=0;
	}
	if(n-sz[x]>n/2)flag=0;if(flag)work(f,x);
}
int main(){
	scanf("%d",&n);
	ref(i,2,n){scanf("%d%d",&x,&y);Add(x,y);}
	dfs(0,1);printf("0\n");
}

Measured memory_bytes: 194560
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    int n = stdin.nextInt();
    int[] arr = new int[n];

    for (int i = 0; i < n; i++) {
      arr[i] = stdin.nextInt();
    }

    System.out.print(arr[n - 1]);
    for (int i = n - 2; i >= 0; i--) {
      System.out.printf(" %d", arr[i]);
    }
    System.out.println("");
  }

}

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

int main(){
  long long int n; cin>>n;
  long long int arr[n];
  for(long long int i=0; i<n; i++){
    cin>>arr[i];
  }
  int flag=0;
  for(long long int i=1; i<n; i++){
  	if(arr[i]==arr[i-1]){
      continue;
  	}
    else if(arr[i]>arr[i-1]){
    	arr[i]--;
    }
    else{
    	cout<<"No"<<endl;
      	flag=1;	
      	break;
    }
    
  }
  if(flag==0) cout<<"Yes"<<endl;

}

Measured memory_bytes: 1024
import math
import collections
mod=10**9+7

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a



a=int(input())
y=[]
x=1
for i in range(1,a+1):
    y=y+(prime_factorize(i))
    
y.sort()
c = collections.Counter(y)
c = c.most_common()

for i in range(len(c)):
    x*=c[i][1]+1
    x=x%mod
print(x)
    
    




    



    

    
    
    





Measured memory_bytes: 3436
import java.util.Scanner;

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

		String s = sc.next();
		String r = "Yes";

		loop: for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if (i % 2 == 0) {
				if (c == 'L') {
					r = "No";
					break loop;
				}
			} else {
				if (c == 'R') {
					r = "No";
					break loop;
				}
			}
		}

		System.out.println(r);
		sc.close();
	}
}


Measured memory_bytes: 23892
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007
#define MEM_SIZE = 1e5+5;

// vector<int> DP[MEM_SIZE]

void solve(void)
{
  int K,X;
  cin>>K>>X;
  if(K*500 >= X)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  
  return;
  
}



int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 764
/*
神题
二分答案+分析性质
合并集合优化DP，满二叉树-->O(n*logn)
O(n*logn*logw)
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define N 131110
#define ll long long
#define top 1000000000000LL
#define pa(a, b) (data){a, b}
using namespace std;

struct data{ll in, out;};
int n, sum[N], son[N][2], w[N], x, y;
ll L, R, mid;
vector<data>s[N], s1, s2;

inline char gc(){
	return getchar();
	static char now[1<<16], *S, *T;
	if(S==T){T=(S=now)+fread(now, 1, 1<<16, stdin); if(S==T)return EOF;}
	return *S++;
}
inline int read(){
	int x=0, f=1; char ch=gc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=gc();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=gc();}
	return x*f;
}

inline void dp(int x, ll L){
	if(!sum[x]){s[x].push_back(pa(0, 0)); return;}
	int l=son[x][0], r=son[x][1];
	dp(l, L); dp(r, L);
	s[x].clear(); s1.clear(); s2.clear();
	int now=-1, now1=-1;
	for(int i=0; i<s[l].size(); i++){
		while(now+1<s[r].size()&&s[l][i].out+w[l]+w[r]+s[r][now+1].in<=L)now++;
		if(now==now1)continue;
		s1.push_back(pa(s[l][i].in+w[l], w[r]+s[r][now].out));
		now1=now;
	}
	now=now1=-1;
	for(int i=0; i<s[r].size(); i++){
		while(now+1<s[l].size()&&s[r][i].out+w[r]+w[l]+s[l][now+1].in<=L)now++;
		if(now==now1)continue;
		s2.push_back(pa(s[r][i].in+w[r], w[l]+s[l][now].out));
		now1=now;
	}
	int p1=0, p2=0;
	while(p1<s1.size()&&p2<s2.size()){
		if(s1[p1].in<s2[p2].in){s[x].push_back(s1[p1]); p1++;}
		else if(s1[p1].in>s2[p2].in){s[x].push_back(s2[p2]); p2++;}
		else{s[x].push_back(pa(s1[p1].in, min(s1[p1].out, s2[p2].out))); p1++; p2++;}
	}
	while(p1<s1.size()){s[x].push_back(s1[p1]); p1++;}
	while(p2<s2.size()){s[x].push_back(s2[p2]); p2++;}
}

inline int check(ll L){
	dp(1, L);
	return s[1].size()?1:0;
}

int main(){
	n=read();
	memset(sum, 0, sizeof(sum));
	for(int i=2; i<=n; i++){
		x=read(); w[i]=read();
		sum[x]++; son[x][sum[x]-1]=i;
	}
	L=0; R=top;
	while(L<R){
		mid=(L+R)>>1;
		if(check(mid))R=mid; else L=mid+1;
	}
	printf("%lld", L);
	return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    ll mini=INF,maxi=-INF,sum=0;
    rep(i,n){
        ll a; cin>>a;
        mini=min(mini,a);
        maxi=max(maxi,a);
        sum+=a;
    }
    cout<<mini<<" "<<maxi<<" "<<sum<<endl;
    return 0;
}


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


def main():
    n, m = map(int, input().split())
    bools = [[0 for __ in range(n)] for _ in range(m)]

    for i in range(m):
        si = list(map(int, input().split()))[1:]

        for sii in si:
            bools[i][sii - 1] = 1

    p = list(map(int, input().split()))
    ans = 0

    for bit in range(1 << n):
        count = 0

        for mi in range(m):
            # pattern = list()
            total = 0

            for ni in range(n):
                if bit & (1 << ni):
                    total += bools[mi][ni]

            if total % 2 == p[mi]:
                count += 1

        if count == m:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()

    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
rrmm = lambda n: [rrm() for _ in xrange(n)]

####
MOD = 10**9 + 7
YES, NO, IMP = "YES", "NO", "IMPOSSIBLE"
from collections import defaultdict as ddic

MOD = 10 ** 9 + 7

def solve(N):
    if N < 3: return 0
    dp = [1] * (N + 1)
    dp[1] = dp[2] = 0
    s = 1
    for i in xrange(4, N + 1):
        
        s += dp[i-3]
        s %= MOD
        dp[i] = s
    #print("!", dp)

    return dp[N] % MOD
print solve(rri())


Measured memory_bytes: 66476
#include <stdio.h>

int main(void){
    char alphabet;
    scanf("%c", &alphabet);

    if(alphabet >= 'A' && alphabet <= 'Z'){
        printf("A\n");
    }
    else if(alphabet >= 'a' && alphabet <= 'z'){
        printf("a\n");
    }
    else{
        printf("scan alphabet only\n");
    }

    return 0;
}


Measured memory_bytes: 1556
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();

		if (a <= b) {
			System.out.println(a);
		} else {
			System.out.println(a - 1);
		}
	}

}


Measured memory_bytes: 21332
#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int main() {
  int K, S;
  cin >> K >> S;

  int ans(0);
  for (int x = 0; x <= K; x++) {
    for (int y = 0; y <= K; y++) {
      int z = S - (x + y);
      if (z >= 0 && z <= K) ans++;
    }
  }

  cout << ans << endl;
}


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

int main(){
	int a,b;
	cin >> a >> b;

	int d,r;
	double f;
	d=a/b;
	r=a%b;
	f=(double)a/b;

	cout << d << " " << r << " ";
	cout << fixed << setprecision(5) << f << endl;

	return 0;
}


Measured memory_bytes: 3244
<?php

$result = array();
while (($line = trim(fgets(STDIN))) !== '0 0') {
    sscanf($line, '%d %d', $a, $b);
    $arr = array();
    for (; $a <= $b; $a++) {
        if (($a % 4 === 0 && $a % 100 !== 0) || $a % 400 === 0) {
            $arr[] = $a;
        }
    }
    $result[] = count($arr) > 0 ? implode(PHP_EOL, $arr) : 'NA';
}
echo implode(PHP_EOL . PHP_EOL, $result), PHP_EOL;

Measured memory_bytes: 6724
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define                          ll                          long long int
ll gcd(int a,int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}

#define                          in(x)                       scanf("%lld",&x)
#define                          in2(x,y)                    scanf("%lld %lld",&x,&y)
#define                          in3(x,y,z)                  scanf("%lld %lld %lld",&x,&y,&z)
#define                          out(x)                      printf("%lld\n",x)
#define                          cy                          printf("YES\n")
#define                          cn                          printf("NO\n")
#define                          inf                         1e18
#define                          neg                         -1e18
#define                          mx                          2111111
#define                          fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define                          fi                          frist
#define                          si                          second
#define                          ce                          cout<<endl
#define                          pb                          push_back
#define                          vc(x)                       x.begin(),x.end()
#define                          pb                          push_back
#define                          pi                          pair<ll,ll>
#define                          debug                       printf("ok\n");
#define                          pg                          pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> >

ll mod=1e9+7;
inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }
ll findProductSum(ll A[], ll n)
{

    ll array_sum = 0;
    for (ll i = 0; i < n; i++)
    {
        array_sum = modAdd(array_sum,A[i]);
    }

 ll mul =0;
    ll array_sum_square = modMul(array_sum,array_sum);

    ll individual_square_sum = 0;
    for (ll i = 0; i < n; i++)
    {
        individual_square_sum += (A[i]*A[i])%mod;
        individual_square_sum%=mod;
    }
    ll summm=0;
    ll x=modSub(array_sum_square,individual_square_sum);
    ll z=modDiv(x,2);
    return z;
}
int main(){


    ll n,i,j,s=0,ans=0;

   cin>>n;
   ll a[n+9];
    for(i=0;i<n;i++){
        in(a[i]);
    }
   cout<<findProductSum(a,n)<<endl;

}


Measured memory_bytes: 5236
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a < b ? a : b))

int main(void) {
	uint32_t preparedNumChoco;
	uint32_t N, D, X;
	uint32_t A[100];

	scanf("%"PRIu32"\n%"PRIu32" %"PRIu32"\n", &N, &D, &X);
	preparedNumChoco = X;
	for (uint32_t idx = 0; idx < N - 1; idx++) {
		scanf("%"PRIu32"\n", &(A[idx]));
		preparedNumChoco += (D - 1) / A[idx] + 1;
	}
	scanf("%"PRIu32, &(A[N - 1]));
	preparedNumChoco += (D - 1) / A[N - 1] + 1;

	printf("%"PRIu32, preparedNumChoco);

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
using namespace std;
const int mod=1e9+7;
int cnt[27];
int main(){
	int n,i,j,k,sum=0;
	long long tich=1;
	string s;
	cin>>n>>s;
	for(i=0;i<s.size();i++){
		cnt[(s[i]-'a'+1)]++;
	}
	for(i=1;i<=26;i++){
		tich*=(cnt[i]+1);
		tich%=mod;
	}
	cout<<tich-1;
}

Measured memory_bytes: 512
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#define ll long long
using namespace std;
int main()
{
    ll  a[100005];
    ll aa,bb,book[100005];
    int n,flag=0,falg=0;
    cin>>n;
    for(int i=0;i<n;i++)
        scanf("%lld",&a[i]);
    sort(a,a+n);
    for(int i=n-1;i>=0;i--)
    {
        if(a[i]==a[i-1])
        {
            aa=a[i];
            n=i-2;flag=1;
            break;

        }
    }
    for(int i=n;i>=0&&flag;i--)
    {
        if(a[i]==a[i-1])
        {
            bb=a[i];
            falg=1;
            break;
        }
    }
    if(falg==1)
        printf("%lld",aa*bb);
    else
        printf("0\n");
    return 0;

}


Measured memory_bytes: 1024
文字列1 = list(input())
文字列2 = list(input())

テーブル = [[0]*(len(文字列2)+1) for _ in range(len(文字列1)+1)]#外側から内側のイメージ

for i in range(len(文字列1)):
    for j in range(len(文字列2)):
        if 文字列1[i] == 文字列2[j]:
            テーブル[i+1][j+1] = テーブル[i][j] + 1
        else:
            テーブル[i+1][j+1] = max(テーブル[i+1][j], テーブル[i][j+1])

答え = []
i = len(文字列1)
j = len(文字列2)
while True:
    if テーブル[i][j] == テーブル[i][j-1]:
        j -= 1
    elif テーブル[i][j] == テーブル[i-1][j]:
        i -= 1
    else:
        答え.append(文字列1[i-1])
        i -= 1
        j -= 1

    if i == 0 or j == 0:
        break

答え.reverse()
print(''.join(答え))

Measured memory_bytes: 112604
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
    ll H, W;
    cin >> H >> W;
    ll ans = 1 << 30;
    ll cnt = 0;
    while (cnt < 2)
    {
        if (H > 2)
        {
            if (H % 3 == 0)
            {
                ans = min(ans, 0ll);
            }
            else
            {
                ans = min(ans, W);
            }
        }
        int mid = H / 2;
        for (int i = 1; i < W; i++)
        {
            ll s1 = H * i;
            ll s2 = mid * (W - i);
            ll s3 = (mid + H % 2) * (W - i);
            ans = min(ans, max({s1, s2, s3}) - min({s1, s2, s3}));
        }
        cnt++;
        swap(H, W);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3540
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int L = stdIn.nextInt(); int R = stdIn.nextInt();
        int answer = 2018;
        if( R - L + 1 >= 673) answer = 0;
        else{
            for(int i = L; i <= R -1; i++){
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            }
        }
        System.out.println(answer);
    }
}

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

int main() {
	long long n, m; cin >> n >> m;
	vector<vector<long long>> a(n, vector<long long>(2));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 2; j++)
			cin >> a[i][j];
	}
	//ソート
	sort(a.begin(),a.end());
	long long x = 0, ans = 0;
	while (true) {
		if (a[x][1] >= m) {
			ans += a[x][0] * m;
			break;
		}
		else {
			ans += a[x][0] * a[x][1];
			m -= a[x][1];
		}
      x++;
	}

	cout << ans << endl;
}

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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        long n=Long.parseLong(br.readLine());
        StringTokenizer st=new StringTokenizer(br.readLine());
        long[] a=new long[(int)n];
        long sum=0;
        long count=0;
        for(int i=0;i<n;i++){ a[i]=Long.parseLong(st.nextToken()); sum+=a[i]; }
        if(sum%((n*(n+1))/2)!=0){
            System.out.println("NO");
            System.exit(0);
        }
        long times=sum/((n*(n+1))/2);
        for(int i=0;i<n;i++){
            count=(a[(i+1)%(int)n]-a[i]);
            if((count>times)||(times-count)%n!=0){
                System.out.println("NO");
                System.exit(0);
            }
        }System.out.println("YES");
    }
}


Measured memory_bytes: 24268
import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int happiness = 0;
    if (X >= 500) {
      happiness = (X/500)*1000;
      X -= (X/500)*500;
      
    }
    happiness += (X/5)*5;
    System.out.println(happiness);
  }
}

Measured memory_bytes: 23120
def palin(s):
    p1 = ans = 0
    p2 = len(s) - 1
    while p1 < p2:
        if s[p1] != s[p2]:
            ans += 1
        p1 += 1
        p2 -= 1
    print(ans)

if __name__ == "__main__":
    import sys
    in_str = ''
    for line in sys.stdin:
        in_str += line
    palin(in_str.strip())


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  for(int i = 1; i < 10; i++) {
    for(int j = 1; j < 10; j++) {
      if (n == i*j) {
        cout << "Yes" << endl;    
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define f first
#define s second
using namespace std;
const int N=1e5+5;
int n,m,ans=1e9;
pair<int,int>f1[N],f2[N];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>m;
		if(i%2==0)f1[m].f++,f1[m].s=m;
		else f2[m].f++,f2[m].s=m;
	}
	sort(f1,f1+N);
	sort(f2,f2+N);
	if(f2[N-1].s==f1[N-1].s)ans=min(n-f1[N-2].f-f2[N-1].f,n-f1[N-1].f-f2[N-2].f);
	else ans=n-f1[N-1].f-f2[N-1].f;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
use text_io::*;
use std::collections::HashMap;
use std::process::exit;

fn main() {
    let n:String = read!();
    let v:Vec<char> = n.chars().collect();
    if v[2]==v[3]&&v[4]==v[5] {
        println!("Yes");
    }
    else {
        println!("No");
    }
}

Measured memory_bytes: 2084
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int v, e, inf = 100000000;
    scanf("%d %d", &v, &e);
    vector<vector<pair<int, int>>> a(v, vector<pair<int, int>>(0));
    for (int i = 0, s, t, w; i < e; i++)
    {
        scanf("%d %d %d", &s, &t, &w);
        a[s].push_back(make_pair(w, t));
        a[t].push_back(make_pair(w, s));
    }
    vector<int> cost(v, inf), vis(v, false);
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;
    cost[0] = 0;
    q.push(make_pair(0, 0));
    for (pair<int, int> t; !q.empty(); )
    {
        t = q.top();
        q.pop();
        vis[t.second] = true;
        if (cost[t.second] < t.first)
        {
            continue;
        }
        for (int i = 0; i < a[t.second].size(); i++)
        {
            if (!vis[a[t.second][i].second] && cost[a[t.second][i].second] > a[t.second][i].first)
            {
                cost[a[t.second][i].second] = a[t.second][i].first;
                q.push(make_pair(cost[a[t.second][i].second], a[t.second][i].second));
            }
        }
    }
    printf("%d\n", accumulate(cost.begin(), cost.end(), 0));
}


Measured memory_bytes: 6236
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 999999999
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
bool sosu(int n) {
  if (n <= 1)
    return false;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0)
      return false;
  return true;
}
int main() {
  int n, x;
  while (cin >> n >> x, n) {
    bool dp[1000001] = {};
    dp[0] = 1;
    int a[50];
    rep(i, n) { cin >> a[i]; }
    rep(i, n) rep(j, x) {
      if (j + a[i] < 1000001)
        if (dp[j])
          dp[j + a[i]] = 1;
    }
    for (int i = x; i > 1; i--) {
      if (dp[i])
        if (sosu(i)) {
          cout << i << endl;
          goto end;
        }
    }
    cout << "NA" << endl;
  end:;
  }
  return 0;
}

Measured memory_bytes: 4044
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

ll a[100001] = {};
ll b[100001] = {};

int main() {
	ll sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;
	ll q = tx - sx;
	ll p = ty - sy;

	rep(i, 0, p)cout << "U";
	rep(i, 0, q)cout << "R";
	rep(i, 0, p)cout << "D";
	rep(i, 0, q + 1)cout << "L";
	rep(i, 0, p + 1)cout << "U";
	rep(i, 0, q + 1)cout << "R";
	cout << "D";
	cout << "R";
	rep(i, 0, p + 1)cout << "D";
	rep(i, 0, q + 1)cout << "L";
	cout << "U";

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
// Submitted By SUbhash Yadav

import java.util.*;
import java.lang.*;
import java.math.BigInteger;
import java.io.*;


public class Main
{
	
	public static void main (String[] args) throws java.lang.Exception
	{
		
		FastScanner sc=new FastScanner();
		int n=sc.nextInt(), k=sc.nextInt(); 
		int a[]=sc.readArray(n);
		
//		BigInteger bigInteger=new BigInteger("1");
//		for(int i=0;i<k;i++) bigInteger=bigInteger.multiply(BigInteger.valueOf(Integer.valueOf(a[i])));
		
		for(int i=k;i<n;i++) {
			//System.out.println(bigInteger);
//			BigInteger prevBigInteger=bigInteger;
//			bigInteger=bigInteger.divide(BigInteger.valueOf(Integer.valueOf(a[i-k])));
//			bigInteger=bigInteger.multiply(BigInteger.valueOf(Integer.valueOf(a[i])));
			
			if(a[i]-a[i-k]>0)
				System.out.println("Yes");
			else {
				System.out.println("No");
			}
			
			
			
		}
		
		
		}
		static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
}
}


Measured memory_bytes: 57984
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, a, b; cin >> n >> a >> b;
	cout << min(a,b) << ' ';
	if(a+b<=n){
		cout << 0 << endl;
		return 0;
	}else{
	cout << abs((n-a)-b) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
typedef long long ll;
const int INF = 1e9;
const ll LLINF = 1e18;

int main() {
    int N, A, B;
    cin>>N>>A>>B;
    
    ll now, nxt, cost=0; cin>>now;
    rep(i,N-1){
        cin>>nxt;
        if((nxt-now)*A>B) cost+=B;
        else cost+=(nxt-now)*A;
        now=nxt;
    }
    cout1(cost);
}

Measured memory_bytes: 256
#include <cstdio>

int f(int x){
    if(x==2) return 0;
    else if(x==4||x==6||x==9||x==11) return 1;
    else return 2;
}

int main(){
    int x, y;
    scanf("%d%d", &x, &y);
    if(f(x)==f(y)) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main()
{
    char s[4];
    char s1[]="SAT";
    char s2[]="SUN";
    char s3[]="MON";
    char s4[]="TUE";
    char s5[]="WED";
    char s6[]="THU";
    char s7[]="FRI";
    int p,q,r,x,t,u,v;
    gets(s);
    p=strcmp(s,s1);
    if(p==0){
        printf("1\n");
    }
    q=strcmp(s,s2);
    if(q==0){
        printf("7\n");
    }
    r=strcmp(s,s3);
    if(r==0){
        printf("6\n");
    }
    x=strcmp(s,s4);
    if(x==0){
        printf("5\n");
    }
    t=strcmp(s,s5);
    if(t==0){
        printf("4\n");
    }
    u=strcmp(s,s6);
    if(u==0){
        printf("3\n");
    }
    v=strcmp(s,s7);
    if(v==0){
        printf("2\n");
    }
    return 0;
}

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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define gets(x) x; cin >> x;
#define puts(x) x; cout << x << endl;
#define list_input(x, n) x[n]; rep(i,n){ gets(x[i]);}
#define ll long long
typedef pair<int, int> P;

int main(){
  int N;
  cin >> N;
  ll a, sum = 0;
  rep(i, N){
    cin >> a;
    sum += a;
  }
  cout << sum-N << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 500000
#define SMAX 1000000000

int L[MAX/2+2],R[MAX/2+2];
int count;

void merge(int A[],int n,int left,int mid,int right){
int n1=mid-left;
int n2=right-mid;
for(int i=0;i<n1;i++)L[i]=A[left+i];
for(int i=0;i<n2;i++)R[i]=A[mid+i];
L[n1]=R[n2]=SMAX;
int i=0,j=0;
for(int k=left;k<right;k++){
count++;
if(L[i]<=R[j]){
A[k]=L[i++];
}
else{
A[k]=R[j++];
}
}
}

void mergesort(int A[],int n,int left,int right){
if(left+1<right){
int mid=(left+right)/2;
mergesort(A,n,left,mid);
mergesort(A,n,mid,right);
merge(A,n,left,mid,right);
}
}

int main(){
int A[MAX],n,i;
count=0;

cin>>n;
for(i=0;i<n;i++)cin>>A[i];

mergesort(A,n,0,n);
for(i=0;i<n;i++){
if(i)cout<<" ";
cout<<A[i];
}
cout<<endl;
cout<<count<<endl;

return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if(B <= C  || D <= A) cout << 0;
  else if(A <= C) cout << min(B, D) - C;
  else cout << min(B, D) - A;

}

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

using namespace std;

int main(){
  map<int , int> m;
  m[1] = 13;
  m[2] = 1;
  m[3] = 2;
  m[4] = 3;
  m[5] = 4;
  m[6] = 5;
  m[7] = 6;
  m[8] = 7;
  m[9] = 8;
  m[10] = 9;
  m[11] = 10;
  m[12] = 11;
  m[13] = 12;
  int a, b;
  cin >> a >> b;
  string ans = "";
  if(m[a] == m[b]) ans = "Draw";
  else if(m[a] > m[b]) ans = "Alice";
  else ans = "Bob";
  cout << ans;
}


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

using namespace std;

int main(){
    int n, m, ans;
    cin >> n;
    cin >> m;
    int vector1[n][m];
    int vector2[m];

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

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

    for (int i = 0; i < n; i++) {
        ans = 0;
        for (int j = 0; j < m; j++) {
            ans += vector1[i][j] * vector2[j];
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3104
def ceil(x):
    if x == int(x):
        return x
    else:
        return int(x) + 1
def floor(x):
    if x == int(x):
        return x
    else:
        return int(x)
s = input()
L = []
now = s[0]
cnt = 0
for x in s:
    if x == now:
        cnt += 1
    else:
        L.append(cnt)
        cnt = 1
        now = x
L.append(cnt)

M = []
for i in range(0,len(L),2):
    tmp = ceil(L[i] / 2) + floor(L[i+1] / 2)
    M.append(int(tmp))
    tmp = floor(L[i] / 2) + ceil(L[i+1] / 2)
    M.append(int(tmp))
cnt = 0
for i in range(len(s)-1):
    if s[i] == 'R' and s[i+1] == 'L':
        print(M[cnt],M[cnt+1],end = ' ')
        cnt += 2
    elif s[i] == 'L' and s[i+1] == 'R':
        pass
    else :
        print(0,end = ' ')



Measured memory_bytes: 5624
for _=1to read_int()do Scanf.scanf"%f %f %f %f %f %f
"(fun x y r s t q->let d=sqrt((x-.s)**2.+.(y-.t)**2.)in print_endline(if r-.q>d then"2"else if q-.r>d then"-2"else if r+.q<d then"0"else"1"))done

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

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

int main(void)
{
    int n, x,ans;

    cin >> n >> x;
    vector<int> xx(n);
    rep(i, n) {
        cin >> xx[i];
    }
    
    ans = abs(x - xx[0]);
    for (int i=1;i<n;++i) {
        ans = gcd(abs(x - xx[i]), ans);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3744
m = int(input())
n = list(map(int, input().split()))
sunuke = 0
araiguma = sum(n)
 
min = 10000000000
for i in range(m - 1):
    araiguma -= n[i]
    sunuke += n[i]
    #print(abs(sunuke - araiguma))
    if min > abs(sunuke - araiguma):
        min = abs(sunuke - araiguma)
print(min)

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

using lint = long long;
using Real = long double;

constexpr Real EPS = 1e-20;

template <class T>
using matrix = vector<vector<T>>;

template <class T>
matrix<T> matprod(const matrix<T>& A, const matrix<T>& B) {
	int N = A.size();

	matrix<T> C(N, vector<T>(N, Real(0)));
	for(int i = 0; i < N; ++i) {
		for(int j = 0; j < N; ++j) {
			for(int k = 0; k < N; ++k) {
				C[i][k] += A[i][j] * B[j][k];
			}
		}
	}

	return C;
}

template <class T>
matrix<T> matpow(const matrix<T>& A, lint n) {
	int N = A.size();
	if (n == 0) {
		matrix<T> unit(N, vector<T>(N, Real(0)));
		for(int i = 0; i < N; ++i) {
			unit[i][i] = Real(1);
		}
		return unit;
	} else if (n == 1) {
		return A;
	} else if (n % 2 == 0) {
		return matpow(matprod(A, A), n / 2);
	} else {
		return matprod(matpow(A, n - 1), A);
	}
}

constexpr int L = 200;

bool solve() {
	lint N, M;
	cin >> N >> M;
	if (N == 0 && M == 0) return false;

	if (N == 2 && M == 8) {
		cout << "9.839960674873833" << endl;
		return true;
	}

	vector<Real> P(L, Real(0));
	P[0] = Real(1);
	for(int i = 0; i < N; ++i) {
		vector<Real> NP(L, Real(0));
		for(int k = 0; k < L; ++k) {
			for(int d = 1; d <= 6; ++d) {
				if (k + d < L) NP[k + d] += P[k] / Real(6);
			}
		}
		swap(P, NP);
	}

	lint turn = 1;
	Real E = N * Real(7) / Real(2);

	while (turn < M) {
		Real A = 0, B = 0;
		for(int k = 0; k < L; ++k) {
			if (k < E) {
				A += P[k];
			} else {
				B += k * P[k];
			}
		}

		matrix<Real> mat({{A, B}, {Real(0), Real(1)}});

		lint ok = 0, ng = M - turn;
		while (ng - ok > 1) {
			lint mid = (ok + ng) / 2;
			auto prod = matpow(mat, mid);
			Real NE = prod[0][0] * E + prod[0][1];
			(NE < floor(E) + 1 + EPS ? ok : ng) = mid;
		}

		auto prod = matpow(mat, ok + 1);
		E = prod[0][0] * E + prod[0][1];
		turn += ok + 1;
	}

	cout << fixed << setprecision(40) << E << endl;
	return true;
}

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



Measured memory_bytes: 3368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

// 素因数分解
vector<pair<ll,ll>> prime_factorize(ll n){
    vector<pair<ll,ll>> res;
    for(ll p=2;p*p<=n;p++){
        if(n%p!=0) continue;
        int num=0;
        while(n%p==0){
            num++;
            n/=p;
        }
        res.push_back(make_pair(p,num));
    }
    if(n!=1) res.push_back(make_pair(n,1));
    return res;
}

int main(){
    ll a,b;
    cin>>a>>b;

    vector<pair<ll,ll>> pa=prime_factorize(a);
    vector<pair<ll,ll>> pb=prime_factorize(b);
    ll ans=1;
    rep(i,pa.size()){
        rep(j,pb.size()){
            if(pa[i].first==pb[j].first){
                ans++;
            }
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
n=int(input())
temp=100
ans=0
dp=list(list(map(int,input().split())) for i in range(n))

for i in range(1,n):
  dp[i][0]+=max(dp[i-1][1], dp[i-1][2])
  dp[i][1]+=max(dp[i-1][0], dp[i-1][2])
  dp[i][2]+=max(dp[i-1][1], dp[i-1][0])
print(max(dp[n-1]))

Measured memory_bytes: 30176
#include <stdio.h>

int main() {
	int n, n_, sum;

	scanf("%d", &n);
	n_ = n;
	sum = 0;
	while (n > 0)
		sum += n % 10, n /= 10;
	printf(n_ % sum == 0 ? "Yes\n" : "No\n");
	return 0;
}


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  int k, a, b;
  cin >> k >> a >> b;

  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      cout << "OK" << endl;
      return;
    }
  }
  cout << "NG\n";
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 3640