akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++) {
    cin >> A.at(i);
  }

  ll ans = 0; // 絶対値の合計
  for (ll i = 0; i < N; i++){
    ans += abs(A.at(i));
  }

  int minus_cnt = 0; // 負数の数を数える
  for (ll i = 0; i < N; i++) {
    if (A.at(i) < 0) minus_cnt++;
  }
  
  if (minus_cnt % 2 != 0) { // 負数が奇数個ならどれか一つ-が残るので、絶対値が一番小さいものを負にする
    ll min = abs(A.at(0));
    for (ll i = 1; i < N; i++) {
      if (abs(A.at(i)) < min) min = abs(A.at(i));
    }
    ans -= abs(min) * 2;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {
	int h,m,s;
	int byou;
	int left;
	while(1) {
		scanf("%d %d %d",&h,&m,&s);
		if(h==-1 && m==-1 && s==-1)break;
		byou=h*60*60+m*60+s;
		left=2*60*60-byou;
		printf("%02d:%02d:%02d\n",left/60/60,left/60%60,left%60);
		left*=3;
		printf("%02d:%02d:%02d\n",left/60/60,left/60%60,left%60);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;while(t--)
#define pb push_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pii>
#define prsp(v) loop(i,0,v.size())cout<<v[i],sp;nl;
#define prpsp(v) loop(i,0,v.size())cout<<v[i].F<<" "<<v[i].S,sp;nl;
#define prnl(v) loop(i,0,v.size())cout<<v[i],nl;nl;
#define prpnl(v) loop(i,0,v.size())cout<<v[i].F<<" "<<v[i].S,nl;nl;
#define MOD 1000000007
#define mod(n) (((n%MOD)+MOD)%MOD)
#define all(x) x.begin(),x.end()

const int N = 1e5+5;

int main() 
{
    fastio();

    char n;
    cin>>n;
    switch(n)
    {
        case 'A':
            cout<<"T";
            break;
        case 'T':
            cout<<"A";
            break;
        case 'C':
            cout<<"G";
            break;
        case 'G':
            cout<<"C";
            break;
    }


    return 0;
}

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

const ll MAX = 1000000+2;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    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;
    }
}

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


ll modpow(ll a,ll n){
    ll res = 1;
    while(n>0){
        // &１つはビット積
        if(n&1) res = res * a%MOD;
        a = a*a%MOD;
        n>>=1;
    }
    return res;
}


int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	COMinit();
	ll N;
	cin >> N;
    vector<ll> A(N);
    rep(i,N){
        cin>>A[i];
    }
    ll ans = 0;

    rep(i,N){
        ans += inv[A[i]];
        ans %=MOD;
    }
    
    ll maxn = 10e3+1;
    map<ll,ll> gcm;
    map<ll,ll> gcm_mp;
    rep(i,N){
        gcm_mp.clear();
        ll border = pow(A[i],0.5);
        for(ll j=2;j<=border;j++){
            if(A[i]==0){
                break;
            }
            while(A[i]%j==0){
                gcm_mp[j]++;
                A[i]/=j;
            }
        }
        if(A[i]!=1){
            gcm_mp[A[i]]++;
        }
        for(auto it:gcm_mp){
            gcm[it.first]= max(gcm[it.first],it.second);
        }
    }
    ll lcm = 1;
    for(auto it:gcm){
        lcm *= modpow(it.first,it.second)%MOD;
        // cout<<it.first << " "<< it.second<<"\n";
        lcm %=MOD;
    }
    ans *=lcm;
    ans %=MOD;
    // cout<<lcm<<"\n";
    cout<<ans<<"\n";

	return 0;
}

Measured memory_bytes: 24448
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    string s;
    cin >> s;
    string yaki = "";
    rep(i,4){
        yaki += s[i];
    }
    if(yaki == "YAKI") cout <<"Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> A(n);
  int cnt = 0;
  int total = 0;
  for (auto& a : A) {
    cin >> a;
    total += a;
  }

  double tho = static_cast<double>(total) / static_cast<double>(4 * m);

  for (auto a : A) {
    if (a >= tho) {
      cnt++;
    }
  }

  if (cnt >= m) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
// ProblemURL : https://atcoder.jp/contests/abc114/tasks/abc114_c
// ---------------------------------------------
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ct := 0
	check := func(n int) bool {
		a, b, c := false, false, false
		for n > 0 {
			switch n % 10 {
			case 3:
				a = true
			case 5:
				b = true
			case 7:
				c = true
			}
			n /= 10
		}
		return a && b && c
	}
	dfs := func() {
		sta := make([]int, 0, 19683)
		sta = append(sta, 0)
		for len(sta) != 0 {
			var x int
			sta, x = sta[:len(sta)-1], sta[len(sta)-1]
			if x > n {
				continue
			}
			if check(x) {
				ct++
			}
			sta = append(sta, x*10+3)
			sta = append(sta, x*10+5)
			sta = append(sta, x*10+7)
		}
	}
	dfs()
	fmt.Println(ct)
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll a, b, c, x,count=0;
	cin >> a >> b >> c >> x;
	for (ll i = 0; i <= a; i++) {
		for (ll j = 0; j <= b;j++) {
			for (ll k = 0; k <= c; k++) {
				if (500 * i + 100 * j + 50 * k == x) {
					count++;
					//cout << i << " " << j << " " << k << endl;
				}
			}
		}
	}
	cout << count << endl;
	
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	@SuppressWarnings("unchecked")
	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		List<Pair>[] lists = new ArrayList[n];
		for (int i = 0; i < n; i++)
			lists[i] = new ArrayList<Pair>();
		while (true) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			int c = scanner.nextInt();
			if ((a | b | c) == 0)
				break;
			lists[a - 1].add(new Pair(b - 1, c));
		}
		int r = scanner.nextInt();
		while (r-- > 0) {
			int[] b = new int[m];
			for (int i = 0; i < m; i++)
				b[i] = scanner.nextInt();
			int res = 0;
			for (Pair p : lists[0]) {
				res += b[p.b] * p.cost;
			}
			System.out.print(res);
			for (int i = 1; i < n; i++) {
				res = 0;
				for (Pair pair : lists[i]) {
					res += b[pair.b] * pair.cost;
				}
				System.out.print(" " + res);
			}
			System.out.println();
		}
	}

	class Pair {
		int b, cost;

		public Pair(int b, int cost) {
			super();
			this.b = b;
			this.cost = cost;
		}

		@Override
		public String toString() {
			return "Pair [b=" + b + ", cost=" + cost + "]";
		}

	}
}

Measured memory_bytes: 295028
#include <bits/stdc++.h>
using namespace std;
int main(){
  char b;
  cin >> b ;
  if(b == 'A'){
    cout << 'T' <<endl;
  }
  else if(b == 'C'){
    cout << 'G' <<endl;
  }
  else if(b == 'G'){
    cout << 'C' <<endl;
  }
  else if(b == 'T'){
    cout << 'A' <<endl;
  }
}

Measured memory_bytes: 256
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n,k=map(int,input().split())
a=list(map(int,input().split()))
ix=a.index(1)
i=math.ceil((n-k)/(k-1))+1
print(i)

Measured memory_bytes: 84768
s=list(input())

def sea(s):
    if s==[]:
        return 0
    max_agct=0
    tem_agct=0
    for i in range(len(s)):
        for j in range(len(s)-i):
            if s[i+j]=="A" or s[i+j]=="G" or s[i+j]=="C" or s[i+j]=="T":
                tem_agct+=1
          
                        
            else:
                if tem_agct>max_agct:
                    max_agct=tem_agct
                tem_agct=0
                break
                
        if i+j==len(s)-1:
            if tem_agct>max_agct:
                max_agct=tem_agct
            break
                    
    return max_agct

print(sea(s))
               

Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <ostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef queue< pair<int, int> > qpii;
typedef vector<int> vi;
typedef vector<int, int> vii;
typedef vector<string> vs;
typedef vector< pair<int, int> > vpii;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

char f[1001][1001];
int h,w,n;
int d[1001][1001];

int bfs(pii s) {
  qpii q;
  rep(i,0,h)
    rep(j,0,w)
      d[i][j] = INF;
  q.push(s);
  d[s.first][s.second] = 0;

  int num = 0, hp = 1;
  while(q.size()) {
    pii p = q.front();
    q.pop();

    if(atoi(&f[p.first][p.second]) == hp) {
      num += d[p.first][p.second];
      if(hp == n) break;
      while(q.size()) q.pop();
      rep(i,0,h)
        rep(j,0,w)
          d[i][j] = INF;
      d[p.first][p.second] = 0;
      hp++;
    }

    rep(i,0,4) {
      int my = p.first + dy[i];
      int mx = p.second + dx[i];
      if(0<=my&&my<h && 0<=mx&&mx<w && f[my][mx] != 'X' && d[my][mx] == INF) {
        q.push(pii(my, mx));
        d[my][mx] = d[p.first][p.second] + 1;
      }
    }
  }
  return num;
}

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

  cin >> h >> w >> n;
  pii s;
  rep(i,0,h)
    rep(j,0,w) {
      cin >> f[i][j];
      if(f[i][j] == 'S') {
        s.first = i;
        s.second = j;
      }
    }

  cout << bfs(s) << endl;

	return 0;
}

Measured memory_bytes: 6124
#include<iostream>
using namespace std;
 
int main(){
  
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  
  int x = a/d;
  if(a%d != 0) x++;
  
  int y = c/b;
  if(c%b != 0) y++;
  
  if(x >= y){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
int main(void){
    int b0,b1,b2;
    scanf("%d %d %d",&b0,&b1,&b2);
    if(b0==1){
        if(b1==1) printf("Open\n");
        else printf("Close\n");
    }
    else {
        if(b2==0) printf("Close\n");
        else printf("Open\n");
    }
    return 0;
}



Measured memory_bytes: 2052
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_s)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

str = inputs[0][0]

# body
if $debugFlag
end

if str == "Sunny"
  ans = "Cloudy"
elsif str == "Cloudy"
  ans = "Rainy"
else
  ans = "Sunny"
end

puts ans
    



Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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 (b < a) { a = b; return 1; } return 0; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N, M, Q;
        cin >> N >> M >> Q;
        vllvll acc(N+1, vll(N+1));
        rep(i, 0, M) {
            ll L, R;
            cin >> L >> R;
            ++acc[L][R];
        }
        rep(i, 1, N+1) {
            rep(j, 1, N+1) {
                acc[i][j] += acc[i][j-1];
            }
        }
        rep(i, 1, N+1) {
            rep(j, 1, N+1) {
                acc[i][j] += acc[i-1][j];
            }
        }
        rep(i, 0, Q) {
            ll p, q;
            cin >> p >> q;
            --p;
            ll ans = acc[q][q] - acc[p][q] - acc[q][p] + acc[p][p];
            cout << ans << endl;
        }
        //print2d(acc);
}



Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(j, n) for (int j = 0; j < (n); j++)

typedef long long ll;

int main()
{
   int n,ans,s=0;
   cin>>n;
   vector<int>a(n);
   vector<int>b(n);
   rep(i,n) cin>>a[i];
   ans=a[0];
   rep(i,n) {
     cin>> b[i];
     ans+=b[i];
     }
   s=ans;
   forx(i,1,n){
     ans +=a[i];
     ans -=b[i-1];
     s=max(ans,s);
   }
   if(n==1)s=a[0]+b[0];
   cout<<s<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

long long const MOD = 1000000007LL;

bool judge[1000][1000][1000];

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

    // 0 : A
    // 1 : C
    // 2 : G
    // 3 : T
    long dp[n + 1][4][4][4];
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                for (int l = 0; l < 4; l++) dp[i][j][k][l] = 0;
            }
        }
    }
    
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                if (i == 0 && j == 2 && k == 1) dp[3][i][j][k] = 0;
                else if (i == 0 && j == 1 && k == 2) dp[3][i][j][k] = 0;
                else if (i == 2 && j == 0 && k == 1) dp[3][i][j][k] = 0;
                else dp[3][i][j][k] += 1;
            }
        }
    }

    for (int i = 3; i < n; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                for (int l = 0; l < 4; l++) {
                    dp[i + 1][k][l][0] += dp[i][j][k][l] % MOD;
                    dp[i + 1][k][l][3] += dp[i][j][k][l] % MOD;;
                    if (k == 0 && l == 1) dp[i + 1][k][l][2] = 0;
                    else dp[i + 1][k][l][2] += dp[i][j][k][l] % MOD;;
                    if (k == 0 && l == 2) dp[i + 1][k][l][1] = 0;
                    else if (k == 2 && l == 0) dp[i + 1][k][l][1] = 0;
                    else if (j == 0 && l == 2) dp[i + 1][k][l][1] = 0;
                    else if (j == 0 && k == 2) dp[i + 1][k][l][1] = 0;
                    else dp[i + 1][k][l][1] += dp[i][j][k][l] % MOD;;
                }
            }
        }
    }

    long long res = 0;
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) res += dp[n][i][j][k] % MOD;
        }
    }

    cout << res % MOD << endl;
}


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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define LOOP(i, N) for (int i = 1; i <= (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define RLOOP(i, N) for (int i =(int)N; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

int main(){
  int n,k;
  cin>>n>>k;
  int min=INF;
  int sum=k;
  int ans=1;
  vector<int> v;
  REP(i,n){
    int tmp;
    cin>>tmp;
    v.push_back(tmp);
  }
  while(sum<n){
    sum+=k-1;
    ans++;
  }
  cout<<ans<<endl;
}


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

using namespace std;

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

int main(){
    int a, b;
    cin >> a >> b;
    for (int i = 1; i < 100000; i++){
        if ((8 * i) / 100 == a && (i / 10 == b)){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    
    
}

Measured memory_bytes: 256
//---------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//                                                        NEVER  GIVE  UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define testcases() ll t; cin>>t; while(t--)
#define debug cout<<"Hello\n";
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define debug4(w,x,y,z) cout<<#w<<" "<<w<<" "<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
//------------------------------------------------------------------------------------------------------------------------------

int main()
{
	
	#ifndef ONLINE_JUDGE
	freopen("C:/Users/DELL/Desktop/input.txt", "r", stdin);
	#endif

	fast;
	ll r,c,k;
	cin>>r>>c>>k;
	string str;
	ll ans = 0;
	vector<vector<char>> v(r,vector<char> (c));
	for(ll i=0;i<r;i++)
	{
		cin>>str;
		for(ll j=0;j<c;j++)
			v[i][j]=str[j];
	}
	for(ll i=0;i<(1<<r);i++)
	{
		for(ll j=0;j<(1<<c);j++)
		{
			vector<vector<char>> temp = v;
			for(ll r_=0;r_<r;r_++)
			{
				if(i&(1<<r_))
				{
					for(ll cc=0;cc<c;cc++)
						temp[r_][cc] = 'R';
				}
			}
			for(ll c_=0;c_<c;c_++)
			{
				if(j&(1<<c_))
				{
					for(ll rr=0;rr<r;rr++)
						temp[rr][c_] = 'R';
				}
			}
			ll cnt = 0;
			for(ll x=0;x<r;x++)
			{
				for(ll y=0;y<c;y++)
				{
					if(temp[x][y]=='#')
						cnt++;
				}
			}
			if(cnt==k)
				ans++;
		}
	}
	cout<<ans;
	return 0;
}


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

using namespace std;

int n;
int cost[100001][3];
long long dp[100001][3];
long long rec(int pos , int type){
    if(pos >= n)return 0;
    if(~dp[pos][type])return dp[pos][type];
    long long ans = 0;
    if(type==0){
        ans += max(rec(pos + 1, 1) , rec(pos + 1, 2)) + cost[pos][type];
    }
    if(type == 1){
        ans += max(rec(pos + 1 , 2) , rec(pos + 1 , 0)) + cost[pos][type];
    }
    if(type == 2){
        ans += max(rec(pos + 1 , 1), rec(pos + 1, 0)) + cost[pos][type];
    }
    return dp[pos][type] = ans;

}

int main() {
    cin>>n;
    for(int i = 0 ; i < n; ++i){
        for(int j = 0; j < 3; ++j){
            cin>>cost[i][j];
        }
    }
    memset(dp , -1 , sizeof(dp));
    long long ret0 = rec(0 , 0);
    memset(dp , -1 , sizeof(dp));
    long long ret1 = rec(0 , 1);
    memset(dp , -1 , sizeof(dp));
    long long ret2 = rec(0 , 2);
    cout<<max({ret0 , ret1 , ret2})<<"\n";
}

Measured memory_bytes: 8448
import sys
bbn=1000000007
	
#+++++
		
def main():
	n, m = map(int, input().split())
	ll=[0]*n
	for i in range(m):
		a, b = map(int, input().split())
		ll[a-1] += 1
		ll[b-1] += 1
	
	for v in ll:
		print(v)
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

int main(){
    int a, b;
    cin >> a >> b;
    if(a < b){
        for(int i=0;i<b;i++){
            cout << a;
        }
    }else{
        for(int i=0;i<a;i++){
            cout << b;
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N; cin >> N;
    vector<tuple<int, int, int>> A(N);
    for (int i = 0; i < N; i++) {
        int h, p; cin >> h >> p;
        A[i] = make_tuple(h + p, h, p);
    }
    sort(begin(A), end(A));
    const Int INF = 1e18;
    vector<Int> dp(N+1, INF), dp2;
    dp[0] = 0;
    for (int i = 0; i < N; i++) {
        dp2 = dp;
        int h = get<1>(A[i]), p = get<2>(A[i]);
        for (int j = 0; j < N; j++) {
            if (dp2[j] == INF || dp2[j] > h) {
                break;
            }
            dp[j+1] = min(dp[j+1], dp2[j] + p);
        }
    }
    int ans = 0;
    for (int i = 0; i <= N; i++) {
        if (dp[i] != INF) {
            ans = i;
        }
    }
    cout << ans << '\n';
    return 0;
}


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








int main(){


  string s;
  cin>>s;
  
  int a=0,b=0;
  
  for (int i=0;i<int(s.size());i+=2){
    if (s.at(i)=='1'){
      a++;
    }
  }
  
  for (int i=1;i<int(s.size());i+=2){
    if (s.at(i)=='0'){
      a++;
    }
  }
  
  for (int i=0;i<int(s.size());i+=2){
    if (s.at(i)=='0'){
      b++;
    }
  }
  
  for (int i=1;i<int(s.size());i+=2){
    if (s.at(i)=='1'){
      b++;
    }
  }
  
    
  cout<<min(a,b)<<endl;
  


        
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

template <ll mod>
struct modular {
    ll value;
    modular(ll x = 0) {
        value = x % mod;
        if (value < 0) value += mod;
    }
    modular& operator+=(modular other) {
        if ((value += other.value) >= mod) value -= mod;
        return *this;
    }
    modular& operator-=(modular other) {
        if ((value -= other.value) < 0) value += mod;
        return *this;
    }
    modular& operator*=(modular other) {
        value = value * other.value % mod;
        return *this;
    }
    modular& operator/=(modular other) {
        ll a = 0, b = 1, c = other.value, m = mod;
        while (c != 0) {
            ll t = m / c;
            m -= t * c;
            swap(c, m);
            a -= t * b;
            swap(a, b);
        }
        a %= mod;
        if (a < 0) a += mod;
        value = value * a % mod;
        return *this;
    }
    modular operator+(modular rhs) {
        return modular(*this) += rhs;
    }
    modular operator-(modular rhs) {
        return modular(*this) -= rhs;
    }
    modular operator*(modular rhs) {
        return modular(*this) *= rhs;
    }
    modular operator/(modular rhs) {
        return modular(*this) /= rhs;
    }
    bool operator==(modular rhs) {
        return value == rhs.value;
    };
    bool operator!=(modular rhs) {
        return value != rhs.value;
    };
    bool operator<(modular rhs) {
        return value < rhs.value;
    }
};
template <ll mod>
string to_string(modular<mod> x) {
    return to_string(x.value);
}
template <ll mod>
ostream& operator<<(ostream& stream, modular<mod> x) {
    x.value %= mod;
    if (x.value < 0) x.value += mod;
    return stream << x.value;
}
template <ll mod>
istream& operator>>(istream& stream, modular<mod>& x) {
    stream >> x.value;
    x.value %= mod;
    if (x.value < 0) x.value += mod;
    return stream;
}
const ll mod = 1000003;
using mint = modular<mod>;

mint pw(mint a, ll n) {
    mint res = 1;
    while (n > 0) {
        if (n & 1) {
            res *= a;
        }
        a *= a;
        n >>= 1;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int q;
    cin >> q;
    vector<mint> fact(mod), finv(mod);
    fact[0] = fact[1] = finv[0] = finv[1] = 1;
    for (int i = 2; i < mod; i++) {
        fact[i] = fact[i - 1] * (mint)i;
        finv[i] = finv[i - 1] / (mint)i;
    }
    while (q--) {
        int x, d, n;
        cin >> x >> d >> n;
        mint mx = x, md = d;
        if (d == 0) {
            cout << pw(mx, n) << endl;
            continue;
        }
        if (x == 0) {
            cout << 0 << endl;
            continue;
        }
        mint mz = mx / md;
        int z = mz.value;
        mint res;
        if (n + z - 1 >= mod || z == 0) {
            res = 0;
        } else {
            int y = z + n - 1;
            res = fact[y] * finv[z - 1];
            res *= pw(md, n);
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 16512
import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
N, T = map(int, input().split())
a = list(map(int, input().split()))
cm = [float("inf")] * (N + 1)
cmx = [0] * (N + 1)
for i in range(N):
  cm[i + 1] = min(cm[i], a[i])
  cmx[N - 1 - i] = max(cmx[N - i], a[N - 1 - i])
res = 0
x = 0
for i in range(N + 1):
  x = max(cmx[i] - cm[i], x)
for i in range(N):
  if cmx[i] - a[i] == x:
    res += 1
print(res)

Measured memory_bytes: 59268
#pragma GCC optimize("O3") 

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

#define test(t)		int t; cin >> t; while(t--)
#define f(i, a, b)	for(int (i) = (a); (i) < (b); ++(i))
#define all(a)		(a).begin(), (a).end()
#define endl 		"\n"
#define maxvec(vec)     *max_element(all(vec))
#define minvec(vec)     *min_element(all(vec))
#define maxarr(arr)     *max_element(arr, arr + n)
#define minarr(arr)     *min_element(arr, arr + n)
#define deb(x)		cout << #x << " is " << x << endl;
#define deb2(x,y)	cout << #x << " is " << x << " and " <<  #y << " is " << y << endl;
#define deba(arr)	cout << #arr << " ~ [ "; for(auto n: arr) cout << n << " "; cout << "]" << endl;
#define debap(arr)	cout << #arr << " ~ [ "; for(auto n: arr) cout << n.first << "-" << n.second << " "; cout << "]" << endl;
#define fast 		ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define mx9		1000000007
#define mx7		10000007
#define mx6		1000006
#define mx5		200005
#define inf		1<<30                                 
#define eps		1e-9
#define mod		1000000007
#define PI		3.141592653589793238462643383279502884L

void solve()
{
    ll n;
    cin >> n;
    string s = "";
    while (n > 0) 
    { 
        int rem = n % 26; 
        if (rem == 0) { 
            s += 'z'; 
            n = (n / 26) - 1; 
        } 
        else
        { 
            s +=  'a' + (rem - 1); 
            n /= 26; 
        } 
        //   deb(s)
    } 
    // deb(s.length())
    for(int i = s.length() - 1; i >= 0; i--)
        cout << s[i];
    cout << endl;
}

int main()
{
    fast;
    // test(t)
        solve();
    return 0;
}

Measured memory_bytes: 3668
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }


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

    // ifstream fin(".in");
    // ofstream fout(".in");
i64 a,b;
cin>>a>>b;
cout<<a*b;



    return 0;
  }


Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String args[]) {
        BufferedReader br = null;

        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            String cards = br.readLine();
            if(cards != null) {
                String[] ab = cards.split(" ");
                if("1".equals(ab[0])) {
                    ab[0] = "100";
                }
                if("1".equals(ab[1])) {
                    ab[1] = "100";
                }
                
                int a = Integer.parseInt(ab[0]);
                int b = Integer.parseInt(ab[1]);
                if(a == b) {
                    System.out.println("Draw");
                } else if(a < b) {
                    System.out.println("Bob");
                } else {
                    System.out.println("Alice");
                }
            }
        } catch (IOException ex) {
            System.out.println("wrong input");
        }
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(0);
    
    float l,a,res;
    cin>>l;
    a= l/3.0;
    res= (float)a*a;
    res= res*(float)a;
    printf("%.12f",res);
    return 0;
}
    

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextLong()
    val a = sc.nextLong()
    val b = sc.nextLong()
    println(problem158b(n, a, b))
}

fun problem158b(n: Long, a: Long, b: Long): Long {
    val ab = a + b
    if (a == 0L) return 0
    var nDiv = n / ab
    var nAmari = n % ab
    if (nAmari > a) nAmari = a
    return (nDiv * a) + nAmari
}

Measured memory_bytes: 31520
n=gets
h=gets.split.map(&:to_i)

count =0
loop do
    break if h.all?{|x|x==0}
    l=h.index{|x|x!=0}
    (l...h.size).each{|i|
        break if h[i]==0;
        h[i]-=1
    }
    count +=1
end


print count

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << (ele) << endl
#define print10(ele) cout << fixed << setprecision(10) << (ele) << endl

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  ll d = c - a - b;
  bool ok = d > 0 && d * d > 4 * a * b;

  print(ok ? "Yes" : "No");
  return 0;
}


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

using namespace std;
int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int dx = tx - sx;
    int dy = ty - sy;
    for(int i = 0 ;i < dy; i++){
        cout << "U";
    }
    for(int i = 0; i < dx; i++){
        cout << "R";
    }
    for(int i = 0 ;i < dy; i++){
        cout << "D";
    }
    for(int i = 0; i < dx; i++){
        cout << "L";
    }
    cout << "L";
    for(int i = 0 ;i < dy + 1; i++){
        cout << "U";
    }
    for(int i = 0; i < dx + 1; i++){
        cout << "R";
    }
    cout << "D";
    cout << "R";
    for(int i = 0 ;i < dy + 1; i++){
        cout << "D";
    }
    for(int i = 0; i < dx + 1; i++){
        cout << "L";
    }
    cout << "U";
    return 0;
}

Measured memory_bytes: 256
import sys
n,k = map(int,input().split())
if k == 0:
    print(n**2)
    sys.exit()
count = 0
for i in range(1,n+1):
    tmp_count = max(0,i - k)
    #print(i,n // i,tmp_count,(n // i)* tmp_count + max(0,(n % k)-k+1),max(0,(n % i)-k+1),n % i)
    count += (n // i)* tmp_count + max(0,(n % i)-k+1)

if k == 0:
    print(n**2)
else:
    print(count)

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

#define int long long

int n,e;
ll t;
int x[252521];

ll dp[252521];
constexpr ll INF = 1e18;

inline ll calc(int i,int j){
  return dp[j+1] + max(t,2*(ll)(x[j]-x[i]));
}

struct RMQ{
  int n;
  vl dat;
  RMQ(int _n){
    n=1;
    while(n<_n)n<<=1;
    dat.assign(2*n,INF);
  }
  void set(int x,int v){
    x += n-1;
    dat[x] = v;
    while(x!=0){
      x = (x-1)/2;
      dat[x] = min(dat[2*x+1],dat[2*x+2]);
    }
  }
  ll qmin(int l,int r,int a,int b,int k){
    if(r<=a || b<=l)return INF;
    if(l<=a && b<=r){
      return dat[k];
    }else{
      int m = (a+b)/2;
      return min(qmin(l,r,a,m,2*k+1),qmin(l,r,m,b,2*k+2));
    }
  }
  ll qmin(int l,int r){
    return qmin(l,r,0,n,0);
  }
};

signed main(){
  scanf("%d%d%lld",&n,&e,&t);
  REP(i,n)scanf("%lld",x+i);
  x[n] = e;
  REP(i,n)dp[i] = -1;
  dp[n] = 0;
  // sum of len
  ll ans = e;
  RMQ aa(n),bb(n);
  // calc dp[i] from n-1 to 0
  FORR(i,0,n){
    aa.set(i,2ll*x[i]+dp[i+1]);
    bb.set(i,t       +dp[i+1]);
    // find m s.t. 2dij<t
    int m = upper_bound(x+i,x+n+1,(ll)(t+2ll*x[i])/2ll) - x;
    m--;
    ll xx = aa.qmin(m+1,n) - 2ll*x[i];
    ll yy = bb.qmin(0,m+1);
    dp[i] = min(xx,yy);
  }
  printf("%lld\n",ans+dp[0]);
  return 0;
}


Measured memory_bytes: 5888
use std::io::Read;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

pub trait Parse {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr;
}

impl<'a> Parse for std::str::SplitWhitespace<'a> {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let word = self.next().unwrap();
        word.parse().ok().unwrap()
    }
}

fn vec_357(x: u32, start: u32, end: u32, out: &mut Vec<u32>) {
    for i in vec![3, 5, 7] {
        let xx = x + i * start;
        out.push(xx);
        if start < end {
            vec_357(xx, start * 10, end, out);
        }
    }
}

fn is_357(mut x: u32) -> bool {
    let mut v = Vec::new();
    while x > 0 {
        v.push(x % 10);
        x /= 10;
    }
    v.sort();
    v.dedup();
    v.len() == 3
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let n = iter.to();
    let mut v: Vec<u32> = Vec::new();
    vec_357(0, 1, 10_u32.pow(8), &mut v);
    println!("{}", v.into_iter().filter(|&x| x <= n && is_357(x)).count());
}

Measured memory_bytes: 4352
/*
ID: wangjun30
LANG: C++11
TASK:
*/
#include<iostream>
#include<algorithm>
#include<array>
#include<unordered_map>
#include<map>
#include<set>
#include<list>
#include<stack>
#include<unordered_set>
#include<vector>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
//#include<fstream>
#define int long long
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
int GetSum(int a,int b){
	int start=a;
	int end=b;
	int number=(end-start+1);
	return (start+end)*number/2;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n,m,ans=0;
	cin>>n>>m;
	for(int i=m;i<=n+1;i++){
		int Number=i+1;
		int Start=GetSum(0,i-1);
		int End=GetSum(n-i+1,n);
		ans=(End-Start+1+ans)%1000000007;
	}
	cout<<ans;
	return 0;
}

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

long long mod = 1e9+7;

vector < long long > DFS(int node, vector < vector <int> > &adjList, vector <bool> &visited)
{
	visited[node]=true;
	vector < vector < long long > > waysChildren;
	for (auto x: adjList[node])
	{
		if (!visited[x])
		{
			waysChildren.push_back(DFS(x, adjList, visited));
		}
	}
	if (waysChildren.empty()) return {1,1};
	vector < long long > ans={1,1};
	for (auto &x: waysChildren)
	{
		ans[0] = (ans[0]*x[1])%mod;
		ans[1] = (ans[1]*(x[0]+x[1]))%mod;
	}
	return ans;
}

int main()
{
	int n;
	cin >> n;
	vector < vector <int> > adjList(n+1);
	for (int i=0; i<n-1; ++i)
	{
		int u,v;
		cin >> u >> v;
		adjList[u].push_back(v);
		adjList[v].push_back(u);
	}
	vector < bool > visited(n+1, false);
	// vector < vector <long long> > ways(n+1);
	vector < long long > ans = DFS(1, adjList, visited);
	cout << (ans[0]+ans[1])%mod << "\n";
	return 0;
}

Measured memory_bytes: 21120
#include <iostream>
#include<algorithm>
#include<set>
#include<queue>
#define rep(i,j,n) for(int i=j;i<n;i++)
using namespace std;
#define int long long
int mul[214514];
int divi[214514];
#define inf 1000000007
int bit[114514],n;
struct edge{int u,v,cost;};
edge es[214514];
int zero=0;
signed main(){
    int n,k,x,y;
    cin>>n>>k>>x>>y;
    if(n<=k){
        cout<<x*n<<endl;
    }
    else {
        cout<<k*x+(n-k)*y<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import Control.Monad
import Data.List

-- firstBinary :: (Int -> Bool) -> Int -> Int -> Int
firstBinary _ l r | l == r = l
firstBinary f l r = let m = div (l + r) 2 in if f m then firstBinary f l m else firstBinary f (m + 1) r

data Interval = Interval Int Int

readInterval s = let [l, r] = map read $ words s in Interval l r

instance Eq Interval where
    (Interval l1 r1) == (Interval l2 r2) = l1 == l2 && r1 == r2

instance Ord Interval where
    (Interval l1 r1) <= (Interval l2 r2) = l1 < l2 || (l1 == l2 && r1 <= r2)

main = do
    [n, x]  <- map read . words <$> getLine :: IO [Int]
    as <- sort . map read . words <$> getLine :: IO [Int]
    print $ f as x
    where
        f [a] x = if a == x then 1 else 0
        f (a:as) x
            | a <= x = 1 + f as (x-a)
            | otherwise = 0


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

using namespace std;
int main()
{
    long long a,b,c;
    cin>>a>>b>>c;
    a=abs(a);
    long long d=a/c;
    if(b<d){
        cout<<a-b*c;
        return 0;
    }
    b-=d;
    a%=c;
    if(b%2LL){
        a-=c;
    }
    cout<<abs(a);
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());

		if(x >= a && x <= a + b) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}

	}

}


Measured memory_bytes: 21844
/*
ID: arthurc4
TASK: test
LANG: C++11
*/

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

typedef vector<string> vs;
typedef vector<vs> vvs;

typedef vector<bool> vb;
typedef vector<vb> vvb;

typedef map<string,int> msi;
typedef map<int,int> mii;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll; // note 'single' ls

typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++)

#define REPb(j, d, c) \
for (int j = int(d); j >= int(c); f--)

#define pb \
push_back

#define ff \
first

#define ss \
second

// LL OR INT ???
// DELETED IFSTREAM ???
int main()
{
	//ifstream cin("input.txt");
	//ifstream cin("test.in");
	//ofstream cout("test.out");

	int n, m;
	cin >> n >> m;

	vvll xyz;

	REP(i, 1, n)
	{
		ll x, y, z;
		cin >> x >> y >> z;

		xyz.pb({x, y, z});
	}

	ll max_score = - pow(10, 13);

	for(int i=-1; i<=1; i+=2)
	{
		for(int j=-1; j<=1; j+=2)
		{
			for(int k=-1; k<=1; k+=2)
			{
				vll new_xyz;

				REP(a, 0, n-1)
				{
					new_xyz.pb(ll(i)*xyz[a][0] + ll(j)*xyz[a][1] + ll(k)*xyz[a][2]);
				}

				sort(new_xyz.rbegin(), new_xyz.rend());

				ll score = 0;

				REP(b, 0, m-1)
				{
					score += new_xyz[b];
				}

				max_score = max(max_score, score);
			}
		}
	}

	cout << max_score << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int n=in.nextInt();
			if(n==0)
				return;
			int L[]=new int[2];
			int D[]=new int[2];
			int M[]=new int[2];
			for(int i=0;i<n;i++)
			{
				String str[]=in.next().split(":");
				int h=Integer.valueOf(str[0]);
				int m1=Integer.valueOf(str[1]);
				int m2=in.nextInt();
				int cnt=0;
				if(11<=h&&h<=14)
				{
					L[0]++;
					while(m1!=m2)
					{
						m1=(m1+1)%60;
						cnt++;
					}
					if(cnt<9)
						L[1]++;
				}
				else if(18<=h&&h<=20)
				{
					D[0]++;
					while(m1!=m2)
					{
						m1=(m1+1)%60;
						cnt++;
					}
					if(cnt<9)
						D[1]++;
				}
				else if(21<=h||h<=1)
				{
					M[0]++;
					while(m1!=m2)
					{
						m1=(m1+1)%60;
						cnt++;
					}
					if(cnt<9)
						M[1]++;
				}
			}
			if(L[0]>0)
				System.out.println("lunch "+100*L[1]/L[0]);
			else System.out.println("lunch no guest");
			if(D[0]>0)
				System.out.println("dinner "+100*D[1]/D[0]);
			else System.out.println("dinner no guest");
			if(M[0]>0)
				System.out.println("midnight "+100*M[1]/M[0]);
			else System.out.println("midnight no guest");
		}
	}
}

Measured memory_bytes: 24516
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int main(void) {
	int n, p, ans;
	ll num, i, k;
	cin >> num >> k;
	vector<int> d(num), a(num, INF), r(num);
	rep(i, num) {
		cin >> d[i];
		d[i]--;
	}
	p = n = 0;
	while (a[n] == INF) {
		if (p == k) {
			cout << n + 1 << "\n";
			return 0;
		}
		a[n] = p++;
		n = d[n];
	}
	k -= a[n];
	p -= a[n];
	k %= p;
	ans = n;
	rep(i, k) {
		ans = d[ans];
	}
	cout << ans + 1 << "\n";
	return 0;
}

Measured memory_bytes: 5636
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<cstring>
#include<set>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<cstdio>
#include<cstdlib>
#define reep(n1,n2,n3) for(int n1=n3;n1<n2;n1++)
#define rep(n1,n2) reep(n1,n2,0)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define INF 1e9
using namespace std;
typedef long long int lint;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int,int> > vp;
typedef pair<int,int> pi;
typedef pair<int,pair<int,int> > pii;
typedef vector<string> vs;
const double PI  = acos(-1.0);
int main(){
    string str;
    while(cin>>str){
        int cntj=0,cnti=0;
        reep(i,str.length(),2){
            if(str[i]=='I'&&str[i-1]=='O'){
                if(str[i-2]=='J')cntj++;
                else if(str[i-2]=='I')cnti++;
            }
        }
        cout<<cntj<<endl;
        cout<<cnti<<endl;
    }
}

Measured memory_bytes: 1192
x = int(input())

dp = [0] * 100001

dp[100] = dp[101] = dp[102] = dp[103] = dp[104] = dp[105] = 1

for i in range(106, 100001):
    if dp[i - 100] == 1 or dp[i - 101] == 1 or dp[i - 102] == 1 or dp[i - 103] == 1 or dp[i - 104] == 1 or dp[
        i - 105] == 1:
        dp[i] = 1

print(dp[x])


Measured memory_bytes: 3956
#include<stdio.h>

#define NUMBER 100


void print_array(int array[],int num)
{
	int i;
	
	for(i = 0; i < num - 1; i++){
		
		printf("%d ", array[i]);
	}
	printf("%d\n", array[i]);
	
}
	
void insertSort(int array[],int num)
{
	int i, v, j;
	for(i = 1; i <= num - 1; i++){
		print_array(array, num);
		v = array[i];
		j = i - 1;
		while(j >= 0 && array[j] > v){
			array[j + 1] = array[j];
			j--;
			
		}
		array[j + 1] = v;
	
    }
}

int main(void)
{
	int i, num;
	int array[NUMBER];

	scanf("%d", &num);
	
	for(i = 0; i < num; i++)
	{
		scanf("%d", &array[i]);
	}
	
	insertSort(array , num);
	
	print_array(array , num);
	
	
	return 0;
}


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

int main() {
	int n; cin >> n;
	vector<string> siri(n);
	rep(i, n){
      string a;
      cin >> a;
      siri.at(i)=a;}

	bool ok = true;

	for (int i = 0; i < n - 1; i++) {
string si = siri.at(i);
		string si1 = siri.at(i + 1);
      if (si.at(si.size() - 1) != si1.at(0)) {
			ok = false;
			break;
		}
	}

	if (ok) {
		sort(ALL(siri));
		for (int i = 0; i < n - 1; i++) {
			if (siri.at(i) == siri.at(i + 1)) {
				ok = false;
				break;
			}
		}
	}
	if (ok) cout << "Yes" << endl;
	else cout << "No" << endl;


	}

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

int main() {
  string s;
  cin >> s;
  if(s == "abc" || s == "acb" || s == "bac" || s == "bca" || s == "cab" || s == "cba"){
    cout << "Yes";
  }else{
    cout << "No";
  }
}

Measured memory_bytes: 256
N=int(input())
Blue=[]
for I in range(N):
	Blue.append(input())
M=int(input())
Red=[]
for J in range(M):
	Red.append(input())
W=[]
Max=-101
for K in Blue:
	if K not in W:
		W.append(K)
		R=Blue.count(K)-Red.count(K)
		if R>Max:
			Max=R
if Max<=0:
	print(0)
else:
	print(Max)

Measured memory_bytes: 3064