akhauriyash/Code-Regression huggingface dataset:
#include <vector> 
#include <list> 
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <complex>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(t,c) for(typeof((c).begin()) t=(c).begin(); t!=(c).end(); ++t)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(t,a,b) for(int t=(a);t<(b);++t)
#define REP(t,n)  FOR(t,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

const LL mod = 1000000007;


#define Yes_ cout<<"Yes"<<endl; return 0;
#define No_ cout<<"No"<<endl; return 0;


#define YES_ cout<<"YES"<<endl; return 0;
#define NO_ cout<<"NO"<<endl; return 0;





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

Measured memory_bytes: 256
#include <algorithm>  // sort, 二分探索(lower_bound)など
#include <cmath>      // pow, logなど
#include <complex>    // 複素数
#include <deque>      // 両端アクセスのキュー
#include <iostream>   // 入出力
#include <iterator>
#include <map>
#include <numeric>  // iota(整数列の生成), gcd, lcm
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>  // 順序保持しないmap
#include <unordered_set>  // 順序保持しないset
#include <utility>        // pair
#include <vector>

#define REP(i, n) for (int i = (0); i < (n); ++i)
#define REPR(i, n) for (int i = (n - 1); i >= (0); --i)
#define ALL(container) (container).begin(), (container).end()
#define MAX(x) *max_element(ALL(x))  // 最大値を求める
#define MIN(x) *min_element(ALL(x))  // 最小値を求める

using namespace std;
typedef long long ll;

constexpr size_t INF = 1e9 + 100;
constexpr int MOD    = 1000000007;

int main() {
  size_t N, M, K;
  cin >> N >> M >> K;
  vector<size_t> a(N + 1), b(M + 1);
  size_t A, B;
  a[0] = 0;
  b[0] = 0;
  for (size_t i = 1; i <= N; ++i) {
    cin >> A;
    a[i] = a[i - 1] + A;
  }
  for (size_t i = 1; i <= M; ++i) {
    cin >> B;
    b[i] = b[i - 1] + B;
  }

  size_t max_count = 0, b_i = M;
  for (size_t a_i = 0; a_i <= N; ++a_i) {
    if (a[a_i] > K) {
      break;
    }
    while (a[a_i] + b[b_i] > K) {
      b_i--;
    }
    max_count = max(max_count, a_i + b_i);
  }

  cout << max_count << endl;

  return 0;
}


Measured memory_bytes: 6428
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))
 
using namespace std;
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}
 
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
 
// Problem Specific Parameter:
// Description: 素集合を管理するデータ構造 
// TimeComplexity: 初期化$\mathcal{O}(n)$ 更新$\mathcal{O}(\log n)$
// Verifyed: AOJ DSL_1_A
 
struct Union_find{
	Union_find(int n){par.resize(n),iota(_all(par),0);}
	int find(int x){return (par[x]==x)?x:par[x]=find(par[x]);}
	void unite(int a,int b){a=find(a),b=find(b);par[a]=b;}
	bool same(int a,int b){return find(a)==find(b);}
	vector<int> par;
};
 
using state=tuple<int,int>;
 
const int limit=200010;

map<state,int> cnt;
int ans[limit];
 
int main(void){
	int n,k,l;
	cin >> n >> k >> l;
 
	Union_find uf(n);
	rep(i,k){
		int p,q;
		cin >> p >> q;
		uf.unite(p-1,q-1);
	}

	Union_find uf2(n);
	rep(loop,l){
		int p,q;
		cin >> p >> q;
		uf2.unite(p-1,q-1);
	}
 	
	rep(i,n) cnt[state(uf.find(i),uf2.find(i))]++;
	rep(i,n) ans[i]=cnt[state(uf.find(i),uf2.find(i))];
	
	rep(i,n) cout << (i?" ":"") << ans[i];
	cout << endl;
 
	return 0;
}

Measured memory_bytes: 14336
#include <stdio.h>
static int x, a, b;
int abs(int x) {
    if (x < 0) return -x;
    return x;
}
int dist(int s, int t) {
    return abs(s - t);
}
int main(void) {
    scanf("%d%d%d", &x, &a, &b);
    puts(dist(x, a) < dist(x, b) ? "A" : "B");
    return 0;
}


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

/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)

/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define MP make_pair 

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/* func */
int gcd(int a,int b){return b?gcd(b,a%b):a;}

/*struct*/
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

//#define int ll
//#define int long long

signed main()
{
  string s; cin >> s;
  
  for(int i = 0; i < s.length(); ++i)
   if(i % 2 == 0)
    cout << s[i];
  
  return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set;

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

#define     int                 ll
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
	string s,t; cin >> s >> t;
	int ans = 0;
	for(int i = 0; i < s.length(); ++i){
		if(s[i]!=t[i]){
			ans++;
		}
	}
	cout<<ans<<'\n';
}

signed main() { 
    IO();
    
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}


Measured memory_bytes: 3888
#include<stdio.h>
int main()
{
       int a,b;
       scanf("%d %d",&a,&b);
       if(a>b)
       {
            printf("a > b\n");
       }
       else if(a<b)
       {
            printf("a < b\n");
       }
       else
       {
            printf("a == b\n");
       }
       return 0;
}

Measured memory_bytes: 580
N = int(raw_input())
    
for c in range(N):
    
    B = [0]
    C = [0]
    
    def dfs(depth):
        if depth == 10:
            return True
            
        res = False
        if B[-1] < A[depth]:
            B.append(A[depth])
            res |= dfs(depth+1)
            del B[-1]
        if C[-1] < A[depth]:
            C.append(A[depth])
            res |= dfs(depth+1)
            del C[-1]
        return res
    
    A = map(int, raw_input().split(" "))
    
    print "YES" if dfs(0) else "NO"
    

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

using namespace std;

typedef long long LL;
#define N 1200

const LL mod=1000000007;
LL n,m,p,a,b,c[N][N],cnt,num,V,E;
char s[N];

struct mat{
	LL a,b,c,d;
	mat(LL a=0,LL b=0,LL c=0,LL d=0):a(a),b(b),c(c),d(d){}
	mat operator * (const mat &w) const{
		return mat((a*w.a+b*w.c)%mod,(a*w.b+b*w.d)%mod,(c*w.a+d*w.c)%mod,(c*w.b+d*w.d)%mod);
	}
};

LL pw(LL x,LL k){
	if (k==0) return 1;
	LL tmp=pw(x*x%mod,k>>1);
	return k&1?tmp*x%mod:tmp;
}

mat pw2(mat x,LL k){
	if (k==0) return mat(1,0,0,1);
	mat tmp=pw2(x*x,k>>1);
	return k&1?tmp*x:tmp;
}

int main(){
	scanf("%lld%lld%lld",&n,&m,&p);
	if (p<=1){puts("1"); return 0;}
	for (LL i=1;i<=n;++i){
		scanf("%s",s+1);
		for (LL j=1;j<=m;++j) c[i][j]=s[j]=='#';
	}
	for (LL i=1;i<=m;++i) a+=c[1][i]&&c[n][i];
	for (LL i=1;i<=n;++i) b+=c[i][1]&&c[i][m];
	if (a&&b){puts("1"); return 0;}
	for (LL i=1;i<=n;++i)
		for (LL j=1;j<=m;++j) cnt+=c[i][j];
	V=pw(cnt,p-1);
	if (!a&&!b){printf("%lld\n",V); return 0;}
	if (!a){
		swap(a,b);
		for (LL i=1;i<=max(n,m);++i)
			for (LL j=1;j<=i;++j) swap(c[i][j],c[j][i]);
		swap(n,m);
	}
	for (LL i=1;i<n;++i)
		for (LL j=1;j<=m;++j) num+=c[i][j]&&c[i+1][j];
	E=pw2(mat(cnt,num,0,a),p-1).b;
	printf("%lld\n",(V-E+mod)%mod);
	
	return 0;
}
			

Measured memory_bytes: 10496
import java.util.*;
public class Main {
 public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  // 整数の入力
  // int a = sc.nextInt();
  // スペース区切りの整数の入力
  //int b = sc.nextInt();
  //int c = sc.nextInt();
  // 文字列の入力
  String s = sc.next();
 	if(s.matches(".*A.*") & s.matches(".*B.*")){
 	 System.out.println("Yes");
 	}else{
 		 	 System.out.println("No");
 	}
 }
}


Measured memory_bytes: 23124
/** 
  If comrades that you trust gather around you, hope can take physical form and become visible. That’s what I believe.
  */
#include <bits/stdc++.h>
using namespace std;
/**
  (▀̿Ĺ̯▀̿ ̿) (ง ͠° ͟ل͜ ͡°)ง
  */
const int N = 2e5 + 10;
int lazy[N << 2];
int t[N << 2];
int combine(int lhs, int rhs) {
    return max(lhs, rhs);
}
auto build(int v, int l, int r) -> void {
    if (l == r) {
        t[v] = 0;
        lazy[v] = -1;
        return;
    }
    int mid = (l + r) >> 1;
    build(v << 1, l , mid);
    build(v << 1 | 1, mid + 1, r);  
    t[v] = combine(t[v << 1], t[v << 1 | 1]); 
}
auto push(int v, int l, int r) -> void{
    if (lazy[v] != -1) {
        t[v] = lazy[v];
        if (l < r) {
            lazy[v << 1] = lazy[v];
            lazy[(v << 1) ^ 1] = lazy[v];
        }
    }
    lazy[v] = -1;
}
void update(int v, int l, int r, int x, int y, int to_add) {
    push(v, l, r);
    if (l > y || r < x) return;
    if (l >= x && r <= y) {
        lazy[v] = to_add;
        push(v, l, r);
        return;
    } 
    int mid = (l + r) >> 1;
    update(v << 1, l, mid, x, y, to_add);
    update((v << 1) ^ 1, mid+1, r, x, y, to_add);
    t[v] = combine(t[v << 1], t[(v << 1) ^ 1]);
}
 
int get(int v, int l, int r, int x, int y) {
    if (l > y || r < x) return 0;
    push(v, l, r);
    if (l >= x && r <= y) return t[v];
    int mid = (l + r) >> 1;
    return combine(get(v << 1, l, mid, x, y), 
            get((v << 1) ^ 1, mid+1, r, x, y));
}

int a[N];
int ans[N];
vector<int> g[N], vals[N];
int n;
map<int, int> to_val;
int MAX_T = -1;
auto dfs(int idx, int p = -1) -> void {
    auto nxt = to_val[a[idx]];
    ans[idx] = get(1, 1, MAX_T, 1, nxt - 1) + 1;
    update(1, 1, MAX_T, nxt, nxt, ans[idx]);
    vals[nxt].emplace_back(ans[idx]);
    for (auto &v : g[idx]) {
        if (v == p) continue;
        dfs(v, idx);
    }
    vals[nxt].pop_back();
    update(1, 1, MAX_T, nxt, nxt, vals[nxt].back());
}

auto dfs2(int idx, int p = -1) -> void {
    if (p != -1) ans[idx] = max(ans[idx], ans[p]);
    for (auto &v : g[idx]) {
        if (v == p) continue;
        dfs2(v, idx);
    }
}
auto main() -> int {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
    vector<int> tt;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        tt.emplace_back(a[i]);
    }
    for (int i = 1; i < n; ++i) {
        int u, v; cin >> u >> v;
        g[u].emplace_back(v);
        g[v].emplace_back(u);
    }
    sort(tt.begin(), tt.end());
    tt.erase(unique(tt.begin(), tt.end()), tt.end());

    for (int i = 0; i < tt.size(); ++i) {
        to_val[tt[i]] = i + 1;
    }
    MAX_T = tt.size() + 6;
    build(1, 1, MAX_T);
    for (int i = 1; i < MAX_T; ++i) vals[i].emplace_back(0);
    dfs(1);
    dfs2(1);
    for (int i = 1; i <= n; ++i) cout << ans[i] << '\n';

	return 0;
}


Measured memory_bytes: 52260
import math
N, D = map(int, input().split())
 
# 前から最適に配置せよ
# 一人目は, 1,...,D, D+1, D+2,...,2D+1 を監視
# 二人目は, 2D+2,..., 3D+2, ...,4D+2 を監視
# x人まで繰り返すと、1,...,x(2D+1)まで監視できる
 
# x(2D+1) > N を満たす最小のxは？
# x_min = ceil(N/(2D+1))
 
print(math.ceil(N/(2*D+1)))

Measured memory_bytes: 9156
import java.util.Scanner;
 


//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	int N =sc.nextInt();
	int R =sc.nextInt();
	int ans=0;
	
	if(N<10) {
		p(R+100*(10-N));
	}else {
		p(R);
		//N-  100*10-k = R
	}
	
	
	
	}
}

Measured memory_bytes: 22868
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        n: usize, k: usize,
    }

    let mut ans = 0;

    for i in k + 1..n + 1 {
        let c = n / i;
        ans += c * (i - k);
        let r = n % i;
        if r >= k {
            ans += r - k + if k == 0 { 0 } else { 1 };
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    string S;

    cin >> S;

    if(S=="Sunny") {
        cout << "Cloudy" << endl;
    } else if(S=="Cloudy") {
        cout << "Rainy" << endl;
    } else if(S=="Rainy") {
        cout << "Sunny" << endl;
    }

    return 0;
    
}

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

using namespace std;

int N, M, X, Y;
int x[100], y[100];

int main() {
    cin >> N >> M >> X >> Y;
    for (int i = 0; i < N; i++) cin >> x[i];
    for (int i = 0; i < M; i++) cin >> y[i];
    sort(x, x + N);
    sort(y, y + M);
    if (x[N - 1] < y[0] && x[N - 1] < Y && y[0] > X) cout << "No War" << endl;
    else cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll A, B;
    
    cin >> A >> B;

    cout << max({A+B, A-B, A * B});

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string s;
    cin>>n>>s;
    int x=0;int maxx=0;
    for(int i=0;i<n;i++)
    {
        if (s[i]=='I')x=x+1;
        else if(s[i]=='D')x=x-1;
        maxx=max(maxx,x);
    }
    cout<<maxx;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int N,T;
	int c[1024],t[1024];

	int i;

	int minTime = 0;
	int minCost = 1001;

	
	scanf("%d%d",&N,&T);
	
	for(i=0;N > i;i ++){
		scanf("%d%d",&c[i],&t[i]);
	}

	for(i=0;N > i; i++){
		if(T >= t[i] && minCost >= c[i]){
			minCost = c[i];
		}
	}
	
	if(minCost == 1001){
		printf("TLE");
	}else{
		printf("%d",minCost);
	}

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int a, b, c; cin >> a >> b >> c;
	int out = 3;
	if (a == b)out--;
	if (b == c)out--;
	if (c == a)out--;
	if (a == b && b == c)out++;
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

//sort(a, a + N, greater<int>());
//n+1：マス数
//m：料金所の数
//X:現在地
int main(void){
	int n,m,x;
	int a[101];
	int i,count1=0,count2=0;
	scanf("%d %d %d",&n,&m,&x);
	for(i = 0; i < m; i++)
		scanf("%d",&a[i]);
	for(i = 0; i < m; i++){
		if(a[i] < x)
			count1++;
		else
			count2++;
	}
	if(count1 < count2)
		printf("%d\n",count1);
	else
		printf("%d\n",count2);
}

Measured memory_bytes: 128
/* Author	: Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

/* MACROS SAMPAH */
#define jehian using
#define mau namespace
#define libur std
#define cepet {ios_base::sync_with_stdio(0);cin.tie(NULL);}

jehian mau libur;
/* MACROS FOR TYPE */
typedef long l;
typedef long double ld;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

/* MACROS FOR PRINT */
#define nl printf("\n");
#define sp printf(" ");

/* MACROS FOR FUNCTION */
#define pb push_back
#define mp make_pair
#define eb emplace_back

/* MACROS FOR ATTRIBUTE */
#define fi first
#define se second

unordered_map<ll, ll> cnt;
int main(){
	ll N;
	cin >> N;
	for (ll i = 0; i < N; ++i){
		ll temp;
		cin >> temp;
		++cnt[temp];
		++cnt[temp-1];
		++cnt[temp+1];
	}
	unordered_map<ll, ll>::iterator it;
	ll MAX = -1;
	for (it = cnt.begin(); it != cnt.end(); ++it){
		MAX = max(MAX, it->second);
	}
	cout << MAX << endl;
	return 0;
}

Measured memory_bytes: 4260
#include <iostream>
#include<vector>
using namespace std;
const int INF=1e8;
std::vector<int> c;
std::vector<int> dp(111111);


int main(){
  int N,i,j;

  std::cin >> N;

  c.push_back(1);
  for(i=6;i<=N;i=i*6) c.push_back(i);
  for(i=9;i<=N;i=i*9) c.push_back(i);

  fill(dp.begin(),dp.end(),INF);
  dp[0]=0;

  for(i=0;i<=N;i++){
    for(j=0;j<=c.size();j++){
      if(i>=c[j]){
        dp[i]=min(dp[i],dp[i-c[j]]+1);
      }
    }
  }

std::cout << dp[N] << '\n';

return 0;





}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;


int main(){
    int N;
    cin >> N;
    vector<LL> A,ans;
    LL o=0,e=0;
    P p=make_pair(-(1LL<<62),0);
    for(int i=0;i<N;i++){
        LL a;
        cin >> a;
        A.push_back(a);
        if(p.first<a) p=make_pair(a,i);
        if(i%2) e+=max(0LL,a);
        else o+=max(0LL,a);
    }
    if(p.first<=0){
        cout << p.first << endl;
        cout << N-1 << endl;
        for(int i=N-1;i>p.second;i--){
        cout << i+1 << endl;
        }
        for(int i=0;i<p.second;i++){
        cout << 1 << endl;
        }
        return 0;
    }
    if(o>=e) cout << o << endl;
    else{
        cout << e << endl;
        ans.push_back(1);
        A.erase(A.begin());
    }
    while(1){
        if(A.size()==1) break;
        else if(A.size()==2){
        if(A[0]<A[1]) ans.push_back(1);
        else ans.push_back(2);
        break;
        }
        else if(A.size()==3){
            if(A[0]>=0&&A[2]>=0){
                ans.push_back(2);
            }
            else{
                if(A[0]<=A[2]){
                    ans.push_back(1);
                    ans.push_back(1);
                }
                else{
                    ans.push_back(3);
                    ans.push_back(2);
                }
            }
            break;
        }
        if(A[0]<=0){
            ans.push_back(1);
            ans.push_back(1);
            A.erase(A.begin());
            A.erase(A.begin());
        }
        else if(A[2]<=0){
            ans.push_back(3);
            A[1]+=A[3];
            A.erase(A.begin()+2);
            A.erase(A.begin()+2);
        }
        else{
            ans.push_back(2);
            A[0]+=A[2];
            A.erase(A.begin()+1);
            A.erase(A.begin()+1);
        }
    }
    cout << ans.size() << endl;
    for(int i=0;i<ans.size();i++){
        cout << ans[i] << endl;
    }
    return 0;
}


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

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

}


Measured memory_bytes: 3592
import bisect
n = list(map(int,input().split()))
l = list(map(int,input().split()))

l.sort()
a = bisect.bisect_left(l,l[-1]/2)

if a == 0:
  print(l[-1],l[0])
elif a == len(l)-1:
  print(l[-1],l[-2])
else:
  if abs(l[-1]/2-l[a-1]) <= abs(l[-1]/2-l[a]):
    print(l[-1],l[a-1])
  else:
    print(l[-1],l[a])

Measured memory_bytes: 14052
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
#define out(n) cout << (n) << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    string s; cin >> s;
    int x, y;
    cin >> x >> y;

    vector<int> vx,vy;
    int tcount = 0;
    int fcount = 0;
    REP(i,s.size()+1) {
        if (i == s.size() || s[i] == 'T') {
            if (tcount % 2 == 0) vx.push_back(fcount);
            else vy.push_back(fcount);
            tcount++;
            fcount = 0;
        } else {
            fcount++;
        }
    }

    set<int> dpx,dpy;
    dpx.insert(0);
    dpy.insert(0);
    
    REP(i,vx.size()) {
        set<int> tmp;
        swap(dpx,tmp);
        for(auto m:tmp) {
            dpx.insert(m+vx[i]);
            if (i != 0) dpx.insert(m-vx[i]);
        }
    }

    REP(i,vy.size()) {
        set<int> tmp;
        swap(dpy,tmp);
        for(auto m:tmp) {
            dpy.insert(m+vy[i]);
            dpy.insert(m-vy[i]);
        }
    }
    
    ATYN(dpx.find(x) != dpx.end() && dpy.find(y) != dpy.end())

    return 0;
}

Measured memory_bytes: 768
#include<stdio.h>
#include<string.h>
int main(void){
    char A[201],buf[201];
    int n,i,h;
    while(1){
        scanf("%s",A);
        if(strcmp(A,"-")==0) break;
        scanf("%d",&n);
        for(i=0;i<n;i++){
            scanf("%d",&h);
            strcpy(buf,A+h);
            strncat(buf,A,h);
            strcpy(A,buf);
        }
        printf("%s\n",A);
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
   int n,m,q;cin>>n>>m>>q;
   vector<vector<ll>> a(n+10,vector<ll>(n+10,0)),b(n+10,vector<ll>(n+10,0));
   rep(i,m){
       int l,r;cin>>l>>r;
       a[l][r]++;
   }
   
   for(int i=0;i<=n;i++){
       for(int j=0;j<=n;j++){
           b[i][j+1]=b[i][j]+a[i][j+1];
       }
   }
   rep(i,q){
       int p,q;cin>>p>>q;
       int res=0;
       for(int j=p;j<=q;j++){
           res+=(b[j][q]-b[j][p-1]);
       }
       cout<<res<<endl;
   }
}

Measured memory_bytes: 7736
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a;
    int h;
    int m;
    int s;
    int remain;
    
    
   cin  >> a;
   
   h = a / 3600;
   remain = a % 3600;
   m = remain / 60;
   s = remain % 60;
   
   
   cout << h << ":" << m << ":" << s << endl;

}


Measured memory_bytes: 3116
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

inline int read()
{
	int x=0;char ch=getchar();
	while(ch<'0' || '9'<ch)ch=getchar();
	while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
	return x;
}

const int N=1e5+9;

int n,to[N],nxt[N],beg[N],tot;
vector<int> f[N];

inline void add(int u,int v)
{
	to[++tot]=v;
	nxt[tot]=beg[u];
	beg[u]=tot;
}

bool cmp(int a,int b)
{
	return a>b;
}

inline int dfs(int u,int fa)
{
	for(int i=beg[u];i;i=nxt[i])
		if(to[i]!=fa)
			f[u].push_back(dfs(to[i],u));
	if(!f[u].size())
		return 0;
    sort(f[u].begin(),f[u].end(),cmp);   
	int ret=0;
	for(int i=0;i<f[u].size();i++)
		ret=max(ret,f[u][i]+i+1);
	return ret;
}

int main()
{
	n=read();
	for(int i=2;i<=n;i++)
		add(read(),i);

	printf("%d\n",dfs(1,0));

	return 0;
}


Measured memory_bytes: 11520
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

using lint = long long;
using ldouble = long double;

bool rec(string S) {
    if (S == "ABC") return true;

    string comp;
    int itr = 0;
    while (itr < S.length()) {
        if (S.substr(itr, 3) == "ABC") {
            comp.push_back('X');
            itr += 3;
        } else {
            comp.push_back(S[itr]);
            ++itr;
        }
    }

    if (count(comp.begin(), comp.end(), 'X') == 0) return false;
    for (char c = 'A'; c <= 'C'; ++c) {
        if (find(comp.begin(), comp.end(), c) != comp.end()) continue;

        string T = comp;
        replace(T.begin(), T.end(), 'X', c);
        if (rec(T)) return true;
    }
    return false;
}

int main() {
    string S;
    cin >> S;
    cout << (rec(S) ? "Yes" : "No") << endl;
    return 0;
}



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

int main() {
  int N;
  string x;
  bool Flg = false;
  
  cin >> N;
  
  for (int i = 0; i < N; i++){
    cin >> x;
    if (x == "Y"){
      Flg = true;
      break;
    }
  }
  if (Flg){
    cout << "Four" << endl;
  }else {
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
N,M = map(int,input().split())
if N > M: N,M = M,N
if M-N > 1:
    print(0)
    exit()

MOD = 10**9+7

fac = [1]
for n in range (1,M+2):
    f = (fac[n-1]*n) % MOD
    fac.append(f)

if M-N == 1:
    ans = (fac[M] * fac[N]) % MOD
else:
    ans = (fac[M] * fac[N] * 2) % MOD
print(ans)

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	998244353;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n;
string s;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	ll a,v,b,w,t;
	cin>>a>>v>>b>>w>>t;

	ll la = a+t*v,ra = a-t*v;
	ll lb =  b+t*w,rb = b-t*w;

	if(la >= lb && ra <= rb) cout<<"YES\n";
	else cout<<"NO\n";
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    int x,y;cin>>x>>y;
    x=min(x,4);
    y=min(y,4);
    int m[]={0,3,2,1,0};
    int ans=0;
    if(x==1&&y==1) ans+=4;
    ans+=m[x]+m[y];
    cout<<ans*100000<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#define int long long
#define oku7 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
using namespace std;
std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0,-1 }; // x軸方向への変位
int dy[4] = { 1, 0,-1, 0 }; // y軸方向への変位

std::vector<int> v;
int c[51][51];	//nCr->c[n][r];
long double ave[51];

vector<pair<int,int>> G[100000];
bool visited[1000000];
int dist[1000000];

signed main() {
	int N;
	cin >> N;
	for (int i = 0; i < N - 1; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		G[a].push_back(make_pair(b, c));
		G[b].push_back(make_pair(a, c));
	}
	int Q, K;

	cin >> Q >> K;
	dist[K] = 0;
	queue<pair<int,int>> q;
	visited[K] = true;
	q.push(make_pair(K,0));
	while (!q.empty()){
		pair<int,int> node = q.front();
		q.pop();
		for (pair<int,int> p : G[node.first]) {
			if (visited[p.first]) continue;
			visited[p.first] = true;

			q.push(make_pair(p.first, node.second + p.second));
			dist[p.first] = node.second + p.second;
		}
	}

	for (int i = 0; i < Q; i++) {
		int x, y;
		cin >> x >> y;
		cout << dist[x] + dist[y] << "\n";
	}
	return 0;
}

Measured memory_bytes: 13424
#include<iostream>
#include<cmath>

int main(){
 int n;
 std::cin >> n;
 int ind=-1;
 bool f=0;
 for(int i=n;i>=1;i--){
     if(floor(i*0.08+i)==n){
        f=1;
        ind=i;
        break;
     }
 }
 f==1?std::cout << ind : std::cout << ":(";
 return 0;
}


Measured memory_bytes: 3584
#include<iostream>
#include<algorithm>
#include<string>
 
using namespace std;
 
int const N = 101;
 
int a[N][N], h, w, eY, eX, prefR[N][N], prefC[N][N], dp[N][N][N][N];
string s;
 
void read(){
	cin >> h >> w;
	for(int i=0;i<h;++i){
		cin >> s;
		for(int j=0;j<w;++j){
			if(s[j] == 'o'){
				a[i+1][j+1] = 1;
			}else{
				if(s[j] == '.'){
					//	
				}else{
					eY = i + 1;
					eX = j + 1;
				}
			}
		}
	}
}
 
void buildPrefs(){
	for(int i=1;i<=h;++i){
		for(int j=1;j<=w;++j){
			prefR[i][j] = prefR[i][j-1] + a[i][j];
			prefC[i][j] = prefC[i-1][j] + a[i][j];
		}
	}
}
 
void clearDp(){
	for(int i=1;i<=h;++i){
		for(int j=i;j<=h;++j){
			for(int k=1;k<=w;++k){
				for(int t=k;t<=w;++t){
					dp[i][j][k][t] = -1;//minH, maxH, minW, maxX
				}
			}
		}
	}
}
 
int getRow(int row, int miniW, int maxiW){
	int le = max(miniW, maxiW - eX + 1);
	int ri = min(maxiW, w - (eX - miniW));
	if(le > ri){
		return 0;
	}
	return prefR[row][ri] - prefR[row][le-1];
} 

int getCol(int col, int miniH, int maxiH){
	int le = max(miniH, maxiH - eY + 1);
	int ri = min(maxiH, h - (eY - miniH));
	if(le > ri){
		return 0;
	}
	return prefC[ri][col] - prefC[le-1][col];
} 

int rec(int miniH, int maxiH, int miniW, int maxiW){
	if(dp[miniH][maxiH][miniW][maxiW] != -1){
		return dp[miniH][maxiH][miniW][maxiW];
	}
	dp[miniH][maxiH][miniW][maxiW] = 0;
 
	if(miniW > 1 && miniW - (maxiW - eX) > 1){
		dp[miniH][maxiH][miniW][maxiW] = max(dp[miniH][maxiH][miniW][maxiW], (rec(miniH, maxiH, miniW-1, maxiW) + getCol(miniW-1, miniH, maxiH)));	
	}
	if(maxiW < w && maxiW + (eX - miniW) < w){
		dp[miniH][maxiH][miniW][maxiW] = max(dp[miniH][maxiH][miniW][maxiW], (rec(miniH, maxiH, miniW, maxiW+1) + getCol(maxiW+1, miniH, maxiH)));		
	}
 
	if(miniH > 1 && miniH - (maxiH - eY) > 1){
		dp[miniH][maxiH][miniW][maxiW] = max(dp[miniH][maxiH][miniW][maxiW], (rec(miniH-1, maxiH, miniW, maxiW) + getRow(miniH-1, miniW, maxiW)));	
	}
	if(maxiH < h && maxiH + (eY - miniH) < h){
		dp[miniH][maxiH][miniW][maxiW] = max(dp[miniH][maxiH][miniW][maxiW], (rec(miniH, maxiH+1, miniW, maxiW) + getRow(maxiH+1, miniW, maxiW)));		
	}
 
	return dp[miniH][maxiH][miniW][maxiW];
}
 
void solve(){
	buildPrefs();
	clearDp();
	int ans = 0;
	for(int i=1;i<=h;++i){
		for(int j=1;j<=w;++j){
			ans = max(ans, a[i][j] + rec(i, i, j, j));
		}
	}
	cout << ans << endl;
}
 
int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	read();
	solve();
 
 
 
	return 0;
}

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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    if ( (A + B) > (C + D) ){
        cout << "Left" << endl;
    }else if ( (A + B) < (C + D) ){
        cout << "Right" << endl;
    }else{
        cout << "Balanced" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        int M = sc.nextInt();
        int[] a_list = new int[A];
        int[] b_list = new int[B];

        for(int i = 0; i < a_list.length; i++) {
            a_list[i] = sc.nextInt();
        }
        for(int i = 0; i < b_list.length; i++) {
            b_list[i] = sc.nextInt();
        }

        int a = 0;
        int aMin = 100000;
        int b = 0;
        int bMin = 100000;
        int m = 0;
        int ret = 0;

        for(int i = 0; i < a_list.length; i++) {
            if(aMin > a_list[i]) {
                aMin = a_list[i];
            }
        }
        for(int i = 0; i < b_list.length; i++) {
            if(bMin > b_list[i]) {
                bMin = b_list[i];
            }
        }
        ret = aMin + bMin;

        for(int i = 0; i < M; i++) {
            a = sc.nextInt();
            b = sc.nextInt();
            m = sc.nextInt();
            int x_ret = a_list[a - 1] + b_list[b - 1] - m;
            if(ret > x_ret) {
                ret = x_ret;
            }
        }

        System.out.println(ret);
    }
}


Measured memory_bytes: 133504
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main() {
	int n;
	cin >> n;
	cout << (n + 1) / 2;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h> 
#include<queue>
using namespace std;
int vis[30][30]={};
char a[30][30]={};
int st[4][2]={0,1,1,0,0,-1,-1,0};
struct s{
	int x,y,cnt;
}no,ne,an;
queue
q;
int n,m; 
int main()
{
	int anso,anst,ans,i,j,ANS=0;
	int bfs(struct s aa);
	while(~scanf("%d%d",&n,&m))
	{
		for(i=0;i<n;i++)
			scanf("%s",a[i]);
		for(i=0;i<n;i++)
		{
			for(j=0;j<m;j++)
			{
				if(a[i][j]=='#')
					continue;
				no.x=i;no.y=j;no.cnt=0;
//				vis[no.x][no.y]=1;
				ans=bfs(no);
//				printf("%d.\n",ans);
				ANS=ans>ANS?ans:ANS;
				memset(vis,0,sizeof(vis)); 
					while(!q.empty())
						q.pop();
			}
		}
		printf("%d\n",ANS);
		ANS=0;
		memset(a,0,sizeof(a));
		memset(vis,0,sizeof(vis));
		while(!q.empty())
			q.pop();
	}
} 
int bfs(struct s aa)
{
	int i,ans=0;
	q.push(no);
	vis[no.x][no.y]=1;
	while(!q.empty())
	{
		no=q.front();
//		if(no.x==an.x&&no.y==an.y)
//		{
			
//			return ans;
//printf("%d\n",no.cnt);	
//		}
		for(i=0;i<4;i++)
		{
			ne.x=no.x+st[i][0];
			ne.y=no.y+st[i][1];
			ne.cnt=no.cnt+1;
			if(ne.x<0||ne.y<0||ne.x>=n||ne.y>=m||vis[ne.x][ne.y]||a[ne.x][ne.y]=='#')
				continue;
			vis[ne.x][ne.y]=1;
			ans=ne.cnt>ans?ne.cnt:ans;
			q.push(ne);
		}
		q.pop();
	}
	return ans;
}

Measured memory_bytes: 256
#[allow(dead_code)]
fn main() {
    let (sx, sy, tx, ty) = (i::i(), i::i(), i::i(), i::i());
    let (x, y) = (tx - sx, ty - sy);
    //行き
    for _ in 0..x {
        print!("R")
    }
    for _ in 0..y {
        print!("U")
    }
    //帰り
    for _ in 0..x {
        print!("L")
    }
    for _ in 0..y {
        print!("D")
    }
    //行き
    print!("D");
    for _ in 0..(x + 1) {
        print!("R")
    }
    for _ in 0..(y + 1) {
        print!("U")
    }
    print!("L");
    //帰り
    print!("U");
    for _ in 0..(x + 1) {
        print!("L")
    }
    for _ in 0..(y + 1) {
        print!("D")
    }
    println!("R")
}
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

const int max_n=123457*2+10;
bool is_prime[max_n];
int prime[max_n];
int sieve(int n){
    int p=0;
    rep(i,n+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    FOR(i,2,n+1){
        if(is_prime[i]){
            prime[p++]=i;
            for(int j=2*i;j<=n;j+=i) is_prime[j]=false;
        }
    }
    return p;
}
int sum[123457*2+10];
int main(){
    int n;
    sieve(123456*2+2);
    rep(i,123456*2+2) sum[i+1]=sum[i]+is_prime[i];
    while(cin>>n,n){
        cout<<sum[2*n+1]-sum[n+1]<<endl;
    }
    return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  int S = 0;
  vector<int> A(M);
    
    for (int i = 0; i <= M; i++) {
        cin >> A[i];
        S += A[i];
    }
  

    
    if (S <= N){
    cout << N - S << endl;
    }
    
    else {
    cout << -1 << endl;
    }
}


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

namespace ProgrammingTest
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> ary = new List<int>();
            int len = int.Parse(Console.ReadLine());
            for (int n = 0; n < len; n++)
            {
                string[] vals = Console.ReadLine().Split(' ');
                switch (vals[0])
                {
                    case "0":
                        ary.Add(int.Parse(vals[1]));
                        break;
                    case "1":
                        Console.WriteLine(ary[int.Parse(vals[1])]);
                        break;
                    case "2":
                        ary.RemoveAt(ary.Count - 1);
                        break;
                }
            }
        }
    }
}



Measured memory_bytes: 22076
H,W=list(map(int,input().split()))
ans=[[0 for _ in range(W+2)] for _ in range(H+2)]
for i in range(H):
    for j,x in enumerate(input()):
        if x=='#':
            ans[i+1][j+1]=-10
            for k in (-1,0,1):
                for m in (-1,0,1):
                    ans[i+1+k][j+1+m]+=1
for x in ans:
    for i,y in enumerate(x):
        if y <0:
            x[i]='#'
for x in ans[1:-1]:
    for y in x[1:-1]:
        print(y,end='')
    print('')

Measured memory_bytes: 3444
#include <stdio.h>
int main(void){
 int a,b,c,tmp=0;
 scanf("%d",&a);
 scanf("%d",&b);
 scanf("%d",&c);
 tmp=a;
 a=b;
 b=tmp;
 tmp=a;
 a=c;
 c=tmp;
 printf("%d %d %d",a,b,c);
}


Measured memory_bytes: 1676
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <utility>
#include <queue>

using namespace std;

#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int n,l,k,a[200100],b[200100];
bool vis_road[200100],vis_rail[200100];
map<int,vi> road_list,rail_list;
map<ii,int> ans;

int main()
{
	scanf("%d%d%d",&n,&l,&k);
	for(int i=0,p,q;i<l;i++) {
		scanf("%d%d",&p,&q);
		road_list[p].pb(q);
		road_list[q].pb(p);
	}
	for(int i=0,p,q;i<k;i++) {
		scanf("%d%d",&p,&q);
		rail_list[p].pb(q);
		rail_list[q].pb(p);
	}
	//mark all city with its root
	//road
	for(int i=1;i<=n;i++) {
		if(!vis_road[i]) {
			vis_road[i] = true;
			queue<int> qi;
			qi.push(i);
			a[i] = i;
			while(!qi.empty()) {
				int qf = qi.front(),sz = road_list[qf].size();
				qi.pop();
				for(int j=0;j<sz;j++) {
					int now = road_list[qf][j];
					if(!vis_road[now]) {
						vis_road[now] = true;
						qi.push(now);
						a[now] = i;
					}
				}
			}
		}
	}
	//rail
	for(int i=1;i<=n;i++) {
		if(!vis_rail[i]) {
			vis_rail[i] = true;
			queue<int> qi;
			qi.push(i);
			b[i] = i;
			while(!qi.empty()) {
				int qf = qi.front(),sz = rail_list[qf].size();
				qi.pop();
				for(int j=0;j<sz;j++) {
					int now = rail_list[qf][j];
					if(!vis_rail[now]) {
						vis_rail[now] = true;
						qi.push(now);
						b[now] = i;
					}
				}
			}
		}
	}
	for(int i=1;i<=n;i++) ans[mp(a[i],b[i])]++;
	for(int i=1;i<=n;i++) {
		if(i>1) printf(" ");
		printf("%d",ans[mp(a[i],b[i])]);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 49704
def main():
    s=input()
    if s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]:
        print("Yes")
        return
    if s[0]==s[2] and s[1]==s[3] and s[0]!=s[1]:
        print("Yes")
        return
    if s[0]==s[3] and s[1]==s[2] and s[0]!=s[1]:
        print("Yes")
        return
    print("No")
    return

if __name__=="__main__":
    main()


Measured memory_bytes: 3064
import sys
n,y = map(int,input().split())
 
ans = 0
for i in range(n+1):
    for j in range(n+1-i):
        k = n - i - j
        m = 10000 * i + 5000 * j + 1000 * k
        if m == y:
            print(str(i)+" "+str(j)+" "+str(k))
            sys.exit()
print("-1 -1 -1")

Measured memory_bytes: 40428