akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    vl a(n);
    map<ll, ll> mp;
    rep(i, n) {
        cin >> a[i];
        mp[a[i]]++;
    }

    ll u = 0;
    for(auto p : mp) {
        ll x = p.second;
        u += x*(x-1)/2;
    }

    rep(i, n) {
        out(u - (mp[a[i]] - 1));
    }

    re0;
}

Measured memory_bytes: 11008
#include<bits/stdc++.h>
using namespace std;
#define IOS std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define FRE freopen("in.txt", "r", stdin);
#define endl "\n"
#define PI acos(-1.0)
typedef long long LL;
typedef pair<int, int> PII;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10, M = 1010;

int cnt[N];

void solve() {
	double x;
	cin >> x;
	int cnt = 0;
	double num = 100;
	while(x - num > eps) {
		num *= 1.010;
		num = (LL) num;
		cnt++;
	}
	cout << cnt << endl;
}

int main() {
	//FRE;
	int t;
	solve();
	return 0;
}

Measured memory_bytes: 3736
#include<cstdio>
//#include<iostream>
//using namespace std;
int parent(int i)
{
  return i/2;
}
int lchild(int i)
{
  return 2*i;
}
int rchild(int i)
{
  return 2*i + 1;
}
int main()
{
  int H;
  scanf("%d", &H);
  int A[255];
  for(int i=1; i<=H; i++)
  {
    scanf("%d", &A[i]);
  }
  for(int i=1; i<=H; i++)
  {
    printf("node %d: key = %d, ", i, A[i]);
    if(parent(i) >= 1)  printf("parent key = %d, ", A[i/2]);
    if(lchild(i) <= H)  printf("left key = %d, ", A[lchild(i)]);
    if(rchild(i) <= H)  printf("right key = %d, ", A[rchild(i)]);
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2668
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int n;
    cin >> n;
    vp a, b;
    int tot = 0;
    rep(i, n)
    {
        string s;
        cin >> s;
        int h = 0, bot = 0;
        for (char c : s)
        {
            if (c == '(')
            {
                h++;
            }
            if (c == ')')
            {
                h--;
                bot = min(bot, h);
            }
        }
        if (h > 0)
        {
            a.emplace_back(P(bot, h));
        }
        else
        {
            b.emplace_back(P(bot - h, -h));
        }
        tot += h;
    }
    sort(a.begin(), a.end(), greater<P>());
    sort(b.begin(), b.end(), greater<P>());

    int h = 0;
    bool ok = true;
    for (auto p : a)
    {
        if (h + p.first < 0)
            ok = false;
        h += p.second;
    }
    h = 0;
    for (auto p : b)
    {
        if (h + p.first < 0)
            ok = false;
        h += p.second;
    }
    if (tot != 0)
        ok = false;

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 11100
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
//#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////

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

    int  q;

    cin>>q;
    string res;
    for(int i = 0;i<=q;i++)res+=' ';
    int st = res.size();
    res += s;
    int en = res.size();
    for(int i = 0;i<=q;i++)res+=' ';
    bool fl = 0;
    
    while(q--){
        int k;
        I(k);
        if(k == 1)fl ^= 1;
        else {
            int k1;
            string f;
            I(k1);
            cin>>f;
            if (k1 == 1){
                if(fl ==0)res[--st] = f[0];
                else res[en++] = f[0];
            }
            else
            {
                 if(fl ==1)res[--st] = f[0];
                else res[en++] = f[0];
            }
            
            
        }
    }
    if (!fl){
    for(int i = 0;i<res.size();i++)if(res[i] != ' ')cout<<res[i];
    cout<<endl;}
    else{
        for(int i = res.size()-1;i>=0;i--)if(res[i] != ' ')cout<<res[i];
    cout<<endl;
    }
    return 0;
}

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    llint a, b, n;
    cin >> a >> b >> n;

    llint m;
    
    if(b-1<=n) m = b-1;
    else m = n;

    llint ans = floor(a*m/b)-a*floor(m/b);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
int n,m,x;
int a[102];
int check;
int count1=0,count2=0;
int main(void)
{
    
    cin >> n >> m >> x;
    for(int i=1;i<=m;i++) {cin >> check; a[check] = 1;}

    for(int i=x;i<n;i++){
        count1 += a[i+1];
    }

    for(int i=x;i>0;i--){
        count2 += a[i-1];
    }

    cout << min(count1,count2);
    return 0;
}

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

const int MAX_N = 100010;

int main() {
  int dp[MAX_N];
  int n, i, a, length;

  scanf("%d",&n);
  scanf("%d",&dp[0]);
  length = 1;

  for (i = 1; i < n; ++i) {
    scanf("%d",&a);
    if (a > dp[length - 1]) {
      dp[length] = a;
      ++length;
    } else {
      *(lower_bound(dp,dp + length, a)) = a;
    }
  }

  cout << length << endl;

  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll a,b,c,d,e,ans=0;
ll x[100005],y[100005],z[100005];
vector<ll> p[3];
bool dpx[100005],dpy[100005];
char s[100005];

int main(){
	cin>>n;
	cin>>d>>a;
	for(i=0;i<n;i++){
		cin >> b;
		ans += (d-1)/b;
	}
	ans += n;
	p(ans+a);
	return 0;
}

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

long long gcd(long long int a, long long int b){
  if(b == 0) return a;
  
  return gcd(b, a % b);
}
long long lcm(long long int a, long long int b){
  long long g = gcd(a, b);
  return a / g * b;
}

int main(void){
  int n;
  vector<long long int> t(100);
  
  cin >> n;
  for(int i = 0; i < n; i ++){
    cin >> t.at(i);
  }
  
  long long int temp = 1;
  for(int i = 0; i < n; i ++){
    temp = lcm(temp, t.at(i));
  }
  
  cout << temp << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
int iinf=1<<30;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll poc(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    double a,b,h,m;cin>>a>>b>>h>>m;
    double ax=a*cos(((h+m/60)/12.0)*2*pi),ay=a*sin(((h+m/60)/12.0)*2*pi);
    double bx=b*cos((m/60.0)*2*pi),by=b*sin((m/60.0)*2*pi);
    double dis=(ax-bx)*(ax-bx)+(ay-by)*(ay-by);
    dis=sqrt(dis);
    //cout<<ax<<" "<<ay<<" "<<bx<<" "<<by<<endl;
    cout<<fixed<<setprecision(12)<<dis<<endl;
}




Measured memory_bytes: 4108
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std; 

int N;
long long int A[100005], B[100005];

int main(void) {

	cin >> N;

	for (int i = 1; i <= N + 1; i++) { cin >> A[i]; }

	for (int i = 1; i <= N; i++) { cin >> B[i]; }

	long long int ans = 0;

	for (int i = 1; i <= N; i++) {
		long long int tmp = min(A[i], B[i]);
		A[i] -= tmp;
		B[i] -= tmp; ans += tmp;

		tmp = min(A[i + 1], B[i]);
		A[i + 1] -= tmp;
		B[i] -= tmp; ans += tmp;
	}

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

Measured memory_bytes: 1792
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int current = 0;
		int ans = 0;
		List<Integer> list = new ArrayList<>();
		for(int i = 1 ; true ; i++) {
			current += i;
			list.add(current);
			if(current == x) {
				ans = i;
				break;
			} else if(current > x) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
		sc.close();

	}

}


Measured memory_bytes: 25172
N, K = map(int,input().split())
x = list(map(int,input().split()))

ans = -1

for i in range(N - K + 1):
    l, r = i, i + K - 1
    xl = x[l]
    xr = x[r]
    tmp = min(abs(xl),abs(xr)) + xr - xl
    if ans == -1 or tmp < ans:
        ans = tmp
        
print(ans)

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

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

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  string s = readString();
  for (auto &c : s) {
    if (c != '9')
      continue;
    std::cout << "Yes" << std::endl;
    return 0;
  }
  std::cout << "No" << std::endl;
}


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

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

using namespace std;

int main(){
	int n,m,c; cin>>n>>m>>c;
	int a[20][20],b[20];
	rep(i,m) cin>>b[i];
	rep(i,n) rep(j,m) cin>>a[i][j];

	int ans=0;
	rep(i,n) if(inner_product(a[i],a[i]+m,b,0)+c>0) ans++;
	cout<<ans<<endl;

	return 0;
}


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

int main() {
  int a, b, k, cnt = 0; cin >> a >> b >> k;
  for (int i = min(a, b); i >= 0; i--)  {
    if (a % (i+1) == 0 && b % (i+1) == 0) {
      cnt++;
    }
    if (cnt == k) {
      cout << i+1 << endl;
      return 0;
    }
  }
  return 0;
}

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

int main(){
  long long N; cin >> N;
  long long A[100000];
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  sort(A,A+N);
  long long bou[100000][2];
  bou[0][0]=A[0]; bou[0][1]=1;
  long long cur=0;
  for(int i=1; i<N; i++){
    if(A[i-1]==A[i]){
      bou[cur][1]++;
    }else{
      cur++;
      bou[cur][0]=A[i];
      bou[cur][1]=1;
    }
  }
  long long bou2[100000]={};
  long long cur2=0;
  for(int i=0; i<=cur; i++){
    if(bou[i][1]>=4){
      bou2[cur2]=bou[i][0];
      bou2[cur2+1]=bou[i][0];
      cur2+=2;
    }else if(bou[i][1]>=2){
      bou2[cur2]=bou[i][0];
      cur2++;
    }
  }
  if(cur2<2){
    cout << 0 << endl;
    return 0;
  }
  long long result=0;
  for(int i=0; i<cur2-1; i++){
    for(int j=i+1; j<cur2; j++){
      result=max(result,bou2[i]*bou2[j]);
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 3328
a = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y = gets.chomp.split(" ").map(&:to_i)
if (a[0].include?(x) && a[0].include?(y)) || (a[1].include?(x) && a[1].include?(y)) || (a[2].include?(x) && a[2].include?(y))
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,a,b,c;
  cin>>n>>a>>b>>c;
  int st = 5*5*5;
  vector<vecint> dp(n+1, vecint(st));
  a = min(a, 4);
  b = min(b, 4);
  c = min(c, 4);
  auto id = [](int x, int y, int z) {
    x = min(x, 4);
    y = min(y, 4);
    z = min(z, 4);
    return x*25 + y*5 + z;
  };
  dp[0][id(a,b,c)] = 1;
  vector<string> vq(n);
  REP(i,n) {
    string s;
    cin>>s;
    vq[i] = s;
    if (s == "AB") {
      REP(j,st) {
        if (!dp[i][j]) continue;
        int x = j / 25;
        int y = (j / 5) % 5;
        int z = j % 5;
        if (x == 0 && y == 0) continue;
        if (x <= y) {
          dp[i+1][id(x+1,y-1,z)] = 1;
        }
        if (x >= y) {
          dp[i+1][id(x-1,y+1,z)] = 1;
        }
      }
    } else if (s == "AC") {
      REP(j,st) {
        if (!dp[i][j]) continue;
        int x = j / 25;
        int y = (j / 5) % 5;
        int z = j % 5;
        if (x == 0 && z == 0) continue;
        if (x <= z) {
          dp[i+1][id(x+1,y,z-1)] = 1;
        }
        if (x >= z) {
          dp[i+1][id(x-1,y,z+1)] = 1;
        }
      }
    } else {
      REP(j,st) {
        if (!dp[i][j]) continue;
        int x = j / 25;
        int y = (j / 5) % 5;
        int z = j % 5;
        if (y == 0 && z == 0) continue;
        if (y <= z) {
          dp[i+1][id(x,y+1,z-1)] = 1;
        }
        if (y >= z) {
          dp[i+1][id(x,y-1,z+1)] = 1;
        }
      }
    }
  }
  int cur = find(ALL(dp[n]), 1) - begin(dp[n]);
  if (cur == st) {
    cout << "No\n";
    return 0;
  }
  vector<string> res;
  REP(i,n) {
    int j = n-i;
    string s = vq[j-1];
    int x = cur / 25;
    int y = (cur / 5) % 5;
    int z = cur % 5;
    int *p;
    int *q;
    if (s == "AB") {
      p = &x;
      q = &y;
    } else if (s == "AC") {
      p = &x;
      q = &z;
    } else {
      p = &y;
      q = &z;
    }
    bool first = false;
    if (*p > 0 && *q < 4) {
      ++*q;
      --*p;
      if (dp[j-1][id(x,y,z)]) {
        first = true;
      } else if (*p == 3) {
        ++*p;
        if (dp[j-1][id(x,y,z)]) {
          first = true;
        } else {
          --*q;
        }
      } else {
        --*q;
        ++*p;
      }
    }
    if (!first) {
      --*q;
      ++*p;
      if (!dp[j-1][id(x,y,z)] && *q == 3) {
        ++*q;
      }
    }
    if (first) {
      if (s == "BC") {
        res.push_back("B");
      } else {
        res.push_back("A");
      }
    } else {
      if (s == "AB") {
        res.push_back("B");
      } else {
        res.push_back("C");
      }
    }
    cur = id(x,y,z);
  }
  cout<<"Yes\n";
  reverse(ALL(res));
  for(auto&& ch : res) {
    cout<<ch<<"\n";
  }
  return 0;
}


Measured memory_bytes: 62904
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, int b, int _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

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

void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> table(n + 3);
  rep(i, m) {
    int a;
    cin >> a;
    table[a] = 1;
  }
  vector<int> dp(n + 3);
  dp[0] = 1;
  rep(i, n) {
    rep(j, 2) if (table[i + j + 1] == 0) add(dp[i + j + 1], dp[i]);
  }
  cout << dp[n] << endl;
}


Measured memory_bytes: 1024
//author: zekigurbuz
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef queue<int> qi;
typedef map<string, int> msi;
#define RANGE_SUM 0
#define RANGE_MIN 1
#define RANGE_MAX 2
#define RANGE_XOR 3
#define RANGE_MUL 4
#define RANGE_OR  5
#define RANGE_AND 6
#define bit_ison(S, j) (S & (1 << j))
#define bit_setbit(S, j) (S |= (1 << j))
#define bit_clearbit(S, j) (S &= ~(1 << j))
#define bit_togglebit(S, j) (S ^= (1 << j))
#define bit_lowestbit(S) (S & (-S))
#define bit_setallon(S, n) (S = (1 << n) - 1)
#define bit_ispowertwo(S) (!(S & (S - 1))
#define bit_turnofflastbit(S) ((S) & (S - 1))
#define bit_turnonlastzero(S) ((S) | (S + 1))
#define double ld
#define M0D 1000000007
#define endl '\n'
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define forn(a,b) for(int a=0;a<b;++a)
#define rep(a,b,c) for(int a=b;a<c;++a)
const ld PI = 4*atan((ld)1);
vs split(string s){vs v;istringstream iss(s);do{string sub;iss>>sub;v.pb(sub);}while(iss);v.pop_back();return v;}
int gcd(int a,int b){return a==0?b:gcd(b%a,a);}
int lcm(int a,int b){return a*b/gcd(a,b);}

signed main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n; cin >> n;
	int a = n / 1000 % 10;
	int b = n / 100 % 10;
	int c = n / 10 % 10;
	int d = n % 10;
	if (a + b + c + d == 7) {
		printf("%d%s%d%s%d%s%d=7\n", a, "+", b, "+", c, "+", d);
	}
	else if (a + b + c - d == 7) {
		printf("%d%s%d%s%d%s%d=7\n", a, "+", b, "+", c, "-", d);
	}
	else if (a + b - c + d == 7) {
		printf("%d%s%d%s%d%s%d=7\n", a, "+", b, "-", c, "+", d);
	}
	else if (a + b - c - d == 7) {
		printf("%d%s%d%s%d%s%d=7\n", a, "+", b, "-", c, "-", d);
	}
	else if (a - b + c + d == 7) {
		printf("%d%s%d%s%d%s%d=7\n", a, "-", b, "+", c, "+", d);
	}
	else if (a - b + c - d == 7) {
		printf("%d%s%d%s%d%s%d=7\n", a, "-", b, "+", c, "-", d);
	}
	else if (a - b - c + d == 7) {
		printf("%d%s%d%s%d%s%d=7\n", a, "-", b, "-", c, "+", d);
	}
	else if (a - b - c - d == 7) {
		printf("%d%s%d%s%d%s%d=7\n", a, "-", b, "-", c, "-", d);
	}
	return 0;
}
/* Think about this stuff:
   - printing: double -> int || printf
   - use for loop instead of memset
   - check bounds & edge cases
   - just implement something
   - find reason of tle
*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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 (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s;
ll k;
cin>>s>>k;
if(k>1 && s[0]=='1'){
    rep(i,s.size()){
        if(s[i]!='1')
        {
            cout<<s[i]<<endl;
            break;
        }
        if(i==k-1){
            cout<<s[i]<<endl;
            break;
        }
    }
}
else{
    cout<<s[0]<<endl;
}
//system("pause");
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
	char s[4];
	int i;
	int j=3;
	char c;
 
	gets(s);
 
	for (c= 97; c< 100; c++)
	{
		for (i = 0; s[i]!= 0; i++)
		{
			if (c == s[i])
			{
	             j--;
				 break;
			}
			
		}
	}
	if (j == 0)
		printf("Yes");
	else
		printf("No");
 
    return 0;
}
 

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
#define _GLIBCXX_DEBUG
const int INF=1e15;

signed main(){
    string A,B;
    cin>>A>>B;
    string d="";
    REP(i,A.size()+B.size()){
        if(i%2==0)d+=A[i/2];
        if(i%2==1)d+=B[(i-1)/2];
    }
    cout<<d<<endl;
}


Measured memory_bytes: 256
from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline


class PrimeComb:
  def __init__(self, MAX=666670, MOD=1000000007):
    # preprocessing: O(MAX)
    self.MAX  = MAX
    self.MOD  = MOD
    self.fac  = [0]*MAX
    self.inv  = [0]*MAX
    self.finv = [0]*MAX
    self.fac[0]  = self.fac[1] = 1
    self.finv[0] = self.finv[1] = 1
    self.inv[1]  = 1
    for i in range(2, MAX):
      self.fac[i]  = self.fac[i-1] * i % MOD
      self.inv[i]  = MOD - self.inv[MOD % i] * int(MOD / i) % MOD
      self.finv[i] = self.finv[i-1] * self.inv[i] % MOD

  def com(self, n, k):
    # compute -> nCk % self.P : O(1)
    if (n < k): return 0
    if (n < 0 or k < 0): return 0
    return self.fac[n] * (self.finv[k] * self.finv[n-k] % self.MOD) % self.MOD


def main():
  X, Y = list(map(int, input().split()))
  PC = PrimeComb()

  num_trans1 = 0
  num_trans2 = 0

  # min_ = min(X, Y) // 3
  # X -= 3*min_
  # Y -= 3*min_
  # num_trans1 += min_
  # num_trans2 += min_
  ans = 0
  for i in range(min(X, Y)//3 + 1):
    tempX = X - 3*i
    tempY = Y - 3*i
    num_trans1 = i
    num_trans2 = i

    if tempX==tempY==0:
      ans += PC.com(num_trans1+num_trans2, num_trans1)

    elif tempX > tempY:
      if tempX % 2:
        # print(0)
        continue
      if tempX//2 != tempY:
        # print(0)
        continue
      num_trans2 += tempY
      ans += PC.com(num_trans1+num_trans2, num_trans1)
    elif tempX < tempY:
      if tempY % 2:
        # print(0)
        continue
      if tempY//2 != tempX:
        # print(0)
        continue
      num_trans1 += tempX
      ans += PC.com(num_trans1+num_trans2, num_trans1)

  # print(num_trans1, num_trans2)
  print(ans % 1_000_000_007)


if(__name__ == '__main__'):
  main()


Measured memory_bytes: 84776
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
if a%2==0:
  print(1/2)
else:
  print(math.ceil(a/2)/a)

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

int main(void) {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<vector<long long>> dp(N + 1, vector<long long>(2));
  dp[0][0] = 0;
  dp[0][1] = -1e10;
  for (int i = 1; i < N + 1; i++) {
    dp[i][0] = max(dp[i - 1][0] + A[i - 1], dp[i - 1][1] - A[i - 1]);
    dp[i][1] = max(dp[i - 1][0] - A[i - 1], dp[i - 1][1] + A[i - 1]);
  }

  cout << dp[N][0] << endl;

  return 0;
}

Measured memory_bytes: 6528
#ACを検索して開始位置をインデックスにしておき、それを操作すれば多少はマシか
import numpy as np
N,Q=[int(_) for _ in input().split()]
S=list(input())
hani=[[int(a) for a in input().split()] for j in range(Q)]
ACindex=[0]
cur=0
for i in range(N-1):
    cur+=S[i]=="A" and S[i+1]=="C"
    ACindex.append(cur)
ACindex.append(cur)
for j in hani:
    print(ACindex[j[1]-1]-ACindex[j[0]-1])

Measured memory_bytes: 35632
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    int t = 7 % n;
    for(int i = 1;i <= n;i++){
          if(t == 0){
                cout << i << endl;
                return 0;
          }
          t = (t * 10 + 7) % n;
    }
    cout << -1 << endl;
}


Measured memory_bytes: 3588
use proconio::input;

fn main() {
    input! {
        a: u128,
        b: f32,
    }

    solve(a, b);
}

fn solve(a: u128, b: f32) {
    let c = (b * 100.1f32) as u128;
    println!("{}", (a * c) / 100);
}


Measured memory_bytes: 2156
def main():
    import collections

    h,w,k = map(int,input().split())
    c = []
    total = 0
    for i in range(h):
        cc = list(input())
        c.append(cc)
        total += collections.Counter(cc)['#']
    from itertools import combinations
    r = list(range(0,h))
    col = list(range(0,w))
    # t = collections.Counter(c)
    # total = t['#']
    ans = 0

    for i in range(h+1):
        for row in list(combinations(r, i)):
            rcnt = collections.Counter(row)
            for j in range(w+1):
                for co in list(combinations(col, j)):
                    ccnt = collections.Counter(co)

                    sumr = 0
                    for kk in row:
                        for l in c[kk]:
                            if l == '#':
                                sumr+=1

                    for kk in co:
                        for l in range(h):
                            if c[l][kk] == '#' and l not in row:
                                sumr+=1
                    
                    if total - sumr == k:
                        ans += 1
    print(ans)
if __name__=='__main__':
    main()


Measured memory_bytes: 9512
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 998244353
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
	int n;
	cin >> n;
	vector <pair<int, int>> p(n);
	for (int i = 0; i < n; i++) {
		int t, x, y;
		cin >> t >> x >> y;
		p[i] = {t, x + y};
	}
	sort(all(p));
	bool ok = true;
	for (int i = 0; i < n; i++) {
		if(i == 0) {
			if(!(p[i].ss <= p[i].ff && (p[i].ff - p[i].ss) % 2 == 0)) {
				ok = false;
				break;
			}
		}
		else {
			if(!(p[i].ss - p[i - 1].ss <= p[i].ff - p[i - 1].ff && ((p[i].ff - p[i - 1].ff) - (p[i].ss - p[i - 1].ss)) % 2 == 0)) {
				ok = false;
				break;
			}
		}
	}
	if(ok) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<queue>
#include<stdlib.h>
using namespace std;
int h, w;
int map[1005][1005];
int d[9] = { -1, 0, 1 };
class S{
public:
	int x, y, z;
	S(int a, int b, int c){
		x = a, y = b, z = c;
	}
};
int main()
{
	int ans = 0;
	queue<S>q;
	cin >> h >> w;
	for (int i = 0; i < h; i++){
		for (int i2 = 0; i2 < w; i2++){
			char c;
			cin >> c;
			if (c == '.'){
				map[i][i2] = 0;
				q.push(S(i2, i, 0));
			}
			else{
				map[i][i2] = atoi(&c);
			}
		}
	}
	while (!q.empty()){
		S s = q.front();
		int x = s.x, y = s.y, z = s.z;
		ans = z;
		q.pop();
		for (int i = 0; i < 3; i++){
			for (int i2 = 0; i2 < 3; i2++){
				int xx = x + d[i2];
				int yy = y + d[i];
				if (xx >= 0 && xx < w&&yy >= 0 && yy < h&&--map[yy][xx] == 0){
					q.push(S(xx, yy, z + 1));
					/*for (int i3 = 0; i3 < h; i3++){
						for (int i4 = 0; i4 < w; i4++){
							printf("%3d", map[i3][i4]);
						}cout << endl;
					}
					cout << endl;*/
				}
			}
		}
	}
	cout << ans << endl;
}

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

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

    string Scopy = S;

    S = regex_replace(S, regex("eraser"), "_");
    Scopy = regex_replace(Scopy, regex("eraser"), "-");

    S = regex_replace(S, regex("erase"), "_");
    Scopy = regex_replace(Scopy, regex("erase"), "-");

    S = regex_replace(S, regex("dreamer"), "_");
    Scopy = regex_replace(Scopy, regex("dreamer"), "-");

    S = regex_replace(S, regex("dream"), "_");
    Scopy = regex_replace(Scopy, regex("dream"), "-");

    string ans = "YES";

    if (S.size() == Scopy.size())
    {
        for (int i = 0; i < S.size(); i++)
        {
            if (S[i] != '_' || Scopy[i] != '-')
            {
                ans = "NO";
            }
        }
    }
    else
    {
        ans = "NO";
    }
    cout << ans << endl;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n - 1); i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

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

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

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int N = 1 << 18;

int e[2 * N], o[2 * N];

void fill(int* t) {
    forn(i, 0, 2 * N) t[i] = INF;
}

void build(int* t) {
    ford(i, 1, N) t[i] = min(t[2 * i], t[2 * i + 1]);
}

void _set(int* t, int pos, int val) {
    pos += N;
    t[pos] = val;
    pos /= 2;
    while (pos) {
        t[pos] = min(t[2 * pos], t[2 * pos + 1]);
        pos /= 2;
    }
}

int get(int* t, int l, int r) {
    l += N, r += N;
    int ans = INF;
    while (l < r) {
        //cerr << l << ' ' << r << '\n';
        if (l % 2) {
            _setmin(ans, t[l]);
            ++l;
        }
        if (r % 2) {
            --r;
            _setmin(ans, t[r]);
        }
        l /= 2;
        r /= 2;
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    fill(o), fill(e);
    int n;
    cin >> n;
    vector<int> a(n);
    forn(i, 0, n) cin >> a[i];
    set<int> bounds;
    bounds.insert(n);
    bounds.insert(-1);
    vector<int> pos(n + 1);
    forn(i, 0, n) pos[a[i]] = i;
    vector<int> ans;
    forn(i, 0, n) (i % 2 ? o : e)[i + N] = a[i];
    build(o), build(e);
    set<int> vars;
    vars.insert(get(e, 0, n - 1));
    forn(_, 0, n / 2) {
        int x = *vars.begin();
        vars.erase(vars.begin());
        int xpos = pos[x];
        auto it = bounds.lower_bound(xpos);
        int r = *it;
        --it;
        int l = *it;
        int y = get(xpos % 2 ? e : o, xpos, r);
        int ypos = pos[y];
        ans.eb(x);
        ans.eb(y);
        bounds.insert(xpos);
        bounds.insert(ypos);
        int val1 = get(l % 2 ? e : o, l, xpos - 1);
        int val2 = get(xpos % 2 ? e : o, xpos, ypos - 1);
        int val3 = get(ypos % 2 ? e : o, ypos, r - 1);
        vars.insert(val1);
        vars.insert(val2);
        vars.insert(val3);
    }
    forn(i, 0, n) cout << ans[i] << ' ';
}


Measured memory_bytes: 17396
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e;
string s;
set <char> ss;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>s;
	ss.insert(s[0]);
	ss.insert(s[1]);
	ss.insert(s[2]);
	if(ss.size()==2){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
import collections

N = int(input())
S = [""] * N
for i in range(N):
    S[i] = input()

c = collections.Counter(S)
c_most_num = c.most_common()[0][1]
ans = []
for ci in c.most_common():
    if ci[1] == c_most_num:
        ans.append(ci[0])
ans.sort()

for a in ans:
    print(a)


Measured memory_bytes: 45028
#include <iostream>
using namespace std;
int main(void){
    int n, l;
    cin >> n >> l;
    int ans=0,taste,i=1;
    for (i; i <= n; i++) {
        taste=l+i-1;
        if (std::abs(taste+1)>std::abs(taste)) 
        {
            break;
        }
        if (i<n) 
        {
            ans+=taste;
        }

    }
    i++;
    for (i; i <= n; i++) {
        taste=l+i-1;
        ans+=taste;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
double judge(double x){
int y=x;
  if(y-x==0)return 1;
  else return 0;
}
int main(void){
int n,d;
  scanf("%d%d",&n,&d);
  double x[n][d];
  for(int i=0;i<n;i++){
	for(int j=0;j<d;j++){
	scanf("%lf",&x[i][j]);
     // printf("%lf",x[i][j]);
    }
    //printf("\n");
  }
  int sum=0;
  double dis=0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
	for(int k=0;k<d;k++){
	 dis+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
    }
      dis=sqrt(dis);
      //printf("%lf\n",dis);
    if(judge(dis))sum++;
    dis=0;
  }
  }
  printf("%d",sum);
  return 0;
}

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

int main()
{
    int K, S;
    cin >> K >> S;
    int ans = 0;

    for (int x = 0; x <= K; x++)
    {
        for (int y = 0; y <= K; y++)
        {
            int z = abs(x + y - S);
            if (z <= K)
            {
                if (x + y + z == S)
                {
                    ans += 1;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
m=0
s=sum(a)
l=[0]*(n+1)
for i in range(n+1):
  l[i]=abs(a[i+1]-a[i])
  m+=l[i]
for i in range(1,n+1):
  ans=m-(l[i-1]+l[i]-abs(a[i+1]-a[i-1]))
  print(ans)


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

int A=0, X=0;

int main(){
  cin >> X >> A;
  if (X < A) cout << 0 << endl;
  else cout << 10 << endl;
}

Measured memory_bytes: 3500
#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, m, x;
vector<long long> val[3001][3001];
long long dp[3001][3001][4];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m >> x;
	for(int i = 0; i < x; i++){
		int a, b, c;
		cin >> a >> b >> c;
		val[a][b].push_back(c);
	}
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			sort(val[i][j].begin(), val[i][j].end(), greater<long long>());
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++){
			for(int k = 0; k <= 3; k++)
				dp[i][j][k] = max(dp[i][j - 1][k], dp[i - 1][j][3]);
			long long sum = 0;
			for(int k = 0; k < min(3, (int)val[i][j].size()); k++){
				sum += val[i][j][k];
				for(int l = 0; l <= 2 - k; l++){
					dp[i][j][l + k + 1] = max(dp[i][j][l + k + 1], dp[i][j - 1][l] + sum);
					dp[i][j][l + k + 1] = max(dp[i][j][l + k + 1], dp[i - 1][j][3] + sum);
				}
			}
		}
	cout << dp[n][m][3] << '\n';
	return 0;
}

Measured memory_bytes: 502196
#include<bits/stdc++.h>
using namespace std;
struct A{
	int x,y,val;
};
int h,w,c[2],d[2],tx[4]={0,0,1,-1},ty[4]={1,-1,0,0},a[1010][1010],vis[1010][1010];
int kx[20]={-2,-2,-2,-2,-2,-1,-1,-1,-1,0,0,1,1,1,1,2,2,2,2,2};
int ky[20]={-2,-1,0,1,2,-2,-1,1,2,-2,2,-2,-1,1,2,-2,-1,0,1,2};
deque<A> q;
int main()
{
	scanf("%d%d%d%d%d%d",&h,&w,&c[0],&d[0],&c[1],&d[1]);
	char s[1010];
	for(int i=1;i<=h;++i) {
		scanf("%s",s);
		for(int j=0;j<w;++j)
			if(s[j]=='#')
				a[i][j+1]=1;
	}
	q.push_front((A){c[0],d[0],0});
	vis[c[0]][d[0]]=1;
	while(!q.empty()) {
		A tmp=q.front();q.pop_front();
		int x=tmp.x,y=tmp.y,val=tmp.val,x1,z1;
//		printf("%d %d %d\n",x,y,val);
		if(x==c[1]&&y==d[1]) {
			printf("%d",val);
			return 0;
		}
		vis[x][y]=1;
		for(int i=0;i<4;++i) {
			x1=x+tx[i],z1=y+ty[i];
			if(x1<=0||x1>h||z1<=0||z1>w) continue;
//			printf("#1: %d %d %d\n",x1,z1,val);
			if(vis[x1][z1]||a[x1][z1]) continue;
//			vis[x1][z1]=1;
			q.push_front((A){x1,z1,val});
		}
		for(int i=0;i<20;++i) {
			x1=x+kx[i],z1=y+ky[i];
			if(x1<=0||x1>h||z1<=0||z1>w) continue;
//			printf("#2: %d %d %d\n",x1,z1,val+1);
			if(vis[x1][z1]||a[x1][z1]) continue;
//			vis[x1][z1]=1;
			q.push_back((A){x1,z1,val+1});
		}
	}
	printf("-1");
	return 0;
}

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

int main()
{
	int g,i;
	string ob;
	
	cin >> i;
	cin.get( );
	
	for(g=0;g<i;g++){
		string::size_type pos;
		
		getline(cin, ob);
		while(pos=ob.find("Hoshino"), pos!=string::npos)ob.replace(pos, 7, "Hoshina");
		
		cout << ob << endl;
	}
	
	return 0;
}

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

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

    int N, K;
    cin >> N >> K;
    int h[N]; 
    int passNum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
        if (h[i] >= K)
            passNum++;
    }
    cout << passNum << endl;
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(){
  int n,i,j,k,m,g[100][100]={},gg[100][100]={},a,b,c,cnt=0;
  scanf("%d %d\n",&n,&m);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(i!=j)
        g[i][j]=gg[i][j]=1001;
    }
  }
  for(i=0;i<m;i++){
    scanf("%d %d %d",&a,&b,&c);
    g[a-1][b-1]=g[b-1][a-1]=gg[a-1][b-1]=gg[b-1][a-1]=c;
  }
  for(k=0;k<n;k++){
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        if(g[i][j]>g[i][k]+g[k][j])
          g[i][j]=g[i][k]+g[k][j];
      }
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(gg[i][j]!=1001&&gg[i][j]!=g[i][j])
        cnt++;
    }
  }
  printf("%d\n",cnt/2);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,i,j,t,mx,ans=1000000;
int x[105];

int max(int x,int y){
	if(x>=y) return x;
	else return y;
}

int min(int x,int y){
	if(x<=y) return x;
	else return y;
}

int main(){
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>x[i];
		mx=max(mx,x[i]);
	}
	
	for(j=1;j<=mx;j++){
		t=0;
		for(i=1;i<=n;i++)
		t+=(x[i]-j)*(x[i]-j);
		ans=min(t,ans);
	}
	
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    l_c = int(input())
    trips = []
    for i in range(l_c):
        trips.append([int(v) for v in input().split(' ')])
    pos = [0, 0, 0]
    for t in trips:
        time = t[0] - pos[0]
        dist = abs(pos[1] - t[1]) + abs(pos[2] - t[2])
        e_or_o = [time % 2, dist % 2]
        if time < dist or e_or_o[0] != e_or_o[1]:
            print('No')
            exit(0)
        pos = t
    print('Yes')

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

int r,c,n;

bool atborder(int x,int y)
{return !x||x==r||!y||y==c;}

struct point{int x,y;}p[200005];int t;
bool operator<(point a,point b){return a.y<b.y;}

int number(int x,int y)
{
    if(!x)return y;
    if(y==c)return c+x;
    if(x==r)return c+r+c-y;
    return c+r+c+r-x;
}

int stk[200005],top;

int main()
{
    scanf("%d%d%d",&r,&c,&n);
    for(int i=1,x1,y1,x2,y2;i<=n;++i)
    {
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	if(atborder(x1,y1)&&atborder(x2,y2))
	{
	    p[++t]=(point){i,number(x1,y1)};
	    p[++t]=(point){i,number(x2,y2)};
	}
    }

    std::sort(p+1,p+t+1);

    for(int i=1;i<=t;++i)
	if(stk[top]==p[i].x)--top;
	else stk[++top]=p[i].x;

    puts(top?"NO":"YES");
    
    return 0;
}

Measured memory_bytes: 2176
#if 0
	???????????????????????????????????????
#endif
#include <iostream>
#include <cmath>
#include <valarray>
#include <vector>
#include <utility>

using namespace std;


int N, M, Z;
int h;


struct Matrix
{
	valarray<int> a;
	Matrix() : a(h*h){ a=0;}
};

Matrix mult(const Matrix A, const Matrix B){
	Matrix C;
	for (int i = 0; i < h ; ++i)
	{
		for(int j = 0; j < h; ++j)
		{
			C.a[i*h+j] =( A.a[slice(i*h,h,1)]  * B.a[slice(j,h,h)] ).sum();
		}
	}
	return C;
};

Matrix expt(Matrix A, long long p)
{
	if (p == 1) return A;
	else if ( p % 2 != 0){  
		Matrix T = expt(A, p-1); 
		return mult(A,T);
	}else{
		Matrix T = expt(A, p/2);
		return mult(T, T);
	}
};

int main()
{
	while(cin>>N>>M>>Z, N)
	{
		int s, d;
		vector< pair<int,int> > v;
		v.push_back(make_pair(1,1));
		for(int i = 0; i < M; ++i)
		{
			cin>>s>>d;
			v.push_back(make_pair(s,d));
			v.push_back(make_pair(d,s));
		}
		h = 2 * M + 1; 
		Matrix A;
		for( int i = 0; i < h; ++i)
		{
			for(int j = 1; j < h; ++j)
			{
				if(v[i].first != v[j].second && v[i].second==v[j].first && i != j)
				{ 
					 A.a[i*h+j] = 1;
				}

			}

		}
		A = expt(A,Z);
		bool C=false;
		for(int i = 0; i < h; i++)
		{
			if(v[i].second == N && A.a[i])
			{
				C = true;
			}
		}
		cout << ( C? "yes":"no") << endl;
	}
	return 0;
}
 

 

Measured memory_bytes: 5580
#include <stdio.h>
#include <math.h>
#define rep(i,l,n) for(i=l;i<n;i++)

int main(void){
	int a,b,C;
	double s,l,h,c,rad;
	//double M_PI=3.1415926;
	
	scanf("%d %d %d",&a,&b,&C);
	
	rad=M_PI*C/180;
	s=a*b*sin(rad)/2;
	c=pow(a*a+b*b-2*a*b*cos(rad),0.5);
	l=a+b+c;
	h=2*s/a;
	
	printf("%f %f %f\n",s,l,h);
	
	return 0;
}

Measured memory_bytes: 672
#include <cstdio>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
using namespace std;
int main()
{
	int n, r;
	cin >> n >> r;
	if(n>=10) 
	{
		cout << r;
	}
	else
	{
		cout << r+100*(10-n);
	}
	

	return 0;
}


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

using namespace std;
typedef long long ll;
typedef double dd;
#define all(v) v.begin()  ;v.end()
#define endl "\n"

void fast() {

    cin.tie(0);
    cin.sync_with_stdio(0);
}
int main(){
    string s;cin>>s;
    if(s=="ABC")cout<<"ARC";
    else cout<<"ABC";
}

Measured memory_bytes: 3628