akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int N, K, C;
	cin >> N >> K >> C;
	string S;
	cin >> S;

	int kari = K;
	for (int i = N - 1; i >= 0; i--) {
		if (S[i] == 'o') {
			A[i] = kari--;
			i -= C;
		}
	}
	kari = 1;
	rep(i, N) {
		if (S[i] == 'o') {
			if (A[i] == kari++) co(i + 1);
			i += C;
		}
	}

	Would you please return 0;
}

Measured memory_bytes: 2580
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#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 Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

vector<ll> ret;

vector<ll> enum_div(ll n){
    for(ll i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            if(i != 1 && i*i != n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

bool isPrime(ll x){
    ll i;
    if(x < 2)return false;
    else if(x == 2) return true;
    if(x%2 == 0) return false;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return false;
    return true;
}

int main(){
    ll n;
    cin >> n;
    if(n == 1) {
        cout << 0 << endl;
        return 0;
    }
    enum_div(n);
    ret.push_back(n);
    Sort(ret);
    ll cnt = 0;
    for(ll i : ret) {
        if(i != 1)
        if(!isPrime(i)){
            ll j = 2;
            while(i%j != 0){
                j++;
            }
            ll tmp = i;
            while(tmp%j == 0){
                tmp /= j;
            }
            if(tmp != 1) continue;
        }
        if(i != 1) {
            //cout << i;
            if(n%i == 0){
                n /= i;
                cnt++;
            }
        }
        //cout << " " << i << endl;
        if(n == 1) break;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;
#define ALL(x)			(x).begin(),(x).end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF				(int)2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))	
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)	
#define FloorN(x, n)	((x)-(x)%(n))			
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define M_PI			3.14159265358979323846
typedef long long			ll;
typedef unsigned long long	ull;
typedef pair<ll, ll>		P;
typedef vector<ll>			VLL;
typedef vector<VLL>			VVLL;
typedef vector<VVLL>		VVVLL;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// 枝定義
struct Edge
{
	int from;
	int	to;
	int	dist;
	Edge(){}
	Edge(int from, int to, int dist) : from(from), to(to), dist(dist){}
};

// ワーシャルフロイド
template<class T>
class WarshallFloyd
{
public:
	// distList[i][j] = iからjまでの最短距離
	vector<vector<T>> distList;

public:
	WarshallFloyd(int nodeNum, const vector<Edge> &edgeList)
	{
		distList.resize(nodeNum, vector<T>(edgeList.size(), (T)1e9));
		for (auto edgeOne : edgeList) {
			distList[edgeOne.from][edgeOne.to] = edgeOne.dist;
			distList[edgeOne.to][edgeOne.from] = edgeOne.dist;
		}

		for (int nodeCnt = 0; nodeCnt < nodeNum; nodeCnt++) {
			for (int i = 0; i < nodeNum; i++) {
				for (int j = 0; j < nodeNum; j++) {
					distList[i][j] = min(distList[i][j], distList[i][nodeCnt] + distList[nodeCnt][j]);
				}
			}
		}
	}
};

int main()
{
	// 入力
	int N;
	cin >> N;

	vector<vector<int>> a(N, vector<int>(N, 0));
	vector<Edge> edgeList;
	REP(i, N) {
		REP(j, N) {
			int r;
			cin >> r;
			edgeList.emplace_back(Edge(i, j, r));
			a[i][j] = r;
		}
	}

	// ワーシャルフロイド
	WarshallFloyd<int> res(N, edgeList);
	REP(i, N) {
		REP(j, N) {
			if (a[i][j] != res.distList[i][j]) {
				cout << -1 << endl;
				return 0;
			}
		}
	}

	ll ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			bool isDirect = true;
			for (int k = 0; k < N; k++) {
				if ((i != k) && (j != k)) {
					if (a[i][j] == a[i][k] + a[k][j]) {
						isDirect = false;
						break;
					}
				}
			}
			if (isDirect) {
				ans += a[i][j];
			}
		}
	}

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


Measured memory_bytes: 107508
#include <bits/stdc++.h>
using namespace std;
int main(){
    string str;cin>>str;
    int n=str.size();
    if((int)str.size()%2==1){
        cout<<"No"<<endl;
    }else{
        int suc=1;
        for(int i=0;i<n/2;i+=2){
            if(!(str[i]=='h' && str[i+1]=='i'))suc=0;
        }
        if(!suc)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
	return 0;
}

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

using namespace std;

const int INF = 1001001001;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
  
    int n;
    cin >> n;
  
    vector<int> a(n),b(n),c(n);
    rep(i,n) cin >> a[i] >> b[i] >> c[i];
  
  	vector<vector<int>> happy(n,vector<int>(3));
  	rep(i,n){
      happy[i][0] = a[i];
      happy[i][1] = b[i];
      happy[i][2] = c[i];
    }
  
    vector<vector<int>> dp(n,vector<int>(3));
    rep(i,3) dp[0][i] = happy[0][i];
    rep(i,n){
      if(i==0) continue;
      rep(j,3) rep(k,3) if(j!=k) 
        dp[i][j] = max(dp[i][j],dp[i-1][k]+ happy[i][j] );
    }
  	int ans = 0;
  	rep(i,3) ans = max(ans,dp[n-1][i]);
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12416
#include<stdio.h>
int main(void)
{
	int w,h,x,y,r;
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
	if(w<r+x || h<r+y){
		printf("No\n");
	}
	else if(r>x || r>y){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 1012
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>
#include <set>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,f,t) for(int i=f;i<t;i++)
#define P(ary) do { for(auto i:ary){ cout << i << " "; } cout << endl; } while (0)
int main()
{
    string s; cin >> s;
    for (int i = 0; i < s.size(); i+=2) cout << s[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const a = Number(arr[0]);
  let count = 0;

  for (let i = 0; i < a; i ++) {
    if (String(i + 1).length % 2 !== 0) {
      count ++;
    }
  }
  
  console.log(count);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 10956
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int[] a = new int[]{sc.nextInt(), sc.nextInt()};
            if (a[0] == 0 && a[1] == 0) {
                break;
            }
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < a[0]; i++) {
                for (int j = 0; j < a[1]; j++) {
                    sb.append("#");
                }
                sb.append("\n");
            }
            System.out.println(sb.toString());
        }
    }
}

Measured memory_bytes: 27772
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N = int(sys.stdin.readline())

    for N_ in range(math.floor(math.sqrt(N)), -1, -1):
        if N % N_ == 0:
            M = N // N_
            print(len(str(M)))
            return

main()


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

#define FAST_IO                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cerr.tie(NULL);

#define dbg(x) cerr << #x << " = " << x << ",  ";
#define vw(v)                        \
    cerr << endl                     \
         << endl                     \
         << (#v) << " is: " << endl; \
    for (int B : (v))                \
    {                                \
        cerr << B << " ";            \
    }                                \
    cerr << endl
#define check(x) cerr << "here " << (x) << "?" << endl

#define rep(i, a, b) for (long long i = (a); i < (b); i++)
#define per(i, a) for (long long i = (a - 1); i >= 0; i--)

#define all(x) (x).begin(), (x).end()
#define rv(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef long long ll;
ll const INF = 2147483647, R_INF = 9223372036854775807, MOD = 1e9 + 7;

//const int N =

int main()
{
    FAST_IO
    int n;
    cin >> n;
    vector<int> v(n + 1);
    rep(i, 1, n + 1)
    {
        cin >> v[i];
    }
    vector<int> DP(n + 2);
    DP[1] = 0;
    DP[2] = abs(v[2] - v[1]);
    rep(i, 3, n + 1)
        DP[i] = min(DP[i - 1] + abs(v[i] - v[i - 1]), DP[i - 2] + abs(v[i] - v[i - 2]));

    cout << DP[n];
}

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

using ll = int_fast64_t;

constexpr ll MOD = 1e9+7;

signed main(){

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

  ll sum = 0;
  for(int i=0;i<n;++i)
    sum += a[i];
  // a[0],a[1],a[2],a[3],...,a[n-1]の和
  sum %= MOD;

  ll ans = 0;
  for(int i=0;i<n-1;++i){
    sum -= a[i];
    if(sum<0)sum+=MOD;
    ll add = a[i]*sum%MOD;
    ans += add;
    ans %= MOD;
  }
  cout<<(ans)<<endl;

}


Measured memory_bytes: 4796
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		new Solution().solve(in, out);
		out.close();
	}
	
	private static class Solution {
		private void solve(InputReader in, PrintWriter out) {
			String N = in.next();
			for (int i = 0; i < N.length(); ++i) if (N.charAt(i) == '7') {
				out.println("Yes");
				return;
			}
			out.println("No");
		}
	}
	
	private static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32678);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}


}


Measured memory_bytes: 25676
#include<stdio.h>
int main()
{
	int h, r,g;
	scanf("%d %d", &h, &r);
	if (h < 0) {
		g = h + r;
		if (g == 0) {
			printf("0\n");
		}
		if (g < 0) {
			printf("-1\n");
		}
		if (g > 0) {
			printf("1\n");
		}
	}
	if (h >= 0) {
	printf("1\n");

	}
	return 0;

}

Measured memory_bytes: 2612
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
// typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  /*
    rep(i, 0, 15) rep(j, 0, 15) {
      if (i == 0)
        continue;
      cout << j % i << (j == 14 ? '\n' : ' ');
    }

    */
  int N, K;
  cin >> N >> K;

  int ans = 0;
  rep(b, 1, N + 1) {
    ans += ((N + 1) / b) * max(b - K, 0ll);
    if ((N + 1) % b - 1 >= K) {
      ans += (N + 1) % b - K;
    }
    dump(b, ans);
  }
  if (K == 0)
    ans -= N;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t;
    int ans=0;
    for(int i=0;i<s.length();i++)
    {
    	if(s[i]!=t[i])
    	ans++;
	}
	cout<<ans<<endl;
}

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

void chmin(int& a, int b) {
  if (a > b) a = b;
}

int main() {
  int N;
  cin >> N;
  
  vector<string> S(N);
  
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }
  
  int char_num[100][26] = {0};
  
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < S[i].size(); j++) {
      char_num[i][S[i][j] - 'a']++;
    }
  }
  
  
  int char_min[26];
  for (int i = 0; i < 26; i++) {
    char_min[i] = char_num[0][i];
  }
  
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < N; j++) {
      chmin(char_min[i], char_num[j][i]);
    }
  }
  
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < char_min[i]; j++) {
      cout << (char)(i +'a');
    }
  }
  cout << endl;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
#define MAXCH(a, b) a = max(a, b)
using namespace std;
typedef long long ll;

ll N, C;
ll dp[2][101][10001];

int main(void) {
  cin >> N >> C;

  REP(j, 0, 101) REP(k, 0, 10001) dp[0][j][k] = -1;
  dp[0][0][0] = 0;

  REP(i, 0, N) {
    ll a, b, c;
    cin >> a >> b >> c;

    REP(j, 0, C + 1) REP(k, 0, 10001) dp[(i + 1) % 2][j][k] = -1;

    REP(j, 0, C + 1) {
      REP(k, 0, 10001) if(dp[i % 2][j][k] >= 0) {
        if(j + c <= C && k + a <= 10000) MAXCH(dp[(i + 1) % 2][j + c][k + a], dp[i % 2][j][k] + b);
        if(j + c <= C && k + b <= 10000) MAXCH(dp[(i + 1) % 2][j + c][k + b], dp[i % 2][j][k] + a);
        MAXCH(dp[(i + 1) % 2][j][k], dp[i % 2][j][k]);
      }
    }
  }

  ll ans = 0;
  REP(j, 0, C + 1) REP(k, 0, 10001) ans = max(ans, min(k, dp[N % 2][j][k]));
  cout << ans << endl;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  for(int i = 0; i < M; i++) {
    cin >> A.at(i);
    N -= A.at(i);
  }
  if(N >= 0) cout << N << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);  
    int n;  
    cin >> n;
    vector<ll>A(n);
    vector<ll>B(n+1);
    vector<ll>B2(n+1);
    B[0]= 0;
    B2[0]= 0;
    REP(i,n){
        cin >> A[i];
        B[i+1]= A[i]+B[i];
        B2[i+1]= B[i+1];
    }
    // REP(i,n+1){
    //     cout << B[i] << " ";
    // } cout << endl;
    ll sum_p= 0;
    //+-+...の場合
    ll pm=0;
    FOR(i,1,n+1){
        ll del= 0;
        if(i%2 && B[i]+pm<=0) del= abs(B[i]+pm)+1;
        if(i%2==0 && B[i]+pm>=0) del= -(B[i]+pm+1);
        pm+= del;
        sum_p+= abs(del);
        // cout << B[i]+pm << " ";
    }
    // cout << endl;
    // cout << "-------------" << endl;
    ll sum_m= 0;
    //-+-...の場合
    pm= 0;
    FOR(i,1,n+1){
        ll del=0;
        if(i%2==0 && B2[i]+pm<=0) del= abs(B2[i]+pm)+1;
        if(i%2 && B2[i]+pm>=0) del= -(B2[i]+pm+1);
        pm+= del;
        sum_m+= abs(del);
        // cout << B2[i]+pm << " ";
    }
    // cout << endl;
    cout << ((sum_p<sum_m)?sum_p:sum_m) << endl;
}

Measured memory_bytes: 2560
s=[str(i) for i in input()]
if s[0]=='R' and s[1]=='S':
	print(1)
elif s[1]=='S' and s[2]=='R':
	print(1)
elif s[0]=='S' and s[1]=='R' and s[2]=='S':
	print(1)
elif s[0]=='R' and s[1]=='R' and s[2]=='S':
	print(2)
elif s[0]=='S' and s[1]=='R' and s[2]=='R':
	print(2)
elif s[0]=='R' and s[1]=='R' and s[2]=='R':
	print(3)
else:
	print(0)

Measured memory_bytes: 8976
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in).useDelimiter("[,\n]");
		
		while (true)
		{
			double xa, ya, xb, yb, xc, yc, xd, yd;
			try
			{
				xa = sc.nextDouble();
				ya = sc.nextDouble();
				xb = sc.nextDouble();
				yb = sc.nextDouble();
				xc = sc.nextDouble();
				yc = sc.nextDouble();
				xd = sc.nextDouble();
				yd = sc.nextDouble();
			}
			catch (Exception e)
			{
				break;
			}
			if (inPoint(xb, yb, xc, yc, xd, yd, xa, ya)
				|| inPoint(xc, yc, xd, yd, xa, ya, xb, yb)
				|| inPoint(xd, yd, xa, ya, xb, yb, xc, yc)
				|| inPoint(xa, ya, xb, yb, xc, yc, xd, yd)
			) {
				System.out.println("NO");
			}
			else
			{
				System.out.println("YES");
			}
		}
	}
	public static boolean inPoint(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp)
	{
		if (!((f(x1, y1, x2, y2, x3) < y3 && f(x1, y1, x2, y2, xp) < yp)
			|| (f(x1, y1, x2, y2, x3) > y3 && f(x1, y1, x2, y2, xp) > yp)
		)) {
			return false;
		}
		if (!((f(x2, y2, x3, y3, x1) < y1 && f(x2, y2, x3, y3, xp) < yp)
			|| (f(x2, y2, x3, y3, x1) > y1 && f(x2, y2, x3, y3, xp) > yp)
		)) {
			return false;
		}
		if (!((f(x3, y3, x1, y1, x2) < y2 && f(x3, y3, x1, y1, xp) < yp)
			|| (f(x3, y3, x1, y1, x2) > y2 && f(x3, y3, x1, y1, xp) > yp)
		)) {
			return false;
		}
		return true;
	}
	private static double f(double x1, double y1, double x2, double y2, double x)
	{
		return (y1 - y2) / (x1 - x2) * (x - x1) + y1;
	}
}

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

int main(){
    int n;
    while(cin>>n,n){
        int c=0,t=0,f=0,j;
        for(int i=1;i<=n;i++){
            j=i;
            while(j%10==0){c++;j/=10;}
            while(j%2==0){t++;j/=2;}
            while(j%5==0){f++;;j/=5;}
        }
        cout<<c+min(t,f)<<endl;
    }
}

Measured memory_bytes: 1160
from math import factorial

def combinations_count(n, r):
  return factorial(n) // (factorial(n - r) * factorial(r))

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

eve = 0
odd = 0

for i in range(n):
	if a[i]%2==0:
		eve += 1
	else:
		odd += 1
		
eve_cb = 2**eve
odd_cb1 = 0
odd_cb2 = 0

if p==1:
  for i in range(1,odd+1)[::2]:
	  odd_cb1 += combinations_count(odd,i)
else:
  for i in range(0,odd+1)[::2]:
	  odd_cb2 += combinations_count(odd,i)

print(eve_cb*(odd_cb1*p + odd_cb2*(1-p)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define endl '\n'
#define loop(i, m, n) for (lli i = m; i < n; i++)
#define loope(i, m, n) for (lli i = m; i <= n; i++)
#define epool(i, m, n) for (lli i = m; i >= n; i--)
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define vt vector<lli>
#define fi first
#define se second
#define pb push_back
#define umap unordered_map
#define mmap multimap
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x << endl, 0;
#define all(v) v.begin(),v.end()

#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;
 
lli gcd(lli a, lli b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
 
lli lcm(lli a, lli b){
    return (a * b) / gcd(a, b);
}
 
lli modi( lli n, lli m=mod ){ 
    n%=m;
    n+=m;
    n%=m;
    return n;
}

lli mpow(lli base, lli exp){
    base %= mod;
    lli result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((lli)result * base) % mod;
        base = ((lli)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

const lli MIN=-1*1e18;
const lli INF=1e18+999999999999999999;
const lli N=2e5+5;
const ldb pi=4*atan(1);

int32_t main(){
    fast_io
    lli i = 0,j = 0;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //cout << fixed << setprecision(22);
   
    lli n,m;
    cin >> n >> m;
    map<lli,lli> mp;
    loop(i,0,n){
        lli a;
        cin >> a;
        mp[i+1]=a;
    }
    lli vis[n+1]={0};
    lli ans=n;
    vector<vector<lli>> v(n+1);
    loop(i,0,m){
        lli a,b;
        cin >> a >> b;
        
        if(mp[a]>mp[b] && vis[b]==0){
            vis[b]=1;
            ans--;
        }
        if(mp[b]>mp[a] && vis[a]==0){
            vis[a]=1;
            ans--;
        }
        else if(mp[a]==mp[b]){
            if(vis[a]==0 && vis[b]==0){
                ans-=2;
                vis[a]=1;
                vis[b]=1;
            }
            else if(vis[a]==0 &&  vis[b]==1){
                ans--;
                vis[a]=1;
            }
            else if(vis[b]==0 && vis[a]==1){
                ans--;
                vis[b]=1;
            }
        }
    }
    cout << ans << endl;

}



Measured memory_bytes: 12708
N=list(map(int,input().split()))
D=input()
for d in D:
  if d=="E":
    N=[N[3],N[1],N[0],N[5],N[4],N[2]]
  if d=="W":
    N=[N[2],N[1],N[5],N[0],N[4],N[3]]
  if d=="N":
    N=[N[1],N[5],N[2],N[3],N[0],N[4]]
  if d=="S":
    N=[N[4],N[0],N[2],N[3],N[5],N[1]]
print(N[0])


Measured memory_bytes: 5600
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")

int main() {
	ll N;
	string s;
	cin >> N;
	cin >> s;
	vector<vector<ll>> dp(N+1);
	REP(i, 0, N + 1) dp[i].resize(N + 1, 0);
	REP(i, 1, N + 1) {
		REP(j, 1, N + 1) {
			if (s[i-1] == s[j-1]) dp[i][j] = dp[i - 1][j - 1] + 1;
		}
	}
	ll ans = 0;
	REP(i, 0, N + 1)REP(j, 0, N + 1) ans = max(ans, min(dp[i][j], max(i, j) - min(i, j)));
	PRI(ans);
	return 0;
}




Measured memory_bytes: 198820
import java.util.*;

public class Main{

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int arr[] = new int[N+1];
    int srt[] = new int[N+1];
    for(int i = 1; i<=N; i++){
      arr[i] = sc.nextInt();
      srt[i] = arr[i];
    }
    Arrays.sort(srt);
    for(int i = 1; i<=N; i++){
      if(arr[i] >= srt[N/2+1]){
        System.out.println(srt[N/2]); 
      }
      else{
        System.out.println(srt[N/2+1]); 
      }
    }
  }
}


Measured memory_bytes: 79372
import sys
sys.setrecursionlimit(10000000)
n = int(input())
G = [[] for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
color = [0 for i in range(n)]
stamp = 0

def dfs(u):
    global stamp
    if d[u]:
        return
    stamp += 1
    d[u] = stamp
    for v in G[u]:
        if color[v] != 0:
            continue
        color[v] = 1
        dfs(v)
    color[u] = 2
    stamp += 1
    f[u] = stamp

color[0] = 1
for i in range(n):
    inp = list(map(int, input().split()))
    u = inp[0]
    u -= 1
    k = inp[1]
    for j in range(k):
        v = inp[j+2]
        v -= 1
        G[u].append(v)
        #G[v].append(u)


for i in range(n):
    dfs(i)

for i in range(n):
    print("{0} {1} {2}".format(i+1, d[i], f[i]))


Measured memory_bytes: 5640
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>










ll x,y,z;



void solve()
{
	cin>>x>>y>>z;
	x-=z;
	cout<<x/(y+z)<<"\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int M=2200;
vector<vector<int>> e;
int dis[M][M],ans[M];

void bfs(int st){
	queue<int> q;
	dis[st][st]=1;
	q.push(st);
	while(!q.empty()){
		int u=q.front();
		q.pop();
		for(int v:e[u]){
			if(dis[v][st]==0){
				dis[v][st]=dis[u][st]+1;
				q.push(v);
			}
		}
	}
}

int main()
{
	int n,x,y;cin>>n>>x>>y;
	e.resize(n);
	for(int i=0;i<n-1;i++){
		e[i].push_back(i+1);
		e[i+1].push_back(i);
	}
	--x,--y;
	e[x].push_back(y);
	e[y].push_back(x);
	for(int i=0;i<n;i++)
		bfs(i);
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n;j++)
			++ans[dis[i][j]-1];
	for(int i=1;i<n;i++)
		cout<<ans[i]<<"\n";
	return 0;
}

Measured memory_bytes: 18816
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  let
    op :: Int -> Int -> String
    op x y | x < y     = "Yes"
           | otherwise = "No"
  [n, k] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  as <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  mapM_ putStrLn . (zipWith op <$> id <*> drop k) $ as

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 44808
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int maxn=100005;
const int logn=20;

int n,q,l;
int dep[maxn];
int up[maxn][logn];
vector<int>G[maxn];

void dfs(int u,int p) {
    dep[u]=dep[p]+1;
    up[u][0]=p;
    for (int i=1;i<=l;i++) up[u][i]=up[up[u][i-1]][i-1];
    for (int v:G[u])
        if (v!=p) dfs(v,u);
}

int lca(int u,int v) {
    if (u==v) return u;
    if (dep[u]<dep[v]) swap(u,v);
    for (int i=l;i>=0;i--) {
        if (dep[up[u][i]]>=dep[v]) u=up[u][i];
        if (dep[u]==dep[v]) break;
    }
    for (int i=l;i>=0;i--)
        if (up[u][i]!=up[v][i]) {
            u=up[u][i];
            v=up[v][i];
        }
    if (u==v) return u;
    return up[u][0];
}

int main() {
    cin>>n;
    for (int i=0;i<n;i++) {
        int m; cin>>m;
        for (int j=0;j<m;j++) {
            int v; cin>>v;
            G[i].pb(v);
        }
    }
    while ((1<<l)<=n) ++l;
    dfs(0,0);
    cin>>q;
    for (int i=0;i<q;i++) {
        int u,v; cin>>u>>v;
        cout<<lca(u,v)<<'\n';
    }
}


Measured memory_bytes: 21428
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

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

LL modpow(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;
}

void Main()
{
    LL n,c;cin>>n>>c;

    VL x(n);
    VL rx(n);
    VL v(n);
    REP(i,n){
        cin>>x[i]>>v[i];
        rx[i] = c-x[i];
    }

    VL c1(n);
    VL mc1(n);
    c1[0] = v[0]-x[0];
    mc1[0] = c1[0];
    FOR(i,1,n){
        c1[i] = v[i]-(x[i]-x[i-1])+c1[i-1];
        mc1[i] = max(c1[i], mc1[i-1]);
    }
    VL c2(n);
    VL mc2(n);
    c2[0] = v[n-1]-rx[n-1];
    mc2[0] = c2[0];
    FOR(i,1,n){
        c2[i] = v[n-1-i] - (rx[n-1-i]-rx[n-1-i+1]) + c2[i-1];
        mc2[i] = max(c2[i], mc2[i-1]);
    }

    LL result = 0;
    REP(i,n){
        LL t = c1[i];
        if(i != n-1){
            t += max(0LL, mc2[n-1-i-1]-x[i]);
        }
        result = max(result,t);
    }

    REP(i,n){
        LL t = c2[i];
        if(i != n-1){
            t += max(0LL, mc1[n-1-i-1]-rx[n-1-i]);
        }
        result = max(result,t);
    }



    cout<<result<<endl;
    


    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 8732
#!/usr/bin/env python3
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
x = 0
y = 0
for i in range(n):
    if v[i] >= c[i]:
        x += v[i]
        y += c[i]
print(x - y)


Measured memory_bytes: 3060
import bisect,sys
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac =fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV
        
    return CONV()



sys.setrecursionlimit(200005)


def main():
    N = iRaw()
    S = sRaw()
    nRGB = [sum([1 for c in S if c == C]) for C in "RGB"]
    zen = nRGB[0]*nRGB[1]*nRGB[2]

    ans = 0
    ho = 0
    for a in range(1,N):
        c2 = S[a]
        for r in range(1,a+1):
            if a+r >= N:
                continue
            c1 = S[a-r]
            c3 = S[a+r]
            if c1!=c2 and c2!=c3 and c1!=c3:
                ho+=1             
    return zen-ho

if __name__ == "__main__":
    print(main())


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

int main(void){
    string b;
    std::cin >> b;
    
    if(b == "A")
        std::cout << "T" << std::endl;
    else if(b == "T")
        std::cout << "A" << std::endl;
    else if(b == "G")
        std::cout << "C" << std::endl;
    else if(b == "C")
        std::cout << "G" << std::endl;
        
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)
var rdr = bufio.NewReaderSize(os.Stdin, 0x100000)

// SplitSpace 空白で分割設定
func SplitSpace() {
	scanner.Split(bufio.ScanWords)
}

// NextLine 標準入力から１行読み込む
func NextLine() string {
	scanner.Scan()
	return scanner.Text()
}

// NextInt 標準入力から数値を一つ読み込む
func NextInt() int {
	n, _ := strconv.Atoi(NextLine())
	return n
}

// ReadLine 標準入力から長めの1行を読み込む
func ReadLine() string {
	buf := make([]byte, 0, 0x100000)
	for {
		line, isPrefix, err := rdr.ReadLine()
		if err != nil {
			panic(err)
		}
		buf = append(buf, line...)
		if !isPrefix {
			break
		}
	}
	return string(buf)
}

func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//================

func main() {
	SplitSpace()
	h := NextInt()
	n := NextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = NextInt()
		h -= a[i]
		if h <= 0 {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


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

int f[10][10], x[23], y[23], dat[10][10], dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };

int main() {
	int m, n;
	while (scanf("%d%d", &m, &n), m) {
		int p = 0, sx, sy;
		rep(i, n)rep(j, m) {
			scanf("%d", &f[i][j]);
			if (f[i][j] == 1)x[p] = i, y[p] = j, dat[i][j] = p++;
			if (f[i][j] == 2)sx = i, sy = j;
		}
		map<P, int>dp;
		auto F = [&](int x, int y, int s, int r) {
			rep(k, 4) {
				for (int nx = x, ny = y; 0 <= nx&&nx < n && 0 <= ny&&ny < m; nx += dx[k], ny += dy[k]) {
					if (f[nx][ny] == 1 && !(r >> dat[nx][ny] & 1)) {
						dp[{r | 1 << dat[nx][ny], dat[nx][ny]}] += s;
						break;
					}
				}
			}
		};
		F(sx, sy, 1, 0);
		int ans = 0, o = 0;
		rep(i, 1 << p)rep(j, p) {
			if (dp.find({ i,j }) == dp.end())continue;
			if (i == (1 << p) - 1) {
				if (x[j] == sx || y[j] == sy)ans += dp[{i, j}];
				continue;
			}
			F(x[j], y[j], dp[{i, j}], i);
			if (++o >= 10000)dp.erase({ i,j });
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 9136
#include<cstdio>
using namespace std;
int a,b,now,id;
bool ok;
int main(){
	scanf("%d%d",&a,&b);
	now=b;
	while(now>0){
		++id;now/=10;
	}
	if(id==1) now=a*10+b;
	else if(id==2) now=a*100+b;
	else now=a*1000+b;
	for(int i=2;i<1000;++i){
		if(i*i==now){
			printf("Yes\n");
			ok=1;
			break;
		}
		if(i*i>now) break;
	}
	if(ok==0) printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n,h;
int main(){
    int ans=0;
    cin>>n>>h;
    for(int i=0;i<n;i++){
        int xxx;
        cin>>xxx;
        ans+=(xxx>=h);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
int ci, ti, n, t;
int main() {
    scanf("%d%d", &n, &t);
    int min = INT32_MAX;
    for (int i = 1; i <= n; ++i) {
        scanf("%d%d", &ci, &ti);
        if (ti <= t) {
            min = std::min(min, ci);
        }
    }
    if (min == INT32_MAX) {
        return puts("TLE"), 0;
    } else {
        return printf("%d\n", min), 0;
    }
    
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int a = 0;
	char op = 0;
	int b = 0;
	while (1){
		cin >> a >> op >> b;
		if (op == '?'){
			return 0;
		}
		switch (op){
		case '+':cout << a + b << endl;
			break;
		case'-':cout << a - b << endl;
			break;
		case'*':cout << a * b << endl;
			break;
		case'/':cout << a / b << endl;
			break;
		}
	}

}

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

using namespace std;
using ll = long long;

int main(){
  ll x;
  cin >> x;
  ll j = 0;
  ll res = 1;
  for(ll i=1; i<x; i++){
    j++;
    if(res==j){
      res++;
      j = 0;
    }
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 3632
/*与えられた数を、それ以下の数の中で最大の2の累乗に変換してください。
   たとえば、2や3ならば2^1=2に変換してください。
   同様に4,5,6,7ならば2^2=4に、8,9,10,11,...,15ならば2^3=8に変換してください。
   与えられた数を、その数以下の数の中で最大の2の累乗に変換するプログラムを作成せよ。*/
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, char const *argv[]) {
        int N, power, loop = 0;
        cin >> N;
        do {
                power = pow(2,loop);
                loop++;

        } while(power <= N/2);
        cout << power << endl;
        return 0;
}



Measured memory_bytes: 3280
/* 16D8102002L Seiya Kokura */

#include <stdio.h>
#define N 100000
 
int a[N]={};
 
int search(int c){
    if(c==a[c]){
    	return c;
    }
    return a[c]=search(a[c]);
}
 
int main(void){
	 int i,n,m,q,s,t;
 
 	for(i=0;i<N;i++){
 	 a[i]=i;
 	}
 
 	scanf("%d %d",&n,&m);
 
 	for(i=0;i<m;i++){
    	 scanf("%d %d",&s,&t);
     	if(search(s)!=search(t)){
     		 a[search(t)]=search(s);
     	}
 	}
 
 	scanf("%d",&q);
 
 	for(i=0;i<q;i++){
    	scanf("%d %d",&s,&t);
     	if(search(s)==search(t)){
     		 printf("yes\n");
     	}else{
     		 printf("no\n");
     	}
 	}
 	return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
#define null NULL
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) ((int)(a).size())
#define all(a) a.begin() , a.end()
#define fi first
#define se second
#define relaxMin(a , b) (a) = min((a),(b))
#define relaxMax(a , b) (a) = max((a),(b))
#define SQR(a) ((a)*(a))
#define PI 3.14159265358979323846
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

// MF
#define SZ 1000
#define INF 1000000000
struct edge{
  int f,t,cap,fl;
  edge(int _f=0,int _t=0,int _cap=0){
   f=_f; t=_t; cap=_cap; fl=0;
                                    }
  int rc(){return cap-fl;}
};
int N , F , T;
vector<edge> E;
vi fo[SZ];
void add_edge(int f,int t,int cap){
  E.pb(edge(f,t,cap)); E.pb(edge(t,f,0));
  fo[f].pb(sz(E)-2); fo[t].pb(sz(E)-1);
}
int lev[SZ] , Q[SZ] , QL , QR;
bool bfs(){
  memset(lev , -1 , N*sizeof(int));
  QL = QR = 0;
  lev[F] = 1; Q[QR++] = F;
  while(QL<QR){
   int V = Q[QL++];
   for(int i=0;i<sz(fo[V]);++i)
    if(E[fo[V][i]].rc()){
     int to = E[fo[V][i]].t;
     if(lev[to]==-1){
      lev[to] = lev[V]+1;
      Q[QR++] = to;
                    }
                        }
              }
  return lev[T]!=-1;
}
int pos[SZ];
int dfs(int vr , int htp=INF){
  if(htp == 0 || vr==T)return htp;
  for(;pos[vr]<sz(fo[vr]);++pos[vr]){
   edge& e = E[ fo[vr][pos[vr]] ];
   if(lev[e.f]+1 == lev[e.t] && e.cap > e.fl){
    int pushed = dfs(e.t , min(htp , e.rc()));
    if(pushed){
     e.fl += pushed;
     E[ fo[vr][pos[vr]] ^ 1 ].fl -= pushed;
     return pushed;
              }
                                             }
                                    }
  return 0;
}
int max_flow(){
  int FLOW = 0 , how;
  while(bfs()){
   memset(pos , 0 , N*sizeof(int));
   while(how = dfs(F))FLOW += how;
              }
  return FLOW;
}
// <End>

int main(){
  int n;
  vector<pii> r, b;

  scanf("%d", &n);
  r.resize(n);
  b.resize(n);

  for(auto& e : r) scanf("%d%d", &e.fi, &e.se);
  for(auto& e : b) scanf("%d%d", &e.fi, &e.se);

  N = 2 * n + 2;
  F = N - 2, T = N - 1;

  for(int i = 0;i < n;++i)
    for(int j = 0;j < n;++j)
      if(r[i].fi < b[j].fi &&
         r[i].se < b[j].se){
        //cout << i << ' ' << j << endl;
        add_edge(i, n + j, 1);
      }

  for(int i = 0;i < n;++i)
    add_edge(F, i, 1),
    add_edge(i + n, T, 1);

  int ans = max_flow();

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

  return 0;
}


Measured memory_bytes: 512
INF = 10**4
n = int(input())

ab = [[int(item) for item in input().split()] for _ in range(n)]
cd = [[int(item) for item in input().split()] for _ in range(n)]

ab.sort(key=lambda x: x[0])
cd.sort(key=lambda x: x[0])

count = 0
for c, d in cd:
  index = -1
  for i, (a, b) in enumerate(ab):
    if a < c and b < d:
      if index == -1:
        index = i
      if ab[index][1] < ab[i][1]:
        index = i
  if index != -1:
    ab[index] = [INF, INF]
    count += 1
print(count)

Measured memory_bytes: 3064
#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 X, Y, Z;
    cin >> X >> Y >> Z;

    swap(X, Y);
    swap(X, Z);

    cout << X << " " << Y << " " << Z << endl;
}

Measured memory_bytes: 256
// Problem : D - Caracal vs Monster
// Contest : AtCoder Beginner Contest 153
// URL : https://atcoder.jp/contests/abc153/tasks/abc153_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
using namespace std;
int main()
{
        long long int ans=1,h,count=1;
        cin >> h;
        while(h>1)
        {
                h/=2;
                ans*=2;
                count+=ans;
        }
        cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.math;
import std.conv;

void main() {
	long s;
	scanf("%ld", &s);
	long x2 = s.to!double.sqrt.ceil.to!int;
	writefln("0 0 %s %s %s %s", x2, x2 * x2 - s, 1, x2);
}


Measured memory_bytes: 256
n = int(input())
nums = list()
answers = list()
i = 0
if n % 2 == 0:
    while not(i == n / 2):
        nums.append((i+1,n-i))
        i += 1
else:
    while not(i == (n-1)/2):
        nums.append((i+1, n-i-1))
        i += 1
    nums.append((n,))
i = 0
while i < len(nums) - 1:
    for a in nums[i]:
        for b in nums[i+1]:
            answers.append((a, b))
    i += 1
if len(nums) >= 3:
    for a in nums[0]:
        for b in nums[-1]:
            answers.append((a,b))
print(len(answers))
for a, b in answers:
    print(a, b)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int n, k; cin >> n >> k;
	int r, s, p; cin >> r >> s >> p;

	string t; cin >> t;

	int64_t sum = 0;
	FOR_LT(i, 0, n) {
		if (i >= k) {
			if (t[i] == t[i - k]) {
				t[i] = ' ';
				continue;
			}
		}
		switch (t[i]) {
		case 'r': sum += p; break;
		case 's': sum += r; break;
		case 'p': sum += s; break;
		}
	}
	cout << sum << endl;

	return 0;
}

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

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

    int k;
    string s;
    cin >> k >> s;
    if (s.size()>k){
        s = s.substr(0,k)+"...";
    }
    cout << s<<endl;

    return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int a,b;
  cin >> a >> b;
  int ans = -100;
  maxs(ans,a+b);
  maxs(ans,a-b);
  maxs(ans,a*b);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3632
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {

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

    for (int i = 0; i < t.length(); i++) {
      String k = t.substring(i,i+1);
      if (k.equals("?")) {
        System.out.print("D");
      } else {
        System.out.print(k);
      }
    }

    System.out.println();

  }

}


Measured memory_bytes: 57788