akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

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

using namespace std;

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

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

constexpr ll MOD = 1000000007LL;

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

template<typename T = ll> class UnionFind {
public:
	UnionFind( T n ) { rep( i, n ) { par.resize( n ); siz.resize( n ); par[i] = i; siz[i] = 1; } }
	T find( T x ) { if ( x == par[x] ) return ( x ); else return( par[x] = find( par[x] ) ); }
	void unite( T x, T y ) { T xx = find( x ); T yy = find( y ); if ( xx == yy ) return;
		if ( siz[xx] <= siz[yy] ) swap( xx, yy ); par[yy] = xx; siz[xx] += siz[yy]; }
private:
	vector<T> par, siz;
};

template<typename T = ll> T power( T a, T b, T m = MOD ) {
	T res = 1;
	while ( b > 0 ) { if ( b & 1 ) res = res * a % m;
		a = a * a % m; b >>= 1; }
	return ( res );
}

/*
constexpr ll MAX = 500010;
ll fact[MAX];
ll inv[MAX];
ll inv_fact[MAX];

template<typename T> void initComb( T n, T m = MOD )
{
	fact[0] = fact[1] = inv_fact[0] = inv_fact[1] = 1;
	inv[1] = 1;
	for ( int i = 2; i < n; i++ ) {
		fact[i] = ( fact[i - 1] * i ) % m;
		inv[i] = m - inv[m % i] * ( m / i ) % m;
		inv_fact[i] = inv_fact[i - 1] * inv[i] % m;
	}
}

template<typename T> T comb( T n, T r, T m = MOD )
{
	if ( n < r ) return ( 0 );
	if ( n < 0 || r < 0 ) return ( 0 );
	return ( fact[n] * ( inv_fact[r] * inv_fact[n - r] % m ) % m );
}
*/

void replace( string &s, string t, string r ) {
	string::size_type p = 0;
	while ( ( p = s.find( t, p ) ) != string::npos ) {
		s.replace( p, t.length(), r );
		p += r.length();
	}
}


int main()
{
	int X, A;
	cin >> X >> A;

	if ( X < A ) cout << 0 << endl;
	else cout << 10 << endl;

	return ( 0 );
}


Measured memory_bytes: 888
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>

#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define RREP(i, a, b) for (int i = (a); i >= (b); --i)

using namespace std;
using ll = long long;

/**
 * print an array in a row
 */
template <typename T>
void print_array (T arr[], size_t n) {
  for (int i = 0; i < n; i++) printf("%d%c", arr[i], (i == n - 1) ? '\n' : ' ');
}

ll solve_1 (int N, int P, vector<int> S) {
  ll cnt = 0;

  RREP(i, N - 1, 0)
    if (S[i] % P == 0) cnt += i + 1;

  return cnt;
}

ll solve_2 (int N, int P, vector<int> S) {
  ll cnt = 0;
  vector<int> table(P, 0);
  table[0] = 1;
  int acc = 0;
  int ten = 1;

  RREP(i, N - 1, 0) {
    acc = (acc + S[i] * ten) % P;
    cnt += table[acc];

    table[acc]++;
    ten = (ten * 10) % P;

  }

  return cnt;
}

/**
 * main
 */
int main () {
  int N, P; cin >> N >> P;
  string S_; cin >> S_;

  vector<int> S(N);
  REP(i, 0, N) S[i] = (S_[i] - '0') % P;

  cout << ((P == 2 || P == 5) ? solve_1(N, P, S) : solve_2(N, P, S))
       << '\n';
}


Measured memory_bytes: 2180
n,m = map(int,input().split())
student = [tuple(map(int,input().split())) for i in range(n)]
check = [tuple(map(int,input().split())) for i in range(m)]
for a,b in student:
	d = [abs(a-c)+abs(b-d) for c,d in check]
	print(d.index(min(d))+1)


Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
  vector<int> v(3);
  cin >> v[0] >> v[1] >> v[2];
  sort(v.begin(), v.end());
  cout << v[2] * 10 + v[1] + v[0] << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int N;
int A[30], B[60], C[60];

int main() {
    cin >> N;
    rep(i, N) cin >> A[i+1];
    rep(i, N) cin >> B[i+1];
    rep(i, N-1) cin >> C[i+1];

    // A[1]番目の料理を食べる
    int ans = B[A[1]];
    for (int i = 2; i <= N; i++) {
        // A[i]番目の料理
        ans += B[A[i]];
        // ボーナス
        if (A[i] - A[i-1] == 1) {
            ans += C[A[i]-1];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	ls := make([]int, m)
	rs := make([]int, m)
	for i := range ls {
		fmt.Scan(&ls[i], &rs[i])
	}

	lmax := ls[0]
	rmin := rs[0]
	for i, l := range ls {
		r := rs[i]
		if l > lmax {
			lmax = l
		}
		if r < rmin {
			rmin = r
		}
	}
	if v := rmin - lmax + 1; v > 0 {
		fmt.Println(v)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 5504
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;
    ll N;
    string c;
    cin >> N >> c;

    ll r_cnt = 0;
    rep(i, N) {
        if (c[i] == 'R') {
            r_cnt++;
        }
    }

    ll now_cnt = 0;
    rep(i, r_cnt) {
        if (c[i] == 'R') now_cnt++;
    }

    cout << r_cnt - now_cnt << endl;

    return 0;
}

Measured memory_bytes: 3772
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
int mod=1e9+7;
int power(int a,int b){
	if(!b)RE 1;
	int t=power(a,b/2);
	if(b&1)RE t*t%mod*a%mod;else RE t*t%mod;
}
int f[200005],finv[200005];
int C(int a,int b){
	RE f[a]*finv[b]%mod*finv[a-b]%mod;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	f[0]=1;
	FOR(i,1,200000)f[i]=f[i-1]*i%mod;
	FOR(i,0,200000)finv[i]=power(f[i],mod-2);
	int n,k;
	cin>>n>>k;
	int ans=0;
	FOR(i,0,min(n,k)){
		ans=(ans+C(n,i)*C(n-1,i))%mod;
	}
	cout<<ans;
	RE 0;
}



Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){
  string K;
  cin >> K;
  int count;
  vector<int>vec(1);
  for(int i = 0;i < K.size(); i++){
    if (K.at(i) == 'A' || K.at(i) == 'T' || K.at(i) == 'G'||
        K.at(i) == 'C'){
       count++;
    }
    else{
      vec.push_back(count);
      count = 0;
    }
  }
  if (count != 0){
    vec.push_back(count);
  }
  sort(vec.begin(),vec.end());
  cout << vec.at(vec.size()-1) << endl;
}

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

// constexpr long MOD = 1000000007;
constexpr long MOD = 998244353;
vector<long> fact, inv;

long mpow(long a, long b) {
  long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b /= 2;
  }
  return res;
}

long com(long n, long r) {
  long x = 1, y = 1;
  for (int i = 1; i <= r; i++) {
    x = x * (n - i + 1) % MOD;
    y = y * i % MOD;
  }
  return x * mpow(y, MOD - 2) % MOD;
}

void init(int n) {
  fact.push_back(1);
  inv.push_back(1);
  for (int i = 0; i < n; i++) {
    fact.push_back(fact.at(i) * (i + 1) % MOD);
    inv.push_back(mpow(fact.at(i + 1), MOD - 2));
  }
}

long qcom(long n, long r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fact.at(n) * inv.at(r) % MOD * inv.at(n - r) % MOD;
}

int main() {
  ios::sync_with_stdio(false);
  init(200000);
  long N, M, K;
  cin >> N >> M >> K;
  long ans = 0;
  for (int i = 0; i <= K; i++) {
    long tmp = qcom(N - 1, i);
    tmp *= M;
    tmp %= MOD;
    tmp *= mpow(M - 1, N - i - 1);
    tmp %= MOD;
    ans += tmp;
    ans %= MOD;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 6592
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
    
n=int(input())
f=prime_factorize(n)
if len(f)==0:
  print(0)
  exit()
s=set(f)
r=0

def func(m):
  r=0
  for ii in range(m):
    if m>=ii+1:
      m-=(ii+1)
      r+=1
      #print(ii+1,m,r)
    else:
      break
  return r

for ii in s:
  m=f.count(ii)
  fm=func(m)
  #print("ii",ii,fm)
  r+=fm
  
print(r)

Measured memory_bytes: 9168
gets.to_i
result = []

readlines.each do |command|
  command, num = command.chomp.split

  case command
  when 'insert'
    result.unshift(num)
  when 'delete'
    index = result.find_index(num)
    result.delete_at(index) if index
  when 'deleteFirst'
    result.shift
  when 'deleteLast'
    result.pop
  end
end

puts result.join(' ')

Measured memory_bytes: 296764
#include <iostream>
    #include <vector>
    #include <map>
     
    using namespace std;
     
    #define rep(i,n) for(int i=0; i<n; i++)
     
    int main() {
    int n,m;
    cin >> n >> m;
    vector<int> s(m),g(m);
    int st = 1;
    for (int i=0; i<m; i++) {
    cin >> s[i] >> g[i];
    }
    int ans = 0;
    while(1) {
    int maxi = -1;
    int maxv = st;
    for (int i=0; i<m; i++) {
    if (s[i] <= st && maxv <= g[i]) {
    maxi = i;
    maxv = g[i];
    }
    }
    if (maxi == -1)break;
    ans++;
    st = g[maxi] + 1;
    }
    if (st != n+1) {
    cout << "Impossible" << endl;
    } else {
    cout << ans << endl;
    }
    return 0;
    }

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int long long
int hmt() {int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';if(n) x=-x;return x;}
#define in hmt()
#define ins ({string x;char c=getchar();for(;c==' '||c=='\n';c=getchar());for(;c!=' '&&c!='\n';c=getchar()) x+=c;x;})
#define forinc(i,a,b) for(int i=a,_b=b;i<=_b;++i)
#define fordec(i,a,b) for(int i=a;i>=b;--i)
#define forb(i,BS) for(int i=BS._Find_first();i< BS.size();i = BS._Find_next(i))
#define forv(a,b) for(auto &a:b)
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define reset(f,x) memset(f,x,sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define onbit(x,i) (x|(1<<(i-1)))
#define offbit(x,i) (x&~(1<<(i-1)))
const int N=5010;
int n,a[N],s[N],f[N][N],g[N][N];
vector<int> ke[N];
void DFS(int u,int p)
{
	f[u][0]=a[u];
	g[u][0]=a[u]>0?a[u]:1e17;
	forv(v,ke[u]) if(v!=p)
	{
		DFS(v,u);
		static int h[N];
		forinc(i,0,s[u]+s[v]) h[i]=1e17;
		forinc(i,0,s[u]) forinc(j,0,s[v]) h[i+j]=min(h[i+j],f[u][i]+f[v][j]);
		forinc(i,0,s[u]+s[v]) f[u][i]=h[i],h[i]=1e17;
		forinc(i,0,s[u]) forinc(j,0,s[v]) h[i+j]=min(h[i+j],g[u][i]+g[v][j]);
		forinc(i,0,s[u]+s[v]) g[u][i]=h[i];
		s[u]+=s[v];
	}
	f[u][++s[u]]=1e17;
	fordec(i,s[u]-1,0) if(f[u][i]<0||g[u][i]<1e17)
	{
	    f[u][i+1]=min(f[u][i+1],0ll);
	    g[u][i+1]=min(g[u][i+1],0ll);
	}
}
main()
{
    //freopen("BB.inp","r",stdin);
	n=in;
	forinc(i,1,n) a[i]=in;
	forinc(i,1,n-1)
	{
	    int u=in,v=in;
	    ke[u].pb(v);
	    ke[v].pb(u);
	}
	DFS(1,0);
	int ans=0;
	while(f[1][ans]>=0&&g[1][ans]>=1e17) ++ans;
	cout<<ans<<"\n";
}


Measured memory_bytes: 391424
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int n;
    cin >> n;
    int a[n];
    REP(i,n){
        cin >> a[i];
    }
    sort(a, a + n);
    cout << a[n - 1] - a[0] << endl;
}

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

int main(){
  double x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << setprecision(10) << sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) << endl;
}


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

#define ll long long
#define p_q priority_queue
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define str string
#define s_vec(data,name,vertical,horizontal) vector<vector<(data)>> (name)((vertical),vector<(data)>((horizontal)));


int main(){
    vector<int> a(3);

    for(int i=0;i<3;i++){
        cin>>a.at(i);
    }

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

    bool jud = false;
    for(int i=0;i<3;i++){
        if(i==2){
            if(a.at(i)==7){
                jud = true;
                break;
            }else{
                jud = false;
                break;
            }
        }else{
            if(a.at(i)==5){
                jud = true;
            }else{
                jud = false;
                break;
            }
        }
    }

    if(jud){
        cout<<"YES";
    }else{
        cout<<"NO";
    }



}

Measured memory_bytes: 256
a, b = map(int, input().split())
if a < b:
	ans = [["."] * 100 for _ in range(100)]
	ichi = (a - 1) // 50
	matsu = (a - 1) % 50

	for i in range(ichi):
		if i % 2 == 0:
			for j in range(0, 100, 2):
				ans[i][j] = "#"
		else:
			for j in range(1, 100, 2):
				ans[i][j] = "#"

	if matsu == 0:
		ans[ichi] = ["#"] * 100

	elif ichi % 2 == 0:
		for j in range(0, 2 * matsu - 1, 2):
			ans[ichi][j] = "#"
		for j in range(2 * matsu, 100):
			ans[ichi][j] = "#"
		ans[ichi + 1] = ["#"] * 100

	else:
		for j in range(1, 2 * matsu, 2):
			ans[ichi][j] = "#"
		for j in range(2 * matsu, 100):
			ans[ichi][j] = "#"
		ans[ichi + 1] = ["#"] * 100

	if ichi > 0:
		used = 50 * (ichi - 1) + matsu + 1
	else:
		used = 1
	remain = b - used
	r_ichi = remain // 50
	r_matsu = remain % 50

	for i in range(r_ichi):
		for j in range(0, 100, 2):
			ans[99 - 2 * i][j] = "#"

	for j in range(0, 2 * r_matsu, 2):
		ans[99 - 2 * r_ichi][j] = "#"

else:
	ans = [["#"] * 100 for _ in range(100)]
	ichi = (b - 1) // 50
	matsu = (b - 1) % 50

	for i in range(ichi):
		if i % 2 == 0:
			for j in range(0, 100, 2):
				ans[i][j] = "."
		else:
			for j in range(1, 100, 2):
				ans[i][j] = "."

	if matsu == 0:
		ans[ichi] = ["."] * 100

	elif ichi % 2 == 0:
		for j in range(0, 2 * matsu - 1, 2):
			ans[ichi][j] = "."
		for j in range(2 * matsu, 100):
			ans[ichi][j] = "."
		ans[ichi + 1] = ["."] * 100

	else:
		for j in range(1, 2 * matsu, 2):
			ans[ichi][j] = "."
		for j in range(2 * matsu, 100):
			ans[ichi][j] = "."
		ans[ichi + 1] = ["."] * 100

	if ichi > 0:
		used = 50 * (ichi - 1) + matsu + 1
	else:
		used = 1
	remain = a - used
	r_ichi = remain // 50
	r_matsu = remain % 50

	for i in range(r_ichi):
		for j in range(0, 100, 2):
			ans[99 - 2 * i][j] = "."

	for j in range(0, 2 * r_matsu, 2):
		ans[99 - 2 * r_ichi][j] = "."

print(100, 100)
print(*["".join(ans[i]) for i in range(100)], sep="\n")

Measured memory_bytes: 3288
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  char str[1200];
  char ch;
  int i = 0;
  while((ch = getchar()) != EOF){
    str[i] = ch;
    ++i;
  }
  int length = i;
  vector<int> ans(123,0);
  int temp;
  for(i = 0;i < length;++i){
    temp = (int)str[i];
    if(65 <= temp && temp <= 90){
      temp += 32;
      ++ans.at(temp);
    }else if(97 <= temp && temp <= 122){
      ++ans.at(temp);
    }else{
      continue;
    }
  }
  for(i = 97;i < 123;++i){
    cout << (char)i << " : " << ans.at(i) << endl;
  }
  return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <cmath>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <set>
using ll = long long;
using namespace std;
#define INF 999999999

int main()
{
    int N;
    cin >> N;
    vector<int> C(N);
    int a, b;
    ll ans = 0;

    for (int i = 0; i < N; i++)
    {
        cin >> a >> b;
        C.push_back(a + b);
        ans -= b;
    }
    sort(C.begin(), C.end(), greater<int>());
    for (int i = 0; i < N; i += 2)
        ans += C[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int maxn=300100;
int a[maxn],b[maxn];
int main(){
	int n,A,B;
	scanf("%d%d%d",&n,&A,&B);
	if(A>n||B>n){
		printf("-1\n");
		return 0;
	}
	if(A+B>n+1){
		printf("-1\n");
		return 0;
	}
	if(A*(long long)B<n){
		printf("-1\n");
		return 0;
	}
	int lef=n;
	for(int i=n-A+1;i<=n;i++)
		a[i-(n-A)]=i;
	int num=A;
	lef-=A,B--;
	while(lef-A>B-1){
		for(int i=1;i<=A;i++)
			b[i]=lef,lef--;
		for(int i=A;i>=1;i--)
			a[++num]=b[i];
		B--;
	}
	if(lef){
		int x=lef-B+1;
		for(int i=1;i<=x;i++)
			b[i]=lef,lef--;
		for(int i=x;i>=1;i--)
			a[++num]=b[i];
		while(lef){
			a[++num]=lef;
			lef--;
		}
	}
	for(int i=1;i<=num;i++)
		printf("%d ",a[i]);
	printf("\n");
	return 0;
}


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

template <typename T>
T maximum(vector<T> A,int idx){
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    return A[idx];
}


int main(){
    int N,A_max,A_sec;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    A_max = maximum(A,0);
    A_sec = maximum(A,1);
    rep(i,N){
        if (A[i] == A_max){
            cout << A_sec << endl;
        } else {
            cout << A_max << endl;
        }
    }
}

Measured memory_bytes: 3184
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    N--; 

    int count = 0;
    for(int a = 1; a <= N; a++){
        for(int b = 1; b <= N; b++){
            if (a * b <= N) {
                count++;
            }else{
                break;
            }
        }
    }

    cout << count << endl;
}


Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<pair<int,int>> list;
    for (int i=0; i<n; ++i) {
        int a, v;
        cin >> a >> v;
        list.push_back(make_pair(-v, a));
    }
    sort(list.begin(), list.end());
    cout << list[0].second << " " << -list[0].first << endl;
    return 0;
}

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

int digit(int x){
  int a=0;
  for(int i=0; i<5; i++){
    a+=(x%10);
    x/=10;
  }
  return a;
}

int main(){
  int N; cin >> N;
  int result=10000000;
  for(int i=1; i<=N/2; i++){
    result=min(result,digit(i)+digit(N-i));
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <float.h>
using namespace std;

#define N 3

int a[N];

int main()
{
	cin >> a[0] >> a[1] >> a[2];

	sort(a, a+3);

	int d1 = a[2] - a[0];
	int d2 = a[2] - a[1];

	int m2 = d1 - d2;
	int op2 = m2 / 2;
	if( (m2 % 2) != 0 ) {
		op2 += 2;
	}
	int ans = d2 + op2;

	cout << ans << endl;

	return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int K, T;
	cin >> K >> T;
	vector<int>a(T);
	rep(i, T)cin >> a[i];
	sort(a.begin(), a.end());
	int x = a[T - 1];
	rep(i, T - 1) {
		x -= a[i];
	}
	cout << max(x - 1, 0) << endl;
	return 0;
}

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

int main(){
  int64_t N,M;
  cin>>N>>M;
  if(N==1 && M==1){
  cout<<1<<endl;
  }
  else if(N==1 || M==1){
  cout<<N*M-2<<endl;
  }
  else{
    int64_t sum=(N-2)*(M-2);
      cout<<sum<<endl;
  }
}

Measured memory_bytes: 256
from heapq import*
i=input
for s in[0]*int(i()):
 n,*x=int(i()),[],[]
 for _ in'_'*n:k,l,r=t=[*map(int,i().split())];x[l>r]+=[[[n-k,r,l],t][l>r]]
 for x in x:
  h=[]
  for k,l,r in sorted(x):heappush(h,l-r);s+=l-(k<len(h)and heappop(h))
 print(s)

Measured memory_bytes: 51340
/*
	Author: Luis Manuel D�az Bar�n (LUISMO)
	Problem:
	Online Judge:
	Idea:
*/
#include<bits/stdc++.h>
// Types
#define ll long long
#define ull unsigned long long
// IO
#define sf scanf
#define pf printf
#define mkp make_pair
#define fi first
#define se second
#define endl "\n"

using namespace std;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll inf = 1e16 + 3;
const int mod = 1e9 + 7;
const int lim = 2e5 + 2;

int N;
ll hi[lim];

ll dp[lim];
int mark[lim];

ll DynamicProgramming(int idx)
{
    if(idx <= 0)
        return 0;

    if(mark[idx])
        return dp[idx];

    mark[idx] = true;

    DynamicProgramming(idx - 1);
    DynamicProgramming(idx - 2);

    ll k1 = dp[idx-1] + abs(hi[idx] - hi[idx-1]);
    ll k2 = (idx > 1) ? dp[idx-2] + abs(hi[idx] - hi[idx-2]) : inf;

    dp[idx] = min(k1, k2);
    return dp[idx];
}


void solve()
{
    cin >> N;
    for(int i = 0; i < N; i++) 
        cin >> hi[i];   

    ll answ = DynamicProgramming(N - 1);
    cout << answ;
}

void fastIO()
{
	cin.sync_with_stdio(false);
	cin.tie(0);
}

void IO()
{
	if(fopen("d:\\lmo.in","r") != NULL)
	{
		freopen("d:\\lmo.in","r",stdin);
	}
	else if(fopen("/media/Beijing/lmo.in","r") != NULL)
	{
		freopen("/media/Beijing/lmo.in", "r", stdin);
	}
}

int main()
{
	IO();

	fastIO();

	solve();
}


Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const double pi=3.1415926535;

int main(){
  ll n,m,a,b,c=0,d=0,ans=0;
  cin>>n>>m;
  rep(i,m,n+2){
    a=i;
    a*=i-1;
    a/=2;
    b=i*n-a;
    ans+=b-a+1;
    ans%=mod;
  }
  co(ans);
  
  return 0;
}

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

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

using namespace std;
using ll = long long;

int main(){
	int s, w; cin >> s >> w;
	cout << ((s <= w) ? "unsafe" : "safe") << endl;

	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  int A, B;
  cin >> A >> B;
  string a1, a2;
  int ans = 0;
  for (int i = A; i <= B; ++i) {
    a1 = to_string(i);
    a2.assign(a1.rbegin(), a1.rend());
    if (a1 == a2) ans++;
  } 
  cout << ans << endl;
  return 0;
}


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

using namespace std;

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

  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());

  int s = 0;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      s += a[i];
    } else {
      s -= a[i];
    }
  }

  cout << s << endl;
}

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

#define MAXN 205
int n,m;
bool a[MAXN][MAXN];
char s[MAXN][MAXN];

void rd()
{
	scanf("%d",&n);
	for(int i = 1; i <= n; i ++) {
		scanf("%s",s[i]+1);
		for(int j = 1; j <= n; j ++)
			a[i][j] = s[i][j]-'0';
	}
}

queue<int>q;
int dis[MAXN];
int ans = -1;

bool bfs(int s)
{
	while(!q.empty()) q.pop();
	memset(dis,-1,sizeof(dis));
	q.push(s);
	dis[s] = 0;
	while(!q.empty())
	{
		int x = q.front();
		q.pop();
		for(int i = 1; i <= n; i ++)
		if(a[x][i]) {
			if(dis[i] == -1) {
				dis[i] = dis[x]+1;
				q.push(i);
			} else {
				if(dis[x] == dis[i]+1 || dis[i] == dis[x]+1) ;
				else return 0;
			}
		}
	}
//	for(int i = 1; i <= n; i ++)
//		cout<<dis[i]<<" ";
//	cout<<"\n";
	for(int i = 1; i <= n; i ++)
		ans = max(ans,dis[i]+1);
	return 1;
}

signed main()
{
	rd();
	for(int i = 1; i <= n; i ++)
		bfs(i);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 384
#!/usr/bin/env python3


def solv(n, dams):
    m = (sum(dams[::2]) - sum(dams[1::2])) // 2
    ans = [m*2]
    for d in dams[:-1]:
        m = d - m
        ans.append(m*2)
    return ans


if __name__ == '__main__':

    n = int(input())
    dams = [int(a) for a in input().split()]
    ans = solv(n, dams)

    print(' '.join([str(a) for a in ans]))


Measured memory_bytes: 19144
a=list(map(int, input().split()))
A=a[0]
B=a[1]
N=a[2]
if B-1<N:
    i=int(A*(B-1)/B)-A*int((B-1)/B)
else:
    i=int(A*N/B)-A*int(N/B)
print(i)

Measured memory_bytes: 9180
#include <iostream>

using namespace std;

class ShellSort
{
public:
  int insertSort( int *a, int n, int g);
  int shsort( int *a, int n, int *m, int *g );
};

int ShellSort::insertSort( int *a, int n, int g)
{
  int cnt = 0;
  
  for ( int i = g; i < n; i++ )
    {
      int v = a[i];
      int j = i - g;
      while (j >= 0 && a[j] > v)
        {
          a[j+g] = a[j];
          j -= g;
          cnt++;
        }
      a[j+g] = v;
    }
  return cnt;
}

int ShellSort::shsort( int *a, int n, int *m, int *g )
{
  int cnt = 0;

  int i = 0;

  if ( n == 1 )
    {
      *m = 1;
      g[0] = 1;
    }
  else
    {
      for (int l = n / 2; l > 0; l /= 2)
        {
          (*m)++;
          g[i++] = l;
        }
    }
  
  for ( int i = 0; i < *m; i++ )
    {
      cnt += insertSort(a, n, g[i]);
    }

  return cnt;
}

int main( void )
{
  int n;
  int g[100];
  int m = 0;
  int cnt;

  ShellSort ss;

  cin >> n;

  int *a = new int[n];
  
  for ( int i = 0; i < n; i++ )
    {
      cin >> a[i];
    }

  cnt = ss.shsort(a, n, &m, g);
  
  cout << m << endl;
  cout << g[0];
  for(int i = 1; i < m; i++)
    cout << " " << g[i];
  cout << endl;

  cout << cnt << endl;
  
  for(int i = 0; i < n; i++)
    cout <<  a[i] << endl;

  return 0;
}

Measured memory_bytes: 5088
import numpy as np
import pdb
import copy

def main():
    [N, A, B] = map(int, raw_input().split(' '))
    print mysum(N, A, B)

def mysum(N, A, B):
    sumval = 0
    for k in range(N + 1 ):
        checkval = np.sum(np.array(list(str(k))).astype(int))
        if checkval <= B and checkval >= A:
            sumval += k
    return sumval


if __name__ == '__main__':
    main()


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

int main() {
  int n;
  cin>>n;
  vector<vector<P> > a(n+1);
  rep(i,0,n-1){
    int f,t;
    cin>>f>>t;
    a[f].push_back(P(t,i+1));
    a[t].push_back(P(f,i+1));
  }
  int b[n+1];
  rep(i,1,n+1) b[i]=0;
  b[1]=-1;
  queue<int> q;
  q.push(1);
  while(q.size()){
    int p=q.front();
    q.pop();
    int cur=1;
    rep(i,0,a[p].size()){
      if(b[a[p][i].first]==0){
        if(cur==b[p]) cur++;
        b[a[p][i].first]=cur;
        cur++;
        q.push(a[p][i].first);
      }
    }
  }
  
  int c[n];
  rep(i,0,n) c[i]=0;
  c[0]=-1;
  queue<int> r;
  r.push(1);
  while(r.size()){
    int s=r.front();
    r.pop();
    rep(i,0,a[s].size()){
      if(c[a[s][i].second]==0){
        c[a[s][i].second]=a[s][i].first;
        r.push(a[s][i].first);
      }
    }
  }
  
  int ans=0;
  rep(i,2,n+1) ans=max(ans,b[i]);
  cout<<ans<<endl;
  rep(i,2,n+1) cout<<b[c[i-1]]<<endl;
}


Measured memory_bytes: 7296
#include <stdio.h>
#define min(a, b) ((a)<(b) ? (a) : (b))
#define max(a, b) ((a)>(b) ? (a) : (b))
#define abs(a) ((a)<0 ? -(a) : (a))

int main(void){
  int n, k, h[100001], cost[100001];
  scanf("%d%d", &n, &k);
  for(int i=0; i<n; i++) scanf("%d", &h[i]);
  cost[0] = 0;
  for(int i=1; i<n; i++) cost[i] = 1000000000;
  for(int i=1; i<n; i++){
    int start = max(0, i-k);
    for(int j=i-1; j>=start; j--){
      cost[i] = min(cost[j]+abs(h[i]-h[j]), cost[i]);
    }
  }

  printf("%d\n", cost[n-1]);
  
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


lint rec(int n, lint x) {
  lint m = (1LL << n + 2) - 3;
  assert(0 < x and x <= m);
  if (!n) {
    return 1;
  }
  if (x == 1) return 0;
  if (x <= m - 1 >> 1) {
    return rec(n - 1, x - 1);
  }
  x -= m - 1 >> 1;
  lint res = (1LL << n) - 1;
  if (x == 1) return res + 1;
  if (x == m + 1 >> 1) return 2 * res + 1;
  return res + 1 + rec(n - 1, x - 1);
}

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n; cin >> n;
  lint x; cin >> x;
  cout << rec(n, x) << '\n';
}

Measured memory_bytes: 256
// Never let them see you bleed...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

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

const int maxn = 1e5 + 10, mod = 1e9 + 7, inf = 1e9 + 10;

vector<int> v[maxn];
ll ans = 0;

vector<int> path;
int mark[maxn], pr[maxn];

bool find_cyc(int u, int par = -1){
    mark[u] = 1;
    pr[u] = par;
    for(int y : v[u]){
	if(mark[y] == 1 && y != par){
	    int tmp = u;
	    while(tmp != y)
		path.PB(tmp), tmp = pr[tmp];
	    path.PB(y);
	    return 1;
	}
	if(mark[y] == 0){
	    if(find_cyc(y, u))
		return 1;
	}
    }
    mark[u] = 2;
    return 0;
}
pii dfs(int u, int h = 0, int par = -1){
    int cnt[2] = {0,0};
    for(int y : v[u]){
	if(y != par && !mark[y]){
	    pii p = dfs(y, h+1, u);
	    cnt[p.S]+= p.F;
	    ans+= p.F;
	}
    }
    cnt[h&1]++;
    int mn = min(cnt[0], cnt[1]);
    cnt[0]-=mn, cnt[1]-=mn;
    if(cnt[1] != 0)
	return {cnt[1], 1};
    else
	return {cnt[0], 0};
}

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

    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
	int a, b;
	cin >> a >> b;
	v[a].PB(b);
	v[b].PB(a);
    }
    if(m == n-1){
	if(dfs(1).F != 0)
	    return cout << -1 << endl, 0;
    }
    else{
	find_cyc(1);
	memset(mark, 0, sizeof mark);
	vector<int> vec;
	for(int u : path){
	    mark[u] = 1;
	}
	int sm = 0;
	for(int u : path){
	    pii p = dfs(u, sz(vec)&1);
	    vec.PB(p.F * (p.S ? 1 : -1));
	    sm+= vec.back();
	}
	if(sz(path) & 1){
	    if(sm & 1)
		return cout << -1 << endl, 0;
	    sm/=2;
	    ans+= abs(sm);
	    vec[0]-= sm;
	    vec[sz(vec)-1]-= sm;
	    int bef = 0;
	    for(int x : vec){
		ans+= abs(x+bef);
		bef = x+bef;
	    }
	}
	else{
	    if(sm != 0)
		return cout << -1 << endl, 0;
	    vector<int> vec2;
	    int bef = 0;
	    for(int x : vec){
		vec2.PB(x+bef);
		bef = vec2.back();
	    }
	    sort(vec2.begin(), vec2.end());
	    int med = vec2[sz(vec2)/2];
	    for(int x : vec2){
		ans+= abs(med - x);
	    }
	}
    }
    return cout << ans << endl, 0;
}


Measured memory_bytes: 14328
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int dx[4] {-1,+1, 0, 0};
int dy[4] { 0, 0,-1,+1};
int main()
{
  int n; cin >> n;
  vecll a(n,0), b(n,0), c(n,0), d(n,0);
  ll ans = 0;
  REP(i,n){
    cin >> a[i] >> b[i];
    d[i] = - a[i]%b[i];
    if(d[i] != 0){
      d[i] += b[i];
    }
  }
  reverse(all(a));
  reverse(all(b));
  reverse(all(d));

  ans = d[0];
  c[0] = d[0];
  REP(i,n - 1){
    if(d[i + 1] >= c[i]){
      c[i + 1] = d[i];
    }else{
      ll tmp = (c[i] - d[i + 1])/b[i + 1] + ((c[i] - d[i + 1])%b[i + 1] != 0);
      c[i + 1] = tmp*b[i+1] + d[i + 1];
    }
    ans += c[i + 1];
  }
  // cout << "c,d" << endl;
  // REP(i,n){
  //   cout << d[i]<<" " << c[i] << endl;
  // }

  cout << c[n - 1] << endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e5+5;
long long a[MAXN];
long long b[MAXN];
long long ans=0;
int main(){
    int n;
    cin >>n;    
    for(int i=1;i<=n;i++){
        cin>>a[i];
        b[i]=b[i-1]+a[i];
        ans+=a[i];
    }
    long long cmin=INT_MAX;
    for(int i=1;i<n;i++)if(cmin>abs(2*b[i]-ans))cmin=abs(2*b[i]-ans);
    cout<<cmin<<endl;
    return 0;
}

Measured memory_bytes: 3328
import sys
input = sys.stdin.readline
a,b=map(int,input().split())
if a==1 and b==1:
    print("Draw")
else:
    if a==1:
        print("Alice")
    elif b==1:
        print("Bob")
    elif a>b:
        print("Alice")
    elif a<b:
        print("Bob")
    else:
        print("Draw")


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

using namespace std;

int main(){

    int N,i;
    cin >> N;

    vector<int> A(N);    

    for(i = 0; i < N; i++){
        cin >> A[i];
     
    }
    for(i = 0 ; i< N-1; i++){
        printf("%d ", A[i]);    
    }
    printf("%d\n",A[i]);

    
    int v,j,k;
    for(i = 1; i < N; i++){
        v = A[i];
        j = i -1 ;
        while(j >= 0 && A[j] > v){
            A[j + 1] = A[j];
            j--;
        }
        A[j+1] = v;
        for(k = 0; k < N-1; k++){
            printf("%d ", A[k]);
        }
        printf("%d\n",A[k]);
        
        
    }
    

    return 0;
}


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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  int aa = (a / c) + (a % c == 0 ? 0 : 1);
  int bb = (b / d) + (b % d == 0 ? 0 : 1);
  cout << n - max(aa, bb) << endl; 
}

Measured memory_bytes: 3100
#include <stdio.h>

int main(){
    int s;
    scanf("%d", &s);
    int hour = (s / 60) / 60;
    int min =  (s / 60) % 60;
    int sec = (s % 60);
//    h = S / 3600;
//    m = S % 3600 / 60;
//    s = S % 60;
    printf("%d:%d:%d\n", hour, min, sec);
    return 0;
}

Measured memory_bytes: 592
import java.io.PrintWriter

val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val s = listOfInt().sorted()
    println(Math.abs(s[1]-s[0]) + Math.abs(s[2]-s[1]))
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt()= listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 35976
n, q = map(int, input().split())
s = input()
count = [0] * n
for i in range(1, n):
  count[i] += count[i-1]
  if s[i-1:1+i] == 'AC' :
    count[i] += 1
for i in range(q):
  l, r = map(int, input().split())
  print(count[r-1] - count[l-1])

Measured memory_bytes: 9620
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ceel(x, y) ((x) / (y) + !((x) % (y) == 0))
#define ff first
#define ss second
#define endl '\n'
#define print(v) for(auto x : v) cout << x << ' '; cout << endl;
#define debug(v) cout << #v << " = "; print(v);
#define printmp(v) for(auto x : v) cout << x.first << ' ' << x.second << endl; cout << endl;
using namespace std;
typedef long long int ll;
typedef long double ld;
void solve(){
    int a[3];
    for(int &x : a) cin >> x;
    sort(a , a + 3);
    if(a[0] == 5 && a[1] == 5 && a[2] == 7) cout << "YES" << endl;
    else cout << "NO" << endl;
}
int main(){
    fastio;
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

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

int main(){

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

    map <ll, ll> cnt;
    ll tmp = 0;
    for(int i = 0; i < N; i++){
        tmp += v[i];
        cnt[tmp] ++;
    }

    if(DEBAG){
        for(auto i = cnt.begin(); i != cnt.end(); ++i){
            cout << i->first << ":" << i->second << endl;
        }
    }

    if(DEBAG) cout << endl;

    tmp = 0;
    ll ans = 0;
    for(int i = 0; i < N; i++){
        tmp += v[i];
        cnt[tmp] --;
        if(tmp == 0) ans ++;;
        ans += cnt[tmp];
        if(DEBAG) cout << "i: " << i << " ans: " << ans << endl;
    }
    cout << ans << endl; 

}

Measured memory_bytes: 14336
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int T = in.nextInt();
        int[] c = new int[N];
        int[] t = new int[N];
        for(int i=0; i<N; i++) {
            c[i] = in.nextInt();
            t[i] = in.nextInt();
        }

        int ans = -1;
        int min = Integer.MAX_VALUE;
        for(int i=0; i<N; i++) {
            if(t[i] > T) {
                continue;
            } else {
                if(c[i] < min) {
                    ans = i;
                    min = c[i];
                }
            }
        }

        if(ans == -1) System.out.println("TLE");
        else System.out.println(min);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;


void north(int* faces) {
	int tmp[7];

	//top(1) to back(5)
	tmp[5] = faces[1];

	//front(2) to top(1)
	tmp[1] = faces[2];

	//right(3) to right(3)
	tmp[3] = faces[3];

	//left(4) to left(4)
	tmp[4] = faces[4];

	//back(5) to bottom(6)
	tmp[6] = faces[5];

	//bottom(6) to front(2)
	tmp[2] = faces[6];

	memcpy(faces, tmp, sizeof(tmp));

}
void west(int* faces) {
	int tmp[7];

	//top(1) to left(4)
	tmp[4] = faces[1];

	//front(2) to front(2)
	tmp[2] = faces[2];

	//right(3) to top(1)
	tmp[1] = faces[3];

	//left(4) to bottom(6)
	tmp[6] = faces[4];

	//back(5) to back(5)
	tmp[5] = faces[5];

	//bottom(6) to right(3)
	tmp[3] = faces[6];

	memcpy(faces, tmp, sizeof(tmp));

}

int dice(int *faces, int *questions) {
	for (int i = 1; i < 7; i++)
	{
		if (faces[i] == questions[0]) {
			if (i == 3 || i == 4)west(faces);
			break;
		}
	}
	
	while (true)
	{
		north(faces);
		if (faces[2] == questions[0])break;
	}

	while (true)
	{
		west(faces);
		if (faces[3] == questions[1])break;
	}

	return faces[1];
}


int main() {
	vector<int> answers;
	int faces[7], questions[2], ques_num;;
	for (int i = 1; i < 7; i++)
	{
		cin >> faces[i];
	}

	cin >> ques_num;

	for (int i = 0; i < ques_num; i++)
	{
		for (int i = 0; i < 2; i++)
		{
			cin >> questions[i];
		}
		answers.push_back(dice(faces, questions));
	}
	
	for (int i = 0; i < ques_num; i++)
	{
		cout << answers.at(i) << endl;
	}

	return 0;
}

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

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

long long MOD = 1000000000 + 7;
vector<pair<char,int>> run_comp(string S){
  vector<pair<char,int>> v;
  char now = S[0];
  int num = 1;
  char tmp = S[S.size()-1];
  for(int i = 1; i < S.size(); i++){
    tmp = S[i];
    if(now == tmp){
      num++;
    } else { 
      v.push_back(make_pair(now, num));
      num = 1;
      now = tmp;
    }
  }

  v.push_back(make_pair(tmp, num));

  return v;
}

int main(){
  int N, K;
  cin >> N >> K;
  string S;
  cin >> S;
  auto x = run_comp(S);
  
  int ans;
  if(x.size() == 1){
    if(S[0] == '0'){
      if(K>0){
        ans = N;
      } else {
        ans = 0;
      }
    } else { 
      ans = N;
    }
    cout << ans << endl;
    return 0;
  }

  bool head_flg = (S[0] == '1' ? true: false);
  bool tail_flg = (S[S.size()-1] == '1' ? true: false);

  vector<int> v;
  if(head_flg){
    //
  } else { 
    v.push_back(0);
  }
  for(auto y:x){
    v.push_back(y.second);
  }
  if(tail_flg){
    //
  } else { 
    v.push_back(0);
  }
  // vは１始まり、1終わり


  if(2*K+1 > v.size()){
    K = v.size()/2;
  }


  // -> 偶数番目を1にした時の最長長さを求める
  vector<int> w(v.size());
  w[0] = v[0];
  for(int i = 1; i < w.size(); i++){
    w[i] = w[i-1] + v[i];
  }
  // K = 1なら、012, 234, -> w[2], w[4] - w[1], ...
  // K = 2なら、01234, -> w[4], w[6] - w[1], ...

  ans = w[2*K];
  int index = 1;
  while(index + 2*K + 1 < w.size()){
    ans = max(ans, w[index + 2*K +1] - w[index]);
    index+=2;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 2164
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s,ans;
    cin >> s;
    int n=s.size();
    sort(s.begin(),s.end());
    int count;
    count=1;
    for(int i=0;i<n;i++){
      if(s[i]==s[i+1]){
        count++;
      }
      else{
        if(count%2==1){
          ans="No";
          break;
        }else{
          count=1;
          ans="Yes";
        }
      }
    }
   cout<<ans<<endl;     
}


Measured memory_bytes: 256
using System;
namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Console.WriteLine(a[0] * a[1] * a[2] == 5 * 5 * 7 ? "YES" : "NO");
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end() 
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define rep(i, a, b) for(int i = a; i < b; i++)
#define repr(i, a, b) for(int i = a - 1; i >= b; i--)
#define iter(m) for(auto it = m.begin(); it != m.end(); it++)
#define iterr(m) for(auto it = m.rbegin(); it != m.rend(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);

signed main(){
    speed;
    int n; cin >> n;
    int mx = 0;
    vi v(n);
    rep(i, 0, n) {
        cin >> v[i];
        mx = max(mx, v[i]);
    }
    int k = mx;
    int mn = INT_MAX;
    rep(i, 0, n) {
        int dif = abs( 2 * v[i] - mx);
        if(dif < mn && mx != v[i]) {
            mn = dif;
            k = v[i];
        }
    }
    cout << mx << " " << k;
    return 0;
}

Measured memory_bytes: 3936
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define pii pair<int,int>
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int a,b,c; cin>>a>>b>>c;
  int ans=0;
  rep(i,a,b+1){
    if(c%i==0) ans++;
  }
  co(ans);
  return 0;
}


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

int main()
{
    int n;
    while(cin>>n){
        multiset<int> LIS;
        int temp;
        cin>>temp;
        LIS.insert(temp);
        for(int i=1;i<n;i++){
            cin>>temp;
            if(temp<=*LIS.begin()){
                LIS.insert(temp);
            }
            else{
                auto p = LIS.lower_bound(temp);
                if(p!=LIS.begin()) p--;
                LIS.erase(p);
                LIS.insert(temp);
            }
        }
        cout<<LIS.size()<<endl;
    }
    return 0;
}


Measured memory_bytes: 4992
import fractions

N = int(input())
A = list(map(int,input().split()))

# ユークリッドの互除法
# 全体の最小公約数 = 最小値
min_life = fractions.gcd(A[0],A[1])

for i in range(1,N):
    min_life = fractions.gcd(min_life,A[i])

print(min_life)

Measured memory_bytes: 16300
# nCk(mod p)の計算
from math import factorial
X, Y = map(int, input().split())
MOD = 10**9+7
MAX = 10**6+1

 # a!のテーブルfact
fact = [0] * MAX
# (a!)^-1のテーブルfinv
finv = [0] * MAX

def comb_init():
    # a!と(a!)^-1のテーブルを作る
    # 累積積のイメージ
    fact[0] = fact[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, MAX):
        fact[i] = i * fact[i-1] % MOD
        finv[i] = pow(i, -1, MOD) * finv[i-1] % MOD

def comb(n, r):
    return fact[n] * (finv[n-r] * finv[r] % MOD) % MOD    


if (X+Y) % 3 != 0:
    print(0)
else:
    num = (X+Y)//3
    p = (Y - X + num) // 2
    q = (X + num - Y) // 2
    if not num >= min(p, q) >= 0:
        print(0)
        exit()
    comb_init()
    print(comb(num, min(p, q)))

Measured memory_bytes: 88120
N, T = map(int, input().split())

min_c = 1001

for _ in range(N):
    _c, _t = map(int, input().split())

    if _t <= T:
        min_c = min(min_c, _c)

if min_c == 1001:
    print('TLE')
else:
    print(min_c)


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>

#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define abs(a) (((a) < 0) ? -(a) : (a))

#define FOR(var, to)          for (register int var = 0; var < to; var++)
#define FROMTO(var, from, to) for (register int var = from; var <= to; var++)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

static inline int ri() {
	int a;
	scanf("%d", &a);
	return a;
}

static inline s64 rs64() {
	s64 a;
	scanf("%" SCNd64, &a);
	return a;
}

static inline void wi(int a) {
	printf("%d", a);
}

static inline void wu64(u64 a) {
	printf("%" PRIu64, a);
}

int main() {
	s64 k = rs64();
	for (int i = 0; i < 9 && i < k; i++) {
		printf("%d\n", i+1);
	}
	k -= 9;
	if (k > 0) {
		int fill_9 = 0;
		s64 base = 1;
		while(1){
			bool break_flag = false;
			for (int i = 1; i < 10; i++) {
				for (int j = 0; j < 10; j++) {
					if (fill_9 == 13 && i == 1 && j == 0) {
						for (int i = 0; i < 10&&k; i++,k--)
							wu64((100+i+1)*(base/10)-1),printf("\n");
						if (!k) {break_flag = true;break;}
						continue;
					} else if (j != 9 && (i*10+j) >= (i+j+9*fill_9)) continue;
					wu64((u64) base*(i*10+j+1)-1);
					// printf("    i : %d, j : %d, filee_9 : %d", i, j, fill_9);
					printf("\n");
					k--;
					if (!k) {break_flag = true;break;}
				}
				if (break_flag) break;
			}
			if (break_flag) break;
			
			base*=10;
			fill_9++;
		}
	}
	
	return 0;
}


Measured memory_bytes: 128