akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int s[]={63,6,91,79,102,109,125,39,127,111},n;

int main(){
	while(cin>>n&&n!=-1){
		int c=0,m;
		rep(i,n){
			cin>>m;
			rep(i,7)cout<<((c^s[m])/(int)pow(2.0,6-i))%2;cout<<endl;
			c=s[m];
		}
	}
}

Measured memory_bytes: 804
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N, M; cin >> N >> M;
    if (N == M) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 #define int long long
#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second
 
 
 
using namespace __gnu_pbds;
using namespace std;
 // const int mod=1e9+7;
 const int mod=998244353;
const int INF=4e18+10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define read(n) int n; cin>>n;
#define readv(x, n) vector<int> x(n); for(auto &i:x) cin>>i; 
 
 
int power(int a, int b, int mod)
{
    int prod=1;
    int mult=a%mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod*=mult;
            prod%=mod;
        }
        mult*=mult;
        mult%=mod;
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int mod)
{
    return power(q, mod-2,mod);
}


signed main()
 
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
       cout.tie(NULL);
     #ifndef ONLINE_JUDGE
        if(fopen("INPUT.txt","r"))
        {
        freopen ("INPUT.txt" , "r" , stdin);
        freopen ("OUTPUT.txt" , "w" , stdout);
        }
     #endif
    auto clk=clock(); 
        mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------     

    read(n);
    readv(a,n-1);
    vector<int> cnt(n+1);
    for(auto i:a)
    {
        cnt[i]++;
    }
    for(int i=1;i<=n;i++)
        cout<<cnt[i]<<endl;
    // -------------------------------------Code ends here------------------------------------------------------------------
 
 
    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    return 0;
 }


Measured memory_bytes: 6348
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int d = a / b;
		int r = a % b;
		double f = 1.0 * a / b;
		
		System.out.printf("%d %d %f",a/b,a%b,(double)a/b);
	}
}

Measured memory_bytes: 17248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

signed main() {
    int r, g, b, k;
    cin >> r >> g >> b >> k;
    rep(i, 0, k + 1) {
        rep(j, 0, k + 1) {
            rep(l, 0, k + 1) {
                if (i + j + l > k) continue;
                int ir = r * pow(2, i);
                int jg = g * pow(2, j);
                int lb = b * pow(2, l);
                if (ir < jg && jg < lb) {
                    cout << "Yes\n";
                    return 0;
                }
            }
        }
    }
    cout << "No\n";
}


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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

typedef struct point2dfloat{
  double x,y;
} point;

int cmp(const void *a,const void *b){
  const point *p=(point *)a;
  const point *q=(point *)b;
  if(p->x!=q->x) return p->x>q->x?1:-1;
  if(p->y!=q->y) return p->y>q->y?1:-1;
  return 0;
}

double distance(const point *a,const point *b){
  double dx=a->x-b->x;
  double dy=a->y-b->y;
  return sqrt(dx*dx+dy*dy);
}

double closestPairDistance(const point *p,int n){
  if(n<=3){
    double min=400;
    int i,j;
    for(i=0;i<n;i++){
      for(j=i+1;j<n;j++){
	min=MIN(min,distance(p+i,p+j));
      }
    }
    return min;
  }
  int m=n/2;
  double l=closestPairDistance(p,m);
  double r=closestPairDistance(p+m,n-m);
  double g=MIN(l,r);
  double mid=(p[m-1].x+p[m].x)/2;
  int ll=m-1;
  while(ll>=0 && mid-p[ll].x<g) ll--;
  int rr=m;
  while(rr<n && p[rr].x-mid<g) rr++;

  double min=g;
  int i,j;
  for(i=m-1;i>ll;i--){
    for(j=m;j<rr;j++){
      min=MIN(min,distance(p+i,p+j));
    }
  }
  return min;
}

void run(void){
  int n;
  scanf("%d",&n);
  point a[100000];
  int i;
  for(i=0;i<n;i++){
    scanf("%lf%lf",&(a[i].x),&(a[i].y));
  }
  srand((unsigned)time(NULL));
  double theta=(M_PI/2)*((double)rand()/RAND_MAX);
  double c=cos(theta);
  double s=sin(theta);
  point b[100000];
  for(i=0;i<n;i++){
    b[i].x=c*a[i].x-s*a[i].y;
    b[i].y=s*a[i].x+c*a[i].y;
  }
  qsort(b,n,sizeof(point),cmp);
  double ans=closestPairDistance(b,n);
  printf("%.9lf\n",ans);
  return;
}

int main(void){
  run();
  return 0;
}



Measured memory_bytes: 6408
#include<bits/stdc++.h>
using namespace std;
int main(){
 string a,b;
  cin>>a>>b;
  int min=0;
  for(int i=0;i<=a.length()-b.length();i++){
   int count=0;
    for(int j=0;j<b.length();j++){
    if(a[i+j]==b[j]){
      count++;
    }
   }
    if(count>min){
      min=count;
    }
    
  }
  cout<<b.length()-min;
  return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n,a[200100],vis[200100],per;
long long k;
vector<int> vv;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i];
	memset(vis,-1,sizeof(vis));
	vv.push_back(1);
	for(int i=0;i<500000;i++) vv.push_back(a[vv[i]]);
	if(k<=500000){cout<<vv[k]<<endl;return 0;}
	for(int i=0;i<500000;i++){
		vis[vv[i]]=i;
		if(vis[vv[i+1]]!=-1){
			per=(i+1-vis[vv[i+1]]);
			if(k<vis[vv[i+1]]){
				cout<<vv[k]<<endl;
				return 0;
			}
			else{
				k%=per;
				while(k<vis[vv[i+1]]) k+=per;
				cout<<vv[k]<<endl;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 6888
<?php
  list($s) = explode(" ", trim(fgets(STDIN)));
  if($s=='000') echo 0;
  if($s=='001') echo 1;
  if($s=='010') echo 1;
  if($s=='011') echo 2;
  if($s=='100') echo 1;
  if($s=='101') echo 2;
  if($s=='110') echo 2;
  if($s=='111') echo 3;
  

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

int main() {
    int N, K;
    cin >> N >> K;

    double res = 0;
    for(int i=1; i<=N; ++i) {
        double tmp = 1;
        int p = i;
        while(p < K) {
            p *= 2;
            tmp /= 2.0;
        }
        res += tmp;
    }
    cout << fixed << setprecision(10);
    cout << res / N << endl;
}

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

using namespace std;

int main()
{
    int a, b; scanf("%d %d", &a, &b);

    for (int i = 1; i <= 999; i++){
        if (i * (i + 1) / 2 > a){
            if (i * (i + 1) / 2 - a == (i + 1) * (i + 2) / 2 - b){
                printf("%d\n", i * (i + 1) / 2 - a);
                return 0;
            }
        }
    }
    assert(0);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define ppb pop_back()
#define fi first
#define se second
#define pi pair<int, int>
#define rep(i, a, n) for(int i = a; i <= n; i++)
#define REP(i, a, n) for(int i = a; i < n; i++)
#define Y "Yes"
#define N "No"
using namespace std;

ll d, x, y, n, c;
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	//freopen("in.txt", "r", stdin);

	cin >> n >> d;
	d *= d;
	
	while (n--) {
		cin >> x >> y;
		if (x*x + y*y <= d) c++;
	}
	cout << c;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
 
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
 
signed main(){
    int N;cin>>N;
    vint A(3*N);
    rep(i,3*N)cin>>A[i];
sort(all(A));
    int sum=0;
    for(int i=0;i<N;i++)sum+=A[3*N-2*(i+1)];
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 2560
import sys
#sys.exit()
#sorted( ,reverse=True)
#N = int(input())
N,K = map(int, input().split())
A = []
for i in range(K):
    d = int(input())
    B = list(map(int, input().split()))
        
    A += B 
   #print(B)
   #print(A)    

#A = [int(input()) for _ in range(N)]

cnt = N
for i in range(1,N+1):
    if i in A:
        cnt -= 1



#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')
print(cnt)

Measured memory_bytes: 9184
from collections import Counter
def main():
    s = list(input())
    c = Counter(s)
    if len(s) != 26:
        for i in range(97, 123):
            if c[chr(i)] == 0:
                s.append(chr(i))
                print(''.join(s))
                exit()
            else:
                pass
    else:
        for i in range(1, 27):
            si = s[-i:]
            if si != sorted(si, reverse = True):
                ans = s[:-i]
                ans.append(min([sii for sii in si[1:] if sii > si[0]]))
                print(''.join(ans))
                break
        else:
            print(-1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38512
#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back

#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

signed main()
{
    speed
    string str;cin>>str;
    int n=str.length();
    std::vector<int> dp(n);
    int pres=0;
    for(int i=1;i<n;++i)
    {
        if(str[i]=='R'){pres=i;}
        else{dp[i]=pres;}
    }
    pres=n-1;
    for(int i=n-1;i>=0;--i)
    {
        if(str[i]=='L'){pres=i;}
        else
        {
            dp[i]=pres;
        }
    }
    std::vector<int> ans(n,0);
    for(int i=0;i<n;++i)
    {
        if(str[i]=='R')
        {
            if((dp[i]-i)%2==0)
            {
                ans[dp[i]]++;
            }
            else{ans[dp[i]-1]++;}
        }
        else{
            if((i-dp[i])%2==0)
            {
                ans[dp[i]]++;
            }
            else{ans[dp[i]+1]++;}
        }
    }
    for(auto itL:ans){cout<<itL<<" ";}
}

Measured memory_bytes: 2256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve(A, Q):
    N = len(A)
    A = A[::-1]

    s, es = [0] * (N + 1), [0] * (N + 1)
    for i in range(N):
        s[i + 1] = s[i] + A[i]
        es[i + 1] = es[i] + (A[i] if i % 2 == 0 else 0)

    ths, vals = [], []
    for i in range((N - 1) // 2):
        th = (A[i + 1] + A[i * 2 + 2]) // 2 + 1
        val = (s[i + 1] - s[0]) + (es[N] - es[i * 2 + 2])
        ths.append(th)
        vals.append(val)

    ths = ths[::-1]
    vals = vals[::-1]

    for _ in range(Q):
        x = int(input())
        p = bisect_right(ths, x)
        if p == 0:
            print(s[(N + 1) // 2] - s[0])
        else:
            print(vals[p - 1])


def main():
    N, Q = map(int, input().split())
    A = list(map(int, input().split()))

    solve(A, Q)


if __name__ == '__main__':
    main()


Measured memory_bytes: 76908
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// using namespace __gnu_pbds;
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define mii map<int, int>
#define msi map<string, int>
#define pb push_back
#define ff first
#define ss second
#define coutp cout<<fixed<<setprecision
#define FR(n) for(int i=0;i<n;i++)
#define W(n) while(n--)
#define I(v) for(int i=0;i<v.size();i++)
#define srt(v) sort(v.begin(),v.end())
#define srtd(v) sort(v.begin(),v.end(),greater<int> ())
#define ALL(v) v.begin(),v.end()
#define IT(m) for(auto it=m.begin();it!=m.end();it++)
#define M 1000000007
#define imin INT_MIN
#define imax INT_MAX
#define SIEVE 100000

int n,m,k,a,b,mx=imin,mn=imax,mxi,mni;
double x,y;
string s,s1,s2;
vector<bool> prime(SIEVE+1,1);
vi primes;

void precomputation();
void solve();
void solvecase();
void sieve();
int pow(int, unsigned int, int);
bool miillerTest(int, int);
bool isPrime(int, int);

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	clock_t start_time = clock();
	precomputation();
	solve();
	clock_t end_time = clock();
  	double elapsed_secs = double(end_time - start_time) / CLOCKS_PER_SEC;
	cerr<<elapsed_secs<<"\n";
	return 0;

}

void solvecase(){
	cin>>n;
	int a1=0,a2=0,a3=0,a4=0;
	FR(n)
	{
		cin>>s;
		if(s=="AC")
		{
			a1++;
		}
		if(s=="WA") a2++;
		if(s=="TLE") a3++;
		if(s=="RE") a4++;
	}
	cout<<"AC x "<<a1<<"\n";
	cout<<"WA x "<<a2<<"\n";
	cout<<"TLE x "<<a3<<"\n";
	cout<<"RE x "<<a4<<"\n";
}

void solve(){
	int T=1;
	//cin>>T;
	for(int i=1;i<=T;i++)
	{
		//cout<<"Case #"<<i<<":"<<" ";
		solvecase();
		cout<<"\n";
	}
}

void precomputation(){
}

void sieve(){
	prime[0]=0;
	prime[1]=0;
	for(int i=2;i<=SIEVE;i++){
		if(prime[i]){
			primes.pb(i);
			for(int j=i+i;j<=SIEVE;j+=i){
				prime[j]=0;
			}
		}
	}
	sort(primes.begin(),primes.end());
}

int pow(int X, unsigned int Y, int P)
{
	int res = 1;
	X = X % P;
	while (Y > 0)
	{
		if (Y & 1)
			res = (res*X) % P;
		Y = Y>>1;
		X = (X*X) % P;
	}
	return res;
}

bool miillerTest(int D, int N)
{
	int A = 2 + rand() % (N - 4);
	int X = pow(A, D, N);
	if (X == 1 || X == N-1)
	return true;
	while (D != N-1)
	{
		X = (X * X) % N;
		D *= 2;
		if (X == 1)	 return false;
		if (X == N-1) return true;
	}
	return false;
}

bool isPrime(int N, int K)
{
	if (N <= 1 || N == 4) return false;
	if (N <= 3) return true;
	int D = N - 1;
	while (D % 2 == 0)
		D /= 2;
	for (int i = 0; i < K; i++)
		if (!miillerTest(D, N))
			return false;
	return true;
}


Measured memory_bytes: 3876
#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
	int a, b, c, d;
	scanf("%d %d %d %d", &a, &b, &c, &d);

	int atoc = abs(a - c);
	int atob = abs(a - b);
	int btoc = abs(b - c);

	if (atoc <= d || (atob <= d && btoc <= d))
		puts("Yes");
	else
		puts("No");
	return (0);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define fastio  cin.sync_with_stdio(0); cin.tie(0);cin.exceptions(cin.failbit);
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
    
    fastio;
    int T=1;
    // cin>>T;
    while(T--){
        ll n;cin>>n;
        string ans;
        // n--;
        while(n>0){
            char u;
            int z=n%26;if(z==0)z=26;
            u='a'+z-1;
            ans.pb(u);
            n=(n-1)/26;
        }
        reverse(all(ans));
        cout<<ans;
    }   
    timecalculater();
    return 0;   
} 

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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	int N, M, X;
	cin >>N >>M >>X;
	vector<int> C(N,0);
	vector<vector<int>> A(N, vector<int> (M, 0));
	Rep0(i, N) {
		cin >>C.at(i);
		Rep0(j, M)
			cin >>A.at(i).at(j);
	}
	//
	int NN=pow(2, N);
	int CC=INF;
	Rep0(i, NN) {
		vector<int> IX(N, 0);
		int I=i;
		Rep0(j, N) {
			IX.at(j)=I%2;
			I/=2;
		}
		bool OK=true;
		Rep0(j, M) {
			int AA=0;
			Rep0(k, N)
				AA +=IX.at(k)*A.at(k).at(j);
			if (AA<X) {
				OK=false;
				break;
			}
		}
		if (OK) {
			int CCC=0;
			Rep0(j, N)
				CCC +=IX.at(j)*C.at(j);
			CC=min(CC, CCC);
		}
	}
	if (CC==INF)
		cout <<-1 <<' ' <<endl;
	else
		cout <<CC <<endl;
	return 0;
}



Measured memory_bytes: 4112
#include<cstdio>
#include<list>
#include<algorithm>
#include<stdlib.h>
using namespace std;

int main()
{
	int key;
	int n;
	char cmd[20];
	list<int> v;
	
	scanf("%d", &n);
	
	for(int i = 0; i<n; i++)
	{
		scanf("%s %d", cmd, &key);
		if(cmd[0]=='i')
		{
			v.push_front(key);
		}
		else if(cmd[0]=='d')
		{
			if(cmd[6]=='F')
			{
				v.pop_front();
			}
			else if(cmd[6]=='L')
			{
				v.pop_back();
			}
			else
			{
				for(list<int>::iterator it = v.begin(); it != v.end(); it++)
				{
					if( *it == key )
					{
						v.erase(it);
						break;
					}
				}
			}
		}	
	}


	
	int i = 0;
	for(list<int>::iterator it = v.begin(); it != v.end(); it++)
	{
		if(i++) printf(" ");
		printf("%d", *it);
	}
	printf("\n");
//	system("pause");
	return 0;
}


Measured memory_bytes: 33912
#include<cstdio>
int main( )
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==5&&b==5||b==5&&c==5||a==5&&c==5)
	    {if(a==7||b==7||c==7)
		    {printf("YES");}
	else{printf("NO");}
	    }
	else{printf("NO");}
	
	return 0;
}

Measured memory_bytes: 128
def prime_factors(num):
    if num < 2:
        return []
    ret = []
    for i in prime_list(int(num**0.5)):
        if i*i > num:
            break
        while num % i == 0:
            ret.append(i)
            num //= i
    if num > 1:
        ret.append(num)
    return ret

def prime_list(num):
    ret = []
    search = list(range(2, num+1))
    while True:
        if search[0] > num**0.5:
            ret.extend(search)
            break
        else:
            head = search[0]
            ret.append(head)
            search.pop(0)
            search = [n for n in search if n%head != 0]
    return ret

if __name__ == "__main__":
    n = int(input())
    li = prime_factors(n)
    s = set(li)
    res = 0
    for i in s:
        c = li.count(i)
        cc = 0
        step = 1
        while True:
            cc += step
            if cc > c:
                if step > 1: step -=1
                break
            step += 1
        res += step

    print(res)

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

#define EPS (1e-7)
#define INF ((ll)1<<50)
#define PI (acos(-1))

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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

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

using ll = long long;

using Weight = ll;

struct Edge {
  int from, to;
  Weight cost;
  Edge(int from, int to, Weight cost) :
    from(from), to(to), cost(cost) {}
};

bool operator < (const Edge &e, const Edge &f) {
  return e.cost < f.cost;
}

bool operator > (const Edge &e, const Edge &f) {
  return e.cost > f.cost;
}

using Edges = vector<Edge>;
using Graph = vector<Edges>;

/*bool*/ void bellman_ford(const Graph &g, int s, vector<Weight> &d) {
  int n = g.size();
  d.assign(n,INF); d[s] = 0;
  // bool f = true;
  REP(k,/*n*/n-1) REP(i,n) for (const Edge &e : g[i]) {
    if (d[e.to] > d[e.from] + e.cost) {
      d[e.to] = d[e.from] + e.cost;
      // if (k == n-1) f = false;
    }
  }
  // return f; // return true if succeed
}

int main() {
  int n, m; cin >> n >> m;
  Graph g(n);
  REP(i,m) {
    int a, b; ll c; cin >> a >> b >> c;
    a--; b--;
    g[a].push_back(Edge(a, b, -c));
  }
  vector<Weight> d;
  bellman_ford(g, 0, d);
  vector<bool> negative(n, false);
  REP(k,n) REP(i,n) for (const Edge &e : g[i]) {
    if (d[e.to] > d[e.from] + e.cost) {
      d[e.to] = d[e.from] + e.cost;
      negative[e.to] = true;
    }
    if (negative[e.from]) negative[e.to] = true;
  }
  if (!negative[n-1]) cout << -d[n-1] << endl;
  else cout << "inf" << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll solve(ll h[],ll n,ll d[])
{
    
    if(n==0)
    {
      // cout<<"khbj"<<"\n";
        return 0;
    }
    if(n==1)
    {
      //  cout<<h[1]-h[0]<<"\n";
        return abs(h[0]-h[1]);
    }
     if(d[n]!=-1)
    {
    //cout<<h[1]-h[0]<<"\n";
        return d[n];
    }
    else
    {
    ll cost1=solve(h,n-1,d)+abs(h[n-1]-h[n]);
    //cout<<cost1<<"\n";
    ll cost2=solve(h,n-2,d)+abs(h[n-2]-h[n]);
    d[n]=min(cost1,cost2);
    return d[n];
    }
}
int main() {
	// your code goes her
	ll n;
	cin>>n;
	ll h[n];
	for(ll i=0;i<n;i++)
	{
	    cin>>h[i];
	}
	ll d[n+1];
	for(ll i=0;i<n;i++)
	{
	    d[i]=-1;
	}
    cout<<solve(h,n-1,d)<<"\n";
	
	return 0;
}


Measured memory_bytes: 12996
#include <iostream>
#include<math.h>
#include <algorithm>
#include<string>
using namespace std;

int main() {
        int n;
        long long int a[100010];

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

        bool fl=true;
        long long int ans[100010];
        int count=0;
        ans[0]=1;
        for(int i=1; i<n; i++) ans[i]=0;
        for(int i=1; i<n; i++){
                if(a[i]!=a[i-1]) count++;
                ans[count]++;
        }

        int ansNum=0;
        for(int i=0; i<=count; i++) if(ans[i]%2==1)ansNum++;

        cout<<ansNum<<endl;
        return 0;
}


Measured memory_bytes: 1792
# D - Wizard in Maze

from collections import deque

h,  w  = map(int, input().split())
ch, cw = map(int, input().split())
dh, dw = map(int, input().split())
s = []
for i in range(h):
    s.append([c for c in input()])

def dfs(y, x, area_id):
    stack = [(y, x)]
    while len(stack) > 0:
        y, x = stack.pop()
        if s[y][x] == '.':
            s[y][x] = area_id
            for vy, vx in [(-1, 0), (0, 1), (1, 0), (0, -1)]:
                if (0 <= x + vx < w and 0 <= y + vy < h and
                    s[y + vy][x + vx] == '.'):
                    stack.append((y + vy, x + vx))

n_area = 0
for y in range(h):
    for x in range(w):
        if s[y][x] == '.':
            dfs(y, x, n_area)
            n_area += 1

# links between areas
adj = [set() for i in range(n_area)]
for y in range(h):
    for x in range(w):
        if s[y][x] == '#':
            continue
        for vy in range(0, 3):
            for vx in range(-2, 3):
                if (0 <= x + vx < w and 0 <= y + vy < h and
                    s[y + vy][x + vx] != '#'):
                    adj[s[y][x]].add(s[y + vy][x + vx])
                    adj[s[y + vy][x + vx]].add(s[y][x])

c = s[ch - 1][cw - 1]
d = s[dh - 1][dw - 1]
dist = [float('inf') for i in range(n_area)]
dist[c] = 0

q = deque()
q.append((c, 0))
while len(q) > 0:
    c, cost = q.popleft()
    for x in adj[c]:
        if dist[x] > cost + 1:
            dist[x] = cost + 1
            q.append((x, cost + 1))

print(dist[d] if dist[d] < float('inf') else -1)


Measured memory_bytes: 196136
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long MOD = 1000000007;

long long fact(long long k) {
	long long sum = 1;
	for (long long i = 2; i <= k; i++)
		sum *= i;

	return sum;
}

int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

long long pow_mod(int a, int b) {
	long long ans = 1;
	for (int i = 0; i < b; i++)
		ans = (ans * a) % MOD;

	return ans;
}

long long powll(long long a, long long  b) {
	long long ans = 1;
	for (long long  i = 0; i < b; i++)
		ans = ans * a;

	return ans;
}


int main()
{
	long long n, ans = 0;
	string s;

	cin >> n;
	cin >> s;

	for (int i = 0; i < n - 2; i++) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
			ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <memory.h>
using namespace std;
typedef long long LL;

struct node
{
	LL val, cnt;
};

vector<node> v;

int main()
{
	ios::sync_with_stdio(0);
	LL n, k, a, b;
	cin >> n >> k;
	for (int i = 0; i < n; ++i)
	{
		cin >> a >> b;
		v.push_back({a, b});
	}
	sort(v.begin(), v.end(), [](node a, node b) {return a.val < b.val; });
	for (int i = 0; i < n; ++i)
	{
		if (v[i].cnt >= k)
		{
			cout << v[i].val << '\n';
			return 0;
		}
		else
			k -= v[i].cnt;
	}
}

Measured memory_bytes: 2420
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
using namespace std; 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;
 
int calc(int n,int *i,int *o){
  int *p,*q;
  p = i;
  q = o;
  int count = 0;
  for(int i = 0;i < 12;i++){
    count += *p - *q;
    if(count >= n) return i+1;
    p++;q++;
  }
  return -1;
}

int main(){
  int n;
  int in[12],out[12];
  int c;
  while(1){
    cin >> n;
    if(n == 0)break; 
    for(int i = 0;i < 12;i++){
      cin >> in[i] >> out[i];
    }
    int count = 0;
    for(int i = 0;i < 12;i++){
      count += in[i] - out[i];
      if(count >= n){P(i+1);break;}
      if(i == 11) P("NA");
    }
  }
  return 0;
}

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

int main(){

    int N;
    cin >> N;

    bool frag = false;

    if (N / 100 == 7) frag = true;
    N -= N / 100 * 100;
    if (N / 10 == 7) frag = true;
    N -= N / 10 * 10;
    if (N == 7) frag = true;

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

    return 0;
}

Measured memory_bytes: 3636
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include<queue>
using namespace std;
//conversion
//------------------------------------------
inline long long toint(string s) {long long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef long long ll;
typedef long long LL;
typedef vector<int > vi;
typedef vector<long long > VLL;
typedef vector<long long > vll;
typedef vector<string > ves;
typedef vector<char > vech;

typedef pair<long long , long long> pll;
typedef pair<long long , long long> PLL;
typedef map<ll , ll >mll;
typedef map<int , int >mii;
typedef map<char , int >mci;
typedef map<char , ll >mcl;


//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define VECMAX(x) *max_element(ALL(x))
#define VECMIN(x) *min_element(ALL(x))
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//#define MULTIPLE(i,n,k) for(int i = (k) ; i<(n) ; i+=k+1)//倍数ループ
//constant
//------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define SIZEOF(x) sizeof(x)/sizeof(x[0])

const long long INF = 100000000000000;
const long long NINF = -100000000000000;







int main(){
    LL n , m , k , A , B;    string s;    map<ll , ll>p;
    vector<pll> Pairs;pll Ap;
    //cin >> n;
    //vll a(n);vll R(n+1);/*累積*/R[0] = 0;
    //REP(i,n)cin>>a[i];REP(i,n)R[i+1] = R[i]+a[i];


    cin >> n >> m >> k >> A;
    if(k/m+(k%m>0) <= n/A + (n%A!=0)){
        cout << "Yes"<<endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}




Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n, -1) {} // -1で初期化(負の場合をrootとし、この値で木の深さも表す)
  int root(int x) {
    if (d[x] < 0) return x; // 負の場合はroot
    return d[x] = root(d[x]); // 経路圧縮: 自身が親でないときは、親に設定する
  }
  bool unite(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y]; // -1からさらに—1していくことで、-2,-3… となり木の深さを表現
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int size(int x) { return -d[root(x)]; /* 木の深さを正の値で返す */ }
};

int main() {
  IOS;
  int n,m;
  cin >> n >> m;
  UnionFind uf(n);

  REP(i,m) {
    int a,b; cin >> a >> b;
    a--; b--;
    uf.unite(a,b);
  }

  int ans = 0;
  REP(i,n) chmax(ans, uf.size(i));
  COUT(ans);
  return 0;
}


Measured memory_bytes: 3988
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

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

    int asum = accumulate(all(a), 0);

    int ans = n - asum;

    cout << (0 <= ans ? ans : -1) << endl;

    return 0;
}

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

using namespace std;

const int N = 2e3 + 5;

int n;
long long dp[N][N];
pair <int, int> a[N];

int main() {
    cin >> n;

    for (int i = 1; i <= n;  i++) {
        cin >> a[i].first;
        a[i].second = i;
    }

    sort(a + 1, a + n + 1);
    reverse(a + 1, a + n + 1);

    for (int i = 1; i <= n; i++) {
        for (int l = 0; l < i; l++) {
            int r = (n + 1) - (i - l - 1);
            dp[l + 1][r] = max(dp[l + 1][r], dp[l][r] + abs(a[i].second - (l + 1)) *1ll* a[i].first);
            dp[l][r - 1] = max(dp[l][r - 1], dp[l][r] + abs(a[i].second - (r - 1)) *1ll* a[i].first);
        }
    }

    long long ans = 0;
    for (int i = 0; i <= n; i++) {
        ans = max(ans, dp[i][i + 1]);
    }

    cout << ans << endl;
}


Measured memory_bytes: 26288
#include <iostream>

using namespace std;

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

    if (s == "Sunny") {
        cout << "Cloudy" << endl;
    } else if (s == "Cloudy") {
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }
}


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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
nodes = tuple([] for i in range(N))
for i in range(N-1):
    a, b, c = MAP()
    a -= 1
    b -= 1
    nodes[a].append((b, c))
    nodes[b].append((a, c))

ans = [0] * N
def rec(u, prev, prevc):
    # 親への辺のコストによって塗り分け
    if prev == -1:
        ans[u] = 0
    elif prevc % 2 == 0:
        ans[u] = ans[prev]
    else:
        ans[u] = 1 - ans[prev]
    for v, c in nodes[u]:
        if v != prev:
            rec(v, u, c)
rec(0, -1, 0)

[print(a) for a in ans]


Measured memory_bytes: 79416
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000000
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    set<char> st;
    rep(i,n){
        char c;
        cin >> c;
        st.insert(c);
    }
    if(st.size()==3){
        cout << "Three" << endl;
    }else{
        cout << "Four" << endl;
    }
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
    public static void Main()
    {
        long N = long.Parse(Console.ReadLine());
        int m = int.MaxValue;
        for (long i = 1; i * i <= N; i++)
        {
            if (N % i != 0)
                continue;
            m = Math.Min(Math.Max(i, N / i).ToString().Length, m);
        }
        Console.WriteLine(m);
    }
}

Measured memory_bytes: 11092
def main():
    K,N = map(int, input().split())
    A = list(map(int, input().split()))
    # start:i->end:i-1 (clockwise)
    ans = K
    for i in range(N):
        if i==0:
            tmp = A[i]+(K-A[i-1])
        else:
            tmp = A[i]-A[i-1]
        ans = min(ans,K-tmp)
    print(ans)

main()


Measured memory_bytes: 25840
#include <bits/stdc++.h>
#include <complex>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
#define INF 1e9
#define MOD 1e9 + 7
using namespace std;

template<typename T> void cmin(T &a, T b) { a = min(a, b); }
template<typename T> void cmax(T &a, T b) { a = max(a, b); }

using P = complex<double>;
const double PI = acos(-1);
const double EPS = 1e-9;
// P p(a,b)=a+bi -> 点p(a,b)
namespace std {
  bool operator<(const P &a, const P &b) { return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b); }
  bool operator==(const P &a, const P &b) { return a.real() == b.real() && a.imag() == b.imag(); }
} // namespace std
// i倍すれば反時計回りに90度回転
P turn(P p, double t) { // t度回転
  return p * exp(P(.0, t * PI / 180.0)); //ベクトルにe^θiをかける
}

//内積
double dot(P a, P b) { return real(conj(a) * b); }
//外戚
double cross(P a, P b) { return imag(conj(a) * b); }

//直線(Line) 線分(Segment)
// L l(a,b);で直線ab
// l[0]=a l[1]=b
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a);
    push_back(b);
  }
};

//円(Circle)
// C c(P(a,b)r); 中心(a,b) 半径rの円
struct C {
  P c;
  double r;
  C(const P &c, double r) : c(c), r(r) {}
};
//点pから直線aに推薦を下ろした足
P projection(L a, P p) {
  double t = dot(p - a[0], a[0] - a[1]) / norm(a[0] - a[1]);
  return a[0] + t * (a[0] - a[1]);
}
//点pを直線aで折り返した点
P reflection(L a, P p) { return p + 2.0 * (projection(a, p) - p); }

signed main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  L line(P(a, b), P(c, d));
  int q;
  cin >> q;
  while (q--) {
    int x, y;
    cin >> x >> y;
    P p(x, y);
    P ans = projection(line, p);
    printf("%.10lf %.10lf\n", ans.real(), ans.imag());
  }
  return 0;
}



Measured memory_bytes: 3292
h,w = map(int, input().split())
a = [list(input()) for _ in range(h)]
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for k in range(h):
    for j in range(w):
        x,y = k,j
        if a[x][y] == "#":
            for i in range(4):
                xi,yi = x+dx[i],y+dy[i]
                if 0 <= xi < h and 0 <= yi < w and a[xi][yi] == "#":
                    break
            else:
                print("No")
                exit()
print("Yes")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    vint a(N);
    int sum=0;
    REP(i,N){ 
        cin>>a[i];
        sum+=a[i];
    }
    sort(ALL(a));

    if(a[N-1]<sum-a[N-1])
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}


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

string s;

signed main() {
	cin >> s;
	
	int i;
	char c = 'C';
	for (i = 0; i < s.length(); i++) {
		if (s[i] == c) {
			if (c == 'C') c = 'F';
			else break;
		}
	}
	if (i < s.length()) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

int main() {
	int n,i=1;
	cin >> n;
	vi v;
	while (i*i<1000000001) {
		v.push_back(i*i);
		i++;
	}
	for (int j = 1; j < v.size();j++) {
		if (n < v[j]) {
			cout << v[j - 1]<<endl;
			return 0;
		}
	}
	cout << v[v.size() - 1] << endl;
}


Measured memory_bytes: 512
/* ***************************************
Author        :Scau.ion
Created Time  :2017/10/22 20:15:02 UTC+8
File Name     :ion.cpp
*************************************** */

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

#define LL long long
#define ULL unsigned long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<PII>
#define X first
#define Y second
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define IN freopen("in", "r", stdin);
#define OUT freopen("out", "w", stdout);

const int maxn = 100010;
char s[maxn];

int main()
{
	IOS;
	cin>>s;
	int n = strlen(s);
	int st = 0, ed = n - 1;
	int ans = 0;
	while (st < ed)
	{
		if (s[st] != s[ed])
		{
			if (s[st] == 'x')
			{
				++ ans;
				++ st;
				continue;
			}
			else if (s[ed] == 'x')
			{
				++ ans;
				-- ed;
				continue;
			}
			else break;
		}
		++ st;
		-- ed;
	}
	if (st < ed) cout<<"-1"<<endl;
	else cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Read in = new Read(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Read in, PrintWriter out) {
            long a = in.nextInt();
            long b = in.nextInt();
            if (((a * b) & 1) == 0) {
                out.println("Even");
            } else {
                out.println("Odd");
            }
        }

    }

    static class Read {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer;
        private int bytesRead;

        public Read(InputStream inputStream) {
            din = new DataInputStream(inputStream);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Read(String file_name) {
            try {
                din = new DataInputStream(new FileInputStream(file_name));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() {
            try {
                bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

    }
}



Measured memory_bytes: 23380