akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>


int f[45];


int initArray(int *a, int l, int key) {
  int i;
  for( i=0; i<l; i++) {
    a[i] = key;
  }
}
  

int fibonacci(int n) {
  
  if( f[n] == -1 ) {
    if(n == 0 || n == 1) {
      f[n] = 1;
    }
    else {
      f[n] = fibonacci(n-1) + fibonacci(n-2);
    }
  }

  return f[n];

}


main() {
  
  int n;

  scanf("%d", &n);

  initArray( f, 45, -1);

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

  return 0;

}

Measured memory_bytes: 596
#include <iostream>
#include <map>
#include <ctime>
#include <vector>
#include <climits>
#include <algorithm>
#include <random>
#include <cstring>
#include <cstdio>
#include <map>
#include <set>
#include <bitset> 
#include <queue>
#define inf 0x3f3f3f3f
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define rep(i, a, n) for(register int i = a; i <= n; ++ i)
#define per(i, a, n) for(register int i = n; i >= a; -- i)
#define ONLINE_JUDGE
using namespace std;
typedef long long ll;
const int mod=1e9+7;
template<typename T>void write(T x)
{
    if(x<0)
    {
        putchar('-');
        x=-x;
    }
    if(x>9)
    {
        write(x/10);
    }
    putchar(x%10+'0');
}
 
template<typename T> void read(T &x)
{
    x = 0;char ch = getchar();ll f = 1;
    while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
    while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;};
ll ksm(ll a,ll n){//看是否要mod 
	ll ans=1;
	while(n){
		if(n&1) ans=(ans*a)%mod;
		a=a*a%mod;
		n>>=1;
	}
	return ans%mod;
}
//==============================================================
const int maxn=1e5+10;
struct ti{
    ll x,y,c;
};
ti da[maxn];
ll a[maxn],b[maxn];
ll A,B,M;


int main()
{
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	clock_t c1 = clock();
	//===========================================================
	read(A),read(B),read(M);
    ll ma=inf,mb=inf;
    rep(i,1,A){
        read(a[i]);
        ma=min(a[i],ma);
    }
    rep(i,1,B){
        read(b[i]);
        mb=min(b[i],mb);
    }
    ll ans=ma+mb;
    rep(i,1,M){
        int x,y,c;
        read(x),read(y),read(c);
        ans=min(ans,a[x]+b[y]-c);
    }
    write(ans);
	//===========================================================
	std::cerr << "Time:" << clock() - c1 << "ms" << std::endl;
	return 0;
}

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

int main(){
    int n,m;
    cin>>n>>m;
    int ans=m*1900+(n-m)*100;
    ans*=pow(2,m);
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const ll MOD { 1000000007 };

ll gcd(ll a, ll b)
{
    return b ? gcd(b, a % b) : a;
}

ll fast_exp(ll a, ll n)
{
    ll res = 1, base = a;

    while (n)
    {
        if (n & 1)
            res = (res * base) % MOD;

        base = (base * base) % MOD;
        n >>= 1;
    }

    return res;
}

ll solve(int N, const vector<ii>& xs)
{
    map<ii, vector<int>> ab, ba;
    set<int> ys;
    int zeroes = 0;

    for (int i = 0; i < N; ++i)
    {
        auto a = xs[i].first, b = xs[i].second;
        
        if (a == 0 and b == 0)
        {
            ++zeroes;
            continue;
        }

        auto sa = a < 0 ? -1 : 1;
        auto sb = b < 0 ? -1 : 1;
        auto signal = sa * sb;

        a = llabs(a);
        b = llabs(b);

        auto d = gcd(a, b);
        a /= d;
        b /= d;

        ab[ii(signal*a, b)].push_back(i);
        ba[ii(-signal*b, a)].push_back(i);
        ys.insert(i);
    }

    ll ans = 1;

    for (auto p : ab)
    {
        if (ys.count(p.second.back()) == 0)
            continue;

        auto it = ba.find(p.first);

        if (it == ba.end())
        {
            ans = (ans * fast_exp(2, p.second.size())) % MOD;

            for (auto x : p.second)
                ys.erase(x);
        } else
        {
            ll r = fast_exp(2, p.second.size());
            ll s = fast_exp(2, it->second.size());
            ll t = ((((r + s - 1) % MOD) + MOD) % MOD);
            ans = (ans * t) % MOD;

            for (auto x : p.second)
                ys.erase(x);
            
            for (auto x : it->second)
                ys.erase(x);
        }
    }

    ans = ((((ans - 1) % MOD) + MOD) % MOD);

    if (zeroes)
        ans = (ans + zeroes) % MOD;

    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<ii> xs(N);

    for (int i = 0; i < N; ++i)
        cin >> xs[i].first >> xs[i].second;

    auto ans = solve(N, xs);

    cout << ans << '\n';

    return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vec(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    vec.at(a)++;
    vec.at(b)++;
  }
  rep(i, n) cout << vec.at(i) << endl;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define test ll t; cin>>t; while(t--)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define M 1000000007LL
#define input(v,n) inc(i,0,n){ll x; cin>>x; v.pb(x);}
#define print(v,n)   inc(i,0,n){cout<<v[i]<<" ";}
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define inc(i,a,n) for (ll i=a;i<n;i++)
#define dec(i,a,n) for (ll i=n-1;i>=a;i--)
long long binpow(long long base, long long exp, long long  mod) {
   long long res = 1;
   while (exp > 0) {
      if (exp % 2 == 1)
         res= (res * base) % mod;
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}
long long mod(long long x){
return ((x%M+M)%M);
}

long long add(long long a, long long b){
return mod(mod(a)+mod(b));
}

long long mul(long long a, long long b){
return mod(mod(a)*mod(b));
}
void solve(ll n)
{
    ll dp[n+1]={0};
  dp[0]=dp[1]=dp[2]=0,dp[3]=1;
  if(n>3)
  {
    inc(i,4,n+1)
    {
       ll temp=i-3LL;
       ll ans=0;
       while(temp>=0)
       {
             ans+=dp[temp];
             ans=ans%M;

             temp--;
       }
       dp[i]=(ans+1)%M;
    }
  }
  cout<<dp[n];
}

int main()
{
  ll n;
  cin>>n;
  solve(n);

 
   return 0;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a+b<c+d){
    cout<<"Right"<<endl;
  }
  if(a+b>c+d){
    cout<<"Left"<<endl;
  }
  if(a+b==c+d){
    cout<<"Balanced"<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int A, B, C;
	int K;
	
	cin>>A>>B>>C;
	cin>>K;
	
	for(int i = 0; i <= K; i++){
		for(int j = 0; i + j <= K; j++){
			int b = B<<i;
			int c = C<<j;
			
			if(A < b && b < c) {
				// cout<<A<<" "<<B<<" "<<C<<endl;
				// cout<<"i = "<<i<<" j = "<<j<<endl;
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	
	
	cout<<"No"<<endl;
	
	return 0;
}

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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;

int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vi x(m);
    rep(i, m)cin >> x[i];
    sort(all(x));
    debug("a")
    vi d;
    rep(i, m-1)d.pb(x[i+1] - x[i]);
        debug("a")

    sort(all(d));
    int ans = 0;
    rep(i, m-1-(n-1))ans+=d[i];
        debug("a")

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1276
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
using namespace std;
int n;
string s;
int main (){
    cin >> s;
    // cout << s << endl;
    n = s.length();
    // cout << n << endl;
    for (int i=n-2; i; i-=2){
        if ((s.substr(0,(i/2)))==(s.substr((i/2),(i/2)))) {
            cout << i << endl;
            return 0;
    // cout << 0 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, t;
  cin >> n >> t;
  vector<P> p(n);
  rep(i, n) cin >> p[i].first >> p[i].second;
  sort(all(p));
  vi a(n), b(n);
  rep(i, n) {
    a[i] = p[i].first;
    b[i] = p[i].second;
  }
  int dp[t][2] = {};
  rep(i, n) for(int j = t - 1; j >= 0; j--) rep(k, 2) {
    if(dp[j][k] == -1) continue;
    int nj = j + a[i];
    if(k) {
      if(nj < t) dp[nj][1] = max(dp[nj][1], dp[j][1] + b[i]);
    } else {
      if(nj < t)
        dp[nj][0] = max(dp[nj][0], dp[j][0] + b[i]);
      else
        dp[j][1] = max(dp[j][1], dp[j][0] + b[i]);
    }
  }
  int ans = 0;
  rep(j, t) rep(k, 2) ans = max(ans, dp[j][k]);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using i64 = long long;

int main() {
    int n;
    std::string s;
    std::cin >> n >> s;

    std::vector<int> ss { 0 };
    for (const char c : s) ss.push_back(ss.back() + (c == 'R'));
    const int rs = ss.back();

    int ret = n;
    for (int i = 0; i <= n; i++) {
        const int pw = i - ss[i], sr = rs - ss[i];
        ret = std::min(ret, std::max(pw, sr));
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 4508
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double n = sc.nextDouble();
		double sum = 0;
		if (a % b ==0) {
			System.out.println(0);
			return;
		}
		if (n < b) {
			sum = calc(a,b,n);
			System.out.println((long)sum);
			return;
		} else if (n == b) {
			sum = calc(a,b,n-1);
			System.out.println((long)sum);
			return;
		} else {
			ArrayList<Double> list = new ArrayList<>();
			long size = (long)(n + 1)/ (long) b;
			for (int i = 1; i <= size; i++) {
				list.add(calc(a,b,i*b-1));
			}
			System.out.println(Collections.max(list).longValue());
		}
	}

	private static double calc(double a, double b, double n) {
		return Math.floor(a*n/b) - a*Math.floor(n/b);
	}

}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, a[101010];
void solve(){
	cin >> n;
	i64 ans = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(a[i] == 0) continue;
		if(i != 0){
			a[i] -= (a[i-1]&1);
			ans += (a[i-1]&1);
		}
		ans += a[i]/2;
	}
	
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


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

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

  int a, b, k;
  cin >> a >> b >> k;
  int c = b - a + 1;
  set<int> res;
  for (int i = 0; i < min(k, c); i++) {
    res.insert(a + i);
    res.insert(b - i);
  }
  for (const int &r : res) {cout << r << '\n';}
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

vector<pair<int,double> > way[SIZE];

int main(){
  int xs,ys,xt,yt;
  int n,x[SIZE],y[SIZE],r[SIZE];

  scanf("%d%d%d%d%d",&xs,&ys,&xt,&yt,&n); 
  
  for(int i=0;i<n;i++){
    scanf("%d%d%d",x+i,y+i,r+i);
  }
  x[n] = xs;
  y[n] = ys;
  x[n+1] = xt;
  y[n+1] = yt;
  r[n] = r[n+1] = 0;


  for(int i=0;i<n+2;i++){
    for(int j=i+1;j<n+2;j++){
      double dis = sqrt((ll)(x[i]-x[j])*(x[i]-x[j]) + (ll)(y[i]-y[j])*(y[i]-y[j]));
      
      dis = max(0.0, dis - r[i] - r[j]);

      way[i].push_back({j,dis});
      way[j].push_back({i,dis});
    }
  }

  priority_queue<pair<double,int> > pq;
  bool used[SIZE] = {};
  
  pq.push({0,n});
  
  while(pq.size()){
    pair<double,int> p = pq.top();
    pq.pop();

    double dis = p.first;
    int now = p.second;

    if(used[now]) continue;
    used[now] = true;
    
    if(now == n+1){
      if(abs(dis) < 1e-12){
        printf("%.10lf\n",0.0);
      }else{
        printf("%.10lf\n",-dis);
      }
      return 0;
    }

    for(int i=0;i<(int)way[now].size();i++){
      pq.push({dis-way[now][i].second, way[now][i].first});
    }
  }

  printf("-1");

  assert(false);
  
  return 0;
}


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

using lint = long long;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<vector<T>>;
template <typename T> using VVV = vector<vector<vector<T>>>;
#define rep(i, n) for(int i = 0; i < int(n); i++)
#define repu(i, a, b, s) for(int i = int(a); i < int(b); i += int(s))
#define repd(i, a, b, s) for(int i = int(a); i > int(b); i += int(s))
#define endl "\n"
constexpr lint INF = 2e18;
constexpr lint MOD = 1e9 + 7;

void solve() {
    lint n;
    cin >> n;

    lint ans;
    if(n == 1) {
        ans = 2;
    } else if(n == 2) {
        ans = 2;
    } else {
        if(n % 2 == 0) {
            ans = n;
        } else {
            ans = n * 2;
        }
    }

    cout << ans << endl;
}

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

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

import sys
import os


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

# query
q = int(input())
M = list(map(int, input().split()))

# i x m matrix
memo = [[None for i in range(2000)] for j in range(n + 1)]

def solve(i, m):
    if memo[i][m] is not None:
        return memo[i][m]
    #print('i', i, 'm', m)

    # i????????\???????????????????????£???m??????????????¨???true
    # i = 0, ..., n-1
    if m == 0:
        return True
    elif i >= n:
        return False
    else:
        # Devide and Conquer

        # i??????????????°??????
        res0 = solve(i + 1, m)
        # i??????????????¶
        res1 = solve(i + 1, m - A[i])

        if res0 or res1:
            memo[i][m] = True
            return True
        else:
            memo[i][m] = False
            return False


# main
for m in M:
    result = solve(0, m)
    if result:
        print('yes')
    else:
        print('no')

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

int n,i,ans,x;
int A[200010];

int main(){
	
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>A[i];
	x=1;
	int bj=0;
	for(i=1;i<=n;i++){
		if(A[i]==x){
			x++;
			bj=1;
		}
		else{
			ans++;
		}
	}
	if(bj==0){
		cout<<"-1"<<endl;
		return 0;
	}
	cout<<ans<<endl;
	
	return 0;
}

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

int main()
{
    int N;
    cin >> N;
    int P[N];
    int M[N];
    for (int i = 0; i < N; i++)
    {
        cin >> P[i];
    }
    M[0] = P[0];
    for (int i = 0; i < N - 1; i++)
    {
        if (M[i] < P[i + 1])
        {
            M[i + 1] = M[i];
        }
        else
        {
            M[i + 1] = P[i + 1];
        }
    }
    int cnt = 1;
    for (int i = 0; i < N - 1; i++)
    {
        if (M[i] > P[i + 1])
        {
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  lint N;
  cin>>N;
  for(int i=int(sqrt(N))+1;i>0;i--){
    if(N%i==0){
      // cout<<N/i<<endl;
      cout<<to_string(N/i).size()<<endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
    ll l,r,d;
    cin>>l>>r>>d;
    ll no1 = r/d;
    ll no2 = (l+d-1)/d;
    cout<<no1-no2+1<<"\n";
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;
#define sv vector<string>

int main() {
	int n,m;

	string str;
	sv blues;
	int count[100]={};

	cin >> n;
	for (int i=0;i<n;i++) {
		cin >> str;
		for (int j=0;j<blues.size();j++)
			if (blues[j]==str) {
				count[j]++;
				goto lp1end;
			};

		blues.push_back(str);
		count[blues.size()-1]++;

		lp1end:;
	}
	
	cin >> m;
	for (int i=0;i<m;i++) {
		cin >> str;
		for (int j=0;j<blues.size();j++)
			if (blues[j]==str) {
				count[j]--;
				goto lp2end;
			};

		lp2end:;

	}
	
	int max=0;
	for (int i=0;i<blues.size();i++)
		if (count[i] > max) max=count[i];

	cout << max << endl;

	return 0;
}


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

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

    if ((S == "AAA") | (S == "BBB")) cout << "No" << endl;
    else cout << "Yes" << endl;

    return 0;
}



Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))

s=[]
ordn=[]
for i in range(n+1):
    ordn.append(-1)

v=1
while(ordn[v] == -1):
    ordn[v]=len(s)
    s.append(v)
    v=a[v-1]

c=len(s)-ordn[v]
l=ordn[v]

if k<l:
    print(s[k])
else:
    k -= l
    k%=c
    print(s[l+k])

Measured memory_bytes: 32380
#include <stdio.h>
#include <vector>
#include <utility>
#include <queue>
#include <string.h>
using namespace std;
const int MAXN=1e2+10;
const int INF=1e9+10;
const long long int INF_FLOW=1e16+10;
struct edge{
    int to,re;
    long long int cap;
};
vector<edge> flow[MAXN];
int dep[MAXN],went[MAXN],iter[MAXN];
long long int min(long long int a,long long int b){return a<b?a:b;}
void addedge(int u,int v,long long int cap){
    flow[u].push_back({v,(int)flow[v].size(),cap});
    flow[v].push_back({u,(int)flow[u].size()-1,0});
    return ;
}
void bfs(int s,int cnt){
    int nxt;
    queue<int> q;
    q.push(s);
    dep[s]=iter[s]=0;
    went[s]=cnt;
    while(!q.empty()){
        nxt=q.front();
        q.pop();
        for(edge i:flow[nxt])if(i.cap>0&&went[i.to]!=cnt){
            dep[i.to]=dep[nxt]+1;
            went[i.to]=cnt;
            iter[i.to]=0;
            q.push(i.to);
        }
    }
    return ;
}
long long int dfs(int u,int t,long long int nf){
    if(u==t)return nf;
    long long int temp;
    for(int &i=iter[u];i<flow[u].size();i++)if(flow[u][i].cap>0&&dep[flow[u][i].to]==dep[u]+1){
        temp=dfs(flow[u][i].to,t,min(nf,flow[u][i].cap));
        if(temp>0){
            flow[flow[u][i].to][flow[u][i].re].cap+=temp;
            flow[u][i].cap-=temp;
            return temp;
        }
    }
    return 0;
}
long long int dinic(int s,int t){
    long long int ans=0,f;
    int cnt=0;
    for(int i=0;i<MAXN;i++)went[i]=-1;
    while(true){
        bfs(s,cnt);
        if(went[t]!=cnt++)break;
        while((f=dfs(s,t,INF_FLOW))>0)ans+=f;
    }
    return ans;
}
int main(){
    int n,s=0,t=MAXN-1;
    long long int tot=0,temp;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&temp);
        if(temp>0)tot+=temp;
        if(temp>0)addedge(i,t,temp);
        else addedge(s,i,-temp);
        for(int j=i<<1;j<=n;j+=i)addedge(i,j,INF_FLOW);
    }
    printf("%lld\n",tot-dinic(s,t));
}


Measured memory_bytes: 384
v[][4]={{0,4,2,5},{0,5,2,4},{0,3,2,1},{0,1,2,3},{4,3,5,1},{1,5,3,4}};main(n,c,i,j,t,s){while(scanf("%d",&n)&&n){int d[]={1,3,6,4,2,5};for(s=1;n--&&scanf(" %c%*s",&c);){c&=255;i=c-'N'?c-'S'?c-'E'?c-'W'?c-'L'?5:4:3:2:1:0;t=d[v[i][0]];for(j=0;j<3;++j)d[v[i][j]]=d[v[i][j+1]];d[v[i][3]]=t;s+=*d;}printf("%d\n",s);}}

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

using namespace std;

int main()
{

	string S, T;

	cin >> S >> T;

	int count = 0;

	for (int i = 0; i < S.length(); i++)
	{
		if (S[i] != T[i])
		{
			S[i] = T[i];
			count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 3924
let fs, s, n = Array.make 8 0, ref 0., Scanf.scanf " %d" (+) 0
let xys = Array.init n @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a, b
let g (a, b) (c, d) = sqrt @@ float @@ (a - c) * (a - c) + (b - d) * (b - d)
let rec h n = if n < 1 then 1 else n * h (n - 1)
let rec f i a p = if i >= n then s := !s +. a else (for j = 0 to n - 1 do
  if fs.(j) = 0 then (fs.(j) <- 1; f (i + 1) (if p < 0 then a else a +. g xys.(j) xys.(p)) j; fs.(j) <- 0) done)
let _ = f 0 0. ~-1; Printf.printf "%.10f\n" @@ !s /. float (h n)

Measured memory_bytes: 2560
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
// constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int A,B;
  cin >> A >> B;
  vector<int> cnt(101,0);
  for(int i=A; i<B; i++){
    cnt[i]++;
  }
  int C,D;
  cin >> C >> D;
  for(int i=C; i<D; i++){
    cnt[i]++;
  }
  int ans = 0;
  for(int i=0; i<=100; i++){
    if(cnt[i] >= 2) ans++;
  }
  cout << ans << "\n";
  return 0;
}

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

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    ll k=n-1;
    ll dp[n];
    dp[n-1]=0;
    for(ll i=k-1;i>=0;i--){
        if(i+2>=n && i<n){
            dp[i]=abs(a[i]-a[i+1])+dp[i+1];
        }
        else if(abs(a[i]-a[i+1])+dp[i+1]<abs(a[i]-a[i+2])+dp[i+2]){
            dp[i]=abs(a[i]-a[i+1])+dp[i+1];
        }
        else{
            dp[i]=abs(a[i]-a[i+2])+dp[i+2];
        }
    }
    cout<<dp[0]<<endl;


}


Measured memory_bytes: 5188
unittest
{
	assert( [ "4", "RRGB" ].parse.expand.solve == 1 );
	assert( [ "39", "RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB" ].parse.expand.solve == 1800 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	const long[ dchar ] CS = [ 'R':0L, 'G':1L, 'B':2L ];
	
	auto tss = new long[][]( 1 + s.length, 3 );
	foreach( ref ts, c; lockstep( tss, s ) )
	{
		ts[ CS[ c ] ]++;
	}
	foreach_reverse( i; 1L .. tss.length.signed )
	{
		foreach( c; 0L .. tss[ i ].length.signed )
		{
			tss[ i - 1 ][ c ] += tss[ i ][ c ];
		}
	}
	
	auto ans = 0L;
	foreach( i; 0L .. tss.length.signed - 3 )
	{
		foreach( j; i + 1 .. tss.length.signed - 2 )
		{
			if( s[ i ] == s[ j ] ) continue;
			
			auto d = j - i;
			auto c = 0L;
			for( ; c < CS.length; c++ )
			{
				if( c != CS[ s[ i ] ] && c != CS[ s[ j ] ] ) break;
			}
			ans += tss[ j + 1 ][ c ] - ( j + d < s.length && CS[ s[ j + d ] ] == c );
		}
	}
	return ans;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[3000][3000];
ll a[3000];
ll dfs(ll l,ll r){
  if(dp[l][r]>=0)return dp[l][r];
  if(l==r)return dp[l][r]=a[l];
  ll ret=max(-dfs(l+1,r)+a[l],-dfs(l,r-1)+a[r]);
  return dp[l][r]=ret;
}
int main(){
  ll n;cin>>n;
  for(ll i=0;i<n;i++)for(ll j=0;j<n;j++)dp[i][j]=-1;
  for(ll i=0;i<n;i++){
    cin>>a[i];
  }
  cout<<dfs(0,n-1)<<endl;
}

Measured memory_bytes: 70656
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    string days[7] ={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string s;
    int n;
    cin>> s;
    for (int i = 0; i< 7; i++){
        if (s== days[i]){
            n = i;
        }
    }
    n = 7-n;
    cout<< n;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n, k, ans = 0;
    cin >> n >> k;
    vector<int> p(n);
    for(int i=0;i<n;i++) cin >> p[i];
    sort(p.begin(), p.end());
    for(int i=0;i<k;i++) ans += p[i];
    cout << ans << endl;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007

vector<int> v[200001];
int vis[200001]={0};
int P =0;
int dfs(int root, int p)
{
	int i;
	vis[root] = 1;
	P++;
	for(i=0; i<v[root].size(); i++)
	{
		int x = v[root][i];
		if(vis[x]==0)
		dfs(x,p);
	}
	return p;
}
int main()
{
	int n ,m, i;
	cin >> n >> m;
	while(m--)
	{
		int a,b;
		cin >> a>> b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	int sz = 0;
	for(i=1;i<=n;i++)
	{
		int p = 0;
		P=0;
		if(vis[i]==0){
			dfs(i,0);
			sz = max(sz, P);
		}
			
	}
	cout<<sz<<endl;
}


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

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;
}
template <class T>
inline T gcd(T m, T n) {
  if (n == 0)
    return m;
  else
    return gcd(n, abs(m) % abs(n));
}

#define IOS ios::sync_with_stdio(false), cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()
#define MAX(a) *max_element(all(a))

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vc = vector<char>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vvi;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

int main() {
  IOS;
  constexpr char endl = '\n';

  ll N, K;
  cin >> N >> K;

  ll rem = N % K;
  ll res = (rem < abs(rem - K)) ? rem : abs(rem - K);
  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define trace1(a) cout << a << 'n';
#define trace2(a, b) cout << a << ' ' << b << 'n';
#define trace3(a, b, c) cout << a << ' ' << b << ' ' << c << 'n';
#define trace4(a, b, c, d) cout << a << ' ' << b << ' ' << c << ' ' << d << 'n';
#define trace5(a, b, c, d, e) cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << 'n';
#define trace6(a, b, c, d, e, f) cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << ' ' << f << 'n';
#define range(n) for(int i = 0; i < n; i++)
#define printArr(harry, tam) range(tam) cout << harry[i] << " n"[i == tam -1];
#define maxn -2000000 //negative value to break code and force you to put right constraint
#define mod 1000000007
#define md(x) (x) % mod;
#define sc scanf
#define pr printf
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ps push
#define prt(x) cout << (#x) << " is " << (x) << endl
#define EPS 1e-9
#define INF 1000000000
#define INFd 1e9
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<double> vd;
bool visited[100005];
vector<ll> primes;
void sieve()
{
  memset(visited,false,sizeof visited);
  visited[1]=visited[0]=true;
  for(ll i=2;i<=100000;i++)
  {
    if(!visited[i]){
    for(ll j=i*i;j<=100000;j+=i)
    {
      visited[j]=true;

    }
    primes.pb(i);
  }
  }

}
int main(){
    ll n;
    cin>>n;
    sieve();
    ll arr[100005]={0};
    for(ll i=1;i<=100000;i++)
    {
        if(!visited[i]&&!visited[(i+1)/2]&&i%2==1)
          arr[i]=arr[i-1]+1;
        else
          arr[i]=arr[i-1];
    }
    while(n)
    {
      n--;
      ll l,r;//std:: << '\n';
      cin>>l>>r;
      cout<<arr[r]-arr[l-1]<<endl;
    }
   return 0;
}


Measured memory_bytes: 1664
#include<stdio.h>
#include<string.h>
#define N 11
char str[N];
char end[N];
int main()
{
	int i,n,len,temp;
	scanf("%s",str);
	len = strlen(str);
	n=0;
	for(i=0 ; i<=len ; i++)
	{ 
		temp=str[i];
		if(str[i]=='B')
		{
			if(n>0)
			{
				end[--n]='\0';
			}
		}
		else end[n++]=temp;
	}
	printf("%s\n",end);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int A,B;
  cin >> A;
  cin >> B;
  if (B==1) cout << 0 << endl;
  else {
    int count=0;
    while(true) {
      ++count;
      if (A*count-count+1>=B) {
        cout << count << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
typedef pair<int,int> P;
#define mod 1000000007

int main(){
   int x,y;
   vector<int>g={0,1,3,1,2,1,2,1,1,2,1,2,1};
   cin >> x >>y;
   if(g[x]==g[y]) cout << "Yes" <<endl;
   else cout << "No" <<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define print(x) cout << x << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll MOD = 1000000007;

int main()
{
    ll N, T;
    cin >> N >> T;
    vector<ll> t(N);
    rep(i, N) cin >> t[i];
    ll ans = 0;
    for (ll i = 0; i < N-1; i++)
    {
        if (t[i+1] - t[i] >= T) {
            ans += T;
        } else {
            ans += t[i+1] - t[i];
        }
    }
    print(ans+T);
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <string>
#include <cmath>
#include <list>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

int main(void)
{
    string s;
    cin >> s;
    int length = s.length();

    int p[11];

    long long ans = 0;

    for (int i = 0; i < pow(2, s.length() - 1); i++) {
        for (int j = 0; j < s.length() - 1; j++) {
            p[j] = i & (int) pow(2, j);
        }
        long long sum = 0;
        long long tmp = stoll(s.substr(0, 1));
        for (int j = 0; j < s.length() - 1; j++) {
            if (p[j] == 0) {
                tmp = tmp * 10 + stoll(s.substr(j + 1, 1));
            } else {
                sum += tmp;
                tmp = stoll(s.substr(j + 1, 1));
            }
        }
        sum += tmp;
        ans += sum;
        // cout << ans << endl;
    }

    cout << ans;
}


Measured memory_bytes: 256
MOD = 10**9 + 7
MAX = int(2e5)


def div(a, b):
    return a * pow(b, MOD-2, MOD) % MOD


FACT = [1] * (MAX+1)
for i in range(1, MAX+1):
    FACT[i] = (i * FACT[i-1]) % MOD
INV = [1] * (MAX+1)
INV[MAX] = div(1, FACT[MAX])
for i in range(MAX, 0, -1):
    INV[i-1] = (INV[i] * i) % MOD


def main():
    N, K = map(int, input().split())
    for i in range(1, K+1):
        if N - K + 1 < i:
            print(0)
            continue
        p1 = (FACT[N-K+1] * INV[i] * INV[N-K+1-i]) % MOD
        p2 = (FACT[K-1] * INV[i-1] * INV[K-i]) % MOD
        print((p1 * p2) % MOD)


if __name__ == "__main__":
    main()


Measured memory_bytes: 45296
#include <iostream>
#include <vector>
#include <climits>
#include <cctype>
#include <cstring>
#include <cstdlib>
using namespace std;

typedef pair<int,int> P;

int w, h, sx, sy, gx, gy;
int dp[7][1002];
char t[1002][1002];

vector<P> v[5];

int main(){
  while(cin >> w >> h, w || h){
    for(int i = 0; i < 5; i++){
      v[i].clear();
    }

    for(int i = 0; i < h; i++){
      cin >> t[i];

      for(int j = 0; j < w; j++){
        if(t[i][j] == 'S'){
          t[i][j] = '.';
          sx = j;
          sy = i;
        }
        else if(t[i][j] == 'G'){
          t[i][j] = '.';
          gx = j;
          gy = i;
        }
        else if(isdigit(t[i][j])){
          v[t[i][j] - '1'].push_back(P(j, i));
        }
      }
    }

    int ansCost = INT_MAX;
    int ans = -1;

    for(int start = 0; start < 5; start++){
      memset(dp, -1, sizeof(dp));
      int S = (start + 1) % 5;

      for(int i = 0; i < v[S].size(); i++){
        int dist = abs(sx - v[S][i].first) + abs(sy - v[S][i].second);
        dp[0][i] = dist;
      }

      for(int I = 0; I < 3; I++){
        int NI = I + 1;
        int i = (S + I) % 5;
        int ni = (i + 1) % 5;

        for(int j = 0; j < v[i].size(); j++){
          for(int k = 0; k < v[ni].size(); k++){
            if(dp[I][j] == -1) continue;

            int dist = abs(v[i][j].first - v[ni][k].first) + abs(v[i][j].second - v[ni][k].second);
            int cost = dist + dp[I][j];

            if(dp[NI][k] == -1 || dp[NI][k] > cost){
              dp[NI][k] = cost;
            }
          }
        }
      }

      int idx = (S + 3) % 5;

      for(int i = 0; i < v[idx].size(); i++){
        if(dp[3][i] == -1) continue;
        int cost = dp[3][i] + abs(gx - v[idx][i].first) + abs(gy - v[idx][i].second);
        if(ansCost > cost){
          ansCost = cost;
          ans = start;
        }
      }
    }

    if(ans == -1){
      cout << "NA\n";
    }
    else{
      cout << ans + 1 << " " << ansCost << endl;
    }
  }
}

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

int main(){
    int n,k;
    cin >> n >> k;
    int h[n];
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    int cnt=0;
    for(int i=0; i<n; i++){
        if(h[i]>=k)cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll X1, Y1, X2, Y2;
  cin >> X1 >> Y1 >> X2 >> Y2;
  ll xlen = X2 - X1;
  ll ylen = Y2 - Y1;

  ll x3 = X2 - ylen;
  ll y3 = Y2 + xlen;
  ll x4 = X1 - ylen;
  ll y4 = Y1 + xlen;
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

  return 0;
}


Measured memory_bytes: 256
//                                                   ¯\_(ツ)_/¯
  //#pragma GCC optimize("Ofast")
 //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
#define pi pair<int,int>
const int N=1e6+5,MOD=1e9+7;

using namespace std;

int n,m;

string a[1005];

ll dp[1005][1005];

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

	
	cin>>n>>m;

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

	dp[0][0]=(a[0][0]!='#');

	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){

			if(a[i][j]=='#')continue;
			if(i!=0)
				(dp[i][j]+=dp[i-1][j])%=MOD;
			if(j!=0)
				(dp[i][j]+=dp[i][j-1])%=MOD;
		}
	}
	
	printf("%lld\n",dp[n-1][m-1] );
}

Measured memory_bytes: 9216
N,Y = list(map(int,input().split()))
for i in range(0,N+1):
    for j in range(0,N+1):
        if i*10000+j*5000+(N-i-j)*1000 == Y and N-i-j >= 0:
          print('{0} {1} {2}'.format(i,j,N-i-j))
          exit()
print('-1 -1 -1')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n;
    cin>>n;
    vector<string> vec(n);
    cin>>vec;
    int a=0,b=0,c=0;
    int d=0;
    REP(i,n){
        REP(j,(int)vec[i].size()-1){
            if(vec[i][j]=='A'&&vec[i][j+1]=='B'){
                d++;
            }
        }
        if(vec[i][0]=='B'&&vec[i].back()=='A'){
            a++;
        }else if(vec[i][0]=='B'){
            b++;
        }else if(vec[i].back()=='A'){
            c++;
        }
    }
    int k=min({a,b,c});
    int ans=d+k*2;
    a-=k;
    b-=k;
    c-=k;
    if(a&&b){
        int l=min(a,b);
        ans+=l;
        a-=l;
        b-=l;
        if(l&&a){
            ans+=a;
        }
    }else if(a&&c){
        int l=min(a,c);
        ans+=l;
        a-=l;
        c-=l;
        if(l&&a){
            ans+=a;
        }
    }else if(b&&c){
        ans+=min(b,c);
    }else if(a){
        if(k){
            ans+=a;
        }else{
            ans+=a-1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

Measured memory_bytes: 3528
#include <iostream>
#include <map>
#include <vector>
#define int long long
using namespace std;
int N,E,ans;
vector<pair<int,int>>xy,v,w;
map<int,int>A,B,C,D;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>N>>E;
    A[0]=B[0]=0;
    C[E]=D[E]=0;
    xy.push_back({0,0});
    for(int i=0;i<N;i++){
        int x,y;
        cin>>x>>y;
        xy.push_back({x,y});
    }
    xy.push_back({E,0});
    v.push_back({0,0});
    w.push_back({E,0});
    for(auto i=xy.begin();i!=xy.end();i++){
        v.push_back({i->first,v.back().second+i->second});
        A[i->first] = max(A.rbegin() -> second, v.back().second - v.back().first);
        B[i->first] = max(B.rbegin() -> second, v.back().second - 2 * v.back().first);
    }
    for(auto i=xy.rbegin();i!=xy.rend();i++){
        w.push_back({i->first,w.back().second+i->second});
        C[i->first] = max(C.begin() -> second, w.back().second - (E - w.back().first));
        D[i->first] = max(D.begin() -> second, w.back().second  - 2 * (E -  w.back().first));
    }

    for(int i=0;i<=N;i++){
        ans = max(ans,A[xy[i].first] + D[xy[i+1].first]);
        ans = max(ans,B[xy[i].first] + C[xy[i+1].first]);
    }
    cout<<ans<<'\n';
    return 0;
}


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

#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 998244353 
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define mii unordered_map<int,int>
#define mll unordered_map<ll,ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi  first

#define se second
#define pb push_backP
#define mp make_pair
#define pp pop_back
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define all(c) c.begin(),c.end()
#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}

int main(){
	boost;

	int a,b;
	cin>>a>>b;
	if(a<b){
		for (int i = 0; i < b; ++i)
		{
			cout<<a;
		}
	}else{
		for (int i = 0; i < a; ++i)
		{
			cout<<b;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define N 101
#define INFTY 100000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n;
int M[N][N];

int prim();

int main(){
	int i, j, e;
  int P;

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    for(j = 0 ; j < n ; j++){
      scanf("%d",&e);
      M[i][j] = e;
      if(M[i][j] == -1) M[i][j] = INFTY;
    }
  }

  P = prim();
  printf("%d\n",P);

  return 0;
}

int prim(){
  int i, u, min;
  int d[N], p[N], color[N];
  int sum = 0;

  for(i = 0 ; i < n ; i++){
    d[i] = INFTY;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while(1){
    min = INFTY;
    u = -1;
    for(i = 0 ; i < n ; i++){
      if(min > d[i] && color[i] != BLACK){
	u = i;
	min = d[i];
      }
    }

    if(u == -1) break;

    color[u] = BLACK;
    for(i = 0 ; i < n ; i++){
      if(color[i] != BLACK && M[u][i] != INFTY){
	if(d[i] > M[u][i]){
	  d[i] = M[u][i];
	  p[i] = u;
	  color[i] = GRAY;
	}
      }
    }
  }
  for(i = 0 ; i < n ; i++){
    if(p[i] != -1) sum += M[i][p[i]];
  }

  return sum;
}



Measured memory_bytes: 2060