akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define LOCAL
#pragma region Macros
typedef long long ll;
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X,K,D; cin >> X >> K >> D;
    X=abs(X);
    ll Y=X%D;
    if ((X-Y)/D>K){cout << X-K*D << '\n'; return 0;}
    ll cnt=(X-Y)/D;
    cout << ((K-cnt)&1?abs(Y-D):Y) << '\n';
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int> > mtr(n, vector<int>(m));
    vector<int> vec(m);
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            cin >> mtr[i][j];
        }
    }
    for(int i=0; i<m; i++){
        cin >> vec[i];
    }

    for(int i=0; i<n; i++){
        int ret=0;
        for(int j=0; j<m; j++){
            ret += mtr[i][j]*vec[j];
        }
        cout << ret << endl;
    }
    return 0;
}

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

using ll = long long;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c == 2 * max({a, b, c})) cout << "Yes\n";
    else cout << "No\n";
}

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

int n, A[20];

bool search(int s, int m, int i){
    if (i == n) return s == m;
    else {
        bool u = search(s+A[i], m, i+1);
        bool v = search(s, m, i+1);
        return u || v;
    }
}

int main(void){
    int q, m;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> A[i];
    cin >> q;
    for (int j = 0; j < q; j++) {
        cin >> m;
        bool t = search(0, m, 0);
        if (t == 1) cout << "yes" << endl;
        else cout << "no" << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
# coding: utf-8
# Your code here!

N = int(input())
A = []
sum = 0

for i in range(N) : 
    a, b = input().split()
    A.append((a, b))
    
for i in range(N) : 
    if A[i][1] == "JPY" : sum += float(A[i][0])
    else : sum += float(A[i][0])*380000.0

print(sum)

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

using namespace std;

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

    long long H, rep=0, finale=0;
    cin>>H;

    while (H>=1)
    {
        finale+=pow(2, rep);
        rep++;
        H/=2;
    }
    cout<<finale;




}


Measured memory_bytes: 256
/* ***********************************************
Author        :taciturnity
Created Time  :2020/2/21 8:23:51
File Name     :TEST.cpp
************************************************ */
 
#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <cmath>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define ll long long
#define INF 0x3f3f3f3f
#define rep(i,x,y) for(int i = x;i <= y;++i)
#define fori(i,x,y) for(int i = x;i >= y; -- i)
#define bug puts("--------------")
#define out(x) cout<<x<<'\n';
inline char gc(){char op[2];scanf("%s",op);return op[0];}
const int N = 1e6+10;
const double eps = 0.00000001;
const ll mod = 1e9 ;
using namespace std;
ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int a[N];
int main(){
    int k = read(),n = read();
    rep(i,1,n) a[i] = read();
    sort(a+1,a+n+1);
    int M = INF;
    rep(i,1,n-1){
        M = min(M,a[i]+(k-a[i+1]));
    }
    M = min(M,a[n]-a[1]);
    cout<<M;
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;

    int ans = INT_MAX;

    for(int i = 0; i < s.size()-2; ++i){
        int tmp = stoi(s.substr(i,3));
        ans = min(ans, abs(753-tmp));
    }

    ppp(ans);



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    int n, K;
    cin >> n >> K;
    vector<pair<ll, ll>> xy(n);
    vector<ll> x(n), y(n);
    for(int i = 0; i < n; i++) {
        cin >> xy[i].first >> xy[i].second;
        x[i] = xy[i].first;
        y[i] = xy[i].second;
    }
    sort(all(xy));
    sort(all(x));
    sort(all(y));
    ll ans = LLONG_MAX;
    for(int i = 0; i < n; i++) {
        for(int j = i + 1; j < n; j++) {
            for(int k = 0; k < n; k++) {
                for(int l = k + 1; l < n; l++) {
                    int count = 0;
                    for(int p = 0; p < n; p++) {
                        if(xy[p].first >= x[i] && xy[p].first <= x[j] &&
                           xy[p].second >= y[k] && xy[p].second <= y[l]) {
                            count++;
                        }
                    }
                    if(count >= K) {
                        ans = min(ans, (x[j] - x[i]) * (y[l] - y[k]));
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

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

int main(){
  int N;
  cin>>N;
  vector<int> A(N+2),B(N+2),C(N+2);
  A[0]=0;
  A[N+1]=0;
  for(int i=1;i<N+1;i++)
    cin>>A[i];
  B[0]=0;
  C[N+1]=0;
  for(int i=0;i<N+1;i++)
    B[i+1]=B[i]+abs(A[i+1]-A[i]);
  for(int i=N+1;i>0;i--)
    C[i-1]=C[i]+abs(A[i]-A[i-1]);
  for(int i=0;i<N;i++)
    cout<<B[i]+C[i+2]+abs(A[i+2]-A[i])<<endl;
}

Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int X, A, B; cin >> X >> A >> B;
  int result = (X-A)%B;
  cout << result << endl;
  return 0;
}

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

using namespace std;

class range {
private:
  struct Iterator {
    int val;
    int operator*() {return val;}
    bool operator!=(Iterator &itr) {return val < itr.val;}
    void operator++() {++val;}
  };
  Iterator i, n;
public:
  range(int n) : i({0}), n({n}) {}
  range(int i, int n) : i({i}), n({n}) {}
  Iterator &begin() {return i;}
  Iterator &end() {return n;}
};

template<class T> T at(vector<T> v, int i) {return v[(i % (int)v.size() + v.size()) % v.size()];}

int main() {
  int t, d, ta, tb, da, db;
  cin >> t >> d >> ta >> tb >> da >> db;
  double res = 1e9;
  for (int i : range(d + 1)) if (i % da == 0) {
    for (int j : range(d + 1)) if (j % db == 0) {
      if (1 <= i + j && i + j <= d) res = min(res, abs(t - (double)(ta * i + tb * j) / (i + j)));
    }
  }
  cout << fixed << setprecision(15) << res << endl;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long a, b, x;
  long long ans = 0;
  cin >> a >> b >> x;
  if((a % x) == 0)
  {
    ++ans;
  }
  ans += (b / x) - (a / x);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    int n,k;
    int ans = 0;


    cin >> n >> k;

    ans = (n + k * 2) / (k * 2 + 1);
    cout << ans << endl;


}



Measured memory_bytes: 256
/*Always success does not build on success,success build on failure*/
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define vec         vector<int>
#define map         map<int,int>
#define scn(t)      scanf("%d",&t);
#define lscn(t)      scanf("%lld",&t);
#define mod         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define endl        "\n"
using namespace std;
const int N=1e5+5;
vec v[N];
int visit[N];
stack<int> s;
void dfs(int node)
{
    visit[node]=1;
    for(auto it:v[node])
    {
        if(visit[it]==0)
        dfs(it);
    }
    s.push(node);
}
int main()
{
   int n,e;
   scn(n);
   scn(e);
   
   rep(i,0,e)
   {
       int u,v1;
       scn(u);
       scn(v1);
       
       v[u].pb(v1);
   }
   
   for(int i=1;i<=n;i++)
   {
       if(visit[i]==0)
       {
           dfs(i);
       }
   }
   int ans[n+1];
   for(int i=1;i<=n;i++)
   ans[i]=0;
   int mi=0;
   while(!s.empty())
   {
       int z=s.top();
       s.pop();
       
       for(auto it:v[z])
       {
           ans[it]=max(ans[z]+1,ans[it]);
           mi=max(mi,ans[it]);
       }
   }
   cout<<mi<<endl;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int M1, D1, M2, D2;
    cin >> M1 >> D1 >> M2 >> D2;
    if (D2 == 1) {
        cout << 1 << '\n';
    }else{
        cout << 0 << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

#define long long long int
using namespace std;


#ifdef JUDGE
std::ifstream cin("input.txt");
std::ofstream cout("output.txt");
#else
using std::cin;
using std::cout;
#endif

using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(6);


    int n;
    cin >> n;
    long ans = LONG_LONG_MAX;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for (int j = a[0]; j <= a[a.size() - 1]; ++j) {
        long tmp = 0;
        for (int i : a) {
            tmp += (i - j) * (i - j);
        }
        ans = min(ans, tmp);
    }

    cout << ans;
    return 0;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int d[n];
    for(int i=0;i<n;i++)cin >> d[i];
    sort(d,d+n);
    int ans=1;
    for(int i=1;i<n;i++){
        if(d[i-1]<d[i]) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 3612
#!/usr/bin/env python3
import sys

N, A, B = map(int, input().split())

if A > B:
    print(0)
    sys.exit(0)

if N == 1:
    if A == B:
        print(1)
        sys.exit(0)
    else:
        print(0)
        sys.exit(0)

max_ = A + (N-1)*B
min_ = A*(N-1) + B

print(max_ - min_ + 1)


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
  gearup;
  ll h,w; cin >> h >> w;
  vvl a(h,vl(w));
  rep(i,h)rep(j,w)cin>>a[i][j];
  vpii s;
  vector<pair<pair<int,int>,pair<int,int> > > res;
  rep(i,h){
      rep(j,w){
          int k = j;
          if(i & 1)k = w - 1 - j;
          s.emplace_back(i,k);
      }
  }
  rep(i,h*w-1){
      int x = s[i].first;
      int y = s[i].second;
      if(a[x][y] & 1){
          int nx = s[i+1].first;
          int ny = s[i+1].second;
          a[nx][ny]++;
          res.emplace_back(s[i],s[i+1]);
      }
  }
  out(res.size());
  rep(i,res.size()){
      cout << res[i].first.first+1 << " " << res[i].first.second+1
       << " " << res[i].second.first+1<< " " << res[i].second.second+1 << endl;
  }
}


Measured memory_bytes: 8176
#include <stdio.h>

int main()
{
  int n = 0, i = 0, count = 0;
  int* arr = NULL;
  scanf("%d", &n);
  arr = new int[n];
  for (; i < n; ++i)
  {
    scanf("%d", &arr[i]);
  }
  for (i = 0; i < n; ++i)
  {
    if (-1 != arr[i] && -1 != arr[arr[i] - 1] && arr[arr[i] - 1] == i + 1)
    {
      ++count;
      arr[i] = arr[arr[i] - 1] = -1;
    }
  }
  printf("%d", count);
  delete[] arr;
}

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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

typedef long long ll;
typedef pair<int,int> p;

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

#define MAX_N 50

ll N, A, B;
map<ll, ll> cnt;
double v[MAX_N];
ll c[51][51];
int main(){
    ios::sync_with_stdio(false);
    cin >> N >> A >> B;
    REP(i,N) {
        cin >> v[i];
        cnt[v[i]]++;
    }
    
    REP(i,51) c[i][0] = 1;
    FOR(i,1,51) {
        FOR(j,1,i+1) {
            c[i][j] = c[i-1][j-1]+c[i-1][j];
        }
    }
    
    
    sort(v,v+N);
    double sumv = 0;
    double maxavg;
    int idx;
    map<ll, ll> cnt2;
    REP(i,N) {
        sumv+=v[N-1-i];
        cnt2[v[N-1-i]]++;
        if(A == i+1) {
            maxavg = sumv/(i+1);
            idx = i;
            break;
        }
    }
    
    ll ans = 0;
    if (v[N-1-idx] != v[N-1]) {
        ans = c[cnt[v[N-1-idx]]][cnt2[v[N-1-idx]]];
    } else {
        for(int i=A;i<=min(B,cnt[v[N-1]]);i++){
            ans+=c[cnt[v[N-1]]][i];
        }
    }
    
    cout << fixed << setprecision(15) << maxavg << endl;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left, bisect
n=int(input())
la=sorted(list(map(int,input().split())))
lb=list(map(int,input().split()))
lc=sorted(list(map(int,input().split())))
ans=0
for i in lb:
    ans+=bisect_left(la,i)*(len(lc)-bisect(lc,i))
print(ans)

Measured memory_bytes: 23744
#include <bits/stdc++.h>
    #include<math.h>
    #include<algorithm> 
    #define rep(i,n) for (int i = 0; i < (n) ; ++i)
    using namespace std;
    using ll = long long ;
    using P = pair<int, int> ;
    #define PI 3.14159265358979323846264338327950
    #define INF 1e18
    #define mod 1000000007 
     
    int modpow(ll a, ll n, ll p = mod) {
        if(n == 0) return 1 ;
        if(n == 1) return a%p ;
        if(n%2 == 1) return (a*modpow(a, n-1, p))%p ;
        ll t = modpow(a, n/2, p) ;
        return (t%p*t%p) % p ;
    }
    int main (){
        ll n, a, b ;
        cin >> n >> a >> b ;
        ll da = 1 ; 
        ll db = 1 ;
        ll na = a; 
        ll nb = b;
        rep(i, na){
            ll tm = ((n-i) % mod) * (modpow(a, mod-2)) ;
            tm %= mod ;
            da *= tm ;
            da %= mod ;
            a-- ;
        }
        rep(i, nb){
            ll tm = ((n-i) % mod) * (modpow(b, mod-2));
            tm %= mod ;
            db *= tm ;
            db %= mod ;
            b-- ;
        }
        ll ans = modpow(2, n) - 1 - da - db  ;
        while(ans < 0){
            ans += mod ;
        }
        ans %= mod ;
        cout << ans << endl ;
    }

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

int main(){
    int a,b;
    char op;
    while(true){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='?')break;
        switch(op){
            case '+':
            printf("%d\n",a+b);
            break;
            case '-':
            printf("%d\n",a-b);
            break;
            case '*':
            printf("%d\n",a*b);
            break;
            case '/':
            printf("%d\n",a/b);
            break;
        }
    }
}


Measured memory_bytes: 3184
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int A[4];
  
  
  A[0]=N/1000;
  A[3]=N%10;
  A[2]=(N%100-A[3])/10;
  A[1]=(N%1000-A[3]-(10*A[2]))/100;
  
  char op[3];
  
  for(int tmp=0;tmp<(1<<3);tmp++) {
    bitset<3> s(tmp);
    
    int sum=A[0];
    
    for(int i=0;i<3;i++) {
      if(s.test(i)){
        sum+=A[i+1];
        op[i]='+';
      }
      else{
        sum-=A[i+1];
        op[i]='-';
      }
    }
    if(sum==7){
      break;
      
    }
  }
  cout<<A[0]<<op[0]<<A[1]<<op[1]<<A[2]<<op[2]<<A[3]<<"=7"<<endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cstring>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}
/*
ll Integer_factorization(ll n){
    ll num = 0;
    ll ndash = n;
    if(n == 1) return 1;
    ll a = 2;
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    return num;
}
*/

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}

int memo[10000000];

int fib(int i){
    if(i <= 1) return i;
    if(memo[i] != 0) return memo[i];
    return memo[i] = fib(i-1)+fib(i-2);
}

ll dig(ll n){
    ll d = 0;
    while(n != 0){
        n/=10;
        d++;
    }
    return d;
}

void solve() {
    int a,b,c;
    cin >> a >> b;
    int n;
    //cin >> n;
    
    //for(int i = 0;i < n;i++) cin >> a[i];
    if(a < 10 && b < 10) cout << a*b << endl;
    else cout << -1 << endl;
    
}




int main() {

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



Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define gc getchar()
#define lint long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln endl
using namespace std;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
#define N 10010
int a[N];
int main()
{
	int n=inn(),x=inn(),ans=0;rep(i,1,n) a[i]=inn();
	sort(a+1,a+n+1);int i=1;
	while(x>0&&i<=n) x-=a[i],(ans+=(x>=0)),i++;
	if(x>0) ans--;return !printf("%d\n",ans);
}

Measured memory_bytes: 256
#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;

#define LL       long long
#define PR       pair<LL, LL>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    double r;
    cin >> r;
    double ans = 2.0 * PI * r;
    cout << fixed << setprecision(20) << ans << '\n';
    return 0;
}


Measured memory_bytes: 3776
// #include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cstdio>
#define FOR(i,a,b) for(i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;

int sa(int a[],int n,int k){

	int x=1000000000,i,s;

	for(i=0;i<n;i++){

		s=a[k+i]-a[i];

		if(x>s)
			x=s;

	}

	return x;
}

int main(){

	int N,K,h[100001],i;

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

	REP(i,N)
	scanf("%d",&h[i]);

	sort(h,h+N);

	printf("%d\n",sa(h,N-K+1,K-1));

	return 0;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.IOException;
    import java.io.InputStreamReader; 
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    import java.util.StringTokenizer;

    public class Main {
        public static void main(String[] args) throws IOException {
            BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
            PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
            StringTokenizer st;
            String a=sc.readLine();
            st=new StringTokenizer (a);
            String a1=st.nextToken();
            String a2=st.nextToken();
            pw.println(a2+a1);
            pw.close();
        }
    }//:D

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

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

    int a, b, c;
    cin >> a >> b >> c;
    vector<int> v = { a, b, c };

    int max_num = max(a, max(b, c));
    int diff = max_num * 3 - (a + b + c);
    if (diff % 2) {
        diff += 3;
    } 
    cout << diff / 2 << '\n';


    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
 
using namespace std;
 
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

const int mod=1e9+7;
			
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void add(int&,int);
int mul(int,int);
int powz(int,int);
int sub(int,int);
template<typename A> ostream& operator<<(ostream&,vector<A>&);
 
const int N=1000001;

void solve(){
	int n,d;
	cin>>n>>d;
	int l=2*d+1;
	cout<<(n/l+(n%l!=0));
	
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
	    output<<i<<' ';
	return output;
}


Measured memory_bytes: 256
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N, K = ISI()
ans = K * (K-1)**(N-1)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
// #include"myfile.h"

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;


void solve() {
	string s;
	cin >> s;
	if (s[2] == s[3] and s[4] == s[5]) cout << "Yes";
	else cout << "No";

}

int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
//	cin >> t_c;
	while (t_c--)
		solve();
}

Measured memory_bytes: 3648
n = int(input())
times = list(map(int,input().split()))
m = int(input())
drinks =[]

for i in range(m):
    drinks.append(list(map(int,input().split())))

total_time = sum(times) 

for i in range(m):
    time = times[drinks[i][0]-1]
    result = total_time - time + drinks[i][1]
    print(result)

Measured memory_bytes: 3060
case = 0
while True:
    case += 1
    w_max = int(input())
    if w_max == 0:
        break
    n = int(input())

    w = [0 for i in range(n)]
    v = [0 for i in range(n)]
    for i in range(n):
        a, b = map(int, input().split(","))
        v[i] = a
        w[i] = b

    dp = [[0 for j in range(w_max + 1)] for i in range(n + 1)]
    for i in range(n)[::-1]:
        for j in range(w_max + 1):
            if j < w[i]:
                dp[i][j] = dp[i + 1][j]
            else:
                dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i])
    print("Case ",case,":",sep="")
    print(max(dp[0]))
    print(dp[0].index(max(dp[0])))



Measured memory_bytes: 18132
n=int(input())
h=list(map(int,input().split()))

for i in range(n-1):
    if h[n-i-1]<h[n-i-2]:
        h[n-i-2]-=1

for i in range(n-1):
    if h[i]>h[i+1]:
        print("No")
        quit()
print("Yes")

Measured memory_bytes: 63984
#include<map>
#include<cmath>
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<fstream>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	string a;
	cin>>a;
	int n=a.length(),sum=0,flag=0;
	for(int i=0;i<n;i++){
		if(a[i]=='A'){
			if(a[1]>='a'&&a[1]<='z')sum++;
			if(a[n-1]>='a'&&a[n-1]<='z')sum++;
			for(int k=2;k<n-1;k++){
				if(a[k]=='C')flag++;
				if(a[k]>='a'&&a[k]<='z')sum++;
			}
			if(flag!=1){
				printf("WA");
				return 0;
			}
			else{
				if(sum+flag+1==n){
					printf("AC");
					return 0;
				}
				else{
					printf("WA");
					return 0;
				}
			}
		}
		else{
			printf("WA");
			return 0;
		}
	}
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int ans = 0, n = s.size();
  for (int i = 0; i < n; i++) {
    int j = i;
    while (j + 1 < n && s[j + 1] == s[j]) {
      ++j;
    }
    ans += (j - i + 1) / 3 * 2 + (bool)((j - i + 1) % 3) + ((j - i + 1) % 3 == 2 && j != n - 1);
    i = j + ((j - i + 1) % 3 == 2);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 720
import math

N, M = map(int, input().split())

A = sorted(list(map(int, input().split())),reverse = True)

sum_A = sum(A) 

pop = math.ceil(sum_A / (4 * M))

count_pop = len([i for i in A if i >= pop])
#https://note.nkmk.me/python-collections-counter/

if count_pop >= M:
    print('Yes')
else:
    print('No')

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

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

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


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
    if(n%10==3){
        printf("bon\n");
    }else{
        if(n%10==0||n%10==1||n%10==6||n%10==8){
            printf("pon\n");
        }else{
            printf("hon\n");
        }
    }
    return 0;
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main(){
    int N;
    cin >> N;
    vector<int> P(N);
    rep(i,N) cin >> P[i];
    
    int mi = P[0];
    int ans = 0;
    rep(i,N){
        if(mi >= P[i]) ans ++;
        mi = min(mi, P[i]);
    }
    cout << ans << endl;
}


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

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

  int n, w;
  cin >> n >> w;
  vector<int> value(n), weight(n);
  for(int i = 0; i < n; ++i) cin >> value[i] >> weight[i];

  vector<vector<int>> dp(n + 1, vector<int>(w + 1, 0));
  for(int i = 0; i < n; ++i) {
    for(int j = 0; j <= w; ++j) {
      dp[i + 1][j] = dp[i][j];
      if(j >= weight[i]) dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - weight[i]] + value[i]);
    }
  }
  cout << dp[n][w] << endl;
}


Measured memory_bytes: 6840
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
typedef pair<ll,string> Ps;
typedef pair<ll,P> PP;
const ll MOD = 1e9;

int main(){
  ll n,m,p[111111],y[111111];
  cin>>n>>m;
  vector<PP> yp(m);
  for(int i=0;i<m;i++){
	cin>>yp[i].second.first>>yp[i].first;
	yp[i].second.second=i;
  }
  sort(yp.begin(),yp.end());
  ll k[111111]={};
  vector<Ps> ans;
  for(int i=0;i<m;i++){
	ll p=yp[i].second.first;
	k[p]++;
	string s="000000000000";
	ll tmp=p,cnt=0;
	while(tmp){
	  s[5-cnt]=tmp%10+'0';
	  tmp/=10;
	  cnt++;
	}
    tmp=k[p],cnt=0;
	while(tmp){
	  s[11-cnt]=tmp%10+'0';
	  tmp/=10;
	  cnt++;
	}
	ans.push_back(Ps(yp[i].second.second,s));
  }
  sort(ans.begin(),ans.end());
  for(int i=0;i<m;i++){
	cout<<ans[i].second<<endl;
  }
  return 0;
}


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


// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef complex<int> ci;
typedef complex<double> cd;
typedef complex<long double> cld;

// macros
#define rep(i, a, b) for(int i=a; i<b; i++)
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define tr(c, it) for(auto it=(c).begin(); it!=c.end(); it++)
#define pb push_back
#define mp make_pair
#define bitcount __builtin_popcount
#define ispresent(c, x) ((c).find(x) != (c).end())
#define watch(x) cout<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// template functions
template <typename T>
inline void printV(vector<T>& a) { rep(i, 0, sz(a)) { cout<<a[i]<<" "; } cout<<"\n"; }
template <typename T>
inline void printV(vector<T>& a, int n) { rep(i, 0, n) { cout<<a[i]<<" "; } cout<<"\n"; }
template <typename T>
inline void printVV(vector<vector<T>>& a)
{
	rep(i, 0, sz(a)) {
		printV(a[i]);
	}
	cout<<"\n";
}

template <typename T>
inline void clearVV(vector<vector<T>>& a)
{
	for(auto& x:a) {
		x.clear();
	}
	a.clear();
}
template <typename T>
inline void assignVV(vector<vector<T>> &a, T val)
{
	for(int i=0; i<sz(a); i++) {
		for(int j=0; j<sz(a[i]); j++) {
			a[i][j]=val;
		}
	}
}


// constants
const long double eps = 1e-9;
const int inf = 5e8;
const int modn = 1e9+7;
const int MAX = 1e5;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
	int n, k;
	cin>>n>>k;
	vector<int> a(n);
	for(int i=0; i<n; i++) {
		cin>>a[i];
	}
	vector<bool> dp(k+1);
	for(int i=0; i<=k; i++) {
		if(dp[i]==0) {
			for(int v:a) {
				if(i+v<=k) {
					dp[i+v]=1;
				}
			}
		}
	}
	cout<<(dp[k]?"First\n":"Second\n");
    return 0;
}



Measured memory_bytes: 256
from collections import deque


def main():
    n, q = map(int, input().split(' '))
    inputs = [input().split(' ') for _ in range(n)]
    inputs = [(p[0], int(p[1])) for p in inputs]
    queue = deque(inputs)
    t = 0
    while len(queue) > 0:
        p = queue.popleft()
        if p[1] > q:
            t += q
            queue.append((p[0], p[1]-q))
        else:
            t += p[1]
            print('{} {}'.format(p[0], t))


if __name__ == '__main__':
    main()



Measured memory_bytes: 20684
#include<iostream>
#include<algorithm>
#include<string>
#define int long long
using namespace std;
int a[114514], b[114514];
signed main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		if (i % 2)cin >> a[i / 2];
		else cin >> b[i / 2];
	}
	n /= 2;
	sort(a, a + (n));
	sort(b, b + (n));
	int pa1 = 0, pa2 = 0, na1 = -1, f = 1;
	for (int i = 1; i < n; i++) {
		if (a[i] != a[i - 1]) {
			if (pa1 < f) {
				pa2 = pa1;
				pa1 = f; na1 = a[i - 1];
			}
			else if (pa1 == f)na1 = 114514;
			else if (pa2 < f) pa2 = f;
			f = 1;
		}
		else f++;
	}
	if (pa1 < f) {
		pa2 = pa1;
		pa1 = f; na1 = a[n - 1];
	}
	else if (pa1 == f)na1 = 114514;
	else if (pa2 < f) pa2 = f;
	int pb1 = 0, pb2 = 0, nb1 = -1; f = 1;
	for (int i = 1; i < n; i++) {
		if (b[i] != b[i - 1]) {
			if (pb1 < f) {
				pb2 = pb1;
				pb1 = f; nb1 = b[i - 1];
			}
			else if (pb1 == f)nb1 = 1919810;
			else if (pb2 < f) pb2 = f;
			f = 1;
		}
		else f++;
	}
	if (pb1 < f) {
		pb2 = pb1;
		pb1 = f; nb1 = b[n - 1];
	}
	else if (pb1 == f)nb1 = 1919810;
	else if (pb2 < f) pb2 = f;
	f = 1;
	if (na1 == nb1)cout << n * 2 - pa1 - max(pa2, pb2);
	else cout << n * 2 - pa1 - pb1;
	cout << endl;
}

Measured memory_bytes: 1024
rect :: [String] -> [String]
rect (h:w:_) =  (\(x:y:_) -> replicate x $ replicate y '#') $ [read h, read w] 

main=do
    xs <- fmap (map words . lines) getContents
    mapM putStrLn . map unlines . map rect $ takeWhile (\(x:xs) -> x/="0") xs


Measured memory_bytes: 4648
#include <stdio.h>

int main(void){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    
    int i;
    int counter=0;
    for(i=a;i<=b;i++){
        if(c%i==0){
            counter++;
        }
    }
    
    
    printf("%d\n",counter);
}

Measured memory_bytes: 1732
#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>
#include <functional>
#include <cstdlib>
#include <queue>
#include <tuple>
#include <map>
#include <cmath>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define SORT(v, n) sort(v, v+n)

using namespace std;

const double EPS =1e-9;
const long INF =999999999;
const long MINF =-999999999;

int main(){
	int i,j,r;
	string S;
	int matrix[30]={};
	cin>>S;
	i=0;
	while(1){
		if(S[i]=='\0') break;
		matrix[S[i++]-97]+=1;
	}

	FOR(i,0,27) {
		if(i==26)
			puts("None");
		else if(matrix[i]==0){
			printf("%c\n",i+97 ); 
			break;
		}
	}

	return 0;
}



Measured memory_bytes: 512
s = input()
c_list = [chr(i) for i in range(97, 123)]
min_loop = len(s)

for c in c_list:
    str_list = s.split(c)
    loop = max(len(str) for str in str_list)
    min_loop = min(min_loop, loop)

print(min_loop)


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

using namespace std;

#define MAXN 100100

typedef long long ll;

ll v[MAXN];
ll ans[MAXN];
vector<pair<ll, ll>> w;

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    w.push_back({v[i], i});
  }
  w.push_back({0, 0});
  sort(w.begin(), w.end());
  int mult = 0;
  int maxi = 0x7fffffff;
  int index = n + 1;
  for (int i = w.size() - 1; i >= 0; i--) {
    if (w[i].first < maxi) {
      ans[index] += mult * (maxi - w[i].first);
      maxi = w[i].first;
    }
    if (w[i].second < index) {
      index = w[i].second;
    }
    mult++;
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 4336
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
alias Goods = Tuple!(long, "w", long, "v");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto n = lread();
    auto a = aryread();
    auto b = aryread();
    auto c = aryread();
    long cost, prev = INF;
    foreach (e; a)
    {
        cost += b[e - 1];
        if (e == prev + 1)
            cost += c[prev - 1];
        prev = e;
    }
    cost.writeln();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int north,south,west,east,up,down;
	up = 1;
	down = 6;
	north = 5;
	south = 2;
	west = 4;
	east = 3;
	int ans,n;
	ans = 1;
	cin >> n;
	if(n==0) break;
	REP(i,n){
	    string s;
	    cin >> s;
	    if(s == "North"){
		int temp = up;
		up = south;
		south = down;
		down = north;
		north = temp;
	    }else if(s=="East"){
		int temp = up;
		up = west;
		west = down;
		down = east;
		east = temp;
	    }else if(s=="West"){
		int temp = up;
		up = east;
		east = down;
		down = west;
		west = temp;
	    }else if(s=="South"){
		int temp = up;
		up = north;
		north = down;
		down = south;
		south = temp;
	    }else if(s=="Right"){
		int temp = north;
		north = west;
		west = south;
		south = east;
		east = temp;
	}else if(s=="Left"){
	    int temp = north;
	    north = east;
	    east = south;
	    south = west;
	    west = temp;
	}
	ans += up;
	}
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1212
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    string s; cin >> s;
    rep(i, 3) {
        if (s[i] == '1') {
            s[i] = '9';
        } else if (s[i] == '9') {
            s[i] = '1';
        }
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
 
#define ll long long
const long long llINF = 1LL << 60;
const int iINF = 0x20000000;
template<class T> inline bool chmin(T& a, T b) { if (b < a) { 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; }
 
void execute();
int main() 
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);// cin と scanfの併用禁止
    cout << fixed << setprecision(15);
    execute();
    return 0;
}
 
 
void execute()
{
    unsigned long long A;
    double Bd;
    cin >> A >> Bd;
    unsigned long long B = (unsigned long long)(100.0999999999999999999999999999999999 * Bd);

    A *= B;
    A /= 100;
 
    cout << A << endl; 
}


Measured memory_bytes: 3756
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int a,b,c; cin >> a >> b >> c;
    if (a <= c && c <= b)
    {
        cout << "Yes\n"; 
    } else {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;

  ll ans = 1;
  int c[3];
  REP(i, 3) c[i] = 0;
  REP(i, n) {
    int a;
    cin >> a;
    int t = 0, p = 0;
    REP(j, 3) if(c[j] == a) {
      t++; p = j;
    }

    ans = (ans * t) % mod;
    c[p]++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3600