akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm( a, b ) ((a)/__gcd(a,b)*(b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> iP;
typedef pair< LL, LL > LP;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 300005;

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );
            if( i * i != n ) ret.pb( n / i );

        }
    }
    sort( all( ret ) );
    return ret;
}

void Prime();

bool prime[SIZE];

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

        int n;
        cin >> n;

        Prime();
        int cnt = 0;
        for( int i = 2; i < 55555 && cnt < n; ++i ) {
                if( !prime[i] && i % 5 == 1 ) {
                        ++cnt;
                        cout << i << " ";

                }
        }
        cout << endl;

    return 0;
}

void Prime() {
        for( int i = 2; i <= 55555; ++i ) {
                if( !prime[i] ) {
                        for( int j = i * 2; j <= 55555; j += i ) {
                                prime[j] = true;

                        }
                }
        }
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<cmath>
#include<algorithm>
#define int long long int
int32_t main()
{
	int k;
	cin>>k;
	int answer=0;
	int i,j,l;
	for(i=1;i<=k;i++)
	{
		for(j=1;j<=k;j++)
		{
			for(l=1;l<=k;l++)
			{
				int val=__gcd(i,__gcd(j,l));
				answer+=val;
			}
		}
	}
	cout<<answer<<endl;
}


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

const int maxN = 3e3 + 5;
const long double PI=atan(1.0) * 4;
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Ford(i,a,b)for(int i=a;i>=b;i--)
#define READ(F)   freopen(F".inp", "r", stdin)
#define WRITE(F)  freopen(F".out", "w", stdout)
#define FILL(a)   fill_n(a , maxN , 0)
#define ll        long long
#define ld        long double
#define ull 	  unsigned long long
#define F         "lcs"
#define pb        push_back
#define pob       pop_back
#define pof       pop_front
#define pf        push_front

using namespace std;

static int n, m, l[maxN][maxN], t[maxN][maxN];
string x, y;
char a[maxN];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //READ(F);WRITE(F);
    getline(cin, x);
    getline(cin, y);
    m = x.length();
    n = y.length();
    For(i, 1, m)
    {
        For(j, 1, n)
        {
            if(x[i - 1] == y[j - 1])
            {
                l[i][j] = l[i - 1][j - 1] + 1;
                t[i][j] = 0;
            }
            else
            {
                if(l[i - 1][j] > l[i][j - 1])
                {
                   l[i][j] = l[i - 1][j];
                   t[i][j] = 1;
                }
                else
                {
                    t[i][j] = -1;
                    l[i][j] = l[i][j - 1];
                }
            }
        }
    }
    int len = l[m][n] - 1;
    while(m >= 0 && n >= 0)
    {
        if(t[m][n] == 0)
        {
            a[len] = x[m - 1];
            --m;
            --n;
            --len;
        }
        else if(t[m][n] == 1) --m;
        else --n;
    }
    cout << a;
}


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

int sum(int x){
  int sum = 0;
  while(x !=0){
    sum += x%10;//一番右の桁の数字を足す
    x /= 10; //一番右の桁を消す
  }
  return sum;
}
    
  
int main() {
  int N,A,B;
  cin>>N>>A>>B;
  int ans=0;
  for(int i=1;i<=N;i++){
    if (A<=sum(i)&&sum(i)<=B) ans +=i;
  }
  cout << ans << endl; 
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include<math.h>
 
int main()
{
long long int N,l;
int a[100001]={0};
scanf("%lld",&N);
for(int i=1;i<=101;i++)
{
    for(int j=1;j<=101;j++)
    {
        for(int k=1;k<=101;k++)
        {
            l=i*i+j*j+k*k+i*j+i*k+j*k;
          a[l]++;
        }
    }
}
for(int i=0;i<N;i++)
{
printf("%d\n",a[i+1]);
}
}

Measured memory_bytes: 2068
//Volume5-0582
import java.util.Arrays;
import java.util.Scanner;

class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		final int   H      = 2,
			        X      = 0,
			        Y      = 1,
			        RIGHT  = 0,
			        ACUTE  = 1,
			        OBTUSE = 2;
		      int[] side   = new int[3];
		      int[] kind   = new int[3];

		while(true){
			side[0]=sc.nextInt(); side[1]=sc.nextInt(); side[2]=sc.nextInt();
			Arrays.sort(side);
			if(side[X]+side[Y] <= side[H]){break;}
			if(Math.pow(side[H],2) == Math.pow(side[X], 2)+Math.pow(side[Y], 2)){
				kind[RIGHT]++;
			} else if (Math.pow(side[H],2) < Math.pow(side[X], 2)+Math.pow(side[Y], 2)){
				kind[ACUTE]++;
			} else {
				kind[OBTUSE]++;
			}
		}
		int triangle = kind[RIGHT]+kind[ACUTE]+kind[OBTUSE];
		System.out.println(triangle+" "+kind[RIGHT]+" "+kind[ACUTE]+" "+kind[OBTUSE]);
	}
}

Measured memory_bytes: 20340
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
int prod=0;
if( a>=1 && a<=9){
    if(b>=1 && b<=9){
            prod = a*b;
    		}


	}
if(prod)cout<<prod<<endl;
else cout<<-1<<endl;	

}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	double[] GR => Strs.Select(double.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	const long INFL = 4011686018427387913L;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		N = F;
		var a = G;
		var cs = new int[3];
		foreach (var x in a) cs[x - 1]++;
		int X = cs[0], Y = cs[1], Z = cs[2];
		int M1 = X + Y + Z, M2 = Y + Z;
		dp = new double[M1 + 1, M2 + 1, Z + 1];
		done = new bool[M1 + 1, M2 + 1, Z + 1];
		done[0, 0, 0] = true;
		WriteLine(Calc(X, Y, Z));
	}
	int N;
	double[,,] dp;
	bool[,,] done;
	double Calc(int x, int y, int z)
	{
		if (!done[x, y, z])
		{
			done[x, y, z] = true;
			var s = (double)(x + y + z);
			if (x > 0) dp[x, y, z] += x * Calc(x - 1, y, z) / s;
			if (y > 0) dp[x, y, z] += y * Calc(x + 1, y - 1, z) / s;
			if (z > 0) dp[x, y, z] += z * Calc(x, y + 1, z - 1) / s;
			dp[x, y, z] += N / s;
		}
		return dp[x, y, z];
	}
}


Measured memory_bytes: 248920
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using P = pair<ld, ld>;
inline ld dist(const P& p1, const P& p2) { return hypot(p1.first - p2.first, p1.second - p2.second); }
int main()
{
    while (true) {
        P p1, p2, p3;
        cin >> p1.first >> p1.second >> p2.first >> p2.second >> p3.first >> p3.second;
        if (p1 == P{0, 0} and p2 == P{0, 0} and p3 == P{0, 0}) { break; }
        const ld a = dist(p1, p2), b = dist(p2, p3), c = dist(p3, p1), s = (a + b + c) / 2;
        const ld r = sqrt((s - a) * (s - b) * (s - c) / s);
        const ld d = hypot(s - a, r), e = hypot(s - b, r), f = hypot(s - c, r);
        const ld r1 = r / 2 / (s - a) * (s + d - r - e - f), r2 = r / 2 / (s - b) * (s + e - r - d - f), r3 = r / 2 / (s - c) * (s + f - r - d - e);
        cout << fixed << setprecision(15) << r2 << " " << r3 << " " << r1 << endl;
    }
    return 0;
}



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

int H, W;

bool In(int x, int y){
	return 0 <= x && x < W && 0 <= y && y < H;
}
string s[50];
int dist[50][50];
const int INF = 1 << 25;

void bfs(){
	fill((int*)begin(dist), (int*)end(dist), INF);
	dist[0][0] = 0;
	typedef pair<int, int> P;
	queue<P> q;
	q.push({ 0, 0 });
	while(q.size()){
		int x = q.front().first, y = q.front().second;
		int d = dist[y][x];
		q.pop();
		int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
		for(int i = 0; i < 4; i++){
			int nx = x + dx[i], ny = y + dy[i];
			if(!In(nx, ny) || s[ny][nx] == '#') continue;
			if(dist[ny][nx] > d + 1){
				dist[ny][nx] = d + 1;
				q.push({ nx,ny });
			}
		}
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	cin >> H >> W;

	int sum = 0;
	for(int i = 0; i < H; i++){
		cin >> s[i];
		for(int j = 0; j < W; j++){
			if(s[i][j] == '.') sum++;
		}
	}
	bfs();
	if(dist[H - 1][W - 1] == INF) cout << -1 << endl;
	else cout << sum - dist[H - 1][W - 1] - 1 << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)

int main() {
    ll N;
    cin >> N;
    vel A(N - 1);
    rep(i, N - 1) {
        cin >> A.at(i);
    }
    vel B(N);
    REP(i, 0, N - 1) {
        B.at(A.at(i) - 1) ++;
    }
    rep(i, N) {
        cout << B.at(i) << endl;
    }
}

Measured memory_bytes: 6428
s = str(input())
t = str(input())

dp=[[0 for i in range(len(s)+1)] for j in range(len(t)+1)] 

for i in range(1,len(s)+1):
    for u in range(1,len(t)+1):
        if s[i-1]==t[u-1]:
            dp[u][i]=dp[u-1][i-1]+1
        else:
            dp[u][i]=max(dp[u-1][i],dp[u][i-1])
lenth=dp[-1][-1]
i=len(s)
j=len(t)
ans=""
while lenth>0:
    if s[i-1]==t[j-1]:
        ans=s[i-1]+ans
        i-=1
        j-=1
        lenth-=1
    elif dp[j][i]==dp[j-1][i]:
        j-=1
    else:
        i-=1
    lenth=dp[j][i]
print(ans)

Measured memory_bytes: 153032
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

# print(N, A_LIST, B_LIST, C_LIST)

result = 0

for i in range(N):
    result += B[A[i] - 1]
    if i > 0 and A[i] - 1 == A[i-1]:
        result += C[A[i-1]-1]

print(result)
# 5+8+9+24+15+13


Measured memory_bytes: 3060
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,v;
	while(cin>>N) {
		VI w(100010);
		REP(i, N) {
			cin>>v;
			REP(i, 3) w[v+i]++;
		}
		ll ans = *max_element(ALL(w));
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

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

    for (int i = 0; i < q; i++) {
      String cmd = stdin.next();
      int a = stdin.nextInt();
      int b = stdin.nextInt();
      if (cmd.equals("print")) {
        System.out.println(str.substring(a, b + 1));
        continue;
      }

      char[] rep;
      if (cmd.equals("replace")) {
        rep = stdin.next().toCharArray();
      } else {
        StringBuilder sb = new StringBuilder(str.substring(a, b + 1));
        rep = sb.reverse().toString().toCharArray();
      }

      char[] chars = str.toCharArray();
      for (int j = 0; a <= b; a++, j++) {
        chars[a] = rep[j];
      }
      str = String.valueOf(chars);
    }
  }

}

Measured memory_bytes: 22392
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
const int maxN = 1000001;
string extractStringAtKey(string str, int key){
    char *s = strtok((char *)str.c_str(), " ");
    while(key > 1){
        s = strtok(NULL, " ");
        key--;
    }
    return (string)s;
}
bool prime[maxN + 1];
void seive(){
    memset(prime, true, sizeof(prime));
    for(int i = 2; i * i <= maxN; ++i){
        if(prime[i]){
            for(int j = i * i; j <= maxN; j += i){
                prime[j] = false;
            }
        }
    }
}
int32_t main(){
    SPEED;
    int n, k;
    cin >> n >> k;
    int ans = k;
    for(int i = 2; i <= n; ++i){
        ans *= (k - 1);
    }
    cout << ans ;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("debug.txt", "w", stderr);
	#endif
}

int32_t main()
{
	fastIO
	inp_out();
	char ch; 
	cin >> ch; 
	if(ch >= 'a' && ch <= 'z')
		cout << 'a'; 
	else cout << 'A'; 
	return 0;
}

Measured memory_bytes: 3632
import core.stdc.stdio;
import std.stdio;
import std.algorithm;

static immutable int unSet=-114514;

struct Data{
	int a,l,r,m;
}
Data Comb(const ref Data a,const ref Data b){
	Data r;
	r.a=a.a+b.a;
	r.l=max(a.l,a.a+b.l);
	r.r=max(a.r+b.a,b.r);
	r.m=max(a.m,b.m,a.r+b.l);
	return r;
}

struct Node{
	Node* l,r,p;
	int delay=unSet,size,v;
	Data d;
	bool rev;
	int State(){
		if(p !is null){
			if(p.l==&this) return -1;
			if(p.r==&this) return 1;
		}
		return 0;
	}
	void Propagate(){
		if(rev){
			if(l !is null) l.rev=!l.rev;
			if(r !is null) r.rev=!r.rev;
			swap(l,r);
			swap(d.l,d.r);
			rev=false;
		}
		if(delay!=unSet){
			if(l !is null) l.delay=delay;
			if(r !is null) r.delay=delay;
			int s=delay*(delay<0?1:size);
			d=Data(delay*size,s,s,s);
			v=delay;
			delay=unSet;
		}
	}
	void Prepare(){
		if(State)
			p.Prepare;
		Propagate;
	}
	void Update(){
		Propagate;
		d=Data(v,v,v,v);
		size=1;
		if(l !is null){
			l.Propagate;
			d=Comb(l.d,d);
			size+=l.size;
		}
		if(r !is null){
			r.Propagate;
			d=Comb(d,r.d);
			size+=r.size;
		}
	}
	void Rotate(){
		Node* par=p,ch;
		if(p.l==&this){
			ch=r;
			r=p;
			r.l=ch;
		}else{
			ch=l;
			l=p;
			l.r=ch;
		}
		if(ch) ch.p=p;
		p=par.p;
		par.p=&this;
		if(p !is null){
			if(p.l==par) p.l=&this;
			if(p.r==par) p.r=&this;
		}
		par.Update;
		Update;
	}
	void Splay(){
		Prepare;
		while(State){
			int s=State*p.State;
			if(!s)
				Rotate;
			else if(s==1){
				p.Rotate;
				Rotate;
			}else{
				Rotate;
				Rotate;
			}
		}
	}
	void Expose(){
		Node* x=&this;
		while(x){
			x.Splay;
			x=x.p;
		}
		x=&this;
		while(x.p){
			x.p.r=x;
			x=x.p;
			x.Update;
		}
		Splay;
	}
	void Evert(){
		Expose;
		r=null;
		rev=!rev;
		Update;
	}
	void Link(Node* t){
		Evert;
		t.Expose;
		p=t;
		t.r=&this;
		t.Update;
	}
	void Cut(){
		Expose;
		if(l !is null) l.p=null;
		l=null;
		Update;
	}
	void Set(int x){
		Expose;
		r=null;
		delay=x;
		Update;
	}
	int Get(){
		Expose;
		r=null;
		Update;
		return d.m;
	}
}

void main(){
	int n,q;
	scanf("%d%d",&n,&q);
	Node[] ns=new Node[n];
	foreach(ref nd;ns){
		int w;
		scanf("%d",&w);
		nd.v=w;
		nd.d=Data(w,w,w,w);
	}
	foreach(i;0..n-1){
		int s,e;
		scanf("%d%d",&s,&e);
		ns[--s].Link(&ns[--e]);
	}
/*	void Output(){
		foreach(i,nd;ns){
			writeln("Node ",i);
			writeln("Rev ",nd.rev);
			write("Parent ");
			if(nd.p is null)
				writeln("NULL");
			else
				writeln(nd.p-ns.ptr);
			write("Left ");
			if(nd.l is null)
				writeln("NULL");
			else
				writeln(nd.l-ns.ptr);
			write("Right ");
			if(nd.r is null)
				writeln("NULL");
			else
				writeln(nd.r-ns.ptr);
			writeln("Value ",nd.v);
			writeln("Data ",nd.d);
			writeln;
		}
	}*/
//	writeln("Begin");
//	Output;
	foreach(_;0..q){
		int t,a,b,c;
//		writeln("Query ",_);
		scanf("%d%d%d%d",&t,&a,&b,&c);
		if(t==1){
			ns[--a].Evert;
//			writeln("Evert ",a);
//			Output;
			ns[--b].Set(c);
//			writeln("Set ",b);
//			Output;
		}else if(t==2){
			ns[--a].Evert;
//			writeln("Evert ",a);
//			Output;
			printf("%d\n",ns[--b].Get);
//			writeln("Get ",b);
//			Output;
		}else
			assert(false);
	}
}

Measured memory_bytes: 13104
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
  let mut stdin = String::new();
  std::io::Read::read_to_string(
    &mut std::io::stdin(),
    &mut stdin).unwrap();
  let mut stdin = stdin.split_whitespace();
  let mut get = || stdin.next().unwrap();
  
  let s = get().as_bytes();
  
  if s.len() < 3 {
    println!("{}", 0);
    return;
  }
  
  let mut ans = 0_i64;
  let mut i = 0;
  let mut cnt = 0;
  while i < s.len()-1 {
    if s[i]==b'A' {
      cnt += 1;
      i += 1;
    } else if cnt > 0 && s[i]==b'B'&&s[i+1]==b'C' {
      ans += cnt;
      i += 2;
    } else {
      cnt = 0;
      i += 1;
    }
  }
  
  println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    for (int i = 0;;i++) {
        if (i%2 == 0) {
            C-=B;
        }
        else {
            A -= D;
        }

        if (A <= 0) {
            cout << "No" << endl;break;
        } 
        if (C<= 0) {
            cout << "Yes" << endl;break;
        }
    }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define maxn 300007
#define ll long long int
using namespace std;

int n,ans=maxn;
char a[maxn];
int s1[maxn]={0},s2[maxn]={0};

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

inline void writ(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) writ(x/10);
	putchar(x%10+'0');
}
inline void write(int x){writ(x);putchar('\n');}

int main()
{
	n=read();
	scanf("%s",&a);
	for (int i=1;i<=n;++i) {s1[i]=s1[i-1];if (a[i-1]=='W') ++s1[i];}
	for (int i=n;i>=1;--i) {s2[i]=s2[i+1];if (a[i-1]=='E') ++s2[i];}
	for (int i=1;i<=n;++i) ans=min(s1[i-1]+s2[i+1],ans);
	write(ans);
	return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  int N,K;
  cin >> N >> K;
  int x = 1;
  for(int i=0; i < N; i++){
    if(x + K < x*2)
      x = x + K;
    else
      x = x * 2;
  }
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
A=sorted(A)
nums=[]
num=0
ans=1
for a in A:
    num+=a
    nums.append(num)
for n in range(N-2,-1,-1):
    if nums[n]*2>=A[n+1]:
        ans+=1
    else:
        break
print(ans)


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

public class AtCoderB
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int k = sc.NextInt();

        int[] nums = new int[n];

        for (int i = 0; i < k; i++)
        {
            int d = sc.NextInt();
            for (int j = 0; j < d; j++)
            {
                nums[sc.NextInt() - 1]++;
            }
        }

        int answer = nums.Where(i => i == 0).Count();

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 28416
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod  1000000007
#define pb push_back
#define mk make_pair
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ld long double
#define fi first
#define se second
#define setbits __builtin_popcount
#define inf 1e18
int main()
{
    fastIO;
    ll a,b,k;
    cin>>a>>b>>k;
    ll val,val1;
    val=min(k,a);
    a-=val;
    k-=val;
    if(k>0)
    {
        val=min(k,b);
        b-=val;
        k-=val;
    }
    cout<<a<<' '<<b<<'\n';
}

Measured memory_bytes: 256
n,k = map(int,input().split())
liv = list(map(int,input().split()))
ans = 0

for a in range(50):
    for b in range(50):
        if a + b <= min(n,k):
            li = liv[:a] + liv[n-b:]
            sum1 = sum(li)
            li.sort()
            for i in range(min(k-a-b,len(li))):
                if li[i] < 0:
                    li[i] = 0
                else:
                    break
            ans = max(ans,sum(li))

print(ans)


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

using namespace std;

const int MAXN = 1e6 + 9;

int main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    vector<vector<pair<int,int>>> primes(MAXN);
    for(int i = 0;i<n;i++)
    {
        cin>>v[i];
    }
    
    vector<int> spf(MAXN);
    for(int i = 2;i<MAXN;i++)
    {
        spf[i] = i;
    }

    for(int i = 4;i < MAXN;i+=2)
    {
        spf[i] = 2;
    }

    for(int i = 3;i*i<MAXN;i++)
    {
        if(spf[i] == i)
        {
            for(int j = i*i;j<MAXN;j+=i)
            {
                if(spf[j] == j)
                {
                    spf[j] = i;
                }
            }
        }
    }


    for(int i = 1;i<MAXN;i++)
    {
        unordered_map<int,int>pfreq;
        int x = i;
        while(x > 1)
        {
            pfreq[spf[x]]++;
            x = x/spf[x];
        }

        for(pair<int,int> p:pfreq)
        {
            primes[i].push_back(p);
        }
    }

    
    vector<bool> seen_prime(MAXN);
    vector<int> times(MAXN);

    bool flag = true;
    for(int i = 0;i<n;i++)
    {
        for(pair<int,int> p:primes[v[i]])
        {
            if(seen_prime[p.first])
            {
                flag = false;
                break;
            }
            else
            {
                seen_prime[p.first] = true;
            }
            
        }
    }

    if(flag)
    {
        cout<<"pairwise coprime\n";
    }
    else
    {
        bool check = true;
        for(int i = 0;i<n;i++)
        {
            for(pair<int,int> p:primes[v[i]])
            {
               times[p.first]++;
            }
        }

        for(int p:times)
        {
            if(p >= n)
            {
                check = false;
                break;
            }
        }

        if(check)
        {
            cout<<"setwise coprime\n";
        }
        else
        {
            cout<<"not coprime\n";
        }
        
    }
    
    return 0;
}

Measured memory_bytes: 81092
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<i64>();
    let k = read::<i64>();

    println!("{}",  (n/k).pow(3u32) + if k % 2 == 0 { ((n+k/2)/k).pow(3u32) } else { 0i64 });
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main() {
	string s;
	cin >> s;

	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == '1') { s[i] = '9'; }
		else if (s[i] == '9') { s[i] = '1'; }
	}

	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
	
public class Main
{ 
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		
		int i=0;
		String s;
		while(scan.hasNext())
		{
			s = scan.nextLine();
			System.out.print(s.charAt(i++));
		}
		scan.close();		
	}
}


Measured memory_bytes: 21844
days = {
  "SUN" : 0,
	"MON" : 1,
  "TUE" : 2,
  "WED" : 3,
  "THU" : 4,
  "FRI" : 5,
  "SAT" : 6
}

input_day = input()
for d in days:
  if input_day == d:
    print(7 - days.get(d))
    break

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> vec(m+1);
  int k,a;
  for(int i=0; i<n; i++){
    cin >> k;
    //cout << k << endl;
    for(int i=0; i<k; i++){
      cin >> a;
      //cout << a << endl;
      vec.at(a)++;
    }
  }
  int ans=0;
  for(int i=0; i<m+1; i++){
    if(vec.at(i)==n)ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
def resolve():
	N = int(input())
	H = list(map(int, input().split()))
	DP = [-1]*N
	DP[0], DP[1] = 0, abs(H[0] - H[1])
	for i in range(2, N):
		a = DP[i-2] + abs(H[i] - H[i-2])
		b = DP[i-1] + abs(H[i] - H[i - 1])
		DP[i] = min(a, b)
	print(DP[-1])
resolve()

Measured memory_bytes: 13928
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
typedef pair<int,int> pii;
typedef pair <long long,long long> pll;
typedef long long ll; 
typedef long double ld; 
const ll mod = 1e9+7;
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); 
    int n; cin>> n;
    vector <vector <int> > v(n,vector <int>(3,0)), dp(n+1,vector <int>(3,0));
    for(vector <int> &p : v)
		cin>>p[0]>>p[1]>>p[2];
	
	dp[1][0] = v[0][0];//base cases
	dp[1][1] = v[0][1];
	dp[1][2] = v[0][2];
	for(int i =1 ; i <= n ; i++)
	{
		dp[i][0] = v[i-1][0] + max(dp[i-1][1], dp[i-1][2]); 
		dp[i][1] = v[i-1][1] + max(dp[i-1][0], dp[i-1][2]); ;
		dp[i][2] = v[i-1][2] + max(dp[i-1][1], dp[i-1][0]); ;
	}
	cout<<max(dp[n][0], max(dp[n][1], dp[n][2])); 
    return 0;
}

 


Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int D;
    cin >> D;
    vector<int> c(26);
    REP (i, 26) {
        cin >> c[i];
    }
    vector<int> last(26,0);
    vector<vector<int> > s(D, vector<int>((26)));
    REP (i, D) {
        REP (j, 26) {
            cin >> s[i][j];
        }
    }

    vector<int> t(D);
    REP(i,D) {
        cin >> t[i];
        t[i]--;
        last[t[i]] = i+1;
        ans += s[i][t[i]];
        REP(j,26) {
            ans -= c[j] * (i+1 - last[j]);
        }
        cout << ans << endl;
    }

    


    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/intro-heuristics/intro_heuristics_b && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/intro-heuristics/intro_heuristics_b && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/intro-heuristics/intro_heuristics_b && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3720
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;sc.hasNext();) {
			String str = sc.next();
			int joi = 0, ioi = 0;
			for(int i=2;i<str.length();i++) {
				if(str.charAt(i-2) == 'J' && str.charAt(i-1) == 'O' && str.charAt(i) == 'I')
					joi++;
				if(str.charAt(i-2) == 'I' && str.charAt(i-1) == 'O' && str.charAt(i) == 'I')
					ioi++;
			}
			System.out.println(joi); System.out.println(ioi);
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

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

Measured memory_bytes: 19688
MOD = 998244353
n, m, k = map(int, input().split())

def init_mod_c(lim=10**6, mod=10**9+7):
    fact = [1, 1] + [0] * (lim-1)
    fact_inv = [1, 1] + [0] * (lim-1)
    inv = [0, 1] + [0] * (lim-1)
    
    for i in range(2, lim+1):
        fact[i] = fact[i-1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        fact_inv[i] = fact_inv[i-1] * inv[i] % mod

    def mod_c(n, m):
        if n < m or n < 0 or m < 0: return 0
        return fact[n] * (fact_inv[m] * fact_inv[n-m] % mod) % mod

    return mod_c

ans = 0
c = init_mod_c(n, MOD)

for i in range(k+1):
    ans += (m * c(n-1, i) % MOD) * pow(m-1, n-i-1, MOD) % MOD
    ans %= MOD

print(ans)

Measured memory_bytes: 34184
h, w = map(int, input().split())
m = [['#'] * (w+2) for i in range(h+2)]
for j in range(h):
    m[j+1][1:w+1] = list(input()) #適宜変える

dp = [[0 for i in range(w+2)] for j in range(h+2)]

dp[1][1] = 1

for i in range(1, h+1):
    for j in range(1, w+1):
        if m[i-1][j] == '.':
            dp[i][j] += dp[i-1][j]
        if m[i][j-1] == '.':
            dp[i][j] += dp[i][j-1]

print(dp[h][w] % 1000000007)

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

int main(){
	int a;
	string ans = "No";
	cin >> a;
	
	for(int i = 1;i<=9;i++){
		if(a%i==0&&a/i<=9){
			ans =  "Yes";
			break;
		}
		
	}
	cout << ans;


	return 0;
}

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

#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 ANS(ans) cout << ans << endl
#define FLG(flg) if(flg) cout << "Yes" << endl; else cout << "No" << endl;
#define YES cout << "Yes" << endl;
#define NO cout << "No" << endl;
#define COUT(s) cout << s << endl;
#define AN vector<int> a(n); for(int i = 0; i < n; i++) cin >> a[i];
#define IN  int n;  cin >> n;
#define VI  vector<int> 
#define SS stringstream ss;
#define SOLVE cout << solve() << endl;

int solve() {
    int cnt = 0;
}

int main() {
    IN
    int ans = 0;
    for(int i = 1; i <= n/2; i++) if(i != n - i) ans++;
    COUT(ans)
}


Measured memory_bytes: 256
#include <cstring>
#include <cstdlib>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define ABS(a) ((a)<0?(-(a)):(a))
#define CS while(cases())
#define I(n) int n = gi()
#define II(n) n = gi()
#define L(n) ll n = gli()
#define LL(n) n = gli()
#define F(i, n) for (int i = 0; i < n; i++)
#define Fa(n, a) for (int i = 0; i < n; i++) a[i] = gi()
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

template<class T>
T gcd(T a, T b) {
    return (b == 0 ? a : gcd(b, a%b));
}

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int cases() {
    static int t = gi();
    return t--;
}

#define MD 1000000007

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    I(l); I(r); I(d);
    int res = 0;
    for (int i = l; i <= r; i++)
        if (i%d == 0)
            res++;
    cout << res << endl;

    return 0;
}


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

const int N = 1e3 + 10;
int n, m;
vector<int> g[N], ans(N + 1);
queue<int> q;

vector<int> findCircle(int st) {
    // puts("");
    int vis[N] = {0}, pre[N] = {0};
    while (q.size()) q.pop();
    q.push(st);
    while (q.size()) {
        int x = q.front(); q.pop();
        // printf("%d %d\n", st, x);
        for (int i = 0; i < g[x].size(); i++) {
            int y = g[x][i];
            // printf("%d %d\n", x, y);
            if (!vis[y]) {
                vis[y] = 1;
                pre[y] = x;
                q.push(y);
            }
        }
        if (vis[st]) break;
    }
    // printf("%d !\n", st);
    int pos = pre[st];
    vector<int> ret;
    ret.push_back(st);
    while (pos && pos != st) {
        ret.push_back(pos);
        pos = pre[pos];
    }
    return ret;
}

int main() {
    cin >> n >> m;
    rep(i, 1, m) {
        int x, y; cin >> x >> y;
        g[x].push_back(y);
    }
    rep(i, 1, n) {
        vector<int> t = findCircle(i);
        if (t.size() > 1 && t.size() < ans.size()) ans = t;
        // printf("%d\n", t.size());
    }
    if (ans.size() == N + 1) puts("-1");
    else {
        cout << ans.size() << endl;
        for (int i = 0; i < ans.size(); i++) printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    lint N, M;
    cin >> N >> M;
    vec<vec<lint>> adj(N, vec<lint>());
    range(i, 0, M) {
        lint a, b;
        cin >> a >> b;
        a--; b--;
        adj.at(a).emplace_back(b);
        adj.at(b).emplace_back(a);
    }
    range(i, 0, N) cout << adj.at(i).size() << "\n";
}

Measured memory_bytes: 256
N = int(input())
A = [int(input()) for i in range(N)]
max_v = A[1] - A[0]

l = 0
r = 1
while r + 1 < N:
    if A[l] > A[r]:
        l = r
    elif A[r] > A[r + 1]:
        max_v = max(max_v, A[r] - A[l])
        if A[l] > A[r + 1]:
            l = r + 1
            r = l
    r += 1
if r<N:
    max_v = max(max_v, A[r] - A[l])
print(max_v)

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

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        x: i64,
        a: i64,
        b: i64,
    }
    let k = b - a;
    if k <= 0 {
        println!("delicious");
    } else if k <= x {
        println!("safe");
    } else {
        println!("dangerous");
    }
}


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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
const int mod = 1e9+7;

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


int main(){
  int H,W;
  cin >> H >> W;
  string board[H];
  VVLL way(H,VLL(W,0));
  rep(i,H) cin >> board[i];

  way[0][0] = 1;

  rep(i,H)rep(j,W){
    if(board[i][j] == '#') continue;
    way[i][j] = way[i][j] + ( ((j-1 >= 0)?way[i][j-1]:0) + ((i-1 >= 0)?way[i-1][j]:0) )% mod;
  }
  cout << way[H-1][W-1] << endl;
  return 0;
}


Measured memory_bytes: 9216
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	long p,mn=1000000005,mx=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>p;
		mn=min(p,mn);
		mx=max(p,mx);
	}
	cout<<mx-mn;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

	
			var inputArray = retreiveLongArray();
			var inputCount = 5;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long H1 = inputArray[0];
			long M1= inputArray[1];
			long H2 = inputArray[2];
			long M2 = inputArray[3];
			long K = inputArray[4];


			//答えの出力
			var ans = (H2-H1)*60 + (M2-M1)-K;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


Measured memory_bytes: 28168
#include <iostream>
#include <iomanip> 
#include <cstdlib>
#include <cmath>
#include<map>
#include<string.h>
#include <algorithm>
#include <bits/stdc++.h> 
#include<vector>

using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define replb(i,a,b) for(ll i=a;i>=b;i--)
#define repl(i,a,b) for(ll i=a;i<b;i++)
#define repv(arr)  for(auto it=arr[i].begin();it!=arr[i].end();it++)  
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define sortA(arr)   sort(arr.begin(),arr.end())
#define ssort stable_sort(arr.begin(),arr.end())
#define search(arr,c)  binary_search(arr.begin(),arr.end(),c)
#define pb   push_back
#define ll long long
#define LCM(a,b) boost::math::lcm(a,b)
#define cl_bf cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define castl static_cast<ll>

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int x,y;cin>>x>>y;
    //cout<<(!y%2)&&((2*x<=y)&&((4*x)>=y));
    if(!(y%2)&&((2*x<=y)&&((4*x)>=y)))cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 3648
import Data.List
main = interact $ unwords . map show . sol . map read . words
sol [a,b,c,d,e,f] = snd $ minimum 
  [(fromIntegral (w+s)/fromIntegral s,[w+s,s]) |
  n <- [0,a..30], m <- [0,b..30], let w = 100*(n+m), w>0, w<=f,
  let g = min (f-w) (e*w`div`100+1), p <- [0,c..g], q <- [0,d..g], 
  let s = p+q, 100*s<=w*e, s+w<=f]

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    string s1,s2;
    cin >> s1 >> s2;

    string ans = "YES";
    rep(i,3){
        if(s1[i] != s2[2-i]){
            ans = "NO";
            break;
        }
    }

    cout << ans << endl;
}


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

int main() {
  int X, A, B;
  cin >> X >> A >> B;
  
  if ( B <= A ) {
    cout << "delicious" << endl;
  }
  else if ( A < B && B <= ( A + X) ){
    cout << "safe" << endl;
  }
  else {
    cout << "dangerous" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm> 
using namespace std;
int main(){
	int n,a[4];
	char b[4];
	cin>>n;

	a[0]=n/1000;
	a[1]=n/100%10;
	a[2]=n/10%10;
	a[3]=n%10;
	if(a[0]+a[1]+a[2]+a[3]==7){
		printf("%d+%d+%d+%d=7\n",a[0],a[1],a[2],a[3]);
		return 0;
	}
	if(a[0]+a[1]+a[2]-a[3]==7){
		printf("%d+%d+%d-%d=7\n",a[0],a[1],a[2],a[3]);
		return 0;
	}
	if(a[0]+a[1]-a[2]+a[3]==7){
		printf("%d+%d-%d+%d=7\n",a[0],a[1],a[2],a[3]);
		return 0;
	}
	if(a[0]-a[1]+a[2]+a[3]==7){
		printf("%d-%d+%d+%d=7\n",a[0],a[1],a[2],a[3]);
		return 0;
	}
	if(a[0]-a[1]-a[2]-a[3]==7){
		printf("%d-%d-%d-%d=7\n",a[0],a[1],a[2],a[3]);
		return 0;
	}
	if(a[0]-a[1]-a[2]+a[3]==7){
		printf("%d-%d-%d+%d=7\n",a[0],a[1],a[2],a[3]);
		return 0;
	}
	if(a[0]-a[1]+a[2]-a[3]==7){
		printf("%d-%d+%d-%d=7\n",a[0],a[1],a[2],a[3]);
		return 0;
	}
	if(a[0]+a[1]-a[2]-a[3]==7){
		printf("%d+%d-%d-%d=7\n",a[0],a[1],a[2],a[3]);
		return 0;
	}
	//return 0;
}

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

using namespace std;

int main()
{
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  for(int i = 0; i < n - 1; i++) if(a[i] == a[i + 1])
  {
    cout << "NO";
    return 0;
  }
  cout << "YES";

  return 0;
}

Measured memory_bytes: 1024