akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define Matrix vector<vector<int>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = 2e18;
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

int mod(int x) {
  x %= MOD;
  if (x < 0)
    x += MOD;
  return x;
}
static int bin_pow(const int n, int p) {
  assert(p >= 0);
  int ans = 1;
  int cur_pow = n;

  while (p) {
    if (p & 1ll)
      ans = (ans * cur_pow) % MOD;

    cur_pow = (cur_pow * cur_pow) % MOD;
    p >>= 1ll;
  }

  return ans;
}
class Combinatorics {
private:
  static constexpr int MOD = 1e9 + 7;
  const int max_val;
  vector<int> _inv, _fat;

private:
  vector<int> build_inverse(const int max_val) {
    vector<int> inv(max_val + 1);
    inv[1] = 1;
    for (int i = 2; i <= max_val; ++i)
      inv[i] = mod(-MOD / i * inv[MOD % i]);
    return inv;
  }

  vector<int> build_fat(const int max_val) {
    vector<int> fat(max_val + 1);
    fat[0] = 1;
    for (int i = 1; i <= max_val; ++i)
      fat[i] = mod(i * fat[i - 1]);
    return fat;
  }

public:
  /// Builds both factorial and modular inverse array.
  ///
  /// Time Complexity: O(max_val)
  Combinatorics(const int max_val) : max_val(max_val) {
    assert(0 <= max_val), assert(max_val <= MOD);
    this->_inv = this->build_inverse(max_val);
    this->_fat = this->build_fat(max_val);
  }

  /// Returns the modular inverse of n % MOD.
  ///
  /// Time Complexity: O(log(MOD))
  static int inv_log(const int n) { return bin_pow(n, MOD - 2); }

  /// Returns the modular inverse of n % MOD.
  ///
  /// Time Complexity: O((n <= max_val ? 1 : log(MOD))
  int inv(const int n) {
    assert(0 <= n);
    if (n <= max_val)
      return this->_inv[n];
    else
      return inv_log(n);
  }

  /// Returns the factorial of n % MOD.
  int fat(const int n) {
    assert(0 <= n), assert(n <= max_val);
    return this->_fat[n];
  }

  /// Returns C(n, k) % MOD.
  ///
  /// Time Complexity: O(1)
  int choose(const int n, const int k) {
    assert(0 <= k), assert(k <= n), assert(n <= this->max_val);
    return mod(fat(n) * mod(inv(fat(k)) * inv(fat(n - k))));
  }
};

Combinatorics comb(2E6 + 2);

// #define MULTIPLE_TEST_CASES
void solve() {
  int k;
  cin >> k;

  string s;
  cin >> s;

  int n = k + s.size();
  int ans = 0;
  for (int i = 0; i < s.size(); ++i) {
    int cur = mod(comb.choose(n, i) * bin_pow(25, n - i));
    ans = mod(ans + cur);
  }
  ans = mod(bin_pow(26, n) - ans);
  cout << ans << endl;
}

signed main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int t = 1;

#ifdef MULTIPLE_TEST_CASES
  cin >> t;
#endif
  while (t--)
    solve();
}

Measured memory_bytes: 35508
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        int[] p2 = new int[n];
        int cnt =0;
        
        for(int i = 0;i<n;i++){
            p[i] = sc.nextInt();
        }



        for(int i = 0;i<n;i++){
           if(p[i]!=i+1){
               cnt++;
               //System.out.println(p[i]);
           }
        }

        //System.out.println(cnt);
        if(cnt==0 || cnt==2){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
        

    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

int main() {
  int a,b;
  cin >>a>>b;
  
  cout << (a==b?"Yes":"No") << endl; 
  
}


Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;

int arr[100010];

int main()
{
    int loop;

    while(~scanf("%d", &loop))
    {
        int temp;

        memset(arr, 0, sizeof(arr));

        if(loop == 2)
        {
            scanf("%d%d", &arr[0], &arr[1]);

            if(abs(arr[0] - arr[1]) <= 2)
            {
                printf("2\n");
                continue;
            }
            else
            {

                printf("1\n");
                continue;
            }

        }

        for(int i = 0; i < loop; i++)
        {
            scanf("%d", &temp);
            arr[temp]++;
        }

        if(loop == 1)
        {
            printf("1\n");
            continue;
        }

        if(loop == 0)
        {
            printf("0\n");
            continue;
        }




        int res = 0;

        for(int i = 1; i < 100000 - 1; i++)
        {
            int x = arr[i] + arr[i - 1] + arr[i + 1];
            res = max(res, x);
        }

        printf("%d\n", res);
    }

    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<queue>
#include<stack>
#include<map>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vint;
typedef vector<ll> vll;

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

ll lcm(ll a, ll b){
    ll g=gcd(a,b);
    return a/g*b;//順
}


int main(){
    ll n;
    cin>>n;

    ll ans=1LL;

    for(int i=0; i<n; i++){
        ll t;
        cin>>t;
        ans = lcm(ans,t);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0;
	bool f=false;
	char c=getchar();
	while(!isdigit(c))f|=c=='-',c=getchar();
	while(isdigit(c))x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return f?~x+1:x;
}
int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	int ac=0,wa=0,tle=0,re=0;
	for(register int i=0;i<n;++i){
		string s;
		cin>>s;
		if(s=="AC"){
			++ac;
		}
		if(s=="WA"){
			++wa;
		}
		if(s=="TLE"){
			++tle;
		}
		if(s=="RE"){
			++re;
		}
	}
	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d",ac,wa,tle,re);
}

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

int main()
{
    int a,b,c;
    cin>>a>>b;
    c=INT_MAX;
    if(a/2019 != b/2019)
    {
        cout<<0<<endl;
        return 0;
    }
    else
        for(int i=a; i<=b; i++)
        {
            for(int j=i+1; j<=b; j++)
            {
                int t =((i%2019)*(j%2019))%2019;
                if(t<c)c=t;//cout<<i<<' '<<j<<endl;}
            }
        }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
  string S, T;
  cin >> S >> T;

  int size = S.length();
  int i, j, k1, k2;
  for(i=0; i<size; i++){ //文字列Sをi文字目から見る
    for(j=0; j<size-1; j++){ //文字列Sのi文字目からj文字後を見る
      k1 = (i+j)%size; //i+jがSの大きさを超えたら始めに戻る
      if(S[k1] == T[0]){ //Sのk1文字目とTの初めが一致すれば2文字目以降を見ていく
	for(k2=0; k2<size; k2++){ //2文字目以降の探索
	  if(k2 == size-1){ //Sの文字分探索すれば，成功
            cout << "Yes" << endl;
	    goto end;
	  }
	  if(S[k1] != T[k2]) //文字が異なれば次のループへ
	    break;
	  k1 = (k1+1)%size; //k1をインクリメント(Sの範囲を超えたら始めに戻る)
	}
      }
      else
	continue;
    }
  }

  cout << "No" << endl;
 end:
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    const string vowel = "aiueo";

    char c;
    cin >> c;
    if(vowel.find(c) != string::npos)
        cout << "vowel" << endl;
    else
        cout << "consonant" << endl;

    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 2e5 + 5;
int n;
int a[N], b[N];

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(a, a + n);
    int l = a[n / 2 - 1];
    int r = a[n / 2];
    for (int i = 0; i < n; ++i) {
        if (b[i] <= l)
            cout << r << endl;
        else
            cout << l << endl;
    }
    return 0;
}


Measured memory_bytes: 5164
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

    int N = scanner.nextInt();
    String[] words = new String[N];
    for (int i = 0; i < N; i++) words[i] = scanner.next();
    Set<String> set = new HashSet<>();
    char last = words[0].charAt(0);
    for (int i = 0; i < N; i++) {
      String w = words[i];
      if (set.contains(w) || last != w.charAt(0)) {
        System.out.println("No");
        return;
      }
      set.add(w);
      last = w.charAt(w.length() - 1);
    }
    System.out.println("Yes");
  }
}


Measured memory_bytes: 21844
n, m, x = map(int, input().split())
c = [0] * n
a = [0] * n
for i in range(n):
    xs = list(map(int, input().split()))
    c[i] = xs[0]
    a[i] = xs[1:]
ans = 10 ** 9
for i in range(2 ** n):
    csum = 0
    asum = [0] * m
    for j in range(n):
        if (i >> j) & 1:
            csum += c[j]
            for k in range(m):
                asum[k] += a[j][k]
    if len(list(filter(lambda v: v >= x, asum))) == m:
        ans = min(ans, csum)
print(-1 if ans == 10 ** 9 else ans)


Measured memory_bytes: 74404
'use strict';
(function(stdin) {
  var inputs  = stdin.toString().split('\n')[0].split(' ').map(Number);
  (function(a,b) {
    var d = Math.floor(a / b);
    var r = Math.floor(a % b);
    var f = (a / b).toFixed(5);

    console.log('%d',d,r,f);

}(inputs[0],inputs[1]
  )); 
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15880
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void){
  int k, t;
  cin >> k >> t;
  VI a(t);
  int ma = 0;
  REP(i, 0, t) {
    cin >> a[i];
    ma = max(ma, a[i]);
  }
  int ans = 0;
  if (ma <= k / 2) {
    ans = 0;
  } else {
    ans = k - 1 - 2 * (k - ma);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		while (true) {
		    c -= b;
		    if (c <= 0) {
		        System.out.println("Yes");
		        return;
		    }
		    a -= d;
		    if (a <= 0) {
		        System.out.println("No");
		        return;
		    }
		}
	}
}



Measured memory_bytes: 35804
///   Journey to the End of earth   ///
/// Gunjan Kumar ///
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// #include <functional> // for less 
// using namespace __gnu_pbds; 
using namespace std;
#define ll  long long
#define s(n) scanf("%d",&n)
#define ls(n) scanf("%lld",&n)
#define p(n) printf("%d",n)
// #define ln() printf("\n")
#define pln(n) printf("%d\n",n)
#define lpln(n) printf("%lld\n",n)
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rev(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define tc           ll t1; cin>>t1; while(t1--)
#define inp         ll n; cin>>n; ll arr[n]; rep(i,0,n) cin>>arr[i];
#define vect vector<ll>
#define sortv(v)       sort(v.begin(),v.end())
#define lower(v,n)    lower_bound(v.begin(),v.end(),n)-v.begin()
#define upper(v,n)    upper_bound(v.begin(),v.end(),n)-v.begin()
#define bitcount(n) __builtin_popcount(n)
#define ln <<endl
#define inf          LONG_MAX
#define ninf         LONG_MIN
#define fast         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const   ll mod=1e9+7;
const ll N=1e5+5;



int main()
{

        
         ll n,W;
    cin>>n>>W;
 
    vector<ll> v(n+1);
    vector<ll> w(n+1);
 
    for(int i=1;i<=n;i++)
    cin>>w[i]>>v[i];
 
    
 
    ll maxval=1000*n;
 
    ll dp[n+1][maxval+1];
 
    for(int i=0;i<=n;i++){
        for(int j=0;j<=maxval;j++){
            dp[i][j]=inf;
        }
    }
 
    dp[0][0]=0;
 
    for(int i=1;i<=n;i++){
        for(int j=0;j<=maxval;j++){
            dp[i][j]=dp[i-1][j];
            if(j>=v[i]){
                if(dp[i-1][j-v[i]]!=inf)
                dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
            }
        }
    }
 
    int ans=0;
 
    for(int i=1;i<=maxval;i++){
        if(dp[n][i]<=W){
          //  cout<<dp[n][i]<<endl;
            ans=i;
        }
    }
 
    cout<<ans;
         
     return 0;
}



Measured memory_bytes: 79104
words = ["dream", "dreamer", "erase", "eraser"]
reverse_words = []
for i in words:
  word = list(reversed(i))
  word = "".join(word)
  reverse_words.append(word)
# print(reverse_words)  

S = input()
# print(S)
while S != "":
  T = S
  length = len(S)
  for j in reverse_words:
    p = (S[:-(len(j)+1):-1])
    if p == j:
      S = (S[:len(T)-len(p)])
  # print(S)
  if S == T:
    print("NO")
    exit()
print("YES")

Measured memory_bytes: 3352
#include  <bits/stdc++.h>
     
    using namespace std;
     
    #define mp make_pair
    #define fi first
    #define se second
    #define all(v) v.begin(),v.end()
    #define allarr(a) a , a + n
    #define ll long long
    #define ull unsigned long long 
    #define pb push_back
    #define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
    typedef pair<int, int> pi;
    typedef pair<ll,ll> pll; 
    typedef pair<int,pi> trp ;
    typedef vector<pi> vpi;
    typedef vector<pll> vpll ;
    // int ab  (int  x ) { return (x>0?x:-x); }
	const int M = 5005 , P = (1<<13); 
	int n , m ; 
	vector<int> boxes[M] ; 
	int dp[M][P] , a[M],b[M]; 
	int solve ( int i , int mask ){
		if( mask == (1<<n)-1 )return 0 ; 
		if( i == m )return 1e9; 
		int& r = dp[i][mask] ; 
		if( r != -1 )return r ;
		r = min( solve(i+1,mask ) , a[i]+solve (i+1,mask|b[i])); 
		return r ;
	}

	int main(){
		cin >> n >> m ;
		memset(dp,-1,sizeof dp)
; 		for(int i= 0 ; i < m ; i++ ){
			cin >> a[i]; 
			int B , x = 0 ; 
			cin >> B ; 
			for(int j = 0 ; j < B ; j++ ){
				int y ; 
				cin >> y ; 
				y--; 
				x |= (1<<y) ; 
			}b[i] = x; 
		} 

		int ans = solve(0,0); 
		if( ans >= 1e9)cout << -1 ; else cout << ans << endl ; 
	}

Measured memory_bytes: 160640
def main():
    N, M = map(int, input().split())

    pairs = []
    a = 1
    for d in range(M, 0, -2):
        pairs.append((a, a + d))
        a += 1

    a = 1 + M + 1
    for d in range(M - 1, 0, -2):
        pairs.append((a, a + d))
        a += 1

    for pair in pairs:
        print(*pair)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21168
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
typedef long long ll;
int main(){
ll a,b;
  cin>>a>>b;
  ll ans=a*b;
  ans-=b;
  ans-=a;
  ans++;
  cout<<ans;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  int x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<int> reds(a);
  vector<int> greens(b);
  priority_queue<int> no_colors;
  int tmp;
  REP(i, a) { cin >> reds[i]; }
  REP(i, b) { cin >> greens[i]; }
  REP(i, c) {
    cin >> tmp;
    no_colors.push(tmp);
  }
  sort(ALL(reds), greater<int>());
  sort(ALL(greens), greater<int>());
  REP(i, x) { no_colors.push(reds[i]); }
  REP(i, y) { no_colors.push(greens[i]); }
  ll ans = 0;
  REP(i, x + y) {
    ans += no_colors.top();
    no_colors.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 6076
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * https://abc060.contest.atcoder.jp/tasks/abc060_b
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		sc.close();
		
		Set<Integer> set = new HashSet<Integer>();		
		String ans = "NO";
		int i=0;
		
		while(true){
			int m = (i*A)%B;
			if(m==C){
				ans = "YES";
				break;
			}else if(set.contains(m)){
				break;				
			}
			set.add(m);
			i++;
		}
		System.out.println(ans);

	}

}

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

int main()
{
	int N;
	cin >> N;
	vector<int> L(N);
	for (int i = 0; i < N; ++i)
		cin >> L[i];
	sort(L.begin(), L.end());
	vector<int> leq(6001, 0);
	int total = 0;
	int current = 1;
	for (int i = 0; i < N; ++i)
	{
		if (L[i] > current)
		{
			for (int j = current + 1; j < L[i]; ++j)
				leq[j] = leq[j-1];
			leq[L[i]] = leq[L[i]-1] + 1;
			current = L[i];
		}
		else
			leq[current]++;
	}
	for (int j = current + 1; j < 6001; ++j)
				leq[j] = leq[j-1];
	
	int ans = 0;
	for (int i = 0; i < N; ++i)
		for (int j = i + 1; j < N; ++j)
			ans += leq[L[i]+L[j]-1] - (j+1);
	cout << ans << '\n';
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int dice[7],q,num1,num2,num3;
  int k;
  for(k=1;k<=6;k++){
    scanf("%d",&dice[k]);
  }
  scanf("\n");
  scanf("%d",&q);
  for(k=1;k<=q;k++){
    scanf("%d %d",&num1,&num2);
    if(num1==dice[1]){
      if(num2==dice[2]) num3=dice[3];
      else if(num2==dice[3]) num3=dice[5];
      else if(num2==dice[4]) num3=dice[2];
      else if(num2==dice[5]) num3=dice[4];
    }
    if(num1==dice[2]){
      if(num2==dice[1]) num3=dice[4];
      else if(num2==dice[3]) num3=dice[1];
      else if(num2==dice[4]) num3=dice[6];
      else if(num2==dice[6]) num3=dice[3];
    }
    if(num1==dice[3]){
      if(num2==dice[1]) num3=dice[2];
      else if(num2==dice[2]) num3=dice[6];
      else if(num2==dice[5]) num3=dice[1];
      else if(num2==dice[6]) num3=dice[5];
    }
    if(num1==dice[4]){
      if(num2==dice[1]) num3=dice[5];
      else if(num2==dice[2]) num3=dice[1];
      else if(num2==dice[5]) num3=dice[6];
      else if(num2==dice[6]) num3=dice[2];
    }
    if(num1==dice[5]){
      if(num2==dice[1]) num3=dice[3];
      else if(num2==dice[3]) num3=dice[6];
      else if(num2==dice[4]) num3=dice[1];
      else if(num2==dice[6]) num3=dice[4];
    }
    if(num1==dice[6]){
      if(num2==dice[2]) num3=dice[4];
      else if(num2==dice[3]) num3=dice[2];
      else if(num2==dice[4]) num3=dice[5];
      else if(num2==dice[5]) num3=dice[3];
    }
    printf("%d\n",num3);
  }
  return 0;
}


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

###
# main
if(__name__ == '__main__'):
    # input
    k = int(input())
    a, b = map(int, input().split(" "))

    for i in range(a,b+1):
        if i % k == 0:
            print("OK")
            break;
    else:
        print("NG")

# else:
    # do nothing

Measured memory_bytes: 9168
#include <bits/stdc++.h>
#define MOD 998244353
#define ll long long
using namespace std;
ll ff[200100];
#define MAXN 200010
int x[200100],y[200100];
unsigned ll n,m,ans[MAXN<<2],tag[MAXN<<2];
inline ll ls(ll x)
{
    return x<<1;
}
inline ll rs(ll x)
{
    return x<<1|1;
}
inline void push_up(ll p)
{
    ans[p]=ans[ls(p)]+ans[rs(p)];
}
void build(ll p,ll l,ll r)
{
    tag[p]=0;
    if(l==r){ans[p]=ff[l];return ;}
    ll mid=(l+r)>>1;
    build(ls(p),l,mid);
    build(rs(p),mid+1,r);
    push_up(p);
} 
inline void f(ll p,ll l,ll r,ll k)
{
    tag[p]=(tag[p]+k)%MOD;
    ans[p]=ans[p]%MOD+k%MOD*(r-l+1)%MOD;
}
inline void push_down(ll p,ll l,ll r)
{
    ll mid=(l+r)>>1;
    f(ls(p),l,mid,tag[p]);
    f(rs(p),mid+1,r,tag[p]);
    tag[p]=0;
}
inline void update(ll nl,ll nr,ll l,ll r,ll p,ll k)
{
    if(nl<=l&&r<=nr)
    {
        ans[p]+=(k*(r-l+1)%MOD);
        tag[p]+=k%MOD;
        return ;
    }
    push_down(p,l,r);
    ll mid=(l+r)>>1;
    if(nl<=mid)update(nl,nr,l,mid,ls(p),k);
    if(nr>mid) update(nl,nr,mid+1,r,rs(p),k);
    push_up(p);
}
ll query(ll q_x,ll q_y,ll l,ll r,ll p)
{
	if(q_x+q_y==0) return 0;
    ll res=0;
    if(q_x<=l&&r<=q_y)return ans[p];
    ll mid=(l+r)>>1;
    push_down(p,l,r);
    if(q_x<=mid)res+=query(q_x,q_y,l,mid,ls(p));
    if(q_y>mid) res+=query(q_x,q_y,mid+1,r,rs(p));
    return res;
}
int main(){
	int n,m;
	cin>>n>>m;
	memset(ff,0,sizeof ff);
	ff[1] = 1;
	ff[0] = 0;
	build(1,1, n);
	for(int i=1;i<=m;i++){
		int p,q;
		cin>>p>>q;
		x[i] = p,y[i] = q;
	}
	
	for(int i = 2;i<=n;i++){
		for(int j = 1;j<=m;j++){
			ll g = max(0,i-x[j]),yy=max(0,i-y[j]);
			ll ans = (query(yy,g,1,n,1))%MOD;
			update(i,i,1,n,1,ans);
		}
	}
	cout<<(query(n,n,1,n,1)%MOD);
	return 0;
}

Measured memory_bytes: 13400
#include <stdio.h>
#include <string.h>
 
int count_ter(const char *str, const char * ter);

int main(void){
  int n,i;
  int num_ter = 0;
  char s[100];
  char ter[] = "R";
  scanf("%d",&n);
  for (i=0; i<=n; i++){
    scanf("%c", &s[i]);
  }
  num_ter = count_ter(s, ter);
  if((2*num_ter)>n){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}
int count_ter(const char *str, const char * ter){
  int cnt = 0;
  int c;
  while ((c = *str++)) {
    if (strchr(ter, c)) {
      cnt++;
    }
  }
  return cnt;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <string>

using namespace std;
int k, n, maxv;
int main() {
	cin >> k >> n;
	for(int i = 1; i <= n; i++)
	{
		int a;
		cin >> a;
		maxv = max(maxv, a);
	}
	//maxv能被剩下的完全间隔
	if(maxv - 1 < k - maxv) cout << 0 << endl;
	//maxv被其他蛋糕间隔后还有多
	else cout << maxv - 1 - (k - maxv) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
 
int main(void)
{
	ll q,h,s,d,n;
	scanf("%lld%lld%lld%lld%lld",&q,&h,&s,&d,&n);
	if(q*2<h) h=q*2;
	if(h*2<s) s=h*2;
	if(s*2<d) d=s*2;
	if(n==1) printf("%lld\n",s);
	else if(n==2) printf("%lld\n",d);
	else{
		if(n%2) printf("%lld\n",d*(n/2)+s);
		else printf("%lld\n",d*(n/2));
	}
	return 0;
}

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

int main(){
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    for(int x=0; x<=K; x++) for(int y=0; x+y<=K; y++){
        int b = B<<x, c = C<<y;
        if(A < b && b < c){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3584
from itertools import permutations

k = int(input())
rc = [list(map(int, input().split())) for i in range(k)]

for x in permutations(range(8)):
    flag = False
    for i in rc:
        if x[i[1]] != i[0]:
            flag = True
            break
    if flag:
        continue
    # 斜めの処理
    for i in range(7):
        flag = False
        for j in range(i+1, 8):
            if abs(x[i] - x[j]) == abs(i-j):
                flag = True
                break
        if flag:
            break
    if flag:
        continue
    for i in range(8):
        for j in range(8):
            if i == x[j]:
                print('Q', end='')
            else:
                print('.', end='')
        print()
    break


Measured memory_bytes: 5656
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace LogicSummoner
{
    class Program
    {
        static void Main(string[] args)
        {
            var result = Enumerable.Range(0, 'z' - 'a' + 1)
                .Select(x => x + 'a')
                .ToDictionary(x => x, x => 0);

            while (true)
            {
                var line = Console.ReadLine();
                if (line == null)
                {
                    break;
                }

                foreach (var l in line.Trim())
                {
                    var a = 'A' <= l && l <= 'Z' ? l - 'A' + 'a' : l;
                    if (result.ContainsKey(a))
                    {
                        result[a]++;
                    }
                }
            }

            foreach (var item in result)
            {
                System.Console.WriteLine("{0} : {1}", (char)item.Key, item.Value);
            }
        }

        //static StreamReader Console = new StreamReader("input.txt");

        static int GetNumber()
        {
            return int.Parse(Console.ReadLine().Trim());
        }

        static double GetDounble()
        {
            return double.Parse(Console.ReadLine().Trim());
        }

        static int[] GetNumbersInt(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        static long[] GetNumbersLong(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToArray();
        }

        static double[] GetNumbersDouble(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => double.Parse(x)).ToArray();
        }

        static string[] GetStrings(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToArray();
        }
    }
}

Measured memory_bytes: 9984
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long
#define vi vector <int>
#define pii pair <int, int>
#define rep(i,n) for (int i = 0; i < (int) (n); ++ i)
#define foreach(it,c) for (__typedef(c.begin()) it = c.begin(); it != c.end(); ++ it)

inline int read() {
	int x = 0, f = 1, c = getchar();
	for (;!(c >= 48); c = getchar()) if (c == 45) f ^= 1;
	for (; (c >= 48); c = getchar()) x = x * 10 + c - 48;
	return f ? x : -x;
}

const int N = 200005;
int a[N], b[N], id[N], can[N], sum[N];

int main() {
	int n = read();
	rep(i, n) a[i] = read();
	rep(i, n) b[i] = read();
	sort(a, a + n); sort(b, b + n);
	rep(i, n) id[i] = i;
	int ans = 0;
	rep(i, n) can[i] = n;
	rep(i, 29) {
		rep(j, n) sum[j + 1] = sum[j] + (b[id[j]] >> i & 1);
		rep(j, n) {
			int cnt = 0;
			if (a[j] >> i & 1) cnt += can[j] - sum[can[j]];
			else cnt += sum[can[j]];
			if (a[j] >> i & 1) cnt += sum[n] - sum[can[j]];
			else cnt += n - can[j] - sum[n] + sum[can[j]];
			ans ^= (cnt & 1) << i;
		}
		stable_sort(id, id + n, [&] (int x, int y) {
			return (b[x] >> i & 1) < (b[y] >> i & 1);
		});
		rep(j, n) {
			int lb = 0, rb = n;
			int ful = (1 << i + 1) - 1;
			while (lb < rb) {
				int md = (lb + rb) >> 1;
				if ((b[id[md]] & ful) + (a[j] & ful) > ful) rb = md;
				else lb = md + 1;
			}
			int ps = lb; 
			can[j] = ps;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 4600
#include <algorithm>
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
//#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int n = in();
  int x = 0;
  {
    int n = in();
    rep(i,n)x|=bit(in());
  }
  method(cover,bool,int x,int y){
    return (x&y)==y;
  };
  rep(i,bit(n)){
    if(cover(i,x)){
      cout << i << ":";
      rep(j,n){
        if(bit(j)&i)cout << " " << j;
      }
      cout << endl;
    }
  }
}



Measured memory_bytes: 3256
import java.util.Scanner;
public class Main{
	int x;
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		x = sc.nextInt();
		System.out.println(x * x * x);
	}
	
	public static void main(String[] args){
		Main obj = new Main();
		obj.solve();
	}
}

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

int main()
{
  int S, T;
  cin >> S >> T;
  if(S<10 && T<10) cout << S*T << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int n,m,c,a,b[21];
int ans;
int main(){
	scanf("%d%d%d",&n,&m,&c);
	for (int i=1;i<=m;i++) scanf("%d",&b[i]);
	while(n--){
		int sum=0;
		for (int i=1;i<=m;i++){
			scanf("%d",&a);
			sum+=a*b[i];
		}
		sum+=c;
		if (sum>0) ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {

	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve() {

		int n = ni();
		int ans = 0;
		int v[] = na(n);
		for (int i = 0; i < n; i++)
			ans += Math.max(v[i] - ni(), 0);
		out.println(ans);

	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
									// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n) {
			if (!(isSpaceChar(b)))
				buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int[][] na(int n, int m) {
		int[][] a = new int[n][];
		for (int i = 0; i < n; i++)
			a[i] = na(m);
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


Measured memory_bytes: 21332
N, L = map(int, input().split())

aji = []
aji_abs = []
for i in range(1, N+1):
    aji.append(L+i-1)
    aji_abs.append(abs(L+i-1))
eaten = min(aji_abs)
if eaten*(-1) in aji:
    eaten = - eaten

all = sum(aji) - eaten
print(all)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node {
  int key;
  struct node *right;
  struct node *left;
  struct node *parent;
};
typedef struct node * Node;
Node root;
void Insert(int );
void inorder(Node );
void preorder(Node );
Node search(Node, int);

int main()
{
  int i,j,k,yflag=0,nflag=0;
  char c[10];
  Node a;
  scanf("%d",&k);
  
  for(i=0;i<k;i++)
    {
      scanf("%s",&c[0]);
      if(c[0]=='f')
	{
	  scanf("%d",&j);
	  a=search(root,j);
	  if(a!=NIL) printf("yes\n");
	  else printf("no\n");
	}
      if(c[0]=='i')
	{
	  scanf("%d",&j);
	  Insert(j);
	}
      else if(c[0]=='p') 
	{
	  /*while(yflag!=0)
	    {
	      printf("yes\n");
	      yflag--;
	    }
	  while(nflag!=0)
	    {
	      printf("no\n");
	      nflag--;
	    }*/
	  inorder(root);
	  printf("\n");
	  preorder(root);
	  printf("\n");
	}
    }
  return 0;
}

void Insert(int p)
{
  Node x=root;
  Node y=NIL;
  Node z;
  
  z=(Node )malloc(sizeof(struct node));
  z->key=p;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL)
    {
      y=x;
      if(z->key < x->key) x=x->left;
      else x=x->right;

      z->parent=y;
    }
  if(y==NIL) root=z;
  else if(z->key < y->key) y->left=z;
  else  y->right=z;
}

void inorder(Node x)
{
  if(x==NIL) return;
  inorder(x->left);
  printf(" %d",x->key);
  inorder(x->right);
}

void preorder(Node x)
{
  if(x==NIL) return;
  printf(" %d",x->key);
  preorder(x->left);
  preorder(x->right);
}

Node search(Node u,int k)
{
  while(u!=NIL && k!=u->key)
    {
      if(k < u->key) u=u->left;
      else u=u->right;
    }
  return u;
}

Measured memory_bytes: 21332
#include <map>
#include <queue>
#include <iostream>
using namespace std;
int N, M, E, S, T, R, a, b, c, f[111]; vector<int> G[6][100];
void add_edge(int r, int a, int b) {
	G[r][a].push_back(b);
	G[r][b].push_back(a);
}
struct State {
	int pos, day, bit;
	State(int pos_, int day_, int bit_) : pos(pos_), day(day_), bit(bit_) {};
};
bool operator<(const State& s1, const State& s2) {
	return s1.pos * ((R + 1) << E) + (s1.day << E) + s1.bit < s2.pos * ((R + 1) << E) + (s2.day << E) + s2.bit;
}
int main() {
	cin >> N >> M >> E >> S >> T >> R;
	for (int i = 0; i < M; i++) {
		cin >> a >> b;
		add_edge(0, a, b);
	}
	fill(f, f + N, -1);
	for (int i = 0; i < E; i++) {
		cin >> a >> b >> c;
		add_edge(i + 1, a, b); f[c] = i;
	}
	State ss = State(S, 0, 0);
	if (f[S] != -1) ss.bit |= (1 << f[S]);
	map<State, int> d; d[ss] = 1;
	queue<State> que; que.push(ss);
	while (!que.empty()) {
		State val = que.front(); que.pop();
		int v = val.pos, r = val.day, bit = val.bit;
		if (r < R) {
			for (int i = 0; i < E + 1; i++) {
				if (i && !(bit & (1 << (i - 1)))) continue;
				for (auto &e : G[i][v]) {
					State z(e, r + 1, bit);
					if (f[e] != -1) z.bit |= (1 << f[e]);
					if (!d[z]) {
						d[z] = d[val] + 1;
						que.push(z);
					}
				}
			}
		}
		State y(S, 0, bit);
		if (!d[y]) {
			d[y] = d[val] + 1;
			que.push(y);
		}
	}
	int ret = 999999999;
	for (int i = 0; i <= R; i++) {
		for (int j = 0; j < (1 << E); j++) {
			State z(T, i, j);
			if (d[z]) ret = min(ret, d[z] - 1);
		}
	}
	if (ret == 999999999) cout << -1 << endl;
	else cout << ret << endl;
	return 0;
}

Measured memory_bytes: 9564
#include<bits/stdc++.h>
#define title "title"
#define ll long long
#define ull unsigned ll
#define fix(x) fixed<<setprecision(x)
#define pii pair<ll,ll>
#define vint vector<ll>
#define pb push_back
using namespace std;
void Freopen(){
	freopen(title".in","r",stdin);
	freopen(title".out","w",stdout);
}
ll read(){
	ll g=0,f=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch&&ch<='9'){g=g*10+ch-'0';ch=getchar();}
	return g*f;
}
const ll N=2e5+5;
ll sa[N],sb[N],a[N],b[N],L,n,ans;
ll sua(ll l,ll r){return sa[r]-sa[l-1];}
ll sub(ll l,ll r){return sb[r]-sb[l-1];}
void solve(){
	for(ll i=n;i>=1;i--){
		ll blen=(n-i)>>1,alen=n-i-blen;
		ans=max(ans,((n-i)&1?b[n-blen]:a[n-alen])+(sub(n-blen+1,n)+sua(i,i+alen-1))*2);
	}
}
signed main(){
	L=read(),n=read();
	for(ll i=1;i<=n;i++)a[i]=read();
	for(ll i=1;i<=n;i++){
		b[i]=L-a[i];
		sa[i]=sa[i-1]+a[i];
		sb[i]=sb[i-1]+b[i];
	}solve();
	for(ll i=1;i<=n;i++)a[i]=b[n-i+1];
	for(ll i=1;i<=n;i++){
		b[i]=L-a[i];
		sa[i]=sa[i-1]+a[i];
		sb[i]=sb[i-1]+b[i];
	}solve();
	return cout<<ans,signed();
}

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

int main(){

int n; cin >>n;
vector<int> f(n+10);

for(int i=1; i<=n; i++){
    //int cnt=0;
    for(int x=1; x*x<=i; x++){
        for(int y=x; y*y<=i; y++){
            for(int z=y; z*z<=i; z++){
                int l=x*x+y*y+z*z+x*y+y*z+z*x;
                if(l==i) {
                    if(x<y && y<z) f[i] += 6;
                    else if(x==y && y==z) f[i]++;
                    else f[i] += 3;
                }
            }
        }
    }
}
for(int i=1; i<=n; i++) cout << f[i] << endl;

}

Measured memory_bytes: 3508
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,m,k; cin >> n >> m >> k; ll ans = 0; vl asum(n+1);
  vl bsum(m+1);
  vl an(n); vl bm(m);
  
  rep(i,n){
    cin >> an[i];
    asum[i+1] = asum[i]+ an[i];
  }
  
  rep(i,m){
    cin >> bm[i];
    bsum[i+1] = bsum[i] + bm[i];
  }
  
  ll bnow = m; ll anow = 0;
  while(anow != n+1){
    if(bsum[bnow] + asum[anow] <= k){
      ans = max(bnow+anow,ans);
      anow++;
    }
    else{
      bnow--;
    }
    
    if(bnow == -1) break;
  }
  
  cout << ans << endl;
  
  
}

Measured memory_bytes: 9512
#include<stdio.h>

int main(){
	int n;
	int a,b,s,t;
	int i;
	while(scanf("%d",&n), n!=0){
		a=0;
		b=0;
		for(i=0;i<n;i++){
			scanf("%d %d",&s,&t);
			if(s>t){
				a += s+t;
			}else if(s<t){
				b += s+t;
			}else{
				a+= s;
				b+= t;
			}
		}
	printf("%d %d\n",a,b);
	}
	return 0;
}

Measured memory_bytes: 600
'use strict'

function main(s) {  
  
  const input = s.split('\n').map(x => Number(x));
  const N = input[0];
  const K = input[1];
  const X = input[2];
  const Y = input[3];
  let result = 0;

  if(N > K) {
    result = (K * X) + ((N - K) * Y);
  } else {
    result = (N * X);
  }
  
  console.log(result);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;

typedef long long li;
typedef pair<li, li> pii;

pii make_set(li x, li y) {
	if (x < y) {
		return make_pair(y, x);
	} else {
		return make_pair(x, y);
	}
}

pii max_of(pii x, pii y) {
	vector<li> vs = {x.first, x.second, y.first, y.second};
	sort(vs.begin(), vs.end());
	return make_set(vs[2], vs[3]);
}

int main() {
	li n;
	cin >> n;
	
	li m = 1 << n;
	
	vector<li> xs(m);
	for (int i = 0; i < m; ++i) {
		cin >> xs[i];
	}
	
	vector<vector<pair<li, li>>> dp(m, vector<pair<li, li>>(n + 1));
	
	for	(int mask = 0; mask < m; ++mask) {
		dp[mask][0] = make_pair(xs[mask], 0);
		for	(int p = 0; p < n; ++p) {
			dp[mask][p + 1] = dp[mask][p];
			if (mask & (1 << p)) {
				dp[mask][p + 1] = max_of(dp[mask][p + 1], dp[mask ^ (1 << p)][p]);
			}
		}
	}
	
	li ans = 0;
	for (int i = 1; i < m; ++i) {
		ans = max(ans, dp[i][n].first + dp[i][n].second);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 93184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n)  for (int i = 0; i <  (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
const int MOD = 1000000007;

int main() {
  double Ans = 0;  // 回答：

  int R; cin >> R;  // 半径
  Ans = 2 * R * 3.141592;

  cout << Ans << endl;
}


Measured memory_bytes: 3764
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <fstream>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = (1 << 30);
const ll inf = (1LL << 60LL);
const int  maxn = 1e5 + 5;
int n, m;
int mat[24][24] = {-1};
int rows, cols;
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    cin >> rows >> cols;
    memset(mat, -1, sizeof mat);
    for(int i  =0; i < rows; i ++){
        for(int j =0; j < m; j ++){
            mat[i][j] = 0;
        }
    }
    for(int i  = 0; i < n; i ++){
        for(int j = 0; j < cols; j ++){
            mat[i][j] = 0;
        }
    }
    int ret =0 ;
    for(int i =0 ; i < n; i ++){
        for(int j = 0; j < m; j ++){
            if(mat[i][j] == -1){
                ret ++;
            }
        }
    }
    printf("%d\n", ret);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n,q;
	cin>>n>>k>>q;

	ll ar[n+1]={0};
	for(i=1;i<=q;i++){
		cin>>l;
		ar[l]+=1;
	}
	for(i=1;i<=n;i++){
		ar[i]+=k-q;
	}

	for(i=1;i<=n;i++){
		if(ar[i]<=0) cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
	return 0;
}

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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

ll max(ll a, ll b)
{
	return (a>b)? a: b;
}

int main()
{
	ll n, w;
	cin >> n >> w;
	ll wt[n], v[n];
	for(int i=0;i<n;i++)
		cin >> wt[i] >> v[i];
	ll ans[n+1][w+1];
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=w;j++)
		{
			if(!i || !j)
				ans[i][j] = 0;
			else if(j - wt[i-1] >= 0)
			{
				ans[i][j] = max(ans[i-1][j], ans[i-1][j-wt[i-1]] + v[i-1]);
			}
			else
				ans[i][j] = ans[i-1][j];
		}
	}
	cout << ans[n][w] <<"\n";

	return 0;
}

Measured memory_bytes: 79104
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
using namespace std;

int main() {
  map<string, int> mp;
  int N;
  cin >> N;
  int mm = 0;
  for (int i = 0; i < N; ++i) {
    string s;
    cin >> s;
    mp[s]++;
    mm = max(mm, mp[s]);
  }

  vector<string> vec;
  for (multimap<string, int>::iterator i = mp.begin(); i != mp.end(); ++i) {
    if (i->second == mm) {
      vec.push_back(i->first);
    }
  }
  sort (vec.begin(), vec.end());
  for (int i = 0; i < vec.size(); ++i) {
    cout << vec[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 26868