akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
//#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int32_t main(){
	boost;
	string ph;
	cin>>ph;
	int ans=0;
	for (int i = 0; i < sz(ph)/2; ++i)
		if(ph[i]!=ph[sz(ph)-1-i])ans++;
	cout<<ans;
	return 0;
}
//long long
//array bounds
//special cases
//binary search

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-06-27 20:55:12 +0900
# LastModified: 2020-06-27 21:04:43 +0900
#


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


def main():
    s = input()
    t = input()
    cnt = 0
    for i in range(len(t)):
        if s[i] != t[i]:
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9472
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
	int a[9];
	vector<bool> can(9, false);
	rep(i, 0, 9) {
		int in;
		cin >> in;
		a[i] = in;
	}
	int n;
	cin >> n;
	rep(i, 0, n) {
		int b;
		cin >> b;
		rep(j, 0, 9) {
			if (a[j] == b)can[j] = true;
		}
	}

	for (int i = 0;i < 3;i++) {
		int cnt = 0;
		// 縦
		for (int j = i;j < 9;j += 3) {
			if (can[j])cnt++;
			if (cnt == 3) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	for (int i = 0;i < 9;i+=3) {
		int cnt = 0;
		//　横
		for (int j = i;j < i + 3;j++) {
			if (can[j])cnt++;
			if (cnt == 3) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	int cnt = 0;
	//　斜め
	for (int j = 0;j < 9;j += 4) {
		if (can[j])cnt++;
		if (cnt == 3) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	for (int j = 2;j < 8;j += 2) {
		if (can[j])cnt++;
		if (cnt == 3) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
import copy
n = int(input())
box = [[] for _ in range(n)]
box[0] = [[0]]
if n == 1:
     print('a')
else:
     for i in range(1,n):
          for j in range(len(box[i-1])):
               for k in range(max(box[i-1][j])+2):
                    a = copy.deepcopy(box[i-1][j])
                    a.extend([k])
                    box[i].extend([a])
     for i in range(len(box[n-1])):
       ans = [''] * n
       for j in range(n):
            ans[j] = chr(ord('a') + box[n-1][i][j])

       print(''.join(ans))





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

#define REP(i, a) for(int64 i = 0; i < (a);i++)
#define FOR(i, a, b) for(int64 i = (a); i < (b); i++)
#define INF (int64)1e9
#define INF_LL (int64)1e18
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int32_t;
using int64 = int64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

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

int main(void) {
  int64 N, d;
  cin >> N >> d;
  using T= tuple<int64, int64, int64>;
  vector<T> star;
  star.reserve(N);
  REP(i, N) {
    int64 x, y, b;
    cin >> x >> y >> b;
    star.emplace_back(b, x, y);
  }
  sort(all(star));

  int64 r = 0;
  int64 res = 0;
  multiset<int64> x, y;
  REP(l, N) {
    while (r < N && abs(get<0>(star[r])-get<0>(star[l])) <= d) {
      x.insert(get<1>(star[r]));
      y.insert(get<2>(star[r]));
      r++;
    }
    chmax(res, (*y.rbegin()-*y.begin()) * (*x.rbegin()-*x.begin()));
    x.erase(x.find(get<1>(star[l])));
    y.erase(y.find(get<2>(star[l])));
  }
  cout << res << endl;
}



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

#define I64d_OJ

//#ifdef I64d_OJ
//#define LL __int64
//#endif // I64d_OJ
#ifdef I64d_OJ
#define LL long long
#endif // I64d_OJ

typedef unsigned LL ULL;
typedef unsigned uint;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;
typedef vector<int> vi;

inline LL read(){
    LL x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-f; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define MID(a,b) (((LL)(a)+(LL)(b))>>1)
#define absx(a) ((a)<0?-(a):(a))
#define MK(a,b) make_pair(a,b)
#define PB(a) push_back(a)
#define lowbit(x) ((x)&-(x))

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

const double pi=(double)acos(-1.0);
const double eps=(double)1e-10;
const int INF = (int) 0x3f3f3f3f;
const int MOD = (int) 1e9+7;
const int MAXN =(int) 1e5+10;
const int MAXM = (int) 1e5+10;

///--------------------START-------------------------
LL Q,H,S,D;
LL N;
LL ans;

void work(){
    scanf("%lld%lld%lld%lld%lld",&Q,&H,&S,&D,&N);
    LL tmp=N/2;
    N=N-tmp*2;
    tmp*=2;
    ans=min(Q*4*tmp,min(H*2*tmp,min(S*tmp,D*tmp/2)));
//    printf("%lld\n",ans);
    ans+=min(Q*4*N,min(H*2*N,S*N));
    printf("%lld\n",ans);
}

///--------------------END-------------------------
int main(){
#ifdef NNever
//freopen("data.in","r",stdin);
///freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}







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

int N, M;
const int MAX_NM = 1.0e5;
ll A[MAX_NM];
pair<ll, ll> CB[MAX_NM];

int main() {
    cin >> N >> M;
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < M; i++) cin >> CB[i].second >> CB[i].first;

    sort(A, A+N);
    sort(CB, CB+M, greater<>());

    //for (int i = 0; i < M; i++) cout << CB[i].first << " " << CB[i].second << endl;

    int next_j = 0;
    bool f = false;
    for (int i = 0; i < M; i++) {
        for (int j = next_j; j < N;) {
            if (A[j] >= CB[i].first) {
                f = true;
                break;
            }
            else {
                if (CB[i].second > 0) {
                    A[j] = CB[i].first;
                    CB[i].second--;
                    j++;
                }
                else {
                    next_j = j;
                    break;
                }
            }
        }
        if (f) break;
    }

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ans += A[i];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int gcd(int x, int y){
    if (x<y) swap(x, y);
    if (y==0) return x;
    return gcd(y, x%y);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k;
    cin >> k;
    ll sum = 0;
    rep(a, k)rep(b, k)rep(c, k){
        sum += gcd(gcd(a+1,b+1),c+1);
    }
    cout << sum << endl;
    return 0;
}

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

#define FOR(i,a,n) for (int i = a; i < (int)n; ++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<typename T> bool chmin(T &a, const T &b) {if (a > b) { a = b; return true; }return false;}
template<typename T> bool chmax(T &a, const T &b) {if (a < b) { a = b; return true; }return false;}

using ll = int_fast64_t;

constexpr ll INF = (1e9);
constexpr ll MOD = (1e9+7);

int main() {
  int n; cin >> n;
  vector<ll> x(n);
  REP(i,n) {
    int a; cin >> a;
    x[a-1] = i;
  }
  set<ll> s;
  s.insert(-1);
  s.insert(n);
  ll ans = 0;
  REP(i,n) {
    s.insert(x[i]);
    auto it = s.find(x[i]);
    it--; ll l = *it;
    it++; it++; ll r = *it;
    ans += (x[i] - l)*(r - x[i])*(i+1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11136
s = gets.chomp
K = gets.to_i

list = [""]

(s.length-1).downto(0) do |i|
  i.upto(s.length-1) do |j|
    tmp = s.slice(i..j)
    break if list[K] != nil && tmp > list[K]

    1.upto(K) do |k|
      if list[k] == nil || tmp < list[k]
        list.insert(k,tmp)
        break
      elsif tmp == list[k]
        break
      end
    end
  end
end

puts list[K]


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

int main()
{
  while(true){
    int m,nmin,nmax;
    cin>>m>>nmin>>nmax;

    if(m==0&&nmin==0&&nmax==0)
    break;

    int P[200];
    for(int i=0;i<m;i++){
      cin>>P[i];
    }
    int gap =-1;
    int n=-1;

    for(int i=nmin; i<=nmax; i++){
      int g=P[i-1]-P[i];

      if(gap<=g){
        gap=g;
        n=i;
      }
    }
    cout<<n<<endl;

  }
  return 0;
}



Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
typedef int64_t LL;
const int MOD=1e9+7;
int P(LL a,LL n)
{
  if(n==0)return 1;
  else if(n%2==0)return P(a*a%MOD,n/2)%MOD;
  else return (a*P(a,n-1))%MOD;
}
int C(LL n,LL k)
{
  LL x=1,y=1;
  k=min(k,n-k);
  if(n<0||k<0||n<k)return 0;
  if(n==0||k==0)return 1;
  for(int i=0;i<k;i++){x*=n-i,x%=MOD;y*=i+1,y%=MOD;}
  return (x*P(y,MOD-2))%MOD;
}
int main()
{
  int N,A,B,z;
  cin>>N>>A>>B;
  z=P(2,N)-1;
  z-=C(N,A);if(z<0)z+=MOD;
  z-=C(N,B);if(z<0)z+=MOD;
  return cout<<z<<endl,0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
using namespace std;
int main(){
    int N; cin >> N;
    vector<int> A(N);
    REP(i,N ) cin >> A[i];

    double pro = 1;
    REP(i,N){pro *= A[i];}

    vector<double> B(N);
    REP(i,N){B[i] = pro / A[i];}

    double sum = 0;
    REP(i,N){sum += B[i];}

    double ans;

    ans = pro / sum;

     cout<<std::defaultfloat<<std::setprecision(6);
    cout<<endl;

    cout << fixed << ans <<endl;


    
}

Measured memory_bytes: 256
#include <stdio.h>


int main(void) {
	int N, K;
	int i, j;
	int base;
	int ans;

	scanf("%d%d", &N, &K);

	int V[N + 1];
	int tv[N];

	V[0] = 0;
	V[N + 1] = 0;
	for (i = 0;i <= N + 1;i++) {
		tv[i] = 0;
	}
	for (i = 1;i <= N;i++) {
		scanf("%d", &V[i]);
	}

	int TL, TR;

	if (N <= K) {
		int fv[N];
		fv[0] = 0;
		int sfv[N][N];

		for (i = 0;i <=N;i++) {
			for (j = 0;j <= N;j++) {
				sfv[i][j] = 0;
			}
		}

		for (TL = 0;TL <= N;TL++) {
			for (TR = 0;TR <= (N - TL);TR++) {
				for (i = 0;i <= TL;i++) {
					tv[i] = V[i];
				}
				tv[-1] = -1;

				for (i = 0;i <= TR;i++) {
					tv[TL + TR + 1 - i] = V[N - i + 1];
				}

				for (j = 0;j < TL + TR;j++) {
					for (i = 0;i < TL + TR;i++) {
						if (tv[i] > tv[i + 1]) {
							base = tv[i];
							tv[i] = tv[i + 1];
							tv[i + 1] = base;
						}
					}
				}

				int R = 0;

				while (TL + TR + R <= K && tv[R - 1] < 0) {
					tv[R - 1] = 0;
					R++;
				}

				for (i = 0;i <= TL + TR + 1;i++) {
					sfv[TL][TR] += tv[i];
				}

				if (TR == 0) {}
				else {
					if (sfv[TL][TR] < sfv[TL][TR - 1]) {
						sfv[TL][TR] = sfv[TL][TR - 1];
					}
				}

				fv[TL] = sfv[TL][TR];
			}

			if (TL == 0) {}
			else {
				if (fv[TL] < fv[TL - 1]) {
					fv[TL] = fv[TL - 1];
				}

				ans = fv[TL];
				
				if (V[1] < 0) {}
				else {
					ans -= V[1];
				}
			}

		}
		printf("%d\n", ans);
	}
	else {
		int fv[K];
		fv[0] = 0;
		int sfv[K][K];

		for (i = 0;i <= K;i++) {
			for (j = 0;j <= K;j++) {
				sfv[i][j] = 0;
			}
		}


		for (TL = 0;TL <= K;TL++) {
			for (TR = 0;TR <= (K - TL);TR++) {
				for (i = 0;i <= TL;i++) {
					tv[i] = V[i];
				}
				tv[-1] = -1;

				for (i = 0;i <= TR;i++) {	
					tv[TL + TR + 1 - i] = V[N - i + 1];
				}

				for (j = 0;j < TL+TR;j++) {
					for (i = 0;i < TL+TR;i++) {
						if (tv[i] > tv[i + 1]) {
							base = tv[i];
							tv[i] = tv[i + 1];
							tv[i + 1] = base;
						}
					}
				}

				int R = 0;

				while (TL + TR + R <= K && tv[R-1] < 0) {
					tv[R-1] = 0;
					R++;
				}

				for (i = 0;i <= TL + TR+1;i++) {
					sfv[TL][TR] += tv[i];
				}

				if (TR == 0) {}
				else {
					if (sfv[TL][TR] < sfv[TL][TR - 1]) {
						sfv[TL][TR] = sfv[TL][TR - 1];
					}
				}

				fv[TL] = sfv[TL][TR];
			}

			if (TL == 0) {}
			else {
				if (fv[TL] < fv[TL - 1]) {
					fv[TL] = fv[TL - 1];
				}
			}

			ans = fv[TL];

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

	return 0;
}

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

using namespace std;
using ll = long long;


struct block {
    int w, s, v;

    void read(){
        cin >> w >> s >> v;
    }

    bool operator <(const block &b){
        return w + s < b.w + b.s;
    }
};

const int maxn = 1e5;

int main()
{
    int n;
    cin >> n;
    vector<block> v(n);
    for(int i = 0; i < n; i++){
        v[i].read();
    }
    sort(v.begin(), v.end());
    vector<ll> dp(maxn + 1);
    for (int i = 0; i < n; i++){
        for (int j = min(v[i].s, maxn - v[i].w); j >= 0; j--){
            dp[v[i].w + j] = max(dp[v[i].w + j], dp[j] + v[i].v);
        }
    }
    ll ans = *max_element(dp.begin(), dp.end());
    cout << ans;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main ()
{
  int n,k,h;
  cin >> n >> k;
  vector<int> v,dp(n,0);
  for(int i=0;i<n;i++){
    cin >> h;
    v.push_back(h);
  }
  for(int i=1;i<min(k+1,n);i++){
    dp[i] = abs(v[0] - v[i]);
  }
  for(int i=k+1;i<n;i++){
    dp[i] = dp[i-k] + abs(v[i-k]-v[i]);
    for(int j=1;j<k+1;j++){
      dp[i]=min(dp[i],dp[i-j]+abs(v[i-j] - v[i]));
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 1276
#include <stdio.h>
#include <math.h>
int main(void){
    long n, sqrt_n;
    scanf("%ld\n", &n);
    
    sqrt_n = (int)sqrt(n);

    for (int i = sqrt_n; i > 0; i--)
    {
        if ( n % i == 0 )
        {
            printf("%ld\n", (i-1) + (n / i - 1));
            return(0);
        }
    }
    
    return(0);
}

Measured memory_bytes: 256
H,W=map(int,input().split())
S=[]
for i in range(0,H):
    S.append(input())

data1=[[0 for i in range(0,W)] for i in range(0,H)]
data2=[[0 for i in range(0,W)] for i in range(0,H)]
for i in range(0,H):
    sequence=[]
    length=0
    for j in range(0,W):
        if S[i][j]=='.':
            sequence.append(j)
            length+=1
        else:
            for k in sequence:
                data1[i][k]=length
            sequence=[]
            length=0
    if sequence!=[]:
        for k in sequence:
            data1[i][k]=length

for i in range(0,W):
    sequence=[]
    length=0
    for j in range(0,H):
        if S[j][i]=='.':
            sequence.append(j)
            length+=1
        else:
            for k in sequence:
                data2[k][i]=length
            sequence=[]
            length=0
    if sequence!=[]:
        for k in sequence:
            data2[k][i]=length

ans=0
for i in range(0,H):
    for j in range(0,W):
        test=data1[i][j]+data2[i][j]-1
        if test>ans:
            ans=test
print(ans)

Measured memory_bytes: 126808
// D - Lazy Faith
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
#define lower(v,x) lower_bound((v).begin(),(v).end(),(x))
#define INF (10000000000*2)

ll calc(vl &a, vl &b, ll x){
	ll mini = INF;
	auto apos = lower(a, x);
	for(int j=0; j<2; ++j){
		ll ax = *(apos - j);
		auto bpos = lower(b, ax);
		for(int k=0; k<2; ++k){
			ll bx = *(bpos - k);
			mini = min(mini, abs(x-ax) + abs(ax-bx));
		}
	}
	return mini;
}

int main(){
	int A,B,Q; cin>>A>>B>>Q;

	vl S(A+2, INF), T(B+2, INF);
	for(int i=1; i<=A; ++i) cin>>S[i];S[0] = -INF;
	for(int i=1; i<=B; ++i) cin>>T[i];T[0] = -INF;

	for(int i=0; i<Q; ++i){
		ll x; cin>>x;
		cout<< min(calc(S, T, x), calc(T, S, x)) <<endl;
	}
}

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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
#if DEBUG
  ll bstart = 20;
#else
  ll bstart = 1e9;
#endif
  vector<ll> v(N), a(N), b(N);
  for (ll i = 0; i < N; i++) {
    ll p; cin >> p; p--;
    v[p] = i;
  }
  a[0] = 1;
  b[0] = bstart;
  for (ll i = 0; i+1 < N; i++) {
    ll d = v[i+1] - v[i];
    if (d > 0) {
      a[i+1] = a[i] + d + 1;
      b[i+1] = b[i] - 1;
    }else {
      a[i+1] = a[i] + 1;
      b[i+1] = b[i] + d - 1;
    }
  }
  for (ll i = 0; i < N; i++) {
    if (i > 0) cout << " ";
    cout << a[i];
  }
  cout << "\n";
  for (ll i = 0; i < N; i++) {
    if (i > 0) cout << " ";
    cout << b[i];
  }
  cout << "\n";

  return 0;
}



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

int main(){
	int n,mi;
	while (1){
		mi = 100000000;
		cin >> n;
		if (!n) break;
		for (int i = 0; i <= n / 500; i++){
			for (int j = 0; j <= (n - i * 500) / 300; j++){
				if ((n - i * 500 - j * 300) % 200) continue;
				int k = (n - i * 500 - j * 300) / 200;
				mi = min(mi, (int)(380 * (k / 5) * 5 * 0.8 + 380 * (k % 5) + 550 * (j / 4) * 4 * 0.85 + 550 * (j % 4) + 850 * (i / 3) * 3 * 0.88 + 850 * (i % 3)));
			}
		}
		cout << mi << endl;
	}
	return 0;
}

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

namespace AOJ2
{
    class Program
    {
        class Point
        {
            public int X { get; set; }
            public int Y { get; set; }
        }

        static void Main(string[] args)
        {
            List<string> resultList = new List<string>();

            while (true)
            {
                int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                if (input[0] == 0 & input[1] == 0)
                    break;
                string[] row = new string[input[0]];
                for (int i = 0; i < input[0]; i++)
                {
                    row[i] = Console.ReadLine();
                }
                Point now = new Point();

                int finish = 0;
                while (finish == 0)
                {
                    switch (row[now.Y][now.X])
                    {
                        case '>':
                            row[now.Y] = row[now.Y].Remove(now.X, 1).Insert(now.X, "*");           
                            now.X++;
                            break;
                        case '<':
                            row[now.Y] = row[now.Y].Remove(now.X, 1).Insert(now.X, "*");
                            now.X--;
                            break;
                        case '^':
                            row[now.Y] = row[now.Y].Remove(now.X, 1).Insert(now.X, "*");
                            now.Y--;
                            break;
                        case 'v':
                            row[now.Y] = row[now.Y].Remove(now.X, 1).Insert(now.X, "*");
                            now.Y++;
                            break;
                        case '.':
                            finish = 1;
                            break;
                        case '*':
                            finish = 2;
                            break;
                    }
                }

                if (finish == 1)
                {
                    resultList.Add(string.Format("{0} {1}", now.X, now.Y));
                }
                else
                {
                    resultList.Add("LOOP");
                }


            }

            foreach (string s in resultList)
            {
                Console.WriteLine(s);
            }

        }


    }
}

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

void solve(string S){
	int cnt = 0;
	for(int i = 0; i + 1 < S.size(); ++i) {
		if(S[i] != S[i + 1]) {
			++cnt;
		}
	}
		cout << cnt << endl;
}

int main(){	
	string S;
	cin >> S;
	solve(S);
	return 0;
}



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

#define fi first
#define se second
#define ep emplace_back
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (b < a) a = b; }

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  string s, t; cin >> s >> t;

  int a = 0, b = 0;
  rep(i, si(s) + si(t)) {
    if (i % 2 == 0) cout << s[a++];
    else cout << t[b++];
  }

  cout << endl;
  
  return (0);
}

Measured memory_bytes: 3608
#include<cstdio>
#include<cmath>
#define MAX_SIZE 10000

int main() {
  int size;
  int current_num;
  int min_num, max_num;
  long long int sum;

  scanf("%d", &size);
  scanf("%d", &current_num);

  min_num = max_num = sum = current_num;

  for(int i = 1; i < size; i++) {
    scanf("%d", &current_num);

    if (current_num < min_num) {
      min_num = current_num;
    }

    if (current_num > max_num) {
      max_num = current_num;
    }

    sum += current_num;
  }

  // unsinged long => %lu
  // unsigned long long => %llu
  printf("%d %d %lld\n", min_num, max_num, sum);
}



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

#define INF 0x7fffffff
#define ll  long long

int main() {
  int n, w;
  cin >> n >> w;
  vector<vector<ll>> dp(n+1 , vector<ll>(w+1) );
  vector<ll> ww(n+1), v(n+1);

  for(int i=1;i<=n;i++) {
    cin >> ww[i] >> v[i]; 
  }

  //dp[i][j]はi番目までの品物で重さの総和がj以下となるように選んだ時の価値の総和の最大値
  for(int i=1;i<=n;i++) {
    for(int j=1;j<=w; j++) {
      if (ww[i] > j) {
        dp[i][j] = dp[i-1][j];
      } else {
        dp[i][j] = max(dp[i-1][j] , dp[i-1][j-ww[i]] + v[i]);
      }
    }
  }
  cout << dp[n][w] << endl;
}


Measured memory_bytes: 80256
import sys
import copy
import  math
import bisect
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

s = input()
print('Yes' if s == s[::-1] else 'No')


Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
       if(x%i==0)return false;
   }return true;
}bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline int readint() {
    int f=1,x=0; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch<='9'&&ch>='0') x=x*10+ch-'0',ch=getchar();
    return f*x;
}
inline ll readll() {
    ll f=1,x=0; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch<='9'&&ch>='0') x=x*10+ch-'0',ch=getchar();
    return f*x;
}
void fl(string name){
    freopen((name+".in").c_str(),"r",stdin);
    freopen((name+".out").c_str(),"w",stdout);
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
          dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
#define MAXN 200010
ll n,d,x[MAXN],y[MAXN];
int main(){
    cin>>n>>d;
    for(int i=1;i<=n;i++){
        cin>>x[i]>>y[i];
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
        double p=sqrt(x[i]*x[i]*1.0+y[i]*y[i]*1.0)*1.0;
        if(p<=d)ans++;
    }
    cout<<ans<<endl;
    return 0;
}
/* stuff to remember
    * int overflow, array bounds
    * special cases (n=1? n=0?)
    * do something instead of nothing and stay organized
    * USE STATIC ARRAYS
    * DEFINING ARRAYS BEFORE main()
    * DO NOT DEFINE ARRAYS IN main()
    * USE INT INSTEAD OF LL,NOTICE THE MLE
*/

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

int main() {
	int n;
	int a[200];

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

	int count = 0;
	bool b = true;
	while (true) {
		for (int i = 0; i < n; i++) {
			if ((a[i] % 2) != 0) {
				b = false;
				break;
			}
		}
		if (b == false) break;
		else {
			count++;
			for (int i = 0; i < n; i++) a[i] /= 2;
		}
	}
	cout << count << endl;
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 2e5 + 575;

int N;

int incMemo[MAX_N];
int decMemo[MAX_N];

int p[MAX_N];
int data[MAX_N];

int getInc(int n) {
  if (incMemo[n] > 0) return incMemo[n];
  if (n == N) return 0;
  
  int res = 0;
  if (data[n + 1] > data[n]) {
    res += getInc(n + 1);
  }
  /*
  FOR(i, data[n], N) {
    if (p[i] == n + 1) {
      res += getInc(n + 1);
      break;
    }
  }
  */

  return incMemo[n] = res + 1;
}

int getDec(int n) {
  if (decMemo[n] > 0) return decMemo[n];

  if (n == 0) return 0;
  int res = 0;
  if (data[n - 1] < data[n]) {
    res += getDec(n - 1);
  }
  
  /*
  RREP(i, data[n]) {
    if (p[i] == n - 1) {
      res += getDec(n - 1);
      break;
    }
  }
  */

  return decMemo[n] = res + 1;
}

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

  cin >> N;
  REP(i, N) {
    cin >> p[i];
    p[i]--;
    data[p[i]] = i;
  }

  memset(incMemo, -1, sizeof(incMemo));
  memset(decMemo, -1, sizeof(decMemo));
  
  RREP(i, N) {
    getInc(i);
  }

  REP(i, N) {
    getDec(i);
  }

  int ans = -1;
  REP(i, N) {
    ans = max(ans, incMemo[i]);
    ans = max(ans, decMemo[i]);
  }

  
  ans = N - ans;
  cout << ans << endl;
  // cout << ans << endl;
  // debug(N - ans);

  /*
  REP(i, N) {
    printf("inc[%d] : %d\n", i, incMemo[i]);
  }

  printf("\n");
  REP(i, N) {
    printf("dec[%d] : %d\n", i, decMemo[i]);
  }
  */

  return 0;
}



Measured memory_bytes: 3456
import sys
sys.setrecursionlimit(10**9)

def dfs(s, targets):
    global K
    visited[s] = True
    # print(targets)
    for t in targets:
        if visited[t]:
            continue
        mab = max(G3[s], G3[t])
        while (mab in G2[s]) or (mab in G2[t]):
            mab += 1
        K = max(K, mab)
        ans[p2i[(s, t)]]= mab
        G2[s].add(mab)
        G2[t].add(mab)
        while G3[s] in G2[s]:
            G3[s] += 1
        while G3[t] in G2[t]:
            G3[t] += 1
        dfs(t, G[t])

K = 0
N = int(input())
G = [[] for i in range(N+1)]
G2 = [set() for i in range(N+1)]
p2i = {}
visited = [False for i in range(N+1)]
ans = [0 for i in range(N-1)]
G3 = [1] * (N+1)
for i in range(N-1):
    a, b = map(int, input().split())
    p2i[(a, b)] = i
    p2i[(b, a)] = i
    G[a].append(b)
    G[b].append(a)
# print(max(p2i.values()))
s = 1
targets = G[s]
dfs(s, targets)
print(K)
for a in ans:
    print(a)

Measured memory_bytes: 154268
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int W = sc.nextInt();
		int H = sc.nextInt();
		int N = sc.nextInt();

		int left = 0;
		int right = W;
		int bottom = 0;
		int top = H;

		for (int i = 0; i < N; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int a = sc.nextInt();

			switch (a) {
			case 1:
				left = Math.max(left, x);
				break;
			case 2:
				right = Math.min(right, x);
				break;
			case 3:
				bottom = Math.max(bottom, y);
				break;
			case 4:
				top = Math.min(top, y);
				break;
			}
		}

		if (left >= right || bottom >= top) {
			out.println(0);
		} else {
			out.println((right - left) * (top - bottom));
		}
		sc.close();

	}

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

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}

	@SuppressWarnings("unused")
	private int[] nextIntArray1origin(Scanner sc, int n) {
		int[] result = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
}


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

int main()
{
    string s;
    cin >> s;
    string a = s;
    reverse(a.rbegin(), a.rend());
    int t = s.length();
    int ans = 0;
    rep(i, t)
    {
        if (s[i] != a[i])
        {
            ans++;
        }
    }
    cout << (ans / 2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int n, m;
    cin >> n >> m;
    vector<string> a(n), b(m);
    for (int i=0; i<n; i++) cin >> a[i];
    for (int i=0; i<m; i++) cin >> b[i];
    
    bool ans = false;
    for (int y=0; y<=n-m; y++) {
        for (int x=0; x<=n-m; x++) {
            bool f = true;
            for (int i=0; i<m; i++) {
                if (a[y+i].substr(x, m) != b[i])
                    f = false;
            }
            if (f) ans = true;
        }
    }
    
    cout << (ans?"Yes":"No") << endl;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

int n;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	map<string, int> cnt;
	cin >> n;
	cnt["AC"] = cnt["WA"] = cnt["TLE"] = cnt["RE"] = 0;
	for(int i = 0; i < n; i++){
		string str;
		cin >> str;
		cnt[str]++;
	}
	cout << "AC x " << cnt["AC"] << "\n";
	cout << "WA x " << cnt["WA"] << "\n";
	cout << "TLE x " << cnt["TLE"] << "\n";
	cout << "RE x " << cnt["RE"] << "\n";
	return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

int main(void){
  int N;
  scanf("%d", &N);
  int a[N];
  int c[100002]={};

  for(int i=0; i<N; i++){
    scanf("%d", &a[i]);
    c[a[i]]++;
  }

  long long ans = 1;
  
  if(c[0] != 1) {
    printf("0");
    return 0;
  }

  if(a[0] != 0) {
    printf("0");
    return 0;
  }

  for(int i=0; i<100001; i++){
    if(c[i] == 0 && c[i+1] != 0){
      printf("0");
      return 0;
    }
  }

  for(int i=0; i<100001; i++){
    ans = (ans * modpow(c[i], c[i+1], 998244353)) % 998244353;
  }

  printf("%lld", ans); 
  return 0;
}


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

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    long long int x;

    cin >> x ;

    long long int h = x/500 * 1000;
    x = x%500;
    h+=x/5 * 5;

    cout << h << endl;


    return 0;
}


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

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

  set<int> already;
  bool can = false;
  int total = 0;
  for (int i = a; true; i += a) {
    total += a;
    int mod = total % b;
    if (mod == c) {
      can = true;
      break;
    } else {
      if (already.count(mod)) {
        break;
      } else {
        already.insert(mod);
      }
    }
  }

  string ans;
  if (can) {
    ans = "YES";
  } else {
    ans = "NO";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(200010, 1e8);
    int size = 0;
    rep(i, n) {
        int tmp_a;
        cin >> tmp_a;
        if ( a[tmp_a] == 1e8 ) {
            a[tmp_a] = 1;
            ++size;
        }
        else {
            ++a[tmp_a];
        }
    }
    sort(a.begin(), a.end());
    if ( size <= k ) {
        cout << 0 << endl;
    }
    else {
        int ans = 0;
        rep(i, size - k ) {
            ans += a[i];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>

int main(){
    double x1,y1,x2,y2;
    double i,j,k;
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    i = pow((x2-x1),2.0);
    j = pow((y2-y1),2.0);
    k = sqrt(i+j);

    printf("%f\n",k);
    return 0;
}


Measured memory_bytes: 2100
def BinarySearch(list, x):
    l = 0
    r = len(list)
    while l < r:
        m = (l+r)//2
        if list[m] == x:
            return True
        elif x < list[m]:
            r = m
        else:
            l = m+1
    return False


a = int(input())
listA = list(map(int, input().split()))
b = int(input())
listB = list(map(int, input().split()))
total = 0

for i in listB:
    if BinarySearch(listA, i):
        total += 1

print(total)


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

main()
{
    int h,w,m; cin>>h>>w>>m;
    vector<int> r(h),c(w);
    set<pair<int,int>> s;
    for(;m--;)
    {
        int a,b; cin>>a>>b;
        a--,b--;
        r[a]++;
        c[b]++;
        s.emplace(a,b);
    }
    int mr=*max_element(begin(r), end(r));
    int mc=*max_element(begin(c), end(c));
    vector<int> rr,cc;
    for(int i=0;i<h;i++) if(r[i]==mr) rr.emplace_back(i);
    for(int i=0;i<w;i++) if(c[i]==mc) cc.emplace_back(i);
    for(int i:rr)
    {
        for(int j:cc)
        {
            if(s.count({i,j})) continue;
            cout<<mr+mc<<endl;
            return 0;
        }
    }
    cout<<mr+mc-1<<endl;
}


Measured memory_bytes: 23868
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <climits>
#include <cfloat>
#include <algorithm>
using namespace std;

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

int main()
{
	vector<string> s(8);
	for(int i=0; i<8; ++i)
		cin >> s[i];

	bool ng = false;
	char my = 'o';
	char your = 'x';
	for(;;){
		int y0;
		int x0;
		int maxNum = 0;
		for(int i=0; i<8; ++i){
			for(int j=0; j<8; ++j){
				if(s[i][j] != '.')
					continue;
				int num = 0;
				for(int k=0; k<8; ++k){
					int y = i + dy[k];
					int x = j + dx[k];
					while(0 <= y && y < 8 && 0 <= x && x < 8 && s[y][x] == your){
						y += dy[k];
						x += dx[k];
					}
					if(0 <= y && y < 8 && 0 <= x && x < 8 && s[y][x] == my){
						num += max(abs(y - i) - 1, abs(x - j) - 1);
					}
				}
				if((my == 'o' && num > maxNum) || (my == 'x' && num >= maxNum)){
					maxNum = num;
					y0 = i;
					x0 = j;
				}
			}
		}

		if(maxNum == 0){
			if(ng)
				break;
			ng = true;
		}else{
			ng = false;
			s[y0][x0] = my;
			for(int i=0; i<8; ++i){
				int y = y0 + dy[i];
				int x = x0 + dx[i];
				while(0 <= y && y < 8 && 0 <= x && x < 8 && s[y][x] == your){
					y += dy[i];
					x += dx[i];
				}
				if(0 <= y && y < 8 && 0 <= x && x < 8 && s[y][x] == my){
					y = y0 + dy[i];
					x = x0 + dx[i];
					while(0 <= y && y < 8 && 0 <= x && x < 8 && s[y][x] == your){
						s[y][x] = my;
						y += dy[i];
						x += dx[i];
					}
				}
			}
		}

		swap(my, your);
	}

	for(int i=0; i<8; ++i)
		cout << s[i] << endl;
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){

int q;
cin >> q;

for(int i = 0; i<q; i++){

ll a,b;
cin >> a >> b;

ll c =   sqrt(a*b);         // cの2乗はa*bよりも小さい,最大の値をとる

if(a == b)                    cout << 2*(c-1) << endl; 
else if((a*b) == (c*c) )  cout << 2*(c-1)-1 << endl; 
else{ 
if(c*(c+1) < a*b)         cout << 2*c -1 << endl;
else                           cout << 2*c -2 << endl;
   }
 }
return 0;
}

Measured memory_bytes: 256
H, W, K = list(map(int, input().split()))
import numpy as np
a = np.full((H, W), '.')
for i in range(H):
    a[i] = list(input())



def check(a, p_r, p_c):
    a2 = a.copy()
    for i, s in enumerate(p_r):
        if s=='1':
            a2[i] = 'r'
    for i, s in enumerate(p_c):
        if s=='1':
            a2[:,i] = 'r'

    return np.sum(a2=='#')



result = 0
n = H+W
for i in range(2**n):
    pattern = format(i, '0%db'%n)
    p_r = pattern[:H]
    p_c = pattern[H:]
    if check(a, p_r, p_c) == K:
        result += 1

print(result)

Measured memory_bytes: 27204
import           Control.Applicative
import           Control.Monad
import qualified Data.ByteString.Char8 as B
import           Text.Printf

readi :: B.ByteString -> Int
readi b | Just (n, _) <- B.readInt b = n

type Vector = (Double, Double)

add :: Vector -> Vector -> Vector
add (a, b) (c, d) = (a + c, b + d)

sub :: Vector -> Vector -> Vector
sub (a, b) (c, d) = (a - c, b - d)

mult :: Vector -> Double -> Vector
mult (a, b) k = (k * a, k * b)

dot :: Vector -> Vector -> Double
dot (a, b) (c, d) = a * c + b * d

norm :: Vector -> Double
norm (a, b) = a * a + b * b

project :: Vector -> Vector -> Vector -> Vector
project (a, b) (c, d) (e, f) = (a, b) `add` (base `mult` r)
  where
    base = (c - a, d - b)
    hypo = (e - a, f - b)
    r = (hypo `dot` base) / norm base

reflect :: Vector -> Vector -> Vector -> Vector
reflect p1 p2 p = p `add` ((project p1 p2 p `sub` p) `mult` 2.0)

main :: IO ()
main = do
    [a,b,c,d] <- fmap (fromIntegral . readi) . B.words <$> B.getLine
    q <- readLn
    let p1 = (a, b)
    let p2 = (c, d)
    replicateM_ q $ do
        [x, y] <- fmap (fromIntegral . readi) . B.words <$> B.getLine
        let (ax, ay) = reflect p1 p2 (x, y)
        printf "%.8f %.8f\n" ax ay



Measured memory_bytes: 4320
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	bool t[4][4] = { 0 };
	REP(i, 3) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		t[a][b] = 1;
		t[b][a] = 1;
	}
	REP(i, 4) {
		int d[4] = { 0 };
		d[i] = 1;
		int k = i;
		while (k >= 0) {
			REP(j, 5) {
				if (j == 4) {
					if (d[k] == 4) {
						cout << "YES\n";
						return 0;
					}
					else k = -1;
				}
				else if (!d[j] && t[k][j]) {
					d[j] = d[k] + 1;
					k = j;
					break;
				}
			}
		}
	}
	cout << "NO\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#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 fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



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

    int n;
    cin>>n;
    vector<double> v(n);
    rep(i,n)cin>>v[i];
    double ans=0;
    double sum=1;
    for(int i=0;i<n;i++)sum*=v[i];
    for(int i=0;i<n;i++){
        ans+=sum/v[i];
    }
    ans=sum/ans;
    printf("%7f\n",ans);

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
//kuch tho karna hai 
#include<bits/stdc++.h>
using namespace std;  
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n; i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  IOS;
  int T=1;
  // cin >> T;
  while(T--){
    int n , k;
    cin >> n >> k;
    fn{
      cin >> ar[i];
    }
    sort(ar,ar+n);
    cout << accumulate(ar,ar+k,0ll);
  
  
  }
  return 0;
}

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

typedef long long ll;

#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define AA(i) cout << i << endl;
#define AS(i) cout << i << " ";

const int INF = 1001001001;
const double PI = 3.14159;

using namespace std;

int main() {

    int n;
    cin >> n;

    int a = 0;

    while (a < n) {
        a += 1000;
    }

    AA(a - n);
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include<math.h>
#include<bits/stdc++.h>
#include <map>
#include <algorithm>
#include <cmath>



using namespace std;
const int INF = 1e9+7;
long long dp1[1100][1100];
char in[1100][1100];
long long mod = 1e9+7;

int main(){
    int r,c;
    cin>>r>>c;
    for(int i=0;i<r;i++){
        cin>>in[i];
    }
    dp1[0][0] = 1;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            if(in[i][j]=='#')dp1[i][j] = 0;
            else {
                if(i-1>=0)dp1[i][j] =(dp1[i-1][j] + dp1[i][j])%mod;
                if(j-1>=0)dp1[i][j] = (dp1[i][j-1] + dp1[i][j])%mod;
            }
        }
    }
    cout<<(dp1[r-1][c-1])<<endl;;
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int main()
{
	int k;
	cin>>k;
	cout<<k*2/__gcd(k,2);
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    int cnt = 0;
    bool ok = false;
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        if (a == b) ++cnt;
        else        cnt = 0;
        if (cnt == 3) ok = true;
    }
    if (ok) cout << "Yes" << endl;
    else    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int D = scan.nextInt();
		int T = scan.nextInt();
		int S = scan.nextInt();
		scan.close();

		double num = (double)D / S;
		if(T >= num) {
			System.out.println("Yes");
		}else if(T < num) {
			System.out.println("No");

		}
	}

}


Measured memory_bytes: 35768
#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int s[100005],is[100005];
int main(){jizz
	int q;cin >> q;
	for(int i = 2; i <= 100000 ;i++){
		if(is[i] == 0){
			for(lld j = 1LL*i*i ; j <= 100005 ; j+=i){
				is[j] = 1;
			}
			if(!is[(i+1)/2]){
				s[i]++;
				if(i == 2)s[i]--;
			}	
		}
		s[i] += s[i-1];
	}
	while(q--){
		int l,r;cin >> l >> r;
		cout << s[r]-s[l-1] <<endl;
	}	
	return 0;
}


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

int main(){
	string s;
	cin >> s;
	vector<int> num(s.size());
	for(int i=0; i < s.size(); i++) {
		num.at(i) = s.at(i) - '0';
	}
	for(int i=0; i < (1 << 3); i++) {
		int sum = num.at(0);
		string res = "";
		res += s.at(0);
		for(int j=1; j < s.size(); j++) {
			if(i & (1 << (j-1))) {
				sum -= num.at(j);
				res += "-" + to_string(num.at(j));
			}else{
				sum += num.at(j);
				res += "+" + to_string(num.at(j));
			}
		}
		if(sum == 7) {
			cout << res + "=7" << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 384