akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int bs(Int s){
	Int l = 0, r = 1e9;
	while(r-l > 1){
		Int m = (l+r) / 2;
		if(m*m >= s) r = m;
		else l = m;
	}
	return r;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	Int s, t;
	cin >> s;
	t = bs(s);
	cout << 0 << " " << 0 << " " << t << " " << t*t-s << " " << 1 << " " << t << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 1002
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

int a[101];
int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	rep(i,n)scanf("%d", &a[i]);
	for(int k = 1;k <= m;k++){
		for(int i = 0;i < n-1;i++){
			if(a[i]%k > a[i+1]%k)swap(a[i], a[i+1]);
		}
	}
	rep(i,n)printf("%d\n", a[i]);
	return 0;
}

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

const int maxR = 10;
const int maxC = 1e4;
int R,C;
bitset<maxC> a[maxR];

int ans;
bool tmp;

void dfs(int k){
	if(k == R){
		int res = 0;
		for(int j=0;j<C; j++){
			int upNum = 0;
			for(int i=0; i<R; i++){
				if(a[i][j]) upNum++;
			}
			res += max(upNum,R-upNum);
		}

		ans = max(ans,res);
		return;
	}
	dfs(k+1);
	a[k].flip();
	dfs(k+1);
}


int main(){
	while(scanf("%d%d",&R,&C) && (R||C)){
		for(int i=0; i<R; i++){
			for(int j=0; j<C; j++){
				scanf("%d",&tmp);
				a[i][j] = tmp;
			}
		}

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

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

int main(){
	long long b[114514] = {};
	bool c[114514] = {};
	long long n, m, i;
	cin >> n >> m;

	long long a[m];
	
	for (i = 0; i < m; i++){
	       	cin >> a[i];
		c[a[i]] = 1;	
	}

	b[0] = 1;
	if (c[1] == 1) b[1] = 0;
	else b[1] = 1;
	for (i = 2; i <= n; i++){
		if (c[i] == 1) continue;
		b[i] = b[i - 1] + b[i - 2];
		b[i] %= 1000000007;
	}
	cout << b[n] % 1000000007 << endl;
	return 0;
}




Measured memory_bytes: 2048
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repext(i, a, b) for (int i = a; i < b; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (int i = b - 1; i >= a; i--)

#define repv(v, values) for (auto v : values)

#define vec_all(vec) vec.begin(), vec.end()
#define sum(vec) accumulate(vec_all(vec), 0)
#define srt(vec) sort(vec_all(vec))

// vectorデバッグ
template <typename T>
void dump_vec(vector<T> vec)
{
    rep(i, vec.size())
    {
        cout << i << ": " << vec[i] << endl;
    }
}

template <typename T, typename S>
void dump_dic(map<T, S> dic)
{
    for (auto v : dic)
    {
        cout << v.first << ": " << v.second << endl;
    }
}

// --- notice ---
// intの和はllにしろ

int main()
{
    int n;
    cin >> n;
    map<ll, int> dic;
    
    int tmp;
    rep(i, n) {
        cin >> tmp;
        dic[tmp]++;
    }

    ll c = 0;
    ll d = 0;
    repv(v, dic) {
        if (v.second >= 2 && v.second < 4) {
            if (c < d) {
                c = v.first;
            } else {
                d = v.first;
            }
        } else if (v.second >= 4) {
            c = v.first;
            d = v.first;
        }
    }

    cout << c * d << endl;
    return 0;
}

Measured memory_bytes: 6528
#include <iostream>
using namespace std;
int main(void){
   int a,b,c,d,e,f,yen;
   cin>>a>>b>>c>>d>>e>>f>>yen;
   yen=a*1+b*5+c*10+d*50+e*100+f*500;
   if(1000<=yen){
       cout<<"1"<<endl;
   }
   else if(1000>yen){
       cout<<"0"<<endl;
   }
   return 0;
}


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

string s;

int rock, paper;

int ans;

int main(void) {
  // Here your code !
  cin >> s;

  if (s[0] == 'p') {
    ans += -1;
  }
  else {
    ans += 0;
  }

  rock = 1;
  paper = 0;

  for (int i = 1; i < s.size(); ++i) {
    if (s[i] == 'g') {
      if (rock > paper) {
        ans += 1;
        paper += 1;
      }
      else {
        ans += 0;
        rock += 1;
      }
    }
    else {
      if (rock > paper) {
        ans += 0;
        paper += 1;
      }
      else {
        ans += -1;
        rock += 1;
      }
    }
  }

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

  return 0;
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
# 整数の入力
N, M, X = map(int, input().split())
# スペース区切りの整数の入力
A = list(map(int, input().split()))

Y = [0 for i in range(N)]
for j in range(M):
    Y[A[j]] = 1

rightSideCost = sum(Y[0:X])
leftSideCost = sum(Y[X:N])

print(min(rightSideCost,leftSideCost))


Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
	int house[4][3][10] = {};
	int i, j, k;
	int n;

	scanf("%d", &n);
	while (n--){
		int b, f, r, v;
		scanf("%d %d %d %d", &b, &f, &r, &v);
		b--, f--, r--;
		house[b][f][r] += v;
	}
	for (i = 0; i < 4; i++){
		if (i){
			for (j = 0; j < 20; j++) printf("#");
			puts("");
		}
		for (j = 0; j < 3; j++){
			for (k = 0; k < 10; k++){
				printf(" %d", house[i][j][k]);
			}
			puts("");
		}
	}
	return (0);
}

Measured memory_bytes: 612
h, w = map(int, input().split())
for i in range(w+2):
    if i == w+1:
        print("#")
    else:
        print("#", end="")
for i in range(h):
    print("#", end="")
    print(input(), end="")
    print("#")
for i in range(w+2):
    if i == w+1:
        print("#")
    else:
        print("#", end="")

Measured memory_bytes: 3064
n,x,y = map(int, open(0).read().split())

x,y = sorted([x,y])

def calc(a,b):
    a,b = sorted([a,b])
    return min(b-a, abs(b-y)+1+abs(x-a))

ans = [0]*(n-1)

from itertools import combinations

for a,b in combinations(range(1,n+1),2):
    ans[calc(a,b)-1] += 1

for c in ans:
    print(c)

Measured memory_bytes: 75156
#include<stdio.h>
#include<stdlib.h>
int cmp(const void * a, const void *b){return *(int*)a-*(int*)b;}
int main(){
    int a[2];
    scanf("%d%d",&a[0],&a[1]);
    qsort(a,2,sizeof(int),cmp);
    if(a[0] == 1 && a[1] == 2)
        puts("3");
    else if(a[0] == 1 && a[1] == 3)
        puts("2");
    else 
        puts("1");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define whole(x) (x).begin(), (x).end()
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
  
const int N = int(2e5) + 2;
const int LG = 20; 
const ll mod = (int)1e8;
const int INF = (int)1e9 + 7;
const ll linf = 1e15; 
const ld pi = acos(-1);
const int base = 10;
const ld EPS = 1e-9;

int n, m, a, b, ans[2005][2005];
int main (){
	scanf ("%d %d %d %d", &n, &m, &a, &b);
	swap(a, b);
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < m; ++j){
			if ((i < a) == (j < b)) ans[i][j] = 1;
		}
	}
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < m; ++j){
			printf ("%d", ans[i][j]);
		}
		printf ("\n");
	}
	return 0;
}

Measured memory_bytes: 9344
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    char f[26];
    bool used[26] = {};
    for(ll i = 0; i < 26; i++) f[i] = 'a' + i;
    string s, t;
    cin >> s >> t;
    bool success = 1;
    for(ll i = 0; i < s.size(); i++){
        char c = f[s[i] - 'a'];
        if(used[s[i] - 'a'] && c != t[i]){
            success = 0;
            break;
        }
        used[s[i] - 'a'] = 1;
        f[s[i] - 'a'] = t[i];
    }
    bool used2[26] = {};
    for(ll i = 0; i < 26; i++){
        if(!used[i]) continue;
        if(used2[f[i] - 'a']) success = 0;
        used2[f[i] - 'a'] = 1;
    }
    cout << (success ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 776
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define REP(a) for(i = 0; i < a; i++)

int main(void)
{
    int i;
    char a[55],b[55];
    scanf("%s",a);
    scanf("%s",b);
    unsigned long int d = strlen(a) + strlen(b);
    REP(d / 2) {
        printf("%c",a[i]);
        printf("%c",b[i]);
    }
    if (d % 2 != 0) {
        printf("%c",a[strlen(a) - 1]);
    }
    printf("\n");
    return 0;
 }

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

bool prime[1000000];

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

    for( int i = 2; i <= 999999; ++i ) {
        if( !prime[i] ) {
            for( int j = i * 2; j <= 999999; j += i ) {
                prime[j] = true;

            }
        }
    }

    int x;
    cin >> x;
    while( prime[x] ) ++x;
    cout << x << endl;
    return 0;
}



Measured memory_bytes: 1280
function main()
  n,m = parse.(Int,split(readline()))
  h_arr = parse.(Int,split(readline()))
  h_ones = ones(n)

  for i in 1:m
    a,b = parse.(Int, split(readline()))
    if h_arr[a] > h_arr[b]
      h_ones[b] = 0
    elseif h_arr[a] < h_arr[b]
      h_ones[a] = 0
    else
      h_ones[a] = 0
      h_ones[b] = 0
    end
  end

  println(count(x -> x == 1, h_ones))
end
main()


Measured memory_bytes: 204984
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
clock_t __my_start_clock = clock();
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

int main() {
#ifdef LOCAL
  freopen("b.in", "r", stdin);
  freopen("b.out", "w", stdout);
#endif

  int n;
  while (scanf("%d", &n) == 1) {
    vector<pair<int, int>> v(n);
    int ans = 0;
    for (auto &x : v) {
      scanf("%d%d", &x.first, &x.second);
      ++x.second;
    }
    sort(v.begin(), v.end());
    auto intersect = [](pair<int, int> a, pair<int, int> b) -> pair<int, int>{
      return {max(a.first, b.first), min(a.second, b.second)};
    };
    auto len = [](pair<int, int> a) {
      return max(0, a.second - a.first);
    };

    vector<pair<int, int>> pr(n);
    pr[0] = v[0];
    for (int i = 1; i < n; i++) {
      pr[i] = intersect(pr[i - 1], v[i]);
    }
    vector<pair<int, int>> sf(n);
    sf.back() = v.back();
    for (int i = n - 2; i >= 0; i--) {
      sf[i] = intersect(sf[i + 1], v[i]);
    }

    for (int i = 0; i < n - 1; i++) {
      ans = max(ans, len(pr[i]) + len(sf[i + 1]));
      pair<int, int> other;
      if (i == 0) {
        other = sf[1];
      } else if (i == n - 1) {
        other = pr[n - 2];
      } else {
        other = intersect(pr[i - 1], sf[i + 1]);
      }
      ans = max(ans, len(v[i]) + len(other));
    }

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

  return 0;
}


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

int main(void)

{
	char str[21];
	char rts[21];
	int i;

	scanf("%s", str);

	int strl = strlen(str);

	for (i = 0; i < strl; i++)
	{
		rts[strl - i -1] = str[i];
	}

	rts[strl] = '\0';
	
	printf("%s\n", rts);
	
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define Phuong // <3
typedef pair<int,int> ii;
vector<int> res;
string s;

void dp(int x, int y)
{
    int u,v;
    for(int i=x; i<y; ++i)
    if (s[i]!=s[i+1])
    {
        u=i;
        v=i+1;
    }
    if ((y-x+1)%2==0)
    {
        res[u]=(y-x+1)/2;
        res[v]=res[u];
    } else
    {
        if (u-x > y-v)
        {
            res[v]=(y-x+1)/2;
            res[u]=(y-x+1)-res[v];
            if ((u-x+1)%2==0)
            {
                swap(res[u],res[v]);
            }
        }else
        {
            res[u]=(y-x+1)/2;
            res[v]=(y-x+1)-res[u];
            if ((y-v+1)%2==0)
            {
                swap(res[u],res[v]);
            }
        }
    }
    for(int i=x; i<u; ++i) res[i]=0;
    for(int i=v+1; i<=y; ++i) res[i]=0;
}

int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
#endif // ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    cin >> s;
    res= vector<int> (s.size());
    int head=-1;
    for(int i=0; i<s.size(); ++i)
    {
        if (s[i]=='R' && head==-1)
            head=i;
        else
        if (s[i]=='L')
        {
            if (i==s.size()-1)
            {
                dp(head,i);
                head=-1;
            }else
            if (s[i+1]=='R')
            {
                dp(head,i);
                head=-1;
            }
        }
    }
    for(auto x :res)
        cout << x << " ";
    return 0;
}


Measured memory_bytes: 1104
#include <bits/stdc++.h>
#define inf (int)1e9
#define fi first
#define se second
using namespace std;

struct Unionfind {
  // tree number
  vector<int> par;
  // tree rank
  vector<int> treerank;
  // constructor
  Unionfind(int n = 1) { stree(n + 1); }
  // make and initialization
  void stree(int n = 1) {
    par.assign(n, -1);
    treerank.assign(n, 0);
  }
  // search root
  int root(int x) {
    if(par[x] < 0) return x;
    return par[x] = root(par[x]);
  }
  // is same?
  bool issame(int x, int y) { return root(x) == root(y); }

  // add
  // already added, return 0
  bool uni(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return 0;
    if(treerank[x] > treerank[y]) swap(x, y);
    if(treerank[x] == treerank[y]) ++treerank[y];
    par[y] -= size(x);
    par[x] = y;
    return 1;
  }
  int size(int x) { return -par[root(x)]; }
};

struct edata {
  int from, to, cost;
};

bool operator<(const edata &l, const edata &r) {
  if(l.cost != r.cost) return l.cost > r.cost;
  return l.from > r.from;
}

int n, m;
vector<pair<int, int>> h;
vector<vector<int>> edge;
Unionfind uf;
priority_queue<edata> pq;

int solve();
int krus(int now);
bool ch(int now);

int main() {
  while(1) {
    cin >> n >> m;
    if(n + m == 0) break;
    h.resize(n);
    for(int i = 0; i < n; ++i) {
      cin >> h[i].fi;
      h[i].se = i;
    }
    sort(h.begin(), h.end());
    edge.assign(n, vector<int>(n, inf));
    for(int i = 0; i < m; ++i) {
      int x, y, d;
      cin >> x >> y >> d;
      --x, --y;
      edge[x][y] = edge[y][x] = d;
    }
    cout << solve() << endl;
  }
  return 0;
}

int solve() {
  int fin = n, ans = 0;
  for(int i = 0; i < n; ++i)
    if(!ch(i)) {
      fin = i - 1;
      while(fin - 1 >= 0 && h[fin].fi == h[fin - 1].fi)
        --fin;
      ++fin;
      break;
    }
    else
      while(i + 1 < n && h[i].fi == h[i + 1].fi) ++i;
  uf = Unionfind(n);
  ans += krus(fin - 1);
  for(int i = fin - 2; i >= 0; --i) {
    int nowr = i;
    while(i > 0 && h[nowr].fi == h[i - 1].fi) --i;
    ans += krus(i);
  }
  return ans;
}

int krus(int now) {
  if(now == -1) return 0;
  int ans = 0;
  for(int i = now; i < n; ++i)
    for(int j = i + 1; j < n; ++j)
      if(edge[h[i].se][h[j].se] != inf)
        pq.push({h[i].se, h[j].se, edge[h[i].se][h[j].se]});
  while(pq.size() > 0) {
    edata nowe = pq.top();
    pq.pop();
    if(!uf.issame(nowe.from, nowe.to)) {
      ans += nowe.cost;
      uf.uni(nowe.from, nowe.to);
    }
  }
  return ans;
}

bool ch(int now) {
  uf = Unionfind(n);
  for(int i = now; i < n; ++i)
    for(int j = i + 1; j < n; ++j)
      if(edge[h[i].se][h[j].se] != inf)
        uf.uni(h[i].se, h[j].se);
  return uf.size(uf.root(h[now].se)) == n - now;
}


Measured memory_bytes: 3656
// c++ -std=c++14 atcoder.cpp
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int64_t n, k, ans;
    cin >> n >> k;
    if (n >= k) {
        ans = n%k;
        if (ans > k-ans) {
            ans = k-ans;
        }
    } else {
        ans = min(n, abs(k-n));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int K = s.nextInt();
		String S = s.next();
		
		if(S.length() <= K) {
			System.out.println(S);
		}else {
			
			System.out.println(S.substring(0, K) + "...");
		}
    }
}	

Measured memory_bytes: 38720
#include <iostream>
#include <algorithm>
#include <map>
typedef long long LL;
using namespace std;
int main(void){
    map<LL,LL,greater<LL> > list;
    LL n,m,d,p;
    LL total_p;
    while(cin>>n>>m,n!=0||m!=0){
        total_p=0;
        list.clear();
        for(LL i=0;i<n;i++){
            cin>>d>>p;
            list[p]+=d;
        }
        for(map<LL,LL>::iterator it=list.begin();it!=list.end();it++){
            if((*it).second>m){
                total_p+=(*it).first*((*it).second-m);
                m=0;
            }
            else{
                m-=(*it).second;
            }
        }
        cout<<total_p<<endl;
    }
    return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
const long long mod = 998244353;
long long power(long long a, long long b, long long m = mod) {
    long long x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
const int N = 3000+9;
ll f[N], a[N], pre[N];
int n, s;

signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> s;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    ll ans = 0;
    // f[0] = 1;
    for(int i = 1; i <= n; i++) {
        // j > a[i]
        f[0]++;
        for(int j = s; j >= a[i]; j--) {
            f[j] += f[j-a[i]];
            if(f[j] >= mod) f[j] -= mod;
        }
        ans = (ans + f[s] * (n-i+1) % mod) % mod;
        f[s] = 0;
    }
    // cout << "brute:" << brute() << " ";
    cout << ans << "\n";

    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

int main() {
    ll n; cin >> n;
    vector<ll> h(n);
    REP(i,n) cin >> h[i];
    bool ans = true;
    REP(i,n) {
        if(i==0) h[i]--;
        else {
            if(h[i-1]>h[i]) {
                ans = false;
                break;
            }
            else if(h[i-1]<h[i]) h[i]--;
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 1024
long mod=1e9+7,dp[3333][3333];
c,i,j;
main(n)
{
	scanf("%d\n",&n);
	dp[0][0]=1;
	for(;++i<n;)
	{
		c=getchar();
		for(j=0;j<=i;j++)
		{
			dp[i][j]=c=='<'?*dp[i-1]-dp[i-1][j]:dp[i-1][j];
		}
		for(;j--;)dp[i][j]=(dp[i][j]+dp[i][j+1]+mod)%mod;
	}
	printf("%d",*dp[n-1]);
}

Measured memory_bytes: 78336
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <math.h>

using namespace std;

bool prime(int num){
    int isprime = true;
    if (num == 1)
        return false;
    if (num == 2)
        return true;
    if (num % 2 == 0 && num != 2)
        return false;
    for (int i = 2; i < num; i++){
        if (num % i == 0)
            isprime = false;
    }
    return isprime;
}
 
int main() {
    int x;
    cin >> x;
    while (true){
        if (prime(x)) {
            cout << x << endl;
            break;
        }
        else
            x++;
    }
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/keyence2020/tasks/keyence2020_b

#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=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1001001001
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
int main() {
    int n; cin >> n;
    vector<pair<int,int>> x(n);
    REP(i,n){
        int a,b; cin>>a>>b;
        x[i].first = a+b;
        x[i].second = a-b;
    }
    sort(ALL(x));

    int back=-INF;
    int cnt=0;
    for(auto k:x){
        int front=k.second;
        if(back <= front){
            back=k.first;
            cnt++;
        }
    }

    cout << cnt << endl;
}

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

using namespace std;

typedef long long ll;

vector<int> Navec(ll x)
{
    vector<int> odp;
    while (x != 0)
    {
        odp.push_back(x % 2);
        x /= 2;
    }
    while (odp.size() < 40)
        odp.push_back(0);
    reverse(odp.begin(), odp.end());
    return odp;
}

int main()
{
    ios_base::sync_with_stdio(0);
    ll a, b;
    cin >> a >> b;
    vector<int> A = Navec(a);
    vector<int> B = Navec(b);
    if (a == b)
    {
        cout << a;
        return 0;
    }
    ll r = 0;
    while (r < 40 && A[r] == B[r])
        ++r;
    vector<int> X = A;
    vector<int> odp(40, 0);
    for (int i = r + 1; i < 40; ++i)
    {
        if (A[i] == 0)
        {
            X[i] = 1;
            if (i == 38)
                odp[39] ^= 1;
            if (i == 39)
                for (int j = 0; j < 40; ++j)
                    odp[j] ^= X[j];
            X[i] = 0;
        }
    }
    X = B;
    for (int i = r + 1; i < 40; ++i)
    {
        if (B[i] == 1)
        {
            X[i] = 0;
            if (i == 38)
                odp[39] ^= 1;
            if (i == 39)
                for (int j = 0; j < 40; ++j)
                    odp[j] ^= X[j];
            X[i] = 1;
        }
    }
    for (int i = 0; i < 40; ++i)
    {
        odp[i] ^= A[i];
        odp[i] ^= B[i];
    }
    ll wyn = 0;
    for (int i = 0; i < 40; ++i)
        wyn = wyn * (ll) 2 + odp[i];
    cout << wyn;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int kt = (d+a-1)/d;
    int ka = (c+b-1)/b;
    if(kt<ka) No
    Yes

    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n;
ll a[3010];
ll dp[3010][3010];
bool mark[3010][3010];

ll resi(int levi,int desni, int igrac)
{
    if(levi==desni)
        return igrac==0?a[levi]:-a[levi];

    if(mark[levi][desni])
        return dp[levi][desni];

    mark[levi][desni]=true;

    if(igrac==0)
    {
        dp[levi][desni]=max(a[levi]+resi(levi+1,desni,1),a[desni]+resi(levi,desni-1,1));
        return dp[levi][desni];
    }
    else
    {
        dp[levi][desni]=min(-a[levi]+resi(levi+1,desni,0),-a[desni]+resi(levi,desni-1,0));
        return dp[levi][desni];
    }



}

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

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

    cout<<resi(0,n-1,0);

	return 0;
}


Measured memory_bytes: 78592
n,a,b,c,d = [int(x) for x in input().split()]
s = input()

ans = "Yes"
if c > d:
    tmp = s[b-2:d+1].count("...")
    if tmp == 0:
        ans = "No"

tmp = s[a-1:max(c,d)].count("##")
if tmp > 0:
    ans = "No"
print(ans)

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

#define endl '\n'

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
  
    string s;
    cin >> s;

    int count = 0, ans = 0;

    for (char c : s) {
        if (c == 'S') {
            count = 0;
        } else {
            ++count;
        }
        ans = max(ans, count);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3652
//#pragma GCC optimize("O3")
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<bits/stdc++.h>
using namespace std;
function<void(void)> ____ = [](){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);};
const int MAXN = 2e5+7;
int n, A[MAXN], num[MAXN<<4];
int main(){
    ____();
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> A[i];
    sort(A+1,A+1+n);
    int __count = 0;
    unordered_set<int> S;
    for(int i = 1; i <= n; i++) num[A[i]]++;
    for(int i = 1; i <= n; i++){
        if(num[A[i]]>1){
            S.insert(A[i]);
            continue;
        }
        bool ok = true;
        for(int f = 1; f * f <= A[i]; f++){
            if(A[i]%f) continue;
            if(S.count(f) or S.count(A[i]/f)){
                ok = false;
                break;
            }
        }
        if(ok) __count++;
        S.insert(A[i]);
    }
    cout << __count << endl;
    return 0;
}

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

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

string S;
ll cnt[26];

int main(){
    cin >> S;
    rep(i,S.size()) cnt[S[i]-'a']++;
    ll ans = (ll)S.size()*(ll)(S.size()-1)/2;
    rep(i,26) ans -= cnt[i]*(cnt[i]-1)/2;
    cout << ans+1 << endl;
}
































Measured memory_bytes: 640
#include<stdio.h>
int main(void){
  char a[2000]={0};
  scanf("%s",a);
  int ok=strlen(a),ng=ok-1;
  
  if(a[ng]=='s'){
    a[ok]='e';
    a[ok+1]='s';
   }else{
      a[ok]='s';
  }
  printf("%s\n",a);
  return 0;
}

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

const int MAXN = 101010;

int arr[MAXN], dist[MAXN];
vector<int> cld[MAXN];

bool gege[MAXN];

int k;
int dfs(int s) {
    int d = 0;
    for (auto t : cld[s]) d = max(d, dfs(t));

    if (d == k-1 and arr[s] != 1) gege[s] = true, d = -1;
    return d + 1;
}

int jizz() {
    int n; scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; ++i) scanf("%d", &arr[i]);

    for (int i = 2; i <= n; ++i) cld[arr[i]].push_back(i);

    int ans = arr[1] != 1;
    arr[1] = 1;
    dfs(1);

    for (int i = 2; i <= n; ++i) ans += gege[i];

    return ans;
}

int main() {
    printf("%d\n", jizz());
    return 0;
}


Measured memory_bytes: 10880
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String args[]) {
		FastScanner scanner = new FastScanner();
		int n=scanner.nextInt();
		int a[]=new int[n+2];
		a[0]=0;
		a[n+1]=0;
		int sum=0;
		for(int i=1;i<=n;i++) {
			a[i]=scanner.nextInt();
			sum+=Math.abs(a[i-1]-a[i]);
		}
		sum+=Math.abs(a[n]);
		for(int i=1;i<=n;i++) {
			int ans=0;
			if(a[i-1]<=a[i]&&a[i]<=a[i+1]) {
				ans=sum;
			}else {
				ans=sum;
				ans-=Math.abs(a[i-1]-a[i])+Math.abs(a[i]-a[i+1]);
				ans+=Math.abs(a[i-1]-a[i+1]);
			}
			System.out.println(ans);
		}
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 49428
#include <stdio.h>

int main(void)
{
    char S[11];
    scanf("%s", S);
    int b = 1;
    int i = 0;
    while(S[i] != '\0'){
        if(b){
            b = 0;
            if(S[i] != 'h') break;
        } else if(!b){
            if(S[i] == 'i') b = 1;
            else break;
        }
        i++;
    }
    printf(b ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 128
N = int(input())
PX = [list(map(int,input().split())) for _ in range(N)]

judge = True
pos = [0,0,0]
for p in PX:
    t = pos[0]
    x = pos[1]
    y = pos[2]
    ti = p[0]
    xi = p[1]
    yi = p[2]
    if abs(x-xi)+abs(y-yi) > (ti-t):
        judge = False
    if (x+y+(ti-t))%2 != (xi+yi)%2:
        judge = False
if judge:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 60888
#include <iostream>

int main() {
    int characterAge;
    std::cin >> characterAge;
    if(characterAge <= 599 and characterAge >= 400){
        int kyu;
        kyu = 8;
        std::string s = std::to_string(characterAge);
        std::cout << kyu << std::endl;
    }
    else if(characterAge <= 799 and characterAge >= 600){
        int kyu;
        kyu = 7;
        std::string s = std::to_string(characterAge);
        std::cout << kyu << std::endl;
    }
    else if(characterAge <= 999 and characterAge >= 800){
        int kyu;
        kyu = 6;
        std::string s = std::to_string(characterAge);
        std::cout << kyu << std::endl;
    }
    else if(characterAge <= 1199 and characterAge >= 1000){
        int kyu;
        kyu = 5;
        std::string s = std::to_string(characterAge);
        std::cout << kyu << std::endl;
    }
    else if(characterAge <= 1399 and characterAge >= 1200){
        int kyu;
        kyu = 4;
        std::string s = std::to_string(characterAge);
        std::cout << kyu << std::endl;
    }
    else if(characterAge <= 1599 and characterAge >= 1400){
        int kyu;
        kyu = 3;
        std::string s = std::to_string(characterAge);
        std::cout << kyu << std::endl;
    }
    else if(characterAge <= 1799 and characterAge >= 1600){
        int kyu;
        kyu = 2;
        std::string s = std::to_string(characterAge);
        std::cout << kyu << std::endl;
    }
    else if(characterAge <= 1999 and characterAge >= 1800){
        int kyu;
        kyu = 1;
        std::string s = std::to_string(characterAge);
        std::cout << kyu << std::endl;
    }
}

Measured memory_bytes: 3724
// このサイトの解説が良い
// https://ferin-tech.hatenablog.com/entry/2017/01/24/184750

#include <bits/stdc++.h>

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  if(N%1000==0) cout << 0 << endl;
  else cout << 1000 - (N%1000) << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;  
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
// #define _GLIBCXX_DEBUG
template <class T> using V = vector<T>;
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
// #define fi first
// #define se second
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};

/*--------------------------------------------------------------------------------

--------------------------------------------------------------------------------*/

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    rep(a, 1, n){
        ans += (n-1)/a;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3580
// ConsoleApplication3.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    //std::cout << "Hello World!\n";
    int a, b;
    cin >> a >> b;

    if ((a * b) % 2 != 0) {
        cout << "Odd" << endl;
    }
    else {
        cout << "Even" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, m;
ll x[1010][3];

ll solve() {
    int c[3];
    vector<ll> vec(n);
    ll res = (ll)-1e18;
    for (int b = 0; b < (1<<3); b++) {
        for (int i = 0; i < 3; i++) {
            c[i] = ((b>>i)&1 ? 1 : -1);
        }
        for (int i = 0; i < n; i++) {
            vec[i] = x[i][0]*c[0] + x[i][1]*c[1] + x[i][2]*c[2];
        }
        sort(RALL(vec));
        ll sum = 0;
        for (int i = 0; i < m; i++) sum += vec[i];
        res = max(res, sum);
    }
    return res;
}

void input() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> x[i][j];
        }
    }
}

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

    input();
    cout << solve() << endl;
}


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

int main() {
  int h,w,n;
  cin >> h >> w >> n;
  int x=max(h,w);
  cout << (n-1)/x+1 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#define WMAX 10000
#define HMAX 10000
#define NMAX 2002

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

struct edge{
  long long to,cost;
};

long long A[NMAX],B = 0,C,N,M,Z,W,H,ans,dp[HMAX][WMAX];
string S;
static const long long dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	long long j = 1;
	for (int i = 0; i < M; ++i)
	{
		j *= 2;
	}
	ans = (1900*M + 100*(N-M)) * j;
}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> N >> M;
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	cin.tie(0); cin.sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	map<long long, long long> mp;
	for (int i = 0; i < n; i++) {
		long long a;
		cin >> a;
		mp[a]++;
	}
	for (int j = 0; j < m; j++) {
		long long b, c;
		cin >> b >> c;
		mp[c] += b;
	}
	long long ret = 0;
	for (auto it = mp.rbegin(); it != mp.rend(); it++) {
		long long b, c; tie(c, b) = *it;
		if (b >= n) {
			ret += n * c;
			break;
		} else {
			ret += b * c;
			n -= b;
		}
	}
	cout << ret << endl;
	return 0;
}

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

long long N;
int ans = 0;
int dfs(long long x, int a, int b, int c) {
  //cout<<"X:"<<x<<" a:"<<a<<" B:"<<b<<" C:"<<c<<" "<<endl;
    if (x > N) return 0;
    if (a*b*c != 0) ans++;
    dfs(x*10+3, a + 1, b, c);
    dfs(x*10+5, a, b + 1, c);
    dfs(x*10+7, a, b, c + 1);
}
int main() {
    cin >> N;
    dfs(0, 0, 0, 0);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
# coding: utf-8
# Your code here!

line = input().split()
count = 0
for i in line:
    
    if i == "5":
        
        count += 1
        
    elif i == "7":
        count += 2
    else:
        print("NO")
        
if count == 4:
    print("YES")
    
else:
    print("NO")

Measured memory_bytes: 3060
#include<stdio.h>
int N;

int bubble(int A[]){
  int flag = 1;
  int i,j,tmp;
  int count = 0;
  for(i=0;i<N;i++){
    flag = 0;
    for(j=N-1;j>=i+1;j--){
      if(A[j]<A[j-1]){
        tmp = A[j];
        A[j] = A[j-1];
        A[j-1] =tmp;
        count++;
      }
    }
  }
  return count;
}
int main(){
  int A[100],i;
  int sw;

  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  sw = bubble(A);
  for(i=0;i<N;i++){
    if(i>0) printf(" ");
    printf("%d",A[i]);
  }

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

  return 0;
}


Measured memory_bytes: 2112
import math
A,B,H,M = map(int,input().split())
# long 0.25rad/m short 6rad/m
deg = abs(6*M-0.5*(60*H+M))
ans = (A**2 + B**2 - 2*A*B*math.cos(math.radians(deg))) ** (1/2)
print(ans)

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

int main() {
  int n; cin >> n;
  int a[n];
  for(int i = 0; i < n; i++) cin >> a[i];
  int cnt = 0;
  for(int i = 0; i < n; i++){
    if(a[i] % 2 != 0 && (i+1) % 2 != 0) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
const int INF = 1e9;
const int MODk = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    int n;
    while(cin >> n){
        if(n == 0){
            return 0;
        }
        vector<int> s;;
        for(int a = 0;a < n;a++){
            int b;cin >> b;
            s.push_back(b);
        }
        sort(s.begin(),s.end());
        cout<<(accumulate(s.begin(),s.end(),0LL)-*max_element(s.begin(),s.end())-*min_element(s.begin(),s.end()))/(max(n-2,0))<<endl;;
    }
}



Measured memory_bytes: 3132
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x) memset(x , -1 , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;
auto in = [](auto &&... args) { (cin >> ... >> args); };

const int fx[]={+1,-1,+0,+0};
const int fy[]={+0,+0,+1,-1};

int H , W;
string mat[30];
int cal(int x , int y){
  int Max = 0;
  int dis[30][30];
  clr(dis);
  dis[x][y] = 0;
  queue<pair<int, int>> q;
  q.push({x, y});
  while(!q.empty()){
    auto e = q.front();
    q.pop();
    int r = e.first, c = e.second;
    dg2(r,c);
    for (int k = 0; k < 4;k++){
      int X = r + fx[k];
      int Y = c + fy[k];
      if(X >= 0 && X < H && Y >= 0 && Y < W && mat[X][Y] == '.' && dis[X][Y] == -1){

          dis[X][Y] = dis[r][c] + 1;
          Max = max(Max, dis[X][Y]);
          q.push({X, Y});
      }
    }
  }
  return Max;
}
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);
  in(H, W);
  for (int i = 0; i < H;i++){
    in(mat[i]);
  }
  int ans = 0;
  for (int i = 0; i < H;i++){
    for (int j = 0; j < W;j++){
      if(mat[i][j] == '.'){
        int x = cal(i, j);
        ans = max(ans, x);
      }
    }
  }
  cout << ans << '\n';
}

Measured memory_bytes: 3156