akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 998244353;
auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };

int main()
{
ll n , s ;
cin >> n >> s ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
vector<vector<ll>> dp(n+1, vector<ll>(s+1,0) );
dp[0][0]=1;
rep(i,n)rep(j,s+1){
  dp[i+1][j]+=mod(dp[i][j]*2);
  if(j+a[i]<=s)dp[i+1][j+a[i]]+=mod(dp[i][j]);
}

cout << mod(dp[n][s]) << endl;
return 0;
}

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

int main(void){
    string A, B;
    cin >> A >> B;
    
    if (A.length() > B.length()) cout << "GREATER"<< endl;
    else if (A.length() < B.length()) cout << "LESS"<< endl;
    else if (A == B)cout << "EQUAL"<< endl;
    else if (A < B) cout << "LESS"<< endl;
    else cout << "GREATER"<< endl;
    return 0;

}


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

int main() {
  int N;
  cin >> N;
  int sum =0;
  for(int i = 1; i <= N; ++i){
    sum += i;
  }
  
  cout << sum << endl;
  return 0;
}



Measured memory_bytes: 3560
s=input()
a,b=0,0
for i in range(len(s)):
    if i%2==0 and s[i]=="1":
        a+=1
    elif i%2==1 and s[i]=="0":
        a+=1
for i in range(len(s)):
    if i%2==0 and s[i]=="0":
        b+=1
    elif i%2==1 and s[i]=="1":
        b+=1
print(min(a,b))

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

int main() {

    int n;

    cin >> n;

    vector<int> members(n, 0);

    for(int i = 1; i < n; ++i) {
        int top;
        cin >> top;
        members[top - 1]++;
    }

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

    return 0;

}

Measured memory_bytes: 4036
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		double x = stdIn.nextDouble();
        stdIn.close();
        System.out.printf("%.6f %.6f%n", x*x*Math.PI,2*x*Math.PI);
	}
}



Measured memory_bytes: 28492
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	cout<<n*(n+1)/2<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	A
# CreatedDate:  2020-06-14 21:00:14 +0900
# LastModified: 2020-06-14 21:01:59 +0900
#


import os
import sys
#import numpy as np
#import pandas as pd


def main():
    x = list(map(int,input().split()))
    print(x.index(0)+1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define int long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;



main(){
#ifdef LOCAL
	freopen("J_input.txt", "r", stdin);
	//freopen("J_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, a, b;
	cin >> n >> a >> b;
	if ((b-a) % 2 == 0) {
		cout << (b-a)/2;
	}
	else{
		int k = min(a-1, n - b);
		k += (b-a+1)/2;
		cout << k;
	}

}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1 << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
int dfs(vector< vector< int > > &G, int x, int p) {
	int c = K - 2 + (p == -1 ? 1 : 0);
	if (p != -1 && c < G[x].size() - 1)
		return 0;
	if (p == -1 && c < G[x].size())
		return 0;
	int ret = 1;
	rep(i, G[x].size()) {
		int j = G[x][i];
		if (j == p)
			continue;
		(ret *= dfs(G, j, x) * (c--) % MOD) %= MOD;
	}
	return ret;
}
signed main() {
	cin >> N >> K;
	vector< vector< int > > G(N);
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	int ans = K * dfs(G, 0, -1) % MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11520
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        int n = sc.nextInt(), k = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);

        long ans = 0;
        Combination comb = new Combination(n, MOD);

        for (int i = 0; i < n; i++) {
            ans = (ans + 1L * (MOD + a[n - i - 1]) % MOD * comb.nck(n - i - 1, k - 1) % MOD) % MOD;
            ans = (ans - 1L * (MOD + a[i]) % MOD * comb.nck(n - i - 1, k - 1) % MOD + MOD) % MOD;
        }

        out.println(ans);

        out.flush();
    }

    public class Combination {
        int n;
        long mod;
        long[] facts;

        public Combination(int n, long mod) {
            this.n = n;
            this.mod = mod;
            facts = new long[n];
            facts[0] = 1;
            for (int i = 1; i < n; i++) {
                facts[i] = facts[i - 1] * i % mod;
            }
        }

        long modpow(long a, long b) {
            if (b == 0) return 1;
            else if (b == 1) return a;

            long x = modpow(a, b / 2);
            return b % 2 == 0 ? x * x % mod : x * (x * a % mod) % mod;
        }

        long inv(long n) {
            return modpow(n, mod - 2);
        }

        public long nck(int n, int k) {
            return n < k ? 0 : facts[n] * (inv(facts[n - k]) * inv(facts[k]) % mod) % mod;
        }
    }


    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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

Measured memory_bytes: 50592
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;


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

	int t = 0;
	for (int i = a; i <= b; i++)
	{
		if (i / 10000 == i % 10 && (i / 1000) % 10 == (i / 10) % 10)
			t++;
	}
	cout << t << endl;

}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np

def main():
	x=int(input())
	
	s=set()
	
	for i in range(1,40):
		for j in range(2,10):
			a=i**j
			if a<=1000:
				s.add(a)
	
	li=list(s)
	li.sort()
	
	for i in range(x,0,-1):
		if i in li:
			print(i)
			exit(0)
			
	
	
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define mod 1000000007ll
#define mod1 998244353ll
#define endl '\n'
#define inf ((ll)1e18+1)
#include<chrono>
using namespace chrono;
mt19937_64 rng(high_resolution_clock::now().time_since_epoch().count());
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define debr(x,y) {cout<<"-->  "<<#x<<" to "<<#y<<" :  "; auto itr=x; while(itr!=y) cout<<(*itr++)<<' '; cout<<endl; }
#define deba(x) {cout<<"-->  "<<#x<<" :  "; for(auto ele:(x)) cout<<ele<<"  "; cout<<endl; }
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s);istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a <<"  ,  ";
    err(++it, args...);
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll> ar(n);
        for(ll x=0;x<n;x++){
            cin>>ar[x];
        }
        ll ans=0;
        for(int x=0;x<n;x++){
            for(int y=x+1;y<n;y++){
                for(int z=y+1;z<n;z++){
                    if(ar[x]==ar[y] || ar[x]==ar[z] || ar[y]==ar[z])continue;
                    vector<ll> temp={ar[x],ar[y],ar[z]};
                    sort(temp.begin(),temp.end());
                    if(temp[0]+temp[1]>temp[2]){
                        ans++;
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;

}


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3
#define mod 1000000007

ll mod_pow(ll a,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

int sz[5001];
int n;
vector<int> g[5001];
ll dp[2][5001];
vector<int> cs;
ll fac[5001],finv[5001];
vector<int> a;

ll comb(ll a,ll b){
  if(a<0||b<0||a<b)return 0;
  else return  (fac[a]*finv[b]%mod)*finv[a-b]%mod;
}

void dfs(int v,int pre){
  sz[v]=1;
  bool is_cent=true;
  for(int nv : g[v]){
    if(nv==pre)continue;
    dfs(nv,v);
    if(sz[nv]>n/2)is_cent=false;
    sz[v]+=sz[nv];
  }
  if(n-sz[v]>n/2)is_cent=false;
  if(is_cent)cs.push_back(v);
}

int main(){
  fac[0]=1;
  rep(i,5000)fac[i+1]=fac[i]*(i+1)%mod;
  rep(i,5001)finv[i]=mod_pow(fac[i],mod-2);

  cin>>n;
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);    
  }
  dfs(0,-1);
  if(cs.size()==2){
    cout<<fac[n/2]*fac[n/2]%mod<<endl;
    return 0;
  }else{
    int r=cs[0];
    for(int v : g[r]){
      if(sz[v]>sz[r])continue;
      a.push_back(sz[v]);
    }
    if(n-sz[r]>0)a.push_back(n-sz[r]);
    int crt=0,nxt=1;
    dp[crt][0]=1;
    rep(i,a.size()){
      memset(dp[nxt],0,sizeof(dp[nxt]));
      rep(j,n){
        rep(k,a[i]+1){
          if(j+k>n-1)continue;
          ll c2=comb(a[i],k)*comb(a[i],k)%mod;
          (dp[nxt][j+k]+=(dp[crt][j]*c2%mod)*fac[k]%mod)%=mod;
        }
      }
      swap(crt,nxt);
    }
    ll res=0;
    rep(x,n){
      ll sgn=(x%2==0?+1:-1);
      (res+=(sgn*((dp[crt][x]*fac[n-x])%mod)+mod)%mod)%=mod;
    }
    cout<<res<<endl;
  }
  return 0;
}


Measured memory_bytes: 896
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f;
	int ans = a + b * 5 + c * 10 + d * 50 + e * 100 + f * 500;
	cout << (ans >= 1000) << endl;
	return 0;
}

Measured memory_bytes: 3080
import * as fs from 'fs';

namespace AtCoder.abc134 {
    class ProgramB {
        args: string[];

        // 6 2
        // 2
        constructor(args: string[]) {
            this.args = args;
        }

        main() {
            const [n, d]: number[] = this.args[0].split(' ').map(x => parseInt(x, 10));

            const ans: number = (n % (d * 2 + 1) > 0) ? Math.floor(n / (d * 2 + 1) + 1) : n / (d * 2 + 1);
            console.log(ans);

        }
    }

    const args: string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n');
    new ProgramB(args).main();
}

Measured memory_bytes: 7500
/**
     *      ABC 109 C
     *      author  : kyomukyomupurin
     *      created : 2018-09-08 21:10:40
    **/
     
    #include <bits/stdc++.h>
    using namespace std;
     
    int gcd(int x, int y){
    	if (x % y ==0){
    		return y;
        }
    	else {
    		return gcd(y ,x % y);
        }
    }
     
     
    int main(){
        ios::sync_with_stdio(false);
        cin.tie(0);
        
        int N, X; cin >> N >> X;
        int x[N] = {};
        for (int i = 0; i < N; ++i) {
            cin >> x[i];
        }
     
        int diff[N] = {};
        for (int i = 0; i < N; ++i) {
            diff[i] = abs(x[i] - X);
        }
     
        int answer = diff[0];
        for (int i = 1; i < N; ++i) {
            answer = gcd(answer, diff[i]);
        }
     
        cout << answer << endl;
     
        return 0;
    }

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

n = int(input())
a = list(map(int,input().split()))

X = sum(a)

minsum = 10000000000

cnt = 0

for i in range(1,n):
    cnt += a[i-1]
    minsum = min(minsum,abs(X-2*cnt))

print(minsum)


Measured memory_bytes: 24820
from bisect import bisect_right
#from collections import deque
from itertools import accumulate

def main():
    N, M, K = tuple(int(c) for c in input().split())
    A = [0]
    A.extend(int(c) for c in input().split())
    B = [0]
    B.extend(int(c) for c in input().split())
    SA = list(accumulate(A))
    SB = list(accumulate(B))

    ans = 0
    for i in range(N+1):
        part_a = SA[i]
        if part_a > K:
            break
        max_part_b = K - part_a
        idx = bisect_right(SB, max_part_b)
        #print(i, SA[i], idx, SB[idx-1], SA[i]+SB[idx-1])
        ans = max(ans, i+idx-1)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 48964
n = int(input())
a = list(map(int, input().split()))
x = []
s = 0
for i in range(1, n, 2):
    s += a[i]
x.append(sum(a) - 2*s)
for i in range(n):
    x.append(2*a[i]-x[i])
x.pop(-1)
for i in range(n):
    print(x[i], end=' ')
print()

Measured memory_bytes: 65636
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    if(d == 25)
        cout << "Christmas" << endl;
    else if(d == 24)
        cout << "Christmas Eve" << endl;
    else if(d == 23)
        cout << "Christmas Eve Eve" << endl;
    else
        cout << "Christmas Eve Eve Eve" << endl;
}


Measured memory_bytes: 764
def main():
    S = {i:s for i, s in enumerate(input()[::-1])}
    MOD = 10**9 + 7

    DP_table = [[0 for i in range(13)] for j in range(len(S))]
    
    digit = S[0]
    if digit == '?':
        for i in range(10):
            DP_table[0][i] = 1
    else:
        DP_table[0][int(digit)] = 1
    
    multiplier = 1
    for i in range(1, len(S)):
        digit = S[i]
        multiplier = multiplier * 10 % 13
        if digit == '?':
            for j in range(10):
                for k in range(13):
                    DP_table[i][(j * multiplier + k) % 13] += DP_table[i-1][k]
        else:
            digit = int(digit)
            for k in range(13):
                DP_table[i][(digit * multiplier + k) % 13] += DP_table[i-1][k]
        
        for j in range(13):
            DP_table[i][j] %= MOD

    print(DP_table[len(S)-1][5])

    
if __name__ == "__main__":
    main()


Measured memory_bytes: 79592
#include<iostream>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
using namespace std;
int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
long long READ(){
    long long xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
char one(){
	char ch=getchar();
	while(ch==' '||ch=='\n')
		ch=getchar();
	return ch;
}
const int maxn=100010;
int N,edge[maxn];
map<pair<int,int>,bool>mp;
struct my{
	int v,id;
	bool friend operator<(const my&A,const my&B){
		if(A.v!=B.v)return A.v<B.v;
		return A.id<B.id;
	}
}a[maxn],b[maxn];
bool vis[maxn];
int dfs(int x){
	vis[x]=1;
	int ret=1;
	if(!vis[edge[x]])
		ret+=dfs(edge[x]);
	return ret;
}
int main(){
	//freopen("in","r",stdin);
	N=read();
	for(int i=1;i<=N;i++)
		a[i].v=read(),a[i].id=i;
	for(int i=1;i<=N;i++)
		b[i].v=read(),b[i].id=i;
	for(int i=1;i<=N;i++)
		mp[make_pair(a[i].v,b[i].v)]=1;
	sort(a+1,a+1+N);
	sort(b+1,b+1+N);
	for(int i=1;i<=N;i++)
		if(a[i].v>b[i].v)
			return printf("No\n"),0;
	for(int i=1;i<=N;i++)
		if(mp[make_pair(a[i].v,b[i].v)])
			return printf("Yes\n"),0;
	for(int i=1;i<N;i++)
		if(a[i+1].v<=b[i].v)
			return printf("Yes\n"),0;
		
	for(int i=1;i<=N;i++)
		edge[a[i].id]=b[i].id;
	if(dfs(1)<N)
		puts("Yes");
	else
		puts("No");
	return 0;
}


Measured memory_bytes: 11648
#include <iostream>
#include <string>
#include <stack>
#include <vector>
using namespace std;
int main(){
    string str;
    cin >> str;

    //出力記憶用
    int sum=0;
    stack<int> output;

    stack<int> slopes; //坂の開始位置を格納する
    stack<pair<int,int> > lakes; //水たまりを格納する first:位置,second:面積

    for(int i=0;i<str.length();++i){
        if(str[i]=='\\'){
            slopes.push(i);
        }else if(str[i]=='/' && !slopes.empty()){
            int s=slopes.top();slopes.pop();
            lakes.push(pair<int,int>(s,i-s));
            sum+=i-s;
        }
    }

    //包含関係にある水たまりのうち，小さい方の方が後から出てくることを利用
    vector<bool> islake(str.length(),false); //湖かどうか記憶しておく
    while(!lakes.empty()){
        if(islake[lakes.top().first]){
            //すでに水面下であった場合
            output.top()+=lakes.top().second;
        }else{
            for(int i=lakes.top().first;i<lakes.top().first+lakes.top().second;++i){
                islake[i]=true;
            }
            output.push(lakes.top().second);
        }
        lakes.pop();
    }

    //出力するだけ
    cout << sum << endl;
    cout << output.size();
    while(!output.empty()){
        cout << ' ' << output.top();
        output.pop();
    }
    cout << endl;
}


Measured memory_bytes: 3272
#include <iostream>

using namespace std;
int main(){
	int n=0;
	int a[1001]={};
	
	int v=0;
	int j=0;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	
	for(int i=0;i<n;i++){
		v=a[i];
		j=i-1;
		while(j>=0 && a[j]>v ){
			a[j+1]=a[j];
			j--;
			a[j+1]=v;
		}
		
		for(int k=0;k<n;k++){
			cout << a[k];
			if(k!=n-1){
				cout <<" ";
			}else{
				cout <<endl;
			}
		}
	}
	return 0;
}

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

int main(){
  string S;
  cin>>S;

  bool flag=true;
  for(int i=0;i<S.size();i++){
    if(i%2==0){
      if(S.at(i)=='L'){
        flag=false;
        break;
      }
    }else{
      if(S.at(i)=='R'){
        flag=false;
        break;
      }
    }
  }

  if(flag){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#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);
  int A,B,C;
  cin >> A>> B>> C;
  if(A+B>=C) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
    

}


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 998244353

ll mod_pow(ll a,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll N,A,B,K;
ll fac[300010],finv[300010];

ll comb(ll n,ll r){
  if(n<0||r<0||n<r)return 0;
  else return ((fac[n]*finv[n-r])%mod)*finv[r]%mod;
}

int main(){
  fac[0]=1;
  rep(i,300001)fac[i+1]=fac[i]*(i+1)%mod;
  rep(i,300001)finv[i]=mod_pow(fac[i],mod-2);

  cin>>N>>A>>B>>K;
  ll res=0;
  rep(X,N+1){
    if(K-A*X<0||(K-A*X)%B!=0)continue;
    ll Y=(K-A*X)/B;
    (res+=comb(N,X)*comb(N,Y)%mod)%=mod;
  }
  cout<<res<<endl;
  return 0;
}


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

int main() {
  int n;
  while (cin >> n, n) {
    auto c = vector<int>(n);
    for (int i = 0; i < n; ++i) {
      string w; cin >> w;
      c[i] = w.length();
    }
    auto s = vector<int>(n + 1, 0);
    auto phrase = vector<int>{5, 7, 5, 7, 7};
    for (int i = 0; i < n; ++i) s[i + 1] = s[i] + c[i];

    auto solve = [&]() {
      for (int i = 0; i < n; ++i) {
        int cur = i, nxt = n + 1;
        for (int j = 0; j < 5; ++j, cur = nxt) {
          nxt = distance(begin(s), find(begin(s), end(s), s[cur] + phrase[j]));
          if (nxt == n + 1) break;
          if (j == 4) return i + 1;
        }
      }
      return 0;
    };
    cout << solve() << endl;
  }
  return 0;
}



Measured memory_bytes: 3148
#[allow(unused_imports)]
use std::cmp::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn calc_digit_sum(mut a: usize) -> usize {
    let mut ans = 0;
    while a > 0 {
        ans += a % 10;
        a /= 10;
    }
    ans
}

fn main() {
    let n: usize = read();
    let mut ans = std::usize::MAX;
    for i in 1..n {
        ans = min(ans, calc_digit_sum(i) + calc_digit_sum(n - i));
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		final char[] checkall = { 'N', 'N', 'N', 'N', 'W', 'W', 'W' };

		Scanner stdIn = new Scanner(System.in);

		Dice dice1 = createDice(stdIn);
		Dice dice2 = createDice(stdIn);

		alignment(dice1, dice2, checkall);


		if (0 <= dice1.getLine().indexOf(dice2.getLine().substring(0, (dice2.getLine().length() / 2)))) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		stdIn.close();
	}

	private static Dice createDice(Scanner stdIn) {
		int[] sary = new int[6];
		for (int i = 0; i < sary.length; i++) {
			sary[i] = stdIn.nextInt();
		}
		stdIn.nextLine();
		Dice d = new Dice(sary[0], sary[1], sary[2], sary[3], sary[4], sary[5]);
		return d;
	}

	private static void alignment(Dice dice1, Dice dice2, char[] checkall) {
		for (int i = 0; i < checkall.length; i++) {
			dice2.roll(checkall[i]);
			if (dice1.getTop() == dice2.getTop() && dice1.getBottom() == dice2.getBottom()) {
				break;
			}
		}
	}
}

class Dice {
	private int top;
	private int front;
	private int right;
	private int left;
	private int back;
	private int bottom;

	int temp;

	public Dice(int top, int front, int right, int left, int back, int bottom) {
		super();
		this.top = top;
		this.front = front;
		this.right = right;
		this.left = left;
		this.back = back;
		this.bottom = bottom;
	}

	public void rollPattern(String rollpattern) {
		for (int i = 0; i < rollpattern.length(); i++) {
			roll(rollpattern.charAt(i));
			System.out.println(rollpattern.charAt(i) + " " + " " + getTop());
		}
	}

	public void roll(char x) {
		switch (x) {
		case 'N':
			rollNorth();
			break;
		case 'S':
			rollSorth();
			break;
		case 'W':
			rollWest();
			break;
		case 'E':
			rollEast();
			break;
		default:
			System.exit(1);
			break;
		}
	}

	private void rollNorth() {
		temp = top;
		top = front;
		front = bottom;
		bottom = back;
		back = temp;
	}

	private void rollSorth() {
		temp = top;
		top = back;
		back = bottom;
		bottom = front;
		front = temp;
	}

	private void rollWest() {
		temp = top;
		top = right;
		right = bottom;
		bottom = left;
		left = temp;
	}

	private void rollEast() {
		temp = top;
		top = left;
		left = bottom;
		bottom = right;
		right = temp;
	}

	public int getTop() {
		return top;
	}

	public int getBottom() {
		return bottom;
	}

	public StringBuilder getLine() {
		int[] ary = { front, right, back, left, front, right, back, left };
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < ary.length; i++) {
			sb.append(ary[i]);
		}
		return sb;
	}
}

Measured memory_bytes: 26296
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

#define MAX_N 700

int n, m;
bool g[MAX_N][MAX_N];
int color[MAX_N];
int cnt[2];

void dfs(int cur) {
    for (int to = 0; to < n; to++) {
        if (to == cur) continue;
        if (g[cur][to]) continue;
        if (color[to] == !color[cur]) continue;
        if (color[to] == color[cur]) {
            cout << -1 << endl;
            exit(0);
        }
        color[to] = !color[cur];
        cnt[color[to]]++;
        dfs(to);
    }
}

signed main() {
    cin >> n >> m;
    int a, b;
    rep(i, m) {
        cin >> a >> b;
        a--;
        b--;
        g[a][b] = true;
        g[b][a] = true;
    }
    vector<int> s, t;
    fill(color, color + n, -1);
    rep(v, n) {
        if (color[v] == -1) {
            color[v] = 0;
            cnt[0] = 1;
            cnt[1] = 0;
            dfs(v);
            s.emplace_back(cnt[0]);
            t.emplace_back(cnt[1]);
        }
    }
    int m = s.size();
    bool dp[m + 1][n + 1];
    fill(dp[0], dp[m + 1], false);
    dp[0][0] = true;
    rep(i, m) {
        for (int j = 0; j <= n; j++) {
            if (j - s[i] >= 0) dp[i + 1][j] |= dp[i][j - s[i]];
            if (j - t[i] >= 0) dp[i + 1][j] |= dp[i][j - t[i]];
        }
    }
    int ans = INF;
    for (int i = 0; i <= n; i++) {
        if (dp[m][i])
            ans = min(ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4432
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	string S;
  	cin >> S;
  	int count = 0;
  	bool flg = true;
  	int max_s = 0;
  	for(int i = 0; i < S.size(); i++){
    	if(S[i] == 'A' || S[i] == 'G' || S[i] == 'T' || S[i] == 'C'){
        	if(flg == true || count == 0){
            	count++;
              	flg = true;
            } else {
            	flg = true;
            }
      	} else {
       		flg = false;
          	if(max_s < count) max_s = count;
          	count = 0;
      	}
    }
  	if(max_s < count) max_s = count;
  	cout << max_s << endl;
}

Measured memory_bytes: 384
k, n = input().split()
a_list_org = list(map(int,input().split()))
a_list = []
for a in a_list_org:
    if a == a_list_org[0]:
        pre = a
        a_list.append(int(k) - a_list_org[-1] + a)
    else:
        a_list.append(a - pre)
        pre = a
a_list.remove(max(a_list))
print(sum(a_list))

Measured memory_bytes: 26444
n, m = map(int, input().split())
conn = [[False]*n for _ in range(n)]
visited = [False] * n
v = []
for _ in range(m):
    i, j = map(int, input().split())
    v.append([i-1, j-1])

for s, e in v:
    conn[s][e] = conn[e][s] = True
def search(now, depth):
    if visited[now] is True:
        return 0
    if depth == n-1:
        return 1
    visited[now] = True
    ret = 0
    for i in range(n):
        if conn[now][i] is True:
            ret += search(i, depth+1)
    visited[now] = False
    return ret

print(search(0, 0))

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

string s;
bool a, b;

int main() {
	cin >> s;
	rep(i,s.length()) {
		if (s[i]=='C') a = true;
		if (a && s[i]=='F') b = true;
	}
	if (b) cout << "Yes" << ln;
	else cout << "No" << ln;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, K;
    cin >> N >> K;
    ll res = 0;
    for(ll b=K+1;b<=N;b++){
    	res += (N/b)*(b-K);
    	if(K != 0)res += max(0ll, (N%b)+1-K);
    	else res += (N%b);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi atan(1.0)*4
#define pb(x) push_back(x)
#define in(x) insert(x)
#define fl(x,y) for(ll i=x;i<y;i++)
#define vi vector<long long>
#define vs  vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
string en="\n";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define fi first
#define se second
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
/*bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
LL bpow(LL a,LL b){if(b==0)return 1;LL r=bpow(a,b/2);if(b%2)return r*r*a;else return r*r;}
LL binpow(LL a,LL b){LL r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
LL binpow(LL a,LL b,LL m){a%=m;LL r=1;while(b>0){if(b&1) r=r*a%m;a=a*a%m; b>>=1;}return r;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
*/
//bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int main()
{
    ll a,b,c,d,t,n,k,p,q,r,y,yy,sum,ct=0,flag=0;
    string s,s1,s2,s3;
    char ch;
    map<ll,ll>mp;
    deque<char>d1,d2,d3;
    vector<ll>v,vv,vz;

        cin>>n>>k;
        t=k;
        for(ll i=0;i<n-1;i++)
        {
            t*=(k-1);
        }

     cout<<t<<endl;

}







Measured memory_bytes: 3576
N = int(input())
L = list(map(int, input().split()))

import itertools
l = list(itertools.combinations(range(1, N + 1), 3))
ans = 0
for c in l:
    a, b, c = sorted([L[c[0]-1], L[c[1]-1], L[c[2]-1]], reverse = True)
    if (a < b + c) and not (a == b or b == c or c == a):
        ans += 1
print(ans)

Measured memory_bytes: 20612
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    int a, b;
    cin >> a >> b;
    if(a==1) a=14;
    if(b==1) b=14;
    if (a>b) cout << "Alice" << endl;
    else if(a<b) cout << "Bob" << endl;
    else cout << "Draw" << endl;
    
    //cout << ans << endl;
}

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

using namespace std;

const int max_lim = 50001;
bool prime[max_lim];
vector<int> look;

void init(){
	for(int i = 0 ; i < max_lim; i++){
		prime[i] = true;
	}
	prime[0] = prime[1] = true;
	for (int i = 2; i * i < max_lim; i++ ){
		for(int j= 2 * i; j < max_lim ; j += i){
			prime[j] = false;
		}
	}
	for(int i = 2; i < max_lim; i++)
		if(prime[i])
			look.push_back(i);
}

int main(){
	int n;
	init();
	while(cin>>n, n){
		int ans = 0;
		for(int i= 0 ; 2* look[i] <= n; i++){
			if(n - look[i] > 0 && prime[n - look[i]])
				ans++;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1320
def d_lunlun_number_dfs():
    K = int(input())

    def dfs(value, digit, digit_max=10):
        ans.append(value)

        if digit == digit_max:
            return  # 10 桁程度調べれば 10**5 個を超える Lunlun Number が得られる

        # 次の数字をつける
        for j in (-1, 0, 1):
            lsd = (value % 10) + j
            if 0 <= lsd <= 9:
                dfs(10 * value + lsd, digit + 1)

    ans = []
    for leading in range(1, 10):
        dfs(leading, 1)
    return sorted(ans)[K - 1]

print(d_lunlun_number_dfs())

Measured memory_bytes: 13840
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		vector<pair<int, int>>vs;
		while (N--) {
			int id; cin >> id;
			int sum = 0;
			for (int i = 0; i < 4; ++i) {
				int m, s; cin >> m >> s;
				sum += m * 60 + s;
			}
			vs.push_back(make_pair(sum, id));
			
		}
		sort(vs.begin(), vs.end());
		cout << vs[0].second << endl;
		cout << vs[1].second << endl;
		cout << vs[vs.size() - 2].second << endl;
	}
	return 0;
}

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

typedef struct{
    double x, y;
} point;

int main(int argc, const char * argv[])
{
    point p[4];
    double s[4];
    int i;
    while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &p[0].x, &p[0].y, &p[1].x, &p[1].y, &p[2].x, &p[2].y, &p[3].x, &p[3].y) != EOF) {
        double total = 0;
        for (i = 0; i < 3; i++) {
            point a = {(p[i % 3].x - p[3].x), (p[i % 3].y - p[3].y)};
            point b = {((p[(i + 1) % 3]).x - p[3].x), ((p[(i + 1) % 3]).y - p[3].y)};
            s[i] = fabs(a.x * b.y - a.y * b.x);
            total += s[i];
        }
        point fa = {(p[0].x - p[2].x), (p[0].y - p[2].y)};
        point fb = {(p[1].x - p[2].x), ((p[1]).y - p[2].y)};
        s[3] = fabs(fa.x * fb.y - fa.y * fb.x);
        if (total == s[3]) puts("YES");
        else puts("NO");
    }
    return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <string>

#define M 1000000007

using namespace std;

int main(){
    int N;
    long ans = 1;
    int index;
    bool bSame;
    string S1, S2;
    cin >> N;
    cin >> S1;
    cin >> S2;
    if(S1[0] == S2[0]){
        ans = 3;
        index = 1;
        bSame = true;
    }else{
        ans = 6;
        index = 2;
        bSame = false;
    }
    while(index < N){
        if(S1[index] == S2[index]){
            if(bSame == true){
                ans *= 2;
                ans = ans%M;
            }else{
                ans *= 1;
                ans = ans%M;
            }
            bSame = true;
            index += 1;
        }else{
            if(bSame == true){
                ans *= 2;
                ans = ans%M;
            }else{
                ans *= 3;
                ans = ans%M;
            }
            bSame = false;
            index += 2;
        }
        //cout << ans << ' ';
    }
    cout << ans << endl;
}

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

const long long int MOD=1e9+7;

int main(){
  long long n, ans=1, a[1009];
  cin >> n;
  memset(a, 0, sizeof(a));
  for(int i=2;i<=n;i++){
    long long tmp=i;
    for(int j=2;j<=n;j++){
      long long cnt=0;
      while(tmp%j==0){
        cnt++;
        tmp/=j;
      }
      a[j] = (a[j]+cnt)%MOD;
      if(tmp==1)break;
    }
  }
  for(int i=2;i<=n;i++){
    ans = (ans*(a[i]+1))%MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
a = [int(input()) for i in range(5)]
max = 0
kazu = 0
ans = 0
for i in range(5):
    if a[i]%10 == 0: amari = 0
    else: amari = 10-(a[i]%10)
    if amari >= max:
        max = amari
        kazu = i
for i in range(5):
    if i == kazu: pass
    else:
        if a[i]%10 == 0:
            ans+=a[i]
        else:
            ans+=((int(a[i]/10))*10 +10)
print(ans+a[kazu])



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> N >> K >> Q;
    vi a(N);
    REP(_, Q) {
        cin >> A;
        A--;
        a[A]++;
    }
    dump(a);
    REP(i, N) {
        if (a[i] + K - Q > 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 3768
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007

long int combination(long int n, long int r);

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}

long int combination(long int n, long int r)
{
	if(r>n-r) r = n-r;
	if(r == 0) return 1;
	else if(r == 1) return n;
	return (combination(n-1, r) + combination(n-1, r-1));
	//大きくなるとき
	/*
	long int tmp1, tmp2, tmp3;
	tmp1 = combination(n-1, r);
	if(tmp1>=MOD) tmp1 = tmp1%MOD;
	tmp2 = combination(n-1, r-1);
	if(tmp2>=MOD) tmp2 = tmp2%MOD;
	tmp3 = tmp1+tmp2;
	if(tmp3>=MOD) tmp3 = tmp3%MOD;
	return (tmp3);
	*/
}


int main(){
	long int n, a, b;
	scanf("%ld%ld%ld", &n, &a, &b);
	if(a>b) printf("0\n");
	else{
		long int pre = (2-n)*a + (n-2)*b + 1;
		if(n==1){
			if(a!=b) printf("0\n");
			else printf("1\n");
		}
		else{
			printf("%ld\n", pre);
		}
	}
		
	return 0;
}

Measured memory_bytes: 128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <numeric> // next_parmutation
#define ll long long
#define rep(i, n) for(int i = 0; i < (n); i++)

using namespace std;

int main() {
    int n;
    cin >> n;
    int N=n;
    if(N >= 100) N %= 100;
    if(N >= 10) N %= 10;
    if(N == 2|| N == 4||N == 5||N == 7||N == 9) cout <<"hon" << endl;
    else if(N==0||N==1||N==6||N==8) cout << "pon" << endl;
    else cout << "bon" << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n,k;cin >> n >> k;
  int res=0;
  rep(i,n){
    int h;cin >> h;
    if(h>=k) res++;
  }
  cout << res << "\n";
  return 0;
}


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

using namespace std;
using LL = long long;

int main(){
	LL N, A, B;
	cin >> N >> A >> B;
	cout << N/(A+B)*A+min(A,N%(A+B)) << endl;

	return 0;
}

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

int main(){
    int a ;
    cin >> a ;
    if (a==000){
        cout << 0 << endl;
    }
    else if(a%3==0){
        cout << 3 << endl;
    }
    if (a%3==1){
        cout << 1 << endl;
    }
    if (a%3==2){
        cout << 2 << endl;
    }
}

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

int ans[365],c[26],s[365][26],last[26],csum,nowscore,newscore,temperature=3;
const int INF=1e9,d=365;

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

void FIN(bool a){
  if(a){
    ofstream fout("output.txt");
    REP(i,d)fout<<ans[i]+1<<"\n";
    fout.close();
    return;
  }
  REP(i,d)cout<<ans[i]+1<<"\n";
  return;
}
/*
int score(){
  int res=0;
  memset(last,-1,sizeof(last));
  REP(day,d){
    res+=s[day][ans[day]];
    last[ans[day]]=day;
    REP(i,26)res-=c[i]*(day-last[i]);
  }
  return res;
}
*/
int score(){//上のがO(26*365)、こっちがO(365)のスコア計算
  int res=0,minus=csum;
  memset(last,-1,sizeof(last));
  REP(day,d){
    res+=s[day][ans[day]];
    minus-=c[ans[day]]*(day-last[ans[day]]);
    last[ans[day]]=day;
    res-=minus;
    minus+=csum;
  }
  return res;
}
void swap(){
  int RAND=rand();
  int day=RAND%(d-8),diff=((RAND^newscore)&7)+1,p=(RAND|newscore)%temperature;
  swap(ans[day],ans[day+diff]);
  newscore=score();
  if(newscore<nowscore&&p)swap(ans[day],ans[day+diff]);
  else nowscore=newscore;
}
void onechange(){
  int RAND=rand();
  int day=RAND%365,p=(RAND^newscore)%temperature;
  REP(i,26){
    int tmp=ans[day];
    ans[day]=i;
    newscore=score();
    if(newscore<nowscore&&p)ans[day]=tmp;
    else nowscore=newscore;
  }
}

int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  clock_t start=clock();
  memset(last,-1,sizeof(last));
  cin>>c[0];
  REP(i,26){cin>>c[i];csum+=c[i];}
  REP(i,d)REP(j,26)cin>>s[i][j];
  REP(day,d){
    int idx,mx=-INF;
    REP(i,26){
      int A=c[i]*(day-last[i])+s[day][i];
      if(mx<A)mx=A,idx=i;
    }
    ans[day]=idx,last[idx]=day;
  }
  nowscore=score();
  while(true){
    clock_t nowt=clock();
    const double time=static_cast<double>(nowt-start)/CLOCKS_PER_SEC;
    if(time>1.97)break;
    REP(__,100)swap();
    REP(__,100)onechange();
    if((int)(time*100)&7==7)temperature++;
  }
  FIN(0);
}


Measured memory_bytes: 3680