akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100005];

    ll jump(ll i,ll n,ll a[])
    {
        if(i==n-1)
            return 0;
        if(dp[i]!=-1)
            return dp[i];
            
        ll l,r;
        
        l=abs(a[i]-a[i+1])+jump(i+1,n,a);
        r=1e6;
        
        if(i<=n-3)
            r=(abs(a[i]-a[i+2]))+jump(i+2,n,a);
            
        return dp[i]=min(l,r);    
            
    }
    int main()
    {
        ll i,n,test=1;
        cin>>n;
        ll a[n];
        for(i=0;i<n;i++)
            cin>>a[i];
        memset(dp,-1,sizeof dp);
        cout<<jump(0,n,a);    
        return 0;
    }

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  long long a = 0;
  long long b = 0;
  long long c = 0;
  for(int i = 0;i<n;i++){
    if(s[i]=='R') a++;
    else if(s[i] =='G')b++;
    else c++;
  }
  long long sum = a*b*c;
  for(int i = 0;i<n;i++){
  for(int j = 1;i+j+j<n;j++){
  if(s[i]!=s[i+j]&&s[i+j]!=s[i+j+j]&&s[i]!=s[i+j+j]) sum --;
  }}
  cout << sum ;
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N;
  cin>>N;
  vector<long long>vec(N);
  for(ll i=0;i<N;i++){
    cin>>vec.at(i);
    if(vec.at(i)%2==0){
      
    if(vec.at(i)%3!=0&&vec.at(i)%5!=0){
      cout<<"DENIED"<<endl;
      return 0;
    }
    }
  }
  cout<<"APPROVED"<<endl;
  

} 

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 unsigned long long N;
  cin>>N;
   unsigned long long  A[N];
   unsigned long long  sum=0;
  for( unsigned long long  i=0;i<N;i++){
    cin>>A[i];
  }
  for( unsigned long long  i=1;i<N;i++){
    if(A[i-1]>A[i]){
      sum+=A[i-1]-A[i];
      A[i]=A[i-1];
    }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 5196
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
const int MAX_N = 500;
int h, w;
char table[MAX_N][MAX_N];
int flag[MAX_N][MAX_N];
ll black;
int bfs(int y, int x, int t)
{
    queue<P> que;
    que.push(P(y, x));
    flag[y][x] = t;
    int res = 0;
    while(!que.empty())
    {
        P p = que.front();
        que.pop();
        for(int i = 0; i < 4; i++)
        {
            int ny = p.first + dy[i];
            int nx = p.second + dx[i];
            if(nx < 0 || ny < 0 || ny >= h || nx >= w) continue;
            if(table[ny][nx] == table[p.first][p.second]) continue; 
            if(flag[ny][nx] == t) continue;
            if(table[ny][nx] == '#') black++;
            else res++;
            flag[ny][nx] = t;
            que.push(P(ny, nx));
        }
    }
    return res;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h >> w;
    int cnt = 0;
    for(int i = 0; i < h; i++)
        for(int j = 0; j < w; j++)
            cin >> table[i][j];
    ll ans = 0;
    memset(flag, -1, sizeof(flag));
    int t = 0;
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            if(table[i][j] == '#' && flag[i][j] == -1)
            {
                black = 1;
                ll white = bfs(i, j, t);
                t++;
                ans += black * white;
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1408
import sys

lists = []
for str in sys.stdin:
  lists+=[tuple(str.rstrip().split(' '))]

for i in range(0, len(lists), 2):
  hit = brow = 0
  for j in range(4):
    if lists[i][j] == lists[i+1][j]:
      hit += 1
  for c in lists[i]:
    if c in lists[i+1]:
      brow += 1
  print "%d %d"%(hit, brow-hit)

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int k,n;cin>>k>>n;
	int a[n+1];
	rep(i,n) cin>>a[i];
	
	sort(a,a+n);
	a[n]=a[0]+k;

	int ans=-inf;
	rep(i,n){
		ans=max(ans,a[i+1]-a[i]);
	}
	cout<<k-ans<<endl;
}

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

#include <iostream>

int main()
{
    int data[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    int K;

    cin >> K;
    cout << data[K - 1];

}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int,int> P;
int main()
{
  int N,X,Y;
  cin >> N >> X >> Y;
  X--;
  Y--;
  vector<int> Ans(N,0);
  for (int i = 0; i < N-1;i++){
    for (int j = i + 1; j < N;j++){
      int a = j - i;//X-Y間の橋を使わずに移動した場合
      int b = 0;
      b+=abs(X-i);//i-X間
      b++;//X-Yに移動
      b += abs(j - Y);
      int num = min(a, b);
      Ans.at(num-1)++;
    }
  }
  rep(i,N-1){
    cout << Ans.at(i) << endl;
  }
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
const int MAX = 86400;

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

  int N, L;
  while(cin>>N>>L,N){
	VI bs(N), es(N), us(N);
	REP(i,N) cin >> bs[i] >> es[i] >> us[i];
	vector<double> sum(MAX+1);
	REP(i,N){
	  sum[bs[i]] -= us[i];
	  sum[es[i]] += us[i];
	}
	REP(i,MAX) sum[i+1] += sum[i];

	double lb = 0., ub = 1e6+10;
	REP(it,100){
	  double X = (lb + ub) / 2.;
	  double acc1 = L;
	  bool ng = false;
	  REP(i,MAX){
		acc1 = min(L*1., acc1 + sum[i] + X);
		if(acc1 < EPS
		   ){
		  ng = true;
		  break;
		}
	  }
	  double acc2 = acc1;
	  REP(i,MAX){
		acc2 = min(L*1., acc2 + sum[i] + X);
		if(acc2 < EPS){
		  ng = true;
		  break;
		}
	  }
	  ng = ng || acc1 - EPS > acc2;
	  if(ng) lb = X;
	  else ub = X;
	}

	cout << fixed << setprecision(9) << ub << endl;
  }

  return 0;
}

Measured memory_bytes: 4684
N = gets.to_i
St = {}  #文字列と出現回数をまとめる

N.times do |i|
  s = gets.chomp.split("")  #１文字ずつ分解する
  s.sort!  #並び替える
  s = s.join
  St[s] ||= 0  #キーがsの要素がなければ0を代入
  St[s] += 1  #キーがsの要素を＋１する
end  #これで各文字列が何個ずつあるかわかる

count = 0
St.each_value do |i|
  count += i * (i-1) / 2  #各文字列で組み合わせがいくつ作れるか
end

p count


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

int main()
{
    ll N, A, B;
    cin >> N >> A >> B;
    ll a = 0;
    ll b = 0;
    ll c = 0;
    for (int i = 0; i < N; ++i)
    {
        ll temp;
        cin >> temp;
        if (temp <= A)
        {
            ++a;
        }
        else if (temp >= B + 1)
        {
            ++b;
        }
        else
        {
            ++c;
        }
    }
    ll ans = min(min(a, b), c);
    cout << ans << endl;
}


Measured memory_bytes: 256
//Author:- S_Aditya

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const ll mod=1e9+7;         
const int N=1e5+4;

//number of ways to distribute i coins among the given children according the 
//give constraints
ll dp[N];

int main()                  
{
    int n,k;
    
    scn(n); scn(k);
    
    int a[n];
    
    rep(i,0,n)
    scn(a[i]);
    
    dp[0]=1;
    
    rep(i,0,n)
    {
        ll aux[k+1]={0};
        
        for(int used=k;used>=0;used--)
        {
            int l=used,r=used+min(a[i],k-used);
            
            aux[l]=(aux[l]+dp[used])%mod;
            
            aux[r+1]=(aux[r+1]-dp[used]+mod)%mod;
        }
        
        ll prefix=0;
        
        rep(i,0,k+1)
        {
            prefix=(prefix+aux[i])%mod;
            
            dp[i]=prefix;
        }
    }
    
    printf("%lld ",dp[k]);
    
} 


Measured memory_bytes: 1792
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder.Contests.ABC168
{
    /// <summary>
    /// 
    /// </summary>
    static class C
    {
        static void Main(string[] args)
        {
            var a = NextInt();
            var b = NextInt();
            var h = (double)NextInt();
            var m = (double)NextInt();

            var rad = Math.PI * (h + m / 60 - m/5) / 6;

            var c = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2) - 2 * a * b * Math.Cos(rad));

            Console.WriteLine(c);
        }

        #region Console
        static int _index = 0;
        static string[] _buffer;

        static string Next()
        {
            if (_buffer == null || _index >= _buffer.Length)
            {
                _buffer = Console.ReadLine().Split();
                _index = 0;
            }

            return _buffer[_index++];
        }
        static int NextInt()
        {
            return int.Parse(Next());
        }
        static long NextLong()
        {
            return long.Parse(Next());
        }
        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        static int[] ReadIntArray(int n)
        {
            var a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadInt();
            }
            return a;
        }
        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        static long[] ReadLongArray(int n)
        {
            var a = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadLong();
            }
            return a;
        }
        static List<T> ReadObjects<T>(int n, Func<int[], T> creator)
        {
            var l = new List<T>(n);

            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                l.Add(creator(a));
            }

            return l;
        }

        static int[,] ReadMatrix(int n, int m)
        {
            var r = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                for (int j = 0; j < m; j++)
                {
                    r[i, j] = a[j];
                }
            }
            return r;
        }
        #endregion
    }
}


Measured memory_bytes: 27936
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int arr[5];
	int note=0;
	for(int i=0;i<5;i++)
	{
		cin>>arr[i];
		if(arr[i]==0)
		note=i+1;
	}
	cout<<note<<endl;
}

Measured memory_bytes: 3556
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		new Main().run();
	}
	void run(){
		Scanner in = new Scanner(System.in);
		int k = in.nextInt();
		int count = 0;
		char name[]=in.next().toCharArray();
		int cnt[] = new int [name.length];
		char yobi[][] = new char [k][];
		for(int i = 0;i < k;i++){
			yobi[i]=in.next().toCharArray();
		}
		for(int i = 0;i < k;i++){
			for(int j=0; j<yobi[i].length; j++){
				if(name[0]==yobi[i][j]){
					if(barname(name,yobi[i],j,0,cnt)){
						count++;
						break;
					}
				}
			}
		}
		System.out.println(count);
	}
	boolean barname(char name[],char yobi[],int j,int v,int cnt[]){
		cnt[v]=j;
		if(name.length-1 <= v){
			for(int k=0; k+2<name.length; k++){
				if(cnt[k+1]-cnt[k] != cnt[k+2]-cnt[k+1]){
					return false;
				}
			}
			return true;
		}
		for(int l=j+1; l<yobi.length; l++){
			if(name[v+1]==yobi[l]){
				if(barname(name, yobi, l, v+1, cnt)){
					return true;
				}
			}
		}
		return false;
	}
}

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

int main() {
	string S1, S2, S3;
	cin >> S1;
	cin >> S2;
	cin >> S3;
	char card=S1[0];
	S1.erase(0, 1);
	while (true) {
		switch (card) {
		case'a':
			if (S1.size() == 0) { cout << 'A'; return 0; }
			card = S1[0];
			S1.erase(0, 1);
			break;

		case'b':
			if (S2.size() == 0) { cout << 'B'; return 0; }
			card = S2[0];
			S2.erase(0, 1);
			break;

		case'c':
			if (S3.size() == 0) { cout << 'C'; return 0; }
			card = S3[0];
			S3.erase(0, 1);
			break;
		}
	}


	return 0;

}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

std::vector<int> primes(int n) {
    std::vector<int> primes;
    std::vector<bool> isPrime(n+1, true);
    for (int i = 2; i <= n; i++) {
        if (!isPrime[i]) continue;
        primes.push_back(i);
        long long buf = i * 2;
        while (buf <= n) {
            isPrime[buf] = false;
            buf += i;
        }
    }

    return primes;
}

std::map<int, int> prime_fact(long long n) {
    std::map<int, int> cnt;

    long long m = n;
    for (int i: primes(int(sqrt(n))+1)) {
        if (m % i == 0) {
            cnt[i] = 1;
            m /= i;
        }
        while (m % i == 0) {
            cnt[i]++;
            m /= i;
        }
    }
    if (m != 1) {
        cnt[m] = 1;
    }

    return cnt;
}

const int MAX = 1e7;
long long fac[MAX], finv[MAX], inv[MAX];

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

long long comb(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int n, m;
string s;

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

    Mii primes = prime_fact(m);

    combInit();
    ll res = 1;
    FOR(i, primes) {
        res = res * comb(i->second + n - 1, i->second) % MOD;
    }
    std::cout << res << '\n';

    return 0;
}


Measured memory_bytes: 234752
a, b, k = map(int, input().split())

if (b - a) / 2 >= k:
  for i in range(a, a+k):
    print(i)

  for i in range(b-k+1, b+1):
    print(i)

else:
  for i in range(a, b+1):
    print(i)

Measured memory_bytes: 3060
n=int(input())
l=list(map(int,input().split()))
cs1=0
s1=0
for i,a in enumerate(l):
    cs1+=a
    if i%2==0:
        if cs1>=0:
            s1+=abs(cs1)+1
            cs1=-1
    else:
        if cs1<=0:
            s1+=abs(cs1)+1
            cs1=1
cs2=0
s2=0
for i,a in enumerate(l):
    cs2+=a
    if i%2==0:
        if cs2<=0:
            s2+=abs(cs2)+1
            cs2=1
    else:
        if cs2>=0:
            s2+=abs(cs2)+1
            cs2=-1
print(min(s1,s2))


Measured memory_bytes: 19960
/*
	Author: zhaodeyin
	Time: 2018.3.25
*/
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
const int MaxN = 1e5 + 4;
int a[MaxN];
int vis[MaxN];
int main(){
	int n;
	cin>>n;
	int sum = 0,ans = 0;
	for(int i = 1; i <= n; i++) cin>>a[i];
	vis[0] = abs(0-a[1]);
	sum = vis[0];
	for(int i = 1; i <= n; i++){
		vis[i] = abs(a[i]-a[i+1]);
		sum += vis[i];
	}
	for(int i = 1; i <= n; i++){
		int t = sum;
		t = t - abs(a[i]-a[i-1]) + abs(a[i+1]-a[i-1])-abs(a[i]-a[i+1]);
		cout<<t<<endl;
	}
	return 0;	
}

Measured memory_bytes: 2048
k=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
i =int(input())-1
print(k[i])

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
int main(void) {
    char array[8];
    int num,i,j,k;
    char reverse[8],temp;
    scanf("%d\n",&num);
    for (i=0; i<num; i++) {
        scanf("%s\n",array);
        for (j=0; j<8; j++) {
            for (k=0; k<7-j; k++) {
                if (array[k]>array[k+1]) {
                    temp=array[k];
                    array[k]=array[k+1];
                    array[k+1]=temp;
                }
            }
        }
        for (j=0; j<8; j++) reverse[j]=array[7-j];
        printf("%d\n",atoi(reverse)-atoi(array));
    }
    return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> P;

int H[100005];

int main(){
    int n, k; cin >> n >> k;
    for(int i=0;i<n;i++) cin >> H[i];

    sort(H, H+n);

    int ans = 2e9;
    for(int i=0;i<n-k+1;i++) ans = min(H[i+k-1]-H[i], ans);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ld long double
#define pb push_back
#define f first
#define se second
 
 
using namespace std;
 
const int N = 2e5 + 19;
const ll inf = 1e18;
const int pls = 1e9 + 2;
const int inff = 1e9 + 7;


struct node {
    node *l, *r;
    ll val, cnt;
    node() {
        val = cnt = 0;
        l = NULL;
        r = NULL;
    }
} *root;


int getmid(int tl, int tr) {
    ll t1, t2;
    t1 = tl + pls;
    t2 = tr + pls;
    return (((t1 + t2) / 2) - pls);
}


ll getval(node *&v) {
    if (!v) return 0ll;
    return v->val;
}


ll getcnt(node *&v) {
    if (!v) return 0ll;
    return v->cnt;
}


void upd(node *&v, int tl, int tr, ll pos) {
    if (!v)
        v = new node();
    if (tl == tr) {
        v->val += pos;
        v->cnt++;
        return;
    }
    int tm = getmid(tl, tr);
    if (pos <= tm)
        upd(v->l, tl, tm, pos);
    else
        upd(v->r, tm + 1, tr, pos);
    v->val = getval(v->l) + getval(v->r);
    v->cnt = getcnt(v->l) + getcnt(v->r);
}


pll get(node *&v, int tl, int tr, int l, int r) {
    if (!v || r < tl || tr < l)
        return {0, 0};
    int tm = getmid(tl, tr);
    if (l <= tl && tr <= r)
        return {v->val, v->cnt};
    pll t1, t2;
    t1 = get(v->l, tl, tm, l, r);
    t2 = get(v->r, tm + 1, tr, l, r);
    return {t1.f + t2.f, t1.se + t2.se};
}


ll cnt = 0, cb = 0, sm = 0, tp, a, b;
int L, R, M;


ll getv(ll x) {
    pll t1 = get(root, -inff, inff, -inff, x);
    // cout << x << " " << t1.f << " " << t1.se << "\n";
    pll t2 = {sm - t1.f, cnt - t1.se};
    return x * t1.se - t1.f + t2.f - x * t2.se + cb;
}
 
 
int main() {
    root = NULL;
    ll q;
    scanf("%lld", &q);
    for (int i = 1; i <= q; i++) {
        scanf("%lld", &tp);
        if (tp == 1) {
            scanf("%lld %lld", &a, &b);
            upd(root, -inff, inff, a);
            cb += b;
            cnt++;
            sm += a;
        } else {
            L = -inff;
            R = inff;
            pll ans = {inf, inf};
            while (L <= R) {
                M = getmid(L, R);
                ans = min(ans, {getv(M), M});
                if (getv(M) <= getv(M + 1))
                    R = M - 1;
                else
                    L = M + 1;
            }
            printf("%lld %lld\n", ans.se, ans.f);
        }
    }
    return 0; 
}


Measured memory_bytes: 74880
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
int mod_counts[2019];
const int MOD = 2019;
int main(){
  string S;
  cin >> S;
  int cur_10_power = 1;
  int cur_mod = 0;
  long long ans = 0;
  mod_counts[0] = 1;
  for(int i = S.size() - 1; i >= 0; i--){
    cur_mod = (cur_mod + (cur_10_power * (int) (S[i] - '0')) % 2019) % 2019;
    ans = ans + (long long) mod_counts[cur_mod];
    mod_counts[cur_mod] ++;
    cur_10_power = (10 * cur_10_power) % MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3724
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    string s;
    cin >> s;
    int len = s.size();
    int ans = 100000;
    for(int i = 0;i < 26;i++)
    {
        string t = s;
        int count = 1;
        while(true)
        {
            bool flag = true;
            for(int j = 0;j < len - count;j++)
            {
                if(t[j] != t[j + 1])
                {
                    flag = false;
                    break;
                }
            }
            if(flag)
            {
                break;
            }
            for(int j = 0;j < len - 1;j++)
            {
                char ch = (char)('a' + i);
                if(t[j + 1] == ch)
                {
                    t[j] = ch;
                }
            }
            count++;
        }
        if(count - 1 < ans)
        {
            ans = count - 1;
        }
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 256
n = int(input())
ans = ""
for i in range(1,n+1):
    if i % 3 == 0:
        ans += " " + str(i)
        continue
    x = i
    while True:
        if x == 0:
            break
        if x % 10 == 3:
            ans += " " + str(i)
            break
        else:
            x //= 10
print(ans)


Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
typedef pair<int,int> pii;
queue<int>q;
int ver[3009*2],edge[5009*2],nxt[5009*2],head[3009],tot=0;
ll d[3009];int v[3009];
void add(int x,int y,int z)
{
    ver[++tot]=y;edge[tot]=z;nxt[tot]=head[x];head[x]=tot;
}
int ban[3009],cntru[3009];
int dfsv[3009];
int n,m,p;
void spfa()
{
    memset(d,0xcf, sizeof(d));
    memset(v,0, sizeof(v));
    d[1]=0;v[1]=1;
    q.push(1);
    while(q.size())
    {
        int x=q.front();q.pop();
        v[x]=0;
        for(int i=head[x];i;i=nxt[i])
        {
            int y=ver[i],z=edge[i];
            if(ban[y])continue;
            if(d[y]<d[x]+z){
                d[y]=d[x]+z;cntru[y]=cntru[x]+1;
                if(cntru[y]>=n){
                    puts("-1");
                    exit(0);
                }
                if(!v[y]){
                    q.push(y),v[y]=1;
                }
            }
        }
    }
    cout<<max(0ll,d[n])<<endl;
}
int dfs(int x){
    if(dfsv[x])return 0;
    if(x==n)return 1;
    dfsv[x]=1;
    for(int i=head[x];i;i=nxt[i]){
        if(dfs(ver[i]))return 1;
    }
    return 0;
}
int main()
{
    scanf("%d%d%d",&n,&m,&p);
    for(int i=1;i<=m;i++){
        int u,vx,vv;scanf("%d%d%d",&u,&vx,&vv);
        add(u,vx,vv-p);
    }
    for(int i=1;i<=n;i++){
        memset(dfsv,0,sizeof(dfsv));
        if(!dfs(i))ban[i]=1;
    }
    spfa();
    return 0;
}



Measured memory_bytes: 384
#include <algorithm>
#include <cctype>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

class edge {
   public:
    int a, b, c;
    edge() {}
    edge(int a, int b, int c) : a(a), b(b), c(c) {}
};

const int INF = 1e8;

int main() {
    int n, m;
    cin >> n >> m;

    vector<edge> es(m);
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        es[i] = edge(a, b, c);
    }

    vector<vector<int>> d(n, vector<int>(n, INF));
    for (const edge& e : es) {
        d[e.a][e.b] = e.c;
        d[e.b][e.a] = e.c;
    }

    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    int cnt = 0;
    for (const edge& e : es) {
        if (d[e.a][e.b] < e.c) {
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
import bisect
import sys
import math
import itertools
sys.setrecursionlimit(10000)

INF = float('inf')

# input macro
def i():
    return int(raw_input())
def ii():
    return map(int,raw_input().split(" "))
def s():
    return raw_input()
def ss():
    return raw_input().split(" ")
def slist():
    return list(raw_input())
#

def join(s):
    return ''.join(s)

#iterate macro
def piter(n,m):
    return itertools.permutations(n,m)
def citer(n,m):
    return itertools.combinations(n,m)

#modulo macro
def modc(a,b,m):
    c = 1
    for i in xrange(b):
        c = c * (a - i) % m
        c = c * modinv(i + 1,m) % m
    return c
 
def gcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
 
def modinv(a, m):
    (inv, q, gcd_val) = gcd(a, m)
    return inv % m

#bisect macro
def index(a, x):
    #Locate the leftmost value exactly equal to x
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    return -1

#memoize macro
def memoize(f):
    cache = {}
    def helper(*args):
        if args not in cache:
            cache[(args)] = f(*args)
        return cache[args]
    return helper

@memoize
def nck(a,b,m):
    b = min([a-b,b])
    if (b>a or b<0 or a<0):
        return 0
    elif a == 0:
        return 1
    return (nck(a-1,b-1,m)+nck(a-1,b,m)) % m

nh=zip([1,0,-1,0],[0,1,0,-1])

###########

n=i()
a=ii()
m=max(a)
if m%2==0:
    x=[m-j for j in range(m/2)]
    x=[m/2]+x+x
else:
    x=[m-j for j in range((m+1)/2)]
    x=x+x

for y in x:
    if y in a:
        a.remove(y)
    else:
        print "Impossible"
        break
else:
    if len(a)==0:
        print "Possible"
    else:
        if min(a)>=(m+1)/2+1:
            print "Possible"
        else:
            print "Impossible"


Measured memory_bytes: 2824
#include <algorithm>
#include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <vector>
using namespace std;

int main()
{
    
    int N, K;
    cin >> N >> K;
    
    int count = 0;
    while (N) {
        N /= K;
        count++;
    }
    cout << count << endl;
    
    return 0;   
}

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

s_ = list(s)
s_.sort()
s_ = ''.join(s_)

t_ = list(t)
t_.sort(reverse= True)
t_ = ''.join(t_)

if s_ == t_:
    print('No')
    exit()

L = [(s_, 0), (t_, 1)]
L.sort()
#print(L)
if L[0][1] == 0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 61592
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n,a,b;
  cin>>n>>a>>b;
  int mx = min({n * a, b});
  cout<<mx<<endl;

  return 0;
}


Measured memory_bytes: 256
import std.conv, std.stdio;
import std.algorithm, std.array, std.string, std.range;

void main()
{
    auto
        x = readln.chomp.to!int,
        t = x / 500,
        s = (x % 500) / 5;
    (t * 1000 + s * 5).writeln;
}


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

namespace Atcoder1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int S = int.Parse(str[0]);
            int W = int.Parse(str[1]);

            if(S <= W)
            {
                Console.WriteLine("unsafe");
            } else
            {
                Console.WriteLine("safe");
            }

        }
    }
}

Measured memory_bytes: 27476
import numpy as np
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()

s = input()
ans = 1
tmp = s[0]
for i in s:
    if i != tmp:
        ans += 1
        tmp = i
print(ans-1)

Measured memory_bytes: 12640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 2305843009213693951
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define all1(i) begin(i),end(i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false


int main(void){
    
    ll H,W,M;
    ll a,b;
    vector<ll> h,w;
    
    cin >> H >> W >> M;
    REP(i,M){
        cin >> a >> b;
        a--;b--;
        h.push_back(a);
        w.push_back(b);
    }
    
    vector<ll> C(H,0),D(W,0);
    REP(i,M){
        C[h[i]]++;D[w[i]]++;
    }
    
    /*
    REP(i,H){cout << C[i] << " ";}cout << endl;
    REP(i,W){cout << D[i] << " ";}cout << endl;
    */
    
    ll Cm=-INF,Dm=-INF;
    REP(i,H){Cm=max(Cm,C[i]);}
    REP(i,W){Dm=max(Dm,D[i]);}
    
    ll Ck=0,Dk=0;
    REP(i,H){if(C[i]==Cm)Ck++;}
    REP(i,W){if(D[i]==Dm)Dk++;}
    
    ll Ans = Cm+Dm;
    
    ll muda=0;
    REP(i,M){
        if(C[h[i]]==Cm && D[w[i]]==Dm){
            muda++;
        }
    }
    
    if(muda==Ck*Dk){
        Ans--;
    }
    
    //cout << muda MM Ck MM Dk << endl;
    cout << Ans << endl;
    
    return 0;
}



Measured memory_bytes: 12608
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <random>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
typedef long long ll;
ll rand26() {
  random_device rnd;
  mt19937 mt(rnd());
  uniform_real_distribution<> rand(0, 25);
  return (ll)rand(mt);
}
int main()
{
  ll D; cin >> D;
  vector<ll> c(26);
  rep(i,26) cin >> c[i];
  vector<vector<ll>> s(D, vector<ll>(26));
  vector<ll> t(D);  
  rep(i,D) {
    ll smax = -1;
    rep(j,26) {
      cin >> s[i][j];
      if(smax <= s[i][j]) {
	smax = s[i][j];
	t[i] = j;
      }
    }
  }

  
  ll m = 26*365*120;
  vector<ll> d(m), q(m);
  rep(k,120) {
    rep(i,26) {
      rep(j,365) {
	d[k*26*365 + i*365 + j] = (j + k) % 365;
	q[k*26*365 + i*365 + j] = (i + k) % 26;
      }
    }
  }
  
  vector<set<ll>> st(26);
  rep(i,26) {
    st[i].insert(-1);
    st[i].insert(D);    
  }
  rep(i,D) {
    st[t[i]].insert(i);
  }

  ll res = 0;
  // ペナルティ
  vector<ll> pen(26, 0);
  rep(i,26) {
    auto it = st[i].begin();
    it++;
    while(it != st[i].end()) {
      auto it2 = it;
      it2--;
      ll x = *it - *it2 - 1;
      res -= x * (x + 1) / 2 * c[i];
      pen[i] += x * (x + 1) / 2 * c[i];
      it++;
    }
  }
  rep(i,D) {
    res += s[i][t[i]];
  }

  rep(i,m){
    ll oldres = res;
    ll old = t[d[i]];
    ll neww = q[i];
    if(old == neww) continue;
    set<ll> oldst1 = st[old];
    set<ll> oldst2 = st[neww];    
    ll oldpen1 = pen[old];
    ll oldpen2 = pen[neww];
    
    res += s[d[i]][neww] - s[d[i]][old];
    st[old].erase(d[i]);
    st[neww].insert(d[i]);    
    // old
    res += pen[old];
    pen[old] = 0;
    auto it = st[old].begin();
    it++;
    while(it != st[old].end()) {
      auto it2 = it;
      it2--;
      ll x = *it - *it2 - 1;
      res -= x * (x + 1) / 2 * c[old];
      pen[old] += x * (x + 1) / 2 * c[old];
      it++;
    }
    // new
    res += pen[neww];
    pen[neww] = 0;
    it = st[neww].begin();
    it++;
    while(it != st[neww].end()) {
      auto it2 = it;
      it2--;
      ll x = *it - *it2 - 1;
      res -= x * (x + 1) / 2 * c[neww];
      pen[neww] += x * (x + 1) / 2 * c[neww];
      it++;
    }

    if(oldres < res) {
      t[d[i]] = neww;
    }
    else {
      t[d[i]] = old;
      st[old] = oldst1;
      st[neww] = oldst2;
      pen[old] = oldpen1;
      pen[neww] = oldpen2;      
    }
  }

  rep(i,D) cout << t[i]+1 << "\n";
  
  return 0;
}


Measured memory_bytes: 21220
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N;
	in >> N;
	std::vector<LL>a(N + 1);
	rep(i, N) in >> a[i + 1];

	std::vector<LL>ans(N + 1);
	for (LL i = N; i >= 1; --i)
	{
		if (i * 2 > N) ans[i] = a[i];
		else
		{
			LL sum = 0;
			for (LL j = i * 2; j <= N; j += i) sum += ans[j];
			sum %= 2;
			if (sum != a[i]) ans[i] = 1;
		}
	}

	std::vector<LL>b;
	for (LL i = 1; i <= N; ++i)
	{
		if (ans[i] == 1) b.push_back(i);
	}
	out << b.size() << std::endl;
	rep(i, b.size()) out << b[i] << std::endl;
}


Measured memory_bytes: 4980
N = int(input())
A = tuple(map(int, input().split()))
maxa = max(A)
min_facts = [0] * (maxa+1)
def p(n):
    """ """
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n+1):
        if not is_prime[i]:
            continue
        min_facts[i] = i
        
        for j in range(i*2, n+1, i):
            is_prime[j] = False
            if min_facts[j] == 0:
                min_facts[j] = i
p(maxa)
fact_counts = dict()
for a in A:
    while min_facts[a] > 0:
        f = min_facts[a]
        fact_counts.setdefault(f, 0)
        fact_counts[f] += 1
        while a%f == 0:
            a //= f

pairwise = True
for c in fact_counts.values():
    if c > 1:
        pairwise = False
        break

if pairwise:
    print('pairwise coprime')
else:
    if max(fact_counts.values()) == N:
        print('not coprime')
    else:
        print('setwise coprime')


Measured memory_bytes: 219032
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <cstring>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main(int argc , char **argv)
{
	(void)argc;
	(void)argv;

	int s[100] = {};
	int N;
	cin >> N;

	int sum=0;
	for(int i=0;i<N;i++){
		cin >> s[i];
		sum += s[i];
	}

	if (sum%10 != 0){printf("%d\n",sum);return 0;}

	int Max = 0;
	for(int i=0;i<N;i++){
		int c = sum - s[i];
		if (c%10 != 0){Max = max(Max,c);}
	}
	printf("%d\n",Max);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int P = 998244353;
inline void upd(int &x,int y){ x = (x+y>=P)?(x+y-P):(x+y); }
map<string,int>F,G;
inline int f(string s);
inline int g(string s);
int main(){ F[""]=G[""]=F["0"]=G["0"]=1; F["1"]=G["1"]=2; string x; cin>>x,cout<<f(x)<<'\n'; return 0; }
inline int f(string s){
	if (F.count(s)) return F[s];
	int sum = 0,n = s.size();
	for (int i = 1; i <= n; ++i) upd(sum,(LL)g(s.substr(0,i)) * f(s.substr(i,n-i)) % P);
	return F[s] = sum; 
}
inline int g(string s){
	if (G.count(s)) return G[s];
	int n = s.size(),i,j,sum = 0; string t;
	for (i = 1; i < n; ++i) if (n % i == 0){
		for (t.resize(i),j = 0; j < i; ++j) t[j] = '1';
		for (j = 0; j < n; ++j) if (s[j] == '0') t[j%i] = '0'; upd(sum,f(t));
	}
	return G[s] = sum;
}

Measured memory_bytes: 14104
import java.util.Scanner;

public class Main {

  // 参考：https://atcoder.jp/contests/abc158/submissions/10591203
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    // longで入るね.
    // https://docs.oracle.com/javase/jp/13/docs/api/java.base/java/lang/Long.html
    // longに設定可能な最大値2**63-1を保持する定数。
    // log10(2) * 63 = 18.964
    long n = sc.nextLong();
    long a = sc.nextLong();
    long b = sc.nextLong();
    long sho = n / (a + b);
    long amari = n % (a + b);
    if(amari > a){
      System.out.println(sho * a + a);
    }else {
      System.out.println(sho * a + amari);
    }
  }
}

Measured memory_bytes: 23764
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    n = II()
    print("ABC"+str(n))
    return

#B
def B():
    ni = [2 ** i for i in range(1, 10)]
    n = II()
    ans = 1
    for i in range(1, n + 1):
        if i in ni:
            ans = i
    print(ans)        
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 38512
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

int MOD=1000000007;

int main()
{
  long long N,Y;
  cin >> N >> Y;
  for(long long x=0; x<N+1; x++){
    for(long long y=0; y<N-x+1; y++){
            long long z=N-x-y;

            if(x*10000+y*5000+z*1000==Y){
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
            if(z<0){ cout << -1 << " " << -1 << " "  << -1 << endl;}
    }
  }
  cout << -1 << " " << -1 << " " <<  -1 << endl;
}


Measured memory_bytes: 256
# m-solutions2020_a.py
# https://atcoder.jp/contests/m-solutions2020 : A

global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    X = int(lines[0])

    if X < 600:
        ret = 8
    elif X < 800:
        ret = 7
    elif X < 1000:
        ret = 6
    elif X < 1200:
        ret = 5
    elif X < 1400:
        ret = 4
    elif X < 1600:
        ret = 3
    elif X < 1800:
        ret = 2
    else:
        ret = 1

    return [ret]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = [725]
        lines_export = [7]
    if pattern == 2:
        lines_input = [1600]
        lines_export = [2]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    # import time
    # started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    if mode > 0:
        print(f'lines_input=[{lines_input}]')
        print(f'lines_export=[{lines_export}]')
        print(f'lines_result=[{lines_result}]')
        if lines_result == lines_export:
            print('OK')
        else:
            print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 9280
#include <stdio.h>
#include <algorithm>

using namespace std;

int main () {
	int a , b , c;
	scanf ( "%d%d%d" , &a , &b , &c );
	if ( a == b && b == c ) printf ( "Yes\n" );
	else printf ( "No\n" );
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<ll, ll>;

int main(int argc, char **argv)
{
	ll N; cin >> N;
	vector<ll> sum(N, 0);
	for (ll i = 1; i < N; ++i)
	{
		ll a; cin >> a;
		--a;
		++sum[a];
	}

	for (auto &e : sum)
		std::cout << e << std::endl;
	
							
}



Measured memory_bytes: 4792
#include<bits/stdc++.h>
using namespace std;
namespace io{
	const int l=1<<20;
	char buf[l],*s,*t;
	char gc(){
		if(s==t){
			t=(s=buf)+fread(buf,1,l,stdin);
			return s==t?EOF:*s++;
		}
		return *s++;
	}
	char c;
	template<class IT>inline void gi(IT &x){
		x=0;c=gc();while(c<'0'||c>'9')c=gc();
		while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^'0');c=gc();}
	}
};
using io::gi;
#define ll long long
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
const int N=5005;const ll inf=1000000000000ll,INF=10000000000000000ll;
int a[N],b[N],c[N];
ll d[N],e[N];
int main(){
	int n,m,p,t,i;
	scanf("%d%d%d",&n,&m,&p);
	for(i=1;i<=m;++i){scanf("%d%d%d",&a[i],&b[i],&c[i]);c[i]=p-c[i];}
	
	for(i=2;i<=n;++i)d[i]=INF;t=n;
	while(t--)for(i=1;i<=m;++i)cmin(d[b[i]],d[a[i]]+c[i]);
	
	for(i=1;i< n;++i)e[i]=INF;t=n;
	while(t--)for(i=1;i<=m;++i)cmin(e[a[i]],e[b[i]]+c[i]);
	
//	for(i=1;i<=n;++i)printf("%lld ",d[i]);printf("\n");
//	for(i=1;i<=n;++i)printf("%lld ",e[i]);printf("\n");
	for(i=1;i<=m;++i)if(d[a[i]]<inf&&e[a[i]]<inf&&d[b[i]]<inf&&e[b[i]]<inf&&d[b[i]]>d[a[i]]+c[i]){printf("-1");return 0;}
	if(d[n]<0ll)printf("%lld",-d[n]);else printf("0");
	return 0;
}


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

using namespace std;

#define MAX_A 25

int L;
int a[MAX_A];

int next_a(int x){
    int da[6];
    int max_x=0;
    int min_x=0;
    for(int i=0;i<L;i++){
        da[i] = x % 10;
        x /= 10;
    }
    sort(da,da+L);
    for(int i=0;i<L;i++){
        max_x = max_x * 10 +da[L-1-i];
        min_x = min_x * 10 + da[i];
    }
    return max_x - min_x;
}


int main (){
    
    while(1){
        cin >> a[0] >> L;
        if(a[0]==0 && L == 0)break;
        bool judge = false;
        int i,j;
        for(i=1;i<MAX_A;i++){
            a[i] = next_a(a[i-1]);
            for(j=0;j<i;j++){
                if(a[j] == a[i]){
                    judge = true;
                    break;
                }
            }
            if(judge)break;
        }
        cout << j << ' '<< a[i] << ' '<< i-j << endl;

    }
}


Measured memory_bytes: 3040
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        double result = 0.0;
        if(num%2 == 0) {
            result = 1.0/2.0;
            System.out.println(result);
        }else if(num == 1) {
            System.out.println(1.0);
        } else {
            result = ((num-1)/2+1)/(double)num;
            System.out.println(result);
        }
    }

}


Measured memory_bytes: 22868
N=int(input())
h=list(map(int,input().split()))
while len(h)>=2:
    if h[0]-h[1]>=2:
        print("No")
        break
    else:
        if h[0]<=h[1]:
            h.pop(0)
        else:
            h.pop(1)
if len(h)<=1:
    print("Yes")
else:
    pass

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

int main() {

	int N,M,sum=0,dsum,t; cin>>N; 
  vector<int> T(N);
  for(int i=0; i<N;i++){
    cin>>T.at(i);}
  cin>>M;
  vector<int> P(M),X(M);
	
 
  for(int i=0; i<N; i++){
    sum+= T.at(i);}
  for(int j=0; j<M;j++){
    cin>>P.at(j)>>X.at(j);}
  
  for(int k=0;k<M;k++){dsum=sum;t=P.at(k)-1;
    dsum-=T.at(t);dsum+=X.at(k);cout<<dsum<<endl;}
}
	


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
char s[100001];
using namespace std;
int main()
{
    int c0 = 0 , c1 = 0;
    scanf("%s" , s);
    int n ;
    n = strlen(s);
    for(int i = 0 ; i < n ; i ++)
        if(s[i] == '0')
        c0 ++;
        else
        c1 ++;
    printf("%d" , 2 * min(c0 , c1));
return 0;
}


Measured memory_bytes: 256
/* HARDWORK IS THE KEY TO SUCCESS.
   RATING IS TEMPORARY , KNOWLEDGE IS PERMANENT.
   PREFER CODING RATHER THAN MEDITATION !!!*/
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define vin ll n; cin>>n; vector<ll>x(n); for(ll i=0; i<n; i++) cin>>x[i]
#define vout for(ll i=0; i<n; i++) cout<<x[i]<<" "
#define T ll t = 1; cin>>t; while(t--)
#define ain ll n,k,i; cin>>n; ll a[n]; for( i=0; i<n; i++) cin>>a[i]
#define aout for(ll i=0; i<n; i++) cout<<a[i]<<" "
#define matin ll m,n; cin >> n >> m; ll a[n + 1][m + 1] ; for(ll i=1;i<=n;i++) for(ll j=1;j<=m;j++) cin>>a[i][j];
#define matout for(ll i=0;i<m;i++){for(ll j=0;j<n;j++) cout<<a[i][j]<<" "; cout<<"\n";}
#define F first
#define S second
#define I insert
#define sin set<ll>s; ll n; cin>>n; ll tmp; for(ll i=0;i<n;i++){cin>>tmp; s.I(tmp);}
#define sout for(auto it=s.begin();it!=s.end();++it) cout<<*it<<" "
#define AISORT sort(a,a+n)
#define ADSORT sort(a,a+n,greater<ll>())
#define VISORT sort(x.begin(),x.end())
#define VDSORT sort(x.begin(),x.end(),greater<ll>())
#define pb push_back
#define ppb pop_back
 
const ll maxs = 1e6+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
ll fastpow(ll x,ll y)
{ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
ll inv(ll x){ return fastpow(x , mod - 2);}


bool vis[maxs];
vector<ll>graph[maxs];
//ALWAYS CLEAR THEM WHEN TESTCASES ARE GIVEN




int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ld a,b,c;
    cin >> a >>  b >> c;
  ll d = (c -a -b);
    ll right = (c - a - b);
    ll left = 4 * a * b;
    right = right * right;
    if(right > left && d > 0)
        cout << "Yes";
    else
        cout << "No";
    
}
    



Measured memory_bytes: 23680
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int h, w;
  cin >> h >> w;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      string name;
      cin >> name;
      if (name == "snuke") {
        cout << char('A' + j) <<  (i + 1) << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256