akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(int i=(a);i<(b);++i)


#define huge 1000000007
typedef long long ll;

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll K = 0;
	ll Y = 0;
	ll X = 0;
	ll m[100000] = {};
	ll p[100] = {};
	ll x[100] = {};
	//ll *x, *c, *d;
	string S,T;
	ll count = 0;
	ll sum = 0;
	ll min = 1;
	ll i = 0;
	//char p;
	cin >> S;



	rep(i, 0, S.length()) {
		sum = (int)S[i];
		sum -= 97;

		if(x[sum] == 0)
		x[sum]++;
		else {
			count++;
			break;
		}

	}
	
	if(count == 0)
		cout << "yes" << endl;
	else
		cout << "no" << endl;


	return 0;

}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
    
  int a,b,c,x,y,z;
    
  scanf("%d%d%d",&a,&b,&c);
    
  if(a > b){ 
    x = a;
    a = b;
    b = x;
  }
    
  if(b > c){
    y = b;
    b = c;
    c = y;
  }
    
  if(a > b){
    z = a;
    a = b;
    b = z;
  }
    
  printf("%d %d %d\n",a,b,c);
    
  return 0;
}

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

int dfs(int v, vector<bool> &used, vector<string> &adj){
	if(used[v]) return 0;
	used[v] = true;
	int ret = 1;
	int n = adj.size();
	for(int i=0; i<n; i++){
		if(adj[v][i] == 'Y') ret += dfs(i, used, adj);
	}
	return ret;
}

//先手必勝の手かどうか
//[偶数サイズの連結成分][奇数サイズの連結成分][余っているフリーの辺の偶奇]
bool dp[1001][1001][2];
bool used[1001][1001][2] = {};
bool win(int even, int odd, int rem){
	bool &ret = dp[even][odd][rem];
	if(used[even][odd][rem]) return ret;
	used[even][odd][rem] = true;
	if(even+odd == 2){
		ret = rem==1;
		return ret;
	}
	ret = false;
	//even--even
	if(even>=2 && !win(even-1, odd, 1-rem)) ret = true;
	//even--odd
	if(even>=1 && odd>=1 && !win(even-1, odd, 1-rem)) ret = true;
	//odd--odd
	if(odd>=2 && !win(even+1, odd-2, rem)) ret = true;
	//pass
	if(rem==1 && !win(even, odd, 0)) ret = true;
	return ret;
}

int main(){
	int n;
	cin >> n;
	vector<string> adj(n);
	for(int i=0; i<n; i++){
		cin >> adj[i];
	}
	vector<bool> used(n, false);
	int odd=0, even=0;
	int rem=0;
	for(int i=0; i<n; i++){
		if(used[i]) continue;
		int size = dfs(i, used, adj);
		rem += size*(size-1)/2;
		if(size%2 == 0) even++;
		else odd++;
	}
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			if(adj[i][j] == 'Y') rem--;
		}
	}
	if(win(even, odd, rem%2)){
		cout << "Taro" << endl;
	}else{
		cout << "Hanako" << endl;
	}
	return 0;
}


Measured memory_bytes: 5924
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#include <time.h>
typedef std::pair<int,int> pii;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;
using namespace std;
using ll = long long;
#define PI 3.14159265358979323846264338327950L
const int mod = 1000000007;




void solve(){
    int n;
    cin >> n;
    vector<int> c(n);
    rep(i,n) cin >> c[i];
    
    map<int,ll> memo;
    vector<ll> dp(n,0);
    dp[0] = 1;
    memo[c[0]] = 1;
    for(int i = 1; i < n; i++){
        if (c[i] == c[i-1]) dp[i] = dp[i-1];
        else{
            dp[i] = dp[i-1];
            dp[i] += memo[c[i]];
            memo[c[i]] += dp[i-1];
            memo[c[i]] %= mod;
            dp[i]%=mod;
        }
    }
    cout << dp.back();
    
}

int main(){
    int T;
    T = 1;
    while(T--){
        solve();
        cout << endl;
    }
}






Measured memory_bytes: 18052
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <deque>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)

#define rdi(i) ll i; scanf("%lld", &i)
#define rds(s) string s; cin >> s
#define rdc(c) char c; cin >> c

#define INF 10000000000
#define MOD 1000000007

ll gcd(ll a, ll b)
{
    if (a < b) {
        return gcd(b, a);
    }
    ll r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    rrepp(i, 1, n) {
        scanf("%lld", &a[i]);
    }

    if (n == 2) {
        cout << max(a[1], a[2]) << endl;
        return 0;
    }
    vector<ll> dp00(n + 1), dp01(n + 1), dp02(n + 1), dp10(n + 1), dp11(n + 1), dp12(n + 1);
    dp00[1] = 0;
    dp01[1] = 0;
    dp02[1] = 0;
    dp10[1] = 0;
    dp11[1] = 0;
    dp12[1] = 0;
    dp00[2] = a[1];
    dp01[2] = 0;
    dp02[2] = 0;
    dp10[2] = a[2];
    dp11[2] = 0;
    dp12[2] = 0;
    dp00[3] = 0;
    dp01[3] = max(a[1], a[2]);
    dp02[3] = 0;
    dp10[3] = a[1] + a[3];
    dp11[3] = a[3];
    dp12[3] = 0;
    rrepp(i, 4, n) {
        if (i % 2 == 0) {
            dp00[i] = dp10[i - 1];
            dp01[i] = max(dp01[i - 1], dp11[i - 1]);
            dp02[i] = max(dp02[i - 1], dp12[i - 1]);
            dp10[i] = dp01[i - 1] + a[i];
            dp11[i] = dp02[i - 1] + a[i];
            dp12[i] = 0;
        } else {
            dp00[i] = 0;
            dp01[i] = max(dp00[i - 1], dp10[i - 1]);
            dp02[i] = max(dp01[i - 1], dp11[i - 1]);
            dp10[i] = dp00[i - 1] + a[i];
            dp11[i] = dp01[i - 1] + a[i];
            dp12[i] = dp02[i - 1] + a[i];
        }
    }
    if (n % 2 == 0) {
        cout << max(dp00[n], dp10[n]) << endl;
    } else {
        cout << max(dp01[n], dp11[n]) << endl;
    }
    return 0;
}

Measured memory_bytes: 13700
N = int(input())
S = input()
R = 0
G = 0
B = 0
for i in S:
    if i == 'R':
        R += 1
    elif i == 'G':
        G += 1
    elif i == 'B':
        B += 1
#print(R,G,B)
RGBall = R*G*B
if N % 2 == 0:
    X = N // 2 - 1
else:
    X = N // 2
eql = 0
for i in range(1,X+1):
    for j in range(N):
        a = S[j]
        b = S[j+i]
        c = S[j+2*i]
        #print(a,b,c)
        if a != b and b != c and c != a:
            eql += 1
        if j + 2*i == N-1:
            break
#print(RGBall,eql)
ans = RGBall - eql
print(ans)

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

template<class Abel> struct UnionFind {
  vector<int> par;
  vector<int> rank;
  vector<Abel> diff_weight;

  UnionFind(int n=1,Abel SUM_UNITY=0) {
    init(n, SUM_UNITY);
  }

  void init(int n=1,Abel SUM_UNITY=0) {
    par.resize(n); rank.resize(n); diff_weight.resize(n);
    for (int i=0;i<n;++i){
      par[i]=i;
      rank[i]=0;
      diff_weight[i]=SUM_UNITY;
    }
  }

  int root(int x) {
    if (par[x] == x) {
        return x;
    }
    else {
      int rx = root(par[x]);
      diff_weight[x] += diff_weight[par[x]];
      return par[x] = rx;
    }
  }

  Abel weight(int x) {
    root(x);
    return diff_weight[x];
  }

  bool same(int x,int y) {
    return root(x) == root(y);
  }

  bool unite(int x,int y,Abel w) {
    w+=weight(x);w-=weight(y);
    x=root(x);
    y=root(y);
    if (x == y){
      return false;
    }
    if (rank[x]<rank[y]){
      swap(x, y);
      w=-w;
    }
    if (rank[x] == rank[y]){
      ++rank[x];
    }
    par[y]=x;
    diff_weight[y]=w;
    return true;
  }

  Abel diff(int x, int y) {
    return weight(y)-weight(x);
  }
};

int main(){
  int N,M;
  cin >> N >> M;
  UnionFind<int> tree(N);
  bool ans=true;
  for (int i=0;i<M;i++){
    int L,R,D;
    cin >> L >> R >> D;
    if (!tree.same(L,R)){
      tree.unite(L,R,D);
    }
    else {
      if (tree.diff(L,R)!=D){
        ans=false;
        break;
      }
    }
  }
  if (ans){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int sum=0;
	vector<int> a;
	for(int i=0;i<n;i++) 
	{
		int x;
		cin>>x;
		if(x%10) a.push_back(x);
		sum+=x;
	}
	if(sum%10)
	{
		cout<<sum;
		return 0;
	}
	if(a.size()==0)
	{
		cout<<0;
		return 0;
	}
	sort(a.begin(),a.end());
	cout<<sum-a[0];
	return 0;
}


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

int main(void) 
{
	int n;
	int on_base[4];
	int score, out;
	int i, j, k;
	char event[8];

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		score = 0;
		out   = 0;

		for (j = 0; j < 4; j++) 
			on_base[j] = 0;

		while (out < 3) {
			scanf("%s", event);

			if (strcmp(event, "OUT") == 0) 
				out++;
			else if (strcmp(event, "HIT") == 0) {
				on_base[3] = on_base[2];
				on_base[2] = on_base[1];
				on_base[1] = on_base[0];
				on_base[0] = 1;

				if (on_base[3]) {
					score++;
					on_base[3] = 0;
				}
			} else if (strcmp(event, "HOMERUN") == 0) {
				for (k = 0; k < 3; k++) {
					if (on_base[k] == 1) {
						score++;
						on_base[k] = 0;
					}
				}
				score++;
			}
		}
		printf("%d\n", score);
	}

	return 0;
}

Measured memory_bytes: 596
//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e18) + 1;
const int mod = 479001599;
const int maxn = 1e5 + 111;
        
using namespace std;          

string s;

void solve(){
	cin >> s;

    if (s == "ARC")
    	cout << "ABC";
  	else
  		cout << "ARC";                                                        
}   
      
main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

    boost;
    
    int q = 1;

    //cin >> q;

    while (q--){
        solve();
    }
}

Measured memory_bytes: 3600
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    i = 1
    ans = 0
    while i*i < n:
        if n%i == 0:
            tmp = n//i -1
            if i < tmp:
                ans += n//i - 1
        i+= 1
    print(ans)




    
if __name__ == '__main__':
    main()

Measured memory_bytes: 9188
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_H = 20;

const int dxs[] = { 1, 0, -1, 0 };
const int dys[] = { 0, -1, 0, 1 };
const char car[] = { '>', '^', '<', 'v' };

/* typedef */

/* global variables */

string flds[MAX_H];

/* subroutines */

/* main */

int main() {
  int tn;
  cin >> tn;

  for (bool first = true; tn--; first = false) {
    int h, w;
    cin >> h >> w;

    int sx, sy, sd;
    
    for (int y = 0; y < h; y++) {
      cin >> flds[y];
      for (int x = 0; x < w; x++)
	switch (flds[y][x]) {
	case '>': sx = x, sy = y, sd = 0; flds[y][x] = '.'; break;
	case '^': sx = x, sy = y, sd = 1; flds[y][x] = '.'; break;
	case '<': sx = x, sy = y, sd = 2; flds[y][x] = '.'; break;
	case 'v': sx = x, sy = y, sd = 3; flds[y][x] = '.'; break;
	}
    }

    int on;
    cin >> on;

    string ops;
    cin >> ops;

    for (int oi = 0; oi < on; oi++) {
      int op;
      switch (ops[oi]) {
      case 'R': op = 0; sd = 0; break;
      case 'U': op = 0; sd = 1; break;
      case 'L': op = 0; sd = 2; break;
      case 'D': op = 0; sd = 3; break;
      case 'S': op = 1; break;
      }

      if (op == 0) {
	int x0 = sx + dxs[sd], y0 = sy + dys[sd];
	if (x0 >= 0 && x0 < w && y0 >= 0 && y0 < h && flds[y0][x0] == '.')
	  sx = x0, sy = y0;
      }
      else {
	int dx = dxs[sd], dy = dys[sd], x = sx + dx, y = sy + dy;
	while (x >= 0 && x < w && y >= 0 && y < h) {
	  if (flds[y][x] == '*') {
	    flds[y][x] = '.';
	    break;
	  }
	  else if (flds[y][x] == '#')
	    break;

	  x += dx, y += dy;
	}
      }
    }

    flds[sy][sx] = car[sd];
    
    if (! first) cout << endl;

    for (int y = 0; y < h; y++)
      cout << flds[y] << endl;
  }

  return 0;
}

Measured memory_bytes: 1204
import java.io.BufferedReader
import java.io.InputStreamReader
import kotlin.math.max

const val MOD = 998244353L

fun main() {
    val jin = BufferedReader(InputStreamReader(System.`in`))
    val (n, k) = jin.readLine().split(" ").map { it.toInt() }
    val p = listOf(0) + jin.readLine().split(" ").map { it.toInt() }
    val pow = LongArray(200001)
    val powInv = LongArray(200001)
    pow[0] = 1L
    pow[1] = ((k - 1).toLong() * (k.toLong() pow -1)) % MOD
    powInv[0] = 1L
    powInv[1] = pow[1] pow -1
    for (j in 2..200000) {
        pow[j] = (pow[1] * pow[j - 1]) % MOD
        powInv[j] = (powInv[1] * powInv[j - 1]) % MOD
    }
    val bitSum = BinaryIndexTree(1, n)
    val bitAMT = BinaryIndexTree(1, n)
    var answer = 0L
    for (j in 1..n) {
        val ix = max(k, j)
        answer += pow[ix] * bitSum[1, p[j] - 1]
        answer += bitAMT[p[j] + 1, n]
        answer -= pow[ix] * bitSum[p[j] + 1, n]
        answer %= MOD
        bitSum.update(p[j], powInv[ix])
        bitAMT.update(p[j], 2L)
    }
    answer *= 2L pow -1
    answer %= MOD
    answer += MOD
    answer %= MOD
    println(answer)
}

class BinaryIndexTree(val treeFrom: Int, treeTo: Int) {
    val value = LongArray(treeTo - treeFrom + 2)

    fun update(index: Int, delta: Long) {
        var i = index + 1 - treeFrom
        while (i < value.size) {
            value[i] += delta
            value[i] %= MOD
            i += i and -i
        }
    }

    fun query(to: Int): Long {
        var res = 0L
        var i = to + 1 - treeFrom
        while (i > 0) {
            res += value[i]
            res %= MOD
            i -= i and -i
        }
        return res
    }

    operator fun get(from: Int, to: Int) = if (to < from) 0L else query(to) - query(from - 1)
}

const val MOD_TOTIENT = MOD.toInt() - 1

infix fun Long.pow(power: Int): Long {
    var e = power
    e %= MOD_TOTIENT
    if (e < 0) {
        e += MOD_TOTIENT
    }
    if (e == 0 && this == 0L) {
        return this
    }
    var b = this % MOD
    var res = 1L
    while (e > 0) {
        if (e and 1 != 0) {
            res *= b
            res %= MOD
        }
        b *= b
        b %= MOD
        e = e shr 1
    }
    return res
}

Measured memory_bytes: 73136
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n;
	cin >> n;
	int a[n];
	map<int, int>mt;
	zip(i, 0, n)
	{
		cin >> a[i];
		mt[a[i]]++;
	}
	int ans = 0;
	for (auto itr = mt.begin(); itr != mt.end(); itr++)
	{
		int x = itr->ff;
		int y = itr->ss;
		if (y < x)
		{
			ans += y;
		}
		else
		{
			ans += y - x;
		}
	}
	cout << ans << en;


	return 0;
}



Measured memory_bytes: 7040
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
//static const long double pi = 3.1415926535897932;

using namespace std;
using ll = long long int;
using ull = unsigned long long;

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ll combination(ll n, ll r) {
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

vector<string> split(const string& src, const char* delim = ",") {
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

struct root {
	int i;
	int value;
};

int main() {
	long double a, b, h, m;
	cin >> a >> b >> h >> m;
	long double o = fabs(((30 * h) + ((m/60) * 30)) - (6 * m));
	long double t = o * (M_PI / 180);
	long double colc = (a * a) + (b * b) - 2 * a * b * cos(t);
	cout << fixed << setprecision(20) << sqrtl(colc) << endl; 
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> s(n);
    rep(i, n) cin >> s[i];

    ll ans = 0;
    for (int c = 1; c <= n - 1; ++c) {
        ll score = 0;
        vector<bool> used(n, false);
        for (int i = 0; i < n - 1; i += c) {
            if (n - 1 - i - c <= 0) break;
            if (used[i] || used[n - 1 - i] || i == n - 1 - i) break;
            score += ll(s[i]) + s[n - 1 - i];
            used[i] = used[n - 1 - i] = true;
            ans = max(ans, score);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
ans = 0
for i in range(1,n):
    if i**2>n:
        break
    if (n-i)%i==0 and (n-i)//i > i:
        ans += (n-i)//i
print(ans)

Measured memory_bytes: 64204
n = gets.to_i
s = Array.new(n)
for i in 0..(n-1)
  s[i] = gets.chomp
end

hs = Hash.new(0)
s.each{|st| hs[st] += 1}

max = 0
hs.each{|k,v| max = [max,v].max}

str = Array.new(0)
hs.each do |k,v|
  str.push(k) if v == max
end

str.sort!
str.each{|strs| puts strs}

Measured memory_bytes: 47976
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int x, y;
    cin >> x >> y;

    ll ans = 0;
    if (x == 1 && y == 1) {
        ans += 400000;
    }
    if (x == 1) ans += 300000;
    if (x == 2) ans += 200000;
    if (x == 3) ans += 100000;
    if (y == 1) ans += 300000;
    if (y == 2) ans += 200000;
    if (y == 3) ans += 100000;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 764
N = input().strip()
#print(N)
length = len(N)
#print(length)
totalZeros = 0
totalOnes = 0
for i in N:
    if i == '0':
        totalZeros += 1
    else:
        totalOnes += 1
if totalOnes < totalZeros:
    answer = totalOnes * 2
else:
    answer = totalZeros * 2

print(answer)

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

#define mp          make_pair
#define pb          push_back
#define ff          first
#define ss          second
#define ii          pair<int,int>
#define mod         int(1e9+7)
#define inf         1e18

typedef long long int lli;
typedef long double ld;

#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

char A[1005][1005];

lli dp[1005][1005];

int func(int r,int c)
{
    int ans=0;
    int i=1,j=1;
    dp[1][1]=1;
    for(int i=1;i<=r;i++)
    {
        for(int j=1;j<=c;j++)
        {
            if(A[i][j]=='#')
                continue;
            if(i==1 and j==1)
                continue;
            if(i==1)
                dp[i][j]=dp[i][j-1];
            else if(j==1)
                dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=(dp[i-1][j]%mod + dp[i][j-1]%mod)%mod;
        }
    }
    return dp[r][c];
}

void solve()
{
    int r,c;
    cin>>r>>c;

    for(int i=1;i<=r;i++)
        for(int j=1;j<=c;j++)
            cin>>A[i][j];

    cout<<func(r,c)<<endl;
    // for(int i=1;i<=r;i++)
    // {
    //     for(int j=1;j<=c;j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
}

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

Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  while(cin>>n&&n) {
    int a[n],ans=1;
    for(int i=0; i<n; i++)cin>>a[i];
    for(int k=1; k<=500; k++) {
      vector<int> v;
      bool f=1;
      for(int i=0; i<n; i++) {
        if(a[i]%k==0) {
          for(int j=0; j<10; j++) {
            if(a[i]/k==(1<<j)) {
              v.push_back(1<<j);
              if(!j) f=0;
              break;
            }
          }
        }
      }
      if(f) continue;
      int s=0;
      for(int i=0; i<v.size(); i++) s+=v[i];
      int dp[s+1];
      fill(dp,dp+s+1,-(1<<29));
      dp[0]=0;
      for(int i=0; i<v.size(); i++)for(int j=s/v[i]*v[i]; j-v[i]>=0; j-=v[i]) dp[j]=max(dp[j],dp[j-v[i]]+1);
      for(int i=0; (1<<i)<=s; i++) ans=max(ans,dp[1<<i]);
    }
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 3528
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
const int N = 105;
char s[N];
int f[N][30],inf = 0x3fffffff;
bool check(int n){
	for (int i = 2;i <= n;i++){
		if (s[i] != s[i-1])	return 0;
	}
	return 1;
}
int main(){
	int n;
	scanf("%s",s+1);
	n = strlen(s+1);
	if (check(n)){
		cout << 0 << endl;
		return 0;
	}
	for (int i = 1;i <= n;i++){
		for (int j = 1;j <= 26;j++){
			f[i][j] = inf;
		}
	}
	for (int i = 1;i <= 26;i++){
		int now = inf;
		for (int j = n;j >= 1;j--){
			if (s[j]-'a'+1 == i){
				now = j;
			}
			f[j][i] = now-j;
		}
	}
	int res = inf;
	for (int k = n;k >= 1;k--){
		int ti = n-k+1;
		for (int i = 1;i <= 26;i++){
			int res = 0;
			for (int j = 1;j <= k-1;j++){
				res = max(res,f[j][i]);
			}
			if (res <= ti){
				cout << n-k+1 << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
import math
def primes(N):
    P = []
    for i in range(2,N):
        sieve = 1
        for p in P:
            if p*p > i:
                break
            elif i % p == 0:
                sieve = 0
                break
        if sieve == 0:
            continue
        else:
            P.append(i)
    return P
def factorize(n, P=None):
    if P is None:
        P = primes(int(math.sqrt(n))+1)
    factor = []
    power = []
    for p in P:
        if p * p > n:
            break
        elif n % p == 0:
            k = 0
            while n % p == 0:
                n //= p
                k += 1
            factor.append(p)
            power.append(k)
    if n > 1:
        factor.append(n)
        power.append(1)
    return factor, power

N = int(input())
factor, power = factorize(N)
ans = sum(int((math.sqrt(1+8*x)-1)/2) for x in power)
print(ans)


Measured memory_bytes: 70808
#include <bits/stdc++.h>
#define N 100010
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define READ(f) freopen (f, "r", stdin)
#define WRITE(f) freopen (f, "w", stdout)
#define pp pop_back
#define mapiter map<int, int>::iterator
#define pii pair<int, int>
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, x, n) for(int i = x; i <= n; ++i)
#define r0 return 0
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lld long double
 
const int inf = 1e9 + 1;
const ll modw = 1e9 + 7;
 
using namespace std;

int a[N];
int dp[N];

int main()
{
	barnarnar
	int n;
	cin >> n;
	forn(i, n)  cin >> a[i];
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);
	forr(i, 2, n)
	{
	    dp[i] = min(abs(a[i] - a[i - 1]) + dp[i - 1], abs(a[i] - a[i - 2]) + dp[i - 2]);
	}
	cout << dp[n - 1];
    return 0;
}









Measured memory_bytes: 1024
#define _USE_MATH_DEFINES

typedef long long ll;
const ll MD = 1000000007;

#include <iostream>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;


/* sample input

*/

//ll conv(int n, int r) {
//	ll ret=1;
//
//	if (r == 0) {
//		return 1;
//	}
//
//
//	if (r > 0) {
//		ret = conv(n, r - 1)*(n - r + 1) / r;
//	}
//	return ret;
//
//	//for (int i = 1; i <=r; i++) {
//	//	ret = ret*(n - i + 1);
//	//}
//	//for (int i = 1; i <= r; i++) {
//	//	ret = ret/i;
//	//}
//	//return ret;
//}

ll conv(int n, int r)
{
	if (n == r || r == 0)
		return 1;
	else
		return conv(n, r - 1) * (n - r + 1) / r;
}

int main()
{
	int n, p;
	int a[100];

	cin >> n >> p;
	int countodd = 0;
	int counteven = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] % 2) {
			countodd++;
		}
	}
	counteven = n - countodd;


	ll oddnum=0, evenum=0;
	ll answer = 0;

	if (p % 2) {
		for (int i = 1; i <= countodd; i += 2) {
			oddnum += conv(countodd, i);
		}
	}
	else {
		for (int i = 0; i <= countodd; i += 2) {
			oddnum += conv(countodd, i);
		}
	}
	for (int i = 0; i <= counteven; i++) {
		evenum += conv(counteven, i);
	}

	answer = oddnum*evenum;

	cout << answer;


	return 0;
}

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

using namespace std;
int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	int p[n];
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}
	
	int count = 0;
	for (int i = 0; i < n; i++) {
		int index = i;
		for (int j = i + 1; j < n; j++) {
			if (p[i] > p[j]) {
				index = j;
			}
		}
		if (index != i) {
			int tmp = p[i];
			p[i] = p[index];
			p[index] = tmp;
			count++;
		}
	}
	
	if (count >= 2) {
		cout << "NO" << endl;
	} else {
		cout << "YES" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>

using namespace std;
 
vector<int> dijkstra(int s, vector<vector<pair<int, int> > >& G) {
	const int INF = 1e9;
	const int N = G.size();
	vector<int> cost(N, INF);
	priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > pq;
	cost[s] = 0;
	pq.push(make_pair(0, s));
	while (!pq.empty()) {
		pair<int, int> p = pq.top(); pq.pop();
		int now = p.second;
		if (cost[now] < p.first) continue;
		for (auto next : G[now]) {
			int nv = next.first, nw = next.second;
			if (cost[nv] > cost[now] + nw) {
				cost[nv] = cost[now] + nw;
				pq.push(make_pair(cost[nv], nv));
			}
		}
	}
	return cost;
}

int main() {
	int n; cin >> n;
	vector<vector<pair<int, int> > > G(n);
	for (int i = 0; i < n; ++i) {
		int u, k; cin >> u >> k;
		while (k--) {
			int v, c; cin >> v >> c;
			G[u].push_back(make_pair(v, c));
		}
	}
	vector<int> ans(dijkstra(0, G));
	for (int i = 0; i < n; ++i)
		cout << i << " " << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 7852
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const int N = 2e5;
ll bit[N+1];

void upd(int k, ll val) {
    for (; k <= N; k += k&-k) bit[k] = max(bit[k], val);
}

ll rmq(int k) {
    ll mx = 0;
    for (; k >= 1; k -= k&-k) mx = max(mx, bit[k]);
    return mx;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    int n;
    cin >> n;
    
    int h[n], w[n];
    forn(i, 0, n) cin >> h[i];
    forn(i, 0, n) cin >> w[i];
    
    ll ans = 0;
    forn(i, 0, n) {
        ll mx = rmq(h[i]-1);
        ll dpi = mx + w[i];
        upd(h[i], dpi);
        
        ans = max(ans, dpi);
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 6752
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
*/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);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
static class TaskC   {
int N;

public void solve(int testNumber, Scanner in, PrintWriter out) {
        N = in.nextInt();
        out.println(dfs(0,0,false,false,false));
    }

int dfs(int n, int keta, boolean o3, boolean o5, boolean o7) {
        int temp = 0;
        int ret = 0;
        if(keta == 9){
            if(o3 && o5 && o7 && n<=N && n!=0){
                return 1;
            }
            return 0;
        }
        if(n == 0){
            ret += dfs(n, keta+1, o3, o5, o7);
        }
        ret += dfs(n*10 + 3, keta+1, true, o5, o7);
        ret += dfs(n*10 + 5, keta+1, o3, true, o7);
        ret += dfs(n*10 + 7, keta+1, o3, o5, true);
        return ret;
    }

}
}



Measured memory_bytes: 22868
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define cst first
#define dur second
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e5 + 5, M = 2 * N + 5;


int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    int ans = 0;
    while(n--){
        int x;
        scanf("%d", &x);
        ans += (x >= m);
    }
    printf("%d\n", ans);
}

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

vector<ll> ans;

int f(int d,ll a,int s){
    if(d==0)ans.push_back(a);
    else{
        for(int i=max(0,s-1);i<min(s+2,10);i++){
            f(d-1,a*10+i,i);
        }
    }
}

int main(){
    int K;cin>>K;
    int d=0;
    while(1){
        for(int i=1;i<10;i++){
            f(d,i,i);
        }
        if(ans.size()>=K)break;
        d++;
    }
    //sort(All(ans));
    //REP(i,K)cout<<ans[i]<<endl;
    cout<<ans[K-1]<<endl;
}


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

using namespace std;

long long mp[300005]={0};

signed main()
{

	long long n;
	cin>>n;

	long long a[n+5];

	set<long long> st;

	for (long long i = 0; i < n; ++i)
	{
		/* code */
		cin>>a[i];
		st.insert(a[i]);
		mp[a[i]]++;
	}

	long long sum = 0;

	for(long long ele: st)
	{	
		long long temp = (mp[ele]*(mp[ele]-1))/2;
		long long zero = 0;
		sum+=(max(zero,temp));
	}

	for(long long i=0;i<n;i++)
	{
		cout<<sum-(mp[a[i]]-1)<<'\n';
	}

	return 0;
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fip ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define reptUsual(b) for(i=0; i<b; ++i)
#define rept(i,a,b) for(i=a; i<b; ++i)
#define pb(a) push_back(a)
#define newln cout<<"\n"
#define bigPrime 1000000007
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef pair<ll , ll> pll;
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>  new_data_set;
// continue // break // greater // string // length // while //iterator //first //second //size //begin //end
 
/*
void funct(int *dp,int *ar, int n){
    if( dp[n]!=0) return;
    else{
        int res=1;
        for(int i=n-1;i>=0;i--){
            
            if(ar[n]>ar[i]){
                funct(dp,ar,i);
                res=max(res, dp[i]+1);
            }
 
        }
        dp[n]=res;
    }
}

bool cmp(pair<int, int>& a, 
         pair<int, int>& b) 
{ 
    return a.second > b.second; 
}
*/

void dfs2(vector <vi> &v, vector<vi> &vis, vi &ancestors, int a,int b){

    
}


int dfs(vector <vi> &v, int n, vector<vi> &vis, vi &ancestors){
    int i,cnt=0;
    ancestors.pb(n);
    reptUsual(v[n].size()){
        if(vis[n][v[n][i]]==0)  {
            for(int j=0;j<ancestors.size();j++) if(ancestors[j]==v[n][i]){ dfs2(v,vis,ancestors,n,v[n][i]);}
            for(int j=0;j<ancestors.size();j++) vis[ancestors[j]][v[n][i]]=1;
            cnt+=dfs(v,v[n][i],vis,ancestors)+1;            
            
            }
    }
    return cnt;

}


int main()
{
    fip;
    int t;
    cin>>t;
    if(t>=30) cout<<"Yes";
    else cout<<"No";

    return 0;
}

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

#include <math.h>
#include <stdlib.h>


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

template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true; } return false; }

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string s; cin >> s;
    int n = s.length();
    for(int i = 1; i < n; i++){
        if((n-i)%2 == 1) continue;
        bool check = true;
        for(int j = 0; j < (n-i)/2; j++){
            if(s[j] != s[(n-i)/2+j]) check = false;
        }
        if(check){
            cout << n-i << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);    
        int N = sc.nextInt();
        int K = sc.nextInt();
        int X = sc.nextInt();
        int Y = sc.nextInt();
        int ans = 0;
        ans += X*Math.min(N,K);
        ans += Math.max(0,(N-K)*Y);
        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    ll N;cin>>N;
    ll A,B,C,D,E;cin>>A>>B>>C>>D>>E;
    ll ans = min({A,B,C,D,E});
    if(N%ans == 0)cout << N/ans+4 << endl;
    else    cout << N/ans+5 << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace _0059
{
	class Program
	{
		static void Main()
		{
			string s;
			while (!string.IsNullOrEmpty(s = Console.ReadLine()))
			{
				double[] x = s.Trim().Split(' ').Select(double.Parse).ToArray();
				bool ret = x[0] <= x[6] && x[1] <= x[7] && x[4] <= x[2] && x[5] <= x[3];
				Console.WriteLine(ret ? "YES" : "NO");
			}
		}
	}
}


Measured memory_bytes: 8080
import math

A, B = map(int, input().split())
value = 0
for i in range(1, 1001):
    if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
        value = i
        break
if value == 0:
    print(-1)
else:
    print(value)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>

using namespace std;

int N;
int d[100];

void solve()
{
	sort(d, d + N);
	int res = 0;
	for(int i = 0, j = 0; i < N; i++) {
		if (j != d[i]) res++;
		j = d[i];
	}
	cout << res << endl;
}


int main()
{
	cin >> N;
	for (int i = 0; i < N; i++) cin >> d[i];
	solve();
	return 0;
}

Measured memory_bytes: 256
def width(_X, _Y, _n, _x):
    lb = float("inf")
    ub = -float("inf")

    for j in range(0, _n):
        x1 = _X[j]
        y1 = _Y[j]
        x2 = _X[(j + 1) % _n]
        y2 = _Y[(j + 1) % _n]

        if (x1 - _x) * (x2 - _x) <= 0 and x1 != x2:
            y = y1 + (y2 - y1) * (_x - x1) / (x2 - x1)
            lb = min(lb, y)
            ub = max(ub, y)

    return max(0, ub - lb)


if __name__ == '__main__':
    while True:
        M, N = list(map(int, input().split()))
        if M == 0 and N == 0:
            break

        X1 = []
        Y1 = []
        X2 = []
        Z2 = []
        for i in range(M):
            tmp_x1, tmp_y1 = list(map(int, input().split()))
            X1.append(tmp_x1)
            Y1.append(tmp_y1)

        for i in range(N):
            tmp_x2, tmp_z2 = list(map(int, input().split()))
            X2.append(tmp_x2)
            Z2.append(tmp_z2)

        min1 = min(X1)
        max1 = max(X1)
        min2 = min(X2)
        max2 = max(X2)

        xs = X1 + X2
        xs = sorted(xs)
        res = 0
        for i in range(0, len(xs) - 1):
            a = xs[i]
            b = xs[i + 1]
            c = (a + b) / 2
            # print("a" + str(a) + "b" + str(b) + "c" + str(c))
            if min1 <= c <= max1 and min2 <= c <= max2:
                fa = width(X1, Y1, M, a) * width(X2, Z2, N, a)
                fb = width(X1, Y1, M, b) * width(X2, Z2, N, b)
                fc = width(X1, Y1, M, c) * width(X2, Z2, N, c)
                res += ((b - a) / 6) * (fa + 4 * fc + fb)
                # print(res)

        print(res)

Measured memory_bytes: 7796
import sys
input = sys.stdin.readline

def main():
    MOD = 10**9+7
    L = input()
    K = len(L)-1
    
    dp1 = [0] * K
    dp1[0] = 1
    
    dp2 = [0] * K
    dp2[0] = 2
    
    for i in range(1, K):
        if L[i] == '0':
            dp1[i] = dp1[i-1] * 3
            dp2[i] = dp2[i-1]
        
        else:
            dp1[i] = dp1[i-1] * 3
            dp2[i] = dp2[i-1] * 2
            dp1[i] += dp2[i-1]
            
        dp1[i] %= MOD
        dp2[i] %= MOD

    print((dp1[-1]+dp2[-1])%MOD)

if __name__ == '__main__':
    main()
   

Measured memory_bytes: 11028
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

/**
 * @author: pashka
 */

private fun solve() {
    val s = next()
    val t = next()
    out.println(t + s)
}

fun main(args: Array<String>) {
    solve()
    out.close()
}

private var br = BufferedReader(InputStreamReader(System.`in`))
private var st: StringTokenizer? = null
private var out = PrintWriter(System.out)

@Throws(IOException::class)
private fun next(): String {
    while (st == null || !st!!.hasMoreTokens()) {
        st = StringTokenizer(br.readLine())
    }
    return st!!.nextToken()
}

@Throws(IOException::class)
private fun nextInt(): Int {
    return Integer.parseInt(next())
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  long double l;
  cin >> l;
  cout << setprecision(18) << l / 3.0 * l / 3.0 * l / 3.0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

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

    ll ans = 0;
    vector<ll> a;

    for(ll i = 1; i * i <= n; i++){
        if(n % i == 0){
            ll k = n / i;
            a.push_back(i);
            a.push_back(k);
        }
    }

    for(int i = 0; i < a.size(); i++){
        if(a[i] != 1){
            if(n % (a[i] - 1) == n / (a[i] - 1)){
                ans += a[i] - 1;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int k;
    std::cin >> k;
    if (k == 1) {
        printf("1\n1\n");
        return 0;
    }
    int n = (k + 3) / 4;
    n *= 2;
    int a = 2 * n - k;
    printf("%d\n", n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            int k = (i + j) % n;
            printf("%d ", (i % 2 && k >= a) * (n - a) + k + 1);
        }
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define INF (ll)1e18+4
#define md (ll)1e9+7
#define mx 10000000
#define mk make_pair
#define __builtin_popcountll(x) one(x)
#define pi pair<int,int>
#define ss second
#define ff first
#define pb emplace_back 
#define all(s) s.begin(),s.end()
#define rall(x) (x).rbegin(), (x).rend()
#define trav(x, a) for (auto& x: a)
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define rf(i,a,b) for(int i=a;i>=b;i--)
#define sz(x) ((long long)x.size())
#define mez(s) memset(s,0,sizeof s)
#define mex(s) memset(s,-1,sizeof s)
#define metr(s) memset(s,true, sizeof s)
typedef vector<int> vi; 
typedef vector<ll>vl;
typedef map<int,int> mp;
typedef queue<int> que;
typedef vector<pi> vp;
const int mxn=100010;
int n,k=2;int a[mxn];
ll dp[mxn];
ll dfs(int r){
	if(r<=0){
		return 0;
	}
  if(dp[r]!=-1)return dp[r];
	ll ans=INF;
	fr(i,1,k){
		if(r-i>=0)
		ans=min(ans,abs(a[r]-a[r-i])+dfs(r-i));
	}
	return dp[r]=ans;
}
void solve(){
	cin>>n;mex(dp);
	rep(i,0,n){
		cin>>a[i];
	}
	ll ans=dfs(n-1);
	cout<<ans<<"\n";
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t=1;
  //cin>>t;
  while(t--){
  	solve();
  }
  return 0;
}

Measured memory_bytes: 12564
#include <iostream>
using namespace std;
 
int pref[102], a[102];
int main() {
  int n;
  cin>>n;
  int i;
  for(i=1;i<=n;i++) cin>>a[i], pref[i] = pref[i-1] + a[i];
  
  int mi = abs(pref[n] - 2*pref[i]);
  
  for(i=2; i<n; i++)
    mi = min(mi, abs(pref[n]-2*pref[i] ));
  cout<<mi;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fl(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
#define mx 200005
#define inf 2e9
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
ll dp[101][100005] ={0};
int main()
{
    fast;
    ll n,W;
    cin>>n>>W;
    vector<int >v,w;
    v.pb(0);
    w.pb(0);
    for(ll i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        w.pb(x);
        v.pb(y);
    }
    ll V=accumulate(v.begin(),v.end(),0);
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <=100005; j++){
            dp[i][j] = 2000000000;
        }
    }
    dp[0][0] = 0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=V;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
            else if(v[i]<=j)
            {
                dp[i][j]= min(dp[i-1][j],w[i]+dp[i-1][j-v[i]]);
            }
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    ll ans=0;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=V;j++)
        {
            if(dp[i][j]<=W)
                ans= max(ans,j);
        }
    }
    cout<<ans;
    /*ll max_val=dp[n][V];
    cout<<dp[n][V]<<endl;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=V;j++)
        {
            if(dp[i][j]==max_val)
            {
                cout<<j;
                return 0;
            }
        }
    }*/
}


Measured memory_bytes: 79232
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  ll res = 1;
  FOR(i, 1, n+1){
    res = res * i;
  }
  cout << res << endl;
	return 0;
}



Measured memory_bytes: 3040
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cmath>

// static const int N = 100100;

using namespace std;

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

    string s;
    // int n, q;
    // array<int, N> a, b;
    // vector<int> a, b;

    cin >> s;

    int max_flag = pow(2, s.size() - 1);

    long long max_val = 0;
    for (int i = 0; i < max_flag; i++)
    {
        long long now_val = s[0] - '0';
        long long sums = 0;
        for (int j = 1; j < s.size(); j++)
        {
            if(i & (1<<j-1))
            {
                sums += now_val;
                now_val = s[j] - '0';
            }
            else
            {
                now_val = now_val * 10 + s[j] - '0';
            }
        }
        sums += now_val;
        max_val +=sums;
    }

    cout << max_val <<endl;

    return 0;
}


Measured memory_bytes: 256