akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
int mod;
inline void add(long long &x, long long y) {
  x += y;
  if(x >= mod) x -= mod;
}

inline void sub(long long &x, long long y) {
  x -= y;
  if(x < 0) x += mod;
}

inline long long mul(long long x, long long y) {
  return x % mod * y % mod;
}

inline long long inverse(long long x) {
  x = (x % mod + mod) % mod;
  long long y = mod, u = 1, v = 0;
  while(y) {
    long long t = x / y;
    x -= t * y; swap(x, y);
    u -= t * v; swap(u, v);
  }
  return (u % mod + mod) % mod;
}

inline long long power(long long x, long long y) {
  long long res = 1;
  while(y) {
    if(y & 1) res = mul(res, x);
    x = mul(x, x);
    y >>= 1;
  }
  return res;
}

// greater index means greater power
template<typename T> vector<T> prod (const vector<T>& v, const vector<T>& w) {
  const int n = (int) v.size();
  const int m = (int) w.size();
  vector<T> res(n + m - 1);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      res[i + j] += v[i] * w[j] % mod;
      res[i + j] %= mod;
    }
  }
  return res;
}
// v / (X - x);
template<typename T, typename U> vector<T> quot (vector<T> v, const U& x) {
  const int n = (int) v.size();
  vector<T> res(n - 1);
  for (int i = n - 1; i >= 1; i--) {
    res[i - 1] = v[i];
    v[i - 1] += v[i] * x % mod;
    v[i - 1] %= mod;
  }
  return res;
}
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int p;
  cin >> p;
  mod = p;
  vector<long long> a(p);
  for (int i = 0; i < p; i++) {
    cin >> a[i];
  }
  vector<long long> f(1, 1);
  for (int i = 0; i < p; i++) {
    f = prod(f, vector<long long>{(-i + mod) % mod, 1});
  }
  vector<long long> ans(p);
  for (int i = 0; i < p; i++) {
    long long res = 1;
    for (int j = 0; j < p; j++) {
      if (i == j) continue;
      (res *= (i - j + mod) % mod) %= mod;
    }
    res = inverse(res) * a[i];
    vector<long long> ff = quot(f, i);
    for (int j = 0; j < p; j++) {
      (ans[j] += res * ff[j] % mod) %= mod;
    }
  }
  for (int i = 0; i < p; i++) {
    if (i > 0) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
int main(void){
	int n,x;
	long long i;
	char d[1001],tmp[1001];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&x);
		d[i]=x+'0';
	}
	d[i]=0;
	for(i=0;;i++){
		sprintf(tmp,"%d",i);
		if(strstr(d,tmp)==NULL){
			printf("%lld\n",i);
			return 0;
		}
	}
}

Measured memory_bytes: 624
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    vint x(5);
    rep(i,5) cin >> x[i];
    rep(i,5) {
        if (x[i] == 0) {
            cout << i+1 << endl;
            return 0;
        }
    }
}

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

int main(){
    int n;cin>>n;
    if(n<1000){
      cout << "ABC"<<endl;
    }else{
      cout << "ABD" <<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7
    H,N = LMIIS()
    AB = XLMIIS(N)
    #最小消費量[価値]
    inf_v = 20000
    inf_c = 10**8
    dp = [inf_c]*inf_v
    dp[0] = 0
    max_c = 0
    for i in range(H):
        if dp[i] == inf_c:
            continue
        for a,b in AB:
            dp[i+a] = min(dp[i+a], dp[i] + b)
            max_c = max(max_c,i+a)
    print(min(dp[H:max_c+1]))

if __name__ == '__main__':
    main()

Measured memory_bytes: 41964
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;

    int xx = x2 - x1, yy = y2 - y1;
    int x4 = x1 - yy, y4 = y1 + xx;
    int x3 = x4 + xx, y3 = y4 + yy;

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define INF 1000000000
#define MOD 1000000007

void solve() {
    string s;
    int q;
    cin >> s >> q;
    deque<char> s1(all(s));
    bool st = 0;
    rep(i,0,q) {
        int t, f;
        char c;
        cin >> t;
        if (t == 1) {
            st ^= 1;
        }
        else if (t == 2) {
            cin >> f >> c;
            --f;
            if (f^st) {
                s1.pb(c);
            } 
            else {
                s1.push_front(c);
            }
        }
    }
    if (st) reverse(all(s1));
    for (auto&i: s1) {
        cout << i;
    }
    cout << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}



Measured memory_bytes: 4040
s = input()
n = len(s)
INF = 10**9

alph = "abcdefghijklmnopqrstuvwxyz"
to_int = {v: i for i, v in enumerate(alph)}
dp = {}
all_state = 0

for i in range(n):
    all_state ^= 1 << to_int[s[i]]
    if all_state not in dp:
        dp[all_state] = i + 1
    for j in range(26):
        bit = all_state ^ (1 << j)
        if bit in dp:
            dp[all_state] = min(dp[bit] + 1, dp[all_state])
    if bin(all_state).count("1") <= 1:
        dp[all_state] = 1
print(dp[all_state])

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template<typename T>
T mypow(T a, int n){
  if(n == 0) return 1;
  if(n%2 == 0){
    T res = mypow(a, n/2);
    return res * res;
  }
  return a * mypow(a, n-1);
}

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

  int x;
  cin >> x;
  ll ans = 0;
  for(int i = 1; i <= x; i++) {
    for(int j = 2; j < 10; j++) {
      ll tmp = mypow(i,j);
      if(tmp <= x) ans = max(ans, tmp);
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	
	int c = n - max(a, b) - min(a, b);
	if (c < 0)
		c *= -1;
	else
		c = 0;
	
	cout << min(a, b) << " " << c << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>

using namespace std;

#define mod (1e9 + 7)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()

typedef long long ll;

void solve1()
{
    ll x; cin >> x;
    ll ansa;
    ll ansb;
    for(ll i = -1000; i <= 1000; i++) {
        for(ll j = -1000; j <= 1000; j++) {
            ll a = (ll)pow(i, 5);
            ll b = (ll)pow(j, 5);

            if(a - b == x) {
                ansa = i;
                ansb = j;
                break;
            }
        }
    }

    cout << ansa << " " << ansb << endl;
}

int main()
{
    solve1();
}


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


typedef long long ll;
typedef double db;
int main(){
	int n , m , x ,y;
	scanf("%d %d %d %d",&n,&m,&x,&y);
	int a[1000] ,b[1000];
	for(int i = 0 ; i < n ; i ++){
		scanf("%d",&a[i]);
	}
	for(int i  = 0 ; i < m ; i ++){
		scanf("%d",&b[i]);
	}
	sort(a,a+n);sort(b,b+m);
	for(int i = -100 ; i <= 100 ; i ++){
		if(i>x&&i<=y){
			if(i>a[n-1]&&i<=b[0]){
				printf("No War");return 0;
			}
		}
	}
	printf("War");












	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using std::min;

int n;

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

int main()
{
    scanf("%d",&n);
    int Ans=0x7f7f7f7f;
    for(int i=1;i<=n>>1;++i)Ans=min(Ans,Divide(i)+Divide(n-i));
    printf("%d\n",Ans);
    return 0;
}


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

using namespace std;

int main(void)
{
	string s;
	bool beg=false;
	int cnt=0,ans=0;

	cin>>s;

	for(int i=0;i<s.size()+1;i++){
		if((s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G')){
			 cnt++;
		 }
		else{
			if(ans<cnt) ans=cnt;
			cnt=0;
		}
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

    int S;
    cin >> S;

    int h = S / (60 * 60);
	int m = (S % (60 * 60)) / 60;
    int s = (S % (60 * 60)) % 60;

    cout << h << ":" << m << ":" << s << endl;

}

Measured memory_bytes: 3104
#include <iostream>

int main()
{
    int a, b, c;
    std::cin >> a >> b >> c;

    int arr[] = {a, b, c};

    for (int n = 0; n < 3; n++)
    {
        for (int i = 0; i < 2; i++)
        {
            if (arr[i] > arr[i+1])
            {
                int x, y;
                x = arr[i];
                y = arr[i+1];
                arr[i] = y;
                arr[i+1] = x;
            }
        }
    }

    std::cout << arr[0] << " " << arr[1] << " " << arr[2] << std::endl;

    return 0;
}



Measured memory_bytes: 3092
#include <algorithm>
#include <iostream>
#include <vector>
#include <limits>
int main()
{
    int N, K;
    std::cin >> N >> K;
    std::vector<int> hs{};
    for (int i = 0; i < N; i++) {
        int h;
        std::cin >> h;
        hs.emplace_back(h);
    }
    std::sort(hs.begin(), hs.end());
    int min = std::numeric_limits<int>::max();
    for (int i = 0; i < N - K + 1; i++) {
        if (hs.at(i + K - 1) - hs.at(i) < min) {
            min = hs.at(i + K - 1) - hs.at(i);
        }
    }
    std::cout << min << std::endl;
    return 0;
}

Measured memory_bytes: 892
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        int n = scanner.nextInt();
        String s = scanner.next();

        char[] array = s.toCharArray();

        int a = 0;

        StringBuffer  sb =  new StringBuffer();
        sb.setLength(0);

        String[] b = {"A", "B", "C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};

        for(int i=0;i<array.length;i++) {
        	a = array[i]-'A' + n;
        	if(a>25) {
        		a-=26;
        	}
        	sb.append(b[a]);
        }
        System.out.println(sb.toString());

    }

    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


Measured memory_bytes: 21204
#内積が0になるかを判定
while True:
    try:
        Ax,Ay,Bx,By,Cx,Cy,Dx,Dy=map(float, input().split())
    except:
        break
    #複素数化する
    A=complex(Ax,Ay)
    B=complex(Bx,By)
    C=complex(Cx,Cy)
    D=complex(Dx,Dy)
    #判定
    if -1e-10<((A-B)/(C-D)).real<1e-10:
        print("YES")
    else:
        print("NO")



Measured memory_bytes: 5592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
#define pb push_back

int main()
{
    int tst=1;
	//scanf("%d",&tst);
    while(tst--)	
	{
		string s;
		cin >> s;
		int l=s.size();
		if(s[l-1]=='3')
		{
			cout << "bon\n";
		}
		else if(s[l-1]=='0' || s[l-1]=='1' || s[l-1]=='6' || s[l-1]=='8')
		{
			cout << "pon\n";
		}
		else
		{
			cout << "hon\n";
		}
	}
    return 0;
}


Measured memory_bytes: 3628
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int main()
{
    int h,a;
    while(cin>>h>>a)
    {
        cout<<(ceil(h*1.0/a))<<endl;
    }
    return 0;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;


int dp[201010];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N; cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    rep(i, N) {
        int p = a[i];
        dp[p] = dp[p-1] + 1;
    }
    int res = 201010;
    reps(i, N) {
        res = min(res, N - dp[i]);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>

int A[10], a[50], b[50], c[50], d[50];

int ans;

int n, m, q;

void dfs(int k)
{

    if (k == n)
    {
        int sum = 0;
        for (int i = 0; i < q; ++i)
        {
            if (A[b[i]] - A[a[i]] == c[i])
                sum += d[i];
        }
        ans = std::max(ans, sum);
        return;
    }

    for (int i = A[k - 1]; i <= m; ++i)
    {
        A[k] = i;
        dfs(k + 1);
    }
}

int main()
{

    A[0] = 1;

    std::cin >> n >> m >> q;

    for (int i = 0; i < q; ++i)
    {
        std::cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i];
        --b[i];
    }

    dfs(1);

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 3156
#include<iostream>
main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}

Measured memory_bytes: 5816
int main(void){
  int n,i,x;
  scanf("%d",&n);
 
  for(i=1;i<=n;i++){
    x=i;
    if ( x % 3 == 0 ){
      printf(" %d",i);
    }else{
      do{
        if ( x % 10 == 3 ){
          printf(" %d",i);
          x=0;
        }
        x /= 10;
      }while( x );
    }
  }
  printf("\n");
  return 0;
}


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

using namespace std;

//#define INF 1001000100010001000
#define INF 1010001000
#define MOD 1000000007
#define EPS 1e-10
//#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    string st;
    cin >> st;
    
    vvi dp(2, vi(2019, 0));

    int ans = 0;
    rep(i, st.size()) {
        rep(j, 2019) {
            dp[!(i&1)][(j * 10 + (st[i] - '0')) % 2019] = dp[i&1][j];
        }
        dp[!(i&1)][(st[i] - '0')]++;
        ans += dp[!(i&1)][0];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3696
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    string S;
    cin >> S;

    //本文
    string K = "keyence";
    ll num = S.size();

    if(S==K){puts("YES");return 0;}
    
    for(int i =0;i<num;i++){
      for(int j = i;j<num;j++){
        string T= "";
        for(int k = 0;k<num;k++){
          if(i<=k&&k<=j) continue;
          else
          {
            T.push_back(S[k]);
          }
        }
        if(T==K){puts("YES");
        return 0;}
      }
    }

    //出力
    cout << "NO" << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<int>> G(N+1, vector<int>(0));
  int A, B;
  for(int i=0; i<M; i++){
    cin >> A >> B;
    G.at(A).push_back(B);
    G.at(B).push_back(A);
  }
  vector<int> L(N+1, -1);
  L.at(1)=0;
  queue<int> que;
  que.push(1);
  vector<int> Ans(N+1);
  while(!que.empty()){
    int k=que.front();
    que.pop();
    for(int i:G.at(k)){
      if(L.at(i)==-1){
        que.push(i);
        L.at(i)=L.at(k)+1;
        Ans.at(i)=k;
      }
    }
  }
  cout << "Yes" << endl;
  for(int i=2; i<=N; i++){
    cout << Ans.at(i) << endl;
  }
}

Measured memory_bytes: 10748
#include <bits/stdc++.h>
#define rep(i, c) for(int i = 0; i < (int)c; i++)
using namespace std;
int main()
{
    int N; cin >> N;
    vector<int> X(N);
    rep(i, N) cin >> X[i];
    sort(X.begin(), X.end(), greater<int>());
    cout << (X[N/2-1] - X[N/2]) << endl;
}

Measured memory_bytes: 768
/*
 * Author: GSaMenezes 
 * 
 */
 
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define repn(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
 
const int INF = 1e9+5;
 
int main (){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;
    int n, k;
    cin >> n >> k;
    vector <int> h(n);
    rep(i, 0, n)
		cin >> h[i];
	vector <int> dp(n, INF);
	dp[0] = 0;
	rep(i, 0, n){
		repn(j, i+1, i+k){
			if(j < n)
				dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]));
		}
	}
	cout << dp[n-1];
    return 0;
}

Measured memory_bytes: 1024
import sys

#+++++
		
def main():
	a = int(input())
	s = input()
	
	sst=len([c for c in s[1:] if c == 'E'])
	ret=sst
	cc=sst
	for i, c in enumerate(s[:-1]):
		leader = s[i+1]
		if leader == 'E':
			cc -= 1
		
		if c == 'W':
			cc+=1
		#pa(cc)
		ret = min(ret, cc)
	
	
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 6300
#include<iostream>

using namespace std;

int main() {
	int H, W; 
		while(cin >> H >> W)
		if (W == 0 && H == 0) {
			return 0;
		} else {
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					cout << "#";
				}
				cout << endl;
			}cout << endl;
		}
	
	
	return 0;
}

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

#define int long long
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); i++)  
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rap(i,a,n) for (int i = a; i < (n); i++) 
#define rrap(i,n,a) for (int i = (n)-1; i >= a; i--) 
#define LL_MAX 9223372036854775807

typedef vector<int> vi;  
typedef pair<int,int> ii;  
typedef vector<ii> vii;  
typedef list<int> li;  
typedef unordered_map<int,int> mii;

vector<bool> v;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,k;
    cin >> n >> k;

    v.assign(10,false);

    rep(i,k) {
        int a;
        cin >> a;
        v[a] = true;
    }

    while (1) {
        bool flag=false;
        int x = n, y;
        while (x != 0) {
            y = x%10;
            if (v[y]) {
                flag = true;
                break;
            }
            x/=10;
        }
        if (flag) {
            n++;
            continue;
        }
        else break;
    }

    cout << n << '\n';


    return 0;
    //compile: g++ -std=c++14 -O2 -Wall NAME.cpp -o NAME
}


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

int main() {

	int a, b, c;

	int divisor = 0;

	cin >> a >> b >> c;

	for (int i = a; i <= b; i++) {
		if (c % i == 0) divisor++;
	}

	cout << divisor << endl;

	return 0;
}


Measured memory_bytes: 3108
import math


def combi(a, b):
    ans = math.factorial(a) / (math.factorial(a - b) * math.factorial(b))
    ans = int(ans)
    return ans


N=int(input())

p=[]
for i in range(N):
    p.append(list(map(int,input().split())))

kai=(math.factorial(N)*(N-1))//combi(N,2)

a=0

for i in range(N):
    for j in range(i+1,N):
        temp=((p[i][0]-p[j][0])**2+(p[i][1]-p[j][1])**2)**0.5
        a+=temp*kai

print(a/math.factorial(N))


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {
			String n = sc.next();
			long result = 0;
			// ビット全探索
			int digits = n.length() - 1;
			for (int i = 0; i < Math.pow(2, digits); i++) {
				StringBuffer tmp = new StringBuffer().append(n.charAt(0) - '0');
				for (int j = 0; j < digits; j++) {
					if ((1 & i >> j) == 1) {
						result += Long.valueOf(tmp.toString());
						tmp = new StringBuffer("0");
					}
					tmp.append(n.charAt(j + 1));
				}
				result += Long.valueOf(tmp.toString());
			}
			System.out.println(result);
		}
	}

}


Measured memory_bytes: 21716
num, count_station, my_position = map(int, input().split())
a = map(int, input().split())
station_list = list(a)
space = num + 1
first_me_cost = 0
last_me_cost = 0

distance_me_first = my_position
distance_me_last = num - my_position

for i in station_list:
    if 1 <= i <= my_position - 1:
        first_me_cost += 1

for i in station_list:
    if my_position + 1 <= i < num:
        last_me_cost += 1

if first_me_cost > last_me_cost:
    print(last_me_cost)
elif last_me_cost > first_me_cost:
    print(first_me_cost)
elif last_me_cost == first_me_cost:
    print(first_me_cost)


Measured memory_bytes: 9100
import math
for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 s,t,u=a*a+b*b,c*c+d*d,e*e+f*f
 x=(s*(d-f)+t*(f-b)+u*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=(s*(c-e)+t*(e-a)+u*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print('%.3f %.3f %.3f'%(x,y,math.hypot(x-a,y-b)))


Measured memory_bytes: 5672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair;
#define pb push_back;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a[3];
  	cin >> a[0] >> a[1]>>a[2];
  	if(a[0]%2==0 || a[1]%2==0 || a[2]%2==0){
     cout << 0 << endl;
     return 0;
    }
  sort(a,a+3);
  cout << a[0] * a[1] << endl;
  
 	return 0; 
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
class Main{


	static final int MOD = 1000000007;


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
//		int N = sc.nextInt();
//		int M = sc.nextInt();
		String ss = sc.next();
		

		for(int i =0;i < ss.length();i++){
			char cc = ss.charAt(i);
			if((i%2 != 0 && cc == 'R' )||(i % 2 == 0 && cc == 'L')){
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");




	}

	static void sieve(ArrayList<Long> list){
		int n = 50000000;
		boolean[] is_prime = new boolean[n+1];
		int[] prime = new int[n];
		for(int i= 0;i <=n;i++){
			is_prime[i] = true;
		}
		list.add((long) 1);
		for(int i = 2;i <= n;i++){
			if(is_prime[i]){
				list.add((long)i);
				for(int j = 2*i;j <= n;j+=i){
					is_prime[j] = false;
				}
			}
		}



	}




	static int upperbond(int k,int min,int[] data){		//kより小さい最大の値をdataの中から探し、返す二分探索
		int max = data.length;
		//		if(min == data.length-1){
		//			if(data[min] > k){
		//				return min;
		//			}
		//		}

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}

		return max;
	}

	static int lowerbond(int k,int min,int[] data){		//kより大きい最小の値をdataの中から探し、返す二分探索
		int max = data.length;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}
		return min;
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}




}


class Edge extends ArrayList<P>{

}

class P{
	int to;
	long cost;
	P(int to,long cost){
		this.to = to;
		this.cost = cost;
	}
}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return   from- otherpair.from;
	}








}






Measured memory_bytes: 22996
#include<iostream>
#include<cmath>

using namespace std;

int main(void) {
	int d, n;

	cin >> d >> n;

	if (n == 100) {
		cout << 101 * (int)pow(100, d) << endl;
	}
	else {
		cout << n * (int)pow(100, d) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
using ll = long long;

int main(){
  string n;
  int r=0;
  cin >> n;
  int ns =n.size();
  for(int i = 0;i < n.size();i++){
    string  str ="0";
    str.at(0)=n.at(i);
    r += stoi(str);
  }

  if(r%9==0){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" <<endl;
  }


}

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

// int dp[100000]={0};
//int sum=0;
int a[100000][3]={0};
//std::vector<int> v;

int rec(int i){
  if(i==0){
    //cout<<i<<" "<<endl; 
    a[i+1][0]+=max(a[0][1],a[0][2]);
    //cout<<max(a[0][1],a[0][2])<<endl;
    a[i+1][1]+=max(a[0][0],a[0][2]);
    //cout<<max(a[0][0],a[0][2])<<endl;
    a[i+1][2]+=max(a[0][1],a[0][0]);
    //cout<<max(a[0][1],a[0][0])<<endl;
    i+=1;
    return i;
  }
  else{
    int j=rec(i-1);
    //cout<<j<<" "<<endl; 
    a[j+1][0]+=max(a[j][1],a[j][2]);
    //cout<<max(a[j][1],a[j][2])<<endl;
    a[j+1][1]+=max(a[j][0],a[j][2]);
    //cout<<max(a[j][0],a[j][2])<<endl;
    a[j+1][2]+=max(a[j][1],a[j][0]);
    //cout<<max(a[j][1],a[j][0])<<endl;
    j=j+1;
    return j; 
  }
}

int main(){
  //freopen("input.txt","r",stdin);
  long long n;
  cin>>n;
  for(long long i=0;i<n;i++){
    for(long long j=0;j<3;j++)
      cin>>a[i][j];
  }
  //memset(dp, -1, sizeof(dp)) ;
  if(n>=2)
  rec(n-2);
  // for(int i=0;i<n;i++){
  //   for(int j=0;j<3;j++)
  //     cout<<a[i][j]<<" ";
  //   cout<<endl;
  // }

  cout<<max(a[n-1][0],max(a[n-1][1],a[n-1][2]));
  return 0;
}

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

int main()
{
    char b;
    cin >> b;
    switch(b)
    {
        case 'A':
            cout << "T\n";
            break;
        case 'C':
            cout << "G\n";
            break;
        case 'G':
            cout << "C\n";
            break;
        case 'T':
            cout << "A\n";
            break;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <queue>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include<cstdio>
#include<cstring>
#include<time.h>
#include<iomanip>
#define PB push_back
#define in scanf
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define IREP(i,n) for (int i=0;i<=(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
using	namespace std;
int n,k;
int main(){
    cin >> n;
    REP(kk,n){pair<int ,int > g ;
    cin >> g.first >> g.second ;
    cin >> k;
    int x1,x2,y1,y2;
    bool map[16][16][16][16];//[x1][y1]???[x2][y2]
    memset (map,-1,sizeof(map));
    REP(i,k){
      cin >> x1 >> y1 >> x2 >> y2;
      map[x1][y1][x2][y2] = false;
      map[x2][y2][x1][y1] = false;
    }
    int dp[17][17];
    memset (dp,0,sizeof(dp));
    dp[0][0]=0 ;
    dp[1][1]=1 ;
    REP(y,g.second+1){
      REP(x,g.first+1){
        if(x==0 && y==0)continue;

        if(x > 0&& map[x-1][y][x][y]){
          dp[y+1][x+1] += dp[y+1][x];
          }
        if(y > 0&& map[x][y-1][x][y]){
          dp[y+1][x+1] += dp[y][x+1];
        }

      }
    }
    if(dp[g.second+1][g.first+1]==0)printf("Miserable Hokusai!\n");
    else printf("%d\n",dp[g.second+1][g.first+1]);

}
}

Measured memory_bytes: 1220
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long[] a = new long[n];
      for(int i = 0;i < n;i++){
        a[i]=sc.nextLong()-i-1;
      }
      Arrays.sort(a);
      long b = 0;
      if(n%2==1)b = a[n/2];
      else b = (a[n/2-1]+a[n/2])/2;
      long sum = 0;
      for(int i = 0;i < n;i++)sum+=Math.abs(a[i]-b);
      System.out.println(sum);
    }
}


Measured memory_bytes: 89052
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define fi first
#define se second
#define forn(i, n)for(int i=0;i<int__(n);i++) 
#define sz(a)int__(a.size())
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a){return out << "(" << a.first << ", " << a.second << ")";}
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
const int mod = 1e9 + 7;
int Mod(int x){x%=mod;if(x<0)x+=mod;return x;}
int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
#define all(x) x.begin(), x.end()
#define db double

int__ main() {
	fast;

	int n; cin >> n;
	int ans = 0;
	for(int i=2;i*i <= n;i++) {
		int c=0;
		while(n%i==0) {
			c++; n /= i;
		}

		if(c == 0) continue;
		// cout << i << " " << c << endl;
		int t=0;
		while((t*(t+1))/2 < c) t++;

		if((t*(t+1))/2 == c) ans += t; else ans += (t-1);
	}

	if(n > 1) ans++;

	cout << ans << endl;
}

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

int main( void )
{
  int N;
  cin >> N;
  int A[ 2 ][ N ];
  int sum = 0;
  int count = 0;
  int max = -INT_MAX;

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

  for( int i = 0; i < N; i++ ) {
    for( int j = 0; j <= N; j++ ) {
      if( count <= i ) {
        //test
        //cout << "+" << A[0][j] << endl;
	sum += A[ 0 ][ j ];
	//test
	//cout << "A[ 0 ][ " << j << " ]" << endl;
      }
	else {
      //cout << "+" << A[1][ j - 1] << endl;
	  sum += A[ 1 ][ j - 1 ];
	  //test
	  //cout << "A[ 1 ][ " << j - 1<< " ]" << endl;
	}
      count++;
    }
    //cout << sum << endl;
      if( max < sum ) {
	max = sum;
      }
    sum = 0;
    count = 0;
  }

    cout << max << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main(){
    int N; cin >> N;
    vector<int> A(N);
    double sum = 0;
    for(int &a:A){
        cin >> a;
        sum += (double)1/a;
    }
    
    cout << fixed << setprecision(20) << (double)1/sum << endl;
    
    return 0;
}





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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int H, W;
    cin >> H >> W;

    vector<vector<int>> D(10, vector<int>(10)), A(H, vector<int>(W));
    rep(i, 10)rep(j, 10) cin >> D[i][j];
    rep(i, H)rep(j, W) cin >> A[i][j];

    rep(k, 10)rep(i, 10)rep(j, 10) chmin(D[i][j], D[i][k] + D[k][j]);

    int ans = 0;
    rep(i, H)rep(j, W) {
        if (A[i][j] != -1) ans += D[A[i][j]][1];
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483600

// Dinic O(E V^2)
template<typename T> // T is flow type (int or long or double), INF??????????????¨???
class MaximunFlow{
private:
  struct edge{int to; T cap; int rev;};
  vector<vector<edge> > Graph;
  vector<int> level, iter; //s??????????????¢,???????????§????????????
  void bfs(int s){
    fill(all(level), -1);
    queue<int> q;
    level[s]=0;
    q.push(s);
    while(!q.empty()){
      int v=q.front(); q.pop();
      for(auto e : Graph[v]){
        if(e.cap>0 && level[e.to]<0){
          level[e.to] = level[v]+1;
          q.push(e.to);
        }
      }
    }
  }
  T dfs(int v, int t, T f){
    if(v==t) return f;
    for(int &i=iter[v]; i<(int)Graph[v].size(); i++){
      auto &e = Graph[v][i];
      if(e.cap>0 && level[v]<level[e.to]){
        T d = dfs(e.to, t, min(f, e.cap));
        if(d>0){
          e.cap -= d;
          Graph[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
public:
  MaximunFlow(int n){
    Graph = vector<vector<edge> >(n, vector<edge>());
    level = vector<int>(n);
    iter = vector<int>(n);
  }
  T max_flow(int s, int t){
    T flow=0;
    while(true){
      bfs(s);
      if(level[t] < 0) break;
      fill(all(iter), 0);
      T f;
      while( (f=dfs(s,t,INF)) > 0){
        flow += f;
      }
    }
    return flow;
  }
  void add_edge(int from, int to, T cap){
    int tos = Graph[to].size(), froms = Graph[from].size();
    Graph[from].pb(((edge){to, cap, tos}));
    Graph[to].pb(((edge){from, 0, froms}));
  }
}; // END class MaximunFlow

int main(){
  int v,e;
  cin>>v>>e;
  MaximunFlow<int> mf(v);
  rep(i,e){
    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);
    mf.add_edge(a, b, c);
  }

  cout<<mf.max_flow(0, v-1)<<endl;

  return 0;
}

Measured memory_bytes: 3280
#include <bits/stdc++.h>
#define int long long
using namespace std;

void nil()
{
	int n;
	cin>>n;
	if(n>=30)
	
		cout<<"Yes"<<endl;
	
	else 
		cout<<"No"<<endl;
}
int32_t main()
{
	#ifndef ONLINE_JUDGE

		freopen("input1.txt","r",stdin);
		freopen("output1.txt","w",stdout);
	#endif	
		nil();
		/*int t;
		cin>>t;
		while(t--)
		{
			nil();
		}*/
		

}

Measured memory_bytes: 3616
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

#define UP 'U'
#define DOWN 'D'
#define LEFT 'L'
#define RIGHT 'R'

int main(void)
{
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	string ret("");

	const int dx = tx - sx;
	const int dy = ty - sy;

	ret += LEFT + string(dy+1, UP) + string(dx+1, RIGHT) + DOWN;
	ret += string(dx, LEFT) + string(dy, DOWN);
	ret += string(dx, RIGHT) + string(dy, UP);
	ret += RIGHT + string(dy+1, DOWN) + string(dx+1, LEFT) + UP;

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define ff first
#define ss second
#define S size()
#define mod (ll)(1e9+7)
#define mset(a,k) memset(a,k,sizeof(a));
#define fr(i, x, y) for ( ll i = x; i < y;i++)
#define dr(i, x, y) for ( ll i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define pqueue priority_queue<ll>
#define piqueue priority_queue<ll,vll ,greater<ll>>
#define mapcl map<char,ll>
#define mapll map<ll,ll>
#define mapsl map<string,ll>
#define vi vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define psi pair<string,ll>
#define pii pair<ll,ll>
#define piii pair<ll,pii>
#define vii vector<pii>
#define vvi vector<vi>
#define llu unsigned long long
using namespace std;
void fast() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}
//----------------------------------------FUNCTIONS-------------------------------------
ll gcd(ll x, ll y )						{if (y == 0) return x; return gcd(y, x % y);}
ll lcm(ll a, ll b)						{return (a * b) / gcd(a, b);}
ll logx(ll base, ll num)				{int cnt = 0; while (num != 1) {num /= base; ++cnt;} return cnt;}
vi vin(ll n)							{vi a(n); fr(i, 0, n) cin >> a[i]; return a;}
void in(ll *a, ll n)        			{for (ll i = 0; i < n; i++)cin >> a[i];}
void out(ll *a, ll n)					{fr(i, 0, n) {cout << a[i] << " ";} cout << '\n';}
void vout(vi v)							{fr(i, 0, (ll)v.S) {cout << v[i] << " ";} cout << endl;}
//----------------------------------------START-------------------------------------------
const ll maxN = (ll)(2 * 1e5 + 5 );
void solve()
{
	ll n;
	cin>>n;
	if(n>=30)cout<<"Yes\n";
	else cout<<"No\n";
}
int main()
{
	fast();
#ifndef ONLINE_JUDGE
	freopen ("inp1.txt", "r", stdin);
	freopen ("out1.txt", "w", stdout);
#endif
	ll t = 1;
	//cin >> t;
	//sieve();
	while (t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3492
# Author: cr4zjh0bp
# Created: Thu Mar 12 15:41:39 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

from itertools import permutations

s = ns()

for op in range(2 ** 3):
    res = int(s[0])
    for i in range(3):
        if op >> i & 1:
            res += int(s[i + 1])
        else:
            res -= int(s[i + 1])
    if res == 7:
        print(s[0], end="")
        for i in range(3):
            print('+' if op >> i & 1 else '-', end="")
            print(s[i + 1], end="")
        print("=7")
        break

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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


int facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}




int main() {
    ll n;
    cin>>n;
    vector<ll>a(n);
    ll SUM=0;
    for(ll i=0;i<n;i++){
        cin>>a.at(i);
        SUM+=a.at(i);
    }
    vector<ll>b(n);
    b.at(0)=a.at(0);
    for(ll i=1;i<n;i++){
        b.at(i)=b.at(i-1)+a.at(i);
    }
    ll MIN=SUM;
    ll index=0;
    for(ll i=0;i<n;i++){
        if(abs(b.at(i) - (SUM-b.at(i)))<MIN){
            MIN=abs(b.at(i) - (SUM-b.at(i)));
            index=i;
        }
    }
    cout<<abs(b.at(index) - (SUM-b.at(index)))<<endl;


    return 0;
}


Measured memory_bytes: 3328
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
#define ll long long
char mp[55][55];
int dir[8][2]={{-1,0},{1,0},{0,-1},{0,1},{-1,-1},{-1,1},{1,-1},{1,1}};
int main()
{
    int H,W;
    scanf("%d%d",&H,&W);
    for(int i=1;i<=H;i++)
    {
        scanf("%s",mp[i]);
    }
    for(int i=1;i<=H;i++)
    {
        for(int j=0;j<W;j++)
        {
            int cnt=0;
            if(mp[i][j]=='.')
            {
                for(int k=0;k<8;k++)
                {
                    int x=i+dir[k][0];
                    int y=j+dir[k][1];
                    if(x<1||x>H||y<0||y>=W)
                        continue;
                    if(mp[x][y]=='#')
                        cnt++;
                }
                mp[i][j]=cnt+'0';
            }
        }
    }
    for(int i=1;i<=H;i++)
    {
        for(int j=0;j<W;j++)
        {
            printf("%c",mp[i][j]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 256