akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    
    string s, t;
    cin >> s >> t;
    
    int ans = s.size() + 10;
    rep(i, s.size()-t.size()+1) {
        int now = 0;
        rep(j, t.size()) {
            if(t[j] != s[i+j]) now++;
        }
        chmin(ans, now);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3552
s = gets.chomp

aa = s[0..1].to_i
bb = s[2..3].to_i

a_ism = (0 < aa && aa <= 12)
b_ism = (0 < bb && bb <= 12)

if a_ism && b_ism
  puts "AMBIGUOUS"
elsif a_ism && !b_ism
  puts "MMYY"
elsif !a_ism && b_ism
  puts "YYMM"
else
  puts "NA"
end


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

int main()
{
	long long N,K,Q,j,i,A[109000],B[100900],c[109000];
	while(cin>>N>>K>>Q)
	{
		for(i=0;i<N;i++)
		{
			c[i]=K-Q;
		}
		for(i=0;i<Q;i++)
		{
			cin>>B[i];
			c[B[i]-1]+=1;
		}
		for(i=0;i<N;i++)
		{
			if(c[i]>0){
				cout<<"Yes"<<endl;
			}
			else{
				cout<<"No"<<endl;
			}
		}
	}
}

Measured memory_bytes: 2176
S = input()

if S == 'SUN':
    print('7')
elif S == 'MON':
    print('6')
elif S == 'TUE':
    print('5')
elif S == 'WED':
    print('4')
elif S == 'THU':
    print('3')
elif S == 'FRI':
    print('2')
elif S == 'SAT':
    print('1')
else:
    print('Error')

Measured memory_bytes: 8996
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
// template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define Mod 1000000007
#define MAX 5002

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll n;cin>>n;
	ll a[n];For(i,0,n) cin>>a[i];
	bool allequal=1;
	For(i,0,n) if(a[i]!=a[0]) allequal=0;

	if(allequal){
		if(a[0]==0)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
		return 0;
	}else{
		map<ll,ll> count;
		For(i,0,n){
			count[a[i]]++;
		}
		if(count.size()>3 || n%3!=0){
			cout<<"No"<<endl;
			return 0;
		}else{
			bool ok=1;
			ll C = 0;
			ll size = n/3;
			vector<ll> elements;
			for(pii x:count){
				ll f = x.se;
				while(f>0){
					C++;
					elements.pb(x.fi);
					f-=size;
				}
				if(f<0) ok=0;
			}
			if(ok && C==3){

				bool check = (elements[0]^elements[1])==(elements[2]);
				if(check)
					cout<<"Yes"<<endl;
				else
					cout<<"No"<<endl;
			}else{
				cout<<"No"<<endl;
			}
		}
	}































	
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int r,g,b;
  cin >> r >> g >> b;
  int n = r*100+g*10+b;
  if(n%4==0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void)
{
    int a, b, c, cnt = 0;
    cin >> a >> b >> c;
    while ((c != 0) || ((a != 0) && (b != 0)))
    {
        if ((c == 0) && (b != 0) && (a != 0))
        {
            break;
        }
        c--;
        cnt++;
        if (b != 0)
        {
            b--;
            cnt++;
        }
        else if (a != 0)
        {
            a--;
        }
        else
        {
            break;
        }
    }
    if (b != 0)
    {
        cnt += b;
    }
    cout << cnt << endl;
    return 0;
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b;
    cin>>a>>b;
    int c=a+b;
    if (c >= 10) {cout<<"error";return 0;}
    else cout<<c;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                                   \
  ifstream in("atcoder-problems/keyence2020_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  vector<pl> c(N);
  rep(i, N) {
    ll x, l;
    cin >> x >> l;
    // 右側の小さい順にソートしたい
    c[i] = pl(x + l, x - l);
  }
  sort(c.begin(), c.end());

  ll ans = 0;
  ll cur = -LINF;
  rep(i, N) {
    ll s = c[i].second;
    if (cur <= s) {
      ans++;
      cur = c[i].first;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<set>
#include<map>

using namespace std;
using ll = long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int n;
  while(cin >> n && n){
    vector<string> groups;
    map<string, set<string>> g_mems;
    for(int i = 0; i < n; i++){
      string s;
      cin >> s;
      string now_g;
      for(int j = 0, k = 0; j < s.length(); j++){
        if(s[j] == ':'){
          now_g = s.substr(k, j-k);
          groups.push_back(now_g);
          k = j+1;
        }
        else if(s[j] == ',' || s[j] == '.'){
          g_mems[now_g].insert(s.substr(k, j-k));
          k = j+1;
        }
      }
    }
    vector<bool> cleared(n, false);
    while(!cleared[0]){
      for(int i = 0; i < n; i++){
        if(cleared[i]) continue;
        cleared[i] = true;
        for(auto now:groups){
          auto it = g_mems[groups[i]].find(now);
          if(it != g_mems[groups[i]].end()){
            cleared[i] = false;
            g_mems[groups[i]].erase(it);
            set<string> temp;
            set_union(g_mems[now].begin(), g_mems[now].end(),
              g_mems[groups[i]].begin(), g_mems[groups[i]].end(),
              inserter(temp, temp.begin())
            );
            g_mems[groups[i]] = temp;
          }
        }
      }
    }
    cout << g_mems[groups[0]].size() << endl;
  }
  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}



Measured memory_bytes: 3468
#include <bits/stdc++.h>   
using namespace std;
#define PI 3.14159265
#define INF 2e18
#define intinf 999999999
#define EPS 1e-16
#define fst first
#define scd second 
#define pb push_back
#define mp make_pair
#define FOR(i,f_limit) for(long long int i=0;i<f_limit;i++)
#define FORR(i,s_limit,f_limit) for(long long int i=s_limit;i<f_limit;i++)
#define closest_perf_sq static_cast<int>(sqrt(static_cast<float>(number)) + .5f);
#define npow2(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b)
{
    return (a.second < b.second);
}
typedef long long int ll; 
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
vector<pair<ll,ii> > ed;
vector<vii> adj;
priority_queue<ii , vector<ii> , greater<ii> > pq;

int main()
{
   // freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    string a,b;
    cin>>a>>b;
    a+=b;
    ll x,n=0;
    FOR(i,a.length())
    {
        x=ceil(pow(10,a.length()-1-i));
        n+=(a[i]-'0')*x;
    }
    // cout<<n;
    ll sq=sqrt(n);
    if(sq*sq==n)
    {
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    

    return 0;
}

Measured memory_bytes: 512
/*
@Author
   Sujeet Kushwaha
*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false)
#define fast_input cin.tie(NULL)
#define fast_output cout.tie(NULL)
#define vi vector<long long int> 
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(a,b) for(int a=0;a<b;a++)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
// ll powmod(ll a, ll b)
// {
//     ll res = 1;
//     while (b) {
//         if (b&1) {
//             res *= a;
//             res %= mod;
//         }
//         b >>= 1;
//         a = (a * a) % mod;
//     }

//     return res;
// }

// ll modInv(ll a)
// {
//     return powmod(a, mod - 2);
// }
// int fastread(){
//     int x=0;
//     int c = getchar_unlocked();
//     while(c<48)
//         c = getchar_unlocked();
//     while(c>=48){
//         x = x*10 + (c - 48);
//         c = getchar_unlocked();
//     }
//     return x;
// }
void solve()
{
  ll a,b,k;
  cin>>a>>b>>k;
  if(a>=k)
  {
    a=a-k;
    cout<<max((ll)0,a)<<" "<<b;
  }
  else
  {
   
    k=k-a;
    a=0;
    b=b-k;
    cout<<0<<" "<<max((ll)0,b);
  }
}
int main() {
	fast;
	fast_input;
	fast_output;
	//ll t;
	//cin>>t;
	//while(t--)
	//{
	  solve();
	//}
	return 0;
}


Measured memory_bytes: 256
#include <climits>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int& ai : a) cin >> ai;
  ll dp[N + 1][2];
  for (int i = 0; i < N; i++) {
    dp[i][0] = 0;
    dp[i][1] = 0;
  }
  dp[0][1] = INT_MIN;
  for (int i = 0; i < N; i++) {
    dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i]);
    dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i]);
  }
  cout << dp[N][0] << endl;
  /*   int N;
    cin >> N;
    int minnum = INT_MAX;
    int minus = 0;
    bool iszero = false;
    ll sum = 0;
    for (int i = 0; i < N; i++) {
      int num;
      cin >> num;
      if (num < 0) minus++;
      if (num == 0) iszero = true;
      if (num != 0) minnum = min(abs(num), minnum);
      sum += abs(num);
    }
    if ((minus % 2 == 1) && !iszero)
      cout << sum - minnum << endl;
    else
      cout << sum << endl; */
  return 0;
}


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

// dp[i][j]: 左にi個、右にj個詰めた時の最大値
ll dp[2020][2020];

int main() {
  int N;
  cin >> N;
  vector< pair<ll, ll> > A(N);
  REP(i,N) {
    cin >> A[i].first;
    A[i].second = i;
  }
  sort(A.begin(), A.end(), greater<pair<ll,ll> >());
  REP(i,N) {
    for( ll j=0; i+j<N; j++ ) {
      // left
      dp[i+1][j] = max(dp[i+1][j], dp[i][j] + A[i+j].first * abs(A[i+j].second - i));
      // right
      dp[i][j+1] = max(dp[i][j+1], dp[i][j] + A[i+j].first * abs(N-1-j - A[i+j].second));
    }
  }
  ll ans = 0;
  REP(i,N+1) {
    ans = max( ans, dp[i][N-i] );
  }
  cout << ans << endl;
}


Measured memory_bytes: 26324
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  int x,t;
  cin >> x >> t;
  cout << max(x-t,0) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>
#include<cmath>
#include<assert.h>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

bool f(vector<int> vec, int target) {
    int s = 0;
    rep(i, vec.size()) {
        s += vec[i];
    }
    if (s < target)return false;
    if (s == target)return true;
    int dist = s - target;
    if (dist % 2 == 1)return false;
    dist /= 2;
    sort(vec.begin(), vec.end());
    bool dp[vec.size() + 1][dist + 1];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = true;
    rep(i, vec.size()) {
        rep(j, dist + 1) {
            dp[i + 1][j] = dp[i][j];
            if (j - vec[i] >= 0)dp[i + 1][j] |= dp[i][j - vec[i]];
        }
    }
    return dp[vec.size()][dist];
}

signed main() {
    string S;
    cin >> S;
    int X, Y;
    cin >> X >> Y;
    int k = 0;
    while (S[k] == 'F') {
        k++;
        --X;
    }
    X = abs(X);
    Y = abs(Y);
    vector<int> lr, ud;
    bool nowX = true;
    int length = 0;
    for (;;) {
        while (k < S.size() && S[k] == 'F') {
            k++;
            length++;
        }
        k++;
        if (nowX && length != 0)lr.push_back(length);
        if (!nowX && length != 0)ud.push_back(length);
        nowX = !nowX;
        length = 0;
        if (k >= S.size())break;
    }
    if (f(lr, X) && f(ud, Y)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

public class Main {
	static int[][] bingo = new int[3][3];

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

		int n = Integer.parseInt(sc.next());
		int[] a = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}
		Arrays.sort(a);
		int alice = 0;
		int bob = 0;

		for (int i = 0; i < a.length; i++) {
			if (i % 2 == 0) {
				alice += a[a.length - 1 - i];
			} else {
				bob += a[a.length - 1 - i];
			}
		}

		System.out.println(Math.abs(alice - bob));

	}
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define LOL cout<<'\n';
#define MOD 1000000007
#define sz(x) ((int)x.size())
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define deb(x) cout << "[" << (#x) << "=" << x << "]" << '\n';
#define deb2(x,y) cout << "[" << (#x) << "=" << x << "] [" << (#y) << "=" << y << "]" << '\n';
#define deb3(x,y,z) cout << "[" << (#x) << "=" << x << "] [" << (#y) << "=" << y << "] [" << (#z) << "=" << z << "]" << '\n';

const int N=1e5+7;
int n,m,k,q,l,r,x,y,z;
int a[N],b[N],c[N];
string s,t;
int ans=0,cnt=0,f=0;

void solve(){
	cin>>n;
	ld bb;
	cin>>bb;
	m=(bb*100+.5);
	m=n*m;
	m/=100;
	cout<<m;LOL
}

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  cout<<setprecision(2);
  int _=1; //cin>>_;
  for(int i=1 ; i<=_ ; i++) solve();
  return 0;
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
#define REP(i,m,n) for (int i=m;i<n;i++)
#define FOR(i,m,n,a) for(int i=m;i<n;i+=a)
const ll MOD=1e9+7;

int n;
char p[100002];
bool ans[100002];

bool solve(){
  REP(i,2,(n+2)+1){
    if(p[i-1]=='o'){
      ans[i]=(ans[i-1])?ans[i-2]:(!ans[i-2]);
    }
    else{
      ans[i]=(ans[i-1])?(!ans[i-2]):ans[i-2];
    }
  }

  if(ans[0]==ans[n]&&ans[1]==ans[n+1]){
    REP(i,0,n){
      cout << (ans[i]?'S':'W');
    }
    cout << endl;
    return true;
  }
  return false;
}

int main(){
  cin >> n >> p;
  p[n]=p[0];p[n+1]=p[1];

  bool PAT[4][2]={{true,true},{true,false},{false,true},{false,false}};
  REP(i,0,4){
    ans[0]=PAT[i][0];
    ans[1]=PAT[i][1];

    if(solve()){
      return 0;
    }
  }
  cout << "-1" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A,B,count_individual=0,count=100;
  cin >> A;
  int target[A];
  for(int i=0; i<A; i++){
    cin >> B;
    count_individual=0;
    while(B%2==0){
      B/=2;
      count_individual+=1;
    }
    count =min(count,count_individual);
  }
  cout << count << endl;
}

Measured memory_bytes: 256
// Input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

// test code ==================================
test! {
    // example:  r##""## => ""
"4 2 9" => "8", "4 2 7"=>"7","4 2 8" => "8"
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        n: i32,
        a: i32,
        b: i32,
    }
    (if a*n<b{a*n}else{b}).to_string()
}

Measured memory_bytes: 4352
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	S := scanner.Text()

	if S[2] == S[3] && S[4] == S[5] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1772
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
string s;
int main(void){
  cin >> s;
  int ans = 0;
  for(int i = 0; i < (int)s.size(); i++){
    if(s[i] == 'g'){
      ans++;
    }else{
      ans--;
    }
  }
  cout << ans/2 << endl;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            LinkedList dll = new LinkedList();

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string[] input = Console.ReadLine().Split(' ');

                switch (input[0])
                {
                    case "insert":
                        dll.Insert(input[1]);
                        break;
                    case "delete":
                        Node temp = dll.Search(input[1]);
                        dll.Erace(temp);
                        break;
                    case "deleteFirst":
                        dll.Erace(dll.first);
                        break;
                    case "deleteLast":
                        dll.Erace(dll.last);
                        break;
                }
            }

            StringBuilder sb = new StringBuilder();

            for (Node node = dll.first; node != dll.end; node = node.next)
            {
                sb.Append(" " + node.val);
            }
            Console.WriteLine(sb.ToString().TrimStart());
        }
    }

    class Node
    {
        internal string val;
        internal Node prev;
        internal Node next;

        internal Node(string val, Node prev, Node next)
        {
            this.val = val;
            this.prev = prev;
            this.next = next;
        }
    }

    class LinkedList
    {
        Node dummy;

        public Node first { get { return dummy.next; } }
        public Node last { get { return dummy.prev; } }
        public Node end { get { return dummy; } }

        public LinkedList()
        {
            dummy = new Node(null, null, null);
            dummy.next = dummy;
            dummy.prev = dummy;
        }

        public void Insert(string val)
        {
            Node temp = new Node(val, dummy, dummy.next);
            dummy.next.prev = temp;
            dummy.next = temp;
        }

        public Node Search(string val)
        {
            Node ret = dummy.next;

            while (ret.val != val && ret != end)
            {
                ret = ret.next;
            }

            return ret;
        }

        public Node Erace(Node node)
        {
            if (node == dummy)
            {
                return dummy;
            }

            node.prev.next = node.next;
            node.next.prev = node.prev;

            return node.next;
        }
    }
}

Measured memory_bytes: 120572
#include<cstdio>
#include<iostream>
using namespace std;

int main(){

  while(1){
    int a;
    scanf("%d",&a);
    if(a==-1) break;
    
    int cost=1150;
    if(a>10) cost+=((a-10>=10)?(10):(a-10))*125;
    if(a>20) cost+=((a-20>=10)?(10):(a-20))*140;
    if(a>30) cost+=(a-30)*160;

    printf("%d\n",4280-cost);
  }

  return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> a(N+1);
    int ans = 0;
    for (int i = 1; i <= N; i++){
        cin >> a[i];
        if(i % 2 != 0){
            if(a[i] % 2 != 0) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
#include <stdio.h>

#define rep(i,m,n) for(unsigned long long int i=(m);i<(n);++i)
#define rem(i,m,n) for(int i=(m);i>(n);--i)
#define MOD 1000000007

using namespace std;

using ll =long long int;
using std::swap;

vector<long long int> v;
vector<long long int> w;

int main() {
	string S;
	cin >> S;
	if (S == "Sunny")cout << "Cloudy" << '\n';
	else if (S == "Cloudy")cout << "Rainy" << '\n';
	else if (S == "Rainy")cout << "Sunny" << '\n';
	
	return 0;
}

Measured memory_bytes: 256
// C++ 14
#include <math.h>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <string>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (*(x.end()-1))

using namespace std;

#define EPS 0.000000001
#define fequals(a,b) (fabs((a) - (b)) < EPS)

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (const Vector2 v) const { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (const Vector2 v) const { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (const double k) const { return Vector2(x * k, y * k); }
  Vector2 operator / (const double k) const { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 const v) { return x * v.x + y * v.y; }
  double cross (Vector2 const v) { return x * v.y - y * v.x; }
  
  bool parallel(Vector2 &other) {
    return fequals(fabs(dot(other)), length() * other.length());
  }
  
  bool orthogonal(Vector2 &other) {
    return fequals(0, dot(other));
  }
  
  bool operator < (const Vector2 &v) {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N;
Vector2 p0, p1, p2, p3;

int cw(Vector2 v01, Vector2 v02) {
  double cross_ = v01.cross(v02);
  if (cross_ > EPS) return 1;
  else if (cross_ < -EPS) return -1;
  if (v01.dot(v02) < 0) return 2;
  if (v01.length() - v02.length() >= 0) return 0;
  return -2;
}

void solve() {
  int cw1 = cw(p1 - p0, p2 - p0) * cw(p1 - p0, p3 - p0);
  int cw2 = cw(p3 - p2, p1 - p2) * cw(p3 - p2, p0 - p2);
  if (cw1 <= 0 && cw2 <= 0) cout << 1 << endl;
  else cout << 0 << endl;
}

void input() {
  cin >> N;
  while (cin >> p0 >> p1 >> p2 >> p3) {
    solve();
  }
}

int main() {
  cout.precision(15);
  input();
}


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

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

    string S;

    cin>>S;

    if(S[2] == S[3] && S[4] == S[5])
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


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

int main(void){

	char a,b,c;
	int d,e,f;
	scanf("%c %c %c",&a,&b,&c);

	d = a - '0';
	e = b - '0';
	f = c - '0';


	if((a*100+b*10+c)%4==0){printf("YES\n");}
	else{printf("NO\n");}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();

		if(N < 9) {
			System.out.println(N);
		}else {
			long temp = N+1;
			int digit = String.valueOf(temp).length();
			int maxdigit = Integer.parseInt((String.valueOf(temp).substring(0,1)));
			System.out.println(maxdigit + (9*digit - 10));
		}
	}
}


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

const int INF = 10000000;   // 十分大きな値に

int N;
int A[210];         // 最大 200 個なので余裕を持って 210 に

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

  int res = INF;

  for (int i = 0; i < N; ++i) {
    int count = 0;  // 何回 2 で割れるか

    while (A[i] % 2 == 0) {
      A[i] /= 2;
      ++count;
    }

    // 最小値を更新
    if (res > count) res = count;
  }

  cout << res << endl;
}


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

int main() {
  int n; cin >> n;
  vector<int>a(n); 
  rep(i,n) cin >> a[i];
  bool flag = true;
  rep(i,n) {
    if (a[i] % 2 == 0) {
      if (a[i] % 3 != 0 && a[i] % 5 != 0) {
        flag = false;
        cout << "DENIED" << endl;
        break;
      }
    }
  }
  if (flag == true) {
    cout << "APPROVED" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        FSugoroku solver = new FSugoroku();
        solver.solve(1, in, out);
        out.close();
    }

    static class FSugoroku {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            String s = in.next();

            String res = solveMe(n, m, s);
            out.println(res);
        }

        private String solveMe(int n, int m, String s) {
            int possible = -1;
            int jump = 1;
            List<Integer> possibles = new ArrayList<>();
            for (int i = n - 1; i >= 0; i--) {
                boolean isPossible = s.charAt(i) == '0';
                if (isPossible)
                    possible = jump;

                if (jump == m || i == 0) {
                    if (!isPossible && possible == -1)
                        return "-1";

                    possibles.add(possible);
                    jump = m - possible;
                    possible = -1;
                }

                jump++;
            }

            Collections.reverse(possibles);
            StringBuilder res = new StringBuilder();
            for (int i = 0; i < possibles.size(); i++) {
                if (i > 0)
                    res.append(" ");
                res.append(possibles.get(i));

            }
            return res.toString();
        }

    }
}



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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

// template from zscoder

int h,w,b;
char grid[55][55];
int visit[55][55];
int dist[55][55];
int dx[4]={-1,0,0,1};
int dy[4]={0,-1,1,0};

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    cin >> h >> w;
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            cin >> grid[i][j];
            if(grid[i][j] == '#')b++;
        }
    }
    queue<ii>Q;
    dist[0][0]=1;
    Q.push(mp(0,0));
    while(!Q.empty())
    {
        int xx = Q.front().fi;
        int yy = Q.front().se;
        Q.pop();
        if(visit[xx][yy])continue;
        visit[xx][yy] = 1;

        for(int i = 0; i < 4; i++)
        {
            int X = xx + dx[i];
            int Y = yy + dy[i];
            if(X>=0&&X<h&&Y>=0&&Y<w&&grid[X][Y]=='.'&&visit[X][Y]==0)
            {
                dist[X][Y] = dist[xx][yy]+1;
                Q.push(mp(X,Y));
            }
        }
    }

    if(dist[h-1][w-1]==0)
    {
        cout << -1 << endl;
        return 0;
    }
    else
    {
        int ans = h*w;
        ans -= dist[h-1][w-1];
        ans -= b;
        cout << ans << endl;
        return 0;
    }
}

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

using namespace std;

int main() {
    double N, T, A, H, tmp, ans, diff;
    cin >> N >> T >> A;
    for (int i = 0; i < N; i++) {
        cin >> H;
        tmp = abs(T - (H * 0.006) - A);
        if (i == 0) {
            diff = tmp;
            ans = i+1;
        }
        if (tmp < diff) {
            diff = tmp;
            ans = i+1;
        }
    }
    cout << ans << endl;
    

    return 0;
}

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


def solve(N: int, S: str):
    nww = [0] * N
    nee = [0] * N

    acc = 0
    for i in range(N - 1):
        if S[i] == "W":
            acc += 1
        nww[i + 1] = acc

    acc = 0
    for i in reversed(range(1, N)):
        if S[i] == "E":
            acc += 1
        nee[i - 1] = acc

    print(min(nwwi + neei for nwwi, neei in zip(nww, nee)))


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


if __name__ == '__main__':
    main()


Measured memory_bytes: 17856
def dijkstra(s):
    import  heapq
    dist=[inf for i in range(n)] #sからの距離のリスト
    dist[s]=0
    mirai=[True for i in range(n)] #Trueなら未確定
    mirai[s]=False

    queue=[] #こいつがheapqになる
    for kyori,to in G[s]:
        heapq.heappush(queue , kyori*10**6+to)  #重みと行先を1つの変数で表してる！
    while queue:
        minedge= heapq.heappop(queue)
        #miraiがTrueのやつ(未確定なやつ)から最小距離のものをさがす
        if not mirai[minedge%(10**6)]: continue
        #距離が小さいものから"確定"していく
        v=minedge%(10**6) #最小距離の頂点
        dist[v] = minedge//(10**6) #その距離
        mirai[v]=False
        for kyori,to in G[v]:
            if mirai[to]:
                heapq.heappush(queue, (kyori+dist[v])*(10**6)+to)
                #queueに入る数は、必ず「sからの」距離と行先を持っている
    return dist
n,m=map(int,input().split())
inf=10**10
G=[[] for i in range(n)]
HEN=[]
for i in range(m):
    a,b,c=map(int,input().split())
    a-=1;b-=1
    G[a].append((c,b))
    G[b].append((c,a))
    HEN.append((a,b,c))

MIN=[[10**10]*n for i in range(n)]
for i in range(n):
    MIN[i]=dijkstra(i)
ans=0
for a,b,c in HEN:
    for s in range(n):
        if MIN[s][a]+c == MIN[s][b]:
            break
        if MIN[s][b]+c == MIN[s][a]:
            break
    else:
        ans+=1
print(ans)


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

#define IL __inline__ __attribute__((always_inline))

#define For(i, a, b) for (int i = a, i##end = b; i <= i##end; ++ i)
#define FOR(i, a, b) for (int i = a, i##end = b; i < i##end; ++ i)
#define Rep(i, a, b) for (int i = a, i##end = b; i >= i##end; -- i)
#define REP(i, a, b) for (int i = (a) - 1, i##end = b; i >= i##end; -- i)

typedef long long LL;

template <class T>
IL bool chkmax(T &a, const T &b) {
  return a < b ? ((a = b), 1) : 0;
}

template <class T>
IL bool chkmin(T &a, const T &b) {
  return a > b ? ((a = b), 1) : 0;
}

template <class T>
IL T mymax(const T &a, const T &b) {
  return a > b ? a : b;
}

template <class T>
IL T mymin(const T &a, const T &b) {
  return a < b ? a : b;
}

template <class T>
IL T myabs(const T &a) {
  return a > 0 ? a : -a;
}

const int INF = 0X3F3F3F3F;
const double EPS = 1E-10, PI = acos(-1.0);

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define OK DEBUG("Passing [%s] in LINE %d...\n", __FUNCTION__, __LINE__)
/*------------------------------header------------------------------*/

const int MAXN = 2000 + 5;

int a[MAXN], val[MAXN];

int main() {
  int n, x;
  scanf("%d%d", &n, &x);
  For(i, 1, n) {
    scanf("%d", &a[i]);
  }
  memset(val, 0X3F, sizeof val);
  LL answer = (LL)INF * INF;
  FOR(i, 0, n) {
    LL total = 0;
    For(j, 1, n) {
      chkmin(val[j], j > i ? a[j - i] : a[j - i + n]);
      total += val[j];
    }
    chkmin(answer, total + (LL)x * i);
  }
  printf("%lld\n", answer);
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <iomanip>
#include <cstdlib>
#include <climits>
using namespace std;

//関数getinputdata宣言
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();

void abc124_b(vector<vector<int>> v) {

    int n = v[0][0];

    vector<int> vec = v[1];
    int cnt = 1;
    for (int i = n - 1; i > 0; i--) {

        int temp = vec[i];
        int maxdata = 0;


        for (int j = 0; j <= i - 1; j++) {

            maxdata = max(maxdata, vec[j]);
        }

        if (temp >= maxdata) {
            cnt += 1;
        }


    }

    cout << cnt << endl;


}

int main() {

    //    vector<vector < string>> vec_arr_result;
    vector<vector<int>> vec_arr_result;
    vec_arr_result = getinputdata2();

    abc124_b(vec_arr_result);

    return 0;
}

//関数getinputdata実装

vector<vector<double>> getinputdata3() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<double>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<double> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atof(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;
}

//関数getinputdata実装

vector<vector<int>> getinputdata2() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<int>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<int> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atoi(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;


}

//関数getinputdata実装

vector<vector < string >> getinputdata() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector < string>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<string> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(ret);
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long MOD = 1e9 + 7;
using namespace std;
typedef long long ll;

map<ll, int> mp;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	for (int i = 0; i < 10; i++) {
		string s;
		cin >> s;
		string tmp = "";
		if (s == "-") break;
		int m;
		cin >> m;
		for (int j = 0; j < m; j++) {
			int h;
			cin >> h;
			tmp = s.substr(0, h);
			s.erase(0, h);
			s += tmp;
		}
		cout << s << endl;
	}
	return 0;
}


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

using namespace std;

int main() {
    // Input
    int N, K;
    cin >> N >> K;

    // Process
    int ans = 0;
    for (int n = N; n > 0; n /= K) ans++;

    // Output
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    int a[101],b[101];
    int sua[101],sub[101];
    int main()
    {
        int n;
        while(cin>>n){
            for(int i=0;i<n;i++){
                cin>>a[i];
            }
            for(int i=0;i<n;i++){
                cin>>b[i]; 
            }
            sua[0]=a[0];sub[0]=b[0];
            for(int i=1;i<n;i++){
                sua[i]=sua[i-1]+a[i];
                sub[i]=sub[i-1]+b[i];
            }
            int maxn=sua[0]+sub[n-1];
            for(int i=1;i<n;i++){
                int sum=sua[i]+sub[n-1]-sub[i-1];
                maxn=max(maxn,sum);
            }
            cout<<maxn<<endl;
        }
        return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
    
#define all(a) a.begin(), a.end()
#define forn(l, r) for(int i = l; i < (r); ++i)
#define F first
#define S second
#define $ ios::sync_with_stdio(0);
//#define int long long int
    
using namespace std;
using namespace __gnu_pbds;
using ll = long long int;
using ii = pair<int, int>;
using vi = vector<int>;
using graph = vector<vi>;
using ordered_mset = tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update>;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
    
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    
const ll mod = 1000000007;
const int INF = 0x3f3f3f3f;
//const ll INFLL = (ll)1e17;
const int MAXN = 123;
const double pi = 3.14159265359;
const double eps = 0.00000001;

int n, k, a[MAXN];
int fw[112][112345];

void add(int i, int x, int wh) {
    for (; i <= k; i = i | (i + 1)) {
        fw[wh][i] += x;
        if (fw[wh][i] >= mod) {
            fw[wh][i] -= mod;
        }
    }
}

int sum(int i, int wh) {
    int res = 0;
    for (; i >= 0; i = (i & (i + 1)) - 1) {
        res += fw[wh][i];
        if (res >= mod) {
            res -= mod;
        }
    }
    return res;
}

int range_sum(int l, int r, int wh) {
    int res = sum(r, wh) - (l < 0 ? 0 : sum(l, wh));
    return (res % mod + mod) % mod;
}

int main() {
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
    }
    for (int j = 0; j <= a[0]; ++j) {
        add(j, 1, 0);
    }
    for (int i = 1; i < n; ++i) {
        add(0, 1, i);
        for (int j = 1; j <= k; ++j) {
            add(j, range_sum(j - a[i] - 1, j, i - 1), i);
        }
    }
    printf("%d\n", range_sum(k - 1, k, n - 1));
}


Measured memory_bytes: 45184
# coding: utf-8
# Your code here!

import math

a,b,x = map(int,input().split())

if a*b/2*a < x:
    c = (x * 2) / (a * a) - b
    d = b - c
    
    atan1 = math.degrees(math.atan(d/a))
else:
    c = (2 * x) / (a * b)
    atan1 = math.degrees(math.atan(b/c))

print(atan1)

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N,M = IL()

L = 0
R = INF

for i in range(M):
  l,r = IL()
  L = max(L,l)
  R = min(R,r)
  
print(max(0,R-L+1))


Measured memory_bytes: 41196