akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    int n;
    std::cin >> n;
    std::vector<pair<int,int>> a(n);
    rep(i,n){
        int dum;
        std::cin >> dum;
        a[i]=mp(dum,i+1);
    }
    sort(all(a));
    std::vector<int> aa(n);
    rep(i,n)aa[a[i].se-1]=i+1;
    int ans=0;
    for (int i = 1; i < n; i+=2) {
        /* code */
        if(aa[i]%2==1)ans++;
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 1408
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;

inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline int ad(int x,int y){int ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int sub(int x,int y){int ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int gun(int x,int y){int ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}


 main()

{
    fast
    int n,m;
    cin>>n>>m;
    int vis[n+5];clr(vis);
    deque<int>dq;
    deque<int>::iterator it;
    dq.push_back(1);
    vis[1]=1;
    vector<int>adj[n+3];
    while(m--)
    {
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    while(1)
    {
        int flag=0;
        int x=dq.back();
        for(auto v:adj[x])
        {
            if(vis[v]==0)
            {
                dq.push_back(v);
                vis[v]=1;
                flag=1;
                break;
            }
        }
        if(flag==0)break;
    }
     while(1)
    {
        int flag=0;
        int x=dq.front();
        for(auto v:adj[x])
        {
            if(vis[v]==0)
            {
                dq.push_front(v);
                vis[v]=1;
                flag=1;
                break;
            }
        }
        if(flag==0)break;
    }
    cout<<dq.size()<<endl;
    for(it=dq.begin();it!=dq.end();it++)
    {
        cout<<*it<<" ";
    }
    cout<<endl;
    return 0;

}





































Measured memory_bytes: 7936
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())

#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7:合同式の法
 
int main(){
    string s;
    cin >> s;

    int flag = 0;
    REP(i,s.length()){
        FOR(j,i+1,s.length()){
            if(s[i]!=s[j]){
                flag = 1;
            }
        }
    }
    if(flag == 1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int vis [200009];
vector <int> adj[200009];
int dist[200009];
int n,e;
void bfs(int node)
{
    queue <int>Q;
    Q.push(node);
    vis[node] = 1;

    while(!Q.empty())
    {
        int u = Q.front();
        Q.pop();
        for(int k = 0; k<adj[u].size(); k++)
        {
            if(!vis[adj[u][k]])
            {
                int v = adj[u][k];
                dist[adj[u][k]] = dist[u]+1;
                vis[v] = 1;
                Q.push(v);
            }
        }
    }
}
int main ()
{
    cin>>n>>e;
   // memset(vis,0,sizeof(vis));
    for(int i = 1; i<=e; i++)
    {
        int x,y;
        cin>>x>>y;
        adj[x].push_back(y);
    }
    bfs(1);
    if(dist[n]<=2 && dist[n]>0)
    {
        cout<<"POSSIBLE"<<endl;
    }
    else
        cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 10488
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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; }

int f(int n) {
  if (n == 1) return 1;
  return n*f(n-1);
}

int main () {
  int n;
  cin >> n;
  vector<double> x(n), y(n);
  rep(i,n) {
    cin >> x[i] >> y[i];
  }

  vi v;
  rep(i,n) {
    v.pb(i);
  }

  double d = 0;
  do {
    rep(i,v.size()-1) {
      double a = (x[v[i]] - x[v[i+1]])*(x[v[i]] - x[v[i+1]]);
      double b = (y[v[i]] - y[v[i+1]])*(y[v[i]] - y[v[i+1]]);
      d += sqrt(a+b);
    }
  } while (next_permutation(rng(v)));
  d /= (double)f(n);

  cout << fixed << setprecision(10);
  cout << d << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque


def nearlist(N):  # 隣接リスト
    NEAR = [set() for _ in range(3 * N)]
    for a, b in uv:
        a, b = 3 * (a - 1), 3 * (b - 1)
        NEAR[a].add(b + 1)
        NEAR[a + 1].add(b + 2)
        NEAR[a + 2].add(b)
    return NEAR


def bfs(S, T, N):  # 幅優先探索  # キュー
    S, T = 3 * (S - 1), 3 * (T - 1)
    dist, flag = [-3] * (3 * N), [0] * (3 * N)  # 前処理
    dist[S], flag[S], que = 0, 1, deque([S])

    while que:
        q = que.popleft()
        for i in near[q]:  # 移動先の候補
            if flag[i]:  # 処理済みか否か
                continue
            dist[i] = dist[q] + 1
            flag[i] = 1
            que.append(i)
    return dist[T] // 3


n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

# 解説AC
near = nearlist(n)
ans = bfs(s, t, n)
print(ans)


Measured memory_bytes: 178388
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) 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(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}


void solve(long long N, std::vector<long long> A){
    map <LL, LL> m;
    REP(i, N){
        if(!m[A[i]]){
            m[A[i]] = 1;
        }
        else m[A[i]] = 0;
    }
    LL cnt=0;
    REP(i, N){
        if(m[A[i]]==1){
            m[A[i]]=0; cnt++;
        }
    }
    cout<<cnt<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 7296
import java.util.*;

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

    char[] a = sc.nextLine().toCharArray();
    char[] b = sc.nextLine().toCharArray();
    char[] c = sc.nextLine().toCharArray();

    char k = 'a';

    int an = 0;
    int bn = 0;
    int cn = 0;
    int n = a.length + b.length + c.length;

    String w = "";
    LABEL: for (int i = 0; i < n; i++) {
      if (k == 'a') {
        if (an == a.length) {
          w = "A";
          break LABEL;
        } else {
          k = a[an];
          an++;
        }
      } else if (k == 'b') {
        if (bn == b.length) {
          w = "B";
          break LABEL;
        } else {
          k = b[bn];
          bn++;
        }
      } else if (k == 'c') {
        if (cn == c.length) {
          w = "C";
          break LABEL;
        } else {
          k = c[cn];
          cn++;
        }
      }
    }
    
    System.out.println(w);
  }
}

Measured memory_bytes: 23124
#include<stdio.h>

int main(){

    int a,b;

    scanf("%d",&a);
    scanf("%d",&b);

    if(a < b){
        printf("a < b\n");
    }else if(a > b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }

    return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    cout << ((C > A && C > B) || (C < A && C < B) ? "No" : "Yes") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;

signed main() {
	int N, K;
	cin >> N >> K;
	vector<int>h(N);
	rep(i, N)cin >> h[i];
	vector<int>dp(N, 0);
	dp[0] = 0;
	for(int i = 1; i < N; i++) {
		int mn = INF;
		for (int j = 1; j<=K&&i-j>=0 ; j++) {
			mn = min(mn, dp[i - j] + abs(h[i] - h[i - j]));
		}
		dp[i] = mn;
	}
	cout << dp[N - 1];
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}


int main()
{
    ll h;
    cin >> h;

    ll i = 0;
    ll ans = 0;
    while (h != 0) {
        ans += pow(2,i);
        h = floor(h/2);
        i++;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut l: Vec<i32> = Vec::new();
    let mut r: Vec<i32> = Vec::new();

    for _ in 0..m {
        l.push(read());
        r.push(read());
    }

    let ans = r.iter().min().unwrap() - l.iter().max().unwrap() + 1;
    if ans < 0 {
        println!("0");
    }else {
        println!("{}", ans);
    }

}


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

int main(){
  char b;
  cin >> b;
  
  if(b == 'A'){
    cout << 'T' << endl;
  }
  else if(b == 'T'){
    cout << 'A' << endl;
  }
  else if(b == 'G'){
    cout << 'C' << endl;
  }
  else {
    cout << 'G' << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int qsort_int(const void *a, const void *b)
{
    return *(int *)a - *(int *)b;
}

int main(int argc, char *argv[])
{
    int n;
    int a[100000];
    int alive, offset;
    int check;
    int i;
    int ans;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }

    qsort(a, n, sizeof(int), qsort_int);

    alive = n;
    offset = 0;
    check = 0;
    while(alive > 1) {
        if (a[offset] == 1) {break;}
        check = 0;
        for (i = offset + 1; i < n; i++) {
            a[i] %= a[offset];
            if (a[i] < 1) {alive--;}
            if (a[i] > 0 && a[i] % a[offset] == 0) {check++;}
        }
        if (check == alive - 1) {break;}
        qsort(a + offset, n - offset, sizeof(int), qsort_int);
        offset = n - alive;
    }

    printf("%d\n", a[offset]);

    return 0;
}


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


using namespace std;

int main (void)
{

  int N;
  cin >> N;

  int i, j;
  vector<int> light(N);

  for(i=0; i<N; i++)
  {
    cin >> light.at(i);
  }

  int  next;
  int  tmp;

  tmp = 1;
  for(i=1; i<N; i++)
  {

    next = light.at(tmp -1);

    if(next == 2)
    {
      cout << i << endl;
      break;
    }

    tmp = next;
    
  }

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

  return 0;

}



Measured memory_bytes: 640
import java.util.*;

public class Main
 {
	public static void main (String[] args)
	 {
	    Scanner in = new Scanner(System.in);
	    int A,B;
	    A = in.nextInt();
	    B = in.nextInt();
	    int max = Math.max(A+B, Math.max(A-B, A*B));
	    System.out.println(max);

	    
	 }
	
	 

}



Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
int main(){
	string s,ans;
	std::cin >> s;
	int le=s.size();
	rep(i,le){
		if(s[i]=='0')ans.push_back('0');
		if(s[i]=='1')ans.push_back('1');
		if(s[i]=='B'){
			if(ans.size()!=0){
				ans.erase(ans.size()-1);
			}
		}
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int W = sc.nextInt();
      int H = sc.nextInt();
      int x = sc.nextInt();
      int y = sc.nextInt();
      int r = sc.nextInt();
     
      if(0 <= x - r && x + r <= W && 0 <= y - r && y + r <= H){
          System.out.printf("Yes\n");
      }
      else{
          System.out.printf("No\n");
      }
   }
}


Measured memory_bytes: 26436
from bisect import bisect_right

a, b, q = map(int, input().split())
INF = 10**11
s = [-INF] + [int(input()) for _ in range(a)] + [INF]
t = [-INF] + [int(input()) for _ in range(b)] + [INF]

for _ in range(q):
    x = int(input())

    si = bisect_right(s, x)
    ti = bisect_right(t, x)

    ans = INF * 10
    for ss in [s[si-1], s[si]]:
        for tt in [t[ti-1], t[ti]]:
            ans = min(ans,
                      abs(x - ss) + abs(ss - tt),
                      abs(x - tt) + abs(tt - ss))
    print(ans)


Measured memory_bytes: 14096
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define repd(i,a,b) for(int i=int(a)-1;i>=int(b);i--)
#define up(i,a,b) for(int i=int(a);i<=int(b);i++)
#define down(i,a,b) for(int i=int(a);i>=int(b);i--)
#define X first
#define Y second
#define CL(x) (x<<1)
#define CR(x) (x<<1)+1
#define pb push_back
/*----------------------------------------------*/
using namespace std;
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
typedef pair<int, int> pii;typedef pair<ll, int> pli;typedef pair<ll, ll> pll;
typedef vector<int> vi;typedef vector<ll> vl;typedef vector<pll> vll;
typedef vector<vi> vvi;typedef vector<pii> vii; typedef vector<pli> vli;
/*----------------------------------------------*/
const int maxn=2e3+7;
const int maxm=30;
const ll linf=1e16; const int inf=2e9;
const ll mod=1e9+7;
const double esp=1e-7;
const long double pi=4*atan((long double)1);
const int as=6e3;
/*----------------------------------------------*/
inline int getbit(int x,int k){return (x>>k)&1;}
inline int pow2(int x){return (1<<x);}
inline int offbit(int x,int k){return x&~(1<<k);}
/*----------------------------------------------*/

int n;
int kq=inf;

inline void enter(){
    cin>>n;
}

inline int digitsum(int x){
    int res=0;
    while(x) res+=x%10,x/=10;
    return res;
}

inline void solve(){
    up(i,1,n-1) kq=min(kq,digitsum(i)+digitsum(n-i));
    cout<<kq;
}

inline void file(){
    #define task "TEST"
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    freopen(task".INP","r",stdin);
    freopen(task".OUT","w",stdout);
}

int main(){
    #define OnlineJudge
    #ifndef OnlineJudge
    file();
    #endif
    enter();
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
  ll n,k,s;
  cin >> n >> k >> s;

  if(s < 1000000000){
    for(int i = 0;i < k;i++){
      cout << s << endl;
    }
    for(int i = k;i < n;i++){
      cout << s + 1 << endl;
    }
  }
  else{
    for(int i = 0;i < k;i++){
      cout << s << endl;
    }
    for(int i = k;i < n;i++){
      cout << 1 << endl;
    }
  }
  

}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;
 
int main() {
	int a, b, c;
	cin >> a >> b >> c;
    
    int maxi = max(a, b);
    int mini = min(a, b);

	if (mini<c && c<maxi)
	cout << "Yes" << endl;
	else
	{
		cout << "No" << endl;
	}
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define S set<int>
V A,B,C,D;
#define pb(v) push_back(v)
int main(){
    CIN(W);CIN(A);CIN(B);
    if(A<=B&&B<=A+W||A<=B+W&&B+W<=A+W){
        COUT(0);return 0;
    }
    COUT(min({abs(A+W-B),abs(A-B),abs(B-A+W)}));
    return 0;
}


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

void merge_sort(vector<int>& A, int left, int right, int& cnt){
    if (left >= right) return;
    int mid = (left + right) / 2;
    merge_sort(A, left   , mid  , cnt);
    merge_sort(A, mid + 1, right, cnt);
    int A1[mid - left + 2];
    int A2[right - mid + 1];
    for (int i = 0; i < mid - left + 1; i++) {
        A1[i] = A[left+i];
    }
    A1[mid - left + 1] = 1e9 + 1;
    for (int i = 0; i < right - mid; i++) {
        A2[i] = A[mid+1+i];
    }
    A2[right - mid] = 1e9 + 1;
    int i1 = 0;
    int i2 = 0;
    for (int k = left; k <= right; k++) {
        cnt++;
        A[k] = (A1[i1] < A2[i2] ? A1[i1++] : A2[i2++]);
    }
}

int main(){
    int n;
    cin >> n;
    vector<int> S(n);
    for (auto& s : S) cin >> s;
    int cnt = 0;
    merge_sort(S, 0, n - 1, cnt);
    for (int i = 0; i < n; i++) {
        cout << S[i] << (i < n - 1 ? " " : "\n");
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 6668
#include "bits/stdc++.h"
using namespace std;

int main(){
	string s;
  cin>>s;
  int a=0;
  for(int i=0;i<s.size();i++){
    if(s[i]>='A'&&s[i]<='Z')a++;
  }
  int f=0;
  for(int i=2;i<s.size()-1;i++){
    if(s[i]=='C')f=1;
  }
  
  if(a!=2||s[0]!='A'||f==0){
    cout<<"WA"<<endl;
    return 0;
  }
  cout<<"AC"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef vector<int>::iterator vit;

int n;
vi adj[100001];
int ans[100001];
const int INF = 100000000;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>n;
	for(int i = 0; i < n; i++)
	{
		ans[i] = INF;
	}
	for(int i = 0; i < n - 1; i++)
	{
		int u, v;
		cin>>u>>v;
		u--; v--;
		adj[u].pb(v); adj[v].pb(u);
	}
	int k; cin >> k;
	for(int i = 0; i < k; i++)
	{
		int u, v;
		cin>>u>>v; u--;
		ans[u] = v;
	}
	priority_queue<ii> pq;
	for(int i = 0; i < n; i++)
	{
		if(ans[i]<INF)
		{
			pq.push(mp(ans[i],i));
		}
	}
	while(!pq.empty())
	{
		int u = pq.top().se; 
		pq.pop();
		for(int i = 0; i < adj[u].size(); i++)
		{
			int v = adj[u][i];
			if(ans[v]<INF)
			{
				if(abs(ans[v]-ans[u])!=1)
				{
					cout<<"No\n"; return 0;
				}
			}
			else
			{
				ans[v]=ans[u]-1;
				pq.push(mp(ans[v],v));
			}
		}
	}
	cout<<"Yes\n";
	for(int i = 0; i < n; i++)
	{
		cout << ans[i] << '\n';
	}
}


Measured memory_bytes: 8692
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c;
	cin>>a>>b>>c;
	int naj = max(a, max(b,c));
	int	mal = min(a,min(b,c));
	int rez = 0;
	if(naj == a)
	{
		if(mal == b){
			rez += abs(a - c);
			rez += abs(c -b);
		}
		else
		{
			rez += abs(a - b);
			rez += abs(b - c);
		}
	}
	else if(naj == b)
	{
		if(mal == c){
			rez += abs(b - a);
			rez += abs(a - c);
		}
		else
		{
			rez += abs(b - c);
			rez += abs(c - a);
		}
	}
	else
	{
		if(mal == b){
			rez += (c - a);
			rez += (a - b);
		}
		else
		{
			rez += (c - b);
			rez += (b - a);
		}
	}
	cout<<rez<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        int result = 0;
        if (k >= n){
            result = x * n;
        }
        if (k < n) {
            result = x * k + y * (n - k);
        }

        System.out.println(result);
    }
}


Measured memory_bytes: 21204
#include<iostream>
using namespace std;
int a[101],b[100];
int main()
{
	short n;
	cin>>n;
	for(short i=1;i<n;++i)
		cin>>b[i];
  b[0]=b[1];
  b[n]=b[n-1];
	for(short i=1;i<=n;++i)
	{
		a[i]=min(b[i-1],b[i]);
		a[0]+=a[i];
	}
	cout<<a[0];
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  let inputs = input.split("\n");

  const [N] = inputs[0].split(' ').map(input=> Number(input));
  const array = inputs[1].split(' ').map(input=> Number(input));

  const res = {}
    // 社員数 N
    // array 直属の上司のID

    array.forEach( _id => {
        const id = Number(_id);
        res[id] = res[id] ? res[id] + 1 : 1
    })

    for( let i = 1 ; i <= N ; i++ ){
        console.log( res[i] || 0)
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 63340
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };



// 入力
ll n, A;
ll a[110];

// DPテーブル
ll dp[52][52][2600];



signed main() {
	ll cnt = 0, maxn = 0;

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


	
	memset(dp, 0, sizeof(dp));   // 一旦すべて 0 に
	dp[0][0][0] = 1;                // dp[0][0] だけ 1 に

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j <= n; ++j) {
			for (int k = 0; k <= 2600; k++) {
				dp[i + 1][j][k] += dp[i][j][k];
				//if (j >= a[i]) (dp[i + 1][j] += dp[i][j - a[i]]) %= MOD;
				if (k  >= a[i]) (dp[i + 1][j + 1][k] += dp[i][j][k - a[i]]);
			}
		}
	}

	//cout << dp[n][A] << endl;

	for (int i = 1; i <= n; i++) {
		cnt += dp[n][i][i * A];
	}


	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 55168
#include<iostream>
using namespace std;
int n,t,i,j;
bool b[40001];
int main(){
  cin>>n;
	b[0]=true;
	for(i=0;i<n;i++){
		cin>>t;
		for(j=40000;j>=t;j--)b[j]|=b[j-t];
	}
	cin>>n;
	for(i=0;i<n;i++) {
		cin>>t;
		cout<<(b[t]?"yes":"no")<<endl;
	}
}



Measured memory_bytes: 3136
#include <iostream>
#include <cstdio>
#include <sstream>

#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <queue>
#include <stack>

#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>

#include <chrono>
#include <random>

using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<i64>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<i64, i64>;

//////////////////////////////////////////////////

int main(){
    vi a(3);
    for(auto&& x:a)cin >> x;
    sort(a.begin(), a.end());
    cout << a[0] + a[1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
vector<ll> Primes;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    for(ll i = 2; i <= 2e6; i++) {
        bool ok = true;
        for(ll j = 2; j * j <= i; j++) {
            if(i % j == 0) {
                ok = false;
                break;
            }
        }
        if(ok) Primes.push_back(i);
    }
    ll N;
    while(cin >> N) {
        if(N == 0) break;
        auto itr = lower_bound(Primes.begin(), Primes.end(), N);
        if(*itr == N) {
            cout << 0 << endl;
            continue;
        }
        ll U = *itr;
        itr--;
        cout << U - *itr << endl;
    }
    return 0;
}


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

bool hasSameString(string s, const vector<string> &v) {
  bool has = false;
  for(auto _s : v) {
    if(_s == s) has = true;
  }
  return has;
}

int main() {
  int N; cin >> N;
  vector<string> v;
  bool can = true;
  rep(i,N) {
    string s; cin >> s;
    if(i > 0) {
      if(v.at(i-1).back() != s.at(0)) {
        can = false;
        break;
      }
      if(hasSameString(s, v)) {
        can = false;
        break;
      }
    }
    v.push_back(s);
  }
  cout << (can ? "Yes" : "No") << endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(x) x.begin(), x.end()

template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 & y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 & y) {if (x < y) x = y;}

#define int ll

struct event{
	int a, b;
	event() {}
};

int n, t;
vector<event> a;

void read() {
	cin >> n >> t;
	a.resize(n);
	for (auto &i : a) {
		cin >> i.a >> i.b;
	}
}

vector<int> zero;

void build() {
	vector<event> na;
	for (auto i : a) {
		if (i.a == 0) {
			zero.push_back(i.b);
		}
		else {
			na.push_back(i);
		}
	}
	sort(all(na), [&] (event i, event j) {return j.a * (i.b + 1) < i.a * (j.b + 1);});
	a = na;
	sort(all(zero));
	for (auto &i : zero)
		i++;
	for (int i = 1; i < zero.size(); i++) {
		zero[i] += zero[i - 1];
	}
}

const int MAXLOG = 32;
const int INF = 1e18;
int dp[MAXLOG];

void calc_dp() {
	for (int i = 0; i < MAXLOG; i++)
		dp[i] = t + 1;
	dp[0] = 0;
	for (auto i : a) {
		for (int j = MAXLOG - 1; j >= 1; j--) {
			if (dp[j - 1] == INF) continue;
			int n_time = (i.a + 1) * (dp[j - 1] + 1) + i.b;
			chkmin(dp[j], n_time);
		}
	}
}

int ans;

void run() {
	build();
	calc_dp();
	ans = 0;
	/*cout << "a = " << endl;
	for (auto i : a) {
		cout << i.a << " " << i.b << endl;
	}
	cout << "zero = " << endl;
	for (auto i : zero) {
		cout << i << " ";
	}
	cout << endl;
	cout << "dp =" << endl;
	for (int i = 0; i < MAXLOG; i++) {
		cout << dp[i] << " ";
	}
	cout << endl;*/
	for (int i = 0; i < MAXLOG; i++) {
		int have = dp[i];
		if (have > t) continue;
		int cnt = --upper_bound(all(zero), t - have) - zero.begin() + 1;
		//cout << i << " " << cnt << endl;
		//cout << t - have << endl;
		chkmax(ans, i + cnt);
	}
}

void write() {
	cout << ans << endl;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}

Measured memory_bytes: 9328
#include<stdio.h>

int main(void)
{
	int i = 1;
	int array[10000];
	while (1)
	{
		scanf("%d", &array[i]);
		if (array[i] == 0)break;
		i++;
	}
	
	for (int k = 1; k < i; k++)
	{
		printf("Case %d: %d\n", k, array[k]);
	}

	return 0;
}



Measured memory_bytes: 2036
#include<bits/stdc++.h>
#include<math.h>
#include<string.h>
#include<vector>
using namespace std;
#define MAX 105
#define MOD 1000000007
#define MAX_BIT 35
bool rev(int a,int b)
{
    return a>b;
}
int main()
{
    int N,M,i,j;
    scanf("%d %d",&N,&M);
    int A[N];
    int total=0;
    for(i=0;i<N;i++)
    {
        scanf("%d",&A[i]);
        total=total+A[i];
    }
    sort(A,A+N,rev);
    for(i=0;i<M;i++)
    {
        if(4*M*A[i]<total) break;
    }
    if(i>=M)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N, K, L, R;
    cin >> N >> K >> L >> R;
    ll n1 = N / 2, n2 = (N + 1) / 2;
    vl a1(n1), a2(n2);
    repa(a, a1) cin >> a;
    repa(a, a2) cin >> a;

    vvc<ll> c1(21), c2(21);
    rep(bit, 1<<n1){
        ll v = 0;
        rep(i, n1) if (1 << i & bit) v += a1[i];
        c1[__builtin_popcount(bit)].eb(v);
    }
    rep(bit, 1<<n2){
        ll v = 0;
        rep(i, n2) if (1 << i & bit) v += a2[i];
        c2[__builtin_popcount(bit)].eb(v);
    }

    rep(i, 21) sort(all(c1[i])), sort(all(c2[i]));

    ll ans = 0;
    rep(i,21){
        if (K - i > 20) continue;
        repa(a, c1[i]){
            ans += upper_bound(all(c2[K - i]), R - a) - lower_bound(all(c2[K - i]), L - a);
        }
    }

    cout << ans << endl;
}


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


int main(){
	int N, K;
	cin >> N;
	cin >> K;
	vector<int> H;
	for(int x = 0; x<N; x++){
		int c;
		cin >> c;
		H.push_back(c);
	}
	long long count = 0;
	sort(H.rbegin(), H.rend());
	for(int x = 0; x < N; x++){
		if(K>0){
			H[x]=0;
			K--;
		}else{
			while(H[x]>0){
			H[x] = H[x]-1;
			count++;
		}
		}
	}
	cout << count;

}
	



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

typedef long long ll;
int t;
long long calc(const ll &n, const ll &m, const ll &a, const ll &b);

int main() {
	scanf("%d", &t);
	while (t--) {
		int n, m, a, b;
		scanf("%d%d%d%d", &n, &m, &a, &b);
		printf("%lld\n", calc(n, m, a, b));
	}
	return 0;
}

long long calc(const ll &n, const ll &m, const ll &a, const ll &b) {
	if (a == 0)
		return 0;
	const ll k = (a * (n - 1) + b) / m;
	return k * n - (m / a * (k + 1) * k >> 1) + b / a * k - calc(k + 1, a, m % a, a - 1 - b % a);
}



Measured memory_bytes: 3820
#include<bits/stdc++.h>
using namespace std;
const int N=5e5+6;
int n,D,m,vi=1,a[N],f[N],ans[N];
int main(){
	scanf("%d%d",&n,&D),f[0]=D;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);

	for(int i=1;i<=n;i++){
		if(abs(f[i-1]-a[i])<f[i-1])	f[i]=abs(f[i-1]-a[i]);
		else	f[i]=f[i-1];
	}
	for(int i=n;i;i--){
		if(f[i-1]>=vi)	ans[i]=1;
		if(vi>=a[i])	vi+=a[i];
		else	if(a[i]-vi+1<=vi)	vi+=a[i];
	}

	scanf("%d",&m);
	while(m--){
		int x;
		scanf("%d",&x);
		if(ans[x])	puts("YES");
		else	puts("NO");
	}
	return 0;
}


Measured memory_bytes: 7808
#include <iostream>

using namespace std;

int main()
{
    int x, a, b;
    cin >> x >> a >> b;

    if ((a - b) >= 0)
    {
        cout << "delicious" << endl;
    }
    else
    {
        cout << (((x - (b - a)) >= 0) ? "safe" : "dangerous") << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int H, W;
    int i, j, k;
    for(k=0; k>=0; k++){
        scanf("%d""%d", &H, &W);
        if(H==0 && W==0){
            break;
        }
        for(i=0; i<H; i++){
            for(j=0; j<W; j++){
                if( i%2==1 && j%2==1 ){
                    printf("#");
                }
                else if( i%2==1 && j%2==0 ){
                    printf(".");
                }
                else if( i%2==0 && j%2==1 ){
                    printf(".");
                }
                else{
                    printf("#");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

  int a, b;
  cin >> a >> b;
  int tmp=0, ans=0;
  for(int i=0; i<a; i++){
    tmp+=pow(10, i)*b;
  }
  for(int i=0; i<b; i++){
    ans+=pow(10, i)*a;
  }
  cout << max(tmp, ans) << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")

#include <bits/stdc++.h>
#define  f               first
#define  s               second
#define  sym(s)          s = "#" + s + "#";
#define  all(x)          (x).begin(), (x).end()
#define  alll(x,n)       x+1, x+n+1
#define  newl            cout<<"\n";
#define  foo(i,a,n)      for(ll i = (a); i <= n; i++)
#define  deb1(a)         cout<<a<<"\n";
#define  deb2(a,b)       cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)     cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)   cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  debp(a)         cout<<a.f<<" "<<a.s<<"\n";
#define  debv(a)         for(auto it: a)cout<<it<<" ";newl;
#define  debm(a)         for(auto it: a)cout<<"{"<<it.f<<","<<it.s<<"}, ";newl;
#define  deb1d(a,n)      foo(i,1,n)cout<<a[i]<<" ";newl;
#define  deb2d(a,n,m)    foo(i,1,n){foo(j,1,m){cout<<a[i][j]<<" ";}newl;}

using namespace std;
using ll              =  long long;
using ld              =  long double;
const ll   MOD        =  1e+9 + 7;
const ll   INF        =  LLONG_MAX;
const int  N          =  (int)2e+3 + 18;

ll n, s;
ll dp[700][2010];

ll solve(ll i, ll j){
    if(j == s) return 1;
    if(dp[i][j] != -1) return dp[i][j];

    ll ans = 0;
    for(int x = 3; x <= s - j; x++){
        ans += solve(i + 1, j + x);
        ans %= MOD;
    }

    return dp[i][j] = ans;
}

void MAIN(int tc){
    cin >> s;
    ll res = 0;
    memset(dp, -1 , sizeof(dp));
    deb1(solve(0, 0));
}

int main(){
    ios:: sync_with_stdio(false); 
    cin.tie(nullptr); cout.tie(nullptr);
    cout<<fixed; cout<<setprecision(10);

    int test_cases = 1;
    //cin>>test_cases;
    for(int i = 1; i <= test_cases; i++){
        MAIN(i);
    }

   
}

Measured memory_bytes: 14664
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i

orders = [a,b,c,d,e].sort_by {|x|
    x1 = x % 10
    if x1 == 0
        x1 = 10
    end
    x1
}

last_order = orders.shift

total_time = last_order +  orders.reduce(0) {|acc, n| 
        n1 = n % 10
        c = 0
        if n1 != 0
            c = 10 - n1
        end
        acc = acc + n + c
        acc
    }

puts total_time


Measured memory_bytes: 1788
#include<stdio.h>
#include<math.h>

int main(void){
	int a , b ,C;
	double L,S,h;
	scanf("%d %d %d",&a,&b,&C);

	h=(double)b*sin((double)C/180*M_PI);
	S=(double)a*h/2;
	L=(double)a+(double)b+sqrt((double)(a*a)+(double)(b*b)-(double)(2*a*b)*cos((double)C/180*M_PI));
	printf("%lf\n",S);
	printf("%lf\n",L);
	printf("%lf\n",h);


	return 0;
}



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

int n,K,arr[2][6001][2001];

int d[2][3]={{0,2,4},{1,3,5}};
void add(int idx,int x,int y) {
    for(int i=0;i<2;i++) {
        for(int j=0;j<3;j++) {
            arr[idx][(y+d[i][j]*K)%(6*K)+1][(x+i*K)+1]++;
        }
    }
}
int sum(int idx,int y1,int x1,int y2,int x2) {
    return arr[idx][y2][x2]-arr[idx][y1-1][x2]-arr[idx][y2][x1-1]+arr[idx][y1-1][x1-1];
}
int main() {
    scanf("%d%d",&n,&K);
    for(int i=0;i<n;i++) {
        int x,y;
        char ch;
        scanf("%d %d %c",&x,&y,&ch);
        y%=2*K; x%=2*K;
        if( (y<K && x<K) || (y>=K && x>=K)){
            y%=K;x%=K;
        } else {
            y%=K; x%=K; y+=K;
        }

        if(ch=='W') add(0,x,y);
        else add(1,x,y);
    }

    for(int i=1;i<=4*K;i++)for(int j=1;j<=2*K;j++) {
        for(int k=0;k<2;k++) arr[k][i][j] += arr[k][i-1][j]+arr[k][i][j-1] - arr[k][i-1][j-1];
    }

    int ans=0;
    for(int i=1;i<=2*K;i++) for(int j=1;j<=K+1;j++) {
        ans = max(ans, sum(0,i,j,i+K-1,j+K-1) + sum(1,i+K,j,i+2*K-1,j+K-1));
    }
    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 94080
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int T;
	cin >> T;
	rep(t, T) {
		int N;
		cin >> N;
		vl KL, KR;
		vl scL, scR;
		ll ans = 0;
		rep(i, N) {
			ll Ktmp, Ltmp, Rtmp;
			cin >> Ktmp >> Ltmp >> Rtmp;
			if (Ltmp >= Rtmp) {
				ans += Rtmp;
				KL.push_back(Ktmp);
				scL.push_back(Ltmp - Rtmp);
			}
			else {
				ans += Ltmp;
				KR.push_back(Ktmp);
				scR.push_back(Rtmp - Ltmp);
			}
		}

		priority_queue<ll, vl, less<ll>> scL_que, scR_que;
		int NL = KL.size();
		int NR = KR.size();
		vector<vl> K_to_scL(N + 1), K_to_scR(N + 1);
		rep(i, NL)
			K_to_scL[KL[i]].push_back(scL[i]);
		rep(i, NR)
			K_to_scR[KR[i]].push_back(scR[i]);
		for (ll k = N; k > NL; k--) {
			for (ll sctmp : K_to_scL[k])
				scL_que.push(sctmp);
		}
		for (ll k = NL; k >= 1; k--) {
			for (ll sctmp : K_to_scL[k])
				scL_que.push(sctmp);
			if (!scL_que.empty()) {
				ans += scL_que.top();
				scL_que.pop();
			}
		}
		for (ll k = 1; k < NL; k++) {
			for (ll sctmp : K_to_scR[k])
				scR_que.push(sctmp);
		}
		for (ll k = NL; k < N; k++) {
			for (ll sctmp : K_to_scR[k])
				scR_que.push(sctmp);
			if (!scR_que.empty()) {
				ans += scR_que.top();
				scR_que.pop();
			}
		}

		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 22008
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 *
 * @author saku
 */
public class Main {
    public static void main(String args[]) throws IOException{
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       String str = br.readLine();
       String[] div = str.split(" ");
       int s = Integer.parseInt(div[0]);
       int l = Integer.parseInt(div[1]);
       System.out.println(s*l + " " + 2*(s+l));
    }     
}

Measured memory_bytes: 24256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll make_bit(ll a){
  ll num=a/4*4;
  ll ret=0;
  for(ll i=num;i<=a;i++)
    ret^=i;
  return ret;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b;cin>>a>>b;
  a=make_bit(a-1);
  b=make_bit(b);
  cout<<(a^b)<<endl;
  return 0;
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int i=0;
  string A;
  cin >> N;
  
 while(i<N){
     cin >> A;
     if(A=="Y"){
         cout<<"Four";
         break;
     }
     
     i++;
     if(i==N-1){
       cout<<"Three";  
     }
 }
 
}

Measured memory_bytes: 3568
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<map>
#include<utility>
#include<queue>
#define mod 998244353
#define pb push_back
#define ll long long
using namespace std;
int main(){
	int n;
	cin>>n;
	ll ans;
	vector<int> a;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		a.pb(x);
	}
	for(int i=0;i<n;i++){
		ans += a[i]/2;
		if( a[i] % 2 == 1 && i<n-1 && a[i+1]>0){
			a[i+1]--;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll p=a*c;
    ll q=b*c;
    ll r=a*d;
    ll s=b*d;
    if(a*b<=0 || c*d<=0){
        cout << max(p,max(q,max(r,max(s,0ll))));
    }else{
        cout << max(p,max(q,max(r,s)));
    }
}


Measured memory_bytes: 3628