akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
 
int main(){
    int N,M;
    cin >> N >> M;
    vector<int> A(M),B(M);
    
    rep(i,M){
        int b,tp,idx = 0;
        cin >> A[i] >> b;
        rep(j,b) cin >> tp, idx += int(pow(2,tp-1));
        B[i] = idx;
    }
    
    int DP[M+10][10000];
    rep(i,M+10) rep(j,10000) DP[i][j] = 1e9;
    DP[0][0] = 0;
    
    rep(i,M){
        rep(j,10000) DP[i+1][j | B[i]] = min({DP[i][j | B[i]],DP[i][j]+A[i],DP[i+1][j | B[i]]});
        rep(j,10000) if(DP[i+1][j] == 1e9) DP[i+1][j] = DP[i][j];
    }
    
    
    int ans = DP[M][int(pow(2,N))-1];
    pr(ans == 1e9 ? -1  : ans);
}

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

const int MAXN = 1e5 + 1;

int n, k, h[MAXN];

int main(){

    cin >> n;
    for(int i = 1; i <= n; i++) cin >> h[i];
    int dp[n + 5];
    for(int i = 1; i <= n; i++) dp[i] = 1e9;
    dp[1] = 0;
    for(int i = 2; i <= n; i++) for(int j = 1; j <= 2 && j < i; j++) if(i > j) dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main(){
  string A,B;
  cin >> A >> B;

  int N = A.size();
  int M = B.size();

  for(int i=0;i<N;i++){
    if(i == N-1 && N==M){
      cout << A[i] << B[i] << endl;
    }
    if(i == N-1 && N-1==M){
      cout << A[i] << endl;
    }
    if(i != N-1){
      cout << A[i] << B[i];
    }
  }

  return 0;
}


Measured memory_bytes: 256
use strict;
use warnings;
use feature 'say';

my $line = <STDIN>;
my ($animals, $legs) = split/\s/, $line;


if ($animals == 1) {
  if ($legs == 2 || $legs == 4) {
    say 'Yes'
  } else {
    say 'No'
  }
  exit;
}

if ($legs % 2) {
  say 'No';
  exit;
}

if ( (($animals * 4) < $legs) || (($animals * 2) > $legs)) {
  say 'No';
  exit;
}

say 'Yes';



Measured memory_bytes: 5244
#include<bits/stdc++.h>
using namespace std;
int a[]={0,1,2,1,3,1,3,1,1,3,1,3,1};
int main(){
	int x,y;
	cin>>x>>y;
	if(a[x]==a[y])puts("Yes");
	else puts("No");
	}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
using namespace std;

typedef long long int ll;
#define MOD 1000000007
#define INF 1000000001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv)
{
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {

	int n; cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];

	vector<int> x(n,0);
	rep(i,n){
		int sgn = (i+1)%2 ? 1 : -1;
		x[0] += sgn*a[i];
	}
	rep2(i,1,n){
		x[i] = 2*(a[i-1]-x[i-1]/2);
	}
//	rep(i,n) cout << x[i] << " ";
	rep(i,n) printf("%d ",x[i]);
	cout << endl;
}




Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main(){
	IOS;
	int n;
	cin >> n;
	int arr[n], xr = 0;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
		xr = xr^arr[i];
	}

	for(int i = 0; i < n; i++)
		cout << (xr^arr[i]) << " ";
	cout << endl;
	return 0;
}

Measured memory_bytes: 5172
def solve(string):
    n, k, s = string.split()
    n, k = map(int, [n, k])
    flip = [0]
    for i, (s0, s1) in enumerate(zip(s, s[1:]), start=1):
        if s0 != s1:
            flip.append(i)
    flip += [n]
    start = int(s[0])
    l = len(flip) - 1
    return str(max([flip[min(l, i + 2 * k + (i % 2 ^ start))] - flip[i] for i in range(l + 1)]))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Measured memory_bytes: 11240
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
using ll = long long;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define rep(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
#define MX 2*1e5+1
const int mod = 1000000007;
const int MOD = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

vector<mint>fl(2*MX),ifl(2*MX),fif(2*MX);
void getfact(int n){
    fl[0]=fl[1]=1;
    ifl[0]=ifl[1]=1;
    fif[0]=fif[1]=1;
    for(int i=2;i<n;i++){
        fl[i]=fl[i-1]*i;
        ifl[i]=ifl[i]=-ifl[mod%i]*(mod/i);
        fif[i]=fif[i-1]*ifl[i];
    }
}
int main(){
    int n,k;
    cin>>n>>k;
    getfact(2*n);
    mint ans=0;
     ans=fl[2*n-1]*fif[n]*fif[n-1];
    if(k>=n-1){
        
        cout<<ans<<endl;
        return 0;
    }
    for(int i=k;i<n-1;i++){
         ans-=fl[n]*fif[n-i-1]*fif[i+1]*fl[n-1]*fif[n-i-2]*fif[i+1];
    }
    cout<<ans<<endl;
    return 0;
}

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

class Radix {
private:
  const char* s;
  int a[128];
  
public:
  Radix(const char* s = "0123456789ABCDEF") : s(s) {
    int i;
    for(i = 0; s[i]; ++i)
      a[(int)s[i]] = i;
  }

  std::string to(long long p, int q) {
    int i;
    if(!p)
      return "0";
    char t[64] = { };
    for(i = 62; p; --i) {
      t[i] = s[p % q];
      p /= q;
    }
    return std::string(t + i + 1);
  }

  std::string to(const std::string& t, int p, int q) {
    return to(to(t, p), q);
  }

  long long to(const std::string& t, int p) {
    int i;
    long long sm = a[(int)t[0]];
    for(i = 1; i < (int)t.length(); ++i)
      sm = sm * p + a[(int)t[i]];
    return sm;
  }
};

int main(){
    int N, K; cin >> N >> K;

    Radix r;

    string m = r.to(N, K);
    int cnt = 0;
    for(int i = 0; i < m.size(); ++i) {
        cnt++;
    }

    cout << cnt << endl;
}

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

int N,M;
//vector<vector<int>> v(100010);
int p[100010] = {0},r[100010] = {0};
void init(int N){
	for(int i=0;i<=N;++i) p[i] = i;
}

int root(int a){
	if(p[a] == a) return a;
	return (p[a] = root(p[a]));
}

bool is_same_set(int a,int b){
	return root(a) == root(b);
}

void unite(int a, int b){
	a = root(a);
	b = root(b);
	if(a==b) return;
	if(r[a]<r[b]){
		p[a] = b;
	}else{
		p[b] = a;
		if(r[a] == r[b]) r[a]++;
	}
}

int main(){
	cin >> N >> M;
	init(N);
	int A[N+1];
	for(int i=1;i<=N;i++){
		cin >> A[i];
	}
	for(int i=0;i<M;i++){
		int a,b;
		cin >> a >> b;
		unite(a,b);
	}
	/*map<int,int> m;
	for(int i=1;i<=N;i++){
		m[p[i]]++;		
	}*/
	int ans = 0;
	/*for(auto x:m){
		ans = max(ans,x.second);
	}*/
	for(int i=1;i<=N;i++){
		if(is_same_set(A[i],i)) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	char s[n];
	for (int i=0;i<n;i++){
		cin>>s[i];
	}
	if (s[k-1]=='A'){
		s[k-1]='a';
	}
	else if (s[k-1]=='B'){
		s[k-1]='b';
	}
	else if (s[k-1]=='C'){
		s[k-1]='c';
	}
	
	for (int i=0;i<n;i++){
		cout<<s[i];
	}
	cout<<endl;
		

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL 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;}

//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) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

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

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

#define PUTS(x) cout << (x) << endl;

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

    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    string ans = "";
    REP(i,n){
        ans += s[i];
        ans += t[i];
    }
    PUTS(ans);
}

Measured memory_bytes: 256
def inpl(): return list(map(int, input().split()))
N, M = inpl()

n2 = N * 1
n1 = N * 1
m1 = M * 1
mall = M * 2

# うくをほろぼす
ans1 = 0
while True:
    mall -= n1
    m1 = -(-mall//2)
    
    if mall <= 0:
        break
    ans1 += 1
    
    if n2 - m1 >= 0:
        n2 -= m1
    else:
        n1 = n1 + n2 - m1
        n2 = 0
    if n1 <= 0:

        break
    ans1 += 1

# ushiを滅ぼす

ans2 = 0
n2 = N * 1
n1 = N * 1
m1 = M * 1
m2 = M * 1
mall = M * 2
nall = N * 2

while True:
    if m2 - n1 >= 0:
        m2 -= n1
    else:
        m1 = m1 + m2 - n1
        m2 = 0
    if m1 <= 0:

        break
    ans2 += 1

    nall -= m1
    n1 = -(-nall//2)
    
    if nall <= 0:
        break
    ans2 += 1

print(min(ans1, ans2))


Measured memory_bytes: 5608
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;
  cin >> n;
  
  vector<int> vec(n);
  for(int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  int count = vec.size();
  
  cout << count << endl;
}

Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.input()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n: usize = sc.input();
    let d: i64 = sc.input();
    let a: i64 = sc.input();
    let mut arr: Vec<(i64, i64)> = (0..n).map(|_| (sc.input(), sc.input())).collect();

    arr.sort();

    let mut ans: i64 = 0;
    let mut bit = Bit::new(n + 1);

    for i in 0..n {
        let (x, mut h) = arr[i].clone();
        h -= bit.sum(i);

        if h <= 0 {
            continue;
        }

        let num = (h + a - 1) / a;
        ans += num;
        let damage = num * a;
        bit.add(i, damage);
        let rx = x + d * 2;

        let mut ok = 0;
        let mut ng = n as i64;
        while (ok - ng).abs() > 1 {
            let mid = (ok + ng) / 2;
            if arr[mid as usize].0 <= rx {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        bit.add(ng as usize, -damage);
    }

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

struct Bit {
    // Binary Indexed Tree
    n: usize,
    data: Vec<i64>,
}

impl Bit {
    fn new(n: usize) -> Bit {
        let mut m = 1;
        while m < n {
            m *= 2;
        }
        Bit {
            n: n,
            data: vec![0; m],
        }
    }

    fn sum(&self, i: usize) -> i64 {
        let mut i = i + 1;
        let mut ret = 0;
        while i > 0 {
            ret += self.data[i - 1];
            i -= (i as i64 & -(i as i64)) as usize;
        }
        ret
    }

    fn add(&mut self, i: usize, x: i64) {
        let mut i = i + 1;
        while i < self.n {
            self.data[i - 1] += x;
            i += (i as i64 & -(i as i64)) as usize;
        }
    }
}


Measured memory_bytes: 12540
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    V<int> p(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    sort(ALL(p));
    int ans = 0;
    for (int i = 0; i < k; i++) ans += p[i];
    cout << ans << '\n';
    return 0;
}


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

int main()
{
  int sum=0;
  int n;
  cin>>n;
  for(int i=0; i<n; i++){
    int l,r;
    cin>>l>>r;
    
    sum+=(r-l+1);
  }
  cout<<sum<<endl;
}


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

int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  
  int cost[N];
  cost[0] = 0;
  cost[1] = abs(A[0] - A[1]);
  
 for (int j = 2; j < N; ++j) {
        cost[j] = min(cost[j - 1]+ abs(A[j] - A[j - 1]), cost[j - 2] + abs(A[j] - A[j - 2]));
 }
  
  cout << cost[N-1] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}

	return d;
}

vll graph[100000] = {};

lli ans[100000] = {};

int main(void) {

	lli n, m;
	cin >> n >> m;

	
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}

	for (int i = 0; i < n; i++)
		ans[i] = -1;

	queue<lli> q;

	q.push(0);
	ans[0] = 0;

	while (!q.empty()) {

		lli t = q.front();
		q.pop();

		for (int i = 0; i < graph[t].size(); i++) {
			if (ans[graph[t][i]] == -1) {
				ans[graph[t][i]] = t;
				q.push(graph[t][i]);
			}
		}
	}

	cout << "Yes" << endl;
	for (int i = 1; i < n; i++) {
		cout << ans[i] + 1 << endl;
	}



	return 0;
}

Measured memory_bytes: 12980
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll; 
 
int N;
const int MAX_N = 100000;
ll A[MAX_N];


int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];

    int minus = 0;
    for (int i = 0; i < N; i++){
        if (A[i] <= 0){
            minus++;
        }
    }

    for (int i = 0; i < N; i++){
        if (A[i] < 0) A[i] = (-1) * A[i];
    }

    if (minus % 2 == 0){
        ll ans = 0;
        for (int i = 0; i < N; i++){
            ans += A[i];
        }
        cout << ans << endl;
    }
    else {
        sort(A, A+N);
        ll ans = (-1) * A[0];
        for (int i = 1; i < N; i++){
            ans += A[i];
        }
        cout << ans << endl;
    }

    
    return 0;    
}

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

using namespace std;

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();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int a,f,t,x,y;

int dmax[2],tmax[2];

int main(void){
	int n;
	cin >> n;
	rep(i,2) dmax[i]=-1,tmax[i]=0;
	rep(i,n){
		int ff,aa,tt,xx,yy;
		cin >> ff >> aa >> tt >> xx >> yy;
		if(a&&t==tt&&a!=aa){
			int d=(xx-x)*(xx-x)+(yy-y)*(yy-y);
			int c=(ff-f);
			if(d>dmax[t])
				dmax[t]=d,tmax[t]=c;
			else if(d==dmax[t]&&c<tmax[t])
				dmax[t]=d,tmax[t]=c;
		}
		f=ff,a=aa,t=tt,x=xx,y=yy;
	}
	cout.precision(9);
	rep(i,2){
		if(dmax[i]<0)
			cout << -1 << " " << -1 << endl;
		else
			cout << fixed << sqrt(1.0*dmax[i]) << " " << 1.0*tmax[i]/60 << endl;
	}
	return 0;
}

Measured memory_bytes: 1244
#include<stdio.h>
#include<math.h>
int main(){
	int a,b,x;
	scanf("%d %d %d",&a,&b,&x);
	double in = a * a * b;
	double ans_r;
	if((in / 2) < (double)x){
		double ov_hi = (((in - x)/a )* 2) /a;
		double tan = ov_hi / a;
		ans_r = atan(tan);
		}else{
		double ins_hi = (((double)x / a) * 2)/b;
		double in_tan = b / ins_hi;
		ans_r = atan(in_tan);
		}
	double ans = ans_r * 180.0 /3.14159265358979;
	printf("%.10lf",ans);
	return 0;
	}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

string s,t;

int main(){
    cin >> s;
    cin >> t;
    ll l = s.size();
    ll c = 0;
    for(int i=0;i<l;i++){
        if(s[i]!=t[i]) c++;
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 3868
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<int> x(n), y(n), h(n);
    for(int i=0;i<n;i++) cin >> x[i] >> y[i] >> h[i];
    
    for(int cx=0;cx<=100;cx++){
        for(int cy=0;cy<=100;cy++){
            int H = -1;
            bool flg = true;
            for(int i=0;i<n*2;i++){
                int v = abs(x[i%n]-cx) + abs(y[i%n]-cy);
                if(h[i%n] > 0){
                    v += h[i%n];
                    if(H == -1) H = v;
                    if(H == v) continue;
                    flg = false;
                    break;
                }else{
                    if(H > v){
                        flg = false;
                        break;
                    }
                }
            }
            if(H != -1 && flg){
                cout << cx << " " << cy << " " << H << endl;
                return 0;
            }
        }
    }
    
}


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

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

    vector<long long> a;

    long long x;
    for(long long i = 0; i < 3*n; i++){
        cin >> x;
        a.push_back(x);
    }

    sort(a.begin(), a.end());

    long long sum = 0;
    long long j = 3*n-2;
    long long i = 0;
    while(i < n){
        sum += a[j];
        //cout << a[j] << endl;
        //cout << "j" << j << endl;
        j = j - 2;
        i++;
    }

   cout << sum << endl;

    return 0;
}

Measured memory_bytes: 6384
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double pi = acos(-1);
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
	for (auto &e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

//↑template↑


ll oripow(ll a, ll b) {
	ll res = 1;
	for (int i = 0; i < b; ++i) {
		res *= a;
		if (res > 1e9) { return res; }
	}
	return res;
}

ll a, b;
ll f(string h) {
	ll res = 0;
	for (int i = 0; i < h.length(); ++i) {
		if (i != 0 && h[i - 1] == '^') { res += oripow(a, h[i] - '0'); }
		if (res > 1e9) { return res; }
	}
	return res;
}


int main() {
	string h;
	cin >> a >> b >> h;
	ll ans = f(h);
	if (ans > 1e9) { cout << "TLE" << endl; return 0; }
	ans *= b;
	if (ans > 1e9) { cout << "TLE" << endl; }
	else { cout << ans << endl; }
}


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

long long a, b, p = 1;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> a >> b;
	int i = 0;
	while(true){
		if(1LL * p * a <= b){
			i++;
			p *= 2;
		}
		else
			return cout << i, 0;
	}	
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)


int main(){
   int n,a,b;
   cin >> n;
   if (n == 2){
      cin >> a >> b;
   }
   if (n == 1) cout << "Hello World" << endl;
   else cout << a + b <<endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
  int N, move=0,ans=0;
  cin >> N;
  vector<int> height(N);
  for(int i=0;i<N;i++){
    cin >> height[i];
  }
  for(int j=0;j<(N-1);j++){
    if(height[j]>=height[j+1]){
      move++;
    }  
    else{
      move = 0;
    }  
    ans = max(ans, move);
  }  
  
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-
def calc_expect(n):
    return (n+1) / 2


n, k = map(int, input().split())
p_list = list(map(int, input().split()))

p_expect_list = list(map(calc_expect, p_list))

max_val = 0

res = [0] * len(p_expect_list)
res[0] = p_expect_list[0]
for i in range(len(res)-1):
    res[i+1] = res[i] + p_expect_list[i+1]

if (n == k):
    print(res[-1])
    exit()

for i in range(len(p_expect_list)-k):
    val = res[i+k]-res[i]
    if val > max_val:
        max_val = val

print(max_val)


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

int main() {
    ll A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    cout << (A1 + A2 + A3 >= 22 ? "bust" : "win") << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //int n=Readint();
            //string[] str = Console.ReadLine().Split(' ');

            int d= int.Parse(Console.ReadLine());
            var c = new int[26];
            c = ReadArray(26);
            int sumc = c.Sum();
            var lastd = new int[26];


            for(int i = 0; i < d; i++)
            {
                string[] str = Console.ReadLine().Split(' ');

                int max = sumc*i;
                int maxn = 0;
                for(int j = 0; j < 26; j++)
                {
                    int temp = int.Parse(str[j]) + c[j] * (i - lastd[j]);
                    if (max < temp)
                    {
                        max = temp;
                        maxn = j;
                    }

                }
                Cout(maxn+1);
                lastd[maxn] = i;
            }



            //ここまで
        }

        static void Cout(string s)
        {
            Console.WriteLine(s);
            return;
        }

        static void Cout(int n)
        {
            Console.WriteLine(n);
            return;
        }

        static void Cout(long n)
        {
            Console.WriteLine(n);
            return;
        }

        static int Readint()
        {
            return int.Parse(Console.ReadLine());
        }

        static int[] ReadArray(int n)
        {
            string[] str = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for (int i=0; i < n; i++){ a[i] = int.Parse(str[i]); }
            return a;
        }
        static long[] ReadArray(long n)
        {
            string[] str = Console.ReadLine().Split(' ');
           long[] a = new long[n];
            for (long i = 0; i < n; i++) { a[i] = long.Parse(str[i]); }
            return a;
        }

        static long Readlong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int Min(int a, int b)
        {
            if (a < b) return a;
            return b;
        }

        static int Max(int a, int b)
        {
            if (a > b) return a;
            return b;
        }


    }

}


Measured memory_bytes: 28440
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 10010010010010;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    int N;cin >> N;
    map<P,int> M;
    for(int i = 1;i<=N;i++){
        int BACK = i%10;
        int FRONT;
        if(i < 10){
            FRONT = i;
        }
        else if(i < 100){
            FRONT = i/10;
        }
        else if(i < 1000){
            FRONT = i/100;
        }
        else if(i < 10000){
            FRONT = i/1000;
        }
        else if(i < 100000){
            FRONT = i/10000;
        }
        else{
            FRONT = i/100000;
        }
        M[make_pair(FRONT,BACK)]++;
    }
    int ans = 0;
    for(int i = 1;i<=9;i++){
        for(int j = 1;j<=9;j++){
            ans += M[make_pair(i,j)]*M[make_pair(j,i)];
        }
    }
    cout << ans << endl;
}


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N;
    char s[132123];
    Scd(N);
    Scs(s);

    bool dp[5][1000] = {};
    dp[0][0] = true;

    Rep(ni,N){
        int c = s[ni]-'0';
        RRep(ci,3) Rep(di,100){
            if( dp[ci][di] ) dp[ci+1][di*10+c] = true;
        }
    }

    int ans = 0;
    Rep(i,1000){
        if( dp[3][i] ) ans++;
    }

    printf ("%d\n", ans );

    return 0;
}



Measured memory_bytes: 256
function pad(n){
	while(n.length<7){
		n="0"+n
	}
	return n;
}
function divide(s){
	var a=[],i=0,l=s.length,d=7;
	for(;(a[i]=s.slice((i+1)*-d,l+i*-d)).length>d-1;i++);
	return a;
}
function unite(a){
	return a.concat().reverse().join("").replace(/^0*/,"");
}
function largeSum(n,m){
	for(var h=0,o=[],i=0,l=Math.max(n.length,m.length);i<l||h!=0;i++){
		var a=((parseInt(n[i],10)||0)+(parseInt(m[i],10)||0)+(+h)).toString(10);
		o[i]=a.length>7?(h=a.slice(0,1),a.slice(1)):(h=0,pad(a));
	}
	return o;
}
process.stdin.on("data",function(c){
	var a=(c+"").trim().split("\n");
	for(var i=0,l=+a.shift()*2;i<l;i+=2){
		var s=unite(largeSum(divide(a[i]),divide(a[i+1])));
		console.log(s==""?0:s.length>80?"overflow":s);
	}
}).resume();

Measured memory_bytes: 8520
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, n, k, b;
  in(n);
  vector<vector<pair<ll, ll>>> c(n, vector<pair<ll, ll>> (0));
  rep(i, n){
    in(k);
    rep(j, k){
      in2(a, b);
      c[i].pb(make_pair(a - 1, b));
    }
  }
  a = 0;
  bool h;
  rep(tmp, 1 << 15){
    bitset<15> s(tmp);
    h = true;
    b = 0;
    rep(i, n){
      if(s.test(i)){
        rep(j, c[i].size()){
          if(s.test(c[i][j].first) != c[i][j].second)
            h = false;
        }
      }
    }
    if(h){
      rep(i, n){
        if(s.test(i))
          b++;
      }
      a = max(a, b);
    }
  }
  out(a);
  memi;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    nums_table = [2] * (n+1)
    ans = 0
    for i in range(1, n+1):
        nums_table[i] = 2
    nums_table[1] = 1
    for i in range(2, n//2+1):
        for j in range(2*i,n+1,i):
            nums_table[j] += 1
    for i in range(1, n+1):
        ans += i * nums_table[i]
    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 151720
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=j;i<=k;++i)
#define Forr(i,j,k) for (int i=j;i>=k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

template<typename T>bool chkmax(T &a,T b) { return a<b?a=b,1:0; }
template<typename T>bool chkmin(T &a,T b) { return a>b?a=b,1:0; }

int n;

inline void file() {
	freopen("C.in","r",stdin);
	freopen("C.out","w",stdout);
}

inline void read(int &x) {
	x=0;
	int p=1;
	char c=getchar();
	while (!isdigit(c)) {if (c=='-') p=-1; c=getchar();}
	while (isdigit(c)) {x=(x<<1)+(x<<3)+(c-'0'); c=getchar();}
	x*=p;
}

int main() {
//	file();
	read(n);
	int xx,yy,zz;
	xx=0; yy=0; zz=0;
	For (i,1,n) {
		int x,y,z; read(z); read(x); read(y);
		if ((x+y+z)%2==1) { printf("No\n"); return 0; }
		if (abs(x-xx)+abs(y-yy)>abs(z-zz)) { printf("No\n"); return 0; }
		xx=x; yy=y; zz=z;
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <string>
#include <stack>
 
using namespace std;
 
#define f(i,a,b) for(int i=a;i<b;i++)
#define fll(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define vvi vector<vector<int> >
#define ss second
#define ff first
#define ll long long
#define lld long double
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pq priority_queue< int >
#define pqll priority_queue< ll >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define INF 1000000000
#define NINF -1000000000
#define endl '\n'

ll power(ll x, ll y, ll p)  
{  
    ll res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}

void solve(){
    int n;
    cin >> n;
    string a , b;
    cin >> a>> b;
    string ans = "";
    for (int j = 0 ; j < n ; j++){
        ans.pb(a[j]);
        ans.pb(b[j]);
    }
    cout << ans << endl;
}

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

    int t = 1;
    // cin >> t;
    
    while(t--){    
        solve();
    }
}

Measured memory_bytes: 3676
#include<stdio.h>
int main(void){
  int n,i,c[4];
   char s[3];
  c[0]=c[1]=c[2]=c[3]=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",s);
    if(s[0]=='A')c[0]++;
    else if(s[0]=='W')c[1]++;
    else if(s[0]=='T')c[2]++;
    else c[3]++;
  }
  printf("AC x %d\n",c[0]);
  printf("WA x %d\n",c[1]);
  printf("TLE x %d\n",c[2]);
  printf("RE x %d",c[3]);
  return 0;
}


Measured memory_bytes: 1724
import sys

input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    h = sorted([int(input()) for i in range(N)])
    
    ans = float('inf')
    
    for i in range(N-K+1):
        ans = min(ans, h[i+K-1] - h[i])
    
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 8280
lst = [9, 9, 9, 9, 9, 9]
lst[0], lst[1] = [int(i) for i in input().split()]
lst[2], lst[3] = [int(i) for i in input().split()]
lst[4], lst[5]  = [int(i) for i in input().split()]
   
flag = [False, False, False, False]
 
f = 1
for i in range(1, 4+1):
    if (lst.count(i) == 0) or (lst.count(i) == 3):
        print("NO")
        f = 0
        break
 
if f == 1:
    print("YES")
 

Measured memory_bytes: 3064
######ANSDEFINE#######
no = "No"

yes = "Yes"

#########END##########
S = input()
T = input()

sl = list(S)
tl = list(T)

Slen = len(S) + 1
Tlen = len(T)

if Slen == Tlen:
  if sl == tl[0:-1]:
    print(yes)
  else:
    print(no)
else:
  print(no)
 


Measured memory_bytes: 9112
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;++i)

using ll = long long;
using namespace std;

const ll INF = 1010101010;
int main() {
	ll n, m = 0, ans = INF, A[10101];
	cin >> n;
	rep(i, n) cin >> A[i];
	for (int i = -100; i < 101; i++) {
		rep(j, n) {
			m += (A[j] - i)*(A[j] - i);
		}
		ans = min(ans, m);
		m = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
h = int(input())
w = int(input())
n = int(input())

lines = 0
act = 0

if h <= w:
#     print('w long')
    lines = h
    act = w
else:
#     print('h long')
    lines = w
    act = h
    
# print(lines)
# print(act)
    
draw = 0 
for i in range(lines):
    
    if n <= (i + 1) * act:
        print(i + 1)
        break

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

int main() {
   int N,M;
   cin >> N >> M;
   vector<tuple<int,int,int>> x(M);
   for (int i=0; i<M; i++) {
       int a,b;
       cin >> a >> b;
       x[i]=make_tuple(a,b,i);
   }
   sort(x.begin(),x.end());
   /*for (int i=0; i<M; i++) {
       cout << get<1>(x[i]) << endl;
       cout << get<2>(x[i]) << endl;
   }*/
   for (int i=0; i<M; i++) {
       if (i==0) {
           get<1>(x[0])=1;continue;
       }
       if (get<0>(x[i])==get<0>(x[i-1])) get<1>(x[i])=get<1>(x[i-1])+1;
       else get<1>(x[i])=1;
       //cout << i << " " << get<1>(x[i]) << endl;
   }
   vector<string> A(M);
   for (int i=0; i<M; i++) {
       string s=to_string(get<0>(x[i]));
       string t=to_string(get<1>(x[i]));
       int a,b;
       a=s.size();
       b=t.size();
       for (int j=0; j<6-a; j++) {
           s="0"+s;
       }
       for (int j=0; j<6-b; j++) {
           t="0"+t;
       }
       A[get<2>(x[i])]=s+t;
   }
   for (int i=0; i<M; i++) {
       cout << A[i] << endl;
   }
}

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

int main() {
    int N, M; cin >> N >> M;
    vector<int> A(N);
    rep(i, N){
        cin >> A[i];
    }
    vector<int> R(N+1);
    R[0] = 0;
    rep(i, N){
        int r = A[i] + R[i];
        r %= M;
        R[i+1] = r;
    }

    map<ll, ll> m;
    rep(i, N+1){
        m[R[i]]++;
    }

    ll ans = 0;
    for (auto p : m){
        ll value = p.second;
        value = value * (value-1) / 2;
        ans += value;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7900
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main(void){
    int n,m;cin>>n>>m;
    vector<int>L(n,1);
    vector<bool>Ans(n,false);
    Ans[0]=true;
    rep(i,m){
        int f,t;cin>>f>>t;f--;t--;
        if(Ans[f])Ans[t]=true;
        L[f]--;L[t]++;
        if(L[f]==0)Ans[f]=false;
    }
    int count=0;
    rep(i,n){
        if(Ans[i])count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
int main()
{
    ll n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n), b(n), c(n);
    vector<P> res(n);
    rep(i, n)
    {
        c[i] = 2 * n + k + i;
        a[i] = k + i;
        b[i] = n + k + i;
    }
    reverse(b.begin(), b.end());
    int harf = n/2;
    for(int i = 0;i<harf-i && harf-i<n;i++){
        swap(a[i],a[harf-i]);
    }
    for(int i = 0;harf+1+i<n-1-i;i++){
        swap(a[i+harf+1],a[n-1-i]);
    }
    rep(i,n){
        res[i] = P(a[i]+b[i],a[i]);
    }
    sort(res.begin(), res.end());
    rep(i,n){
        if(res[i].first>c[i]){
            cout << -1 << endl;
            return 0;
        }
    }
    rep(i, n)
    {
        cout << res[i].second << ' ' << res[i].first - res[i].second << ' ' << c[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 6144
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define clr(a,b) memset(a,b,sizeof a)
#define PII pair<int,int>
#define PI acos(-1.0)
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
typedef long long ll;
typedef unsigned long long ull;
const int INF=0x3f3f3f3f;
const int maxn=1e5+10;
int dp[1<<16],V[maxn],cnt[16];
int n,x,y,a;

int Work(int S)
{
    if(S==0) return 0;
    if(dp[S]!=-1) return dp[S];
    dp[S]=INF;
    for(int i=1;i<16;i++)
    {
    	if(S&(1<<i))
            for(int j=1;j<16;j++)
            {
            	
            	if(S&(1<<j))
                {
                    int cs=S^(1<<i)^(1<<j)^(1<<(i^j));
                    if(i!=j)
					{
						if(((1<<(i^j)) & S) == (1<<(i^j))) dp[S]=min(dp[S], Work(cs) + 2);
						else dp[S]=min(dp[S], Work(cs) + 1 ); 
					}
                }
			}
	}
    return dp[S];
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<n;i++)
    {
        scanf("%d%d%d",&x,&y,&a);
        V[x]^=a; V[y]^=a;
    }
    for(int i=0;i<n;i++) if(V[i]) cnt[V[i]]++;
    int ans=0,s=0;
    for(int i=0;i<16;i++) ans += cnt[i]/2, s^=(cnt[i]&1)<<i;
    memset(dp,-1,sizeof dp);
    ans+=Work(s);
    printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 896
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] cost = new int[n];
		Arrays.fill(cost, 10000000);
		int[] ary = new int[n];
		for(int i=0; i<n; i++){
			ary[i] = in.nextInt();
		}

		cost[0] = 0;
		cost[1] = cost[0]+Math.abs(ary[0] - ary[1]);
		// cost[2] = Math.min(Math.abs(ary[0] - ary[2]), cost[1] + Math.abs(ary[1] - ary[2]));
		for(int i=2; i<n; i++){
			cost[i] = Math.min(cost[i-1]+ Math.abs(ary[i-1] - ary[i]), 
							   cost[i-2]+ Math.abs(ary[i-2] - ary[i]));
		}
		System.out.println(cost[n-1]);
	}
}


Measured memory_bytes: 58048
#include<bits/stdc++.h>
#define INF (1e9)
#define N 6005
#define M 2005
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;

int n,m,cap,d[N][M],n_max;
map<string,int> num;
string src,dest;
vector<P> G[N];
set<int> lpc;

int dijkstra(int s,int g){
  priority_queue<P1,vector<P1>,greater<P1> > q;
  for(int i=0;i<n_max;i++)
    for(int j=0;j<=cap*10;j++)
      d[i][j]=INF;
  q.push(P1(0,P(s,cap*10)));
  d[s][cap*10]=0;
  while(!q.empty()){
    P1 t=q.top(); q.pop();
    int cost=t.first;
    int node=t.second.first;
    int c=t.second.second;
    if(d[node][c]<cost)continue;
    if(node==g)return cost;
    for(int i=0;i<G[node].size();i++){
      int ncost=cost+G[node][i].second;
      int nnode=G[node][i].first;
      int nc=c-G[node][i].second;
      if(nc<0)continue;
      if(d[nnode][nc]>ncost){
	d[nnode][nc]=ncost;
	q.push(P1(ncost,P(nnode,nc)));
      }
      if(lpc.count(nnode)){
	nc=cap*10;
	if(d[nnode][nc]>ncost){
	  d[nnode][nc]=ncost;
	  q.push(P1(ncost,P(nnode,nc)));
	}
      }
    }
  }
  return -1;
}

int main(){
  while(1){
    cin>>n>>m>>cap;
    if(!n&&!m&&!cap)break;
    cin>>src>>dest;
    string a,b;
    int c;
    n_max=0;
    for(int i=0;i<n;i++){
      cin>>a>>b>>c;
      if(!num.count(a))num[a]=n_max++;
      if(!num.count(b))num[b]=n_max++;
      G[num[a]].push_back(P(num[b],c));
      G[num[b]].push_back(P(num[a],c));
    }
    if(!num.count(src))num[src]=n_max++;
    if(!num.count(dest))num[dest]=n_max++;
    for(int i=0;i<m;i++){
      cin>>a;
      lpc.insert(num[a]);
    }
    int s=num[src],g=num[dest];
    cout<<dijkstra(s,g)<<endl;
    num.clear();
    lpc.clear();
    for(int i=0;i<n_max;i++)G[i].clear();
  }
  return 0;
}

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

int main()
{
  std::vector<std::string> C(3);
  for(auto& c : C) std::cin >> c;
  std::cout
    << C[0][0]
    << C[1][1]
    << C[2][2]
    << std::endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = int(input())
if n % 10 == 3:
    print("bon")
elif n % 10 == 0 or n % 10 == 1 or n % 10 == 6 or n % 10 == 8:
    print("pon")
else:
    print("hon")

Measured memory_bytes: 9168