akhauriyash/Code-Regression huggingface dataset:
#ifdef LOCAL111
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RBP(i,a) for(auto& i : a)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
#define rangej(a,b,c) ((a) <= (c) and (c) < (b))
#define rrangej(b,c) rangej(0,b,c)
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n,a,b;
	while(cin >> n >> a >> b){
		string s;
		cin >> s;
		int cnt = 0;
		int cntb = 0;
		REP(i,SZ(s)){
			if(s[i] == 'a'){
				if(cnt < a+b){
					cnt++;
					cout << "Yes" << endl;
				}else{
					cout << "No" << endl;
				}
			}else if(s[i] == 'b'){
				cntb++;
				if(cnt < a+b and cntb <= b){
					cnt++;
					cout << "Yes" << endl;
				}else{
					cout << "No" << endl;
				}
			}else{
				cout << "No" << endl;
			}
		}
	}
	return 0;
}


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

namespace AtCoderBiginnerContest154
{
	class Program
	{
		static void Main(string[] args)
		{
			var number = ReadInt();
			var inputs = ReadIntArray();

			if(number == inputs.Distinct().Count())
			{
				Console.WriteLine("YES");
			}
			else
			{
				Console.WriteLine("NO");
			}
		}

		public static int ReadInt()
			=> int.Parse(Console.ReadLine());

		public static int[] ReadIntArray()
			=> Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

		public static long ReadLong()
			=> long.Parse(Console.ReadLine());

		public static long[] ReadLongArray()
			=> Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();

		public static string ReadString()
			=> Console.ReadLine();

		public static string[] ReadStringArray()
			=> Console.ReadLine().Split();
	}
}


Measured memory_bytes: 40008
#include<iostream>
#include<string>
using namespace std;
int main(){
int i,j;
string a;
cin>>a;
for(i=0;i<a.size();i++)
if(a[i]=='C'){
for(j=i+1;j<a.size();j++)
if(a[j]=='F') break;
if(j==a.size()) cout<<"No"<<endl;
else cout<<"Yes"<<endl;
return 0;}
cout<<"No"<<endl;
return 0;
}

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

using namespace std;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-1
	vector<int> Parent;
	
	//作る時はParentの値をすべて-1にする
	//こうするとすべてバラバラになる
	UnionFind(int N){
		Parent = vector<int>(N,-1);
	}
	//Aがどのグループに属しているか調べる
	int root(int A){
		if(Parent[A]<0)return A;
		return Parent[A] = root(Parent[A]);
	}
	//自分のいるグループの頂点数を調べる
	int size(int A){
		return -Parent[root(A)];//親をとってきたい
	}
	
	//AとBをくっつける
	bool connect(int A,int B){
		//AとBを直接つなぐのではなく,root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if(A==B){
			//すでにくっついているからくっつけない
			return false;
		}
		
		//大きい方(A)に小さいaとき(B)をくっつけたい
		//大小が逆だったらひっくり返す
		if(size(A)<size(B))swap(A,B);
		
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		Parent[B] = A;
		return true;
	}
};

int main(void){
	long long N,M;
	cin >> N >> M;
	vector<int> A(M),B(M);
	for(int i=0;i<M;i++){
		cin >> A[i] >> B[i];
		A[i]--;B[i]--;
	}
	vector<long long> ans(M);
	ans[M-1] = (long long)(N*(N-1))/2;
	UnionFind Uni(N);
	
	for(int i= M-1;i>=1;i--){
		ans [i-1] = ans[i];
		//繋がっていないのがつながったとき
		if(Uni.root(A[i]) != Uni.root(B[i])){
			ans[i-1] -=(long long)Uni.size(A[i])*Uni.size(B[i]);
			Uni.connect(A[i],B[i]);
		}
	}
	for(int i=0;i<M;i++){
		cout << ans[i] << endl;
	}
}



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

int main() {
	long long M, D, COUNT = 0;
	cin >> M >> D;
	for (int i = 1; i <= M; i++) {
		for (int j = 22; j <= D; j++) {
			int D1 = j % 10;
			int D10 = (j - D1) / 10;
			if (D1 >= 2 && D10 >= 2 && D1 * D10 == i) COUNT++;
		}
	}
	cout << COUNT << endl;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int[][] c  = new int[3][3];
		for(int i = 0; i < 3; i++){
		    for(int j = 0; j < 3; j++){
		        c[i][j] = sc.nextInt();
		    }
		}
		
		// 計算
		String result = "No";
		for(int a1 = -200; a1 <= 200; a1++){
		    boolean bool = true;
		    int b1 = c[0][0] - a1;
		    int b2 = c[0][1] - a1;
		    int b3 = c[0][2] - a1;
		    int a2 = c[1][0] - b1;
		    int a3 = c[2][0] - b1;
		    if(c[1][1] != a2 + b2) bool = false;
		    if(c[1][2] != a2 + b3) bool = false;
		    if(c[2][1] != a3 + b2) bool = false;
		    if(c[2][2] != a3 + b3) bool = false;
		    if(bool){
		        result = "Yes";
		        break;
		    }
		}
		
		// 出力
		System.out.println(result);
		
	}
}




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

public class ABC
{
    //          long[] sp = Console.ReadLine().Split().Select(long .Parse).ToArray();
    //          int[] sp = Console.ReadLine().Split().Select(int.Parse).ToArray();
    //          int N =  int.Parse(Console.ReadLine());
    //CompLib.Collections.PriorityQueue<?>
    public static void Main()
    {
        int r = int.Parse(Console.ReadLine());
        Console.WriteLine(r * r);
    }
   

}




Measured memory_bytes: 13140
import java.util.Scanner;
import java.util.Arrays;

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner (System.in);
		
		int N = sc.nextInt();
		
		int [] list = new int [N];
		
		for (int index=0; index<N; index++){
		    list[index]= sc.nextInt();
		}
		
		Arrays.sort(list);
		
		int dif = list [N/2] - list [N/2-1];
		
		System.out.println(dif);

		sc.close();
	}
}

Measured memory_bytes: 50732
/*input
5
2 1 5 4 3
*/

// Nihesh Anderson - knandy

#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 long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key
ll MOD=1000000007;

#define endl '\n'
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
ll INF = 2000000000000000001;
long double EPS = 1e-9;
ll power(ll a, ll n, ll md){if(n==0){return 1;}else{ll res=power(a,n/2,md);res=(res*res)%md;if(n%2!=0){res=(res*a)%md;}return res;}}
random_device rndm;
mt19937 grndm(rndm());
void mix(ll* a, ll* b){shuffle(a,b,grndm);}

int main(){
	fast_cin();
	// freopen("input.in","r",stdin);
	// freopen("output.out","w",stdout);
	ll n; cin >> n;
	vector<ll> v(n);
	for(int i = 0; i < n; i++) {
		cin >> v[i];
	}
	ll ans = 0;
	for(ll i = 1; i < n; i++) {
		ll step = max((ll)0, v[i - 1] - v[i]);
		v[i] = max(v[i], v[i - 1]);
		ans += step;
	}
	cout << ans << endl;
	return 0;
}




















Measured memory_bytes: 4776
import java.util.*;
import java.io.*;
public class Main {
    static long mod = (long) Math.pow(10, 9) + 7;
    public static void main(String[] args) {
        FastScanner f = new FastScanner(System.in);
        int a = f.nextInt();
        int b = f.nextInt();
        pn((6-(a + b)));
    }
        
/******************************END OF MAIN PROGRAM*******************************************/
    // Fast Scanner Alternative of Scanner 
    // Uses Implementation of BufferedReader Class
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        FastScanner(InputStream stream) {
            try {
                br = new BufferedReader(new
                    InputStreamReader(stream));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
    
    // Print in console
    static void pn(Object o){System.out.println(o);}
    static void p(Object o){System.out.print(o);}
    static void pni(Object o){System.out.println(o);System.out.flush();}

    //GCD of two integers
    static int gcd(int a, int b) {
        if(b == 0) return a;
        else {
            return gcd(b, a % b);
        }
    }

    // GCD of a array of integers
    static int gcdarray(int a[]) {
        int res = a[0];
        for(int i = 1; i < a.length; i++) {
            res = gcd(a[i] , res);
        }
        return res;
    }
    
    // Return boolean sieve of first n prime nos.
    static boolean[] sieve(int n) {
        boolean isprime[] = new boolean[n + 1];
        for(int i = 0; i <= n;++i) {
            isprime[i] = true;
        }
        isprime[0] = false;
        isprime[1] = false;
        for(int i = 2; i * i <= n; ++i) {
             if(isprime[i] == true) {               
                 for(int j = i * i; j <= n;j += i)
                     isprime[j] = false;
            }
        }
        return isprime;
    }

    // Return HashSet of factors of a number
    static HashSet<Long> factors(long n) {
        HashSet<Long> hs = new HashSet<Long>();
        for(long i = 1; i <= (long)Math.sqrt(n); i++) {
            if(n % i == 0) {
                hs.add(i);
                hs.add(n / i);
            }
        }
        return hs;
    }

    //Is n prime ?
    static boolean isPrime(int n) {
        if(n == 1) return false;
        int i = 2;
        while((i * i) <= n) {
            if(n % i == 0) return false;
            i += 1;
        }
        return true;
    }
}

Measured memory_bytes: 21204
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=100005;
int a[MAXN];
int n,t=0,ans=0;
int k;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<n;i++)
	{
		t++;
		if(a[i]!=a[i+1])
		{
			if(t%2==1) ans++;
			t=0;
		}
	}
	cout<<ans<<endl;
	return 0;
 } 

Measured memory_bytes: 640
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().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
inf = float('INF')

#solve
def solve():
    n = II()
    a = LI()
    maxa = max(a)
    bitmax = len(bin(maxa)) - 2
    ans = 0
    for i in range(bitmax):
        zero_num = 0
        one_num = 0
        for ai in a:
            if ai & (1 << i):
                one_num += 1
            else:
                zero_num += 1
        ans += (one_num * zero_num * (1 << i)) % mod
        ans %= mod
    print(ans)

    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 123340
def resolve():
    mod=998244353
    n,k=map(int,input().split())
    d=[[],[]]
    for _ in range(k):
        l,r=map(int,input().split())
        d[0].append(l)
        d[1].append(r)
    dp=[0]*(n+1)
    a=[0]*(n+2)
    a[1]=dp[1]=1
    for i in range(2,n+1):
        for j in range(k):
            if i-d[0][j]>0:
                dp[i]=(dp[i]+a[i-d[0][j]]-a[max(i-d[1][j]-1,0)]+mod)%mod
        #print(dp[i])
        a[i]=(a[i-1]+dp[i])%mod
    print(dp[n])
resolve()

Measured memory_bytes: 24520
import java.util.*;
public class Main {
	int[][] cnt = new int[100][];
	char[][] c = new char[100][];
	void doIt( ) {
		//?????°??£?¨?
		Scanner sc = new Scanner(System.in);
		int h,w;
		char[] moji;
		h= sc.nextInt();
		w = sc.nextInt();
		Main tenki = new Main();
		//????????±?????\???
		for(int i = 0;i < h;i++){
			//moji = sc.next().toCharArray();
			tenki.c[i] = sc.next().toCharArray();
		}
		//???????????\????????????????¨????
		for(int i = 0;i < h;i++){
			tenki.cnt[i] = tenki.search(i);
		}
		//????????????
		for(int i = 0;i < h;i++){
			for(int k = 0;k < w;k++){
				System.out.print(tenki.cnt[i][k]);
				if(k != w-1)System.out.print(" ");
			}
			System.out.println("");
		}
	}
	
	public int[] search(int k){
		int[] out = new int[this.c[k].length];
		for(int i = 0;i < this.c[k].length;i++){
			if(this.c[k][i] == 'c'){
				out[i] = 0;
			}else if(i-1 < 0){
				out[i] = -1;
			}else if(out[i-1] == -1){
				out[i] = -1;
			}else{
				out[i] = out[i-1] + 1;
			}
		}
		return out;
	}
	
	public static void main(String [ ] args) {
		new Main( ) . doIt( );
	}
	
	}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

long long INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	ll n,k; cin >> n >> k;
	ll p[n+1]; ld dp[n+1],ans = 0;
	memset(dp,0,sizeof(dp));
	for(int i = 1; i <= n; i++){
		cin >> p[i];
		dp[i] = (1+p[i]);
		dp[i] /= 2;
		if(i)dp[i]+=dp[i-1];
		if(i>=k){
			ans = max(ans,dp[i]-dp[i-k]);
		}
	}
	cout << setprecision(7) << ans << endl;
}	


Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
using namespace std;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
int n;
ll a[N];
 
bool cmp(ll a,ll b){
	return a>b;
}

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
  	cin>>n;
  	 for(int i=1;i<=n;++i){
  	 	cin>>a[i];
  	 }

  	 sort(a+1,a+1+n,cmp);

  	 ll ans=a[1];
  	 int cnt=1;
  	 for(int i=2;i<=n;i++){
  	 	cnt+=2;
  	 	if(cnt<=n-1){
  	 		ans+=2*a[i];
  	 	}
  	 	else{
  	 		if(cnt==n){
  	 			ans+=a[i];
  	 		}
  	 		break;
  	 	}
  	 }

  	 cout<<ans<<endl;




    return 0;
}

Measured memory_bytes: 5220
#!/bin/bash

read -p "4文字の英大文字を入力: " s
if expr ${s} : "[A-Z]\{4\}$" > /dev/null ; then
  echo ${s:0:1} > _tmp
  echo ${s:1:1} >> _tmp
  echo ${s:2:1} >> _tmp
  echo ${s:3:1} >> _tmp
  if [ "`cat _tmp | sort | uniq -c | awk '{print $1}' | sort | uniq -c | xargs`" = "2 2" ]; then
    echo "Yes"
  else
    echo "No"
  fi
else
  echo "No"
fi

Measured memory_bytes: 1532
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {

    ll N;
    cin >> N;
    vector<ll> v;
    map<ll,ll> mp;
    rep(i,N){
        ll A;
        cin >> A;
        if(mp.count(A)) mp[A]++;
        else{
            mp.emplace(A,1);
            v.push_back(A);
        }
    }
    ll ex = 0;
    rep(i,v.size()){
        ex += mp[v[i]]-1;
    }
    if(ex%2==1) ex++;
    ll out = N-ex;
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 10248
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);

    int n, q;
    cin >> n >> q;
    vector<int> E[200010];

    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        E[a].push_back(b);
        E[b].push_back(a);
    }

    ll cnt[200010] = {};

    rep(i, q) {
        ll p, x;
        cin >> p >> x;
        p--;
        cnt[p] += x;
    }

    queue<int> que;
    que.push(0);
    bool visited[200010] = {};
    visited[0] = true;
    while (!que.empty()) {
        int q = que.front();
        que.pop();
        for (auto to : E[q]) {
            if (visited[to]) continue;
            que.push(to);
            cnt[to] += cnt[q];
            visited[to] = true;
        }
    }

    rep(i, n) cout << cnt[i] << (i == n - 1 ? "\n" : " ");



    return 0;
}


Measured memory_bytes: 16500
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N; cin >> N;
  cout << N*(N+1)/2 << endl;
  return 0;
}


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

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

void greedy(){

    int N, K;
    cin >> N >> K;
    //N = 100000;
    //K = 100;

    vector<int> v(N, 0);
    for(int i = 0; i < N; i++) cin >> v[i];

    if(K >= 100){
        for(int i = 0; i < N; i++){
            printf("%d ", N);
        }
        return;
    }

    for(int k = 0; k < K; k++){
        vector<int> v2(N);
        vector<int> vs(N);
        vector<int> ve(N);
        for(int i = 0; i < N; i++){
            int s = max(0, i - v[i]);
            int e = min(N - 1, i + v[i]);
            vs[s] ++;
            ve[e] ++;
        }
        int tmp = 0;
        for(int i = 0; i < N; i++){
            tmp += vs[i];
            v2[i] = tmp ;
            tmp -= ve[i];
        }

        for(int i = 0; i < N; i++){
            v[i] = v2[i];
        }
    }

    for(int i = 0; i < N; i++){
        printf("%d ", v[i]);
    }
    cout << endl;

}

int main(){
    
    greedy();

    return 0;
}

Measured memory_bytes: 6352
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt(), C = sc.nextInt();
		System.out.println((C>=A && C<=B) ? "Yes" : "No");
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}

Measured memory_bytes: 35420
var
  i,j,s,n,ans:longint;
begin
  read(n);
  for i:=1 to n do
    if i mod 2=1 then
      begin
        s:=0;
        for j:=1 to i do
          if i mod j=0 then inc(s);
        if s=8 then inc(ans);
      end;
  write(ans);
end.

Measured memory_bytes: 128
//shara's here
#include <bits/stdc++.h>
using namespace std;
typedef int q;
typedef double w;
typedef string s;
typedef long long ll;
void yoinks(){
std::ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
}
int main(){
    yoinks();
    q ss ,dd;
    cin>>ss>>dd;
    cout<<dd*2-ss;

















return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf=1e16;
int n,a[20][20];
ll s[70010],f[70010];
void upd(ll &x,ll v)
{
	x=max(x,v);
}
int main()
{
	scanf("%d",&n);
	for (int i=0;i<n;i++)
	{
		for (int j=0;j<n;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	for (int mask=1;mask<(1<<n);mask++)
	{
		f[mask]=-inf;
		for (int i=0;i<n;i++)
		{
			if (!(mask&(1<<i)))
			{
				continue;
			}
			for (int j=i+1;j<n;j++)
			{
				if (!(mask&(1<<j)))
				{
					continue;
				}
				s[mask]+=a[i][j];
			}
		}
		//cerr<<mask<<" "<<s[mask]<<endl;
	}
	for (int mask=1;mask<(1<<n);mask++)
	{
		for (int h=mask;h;h=(h-1)&mask)
		{
			upd(f[mask],f[mask^h]+s[h]);
		}
		//cerr<<mask<<" "<<f[mask]<<endl;
	}
	cout<<f[(1<<n)-1]<<endl;
	return 0;
}


Measured memory_bytes: 1280
N ,K = map(int, input().split())
k = N//K
#あまりRとして(0,0,0)mod(K)の時
ans = k**3
#R/2
if K%2 == 0:
    k2 = k
    if (N%K)>=(K//2):
        k2 += 1
    ans += k2**3
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
int B[MAXN];
int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

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

    cin>>n;

    for(int i=0;i<n;i++)cin>>A[i];
    for(int i=0;i<n;i++)cin>>B[i];

    for(int i=0;i<n;i++)sum+=max(0,A[i]-B[i]);

    cout<<sum<<"\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
    int count = 0;
    string s;

    cin >> s;

    for (int i = 0; i < s.length(); i++) {
        count += (s[i] == '1' ? 1 : 0);
    }
    cout << count << endl;

    return 0;
}

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

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

  long long n, k, q;
  cin >> n >> k >> q;
  vector<ll> a(q), imos(n+2, 0);
  for(int i=0;i<q;i++){
    cin >> a[i];
    imos[0]--;
    imos[a[i]]++;
    imos[a[i]+1]--;
  }
  for(int i=1;i<n+1;i++){
    imos[i] += imos[i-1];
    if(k+imos[i] <= 0){
      cout << "No\n";
    }else{
      cout << "Yes\n";
    }
  }
  return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}
const int N = 2e5 + 50;
ll mod = 998244353;
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937_64 mt(seed);
int fac[N],invf[N];
inline int add(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
inline int sub(int x, int y) { return x - y >= 0 ? x - y : x - y + mod; }
inline int power(int x, int y, int res = 1) {
    for (; y; y >>= 1, x = 1ll * x * x % mod) {
        if (y & 1) { res = 1ll * res * x % mod; }
    } return res;
}
void initcombi(int n) {
    for (int i = fac[0] = 1; i <= n; i++) { fac[i] = 1ll * fac[i - 1] * i % mod; }
    invf[n] = power(fac[n], mod - 2);
    for (int i = n; i; i--) { invf[i - 1] = 1ll * invf[i] * i % mod; }
}
 
inline int NCR(int n, int m) {
    if (n < m) { return 0; }
    return 1ll * fac[n] * invf[m] % mod * invf[n - m] % mod;
}
ll sum;
int main() {
    io();
    int x, y, a, b, c;
    priority_queue<int> pick;
    priority_queue<int, vector<int>, greater<int>> pq;
    cin >> x >> y >> a >> b >> c;
    ll r[a], g[b], col[c];
    for(int i = 0; i < a; i++) {
        cin >> r[i];
    }
    for(int i = 0; i < b; i++) {
        cin >> g[i];
    }
    for(int i = 0; i < c; i++) {
        cin >> col[i];
        pick.push(col[i]);
    }
    sort(r, r + a, greater<int>());
    sort(g, g + b, greater<int>());
    sort(col, col + c, greater<int>());
    for(int i = 0; i < x; i++) {
        pq.push(r[i]);
        sum += r[i];
    }
    for(int i = 0; i < y; i++) {
        pq.push(g[i]);
        sum += g[i];
    }

    while(pq.size() && pick.size() && pq.top() <= pick.top()) {
        ll k = pq.top();
        ll kk = pick.top();
        pq.pop();
        pick.pop();
        sum += (kk - k);
    }
    cout << sum;



}
    

Measured memory_bytes: 4216
/***********************************************
 *                                             *
 *   author: raghav_0901 (Raghav Dalmia)       *
 *   updated on: 21-06-2020, 10:24:19 pm IST   *
 *                                             *
\***********************************************/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long int

signed main( )
{
    int n, q;
    cin >> n;

    map<int, int> mp;

    int sum = 0, num;

    for (int i = 0; i < n; i++)
    {
        cin >> num;
        sum += num;
        mp[num]++;
    }

    cin >> q;

    while (q--)
    {
        int b, c;
        cin >> b >> c;
        if (mp.find(b) != mp.end( ))
        {
            int cnt = mp[b];
            mp.erase(b);
            sum -= (cnt * b);
            sum += (cnt * c);
            if (mp.find(c) != mp.end( ))
                mp[c] = mp[c] + cnt;
            else
                mp[c] = cnt;
            // for (auto it : mp) cout << it.first << " " << it.second << " ";
            // cout << endl;
        }
        cout << sum << endl;
    }

    return 0;
}


Measured memory_bytes: 7508
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
ll c[50][50] = {};
ll A[50] = {};
ll B[50] = {};
bool v[50] = {};
ll N, M;
void dfs(int i) {
	v[i] = true;

	rep(j, 0, N) {
		if (i != j && c[i][j] == 1 && !v[j])
		{
			dfs(j);
		}
	}
}
int main() {
	cin >> N >> M;

	rep(i, 0, M) {
		ll a, b; cin >> a >> b;
		c[a - 1][b - 1] = 1;
		c[b - 1][a - 1] = 1;
		A[i] = a - 1;
		B[i] = b - 1;
	}
	ll cnt = 0;
	rep(i, 0, M) {
		c[A[i]][B[i]] = 0;
		c[B[i]][A[i]] = 0;

		if (i == 3) {
			cout << "";
		}
		rep(j, 0, N) {
			v[j] = false;
		}
		dfs(0);

		rep(j, 0, N) {
			if (!v[j]) {
				cnt++;
				break;
			}
		}
		c[A[i]][B[i]] = 1;
		c[B[i]][A[i]] = 1;
	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var s string
	fmt.Scan(&s)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	for i := 0; i < len(s); i++ {
		if s[i] == '?' {
			fmt.Fprintf(w, "%c", 'D')
		} else {
			fmt.Fprintf(w, "%c", s[i])
		}
	}
	fmt.Fprintln(w)
}


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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define ph push
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

typedef long long ll; 
typedef long double ld;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
typedef pair<ll,ll>pi; typedef pair<ll,pi>spi; typedef pair<pi,pi>dpi;

#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
// #define cerr if(0)cout
#define MAXN (300006)
ll n;
ll A[MAXN];
int main()
{
	FAST
	cin>>n;
	bool gotneg=0, gotpos=0;
	FOR(i,0,n-1)cin>>A[i], gotneg|=(A[i]<0), gotpos|=(A[i]>0);
	if(gotneg==0) {
		cout<<n-1<<'\n';
		FOR(i,0,n-2) {
			cout<<i+1<<' '<<i+2<<'\n';
		}
		return 0;
	}
	if(gotpos==0) {
		cout<<n-1<<'\n';
		DEC(i,n-1,1) {
			cout<<i+1<<' '<<i<<'\n';
		}
		return 0;
	}
	ll mx=max_element(A,A+n)-A, mi=min_element(A,A+n)-A;
	if(A[mx]>-A[mi]) {
		ll co = 0;
		FOR(i,0,n-1) co += (A[i]<0);
		cout<<co+n-1<<'\n';
		FOR(i,0,n-1) if(A[i]<0) cout<<mx+1<<' '<<i+1<<'\n';
		FOR(i,0,n-2) {
			cout<<i+1<<' '<<i+2<<'\n';
		}
	} else {
		ll co = 0;
		FOR(i,0,n-1) co += (A[i]>0);
		cout<<co+n-1<<'\n';
		FOR(i,0,n-1) if(A[i]>0) cout<<mi+1<<' '<<i+1<<'\n';
		DEC(i,n-1,1) {
			cout<<i+1<<' '<<i<<'\n';
		}
	}
}


Measured memory_bytes: 256
module Sort_Module
    implicit none
    public
    contains
    recursive subroutine mergesort(a, p, r, b)
        integer(8) a(:), b(:)
        integer(8) p, r
        integer(8) q
        if (p < r) then
            q = (p+r)/2
            call mergesort(a, p, q, b)
            call mergesort(a, q+1, r, b)
            call merge(a, p, q, r, b)
        end if
    end subroutine mergesort
    subroutine merge(a, p, q, r, b)
        integer(8) a(:), b(:)
        integer(8) p, r, q, i, j, k
        integer(8) t
        k = p;   i = p;   j = q+1
        do
            if (.not. (k <= r)) exit
            if (j > r) then
                t = a(i);   i = i+1
            else if (i > q) then
                t = a(j);   j = j+1
            else if (a(i) <= a(j)) then
                t = a(i);   i = i+1
            else
                t = a(j);   j = j+1
            end if
            b(k) = t;   k = k+1
        end do
        do i = p, r
            a(i) = b(i)  
        end do
    end subroutine merge
    subroutine sort(a)
      integer(8) a(:),b(ubound(a,1)-size(a)+1:ubound(a,1)),n,k
      n = ubound(a,1)
      k = ubound(a,1)-size(a)+1
      call mergesort(a,k,n,b)
    end subroutine sort
    function POSL(a,v) result(r)!find first i:a(i)>=v
        implicit none
        integer(8) :: a(:),l,r,idx,v
        r = ubound(a,1) + 1
        l = ubound(a,1)-size(a)
        do while(r-l>1)
            idx = l + (r-l)/2
            if(a(idx) >= v)then
                r = idx
            else
                l = idx
            endif
        enddo
    end function
    function POSU(a,v) result(r)!find first i:a(i)>v
        implicit none
        integer(8) :: a(:),l,r,idx,v
        r = ubound(a,1) + 1
        l = ubound(a,1)-size(a)
        do while(r-l>1)
            idx = l + (r-l)/2
            if(a(idx) > v)then
                r = idx
            else
                l = idx
            endif
        enddo
    end function
    function NUM(a,v) result(n)
        implicit none
        integer(8) :: a(:),v,n
        n = POSU(a,v) - POSL(a,v)
    end function
end module Sort_Module



program atcoder
    use Sort_Module
    implicit none
    integer(8) :: N,M,i,ans,k,l,x,y,z,MO,j
    integer(8),allocatable,dimension(:) :: A,B,C,Csum
    MO = 1000000007_8
    read*,N
    allocate(A(N),B(N),C(N),Csum(N))
    read(*,*)(A(i),i=1,N)
    read(*,*)(B(i),i=1,N)
    do i=1,N
        C(i) = A(i)-B(i)
    enddo
    if(sum(A)<sum(B))then
        write(*,'(I0)')-1
        return 
    endif
    call sort(C)
    Csum(1) = C(1)
    do i = 2,N
        Csum(i) = Csum(i-1) + C(i)
    enddo

    k = 0
    i = 1
    do while(C(i)<0)
        k = k + C(i)
        i = i + 1
    enddo
    do j = 0,N-1
        l = Csum(N) - Csum(N-j)
        if(l+k>=0)then
            write(*,'(I0)')j+i-1
            return
        endif
    enddo

    stop 
contains
end program atcoder

Measured memory_bytes: 3968
#include<stdio.h>
int main(void){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    
    if((x - r) >= 0 && (x + r) <= W ){
        if((y - r ) >= 0 && ((y + r) <= H))
          printf("Yes\n");
        else if((y - r) < 0 || ((y + r) > H))
         printf("No\n");
    }
    else if((x - r) < 0 || (x + r) > W)
     printf("No\n");
     
    
    
    return 0;
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a,k) distance((v).begin(),(k)+upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a,k) distance((v).begin(),(k)+lower_bound((v).begin(),(v).end(),(a)))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};

struct D21{
  int is,js;
  D21(int isize,int jsize){
    is = isize;
    js = jsize;
  }
  int operator()(int i,int j){
    return i*js+j;
  }
};


void Main(){
  int h,n;
  cin>>h>>n;
  vi a(n),b(n);
  rep(i,n){
    cin>>a[i]>>b[i];
  }
  int p = 1;
  vvi dp(n+1,vi(h+p,INF));
  rep(i,n+1) dp[i][0] = 0;
  rep(i,n) rep(j,h+p){
    chmin( dp[i+1][j], dp[i][j] );
    chmin( dp[i+1][min(j+a[i],h)], dp[i+1][j]+b[i] );
  }
  int ans = dp[n][h];
  srep(i,h+1,h+p){
    chmin(ans,dp[n][i]);
  }
  cout<<ans<<endl;
} int main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 39424
#include<stdio.h>
#include<string.h>
int P[8][8],H,W,C,i,j,mv[5]={0,-1,0,1,0};

int ch(int p[8][8],int h,int w,int c,int nc)
{
	int i,nh,nw,res=0;
	if(nc==-1)res++;
	if(p[h][w]==c)
	{
		p[h][w]=nc;
		for(i=0;i<4;i++)
		{
			nh=h+mv[i],nw=w+mv[i+1];
			if(0<=nh&&0<=nw&&nh<H&&nw<W&&p[nh][nw]==c)
			{
				res+=ch(p,nh,nw,c,nc);
			}
		}
	}
	return res;
}

int dfs(int p[8][8],int c,int d)
{
	int t[8][8],res=0,i,tm;
	if(d==5)
	{
		if(p[0][0]==C)
			return ch(p,0,0,p[0][0],-1);
		return 0;
	}
	for(i=1;i<7;i++)
	{
		if(p[0][0]==i)continue;
		memcpy(t,p,sizeof(t));
		ch(t,0,0,t[0][0],i);
		tm=dfs(t,i,d+1);
		res=res<tm?tm:res;
	}
	return res;
}

int main()
{
	for(;scanf("%d%d%d",&H,&W,&C),W;)
	{
		int res=0,t;
		for(i=0;i<H;i++)
			for(j=0;j<W;j++)
				scanf("%d",&P[i][j]);
		for(i=1;i<7;i++)
		{
			t=dfs(P,i,0);
			res=t<res?res:t;
		}
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 604
n=int(input())
happy=[list(map(int,input().split())) for _ in range(n)]
DP=[[0,0,0] for _ in range(n+1)]
for i in range(n):
    a,b,c=happy[i]
    DP[i+1][0]=max(DP[i][1],DP[i][2])+a
    DP[i+1][1]=max(DP[i][2],DP[i][0])+b
    DP[i+1][2]=max(DP[i][0],DP[i][1])+c
print(max(DP[-1]))

Measured memory_bytes: 50080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(){
  ll n,a[110];
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a,a+n);
  cout<<a[n-1]-a[0]<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N;
    cin >> N;
    vector<int> x(N), y(N), h(N);
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i] >> h[i];

    for (int cx = 0; cx <= 100; cx++) {
        for (int cy = 0; cy <= 100; cy++) {
            int H = -1;
            bool can = true;
            for (int i = 1; i < N; i++) {
                if (h[i] == 0) continue;
                int tmp = h[i] + abs(cx - x[i]) + abs(cy - y[i]);
                if (H == -1) H = tmp;
                if (H != tmp) can = false;
            }
            if (!can) continue;
            for (int i = 0; i < N; i++) {
                int Hi = max(H - abs(cx - x[i]) - abs(cy - y[i]), 0);
                if (Hi != h[i]) can = false;
            }
            if (can) {
                cout << cx << ' ' << cy << ' ' << H << '\n';
                return 0;
            }
        }
    }
}


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

int main() {
  int A, B, C, K, d = 0;
  cin >> A >> B >> C >> K;
  for (; A >= B; d++) B *= 2;
  for (; B >= C; d++) C *= 2;
  if (d <= K) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 3608
// AtCoder Beginner Contest 166 - Problem E: This Message Will Self-Destruct in 5s (https://atcoder.jp/contests/abc166/tasks/abc166_e) 
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

// j - i = Ai + Aj => Ai + i = j - Aj
ll solve(int N, const vector<int>& xs)
{
    map<ll, ll> Ls;
    ll ans = 0;

    for (int i = 1; i <= N; ++i)
    {
        auto R = i - xs[i];

        ans += Ls[R];
        Ls[i + xs[i]]++;
    }

    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<int> xs(N + 1);

    for (int i = 1; i <= N; ++i)
        cin >> xs[i];

    auto ans = solve(N, xs);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 26556
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>



using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef pair<int,int>P;
#define INF 1000000000
 
struct edge { 
	int from, to; 
	edge (int from, int to){
		this->from=from; this->to=to;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;


int main(){

	int n, m;

	cin >> n >> m;

	int p = 1;

	FORI(0, m) {
		p *= 2;

	}
	cout << p*(1900 * m + 100 * (n - m)) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <tuple>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#define int long long
using namespace std;
 
int mod = 1000000007;
int n, a[2];
int INF = 2000000000000000000;
int s[100010];
 
void input() {
	cin >> n >> a[0] >> a[1];
	if (a[0] > a[1]) swap(a[0], a[1]);
	s[0] = -INF;
	s[1] = -INF;
	n += 2;
	for (int i = 2; i < n; i++) {
		cin >> s[i];
	}
	s[n] = INF;
}
 
int l[2][100010];	//l[i][j] = s[p] - s[j - 1] >= a[(i+1)%2]となるpの最小値(p > j)
int r[2][100010];	//r[i][j] = s[p] - s[p - 1] <  a[i]となるpの最小値 (p > j)
 
void to_seg() {
	int i, j;
	
	static bool is_near[2][100010];	//is_near[i][j] = s[j] - s[j - 1] < a[i]になっているか？ (1 <= j < n)
	for (j = 1; j < n; j++) {
		is_near[0][j] = (s[j] - s[j - 1] < a[0]);
		is_near[1][j] = (s[j] - s[j - 1] < a[1]);
	}
	
	//l
	for (i = 0; i < 2; i++) {
		for (j = 1; j < n; j++) {
			l[i][j] = lower_bound(s, s + n, s[j - 1] + a[!i]) - s;
			l[i][j] = max(l[i][j], j + 1);
		}
	}
	
	//r
	for (i = 0; i < 2; i++) {
		int p = n;
		for (j = n - 1; j >= 0; j--) {
			r[i][j] = p;
			if (is_near[i][j]) p = j;
		}
	}
}

const int depth = 17;	//深さ, 葉は(1 << depth)個の頂点を持つ
class SegTree {
	int data[1 << (depth + 1)];	//data[i]は, 区間に一様に足された値(%mod)を持つ
public:
	SegTree() { for (int i = 0; i < (1 << (depth + 1)); i++) data[i] = 0; }
	
	//区間[l, r)にv(>=-mod)を足す. data[id]は区間[a, b)に一様に足された値を持つ
	void add(int l, int r, int v, int a = 0, int b = (1 << depth), int id = 0) {
		if (b <= l || a >= r) return;
		if (l <= a && b <= r) { data[id] = (data[id] + v + mod) % mod; return; }
		add(l, r, v, a, a + (b - a) / 2, 2 * id + 1);
		add(l, r, v, a + (b - a) / 2, b, 2 * id + 2);
	}
	
	//場所pos(>=0)の値(%mod)を求める
	int value(int pos) {
		pos = (1 << depth) - 1 + pos;
		int ret = data[pos];
		while (pos > 0) {
			pos = (pos - 1) / 2;
			ret += data[pos];
			ret %= mod;
		}
		return ret;
	}
	
	//場所posの値をxにする
	void update(int pos, int x) {
		add(pos, pos + 1, x - value(pos));
	}
};
SegTree dp[2];

void to_dp() {
	int pos, i;
	
	dp[0].update(1, 1);
	for (pos = 1; pos < n; pos++) {
		for (i = 0; i < 2; i++) {
			dp[!i].add(l[i][pos], r[i][pos] + 1, dp[i].value(pos));
		}
	}
}
 
signed main() {
	input();
	to_seg();
	to_dp();
	
	int ans = dp[0].value(n) + dp[1].value(n);
	ans %= mod;
	cout << ans << endl;
	return 0;
}

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

int dp[100003];
int n;
vector<int> g[100003];

int DP(int i){
    if(dp[i]) return dp[i];
    int lar = 0;
    int l = g[i].size();
    for(int j = 0; j < l; j++){
        lar = max(lar, DP(g[i][j]) + 1);
    }
    return dp[i] = lar;
}

int main()
{
    int m;
    cin >> n >> m;
    int x[100002], y[100002];
    for(int i = 0; i < m; i++){
        cin >> x[i] >> y[i];
        g[x[i]].push_back(y[i]);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans, DP(i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 8960
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll b = 0, c = 0;
    for(ll i=0;i<n;++i){
        cin>>a[i];
        if(a[i] % 4 == 0){
            b++;
        }else if(a[i] % 2 == 0){
            c++;
        }
    }
    string ans = "No";
    if(b - n / 2 >= 0){
        ans = "Yes";
    }else if(n - b * 2 <= c){
        ans = "Yes";
    }
    cout<<ans<<endl;

    return 0;
    
}

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


int main() {
	ios_base::sync_with_stdio(false);
	int a[2];
	cin >> a[0] >> a[1];
	sort(a, a + 2);
	if (a[0] != 1) {
		cout << 1 << endl;
	} else if (a[1] == 2) {
		cout << 3 << endl;
	} else cout << 2 << endl;


	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef long double ld;

int m, n, x, k, l, y;

ld side(ld a, int k){
	if(k == 0){
		return 1;
	}
	return (2 * a * a - 2 * a + 1) * side(a, k - 1) + a * (1 - a);
}

int main(){
	scanf("%d%d%d%d%d%d", &m, &n, &x, &k, &l, &y);
	printf("%Lf\n", side(n / ld(n + m), x) * side(l / ld(l + k), y));
	return 0;
}

Measured memory_bytes: 1064