akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INFTY 2001

int main()
{
    int tmp;
    int minv = INFTY;
    int sum = 0;
    for (int i = 0; i < 3; i++) {
        std::scanf("%d", &tmp);
        minv = std::min(minv, tmp);
    }
    sum = minv;
    minv = INFTY;
    for (int i = 0; i < 2; i++) {
        std::scanf("%d", &tmp);
        minv = std::min(minv, tmp);
    }
    sum += minv;
    std::cout << sum - 50 << std::endl;


    return 0;
}



Measured memory_bytes: 3160
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long N = lread();
    auto A = aryread();
    foreach (i; 0 .. N)
    {
        long cnt;
        while (~A[i] & 1)
        {
            A[i] >>= 1;
            cnt++;
        }
        A[i] = cnt;
    }
    A.sort();
    // writeln(A);
    long prev = A.front;
    A.popFront();
    foreach (i; 1 .. N)
    {
        if (i & 1)
        {
            long b = A.back;
            A.popBack();
            if (prev + b < 2)
            {
                writeln("No");
                return;
            }
            prev = b;
        }
        else
        {
            long f = A.front;
            A.popFront();
            if (prev + f < 2)
            {
                writeln("No");
                return;
            }
            prev = f;
        }
    }
    writeln("Yes");
}


Measured memory_bytes: 4404
N, A, B = map(int,input().split())
S = list(input())
b = 0
c = 0

for i in range(N) :
    if (S[i] == 'a') and (c < A + B) :
        print('Yes')
        c += 1
    elif S[i] == 'b' and (c < A + B) and b < B:
        print('Yes')
        b += 1
        c += 1
    else :
        print('No')

Measured memory_bytes: 4708
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int main()
{
	long long x, attacks = 0;
	cin >> x;
	if (x == 1)
		attacks++;
	else
	{
		long long log =log2(x)+1;
		attacks=pow(2,log)-1;
	}
	
	cout << attacks << endl;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
int n, k;
int a[100010];
vector <int> g[100010];
int dep[100010];
int ans;

void dfs(int x) {
	dep[x] = 1;
	for(auto i : g[x]) {
		dfs(i);
		dep[x] = max(dep[x], 1 + dep[i]);
	}
	if(dep[x] == k && x > 1 && a[x] != 1) {
		++ans;
		dep[x] = -n;
	}
}
int main(int argc, char const *argv[])
{
	scanf("%d %d", &n, &k);
	for(int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	if(a[1] != 1) {
		a[1] = 1;
		++ans;
	} 
	for(int i = 2; i <= n; i++) {
		g[a[i]].push_back(i);
	}
	dfs(1);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int MOD = 1000000007;
template<typename T>
struct Mint{
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;};
  Mint operator-(Mint a) const{return Mint(v)-=a;};
  Mint operator*(Mint a) const{return Mint(v)*=a;};
  Mint operator/(Mint a) const{return Mint(v)/=a;};

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}
};
template<typename T>
ostream& operator<<(ostream &os,Mint<T> m){os<<m.v;return os;}

//INSERT ABOVE HERE

using M = Mint<int>;
M dp[202][11][1<<10]={};
M nx[202][11][1<<10]={};

signed main(){
  int n,k;
  cin>>n>>k>>MOD;

  for(int i=0;i<k;i++)
    dp[1][i][1<<i]=1;

  for(int i=1;i<n;i++){
    for(int a=0;a<202;a++)
      for(int b=0;b<11;b++)
        for(int c=0;c<(1<<10);c++)
          nx[a][b][c]=M(0);

    for(int a=0;a<202;a++){
      for(int b=0;b<11;b++){
        for(int c=0;c<(1<<10);c++){
          if(dp[a][b][c].v==0) continue;
          int na=a+1;
          while((c>>(na-(a+1)))&1) na++;
          if(na>a+k) continue;

          int nc=c>>(na-a);
          for(int nb=0;nb<k;nb++){
            if((nc>>nb)&1) continue;
            if(a+1+b>=na+1+nb) continue;
            if(a+1+b+k<na+1+nb) continue;
            nx[na][nb][nc|(1<<nb)]+=dp[a][b][c];
          }
        }
      }
    }

    for(int a=0;a<202;a++)
      for(int b=0;b<11;b++)
        for(int c=0;c<(1<<10);c++)
          dp[a][b][c]=nx[a][b][c];
  }

  M ans{0};
  for(int a=0;a<202;a++){
    for(int b=0;b<11;b++){
      for(int c=0;c<(1<<10);c++){
        if(dp[a][b][c].v==0) continue;
        int na=a+1;
        while((c>>(na-(a+1)))&1) na++;
        int nc=c>>(na-a);
        if((a+1+b==2*n)&&(na==2*n+1)&&(nc==0)) ans+=dp[a][b][c];
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 20884
unittest
{
	assert( [ "3 2", "1 2", "5 5", "-2 8" ].parse.expand.solve == 1 );
	assert( [ "3 4", "-3 7 8 2", "-12 1 10 2", "-2 8 9 3" ].parse.expand.solve == 2 );
	assert( [ "5 1", "1", "2", "3", "4", "5" ].parse.expand.solve == 10 );
}



import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nd = input.front.split.to!( long[] );
	auto xss = new long[][]( nd[ 0 ], nd[ 1 ] );
	foreach( ref xs; xss )
	{
		input.popFront;
		xs = input.front.split.to!( long[] );
	}
	return tuple( xss );
}

auto solve( long[][] xss )
{
	auto ans = 0L;
	foreach( i, as; xss )
	{
		foreach( bs; xss[ i + 1 .. $ ] )
		{
			auto d = 0.0L;
			foreach( a, b; lockstep( as, bs ) )
			{
				d += ( a - b ) ^^ 2;
			}
			ans += ( d.sqrt % 1 == 0 );
		}
	}
	return ans;
}


Measured memory_bytes: 256
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

my @ans = (1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51);
chomp (my $k = <STDIN>);

say $ans[$k-1];

Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
using namespace std;

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

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

int main(void) {
  int x, y;
  cin >> x >> y;

  string result;
  int t = y - 2 * x;
  if (t >= 0 && t % 2 == 0 && t / 2 <= x) {
    result = "Yes";
  } else {
    result = "No";
  }

  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3616
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = MAP()

fours = len([a for a in A if not a%4])
twos = len([a for a in A if not a%2]) - fours

# print(fours, twos)

if N % 2:
	if fours * 2 + 1 + twos >= N:
		print('Yes')
	else:
		print('No')
else:
	if fours * 2 + twos >= N:
		print('Yes')
	else:
		print('No')

Measured memory_bytes: 59672
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll d;
    cin >> d;
    vector<vector<ll>> s(d, vector<ll>(26));
    vector<ll> c(26);

    rep(i, 26) cin >> c[i];
    rep(i, d){
        rep(j, 26){
            cin >> s[i][j];
        }
    }
    
    rep(i, d){
        ll ma = 0;
        ll idx = 0;
        rep(j, 26){
            if(ma < s[i][j]){
                ma = s[i][j];
                idx = j;
            }
        }
        cout << idx + 1 << endl;
    }

}


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

using namespace std;

int main()
{
    int N;
    cin >> N;
    string w[100];
    for(int i = 0; i < N; ++i) cin >> w[i];
    string word = w[0];
    set<string> words;
    words.insert(word);
    for(int i = 1; i < N; ++i){
        if(word[word.size() -1] != w[i][0]){
            cout << "No" << endl;
            return 0;
        }
        words.insert(w[i]);
        word = w[i];
    }
    if(words.size() != N){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 256
MAX = 1000000
s = [1]*MAX
s[0] = 0
s[1] = 0

start = 2
while True:
    pmb = 0
    for i in range(start, MAX):
        if s[i] == 1:
            pmb = i
            break
    if pmb == 0:
        break
    
    for i in range(pmb**2, MAX, pmb):
        s[i] = 0
    start += 1

while True:
    try:
        n = int(input())
        c = 0
        for i in range(2, n+1):
            if s[i] == 1:
                c += 1
        print(c)
    except EOFError:
        break


Measured memory_bytes: 13172
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

template<typename T>
inline void setmax(T& a, T b) {
    if (a < b) a = b;
}

template<typename T>
inline void setmin(T& a, T b) {
    if (a > b) a = b;
}

template<typename T, typename S>
istream& operator>> (istream& in, pair<S, T>& p) {
    in >> p.fs >> p.sn;
    return in;
}
template<typename T, typename S>
ostream& operator<< (ostream& out, pair<S, T>& p) {
    out << p.fs << ' ' << p.sn << ' ';
    return out;
}

template<typename T>
istream& operator>> (istream& in, vector<T>& v) {
    for (T& x : v) in >> x;
    return in;
}
template<typename T>
ostream& operator<< (ostream& out, vector<T>& v) {
    for (T& x : v) out << x << ' ';
    return out;
}

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int N = 1e6 + 100;
ll fact[N], tcaf[N], score[N];

ll Pow(ll a, ll b) {
    ll x = 1, y = a;
    while (b) {
        if (b % 2) (x *= y) %= MOD;
        (y *= y) %= MOD;
        b /= 2;
    }
    return x;
}

ll Inv(ll x) {
    return Pow(x, MOD - 2);
}

ll choose(int n, int k) {
    if (n < 0) return 0;
    if (k < 0) return 0;
    if (k > n) return 0;
    return fact[n] * tcaf[k] % MOD * tcaf[n - k] % MOD;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    fact[0] = 1;
    forn(i, 1, N)
        fact[i] = fact[i - 1] * i % MOD;
    tcaf[N - 1] = Inv(fact[N - 1]);
    ford(i, 0, N - 1)
        tcaf[i] = tcaf[i + 1] * (i + 1) % MOD;

    int n;
    cin >> n;
    fact[0] = 1;
    forn(k, 0, n)
        score[k] = choose(k - 1, n - k - 1) * fact[n - k - 1] % MOD * fact[k] % MOD;
    //forn(k, 0, n) cerr << score[k] << ' ';
    ll ans = 0;
    forn(k, 0, n) {
        ans += k * (MOD + score[k] - (k ? score[k - 1] : 0));
        ans %= MOD;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 23680
#include <iostream>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
char a[101][101];

int main(){
  int h,w;cin>>h>>w;
  rep(i,h){
    rep(j,w){
      cin>>a[i][j];
    }
  }

  set<int> line,column;
  bool flg;
  rep(i,h){
    flg=false;
    rep(j,w){
      if(a[i][j] != '.'){
        flg=true;
        break;
      }
    }
    if(flg==false){
      column.insert(i);
    }
  }

  rep(i,w){
    flg=false;
    rep(j,h){
      if(a[j][i] != '.'){
        flg=true;
        break;
      }
    }
    if(flg==false){
      line.insert(i);
    }
  }

  rep(i,h){
    if(column.count(i)==0){
      rep(j,w){
        if(line.count(j)==0){
          cout<<a[i][j];
        }
      }
      cout<<endl;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N, S, A[3030];

long long int MOD = 998244353;

long long int dp[5000][7000];

int main(void) {

	cin >> N >> S;
	for (int i = 1; i <= N; i++) { cin >> A[i]; }

	for (int i = 0; i <= N; i++) { dp[i][0] = 1; }

	long long int ans = 0;

	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= S; j++) {
			dp[i][j + A[i]] += dp[i - 1][j];
			dp[i][j + A[i]] %= MOD;
			dp[i][j] += dp[i - 1][j];
			dp[i][j] %= MOD;
		}
		ans += dp[i][S];
		ans %= MOD;
	}

	/*for (int i = 1; i <= 3; i++) {
		for (int j = 0; j <= 4; j++) {
			cout << "dp[" << i << "][" << j << "]= " << dp[i][j] << endl;
		}
	}*/

	cout << ans << endl;

	return 0;
}

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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int n;

main() {
    cin >> n;
    if (n%2) ct(n*2)
    else ct(n)
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD (long long)1e9+7
#define LINF (long long)4e18


void dfs(){

}

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> P(M),Y(M);
    rep(i,M) cin >> P[i] >> Y[i];
    vector<vector<int>> PY(N+100);
    rep(i,M){
        PY[P[i]].push_back(Y[i]);
    }
    repr(i,1,N+1){
        sort(PY[i].begin(),PY[i].end());
    }
    rep(i,M){
        printf("%012lld\n",(long long)(P[i]) * 1000000 + lower_bound(PY[P[i]].begin(),PY[P[i]].end(),Y[i]) -PY[P[i]].begin()+1);
    }
}
   


Measured memory_bytes: 7808
#include <cstdio>
#include <iostream>
#include <queue>
using namespace std;

class Point{
public:
  int a[20],n;
};

int main(){
  int i,j,n,k,tmp,ans;
  cin >> n;
  for(int t=0;t<n;t++){
    Point a;
    for(i=0;i<20;i++) cin >> a.a[i];
    queue <Point> Q;
    a.n = 20;
    Q.push(a);
    ans = 20;
    while(!Q.empty()){
      Point p = Q.front();
      Point q;
      int d[4] = {1,3,4,5};
      Q.pop();
      bool f = true;
      for(i=0;i<p.n-1;i++){
	if(p.a[i] == 0) break;
	for(j=0;j<4;j++){
	  if((i == 3 || i == 7 || i == 11 || i == 15 || i == 19) && (j == 0 || j == 3)) continue;
	  if((i == 16 || i == 17 || i == 18 || i == 19) && (j != 0)) continue;
	  if((i % 4 == 0 || i == 0) && j == 1) continue;
	  if(p.a[i+d[j]] == 0) break;
	  if(p.a[i] == p.a[i+d[j]]){
	    f = false;
	    q = p;
	    q.a[i] = q.a[i+d[j]] = 0;

	    for(int l=0;l<2;l++){
	      for(k=0;k<q.n-1;k++){
		if(q.a[k] == 0){
		  tmp = q.a[k];
		  q.a[k] = q.a[k+1];
		  q.a[k+1] = tmp;
		}
	      }
	      q.n--;
	    }
	    Q.push(q);
	  }
	}
      }
      if(f){
	ans = min(ans,p.n);
	if(ans == 0) break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 4508
#include<stdio.h>
int main(){
  int n,i;
  scanf("%d",&n);
  int p[n+1];
  for(i=1;i<=n;i++)
    scanf("%d",&p[i]);
  int min=0;
  for(i=1;i<n;i++){
    if(p[i]==i){
      p[i]=p[i+1];
      p[i+1]=i;
      min++;
    }
  }
  if(p[n]==n)
    min++;
  printf("%d\n",min);
  return 0;
}

Measured memory_bytes: 2084
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		String s=sc.next();
		String t=sc.next();
		int[][] dp=new int[len(s)+1][len(t)+1];
		for(int i=0; i<=len(s); i++) {
			for(int j=0; j<=len(t); j++) {
				dp[i][j]=0;
			}
		}		//クソガバ初期化くん

		for(int i=0; i<=len(t); i++) {
			dp[0][i]=i;		//空文字と文字列とのレイヴェンシュタイン距離はその文字列の大きさだから
		}
		for(int i=0; i<=len(s); i++) {
			dp[i][0]=i;
		}

		for(int i=1; i<=len(s); i++) {
			for(int j=1; j<=len(t); j++) {	//LCS系おなじみの1から始まるカウント　0から始まらないのはからの文字列にも何らかの意味があるからだろう
				if(s.charAt(i-1)==t.charAt(j-1)) {
					dp[i][j]=min(dp[i-1][j-1],dp[i][j-1]+1,dp[i-1][j]+1);
				}
				else if(s.charAt(i-1)!=t.charAt(j-1)) {
					dp[i][j]=min(dp[i-1][j-1]+1,dp[i][j-1]+1,dp[i-1][j]+1);
				}
			}
		}
		//ケツの文字の一致不一致しか見れなかった
		System.out.println(dp[len(s)][len(t)]);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	static int len(String a) {	//python-like method
		return a.length();
	}
	static int len(Object[] a) {
		return a.length;
	}
	static int max(int a,int b,int c) {
		return Math.max(Math.max(a,b),c);
	}
	static int max(int a,int b,int c,int d) {
		return Math.max(Math.max(a, b),Math.max(c, d));
	}
	static int min(int a,int b,int c) {
		return Math.min(Math.min(a,b),c);
	}
	static int min(int a,int b,int c,int d) {
		return Math.min(Math.min(a, b),Math.min(c, d));
	}
}


Measured memory_bytes: 30988
def rotate(p, comm):
    if comm==0:
        p[0],p[1],p[2], p[27],p[28],p[29] = p[27],p[28],p[29], p[0],p[1],p[2]
        p[14], p[15] = p[15], p[14]
        p[18], p[20] = p[20], p[18]
    elif comm==1:
        p[2],p[5],p[8], p[21],p[24],p[27] = p[21],p[24],p[27], p[2],p[5],p[8]
        p[11], p[18] = p[18], p[11]
        p[12], p[14] = p[14], p[12]
    elif comm==2:
        p[6],p[7],p[8], p[21],p[22],p[23] = p[21],p[22],p[23], p[6],p[7],p[8]
        p[12], p[17] = p[17], p[12]
        p[9], p[11] = p[11], p[9]
    elif comm==3:
        p[0],p[3],p[6], p[23],p[26],p[29] = p[23],p[26],p[29], p[0],p[3],p[6]
        p[9], p[20] = p[20], p[9]
        p[15], p[17] = p[17], p[15]
def all_eq(A, left, right):
    return all(A[i]==A[left] for i in xrange(left, right))
def is_correct(p):
    return all_eq(p, 9, 12) and all_eq(p, 12, 15) and all_eq(p, 15, 18) and all_eq(p, 18, 21) and all_eq(p, 0, 9) and all_eq(p, 21, 30)
ans = 8
def dfs(p, cnt, f):
    global ans
    if ans<=cnt:
        return
    if is_correct(p):
        ans = cnt
        return
    for k in xrange(4):
        if ans<=cnt+1:
            break
        if k==f:
            continue
        rotate(p, k)
        dfs(p, cnt+1, k)
        rotate(p, k)

n = input()
for _ in xrange(n):
    p = map(int, raw_input().split())
    ans = 8
    dfs(p, 0, -1)
    print ans

Measured memory_bytes: 4424
#include<bits/stdc++.h>
using namespace std ;
#define ll long long 
#define pb push_back
#define in(x) int x; cin>>x;
#define ln(x) long long x; cin>>x;
#define memf(a) memset(a,false,sizeof(a))
#define F first
#define S second
#define endl "\n"
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)

{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
int main()
{
	fast
	double d,t,s;
	cin>>d>>t>>s;
	if(ceil(d/s) <= t)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

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

//定数
//円周率
const double pi = 3.141592653589793238462643383279;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 100000000000000000; // = 10^17
//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";
//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7

//データ構造
//隣接リスト用構造体（有向グラフ向け）
struct edge {
  ll to; // E.toでその辺の終点へアクセスできる
  ll cost; // e.costでその辺の重みにアクセスできる
};
//Union_Find木
struct UnionFind {
  vector<int> UF; // UF.at(i) : iの親の番号
  vector<int> SIZE; // SIZE.at(root(i)) : iと連結されてる要素の数
  UnionFind(int N) : UF(N), SIZE(N, 1) { // 最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      UF.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (UF.at(x) == x) {
      return x;
    }
    return UF.at(x) = root(UF.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry) {
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    }
    // xとyの根が同じでない(=同じ木にない)時：小さい方の根を大きい方の根につける
    if (SIZE.at(rx) < SIZE.at(ry)) {
      UF.at(rx) = ry;
      SIZE.at(ry) += SIZE.at(rx);
      SIZE.at(rx) = 0;
    }
    else {
      UF.at(ry) = rx;
      SIZE.at(rx) += SIZE.at(ry);
      SIZE.at(ry) = 0;
    }
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { // xと連結されてる要素の数を返す
    return SIZE.at(root(x));
  }
};

//関数 (計算量)
//ctoi (O(1))
int ctoi(char c){
  if (c == '0') return 0;
  if (c == '1') return 1;
  if (c == '2') return 2;
  if (c == '3') return 3;
  if (c == '4') return 4;
  if (c == '5') return 5; 
  if (c == '6') return 6;
  if (c == '7') return 7;
  if (c == '8') return 8;
  if (c == '9') return 9;
  return -1;  
}
//to_char (O(1))
char to_char(int i){
  if (i == 0) return '0';
  if (i == 1) return '1';
  if (i == 2) return '2';
  if (i == 3) return '3';
  if (i == 4) return '4';
  if (i == 5) return '5';
  if (i == 6) return '6';
  if (i == 7) return '7';
  if (i == 8) return '8'; 
  if (i == 9) return '9';
  return ' ';  
}
//素数判定 
//一つ一つの判定ではこっちの方が速い(一つ当たりO(√N))
//一方100までに何個あるかなどはEratosthenesの篩の方が良い（O(NlogN))
bool PN(int x) {
  if (x <= 1) return false; // 1や0,-1は素数ではない
  if (x == 2) return true; // √2 + 1 > 2 なので下でやると 2 ％ 2 = 0 となり判定できない
  for (int i = 2; i < sqrt(x) + 1; i++) {
    if (x % i == 0) return false; // 割れたら素数じゃない
  }
  return true;
}
// A^N mod M を計算する。modしたくなかったらM = LINFとかにすればよい。(O(√N))
ll modpow(ll A, ll N, ll M) {
  ll ans = 1;
  while (N > 0) {
    if (N & 1) ans = ans * A % M;
      A = A * A % M;
      N >>= 1;
   }
  return ans;
}

int S(ll X) {
  int A = 0;
  while (X > 0) {
    X /= 10;
    A++;
  }
  return A;
}
  
//メイン処理
int main() {
  cout << fixed << setprecision(16); //精度向上
  //ここまでテンプレ
  ll N;
  cin >> N;
  int ans = INF;
  for (int i = 1; i < sqrt(N) + 1; i++) {
    if (N % i == 0) {
      ans = min(ans, max(S(i), S(N / i)));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3644
#include <iostream>
using namespace std;
int main(){
  int X,n,no_prime[100003+1]={0};
  cin >> X;
  no_prime[0]=no_prime[1]=1;
  for(n=2;n<=100003;n++){
    if(no_prime[n])continue;
    if(n>=X)break;
    for(int k=2*n;k<=100003;k+=n)no_prime[k]=1;
  }
  cout << n << endl;
  return 0;
}

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

ll calc(ll a, ll b) {
    return abs(a-b);
}

ll calc(ll a, ll b, ll c) {
    ll t;
    if (a < b) { t = a; a = b; b = t; }
    if (b < c) { t = b; b = c; c = t; }
    if (a < b) { t = a; a = c; c = t; }
    return a - c;
}

int main() {
    int h, w;
    cin >> h >> w;

    ll ans = 1e8;
    rep(i, h-1) {
        ll hh = i+1;
        ll sa = hh * w;

        if ((h-hh)%2) {
            ll hhh = (h - hh) / 2;
            ll sb = (hhh+1) * w;
            ll sc = hhh * w;
            ans = min(ans, calc(sa, sb, sc));
        }
        else {
            ll sc = (h-hh) * w / 2;
            ans = min(ans, calc(sa, sc));
        }

    }

    rep(i, h-1) {
        ll hh = i+1;
        ll sa = hh * w;

        if (w%2) {
            ll sb = (h-hh) * (w/2+1);
            ll sc = (h-hh) * (w/2);
            ans = min(ans, calc(sa, sb, sc));
        }
        else {
            ll sb = (h-hh) * (w/2);
            ans = min(ans, calc(sa, sb));
        }

    }

    int t = h; h = w; w = t;
    rep(i, h-1) {
        ll hh = i+1;
        ll sa = hh * w;

        if ((h-hh)%2) {
            ll hhh = (h - hh) / 2;
            ll sb = (hhh+1) * w;
            ll sc = hhh * w;
            ans = min(ans, calc(sa, sb, sc));
        }
        else {
            ll sc = (h-hh) * w / 2;
            ans = min(ans, calc(sa, sc));
        }

    }

    rep(i, h-1) {
        ll hh = i+1;
        ll sa = hh * w;

        if (w%2) {
            ll sb = (h-hh) * (w/2+1);
            ll sc = (h-hh) * (w/2);
            ans = min(ans, calc(sa, sb, sc));
        }
        else {
            ll sb = (h-hh) * (w/2);
            ans = min(ans, calc(sa, sb));
        }

    }


    cout << ans << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if(s.equals("Sunny")) {
			System.out.println("Cloudy");
		} else if(s.equals("Cloudy")) {
			System.out.println("Rainy");
		} else {
			System.out.println("Sunny");
		}
	}

}


Measured memory_bytes: 23380
N = int(input())
Dlist = sorted(list(map(int, input().split())))
M = int(input())
Tlist = sorted(list(map(int, input().split())))
now = 0
for d in Dlist:
    if now == M:
        break
    if Tlist[now] == d:
        now += 1

if now == M:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 33784
# 2019-11-12 01:01:32(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    a, b, c = (int(x) for x in sys.stdin.readline().split())
    print(a * b // 2)



if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#!/usr/bin/env python3
#AOJ B
from collections import deque

while 1:
    N = int(input())
    if N == 0:
        break
    W,H = map(int,input().split())
    P = [list(map(int,input().split())) for _ in range(N)]
    S,T = map(int,input().split())
    M = [[0 for _ in range(W)] for _ in range(H)]
    for i in P:
        M[i[1]-1][i[0]-1] = 1
    count = [[0 for _ in range(W - S + 1)] for _ in range(H - T + 1)]
    for i in range(H-T+1):
        for j in range(W-S+1):
            for k in range(T):
                for l in range(S):
                    if M[i+k][j+l] == 1:
                        count[i][j] += 1
    m = 0
    for i in range(H - T + 1):
        s = max(count[i])
        if s > m:
            m = s
    print(m)


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

typedef long long ll;
ll dp[70][70][70];
int t;
ll n, a, b, c, d;
const ll INF = 1e18;
map<ll, ll> v;

ll solve(ll n)
{

    if (n == 1)
        return d;
    if (n == 0)
        return 0;

    if (v.count(n))
    {
        return v[n];
    }

    ll res = INF;

    if (res / n >= d)
        res = min(res, n * d);

    res = min(res, solve(n / 2) + d * (n % 2) + a);
    // cout << "n = " << n << "   " << res << endl;
    res = min(res, solve((n + 1) / 2) + d * (2 - n % 2) + a);
    //cout << "n = " << n << "   " << res << endl;
    res = min(res, solve(n / 3) + d * (n % 3) + b);
    //cout << "n = " << n << "   " << res << endl;
    res = min(res, solve((n + 2) / 3) + d * (3 - n % 3) + b);
    //cout << "n = " << n << "   " << res << endl;
    res = min(res, solve(n / 5) + d * (n % 5) + c);
    //cout << "n = " << n << "   " << res << endl;
    res = min(res, solve((n + 4) / 5) + d * (5 - n % 5) + c);
    //cout << "n = " << n << "   " << res << endl;
    return v[n] = res;
}

int main()
{
    cin >> t;

    for (int i = 0; i < t; i++)
    {
        cin >> n >> a >> b >> c >> d;
        v.clear();

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


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

using namespace std;
using ll = long long;
const int md = 1e9 + 7;

int main(int argc, const char *argv[]) {
  ll n, m;
  cin >> n >> m;
  vector<ll> fact(n + m + 1);
  fact[1] = 1;
  for (ll i = 2; i < fact.size(); i++) {
    fact[i] = fact[i - 1] * i % md;
  }
  
  ll ans = 0, total = n + m, half = total / 2;
  if (min(n, m) != half) {
    cout << ans << '\n';
    return 0;
  }

  if (total % 2 == 1) {
    ans = fact[half] * fact[half + 1] % md;
  } else {
	ans = fact[half] * fact[half] % md;
    ans = ans * 2 % md;
  }
  
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 4748
x,n = map(int, input().split())
if n==0:
  print(x)
  quit()
p = list(map(int, input().split()))
ans = 0
for i in range(x+1):
  x1,x2 = x+i,x-i
  if (x1 in p) and (x2 in p):
    continue
  elif not((x1 in p) or (x2 in p)):
    ans = min(x1,x2)
    break
  elif not(x1 in p):
    ans = x1
    break
  else:
    ans = x2
    break
print(ans)  

Measured memory_bytes: 9092
import java.util.Scanner;
public class Main {
	static long k = 0;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] a = new int[n + 1];
		long c = 1;
		for (int i = 2; i <= n; i++) {
			int m = i;
			for (int j = 2; j <= i; j++) {
				while (m % j == 0) {
					m /= j;
					a[j]++;
				}
			}
		}
		for (int i = 2; i <= n; i++)
			c = c * (a[i] + 1) % 1000000007;
		System.out.println(c);
	}
}

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

int main(){
  char c;
  cin >> c;
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator > (long&& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  long n;
  std::vector<long> xs;
  Solver() {
    S002 reader;
    reader >= n;
    long m = 3 * n;
    reader >m>= xs;
  }
  void solve() {
    std::sort(xs.begin(), xs.end());
    std::reverse(xs.begin(), xs.end());
    long res = 0;
    for(long i = 0; i < n; ++i) {
      res += xs[2 * i + 1];
    }
    printf("%ld\n", res);
  }
};

int main() {
  loop std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

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

int main() {
 int N ;
  cin>>N;
 vector<double> value(N) ;
  for (int i= 0; i<N;i++){
  cin >> value.at(i) ;
  }
  sort(value.begin(),value.end());
  double ans = value.at(0) ;
  for (int j=0; j<N-1;j++){
    ans += value.at(j+1) ;
    ans/=2;
  }
  cout <<ans;
}

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

int main() {
    int x,y;
    cin>>x>>y;
    cout<<x+y/2<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int RightDice(int num[6], int top, int front);

int main()
{
    int num[6];
    int q;
    int top, front;
    int i;
    
    for(i=0; i<6; i++) scanf("%d", &num[i]);
    scanf("%d", &q);
    
    for(i=0; i<q; i++){
        scanf("%d %d", &top, &front);
        printf("%d\n", RightDice(num, top, front));
    }
    
    return 0;
}

int RightDice(int num[6], int top, int front)
{
    int i;
    int t_num, f_num, r_num;
    for(i=0; i<6; i++){
        if(num[i] == top) t_num = i;
        else if(num[i] == front) f_num = i;
    }
    
    if(t_num == 0){
        if(f_num == 1) r_num = 2;
        else if(f_num == 2) r_num = 4;
        else if(f_num == 4) r_num = 3;
        else if(f_num == 3) r_num = 1;
    }
    else if(t_num == 1){
        if(f_num == 0) r_num = 3;
        else if(f_num == 3) r_num = 5;
        else if(f_num == 5) r_num = 2;
        else if(f_num == 2) r_num = 0;
    }
    else if(t_num == 2){
        if(f_num == 0) r_num = 1;
        else if(f_num == 1) r_num = 5;
        else if(f_num == 5) r_num = 4;
        else if(f_num == 4) r_num = 0;
    }
    else if(t_num == 3){
        if(f_num == 0) r_num = 4;
        else if(f_num == 4) r_num = 5;
        else if(f_num == 5) r_num = 1;
        else if(f_num == 1) r_num = 0;
    }
    else if(t_num == 4){
        if(f_num == 0) r_num = 2;
        else if(f_num == 2) r_num = 5;
        else if(f_num == 5) r_num = 3;
        else if(f_num == 3) r_num = 0;
    }
    else if(t_num == 5){
        if(f_num == 1) r_num = 3;
        else if(f_num == 3) r_num = 4;
        else if(f_num == 4) r_num = 2;
        else if(f_num == 2) r_num = 1;
    }
    return (num[r_num]);
}

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

string s;

bool check(int ii){
	string tmp;
	for(int i=0; i < 3; i++){
		tmp += s[i+ii];
	}
	return "ABC" == tmp;
}

int main(){
	int n;
	cin >> n >> s;
	
	int qtd = 0;
	
	for(int i=0; i < n-2; i++){
		if(check(i)) qtd++;
	}
	cout << qtd << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
    int sum = 0;
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    if(n % 2 == 1){
        System.out.println((n / 2) + 1);
    }else{
        System.out.println(n / 2);
    }
    
    

        
    
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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 (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    ll k;
    int n;
    cin >> k >> n;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    a.push_back(a[0] + k);
    ll ans = LINF;
    rep(i, n) chmin(ans, k - (a[i + 1] - a[i]));
    cout << ans << endl;
}


Measured memory_bytes: 4864
#include <iostream>

using namespace std;

int main() {
    int a,b,c,d,e,x,y,z;
    cin >> a;
    x=a/3600;
    b=a%3600;
    y=b/60;
    d=x*3600;
    e=y*60;
    z=a-d-e;
    

    cout<< x << ":" << y << ":" << z <<endl;
                                                                                                                                      
}


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

int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
int main()
{
    int n,sum=0,flag=0;
    cin>>n;
    
     for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
          for(int k=1;k<=n;k++) sum+=gcd(i,gcd(j,k));


             cout<<sum<<endl;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

LL a[100];
int i,n;
int main()
{
	a[0]=2;
	a[1]=1;
	cin>>n;
	for(i=2;i<=n;i++)
		a[i]=a[i-1]+a[i-2];
	cout<<a[n]<<endl;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(ll i=0;i<n;i++)
#define for1(i,n)        for(ll i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"

int main()
{
	ll t=0,n,x,c=1;
	cin>>n>>x;
	vector<ll>l(n+1);
	for0(i,n) cin>>l[i];
	for1(i,n){
		t = t+l[i-1];
		if(t<=x)c++;
		}
	cout<<c<<nw;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	long long n,k;
	long long sum=0;
	const long long modd=1e9+7;
	cin>>n>>k;
	for(long long i=k;i<=n+1;i++)
	{
		long long sum1=(n+n-i+1)*i/2;
		long long sum2=(i-1)*i/2;
		sum+=sum1-sum2+1;
		sum%=modd;
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#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 show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    bool ans = false;
    if (c-a-b <=0) {
        ans=false;
    } else {
        ll s = c-a-b;
        s = s*s;
        if (4*a*b<s){
            ans=true;
        } else {
            ans=false;
        }
    }

    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://agc008.contest.atcoder.jp/tasks/agc008_b>
問題文============================================================
 N 個のマスが横一列に並んでいます。 左から i 番目のマスには整数 ai が書かれています。
 
 最初、すべてのマスは白色です。 すぬけ君は次の操作を好きな回数だけ繰り返します。
 
 連続する K 個のマスを選び、それらすべてを白く塗るか、それらすべてを黒く塗る。
 このとき、各マスの色は上書きされる。
 すぬけ君が操作を終えた後、黒いマスに書かれた整数の総和がスコアになります。
 考えられるスコアの最大値を求めてください。
=================================================================

解説=============================================================
 
 自由に塗り替える色を黒か白かに決定できるので、
 最終的に 任意の連続するK個の区間が　黒 or 白　で統一さえしていれば、
 他のマスは自由な色付けをすることができる。
 
 よって、区間の総和を累積和でとっておき、
 ある区間を黒 or 白にした時の総和と他のマスで正となっているものの総和を全探索すれば良い
 
================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N,K; cin >> N >> K;
    vector<ll> a(N);
    for(auto &in:a) cin >> in;
    vector<ll> cusum(N+1,0);
    vector<ll> p_cusum(N+1,0);
    for(int i = 0; i < N;i++) {
        cusum[i+1] = cusum[i] + a[i];
        p_cusum[i+1] = p_cusum[i] + max(a[i],0LL);
    }
    ll ans = 0;
    for(int i = 0;i <= N - K;i++){
        ll sec_sum = cusum[i+K] - cusum[i];
        ll l_sum = p_cusum[i];
        ll r_sum = p_cusum[N] - p_cusum[i+K];
        ans = max(ans,max(sec_sum,0LL) + l_sum + r_sum);
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> cnt(n, 0);
    for(int i=0;i<m;i++){
        int a, b;
        cin >> a >> b; a--; b--;
        cnt[a]++;
        cnt[b]++;
    }
    for(int i=0;i<n;i++){
        if(cnt[i]%2){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 640
n = int(input())
con = 1;
a = 1;
b = 1;

for i1 in range(n):
    con = (con * 10) % 1000000007;
for i2 in range(n):
    a = (a * 9) % 1000000007;
for i3 in range(n):
    b = (b * 8) % 1000000007;

c = (2*a - b)%1000000007;
con = (con - c)%1000000007;
print(con)

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

void solve(long long n, std::vector<std::string> S){
    //vector<map<ll, ll>> vec;
    //map<char, ll> mp;
    vector<vector<ll>> vec;
    for(ll i = 0; i < n; ++i){
        vector<ll> az;
        for(char j = 'a'; j <= 'z'; ++j){
            az.push_back((ll)count(S[i].begin(),S[i].end(), j));
        }
        vec.push_back(az);
        //for(auto i: cnt_vec) cout << i << endl;
    }
    //cout << vec[0].size() << endl;
    vector<ll> ans(vec[0].size(), INF);
    for(ll i = 0; i < vec[0].size(); ++i){
        for(ll j = 0; j < n; ++j){
            ans[i] = min(ans[i], vec[j][i]);
        }
    }
    for(char i = 'a'; i <= 'z'; ++i){
        for(ll j = 0; j < ans[i - 'a']; ++j){
            cout << i;
        }
    }
    cout << endl;
    //for(char i = 'a'; i <= 'z'; ++i) cout << i-'a' << endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a);i>int(b);--i)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define show(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl;
#define MOD 1000000007
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define SZ(x) ((int)(x).size())
#define sum(v,i) accumulate(all(v),i)
//#define int long long
using ll = long long;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
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 (b < a) { a = b; return 1; } return 0; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }//最大公約数
int lcm(int a, int b) { return a * b / gcd(a, b); }	//最小公倍数
//template <typename... Args>void IN(Args& ... args) {cin >>args;IN(args...);return;} //まとめて入力　IN(a,b,c,d...)

void Main() {
	int n; cin >> n;
	vector<int> v(n);
	rep(i, n)cin >> v[i];
	sort(all(v));
	//cout << accumulate(v.begin(), v.end() - 1, 0);
	if (accumulate(v.begin(), v.end() - 1, 0) > v[n - 1])cout << "Yes";
	else cout << "No";
}

signed main() {
	Main();

	return 0;
}


Measured memory_bytes: 256