akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <list>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <math.h>
#include <unordered_map>
#include <string>

typedef long long ll;
typedef double db;
const ll mod=1000000007;

#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/* author : hey_it_works(kunal)
 It works, idk how exactly*/

using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int n;
  cin>>n;
  vector<int> freq(4);
  for(int i=0;i<n;i++)
  {
    string s;
    cin>>s;
    if(s=="AC")
    {
      freq[0]++;
    }
    else if(s=="WA")
    {
      freq[1]++;
    }
    else if(s=="TLE")
    {
      freq[2]++;
    }
    else
    {
      freq[3]++;
    }
  }
  cout<<"AC  x  "<<freq[0]<<endl;
  cout<<"WA  x  "<<freq[1]<<endl;
  cout<<"TLE  x  "<<freq[2]<<endl;
  cout<<"RE  x  "<<freq[3]<<endl;

}


Measured memory_bytes: 3668
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#include <sstream>
#include <iomanip>
#include <functional>
using namespace std;

const int maxn = 110;
const int INF = 0x3f3f3f3f;    //无限大
typedef long long ll;
typedef unsigned long long ull;
int main()
{
    char a[4];
    cin>>a;
    int sum=0;
    sum = strlen(a);
    if(sum==2) for(int i=0;i<=1;++i) cout<<a[i];
    else
    {
        for(int i=2;i>=0;--i) cout<<a[i];
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <random>
#include <functional>

using namespace std;

#define F first
#define S second
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define dbv(a) cerr << #a << ": "; for (auto& xxxx: a) cerr << xxxx << " "; cerr << endl;
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define pw(n) (1ll << (n))
#define equal equalll
#define less lesss

typedef double dbl;
typedef long long ll;
const int N = -1;
const int INF = 1.01e9;
typedef vector<int> vi;



int main() {
#ifdef HOME 
    assert(freopen("in", "r", stdin));
#endif
    int n;
    scanf("%d", &n);   
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    auto check = [&](ll k) {
        for (int i = 0; i < n; i++) {
            k -= k % a[i];
        }
        return k;
    };
    ll l = 0; 
    ll r = 1e18;
    while (r - l > 1) {
        if (check((l + r) / 2) > 2)  {
            r = (l + r) / 2;
        }
        else {
            l = (l + r) / 2;
        }
    }

    ll up = l;
    l = 0;
    r = 1e18;
    while (r - l > 1) {
        if (check((l + r) / 2) < 2) {
            l = (l + r) / 2;
        }
        else {
            r = (l + r) / 2;
        }
    }
    ll down = r;
    if (down <= up) {
        cout << down << " " << up << endl;
    }
    else {
        cout << -1 << endl;
    }



    
#ifdef HOME 
    epr("time = %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
#endif
    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, 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; }
template<class T>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	vs s = { "thu", "fri", "sat", "sun", "mon", "tue", "wed" };

	cout << s[x % 7] << endl;
}


Measured memory_bytes: 3236
N, A, B = map( int, input().split())
H = [0]*N
hmax = 0
for i in range(N):
    h = int( input())
    H[i] = h
    hmax = max( h, hmax)

L = 0
R = hmax//B + 1
add = A-B
while L != R:
    now = (L+R)//2
    need = 0
    for i in range(N):
        if H[i] > now*B:
            need += (H[i]-1-now*B)//add + 1
    if need <= now:
        R = now
    else:
        L = now+1
print(L)

Measured memory_bytes: 8948
import std.stdio;

const int a = 2;
char[110][110] ch;
int d, n, px, py;

void main(){
	bool f = true;
	readf("%d\n", &d);
	for (int i = 0; i < d; i++) {
		if (f) f = false;
		else writeln();

		readf("%d\n", &n);
		foreach (y; 0..110) ch[y][] = ' ';
		ch[a-2][a] = ch[a][n+1+a] = ch[n+1+a][n-1+a] = '#';

		px = 0;
		py = n;
		draw(0, -1);
		foreach (y; 0..n) {
			foreach (x; 0..n) {
				write(ch[y+a][x+a]);
			}
			writeln();
		}
	}
}

void draw(int dx, int dy){
	int x, y;
	bool f = false;
	while (1) {
		x = px + dx;
		y = py + dy;
		if (ch[y+dx+a][x-dy+a] == '#' || ch[y-dx+a][x+dy+a] == '#' || ch[y+dy+a][x+dx+a] == '#') break;
		px = x;
		py = y;
		ch[y+a][x+a] = '#';
		f = true;
	}
	if (f) draw(-dy, dx);
}

Measured memory_bytes: 1012
#include <stdio.h>

int main(void){
  int i,N,a[100],min=0,max=0;
  int ratecolor[9]={};

  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
    if(a[i]<400){
      ratecolor[0]++;
    }else if(400<=a[i]&&a[i]<800){
      ratecolor[1]++;
    }else if(800<=a[i]&&a[i]<1200){
      ratecolor[2]++;
    }else if(1200<=a[i]&&a[i]<1600){
      ratecolor[3]++;
    }else if(1600<=a[i]&&a[i]<2000){
      ratecolor[4]++;
    }else if(2000<=a[i]&&a[i]<2400){
      ratecolor[5]++;
    }else if(2400<=a[i]&&a[i]<2800){
      ratecolor[6]++;
    }else if(2800<=a[i]&&a[i]<3200){
      ratecolor[7]++;
    }else if(3200<=a[i]){
      ratecolor[8]++;
    }
  }

  for(i=0;i<8;i++){
    if(ratecolor[i]>0){
      min++;
      max++;
    }
  }
  if(ratecolor[8]!=0){
    max=max+ratecolor[8];
  }

  if(N=1&&a[0]>=3200){
    min=1;
  }

  printf("%d %d\n",min,max);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n, q, query, t, x;
    cin >> n;
    vector<vector<int>> vec(n);
    cin >> q;
    while (q--) {
        cin >> query;
        if (query == 0) {
            cin >> t >> x;
            vec[t].push_back(x);
        }
        else if (query == 1) {
            cin >> t;
            if (vec[t].empty())
                cout << endl;
            for (vector<int>::iterator it = vec[t].begin(); it != vec[t].end(); it++) {
                vector<int>::iterator i;
                i = vec[t].end();
                i--;
                if (it != i)
                    cout << *it << " ";
                else cout << *it << endl;
            }
        }
        else if (query == 2) {
            cin >> t;
            vec[t].clear();
        }
    }
}


Measured memory_bytes: 5820
#include <bits/stdc++.h>
#define itn int
#define gI gi

using namespace std;

typedef long long ll;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline ll gl()
{
	ll f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

int n, m, p;

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	cin >> n >> m >> p;
	if (n + m + p >= 22) cout << "bust";
	else cout << "win";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int a[10];
int main(){
	for (int i = 0; i<10; i++){
		cin >> a[i];
	}
	sort(a, a+10);
	cout << a[9] <<endl<< a[8] <<endl<< a[7] << endl;

	return 0;
}

Measured memory_bytes: 3080
deg = 0.0
x = 0.0
y = 0.0
from math import pi, cos,sin
while(1):
    a,b = [int(i) for i in input().split(",")]
    if a == 0.0 and b==0.0:
        print(int(y))
        print(int(x))
        break
    else:
        x += a*cos(deg*pi/180)
        y += a*sin(deg*pi/180)
        deg += b


Measured memory_bytes: 5728
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>
#include <unordered_set>

int main()
{
    int N, M;
    std::cin >> N >> M;

    int X[M];
    for (int i = 0; i < M; ++i) {
        std::cin >> X[i];
    }

    std::sort(X, X + M);

    int gap[M-1];
    for (int i = 0; i < M -1; ++i) {
        gap[i] = X[i + 1] - X[i];
    }

    std::sort(gap, gap + M - 1);

    int sum = 0;
    for (int i = 0; i < M - N; ++i) {
        sum += gap[i];
    }

    std::cout << sum << std::endl;

    return 0;
}

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

using namespace std;

int main()
{
   string s;cin>>s;
   
   if(s=="RRR")
   cout<<"3";
   else if(s=="RSR"||s=="SSR"||s=="RSS"||s=="SRS")
   cout<<"1";
   else if(s=="SSS")
   cout<<"0";
   else
   cout<<"2";
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 1e5 + 5;
const ll LINF = 1e18 + 5;
int n, m;
int f[N];
int find(int x)
{
	if(x==f[x]) return x;
	return f[x] = find(f[x]);
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n >> m;
 	for(int i=1; i<=n; i++) f[i] = i;
 	for(int i=1; i<=m; i++)
 	{
 		int x, y, z;
 		cin >> x >> y >> z;
 		int fx = find(x), fy = find(y);
 		if(fx!=fy) f[fx] = fy;
 	}
 	int cnt = 0;
 	for(int i=1; i<=n; i++) if(f[i]==i) cnt++;
 	cout << cnt;
	return 0;
}


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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

const int N = 3005;
int dp[N][N][2];
int a[N], b[N];

void maxSelf(int& x, int y) {
	x = max(x, y);
}

int main() {
	int n, t;
	scanf("%d%d", &n, &t);
	for (int i = 1; i <= n; i++) scanf("%d%d", &a[i], &b[i]);

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= t; j++) {
			dp[i][j][0] = dp[i-1][j][0];
			if (j >= a[i]) maxSelf(dp[i][j][0], dp[i-1][j-a[i]][0] + b[i]);

			dp[i][j][1] = max(dp[i-1][j][1], dp[i-1][j-1][0] + b[i]);
			if (j >= a[i]) maxSelf(dp[i][j][1], dp[i-1][j-a[i]][1] + b[i]);
			maxSelf(dp[i][j][1], dp[i][j][0]);
		}
	}
	printf("%d\n", dp[n][t][1]);
}


Measured memory_bytes: 70656
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = a - 2 * b;
        if (ans < 0) {
            ans = 0;
        }
        System.out.println(ans);

        sc.close();
    }

}


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

int main(){ 
  int N;
  vector<pair<int,int>> AB(110), CD(110);

  cin >> N;
  for(int i=0; i<N; i++) cin >> AB[i].second >> AB[i].first;
  for(int i=0; i<N; i++) cin >> CD[i].first >> CD[i].second;

  sort(AB.begin(), AB.begin()+N, greater<pair<int,int>>());
  sort(CD.begin(), CD.begin()+N);

  int ans = 0;
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      if(AB[j].second < CD[i].first && AB[j].first < CD[i].second){
        ans++;
        AB[j].first = 1000; AB[j].second = 1000;
        break;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
require 'prime'
a = gets.to_i

def divisors(n)
  n.prime_division.inject([1]) do |ary, (p, e)|
    (0..e).map{ |e1| p ** e1 }.product(ary).map{ |a, b| a * b }
  end.sort
end

nums = []
divisors(a).each do |i|
  nums << i + (a / i) - 2
end
puts nums.min


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

int main(){
    int a, b;
    cin >> a >> b;
    int c = a + b;
    
    if(c < 24) cout << c << endl;
    else cout << c - 24 << endl;

    return 0;
}

Measured memory_bytes: 3632
#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________
template <typename T = long long, const int sz = 5 * 10000000> struct IO {
    char reader[sz], writer[sz];
    char *now, *now2 = writer;
    IO() {
        reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
        now = reader;
    }
    inline T read() {
        while(*now && *now <= 32) now++;
        if(*now == '-') {
            now++;
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return -res;
        } else {
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return res;
        }
    }
    inline string read_str() {
        string res;
        while(*now and *now != '\n' and *now != ' ') res += *now++;
        now++;
        return res;
    }
    inline void write(T x, char margin = ' ') {
        if(x == 0) {
            putchar('0');
            putchar(margin);
            return;
        }
        if(x < 0) {
            putchar('-');
            x = -x;
        }
        while(x) {
            *now2 = '0' + x % 10;
            now2++;
            x /= 10;
        }
        do {
            now2--;
            putchar(*now2);
        } while(now2 != writer);
        putchar(margin);
    }
    inline void write_str(string s, char margin = ' ') {
        for(auto c : s) putchar(c);
        putchar(margin);
    }
};
IO<int> io;
int n, m, k;
constexpr int MAX = 1e9 + 1;
constexpr int N = 200010;
int a[N], b[N];
int nn;
main() {
    n = io.read(), m = io.read(), k = io.read();
    nn = n;
    rep(i, n) {
        a[i + 1] = io.read() + a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while(*io.now && *io.now <= 32) io.now++;
                while('0' <= *io.now and *io.now <= '9') io.now++;
            }
            break;
        }
    }
    rep(i, m) {
        b[i + 1] = io.read() + b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    int now = nn;
    int ans = now;
    for(int i = 1; i <= m; i++) {
        while(b[i] + a[now] > k) now--;
        ans = max(ans, i + now);
    }
    io.write(ans);
}


Measured memory_bytes: 7684
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000009
const long long INF = 1LL<<29;
using pint = pair<int,int>;

int main() {
    int n;
    cin>>n;
    int f[110][10];
    rep(i,n){
        rep(j,10){
            cin>>f[i][j];
        }
    }
    int p[110][11];
    rep(i,n){
        rep(j,11){
            cin>>p[i][j];
        }
    }

    ll ans=-1LL<<60;
    for(int bit=0;bit<(1<<10);bit++){
        if(bit==0) continue;
        ll tmp=0;
        rep(i,n){
            int cnt=0;
            rep(j,10){
                if(bit>>j & 1){
                    if(f[i][j]==1) cnt++;
                }
            }
            tmp+=p[i][cnt];
        }
        ans=max(ans,tmp);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;

int n,v[20],c[20],mx=0;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	for(int i=0;i<n;i++){
		cin>>c[i];
	}
	for(int i=0;i<n;i++){
		if(v[i]-c[i]+mx>mx)
			mx+=(v[i]-c[i]);
	}
	cout<<mx;
	return 0;
}

Measured memory_bytes: 256
from itertools import permutations

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

a = 0
b = 0
for i, v in enumerate(permutations(range(1, N + 1), N)):
    if v == P:
        a = i
    if v == Q:
        b = i
print(abs(a - b))



Measured memory_bytes: 39024
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    string s; cin >> s;
    for (int i=s.size()-2;i>=1;i-=2) {
        if(s.substr(0,i/2)==s.substr(i/2,i/2)){
            out(i); break;
        }
    }

    return 0;
}

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

int main()
{
    int x, y, p = 0;
    cin>>x>>y;
    
    if(x==1)
        p+=300000;
    else if(x==2)
        p+= 200000;
    else if(x==3)
        p+= 100000;
    
   if(y==1)
        p+= 300000;
    else if(y==2)
        p+= 200000;
    else if(y==3)
        p+= 100000;
    
    if(y==1&&x==1)
        p+= 400000;
    
    cout<<p<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
const ll MOD=1000000007,INF=1e18;
 
string s,t;
pint S[100010],T[100010];
int Q;
int A,B,C,D;

signed main() {
    IOS();
    cin>>s>>t>>Q;
    rep(i,1,s.size()+1){
        if(s[i-1]=='A')S[i].fi++;
        else S[i].se++;
        S[i].fi+=S[i-1].fi;
        S[i].se+=S[i-1].se;
    }
    rep(i,1,t.size()+1){
        if(t[i-1]=='A')T[i].fi++;
        else T[i].se++;
        T[i].fi+=T[i-1].fi;
        T[i].se+=T[i-1].se;
    }
    while(Q--){
        cin>>A>>B>>C>>D;
        pint ss={(S[B].fi-S[A-1].fi)%3,(S[B].se-S[A-1].se)%3};
        pint tt={(T[D].fi-T[C-1].fi)%3,(T[D].se-T[C-1].se)%3};
        int aa=ss.fi-tt.fi,bb=ss.se-tt.se;
        if((aa-bb)%3==0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

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

const int N = 1e5+20;
const int oo = 1e9;

ll n, m, l, k, a[3], dp[3];

int main() {

    ios::sync_with_stdio(0);
    cin.tie(0);

    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif // LOCAL

    cin>>n;
    for(int i=1; i<=n; ++i){
        for(int it=0; it<3; ++it)
            cin>>a[it];
        ll dpn[3]={0,0,0};
        for(int it=0; it<3; ++it){
            for(int j=0; j<3; ++j){
                if(it != j)
                    dpn[it] = max(dpn[it], dp[j]+a[it]);
            }
        }
        for(int it=0; it<3; ++it)
            dp[it] = dpn[it];
    }
    cout<<max(dp[0], max(dp[1], dp[2]))<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   cin>>s;
  long long int k;
   cin>>k;
   if(s[0]!='1')
   {
      cout<<s[0];
      return 0;
   }
   
else
{
   long long int i=1;
   while(s[i]=='1')
   {
      i++;
   }
   if(k<=i)
      cout<<"1";
   else 
      cout<<s[i];
}
   
   
   
}

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

int main () {
  int r,g,b;
  cin >> r >> g >> b;
  cout << ((r * 100 + g * 10 + b) % 4 == 0 ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    input = stdin.readline

    k = int(input())


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

    for i in range(a, b+1):
        if i % k == 0:
            print('OK')
            exit()
    print('NG')



Measured memory_bytes: 9136
def main():
    n = int(input())
    a = [None]*n
    b = [None]*n
    for i in range(n):
        a[i], b[i] = map(int, input().split())
    a.sort()
    b.sort()
    if n&1:
        print(b[n//2]-a[n//2]+1)
    else:
        print(b[n//2-1]+b[n//2]-a[n//2-1]-a[n//2]+1)
        

if __name__ == "__main__":
    main()

Measured memory_bytes: 25424
#include "bits/stdc++.h"
using namespace std;

#define all(x) (x).begin(),(x).end()
#define fastio ios_base::sync_with_stdio(false)

typedef double db;
typedef long long ll;
typedef unsigned long long ull;

typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

//dp[i][j] = min number of # req. 
const int inf = 1e5;
int main() {
	fastio;
	int h,w; cin >> h >> w;
	
	vector < vector < char > > mt(h, vector < char > (w));
	vector < vector < int > > dp(h, vector < int > (w, 0));

	for(int i = 0; i < h; ++i) 
		for(int j = 0; j < w; ++j)
			cin >> mt[i][j];

	for(int i = 0; i < h; ++i) {
		for(int j = 0; j < w; ++j) {
			if(i + j == 0) {
				dp[i][j] = (mt[i][j] == '#');
			}
			else {
				dp[i][j] = inf;
				if(i > 0) {
					if(mt[i - 1][j] == '.' and mt[i][j] == '#')
						dp[i][j] = min(dp[i][j], dp[i - 1][j] + 1);
					else
						dp[i][j] = min(dp[i][j], dp[i - 1][j]);
				}
				if(j > 0) {
					if(mt[i][j - 1] == '.' and mt[i][j] == '#')
						dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
					else
						dp[i][j] = min(dp[i][j], dp[i][j - 1]);
				}
			}
		}
	}
	cout << dp[h - 1][w - 1] << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define fir first
#define sec second
#define mod 998244353
#define int long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
#define N 25
int a[N];
int dfs(int l,int r,int cl,int cr)
{
	if(l>r) return 0;
	int ans=INF;
	for(int i=l;i<=r;i++)
	{
		int R=dfs(l,i-1,cl,cl+cr)+dfs(i+1,r,cl+cr,cr)+(cl+cr)*a[i];
		if(R<ans) ans=R;
	}
	return ans;
}
signed main()
{
	int n=read();
	for(int i=1;i<=n;i++) a[i]=read();
	cout<<dfs(2,n-1,1,1)+a[1]+a[n]<<endl;
	return 0;
}




Measured memory_bytes: 3636
def resolve():
    h,w=map(int,input().split())
    s=[]
    for _ in range(h):
        s.append(list(input()))
    dx=[-1,-1,-1,0,0,1,1,1]
    dy=[-1,0,1,-1,1,-1,0,1]
    for x in range(h):
        for y in range(w):
            if s[x][y]=='#':
                for k in range(8):
                    nx=x+dx[k]
                    ny=y+dy[k]
                    if not(nx<h and 0<=nx and ny<w and 0<=ny) or s[nx][ny]=='#':
                        continue
                    if s[nx][ny]=='.':
                        s[nx][ny]='1'
                    else:
                        s[nx][ny]=str(ord(s[nx][ny])-ord('0')+1)
    for i in range(h):
        for j in range(w):
            if s[i][j]=='.':
                s[i][j]='0'
    for i in range(h):
        print(''.join(s[i]))
resolve()

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

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  rd(int, r, m, x);
  int lo = 0, hi = 0;
  rep(i, m) {
    rd(int, a);
    (a < x ? lo : hi)++;
  }
  wt(min(lo, hi));
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD=1000000007;
const long long INF = 1LL<<60;

void YN(bool x){
  if(x) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

int main() {
  bool finish=true;
  int N; cin>>N;
  vector<int> A(N),B(N),C(N,0),D(N,0);
  rep(i,N){
    cin>>A.at(i);
    C.at(A.at(i)-1)++;
  }
  rep(i,N){
    cin>>B.at(i);
    D.at(B.at(i)-1)++;
  }
  rep(i,N){
    if(C.at(i)+D.at(i)>N) finish=false;
  }
  YN(finish);
  if(finish){
    reverse(B.begin(),B.end());
    int k=0,a=1;
    rep(i,N){
      if(A.at(i)==B.at(i)){
        if(A.at(i)==B.at(k)||A.at(i)==A.at(k)){
          k=N-1;
          a*=-1;
        }
        swap(B.at(i),B.at(k));
        k+=a;
      }
    }
    rep(i,N){
      if(i==N-1) cout<<B.at(i)<<endl;
      else cout<<B.at(i)<<' ';
    }
  }        
}


Measured memory_bytes: 6428
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
signed main(){
    int n; cin >> n;
    vector<vector<pair<int,int>>> edge(n);
    for(int i  = 1; i < n; ++i){
        int a,b,cost;
        cin >> a >> b >> cost;
        --a,--b;
        edge[a].push_back(make_pair(b,cost));
        edge[b].push_back(make_pair(a,cost));
    }
    int begin = 0;
    vector<int>d(n,1000000000000000000);
    d[0] = 0;
    priority_queue<pair<int,int>,vector<pair<int, int>>,greater<pair<int, int>>>que;
    que.push(make_pair(0,0));
    while(not que.empty()){
        auto top = que.top();
        que.pop();
        int cost = top.first;
        int cv = top.second;
        if(cost > d[cv])continue;
        for(auto p : edge[cv]){
            if(d[p.first] <=  p.second + cost)continue;
            d[p.first] = p.second+ cost;
            que.push(make_pair(d[p.first],p.first));
        }
    }
    for(auto val : d){
        cout << val % 2 << endl;
    }
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
const int maxn = 2e5 + 10;

using namespace std;

int a[maxn];

int main() {
	int k, n;
	cin >> k >> n;
	for(int i = 1; i <= n; ++i) cin >> a[i];
	sort(a + 1, a + 1 + n);
	int res = INT_MAX;
	for(int i = 1; i <= n; ++i) {
		int l = i - 1;
		if(l == 0) {
			res = min(res, a[n] - a[1]);
		}
		else res = min(res, k - a[i] + a[l]);
		int r = i + 1;
		if(r == n + 1) {
			res = min(res, a[n] - a[1]);
		}
		else res = min(res, a[i] + k - a[r]);
	}
	cout << res;
}

Measured memory_bytes: 1024
L = list(str(input()))
A, B, C, D = list(map(int, L))

if A + B + C + D == 7:
    print(A, '+', B, '+', C, '+', D, '=', 7, sep='')
elif A + B + C - D == 7:
    print(A, '+', B, '+', C, '-', D, '=', 7, sep='')
elif A + B - C + D == 7:
    print(A, '+', B, '-', C, '+', D, '=', 7, sep='')
elif A + B - C - D == 7:
    print(A, '+', B, '-', C, '-', D, '=', 7, sep='')
elif A - B + C + D == 7:
    print(A, '-', B, '+', C, '+', D, '=', 7, sep='')
elif A - B + C - D == 7:
    print(A, '-', B, '+', C, '-', D, '=', 7, sep='')
elif A - B - C + D == 7:
    print(A, '-', B, '-', C, '+', D, '=', 7, sep='')
elif A - B - C - D == 7:
    print(A, '-', B, '-', C, '-', D, '=', 7, sep='')



Measured memory_bytes: 3188
from sys import stdin
from itertools import combinations
from collections import Counter
n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
lin = list(combinations(li,2))
sa = []
for i,j in lin:
    p = i[0]-j[0]
    q = i[1]-j[1]
    sa.append((p,q))
    sa.append((-p,-q))
san = Counter(sa)
if n >= 2:
    print(n-max(san.values()))
else:
    print(1)

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

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main()
{
  int a, b, c;
  int ans;
  scanf("%d %d %d", &a, &b, &c);
  ans = (a==b)? c
              : (a==c)? b
                      : a;
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <deque>
#include <stack>
#include <iomanip>
#include <cmath>


using namespace std;


typedef long long ll;
typedef long double ld;


const int MAXN = 41;
const int MAXMASK = (1<<18);
const ll MOD = 1000000007ll;


int N, X, Y, Z;


ll memo[MAXN][MAXMASK];


void input() {
  cin >> N >> X >> Y >> Z;
}


void preprocess() {
}



void solve() {
  int finalMask = (1<<(Z-1))|(1<<(Y+Z-1))|(1<<(Z+X+Y-1));
  int superMask = (1<<(X+Y+Z));
  memo[0][0] = 1;
  for (int i = 0 ; i < N ; i++) {
    for (int m = 0 ; m <= superMask ; m++) {
      for (int d = 1 ; d <= 10 ; d++) {
        if (m == superMask) {
          memo[i+1][m] = (memo[i+1][m] + memo[i][m]) % MOD;
        } else {
          int n = ((m<<d)|(1<<(d-1)))&(superMask-1);
          if ((n&finalMask) == finalMask) {
            n = superMask;
          }
          memo[i+1][n] = (memo[i+1][n] + memo[i][m]) % MOD;
        }
      }
    }
  }
  cout << memo[N][superMask];
}






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

  int T;
//  cin >> T;
  T = 1;

  for (int i = 0 ; i < T ; i++) {
    input();
    preprocess();
    solve();
  }

  return 0;
}


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



int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n;
	cin >> n;
	long long res = 0;
	vector<int> a(n);
	for(auto i = 0; i < n; ++ i){
		cin >> a[i];
	}
	for(auto i = 1; i < n; ++ i){
		res += max(0, a[i - 1] - a[i]);
		a[i] = max(a[i], a[i - 1]);
	}
	cout << res << "\n";
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 3988
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int n; cin >> n;
  if(n < 30) cout << "No\n";
  else cout << "Yes\n";
  return 0;
}

Measured memory_bytes: 3636
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });            var N = Sarray()[0];
            var N = Sarray()[0];
            var Ai = Sarray();
            var Bi = Sarray();
            var diff = new List<long>();
            for (var i = 0; i < N; ++i)
                diff.Add(Bi[i] - Ai[i]);
            diff.Sort();
            var diffp = diff.Where(d => d > 0).Sum();
            var diffm = diff.Where(d => d < 0).Sum();
            if (0 < diffm + diffp)
            {
                WriteLine(-1);
                return;
            }
            if (0 == diffp)
            {
                WriteLine(0);
                return;
            }
            var sum = 0L;
            var ans = 0L;
            for (var i = 0; i < N; ++i)
            {
                sum -= diff[i];
                if (diffp <= Abs(sum))
                {
                    ans = i + 1;
                    break;
                }
            }
            ans += diff.Count(d => d > 0);
            WriteLine(ans);
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 34144
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
#include<iomanip>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp(a, b) make_pair(a, b)
#define mt(a,b,c) make_tuple(a,b,c)
#define rank qwertyuio
#define next dfghjk
#define plus fsghsf
#define minus ytryr
#define pb push_back
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
 
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int mod = (int)1e9 + 7;
const int mod1 = (int)1e9 + 9;
const int mod2 = 998244353;
const int mod3 = (int)1e6+3;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;
 
 
ll binary_search(vector<ll> arr,ll val,ll l,ll r){
    ll m=l+(r-l)/2;
    if(l>=r){
        return l;
    }
    if(val<arr[m]){
        return binary_search(arr,val,l,m);
    }
    else{
        return binary_search(arr,val,m+1,r);
    }
}//return position less than
ll binary_search2(vector<ll> arr,ll val,ll l,ll r){
    ll m=l+(r-l)/2;
    if(l>=r){
        return l;
    }
    if(val<=arr[m]){//changed here
        return binary_search2(arr,val,l,m);
    }
    else{
        return binary_search2(arr,val,m+1,r);
    }
}//return position less than or equal
ll power(ll x, ll y) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % mod;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % mod; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll n) 
{ 
    return power(n, mod-2); 
}

int main()
{   ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin>>n;
    string s[n];
    int t[n];
    string inc;
    int i;
    rep(i,0,n){
        cin>>s[i];
        cin>>t[i];
    }
    cin>>inc;
    int sum=0,flag=0;
    rep(i,0,n){
        if(flag){
            sum+=t[i];
        }
        else{
            if(inc==s[i]){
                flag=1;
            }
        }
    }
    cout<<sum;


    return 0;
             
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 1e6+10;
int read(){int x;scanf("%lld",&x);return x;}
string s;
int sum=0;
signed main() {
	//freopen("test.in","r",stdin);
	//freopen("test.out","w",stdout);
	cin>>s;
	for(int i=0;i<s.size();++i) {
		sum+=s[i]-'0'+0;
	}
	if(sum%9==0) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 3668
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
#define l(i,a,b) for(auto i=a;i<b;i++)
#define lr(i,a,b) for(auto i=a;i>=b;i--)
#define ll long long
#define lli long long int
#define ld long double
#define vec vector<int>
#define mii map<ll,ll>
#define vl vector<long long>
#define se set <long long int>
#define pi pair<long long,long long>
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define in(x) cin>>x
#define o(x) cout<<x
#define SYNC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.14159265359
using namespace std;


//const string k = "enterstringtobechecked";



int main()
{
    SYNC
    //clock_t tStart = clock();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll n,d; in(n)>>d;
    ll count=0;
    l(i,0,n)
    {
        ll a,b; in(a)>>b;
        double temp = a*a + b*b;
        temp = (double)sqrt(temp*1.0);
        if(temp<=d)
            count++;
    }
    o(count)<<endl;





   // printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);   
}


Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define P pair<ll,ll> 
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,ans=1e11;cin>>n;
  lvector A(n,0),S(n,0);rep(i,n) cin>>A[i];
  S[0]+=A[0];
  for(ll i=1;i<n;++i) S[i]+=S[i-1]+A[i];
  ll tot=S[n-1];
  rep(i,n-1) {
    ll tmp=abs(tot-2*S[i]);
    ans=min(ans,tmp);
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 3456
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int b[n];
  int c[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int satis = 0;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    satis += b[i];
  }

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

  for (int i = 0; i < n - 1; i++) {
    if (a[i + 1] == a[i] + 1) {
      satis += c[a[i] - 1];
    }
  }
  cout << satis << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
 	int W, H, x, y, r;
 
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	
	
	if(x - r < 0){
		printf("No\n");
	}
	else if(x + r > W){
		printf("No\n");
	}
	else if(y - r < 0){
		printf("No\n");
	}
	else if(y + r > H){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
	
	return 0;
   
}

Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define pb push_back
#define size(v)  (int) v.size()
#define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
ll inv(ll a){return power_mod(a,mod-2);}    
ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}

int main() {

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

 for(int i = 1; i <= n;i ++) {
 	cout << (xr ^ a[i]) << " ";
 }
 cout << endl;

}

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

using namespace std;

int n,m,i,j,a[100005],ans;
vector <int> edge[100005];

int dfs(int id, int p){
	int mx = 0;
	for(int ii = 0; ii < edge[id].size(); ii++)
	mx = max(mx, dfs(edge[id][ii], id));
	
	if(p != 1){
		if(mx + 1 == m){
			a[id] = 1;
			ans++;
			return 0;
		}
	}
	
	return mx + 1;
}

int main(){
	scanf("%d%d", &n, &m);
	
	for(i = 1; i <= n; i++){
		int x;
		scanf("%d", &x);
		a[i] = x;
		if(i != 1)
		edge[x].push_back(i);
	}
	
	dfs(1, 1);
	
	ans += (a[1] != 1);
	
	printf("%d\n", ans);
}


Measured memory_bytes: 13952
import java.util.*;

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

		long[] arr = new long[n];

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

		long sum = 0;

		for(int i = 1; i<n; i++){
			if(arr[i] < arr[i-1]){
				sum += arr[i-1] - arr[i];
				arr[i] = arr[i - 1];	
			}
		}
		System.out.println(sum);
	}
}


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

int main(){
  int n;
  cin >> n;
  string s[n];
  int p[n];
  for(int i=0;i<n;i++){
    cin >> s[i] >> p[i];
  }
  int ans[n];
  for(int i=0;i<n;i++){
    ans[i]=0;
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i!=j){
        if(s[i]>s[j]){
          ans[i]++;
        }
        else if(s[i]==s[j]&&p[i]<p[j]){
          ans[i]++;
        }
      }
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(ans[j]==i){
        cout << j+1 << endl;
      }
    }
  }
}

Measured memory_bytes: 256