akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 200005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
 vector<int> vi[maxii];
 vector<int>::iterator child;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];


int main()
{
  string a[105];
  int n,m;
  cin>>n>>m;
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  for(int i=0;i<n;i++)
  {
      cout<<a[i]<<endl;
      cout<<a[i]<<endl;
  }

}






Measured memory_bytes: 8332
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>

using namespace std;

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
	
int main(){
    double N,K,MAX = 0;
    cin >> N >> K;
    vector<double> p(N,0);
    vector<double> ans(N,0);

    for(ll i = 0;i < N;i++){
        cin >> p[i];
        if(i == 0){
            ans[i] = (p[i] + 1)/2;
        }else{
            ans[i] = ans[i - 1] + (p[i] + 1)/2;
        }
    }

    MAX = ans[K - 1];

    for(ll i = K;i < N;i++){
      MAX = max(MAX,ans[i] - ans[i - K]);
    }

    cout << fixed << MAX << endl;

    return 0;

}

Measured memory_bytes: 3328
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int px = 0; int py = 0; int pt = 0;

		for (int i = 0; i < N; i++) {
			int t = sc.nextInt();
			int x = sc.nextInt();
			int y = sc.nextInt();
			int dt = t - pt;
			int dist = Math.abs(px - x) + Math.abs(py - y);

			if (dt >= dist && dt % 2 == dist % 2) {
				px = x;
				py = y;
				pt = t;
				continue;
			} else {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}

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

int main() {
  string s;
  cin >> s;
  int q;
  cin >> q;
  string t;
  rep(qi,q) {
    int ty;
    cin >> ty;
    if (ty == 1) {
      swap(s,t);
    } else {
      int f; char c;
      cin >> f >> c;
      if (f == 1) {
        t += c;
      } else {
        s += c;
      }
    }
  }
  reverse(t.begin(), t.end());
  t += s;
  cout << t << endl;
  return 0;
}

Measured memory_bytes: 1128
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<map>
#include<vector>

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

using namespace std;

typedef long long ll;
int a,b,c,d;

int main(){
  cin >> a>> b >> c >> d;
  if(abs(a-c) <= d) {
    cout << "Yes" << endl;
  }
  else if(abs(a-b) <= d && abs(b-c) <= d){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
  return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;

const int INF=1e9;
const int MOD=1e9+7;

int main(){
    string s; cin >> s;
    map<char,ll> ma;
    ll N=s.size();
    for(int i=0;i<N;i++){
        ma[s[i]]++;
    }
    ll ans=N*(N-1)/2+1;
    for(auto it=ma.begin();it!=ma.end();it++){
        ll res=(it->second)*(it->second-1)/2;
        ans-=res;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3748
N, Q = map(int, input().split())
S = input()
S += "X"
count_AC = [0 for i in range(N + 1)]
for i in range(N):
    if S[i] + S[i + 1] == "AC":
        count_AC[i + 1] = count_AC[i] + 1
    else:
        count_AC[i + 1] = count_AC[i]


for i in range(Q):
    l, r = map(int, input().split())
    print(count_AC[r - 1] - count_AC[l - 1])


Measured memory_bytes: 6208
// https://atcoder.jp/contests/agc024/tasks/agc024_c
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

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

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: usize,
        a: [i64; n]
    };


    let mut total = 0;
    let mut last = 0;
    let mut isok = a[0] == 0;
    for i in (0..n).rev() {
        if last <= 1 {
            total += a[i];
        } else if last - 1 == a[i] {
            // ok
        } else if last <= a[i] {
            total += a[i];
        } else {
            isok = false;
        }
        last = a[i];
    }

    if !isok {
        println!("-1");
    } else {
        println!("{}", total);
    }
}


Measured memory_bytes: 8444
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> vpi;
 
const long long MOD = 998244353;
const long long mod = 1000000007;
const long long INF = 10000000000000;
 
#define itn int
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
 
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
 
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
/////////////////////////
//重み付きUnionFind-Tree
template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};
int main(void){
   int n,m; scanf("%d%d",&n,&m);
   UnionFind<int> UF(n);
   rep(i,m){
      int l,r,d;scanf("%d%d%d",&l,&r,&d);
      l--,r--;
      if(UF.issame(l,r)){
         if(UF.diff(l,r) != d){
            cout << "No" << endl;
            return 0;
         }
      }else{
         UF.merge(l,r,d);
      }
   }
   cout << "Yes" << endl;
   return 0;
}

Measured memory_bytes: 1408
import sys
input = sys.stdin.readline

n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cnt = 0
for i in range(n):
    x -= a[i]
    cnt += 1
    if x < 0:
        cnt -= 1
        break
if x > 0:
    cnt -= 1
print(cnt)

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

int main() {
	string a,b,s; cin >> a >> b;
	s = a + b;
	int is = stoi(s);
	int rt = (int)sqrt(is);
	if (rt * rt == is) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

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

int main(){
	int N, Y, x, y, z;
	
	cin >> N >> Y;  
	
	for (x=0; x<=Y/10000; x++)   
	  for (y=0; y<=Y/5000; y++)   
	  {
	  	    z = N - x - y;
	    	if (z>=0 && x*10000+y*5000+z*1000==Y)
	    	{
	    		cout << x << " " << y << " " << z;
	    		return 0;
	    	}
	  }
	
	cout << "-1 -1 -1";
	return 0;
}

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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

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

    set<int> s;
    s.insert(1);

    for (int i = 2; i < 40; i++) {
        int b = 2;
        while (pow(i, b) <= 1000) {
            s.insert(pow(i, b));
            b++;
        }
    }

    for (int i = x; i > 0; i--) {
        if (s.count(i) == 1) {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}
 
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
 
#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e3 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, x, y;
vi adj[N];
int d[N][N];

void bfs (int s)
{
    queue<int> q;
    vector<bool> used(n);
    
    q.push(s);
    used[s] = true;
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int u : adj[v]) {
            if (!used[u]) {
                used[u] = true;
                q.push(u);
                d[s][u] = d[s][v] + 1;
            }
        }
    }
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);	
	cin >> n >> x >> y;
	FOR (i, 1, n - 1)
	{
	    adj[i].pb(i + 1);
	    adj[i + 1].pb(i);
	}
	
	adj[x].pb(y);
	adj[y].pb(x);
	FOR (i, 1, n) bfs(i);
	
	int ans[n + 1] = {};
	FOR(i, 1, n)
	    FOR(j, i + 1, n)
	        ans[d[i][j]]++;
	
	FOR(i, 1, n - 1) cout << ans[i] << endl;
}















Measured memory_bytes: 31616
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define Ifor(i, a, b) for (int i = int(a); i < int(b); i++)
#define Dfor(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define Trav(e, v) for (auto& e : v)
#define pb push_back
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<ii>;
template <typename T> bool ckmin (T& a, T b) { return (b < a) ? a = b, 1 : 0; }
template <typename T> bool ckmax (T& a, T b) { return (b > a) ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int n, m;
	cin >> n >> m;
	cout << (1800 * m + 100 * n) * (1 << m) << '\n';
}



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

using namespace std;

void Main() {
    long long a, b, c;
    cin >> a >> b >> c;

    bool s = false;
    long long d = c - a - b;
    if (d > 0 && d * d > 4 * a * b) {
        s = true;
    }
    cout << (s ? "Yes" : "No") << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3596
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define mod  1073741824
#pragma GCC optimization ("O3")
using namespace std;
const int N = 100*1000+5;
#define all(x) begin(x),end(x)
int main()
{
   
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    long long int n,a,b,c=0,m =1e18;
    cin >> n >> a;
    vector<long long int> v(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }   
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    for (int i = a; i < n; ++i)
    {
	    c += v[i];
    }
    cout << c << "\n";
    return 0;
}


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

#define int long long
#define fast_io(); 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 all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    int a,b;
    cin>>a>>b;

    int ans=a*b/__gcd(a,b);

    cout<<ans;

    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main(){
  char s[2000000];
  cin>>s;
  long long sum=0,q;
  for(int i=0;s[i]!='\0';i++) q++;
  
  for(int i=0;i<q;i++){

    int a=(char)s[i]-48;
    sum+=(unsigned char)a;
  }

  if(sum%9==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3792
#include<cstdio>
int cnt[2];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        int su;
        scanf("%d",&su);
        if(su%2 == 1){
            cnt[0]++;
        }else if(su%4 == 0){
            cnt[1]++;
        }
    }
    if(cnt[0] <= cnt[1]){
        printf("Yes\n");
    }else if(cnt[0] - cnt[1] == 1 && cnt[0] + cnt[1] == n){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int

struct edge
{
  int to, cost;
};
typedef std::vector<std::vector<edge>> graph;
const ll MOD = 1000000007;
using namespace std;

ll gcd(ll n, ll m)
{
  if (n < m)
  {
    ll tmp = m;
    m = n;
    n = tmp;
  }
  if (m == 0)
  {
    return n;
  }
  return gcd(m, n % m);
}

int main()
{
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll g = gcd(c, d);
  ll l = (c / g) * (d / g) * g;
  ll co = (b / c - (a - 1) / c) + (b / d - (a - 1) / d) - (b / l - (a - 1) / l);

  cout << b - a + 1 - co << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		for (int i = 1; i <= s.length(); i++) {
			if (i % 2 != 0) {
				System.out.print(s.charAt(i - 1));
			}
		}
		in.close();
	}
}

Measured memory_bytes: 29164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

int main() {
  int N, M; cin >> N >> M;
  vector<pair<int, int>> x(N);
  rep(i, N) cin >> x[i].first >> x[i].second;
  sort(all(x));

  ll ans = 0LL;
  int idx = 0;
  priority_queue<int> q;
  for (int i = 1; i <= M; i++) {

    while (x[idx].first <= i) {
      q.push(x[idx].second);
      idx++;
    }

    if (!q.empty()) {
      ans += (ll)q.top();
      q.pop();
    }

  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1660
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	pair<char,int> d_p[10000];
	for(int n,m;scanf("%d%d",&n,&m),n;){
		int psum=0;
		for(int i=0;i<n;i++){
			scanf("%d%d",&d_p[i].second,&d_p[i].first);
			psum+=d_p[i].first*d_p[i].second;
		}
		sort(d_p,d_p+n);
		for(int i=n-1;i>=0;i--){
			if(m==0)	break;
			int deltam=min(d_p[i].second,m);
			psum-=d_p[i].first*deltam;
			m-=deltam;
		}
		printf("%d\n",psum);
	}
	return 0;
}

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

int main(){
	
	int n,k;
	cin >> n >> k;
	int arr[n+1];
	for(int i=1;i<=n;i++) cin >> arr[i];
	// this is already given in sorted order

	int dp[k+1]={0};
	// dp[i] ---> 1/0 denotes the starting player will win or loose 
	// if i stones are left
	
	// dp[0] = 1;
	for(int i=1;i<n;i++) dp[arr[i]] = 1;

	for(int i=1; i<=k ;i++){
		if(dp[i]==1) continue;

		bool win = 0;
		for(int j=1;j<=n;j++){
			if(arr[j]>i) continue;
			if(dp[i - arr[j]] == 0){
				win = 1; break;
			}
		}
		if(win) dp[i] = 1;
		else dp[i] = 0;
	}

	// cout << endl;
	// for(int i=0;i<=k;i++) cout << dp[i] << " ";
	// cout << endl;

	if(dp[k]==1) cout << "First" << endl;
	else cout << "Second" << endl;

	return 0;
}

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

int main(){
    int i, c[26] = {};
    string s;
    cin >> s;
    for(i=0; i<s.length(); i++){
        if(c[(int)s[i]-'a'] == 0){
            c[(int)s[i]-'a']++;
        }else{
            cout << "no";
            return 0;
        }
    }
    cout << "yes";
    return 0;
}

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

#define FAST_IO ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define khela_shuru int main()
#define khela_shesh return 0
#define MOD 1000000007
#define PI acos(-1)
#define ll long long
#define vi vector<int>
#define vii vector <pair<int, int>>
#define FOR(i,a,b) for(int (i)=(a); i<(b); i++)
#define en '\n'

khela_shuru{

    ///Balsal jinish daka dakir kaaj ekhane

    FAST_IO;

    /// Bhulbhal coding shuru ekhan theke

    int r{};
    cin >> r;

    double c = 2 * PI * r;

    cout << fixed << setprecision(3) << c << endl;

    khela_shesh;
}


Measured memory_bytes: 3796
#include <cstdio>
#include <set>
std::set < char > S;
char g;
int main()
{
	do
	{
		g = getchar();
		S.insert(g);
	}
	while (g == 'N' || g == 'W' || g == 'S' || g == 'E');
	puts(((S.find('N') != S.end()) == (S.find('S') != S.end())) && ((S.find('W') != S.end()) == (S.find('E') != S.end())) ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 256
#pragma region
// {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
// }}}
#pragma endregion


void main() {
    int h,w;
    R(h,w);
    map<int,int> mp; // 終點，起點
    multiset<int> S; // 需要移動步數
    REP(i,w) {
        mp[i]=i;
        S.insert(0);
    }
    REP(i,h) {
        int A,B;
        R(A,B);
        --A;
        // [A,B)不能往下，從mp中移除，同時找B左邊最大的點
        auto it=mp.lower_bound(A);
        int l=-1;
        while ( it!=mp.end() && it->first<=B ) {
            chmax(l,it->second);
            int x=it->first-it->second;
            S.erase(S.find(x));
            mp.erase(it++);
        }
        // 更新B的位置
        if ( l!=-1 && B<w ) {
            mp[B]=l;
            S.insert(B-l);
        }
        int ans=-1;
        if ( SZ(S) ) {
            ans=*S.begin()+(i+1);
        }
        W(ans);
    }
}

}} // {{{ main
int main() { unolight::main(); return 0; }
// }}}

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

int main(){
    ll N;cin>>N;
    ll D[N][2];
    vector<bool> f(N,false);
    rep(i,N){
        cin>>D[i][0]>>D[i][1];
        if(D[i][0]==D[i][1]) f[i]=true;
    }

    rep(i,N-2){
        if(f[i]==true && f[i+1]==true && f[i+2]==true){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


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

#define vi vector<int>
#define vl vector<long long>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define MOD 1e9+7

template<class T> bool chmax(T &a, const T & b) {
    if (a<b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> bool chmin(T &a, const T & b) {
    if (a>b) {
        a = b;
        return true;
    }
    return false;
}

const int MAX_N = 110;
struct edge {int to, cost;};
//vector < vector<int> > G;
vector< vector<edge> > es;
ll d[MAX_N][MAX_N];
int V, E;

void warshallfloyd() {
    REP(j, V) {
        REP(i, V) {
            if (d[i][j] == INF) continue;
            REP(k, V) {
                if (d[j][k] == INF) continue;
                chmin(d[i][k], d[i][j]+d[j][k]);
            }
        }
    }
}

int main() {
    cin >> V >> E;
    es.resize(V);
    REP(i, V) {
        REP(j, V) {
            if (i == j) d[i][j] = 0;
            else d[i][j] = INF;
        }
    }
    REP(i, E) {
        int s, t, w;
        cin >> s >> t >> w;
        d[s][t] = w;
    }
    warshallfloyd();
    REP(i, V) {
        if (d[i][i] < 0) {
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }
    REP(i, V) {
        REP(j, V) {
            if (j == V-1) {
                if (d[i][j] == INF) cout << "INF" << endl;
                else cout << d[i][j] << endl;
            } else {
                if (d[i][j] == INF) cout << "INF" << ' ';
                else cout << d[i][j] << ' ';
            }
        }
    }
    return 0;
}


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

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,p,x;
	while(cin>>N) {
		VI T(N);
		REP(i, N) cin>>T[i];
		cin>>M;
		ll ans=accumulate(ALL(T),0LL);
//		DD(ans);
		REP(i, M) {
			cin>>p>>x;
			p--;
//			DD(ans);DD(p);DD(x);
			cout<<ans-T[p]+x<<endl;
		}
	}
	
	return 0;
}


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

#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T& _t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T& _t) { for (auto& _e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(8); } } pre__;



int main(void) {
	int X, A;
	cin >> X >> A;
	if (X < A) {
		cout << 0 << endl;
		return 0;
	}
	else {
		cout << 10 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
   string s, t;
   cin >> s >> t;
   string str;
   for(int i=0;i<s.length();i++)
   {
       str += s[i];
       str += t[i];
   }
   cout << str << endl;
}

Measured memory_bytes: 256
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const a = parseInt(args[0][0], 10)
	const b = parseInt(args[0][1], 10)
	const c = parseInt(args[0][2], 10)
	const d = parseInt(args[0][3], 10)
	if (Math.abs(a - c) <= d || (Math.max(Math.abs(a - b), Math.abs(b - c)) <= d)) console.log('Yes')
	else console.log('No')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		sc.close();
		int black = h*W + H*w - h*w;
		int white = H*W - black;
		System.out.println(white);
	}

}

Measured memory_bytes: 25300
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast int x = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
ll ans;
void solve()
{
    map<string,ll>mp;
    ll n;cin>>n;
    for(ll i=0;i<n;i++)
    {
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<mp.size()<<endl;
}
int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    //int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 19252
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstdlib>
#define cmax(a,b) (a<(b)?a=(b),1:0)
#define cmin(a,b) (a>(b)?a=(b),1:0)
#define dmin(a,b) ((a)<(b)?(a):(b))
#define dmax(a,b) ((a)>(b)?(a):(b))
#define CL fclose(stdin),fclose(stdout)
namespace io
{
	int F()
	{
		int n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
	long long G()
	{
		long long n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
}
struct edge
{
	int to;
	int next;
}e[333333];
int pe=111111;
int deg[111111];
void insert(int a,int to)
{
	e[pe]=(edge){to,e[a].next};
	e[a].next=pe++;
	deg[to]++;
}
int f[111111],g[111111];
void dfs(int o,int fa)
{
	if(deg[o]==1){g[o]=1;return;}
	for(register int p=e[o].next;p;p=e[p].next)
		if(e[p].to!=fa)
		{
			dfs(e[p].to,o);
			if(g[e[p].to])++g[o];
				else f[o]+=f[e[p].to];
		}
	if(g[o]>1)f[o]+=g[o]-1,g[o]=0;
		else if(g[o]==1&&deg[o]-(o!=fa)!=1)g[o]=0;
}
int main()
{
	int n=io::F();
	for(register int i=1;i<n;++i)
	{
		int x=io::F(),y=io::F();
		insert(x,y);
		insert(y,x);
	}
	for(register int i=0;i<n;++i)
		if(deg[i]>2){dfs(i,i);printf("%d\n",f[i]);return 0;}
	puts("1");
	return 0;
}



Measured memory_bytes: 6144
#include <stdio.h>
#include <string.h>


int main()
{
  int i, j, k, n, lenx, leny, maxl = 0;
  int c[1001][1001];
  char X[1000] = {}, Y[1000] = {};
  
  scanf("%d", &n);
  
  for (i = 0; i < n; i++) {
    scanf("%s", X);
    scanf("%s", Y);
    
    lenx = strlen(X);
    leny = strlen(Y);
    
    for (j = 1; j <= lenx; j++) {
      c[j][0] = 0;
    }
    for (k = 1; k <= leny; k++) {
      c[0][k] = 0;
    }
    
    for (j = 1; j <= lenx; j++) {
      for (k = 1; k <= leny; k++) {
        if (X[j - 1] == Y[k - 1]) {
          c[j][k] = c[j - 1][k - 1] + 1;
        } else if (c[j - 1][k] > c[j][k - 1]) {
          c[j][k] = c[j - 1][k];
        } else {
          c[j][k] = c[j][k - 1];
        }
        if (maxl < c[j][k]) {
          maxl = c[j][k];
        }
      }
    }
    printf("%d\n", maxl);
    maxl = 0;
  }
  
  return 0;
}

Measured memory_bytes: 4516
#include <bits/stdc++.h>
using namespace std;
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
typedef long long ll;
typedef long double ld;
bool E[105][105], used[105];
int N, match[105];
bool path(int x) {
	if (x == -1) return true;
	if (used[x]) return false;
	used[x] = true;
	for (int i = 0; i < N; ++i)
		if (E[x][i] && path(match[i])) {
			match[i] = x;
			return true;
		}
	return false;
}
int A[105], B[105], C[105], D[105];
int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		scanf("%d%d", &A[i], &B[i]);
	}
	for (int i = 0; i < N; ++i) {
		scanf("%d%d", &C[i], &D[i]);
	}
	for (int i = 0; i < N; ++i)
		for (int j = 0; j < N; ++j)
			if (A[i] < C[j] && B[i] < D[j]) {
				E[i][j] = true;
			}
	memset(match, -1, sizeof(match));
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		memset(used, 0, sizeof(used));
		if (path(i)) ++ans;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256
import java.util.Map.Entry;
import java.util.*;
import java.math.*;
import org.w3c.dom.css.Counter;
  
public class Main{
    public static void main(final String[] args){
 
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        long An = 1;
        long temp =1;
        int flag=0;
        //final long answer=1;
        final long max = 1000000000000000000l;


        for(long i = 0; i < N; i++) {
            temp = sc.nextLong();
            if(temp == 0){
                System.out.println(0);
               return;
            }else if(max / temp <An){
                flag = 1;
                An =1;
            }else{
                An = An * temp;
            }
        }

        if(flag != 0){
            System.out.println(-1);
        }else{
            System.out.println(An);
        }
    
    }
}

Measured memory_bytes: 59892
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// スペース区切りの整数の入力
		int n = sc.nextInt();

		int c = 0;
		int o = n+1;

		for ( int i=0; i<n; i++ ) {
			int p = sc.nextInt();
			if ( o > p ) {
				c++;
				o = p;
			}
		}
		System.out.println(c);
	}
}

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

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

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using ld = long double;

template <typename T>
int sz(T &x) {
  return (int)(x.size());
}

const int inf = 1'000'000'007;

vector<int> val;
map<int, int> pos;

void solve() {
  int n;
  cin >> n;
  val.clear(), val.resize(n);
  vector<int> all;
  for (int i = 0; i < n; ++i) {
    cin >> val[i];
    pos[val[i]] = i;
    all.push_back(val[i]);
  }
  sort(all.begin(), all.end());
  int ans = 0;
  for (int i = 0; i < sz(all); ++i) {
    if (pos[all[i]] % 2 != i % 2) {
      ans++;
    }
  }
  cout << ans / 2 << "\n";
}

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

  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 8660
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int c = 5;
	int ans = 0;
	int rsd = INF;
	while( c-- ){
		int t; cin >> t;
		ans += t + ((10-t%10))%10;
		if( t%10 != 0 ){
			rsd = min( rsd, t%10 );
		}
	}
	if( rsd == INF ){
		cout << ans << endl;
	} else {
		cout << ans - (10-rsd) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

int count;
int main() {
    string s;
    cin >> s;
    size_t t = s.size();
    string a = to_string(t - 2);
    cout << s[0] << a << s[t - 1] << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#define N 1007
#define M 2002
#define P 1000000007
using namespace std;
int Pow[M],n,m,u[M],v[M],w[M],e[M],f[N],p[N],wp[N],dep[N],delta[M],ee[M];
vector < pair <int,int> > to[N];
bool cmp1(int x,int y){return w[x]<w[y];}
bool cmp2(int x,int y){return delta[x]<delta[y];}
int find(int x){return f[x]==x ? x:f[x]=find(f[x]);}
void dfs(int x){
    for(pair <int,int> i:to[x]){
        int y=i.first;
        if(y==p[x])continue;
        p[y]=x,wp[y]=i.second;
        dep[y]=dep[x]+1,dfs(y);
    }
}
int get(int x,int y){
    int res=0;
    while(dep[x]>dep[y])res=max(res,wp[x]),x=p[x];
    while(dep[y]>dep[x])res=max(res,wp[y]),y=p[y];
    while(x!=y)res=max(res,max(wp[x],wp[y])),x=p[x],y=p[y];
    return res;
}
int main(){
    Pow[0]=1;
    for(int i=1;i<M;++i)Pow[i]=Pow[i-1]*2%P;
    long long s=0;
    scanf("%d%d%lld",&n,&m,&s);
    for(int i=1;i<=m;++i)scanf("%d%d%d",&u[i],&v[i],&w[i]);
    for(int i=1;i<=m;++i)e[i]=i;
    sort(e+1,e+m+1,cmp1);
    for(int i=1;i<=n;++i)f[i]=i;
    long long mst=0;
    for(int i=1;i<=m;++i){
        int fu=find(u[e[i]]),fv=find(v[e[i]]);
        if(fu!=fv){
            to[u[e[i]]].push_back(make_pair(v[e[i]],w[e[i]]));
            to[v[e[i]]].push_back(make_pair(u[e[i]],w[e[i]]));
            mst+=w[e[i]];
            f[fu]=fv;
        }
    }
    dep[1]=1,dfs(1);
    for(int i=1;i<=m;++i)delta[i]=w[i]-get(u[i],v[i]);
    if(s==mst){
        int cnt=0;
        for(int i=1;i<=m;++i)cnt+=delta[i]==0;
        printf("%d",1LL*(Pow[cnt]+P-2)*Pow[m-cnt]%P);
    }
    else{
        for(int i=1;i<=m;++i)e[i]=i;
        sort(e+1,e+m+1,cmp2);
        int ans=0;
        for(int i=1;i<=m;++i)
            if(s==mst+delta[e[i]])ans=(ans+Pow[m-i])%P;
        printf("%d",ans*2%P);
    }
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);

	void run() {
		while (true) {
			if (!sc.hasNext()) {
				break;
			}
			char[] str = sc.next().toCharArray();
			boolean flag = false;
			for (int i = 0; i < str.length; i++) {
				if (i == str.length - 1) {
					flag = true;
					break;
				}
				switch (str[i]) {
				case 'A':
					if (str[i + 1] != 'B' && str[i + 1] != 'D') {
						i = str.length;
					}
					break;
				case 'B':
					if (str[i + 1] != 'A' && str[i + 1] != 'C'
							&& str[i + 1] != 'E') {
						i = str.length;
					}
					break;
				case 'C':
					if (str[i + 1] != 'B' && str[i + 1] != 'F') {
						i = str.length;
					}
					break;
				case 'D':
					if (str[i + 1] != 'A' && str[i + 1] != 'E'
							&& str[i + 1] != 'G') {
						i = str.length;
					}
					break;
				case 'E':
					if (str[i + 1] != 'D' && str[i + 1] != 'B'
							&& str[i + 1] != 'F' && str[i + 1] != 'H') {
						i = str.length;
					}
					break;
				case 'F':
					if (str[i + 1] != 'C' && str[i + 1] != 'E'
							&& str[i + 1] != 'I') {
						i = str.length;
					}
					break;
				case 'G':
					if (str[i + 1] != 'D' && str[i + 1] != 'H') {
						i = str.length;
					}
					break;
				case 'H':
					if (str[i + 1] != 'G' && str[i + 1] != 'E'
							&& str[i + 1] != 'I') {
						i = str.length;
					}
					break;
				case 'I':
					if (str[i + 1] != 'F' && str[i + 1] != 'H') {
						i = str.length;
					}
					break;
				}
			}
			if (flag) {
				System.out.println(str);
			}
		}
	}

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

}

Measured memory_bytes: 24084
#include <iostream>

int main() {
  int a, b;
  std::cin >> a >> b;

  for (int i = 1; i < 1250; ++i) {
    int c = i * 0.08;
    int d = i * 0.1;
    if (c == a && d == b) {
      std::cout << i << std::endl;
      return 0;
    }
  }

  std::cout << -1 << std::endl;
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200200;
long long f[maxn];
void add(int x, long long v){
  for(; x < maxn; x += x & - x) f[x] = max(f[x], v);
}
long long sum(int x){
  long long ans = 0;
  for(; x; x -= x & - x) ans = max(ans, f[x]);
  return ans;
}
int main(){
  int n; cin >> n;
  vector<int> h(n), a(n);
  for(int & i : h) cin >> i;
  for(int & i : a) cin >> i;
  long long ans = 0;
  for(int i = 0; i < n; i++){
    long long tmp = sum(h[i]) + a[i];
    add(h[i], tmp);
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
#include <string>
#include <iostream>
#include <cstdio>
int main(){
	int n;
	std::cin>>n;
	std::string s;
	std::cin.ignore();
	for(int i=0;i<n;++i){
		std::getline(std::cin,s);
		/*for(int j=0;j<s.size()-6;++j){
			if(s[j]=='H' && s[j+1] == 'o' && s[j+2] == 's'&& s[j+3] == 'h'&& s[j+4] == 'i'&& s[j+5] == 'n'&& s[j+6] == 'a')s[j+6]='a';
		}*/
		while(s.find("Hoshino") != std::string::npos){
			s[s.find("Hoshino")+6]='a';
			//std::cout<<s.find("Hoshino")<<std::endl;
		}
		//std::cout<<"tes"<<std::endl;
		std::cout<<s<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 1204
a = list(map(int,input().split()))
b = [list(map(int,input().split())) for i in range(a[0])]
c = [list(map(int,input().split())) for i in range(a[1])]

for i in range(a[0]):
  d = []
  for j in range(a[1]):
    d.append(abs(b[i][0]-c[j][0])+abs(b[i][1]-c[j][1]))
  else:
    print(d.index(min(d))+1)

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

int main() {
  int f,s,t;
  cin >> f >> s >> t;
  
  if(f == s && s == t){
    cout << 1; 
  }else if(f == s || f == t || s == t){
    cout << 2;
  }else{
    cout << 3;    
  }
}


Measured memory_bytes: 256
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int a, b;
  scanf("%d%d", &a, &b);
  if ((1 <= a && a <= 9) && (1 <= b && b <= 9))
    printf("%d\n", a * b);
  else
    printf("%d\n", -1);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    const int maxhw = 100;
    char c[maxhw][maxhw];
    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            cin >> c[y][x];
        }
    }

    for (int ly = 0; ly < h; ly++) {
        for (int lx = 0; lx < w; lx++) {
            cout << c[ly][lx];
        }
        cout << endl;
        for (int lx = 0; lx < w; lx++) {
            cout << c[ly][lx];
        }
        cout << endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char toLower(char ch) { return tolower(ch); }
int main() {
  string T, W;
  int count = 0;
  cin >> W;
  transform(W.begin(), W.end(), W.begin(), toLower);
  while (true) {
    cin >> T;
    if (T == "END_OF_TEXT") break;
    transform(T.begin(), T.end(), T.begin(), toLower);
    if (T == W) count++;
  }

  cout << count << endl;
}



Measured memory_bytes: 3156
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <istream>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define vec vector<int>a(n)
#define soot(a) sort(a.begin(),a.end())
/*int n;
cin >> n;
vector<int>a(n);
rep0(i, n - 1)cin >> a[i];*/
using namespace std;
int main() {
	string s;
	cin >> s;
	int a = 700;
	rep0(i,2)
	if (s[i] == 'o')a += 100;
	cout << a << endl;
	return 0;
}


Measured memory_bytes: 256