akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define inf 1000000005
#define mod 1000000007
#define eps 1e-10
#define rep(i,n) for(int i = 0; i < (n); ++i) 
#define rrep(i,n) for(int i = 1; i <= (n); ++i) 
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define each(a,b) for(auto& (a): (b)) 
#define all(v) (v).begin(),(v).end() 
#define sz(v) (int)(v).size() 
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define mx(x,y) x=max(x,y) 
#define mn(x,y) x=min(x,y)
#define rev(v) reverse((v).begin(),(v).end());
#define so(v) sort((v).begin(), (v).end());
#define yn {puts("Yes");}else{puts("No");}
#define fi first
#define se second
#define pb push_back

using namespace std;

using ll = long long;
using P = pair<int,int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vp = vector<P>;
using vs = vector<string>; 

int main() {
    int a, b;
    string s;
  	cin>>s;
    ll ct;
    a = sz(s);
    b = 0;
    ct = 0;
    rep(i, a) {
        if (s.at(i) == 'W') {
            ct = ct +i-b;
            b++;
        }
    }
    cout << ct << endl;
    return 0;
}


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

# スペース区切りの整数の入力
a = int(input())
s = input()

temp = []
for i in range(1,a):
    x = s[:i]
    y = s[i:]
    x = set(list(x))
    y = set(list(y))
    temp.append(len(x & y))

# 出力
print("{}".format(max(temp)))


Measured memory_bytes: 2940
/*  CREATED BY
    STREAM_CIPHER
    29-aug-2020
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define debug1(a) cout<<#a<<"="<<(a)<<"\n"
#define debug2(a,b) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<"\n"
#define debug3(a,b,c) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<","<<#c<<"="<<(c)<<"\n"
#define fix_precision(n) cout << fixed << setprecision(n)
#define all(a) a.begin(),a.end()
const double pi=acos(-1.0);
int inf=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int mx=5*1000000;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    #endif
        string a;
        cin>>a;
        int sum=0;
        for(auto i:a)
            sum+=i-'0';
        cout<<((sum%9)?("No\n"):("Yes\n"));
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}

int main(){
    int n=in(),m=in();
    ll k=in();
    vecll a(n+1),b(m+1);
    a[0]=b[0]=0;
    rep(i,n)a[i+1]=a[i]+in();
    rep(i,m)b[i+1]=b[i]+in();
    int ans=0;
    rep2(i,0,n){
        if(a[i]>k)break;
        int ok=0,ng=m+1;
        while(ok+1<ng){
            int mid=(ok+ng)/2;
            if(a[i]+b[mid]<=k) ok=mid;
            else ng=mid;
        }
        ans=max(ans,i+ok);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6440
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;

ll X, Y;

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

  cin >> X >> Y;

  ll k = 1, count = 0;
  while (X*k <= Y) {
    ++count; k <<= 1;
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979

//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
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; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;

int main(){
    int A, B;
    cin >> A >> B;
    if (A >= 10 || B >= 10) cout << - 1 << endl;
    else cout << A * B << endl;
}

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

namespace ABC046C{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            var N = sr.Next<int>();
            var Q = sr.Next<long>(N, 2).Select(a => new{T = a[0], A = a[1]}).ToArray();

            var res = Q.Aggregate((q1, q2) =>{
                var mul = Math.Max((q1.T - 1) / q2.T, (q1.A - 1) / q2.A) + 1;
                return new{T = q2.T * mul, A = q2.A * mul};
            });

            Console.WriteLine(res.T + res.A);
            //---------------------------------
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];
        private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = _sr.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }

        public T[][] Next<T>(int y, int x){
            var ret = new T[y][];
            for(var i = 0; i < y; ++i) ret[i] = Next<T>(x);
            return ret;
        }
    }
}

Measured memory_bytes: 3544
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = min(a) + min(b)
for k in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, ((a[x - 1] + b[y - 1]) - c))
print(ans)

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

int main()
{
    string s, t;
    int num =0;

    cin >> s >> t;

    for (int i = 0; i < (int)s.size(); ++i) {
        if (s[i] != t[i]) {
            num++;
        }
    }

    cout << num;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int n,x[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
  cin>>n;n--;
  cout<<x[n];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int e,y;
  cin >> e >> y;
  if (e == 0) {
    if (y <= 1911) {
      cout << "M";
      cout << y-1867 << endl;
    } else if (y>=1912 && y<=1925) {
      cout << "T";
      cout << y-1911 << endl;
    } else if (y>=1926 && y<=1988) {
      cout << "S";
      cout << y-1925 << endl;
    } else if (y>=1989) {
      cout << "H";
      cout << y-1988 << endl;
    }
  } else if (e == 1) {
    cout << y+1867 << endl;
  } else if (e == 2) {
    cout << y+1911 << endl;
  } else if (e == 3) {
    cout << y+1925 << endl;
  } else if (e == 4) {
    cout << y+1988 << endl;
  }
}


Measured memory_bytes: 3116
#include <cstdio>

int a,b,c,d,e,f,W=0,S=0,t,T;
double h,H;
int main()
{
    scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
    for(int i=0; i<11; i++)
        for(int j=0; j<11; j++)
        {
            t=a*i*100+b*j*100;
            if(t<=f)
            {
                for(int I=0; I<600; I++)
                    for(int J=0; J<600; J++)
                    {
                        T=c*I+d*J;
                        if((t/100*e)>=T&&t+T<=f)
                        {
                            if(W==0&&S==0)
                                S=T,W=t+T;
                            else
                            {
                                h=(double)T/(double)(t+T)*(double)100;
                                H=(double)S/(double)(W)*(double)100;
                                if(h>H) S=T,W=t+T;
                            }
                        }
                    }
            }
        }
    printf("%d %d",W,S);
}


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

namespace CSharpSample01
{ 

    class Program
    {

        
        
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            string ans = "";

            while(N != 0)
            {
                if (N % 2 != 0)
                {
                    N--;
                    ans = "1" + ans;
                }
                else ans = "0" + ans;
                N /= -2;

            }

            if (ans == "") ans = "0";

            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(), (a).end()
const int64_t BIG_PRIME = 1000000007;

int main()
{
    char s[3];
    cin >> s;

    if (s[0] == s[1] && s[1] == s[2])
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // input
    ll N, M;
    cin >> N >> M;
    vector<ll> a(N);
    vector<pair<ll, ll>> cb(M);
    rep(i, N) { cin >> a[i]; }
    rep(i, M) { cin >> cb[i].second >> cb[i].first; }
    // output
    sort(a.begin(), a.end());
    sort(cb.rbegin(), cb.rend());
    int i = 0, j = 0;
    while (i < N && j < M) {
        ll tmp = 0;
        while (a[i] < cb[j].first && tmp < cb[j].second) {
            a[i] = cb[j].first;
            i++;
            tmp++;
        }
        j++;
    }
    ll ans = accumulate(a.begin(), a.end(), 0ll);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,c=1,j,l;
    long double p=0;
    cin>>n>>k;
    if(k==1)
    {
        p = 1;
        cout<<p;
    }
    else
    {
        while(c<=n)
        {
            l=0;
            j=c;
            while(j<=(k-1))
            {
                l++;
                j*=2;
            }
            p+=pow(0.5,l);
            c++;
        }
        cout<<setprecision(9)<<(p/n);
    }
    return 0;
}


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

int main(){

    int n, k, x, y;
    cin >> n >> k >> x >> y;

    int sum = 0;

    if(k > n)k = n;

    for(int i = 0; i < k; ++i)sum += x;

    for(int i = k; i < n; ++i)sum += y;

    cout << sum << endl;

    return 0;

}

Measured memory_bytes: 256
/*author* Priyanshu Shrivastav (from IIT Palakkad) *
 * *_ __ ___  _ ______ ___  _ ____   ___  ___| |_  *
 * | '_ ` _ \| '__/ __/ _ \| '_ \ \ / / |/ __| __| *
 * | | | | | | | | (_| (_) | | | \ V /| | (__| |_  *
 * |_| |_| |_|_|(_)___\___/|_| |_|\_/ |_|\___|\__| *
When I wrote this, only God and I understood what I was doing
 ** * * * * * * * Now, only God knows * * * * * * */
#include         <bits/stdc++.h>
using namespace std;
#pragma GCC      optimize ("Ofast")
#pragma GCC      optimize ("unroll-loops")
#pragma GCC      target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define IOS      ios_base::sync_with_stdio(false); cin.tie (nullptr)
#define PREC     cout.precision (10); cout << fixed
#define bg(x)    " [ " << #x << " : " << (x) << " ] "
#define x        first
#define y        second
using ll = long long;
using ff = long double;
using pii = pair<int,int>;

#define debug(args...) { \
/* WARNING : do NOT compile this debug func calls with following flags: // \
 * // -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_FORTIFY_SOURCE=2*/ \
   string _s = #args; replace(_s.begin(), _s.end(), ',', ' ');\
   stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); \
}
void err(istream_iterator<string> it) { it->empty();
   cerr << " (Line : " << __LINE__ << ")" << '\n';
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << fixed << setprecision(15) << " [ " <<  *it << " : " << a  << " ] "<< ' ';
	err(++it, args...);
}

const int MOD = (int)1e9 + 7;
const int K = (int)1e5 + 10, N = 103;
int n, k;
int ar[N];

int dp[K], cum[K];

int add(int a, int b) {
   a += b;
   if (a >= MOD) a -= MOD;
   return a;
}

int sub (int a, int b) {
   a -= b;
   if (a < 0) a += MOD;
   return a;
}

void solve() {
   for (int i = 1; i <= k; ++i) dp[i] = 0;
   dp[0] = 1;

   for (int i = 1; i <= n; ++i) {
      for (int j = 0; j <= k; ++j) {
         if (j) cum[j] = add(cum[j-1], dp[j]);
         else cum[j] = dp[j];
      }
      for (int j = k; j >= 0; --j) {
         int l = max(0,j-ar[i]), r = j;
         dp[j] = cum[r];
         if (l - 1 >= 0) dp[j]  = sub(dp[j], cum[l-1]);
      }
   }
   cout << dp[k] << '\n';
}


signed main() {
   IOS; PREC;
   cin >> n >> k;
   for (int i = 1; i <= n; ++i) cin >> ar[i];
   solve();

   return EXIT_SUCCESS;
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll MOD=1e9+7;
const int INF=1<<30;

int main(){
  vector<int> v(5);
  int k;
  rep(i,5){
    cin >> v[i];
  }
  cin >> k;
  sort(all(v));
  if(v[4]-v[0]>k){
    cout << ":(" << endl;
  }
  else{
    cout << "Yay!" << endl;
  }
  
}

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

int main(){
  string S;
  cin >> S;
  int tot=0;
  for(ll i=0;i<S.size();i++){
    tot+=(S.at(i)-'0');
  }
  if(tot%9==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}



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

struct Mo {
    vector<int> left, right, index;
    int window;
    int nl, nr, ptr;
    
    vector<int> a; // input
    vector<int> res; // output
    /* 問題ごとに書き換える */
    vector<int> count;
    int sum;
    
    
    Mo(int n, int q) {
        window = (int)sqrt(n); nl = 0; nr = 0; ptr = 0;
        left.resize(q);
        right.resize(q);
        index.resize(q); iota(index.begin(), index.end(), 0);

        a.resize(n);
        res.resize(q);
        /* 問題ごとに書き換える */
        count.assign(n, 0);
        sum = 0;
    }

    /* 問題ごとに書き換える */
    void add(int id) { if (count[a[id]]++ == 0) sum++; return; }
    void del(int id) { if (--count[a[id]] == 0) sum--; return; }
    
    /* culculation */
    void next() {
        int i = index[ptr++];
        while (left[i] < nl ) add(--nl);
        while (nr < right[i]) add(nr++);
        while (nl < left[i] ) del(nl++);
        while (right[i] < nr) del(--nr);
        res[i] = sum;
    }

    /* query sort ans culculation */
    void build() {
        sort(index.begin(), index.end(), [&](int a, int b) {
            if (left[a] / window != left[b] / window) return left[a] < left[b];
            if((left[a] / window) % 2) return right[a] > right[b];
            return right[a] < right[b];
        } );
        for (int i = 0; i < (int)index.size(); i++) next();
    }
};

int n, q, x, l, r;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  
    scanf("%d %d", &n, &q);
    Mo mo(n, q);
    for (int i = 0; i < n; i++) { scanf("%d", &x); mo.a[i] = --x; }
    for (int i = 0; i < q; i++) { scanf("%d %d", &l, &r); mo.left[i] = --l; mo.right[i] = r; }

    mo.build();
    for (int i = 0; i < q; i++) printf("%d\n", mo.res[i]);
    return 0;
}


Measured memory_bytes: 15420
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto a = readln.chomp.split.to!(int[]);

  int[9] res;
  foreach (i; 0..n) {
    foreach (j; 1..9) {
      if (a[i] < 400 * j) {
        res[j-1]++;
        break;
      }
    }
    if (a[i] >= 3200) {
      res[8]++;
    }
  }
  int cnt;
  foreach (i; 0..8) {
    if (res[i]) {
      cnt++;
    }
  }
  int r_min, r_max;
  r_min = cnt;
  if (!cnt && res[8]) {
    r_min = 1;
  }
  r_max = cnt + res[8];
  writeln(r_min, " ", r_max);
}


Measured memory_bytes: 256
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
#define mkpr make_pair
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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

  int N, M; cin >> N >> M;
  vc num(N, 'N');
  REP(i,M) {
    int S; char C; cin>>S>>C;
    S--;
    if (num[S]!='N' && num[S]!=C) {
      cout << -1 << endl;
      return 0;
    }
    num[S] = C;
  }
  if (N>1 && num[0] == '0') {
    cout << -1 << endl;
    return 0;
  }

  if (N==1 && num[0] == 'N') {
    cout << 0 << endl;
    return 0;
  }

  string ans = "";
  REP(i,N) {
    if (num[i] == 'N') ans += i==0 ? '1' : '0';
    else ans +=  num[i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long int a,b,n,i;
    cin>>n;
    for(i=1;i<10;i++){
        if(n%i==0&&n/i>0&&n/i<10){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}



Measured memory_bytes: 256
n = int(input())
res = []
for i in range(n):
    s, p = input().split()
    res.append((s, int(p), i+1))
res.sort(key = lambda x: x[1], reverse = True)
res.sort(key = lambda x: x[0])
for s, p, i in res:
    print(i)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    string s;cin>>s;
    ll sum=0;
    int num=0;
    rep(i,s.size()){
        num=(int)(s.at(i)-'0');
        sum+=num;
    }
    if(sum%9==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }



    
}

Measured memory_bytes: 3752
a[101],b[101];j;k;x;y;z;main(){for(;~scanf("%d%d",a+k++,b+k););for(;j++-*a;printf("%d ",z))for(k=0;k++-*b;k==1|x<y?y=x,z=k:0)x=abs(a[j]-a[*a+k])+abs(b[j]-b[*a+k]);}

Measured memory_bytes: 128
import numpy as np
def solve(n, x, y, h):
    for cx in range(101):
        for cy in range(101):
            ok = False
            for i in range(n):
                if h[i] > 0:
                    H = h[i] + abs(x[i] - cx) + abs(y[i] - cy)
                    ok = True
                    break
            if ok:
                for i in range(n):
                    h_i = max(H - abs(x[i] - cx) - abs(y[i] - cy), 0)
                    if h_i != h[i]:
                        ok = False
                        break
            if ok:
                return "%d %d %d" % (cx, cy, H)

n = input()
x, y, h = np.zeros(n,int), np.zeros(n,int), np.zeros(n,int)
for i in range(n):
    x[i], y[i], h[i] = map(int, raw_input().split())
print solve(n, x, y, h)

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

void solve() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    bool flag = 0;
    while(k--) {
        if(c <= b) c *= 2;
        else if(b <= a) b *= 2;
    }
    if(a < b && b < c) puts("Yes");
    else puts("No");
}

int main() {
//    freopen("in.txt", "r", stdin);
    solve();
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e10;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    int n;
    int a[200010];
    cin >> n;
    rep(i,n) cin >> a[i];
    int m = 1000000;
    int c = 0;
    rep(i,n){
        if (a[i] <= m) c++;
        chmin(m,a[i]);
    }
    PRINT(c);
}


Measured memory_bytes: 1024
inputa = list(map(int, input().split()))
inputb = list(input())
#double mountain
mountain = 0
for i in range(min(inputa[1], inputa[2]) - 1, max(inputa[3], inputa[4])):
  if inputb[i] == "#":
    if mountain == 1:
      mountain = 2
      break
    mountain = 1
  else:
    mountain = 0

if mountain == 2:
  print("No")
  exit()
    
#need oikoshi
oikoshi = 0
if inputa[3] > inputa[4]:
  oikoshi = 1

#triple step
triplestep = 0
for i in range(inputa[2] - 1, inputa[4]):
  if oikoshi == 0:
    break
  if inputb[i - 1] == ".":
    if inputb[i] == ".":
      if inputb[i + 1] == ".":
        triplestep = 1
        break

if oikoshi == 0:
  print("Yes")
else:
  if triplestep == 1:
    print("Yes")
  else:
    print("No")

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

#define ll long long
#define p_q priority_queue
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)


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

    string a,b;
    cin>>a>>b;

    string w="";
    for(int i=0;i<n;i++){
        w += a.at(i);
        w += b.at(i);
    }

    cout<<w<<endl;
}



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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
T GCD(T a, T b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
template<class T>
T LCM(T a, T b) {
	return a / GCD(a, b) * b;
}
template<class T>
inline T round_int(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	for (int i = 1; i <= b; ++i) {
		if (a * i % b == c) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n , k , q , p[100005] , a;
int main(){
	cin >> n >> k >> q;
	for(int i = 1; i <= q ; i++){
		cin >> a;
		p[a]++;
	}
	for(int i = 1 ; i <= n ; i++){
		if(p[i] - q + k <= 0)cout << "No" << endl;
		else cout << "Yes" << endl;
	}
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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(){
  vector<char> s(10);
  rep(i,10){
    cin >> s[i];
  }
  if(s[5]=='1'){
    print("TBD");
  }
  else{
    if(s[6]!='1'&&s[6]!='2'&&s[6]!='3'&&s[6]!='4'){
      print("TBD");
    }
    else{
      print("Heisei");
    }
  }
}

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

int main()
{
    char a[100000];
    scanf("%s",&a);
    int b=0,len=strlen(a);
    char temp=a[0];

    for(int i=1;i<len;i++)
    {
        if(a[i]!=temp)
        {
            temp=a[i];
            b++;
        }
    }
    if(b>0)
    {
        cout<<b<<endl;
    }
    else
    {
        cout<<0<<endl;
    }
    return 0;
}


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

int num(vector<int> e, int m){
	int ret = 0;
	for(int i=0; i<e.size(); i++) if(m <= e[i]) ret++;
	
	return ret;
}

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

	vector<int> e(n+1, 0);
	for(int i=2; i<=n; i++){
		int cur = i;
		for(int j=2; j<=i; j++){
			while(cur%j == 0){
				e[j]++;
				cur /= j;
			}
		}
	}

	int d75 = num(e,74);
	int d25_3 = num(e,24)*(num(e,2)-1);
	int d15_5 = num(e,14)*(num(e,4)-1);
	int d_5_5_3 = num(e,4)*(num(e,4)-1)*(num(e,2)-2)/2;

	cout << d75+d25_3+d15_5+d_5_5_3 << endl;
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  ll w,h,x,y;
  cin >> w >> h >> x >> y;
  bool a = (2*x==w)&&(2*y==h);
  cout << (double)w*(double)h/2 << " " << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
#define all(v) v.begin() , v.end()
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define tr(con) for(auto it = con.begin(); it!= con.end() ; it++)
#define INF 1e9+7   // 1 * 10^9+ 7
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define fo(i,n) for(ll i=0;i<n;i++)
using namespace std;

int main(){
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long a,b,c;
	cin >> a>>b>>c;
	if(c-(a-b)<=0)
		c=0;
	else
		c=c-(a-b);
	cout << c;

	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
using Int = long long;
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
int main()
{
    int N, W; cin >> N >> W;
    map<int, int> M;
    M[0] = 0;
    REP(i, N) {
        int w, v; cin >> w >> v;
        vector<pair<int, int>> ins;
        for (auto p : M) {
            int weight = w + p.first;
            if (weight <= W) {
                auto it = M.find(weight);
                if (it == M.end() || it->second < p.second + v) {
                    ins.emplace_back(weight, p.second + v);
                }
            }
        }
        for (auto p : ins) {
            M[p.first] = p.second;
        }
    }
    int ans = 0;
    for (auto p : M) ans = max(ans, p.second);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int N = s.size();
  int w = 1;
  for(int i = 0; i < N; i++) {
    if(!(s.at(i) == s.at(N - 1 - i))) {
      w--;
      break;
    }
  }
  for(int i = 0; i < (N - 1) / 2; i++) {
    if(!(s.at(i) == s.at((N - 1) / 2 - 1 - i))) {
      w--;
      break;
    }
  }
  for(int i = (N + 3) / 2 - 1; i < N; i++) {
    if(!(s.at(i) == s.at(N - 1 - i))) {
      w--;
      break;
    }
  }
  if(w == 1) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ull = unsigned long long;
using P = pair<int, int>;


char A[55][55];
char B[55][55];

ull E = 1000000007;

int main() {
    int N, M;
    cin >> N >> M;
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    for (int i = 0; i < M; ++i) {
        cin >> B[i];
    }
    for (int w = 0; w <= N - M; ++w) {
        for (int h = 0; h <= N - M; ++h) {
            bool flag = true;
            for (int i = 0; i < M; ++i) {
                for (int j = 0; j < M; ++j) {
                    if (A[w + i][h + j] != B[i][j]) {
                        flag = false;
                        break;
                    }
                }
                if (!flag) break;
            }
            if (flag) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


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

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

    static class TaskA {
        static final long MODULO = (long) (1e9 + 7);

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int avail = 0;
            long res = 1;
            for (int i = 0; i < n; ++i) {
                int x = in.nextInt();
                ++avail;
                while ((avail - 1) * 2 >= x) {
                    res = res * avail % MODULO;
                    --avail;
                }
            }
            while (avail > 0) {
                res = res * avail % MODULO;
                --avail;
            }
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

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

    }
}



Measured memory_bytes: 36468
#include <stdio.h>
#include <algorithm>
using namespace std;

typedef long long ll;
ll n, cnt[100100], p = 998244353;
int main(void) {
	scanf("%lld", &n);
	ll x; scanf("%lld", &x);
	if (x != 0) return !printf("0\n");
	cnt[0] = 1;

	for (ll i = 1; i < n; i++) {
		scanf("%lld", &x);
		cnt[x]++;
	}
	
	if (cnt[0] != 1) return !printf("0\n");

	while (cnt[n] == 0) n--;

	ll ans = 1;
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < cnt[i + 1]; j++) {
			ans *= cnt[i];
			ans %= p;
		}
	}
	
	printf("%lld\n", ans);
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int s,w;
    cin >> s >> w;
    if(w>=s)cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}


Measured memory_bytes: 3632
n = int(input())
hs = map(int, input().split())
c = 0
mc = 0
v = 0
for i, h in enumerate(hs):
  if i == 0:
    v = h
    continue
  if h <= v:
    c += 1
  else:
    mc = max(mc, c)
    c = 0
  v = h
mc = max(mc, c)
print(mc)

Measured memory_bytes: 11128
S = input()
T = input()

dic = {}
flag=True

for i in range(len(S)):
    v = S[i]
    w = T[i]
    key=''

    if v not in dic.keys() and w not in dic.values():
        dic[v]=w
    elif w in dic.values():
        for k in dic.keys():
            if dic[k]==w:
                key=k
        if v!=key:
            flag=False
    else:
        flag=False


if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 43580
#include <stdio.h>
#include <math.h>
#define MAX 2000000001
#define INF 2000000001

void maxHeapify(int i);
int extract();
void increaseKey(int,int);
void insert(int);
int H,A[MAX+1];

int main(){
  int key;
  char com[10];

  while(1){
      scanf("%s",com);

      if(com[0]=='e'&&com[1]=='n') break;

      if(com[0]=='i'){
          scanf("%d",&key);
          insert(key);
      }
      else{
          printf("%d\n",extract());
      }
  }

  return 0;
}

int parent(i){
  return floor(i/2);
}

int left(i){
  return 2*i;
}

int right(i){
  return 2*i+1;
}

void maxHeapify(int i){
  int l, r, largest, tmp;
  l=left(i);
  r=right(i);

  if(l<=H && A[l]>A[i]) largest=l;
  else largest=i;
  if(r<=H && A[r]>A[largest]) largest=r;

  if(largest!=i){
    tmp=A[i];
    A[i]=A[largest];
    A[largest]=tmp;
    maxHeapify(largest);
  }
}

int extract(){
    int max;

    if(H<1) return -INF;

    max=A[1];
    A[1]=A[H--];
    maxHeapify(1);

    return max;
}

void increaseKey(int i,int key){
    int tmp;

    if(key<A[i]) return;

    A[i]=key;

    while(i>1&&A[i/2]<A[i]){
        tmp=A[i];
        A[i]=A[i/2];
        A[i/2]=tmp;

        i/=2;
    }
}

void insert(int key){
    H++;

    A[H]=-INF;

    increaseKey(H,key);
}


Measured memory_bytes: 5768
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout <<fixed<<setprecision(12);
        cerr <<fixed<<setprecision(12);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a=max(a,b))==b;}
template<class T>bool chmin(T &a, const T &b){return(a=min(a,b))==b;}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int h, w, n;
vector<int> a;
int m[105][105];

signed main() {

    cin >> h >> w >> n;
    a.resize(n);

    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    //a.bash(INF);
    int p = 0, c =  0;
    int y = 0, x = 0;
    bool d = true;
    while(true) {
        if(x==w) break;
        m[y][x] = p + 1;
        c++;
        if(c==a[p]) c = 0, p++;
        if(d) {
            if(y + 1 == h)
                d = false, x++;
            else
                y++;
        }
        else{
            if(y == 0)
                d = true, x++;
            else
                y--;
        }
    }

    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            cout << m[i][j] << " \n"[j+1 == w];
        }
    }
  
    return 0;
}



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

int main(){
    int N,K;
    set<int> dic;
    cin>>N>>K;
    for(int i=0; i<K; i++){
        int d;
        cin>>d;
        dic.insert(d);
    }

    for(int cur=N; cur<=10*N; cur++){
        string tmp;
        bool flag = true;
        tmp = to_string(cur);
        for(int i=0; i<tmp.size(); i++){
            int keta = tmp[i] - '0';
            if(dic.count(keta)){
                flag = false;
                break;
            }
        }
        if(flag){
            cout<<cur<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;
int main(void){
    int a,b,c; cin>>a>>b>>c;
    map<int,int> mp;
    mp[a]++;
    mp[b]++;
    mp[c]++;
    if(mp[5]==2 && mp[7]==1) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//絶対値
long long int change_plus(long long int a) {
	if (a < 0) { return -a; }
	if (a >= 0) { return a; }
}
//大小比較(大)
long long int big(long long int a, long long int b) {
	if (a >= b) {
		return a;
	}
	else {
		return b;
	}
}

//大小比較(小)
long long int small(long long int a, long long int b) {
	if (a >= b) {
		return b;
	}
	else {
		return a;
	}
}

int main() {
	long long int n, m, k = 0;
	char str[15],str2[160],str3[15];
	scanf("%s%s%s",str,str2,str3);
	
	printf("%c%c%c",str[0],str2[0],str3[0]);
}


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

bool cmp(P a, P b) {
    if (a.first.first != b.first.first)
        return a.first.first < b.first.first;
    else
        return a.first.second > b.first.second;
}

int main() {
    int n;
    cin >> n;
    vector<P> v(n);

    rep(i, n) {
        string s;
        int p;
        cin >> s >> p;
        v[i].first = {s, p};
        v[i].second = i + 1;
    }

    sort(v.begin(), v.end(), cmp);

    for (auto e : v) cout << e.second << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

typedef long long ll;

using namespace std;

int main(){

    ll x;
    cin >> x;

    vector<bool> prime(x + 1, true);

    prime[0] = false;
    prime[1] = false;

    for(ll i = 2; i <= x; i++){
        if(prime[i] && i * i <= x){
            for(ll j = i * i; j <= x; j = j + i){
                prime[j] = false;
            }
        }
    }

    cerr << "check" << endl;

    while(true){
       

        bool p = true;

        for(ll i = 2; i <= x; i++){
            if(i * i <= x && prime[i]){
                if(x % i == 0){
                    p = false;
                    break;
                }
            }
        }

        if(p){
            cout << x << endl;
            break;
        }

        x++;
    }



    return 0;
}


Measured memory_bytes: 256
#import sys
#input = sys.stdin.readline
def main():
    N, s, t = map( int, input().split())
    if N <= 2:
        print("! " + str(s) + " " +str(t))
        return
    print("? "+ str(s) + " " + str(t))
    d = int( input())
    D = [(0, 0) for _ in range(N)]
    for i in range(N):
        print("? " + str(s) + " " + str(i+1), flush=True)
        D[i] = ( int( input()), i+1)
    D.sort()
    F = [0]*(N+1)
    for i in range(1, N+1):
        print("? " + str(t) + " " + str(i), flush = True)
        F[i] = int( input())
    ANS = [s]
    now = 0
    for i in range(1, N):
        if D[i][0] == d:
            ANS.append(t)
            break
        if now == D[i][0]:
            continue
        if D[i][0] + F[D[i][1]] == d:
            ANS.append(D[i][1])
            now = D[i][0]
    print("! " + " ".join( map( str, ANS)))
if __name__ == '__main__':
    main()




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

int main() {
  int a[3][3];
  int b,c;
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> a[i][j];
    }
  }
  cin >> b;
  for(int k=0;k<b;k++){
    cin >> c;
    for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      if(a[i][j]==c)a[i][j]=0;
    }
  }
  }
    bool exist = false;
    for(int i=0;i<3;i++){
      if(a[i][0]==0&&a[i][1]==0&&a[i][2]==0)exist = true;
    }
    for(int i=0;i<3;i++){
      if(a[0][i]==0&&a[1][i]==0&&a[2][i]==0)exist = true;
    }
    if(a[0][0]==0&&a[1][1]==0&&a[2][2]==0)exist=true;
    if(a[0][2]==0&&a[1][1]==0&&a[2][0]==0)exist=true;
    if(exist) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3604
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Monster a = new Monster(scanner.nextInt(), scanner.nextInt());
        Monster b = new Monster(scanner.nextInt(), scanner.nextInt());

        while (true) {
            b.hp = b.hp - a.attack;
            if (b.hp <= 0) {
                System.out.println("Yes");
                System.exit(0);
            }

            a.hp = a.hp - b.attack;
            if (a.hp <= 0) {
                System.out.println("No");
                System.exit(0);
            }
        }

    }

    static class Monster {
        int hp;
        int attack;

        public Monster(int hp, int attack) {
            this.hp = hp;
            this.attack = attack;
        }
    }


}

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

int x1,x2,Y;


int main(){
Y=0;    
cin>>x1>>x2;

 if (x1<x2)
   Y=x2 - x1;
 else
   Y=(x2 - x1)*(-1);
cout<<Y<<endl;

return 0;
}


Measured memory_bytes: 3108
s = raw_input()
s = filter(lambda x: x == 'C' or x == 'F', s)

flag = False
if 'C' not in s:
    flag= True
    print "No"

if not flag:
    flag = False
    i = s.index('C')
    s_ = filter(lambda x: x== 'F', s[i:len(s)])
    if len(s_) == 0:
        print "No"
        flag = True

    if not flag:
        print "Yes"


Measured memory_bytes: 2568
#ifdef DEBUG
#include <LeetcodeHelper.h>
#include <prettyprint.hpp>
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int cost(const vector<int>& v, int k) {
  int n = v.size();
  vector<int> dp(n, INT_MAX);
  dp[0] = 0;
  for (int i = 1; i < n; ++i) {
    for(int j = 1; j <= k; ++j) {
      if (i - j >= 0) {
        dp[i] = min(dp[i], dp[i - j] + abs(v[i] - v[i - j]));
      }
    }
  }
  return dp[n-1];
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for(auto& e: v) {
    cin >> e;
  }
  cout << cost(v, k) << '\n';
  return 0;
}


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

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

int main(){
    int W, H, C;
    cin >> W >> H >> C;

    int ans = (W / gcd(W, H)) * (H / gcd(W, H)) * C;
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3112
#include <iostream>

using namespace std;

int main()
{
	int a[3], flg[3];
	int mid, min, max;
	int minp, maxp, midp;
	int sum = 0;

	cin >> a[0] >> a[1] >> a[2];

	for (int i = 0; i < 3; i++) {
		flg[i] = 0;
	}

	mid = min = max = a[0];
	minp = maxp = midp = 0;
	for (int i = 1; i < 3; i++) {
		if (a[i] > max) {
			max = a[i];
			maxp = i;
			flg[i] = 1;
		}
		if (a[i] < min) {
			min = a[i];
			minp = i;
			flg[i] = 1;
		}
	}
	for (int i = 0; i < 3; i++) {
		if (flg[i] == 0) {
			midp = i;
			break;
		}
	}
	sum += abs(a[midp] - a[minp]);
	sum += abs(a[maxp] - a[midp]);

	cout << sum << endl;


	return 0;
}


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

void solve() {
    long long a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    long long  ans = 0;
    while(x > 0 || y > 0) {
        long long  f = min(x, y);
        if(f <= 0) {
            f = max(x, y);
        }
        long long  q = c * f * 2;
        long long  w = (a * min(f, x)) + (min(f, y) * b);
        ans += min(q, w);
        x = max(0ll, x - f);
        y = max(0ll, y - f);
    }
    cout << ans;
}

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


Measured memory_bytes: 3656