akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<iomanip>
#include<vector>

using namespace std;

vector<int> num;

int main() {
	
	int n;
	
	while( cin >> n ) {
		
	if( n == 0 )
	break;	
		
	int score;
	double sum = 0, a2 = 0;
		
	num.clear();
	
	for(int i=0;i<n;i++) {
		
		cin >> score;
		num.push_back(score);
		
		sum += score;
		
	}
	
		sum /= n;
	
		for(int i=0;i<n;i++)
		a2 += pow( num[i] - sum, 2) ; 
			
		cout << fixed << setprecision(8) << sqrt ( a2 / n ) << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 3264
import java.util.*;
import java.io.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		System.out.println("0.00000 0.00000");
		kochCalc(0, 0, 100, 0, n);
		System.out.println("100.00000 0.00000");
	}
	
	public static void kochCalc(double x1, double y1, double x2, double y2, int n){
		
		if (n==0)return;
		
		double dis = Math.pow(Math.pow(x1-x2,2)+Math.pow(y1-y2, 2),.5);
		double true_dis = dis/3;
		double ang = Math.atan2(y2-y1,x2-x1);
		
		double sx = x1 + Math.cos(ang)*true_dis;
		double sy = y1 + Math.sin(ang)*true_dis;
		double tx = sx + Math.cos(ang)*true_dis;
		double ty = sy + Math.sin(ang)*true_dis;
		double ux = sx + Math.cos(ang+Math.PI/3)*true_dis;
		double uy = sy + Math.sin(ang+Math.PI/3)*true_dis;
		
		kochCalc(x1, y1, sx, sy, n-1);
		System.out.printf("%.5f %.5f\n",sx,sy);
		kochCalc(sx, sy, ux, uy, n-1);
		System.out.printf("%.5f %.5f\n",ux,uy);
		kochCalc(ux, uy, tx, ty, n-1);
		System.out.printf("%.5f %.5f\n",tx,ty);
		kochCalc(tx, ty, x2, y2, n-1);
		
		
	}
}


Measured memory_bytes: 40616
#include <iostream>
#include <algorithm>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

  int tmp1 = 0;
  int tmp2 = 0;

  for(int i = 0; i < s.size() ;i++){
    if(i % 2 == 0){
      if(s[i] == '0')
	tmp1++;
      else
	tmp2++;
    }else{
      if(s[i] == '0')
	tmp2++;
      else
	tmp1++;
    }
  }
  int ans = tmp1 < tmp2 ? tmp1:tmp2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = B[A[0]-1]
cur = A[0]
for i in range(1,n):
    if A[i] == cur+1:
        ans += C[cur-1]
    ans += B[A[i]-1]
    cur = A[i]
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
 
int main(){
vector<char> vec(6);
for(int i=0;i<6;i++){
    cin>>vec.at(i);
}
if(vec.at(0)==vec.at(5)&&vec.at(1)==vec.at(4)&&vec.at(2)==vec.at(3)){
 cout<<"YES"<<endl;   
}
else{
    cout<<"NO"<<endl;
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e18;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int X,Y,Z,K;
    cin >> X >> Y >> Z >> K;
    vector<int>A(X),B(Y),C(Z);
    for(int i = 0; i < X; i++) {
        cin >> A[i];
    }
    for(int i = 0; i < Y; i++) {
        cin >> B[i];
    }
    for(int i = 0; i < Z; i++) {
        cin >> C[i];
    }
    vector<int>AB;
    for(int i = 0; i < X; i++) {
        for(int j = 0; j < Y; j++) {
            AB.push_back(A[i]+B[j]);
        }
    }
    sort(AB.rbegin(),AB.rend());
    vector<int>ABC;
    for(int i = 0; i < min(K,(int)AB.size()); i++) {
        for(int j = 0; j < Z; j++) {
            ABC.push_back(AB[i]+C[j]);
        }
    }
    sort(ABC.rbegin(),ABC.rend());
    for(int i = 0; i < K; i++) {
        cout << ABC[i] << endl;
    }
}


Measured memory_bytes: 44104
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    while(true){
        int n, nMax, nMin; cin >> n >> nMin >> nMax;
        if(n == 0 and nMax == 0 and nMin == 0) return 0;
        else{
            vector<int> score(n);
            REP(i, n) cin >> score[i];
            int ans = 0, gap = 0;
            FOR(i, nMin, nMax + 1){
                if(score[i - 1] - score[i] >= gap){
                    gap = score[i - 1] - score[i];
                    ans = i;
                }
            }
            cout << ans << endl;
        }
    }
}


Measured memory_bytes: 3092
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val v = (1..n).map { sc.nextInt()}

  println(abc138c(n, v))
}

private fun abc138c(n: Int, v: List<Int>): Double {
  val sorted = v.sorted().map { it.toDouble() }

  var pre = sorted.get(0).toDouble()
  for (i in 1 until n) {
    pre = sorted.get(i).toDouble() + pre
    pre /= 2.0
  }

  return pre
}


Measured memory_bytes: 35956
#include<bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << max(a*b,c*d) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    System.out.print(s.charAt(0));
    System.out.print(s.length() - 2);
    System.out.print(s.charAt(s.length() - 1));
  }
}

Measured memory_bytes: 21844
from math import ceil
n,a,b=map(int,input().split())
H=[int(input()) for _ in range(n)]
Mh=max(H)
left,right=Mh//a,Mh//b+1
while right-left>1:
    mid=(left+right)//2
    cnt=0
    for i in range(n):
        cnt+=ceil(max(H[i]-mid*b,0)/(a-b))
    if cnt<=mid:
        right=mid
    else:
        left=mid
print(right)

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

using namespace std;

int main(void) {
  int n, p;
  cin >> n >> p;

  int a;
  int odd = 0, even = 0;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a % 2) {
      odd++;
    } else {
      even++;
    }
  }

  long long cnt_even = 1LL << even;
  cnt_even *= odd ? (1LL << odd) / 2 : 1;
  
  if (p) {
    cout << (1LL << n) - cnt_even << endl;
  } else {
    cout << cnt_even << endl;
  }

  return 0;
}

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

// Type alias
using ll=long long;
using ld=double;

using pi=pair<int,int>;
using pll=pair<ll,ll>;
using pld=pair<ld,ld>;
using ti3=tuple<int, int, int>;

using vi=vector<int>;
using vll=vector<ll>;
using vld=vector<ld>;
using vpi=vector<pi>;
using vpll=vector<ll>;
using vpld=vector<ld>;
using vti3=vector<ti3>;

// Constants
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max() / 2;
const ll mod = 1e9+7;

// Macro
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

#define ALL(a) a.begin(),a.end()

// Funtcions
ll pow(ll base, ll i, ll mod){
  ll a = 1;
  while(i){
    if (i & 1) {
      a *= base;
      a %= mod;
    }
    base *= base;
    base %= mod;
    i >>= 1;
  }
  return a;
}
ll gcd(ll a, ll b){
  while(b){
    ll c = a % b;
    a = b;
    b = c;
  }
  return a;
}
ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}
template<typename T> bool chmin(T& a, const T& b) {
  if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
  if (a < b) return a = b, true; else return false;
}


void solve(){
  int N;
  cin >> N;
  cout << fixed << setprecision(5) << 2 * M_PI * N << endl;
}

int main(){
// FastIO
//ios_base::sync_with_stdio(false);
cin.tie(NULL);
  solve();
  return 0;
}

Measured memory_bytes: 3740
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iterator>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define gc(x) getchar(x)
#define pc(x) putchar(x)
#define endline pc('\n')

typedef long long LL;

using namespace std;

int
main() {
	int a, b;
	cin >> a >> b;
	
	int ans = a * b;
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n) ; ++i)
#define srep(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define emb emplace_back
#define fcout cout << fixed << setprecision(15)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

bool dpk[100005];

int main() {
  int n,k;
  cin >> n >> k;
  vi a(n,0);
  int mn=100000001;
  rep(i,n) {
    cin >> a.at(i);
    mn=min(a.at(i),mn);
  }
  rep(i,n) {
    dpk[a.at(i)] = 1;
  }
  srep(i,mn,k+1) {
    if(dpk[i]) continue;
    rep(j,n) {
      if(i-a.at(j)<0) continue;
      if(!dpk[i-a.at(j)]) dpk[i]=true;
    }
  }

  if(dpk[k]) cout << "First" << endl;
  else cout << "Second" << endl;

  return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

const string P = "POSSIBLE";
const string IMP = "IMPOSSIBLE";

int n, len;
vector<int> g[200000];
int r[200000], far[200000];
int cyc[200000];
bool incyc[200000];
int num[200000];
int pos[200000];
bool have[200005];
int a[200000], b[200000];
int val[200000];

void calc(int v) {
    for (int to : g[v]) if (!incyc[to]) {
        calc(to);
    }
    for (int to : g[v]) if (!incyc[to]) {
        have[num[to]] = true;
    }
    int a = -1, b = -1;
    forn(i, 200005) {
        if (!have[i]) {
            if (a == -1) {
                a = i;
            } else {
                b = i;
                break;
            }
        }
    }
    if (incyc[v]) {
        ::a[pos[v]] = a;
        ::b[pos[v]] = b;
    } else {
        num[v] = a;
    }
    for (int to : g[v]) if (!incyc[to]) {
        have[num[to]] = false;
    }
}

int main() {
    scanf("%d", &n);
    forn(i, n) {
        int v;
        scanf("%d", &v), --v;
        g[v].pb(i);
        r[i] = v;
    }
    forn(i, n) far[i] = r[i];
    forn(i, 20) forn(j, n) {
        far[j] = far[far[j]];
    }
    len = 0;
    for (int i = far[0]; !incyc[i]; i = r[i]) {
        cyc[len++] = i;
        incyc[i] = true;
    }
    reverse(cyc, cyc + len);
    forn(i, len) pos[cyc[i]] = i;
    forn(i, len) {
        calc(cyc[i]);
    }
    forn(x, 2) {
        val[len - 1] = x ? a[len - 1] : b[len - 1];
        for (int i = len - 2; i >= 0; --i) {
            if (val[i + 1] == a[i]) {
                val[i] = b[i];
            } else {
                val[i] = a[i];
            }
        }
        if (val[0] == a[len - 1] && val[len - 1] == b[len - 1]) {
            cout << P << endl;
            return 0;
        }
        if (val[0] != a[len - 1] && val[len - 1] == a[len - 1]) {
            cout << P << endl;
            return 0;
        }
    }
    cout << IMP << endl;
    return 0;
}


Measured memory_bytes: 16640
x, y = map(int, input().split())
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
if ((x in l1 and y in l1) or (x in l2 and y in l2) or (x in l3 and y in l3)):
    print('Yes')
else:
    print('No')


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int n;
  cin >> n;
  vi32 a(n);
  cin >> a;
  rep(i, n) a[i]--;
  set<int> s = {-1, n};
  vi32 indices(n);
  rep(i, n) indices[a[i]] = i;
  i64 ans = 0;
  rep(i, n) {
    int idx = indices[i];
    auto j = s.upper_bound(idx);
    int r = *j, l = *(--j);
    ans += (i64) (r - idx) * (idx - l) * (i + 1);
    s.insert(idx);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;  
using namespace std;

typedef long long ll;

typedef tree<
pair <int, int>,
null_type,
less<pair <int, int>>,
rb_tree_tag,
tree_order_statistics_node_update>
os;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int main() {
  int X, Y; int A, B, C; cin >> X >> Y >> A >> B >> C;
  vector <ll> a(A), b(B), c(C);
  for(int i = 0; i < A; i++) {
    cin >> a[i];
  }
  for(int i = 0; i < B; i++) {
    cin >> b[i];
  }
  for(int i = 0; i < C; i++) {
    cin >> c[i];
  }
  sort(a.rbegin(), a.rend());
  sort(b.rbegin(), b.rend());
  sort(c.rbegin(), c.rend());
  vector <ll> cur;
  for(int i = 0; i < X; i++) {
    cur.push_back(a[i]);
  }
  for(int i = 0; i < Y; i++) {
    cur.push_back(b[i]);
  }
  for(int i = 0; i < C; i++) {
    cur.push_back(c[i]);
  }
  sort(cur.rbegin(), cur.rend());
  ll ans = 0;
  for(int i = 0; i < X + Y; i++) {
    ans += cur[i];
  }
  print(ans);
} 

Measured memory_bytes: 8688
#include <bits/stdc++.h>
#include <string>
#include <vector>

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

int main() {
    string s;
    cin >> s;
    // s = num - '0';
    int n = s.size(); int ans;
    if (n == 0) ans = 0;

    int start_zero = 0; int start_one = 0;
    rep(i, n) {
        /* code */
        if ((i%2) == 0)
        {
            /* code */
            (s[i] == '0') ? start_one++ : start_zero++;
        }
        else if ((i%2) == 1)
        {
            /* code */
            (s[i] == '1') ? start_one++ : start_zero++;
        }
    }
    cout << ((start_one < start_zero) ? start_one : start_zero) << endl;
}

Measured memory_bytes: 512
N=int(input())
D,X=map(int,input().split())

alist=[]
for i in range(N):
  alist.append(int(input()))
#print(alist)

choco=0
for i in range(D):
  for a in alist:
    if i%a==0:
      choco+=1
      
print(X+choco)

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<cstdlib>
#include<queue>
#include<list>
#include<cctype>
using namespace std;

int main() {
    int a, b, k, c;
    cin>>a>>b>>k;
    c=min(a, b);
    vector<int> v(100);
    v.clear();
    for(int i=c; i>0; i--){
        if(a%i==0 && b%i==0)v.push_back(i);
    }
    cout<<v[k-1]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//最大公約数をユークリッドの互除法を使って求める
//計算量はlog(max(a,b))
ll gcd(ll a, ll b) {
    if(a % b == 0)
    return b;
    return gcd(b, a % b);
}
ll f(ll a,ll b) {
    if(a<=b/2)  return a;
    return f(max(a,b)%min(a,b),b);
}


 
int main() {

    ll n,k;
    cin >> n >> k;

    if(k==1) {
        cout<<0<<endl;
        return 0;
    }

    ll ans=f(n,k);

    cout<<ans<<endl;

 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

int UF[114514];
int UFnum[114514];
void UFinit(int n){
    for(int i=0;i<=n;i++){
        UF[i]=i;
    }
}
int UFroot(int k){
    if(UF[k]==k){
        return k;
    }else{
        UF[k]=UFroot(UF[k]);
        return UF[k];
    }
}
int UFsame(int P,int Q){
    if(UFroot(P)==UFroot(Q)){
        return true;
    }else{
        return false;
    }
}
void UFunite(int P,int Q){
    int p=UFroot(P);
    int q=UFroot(Q);
    if(p==q)return;
    if(p>q)swap(p,q);
    UF[q]=p;
}


signed main(){
    int N,M;
    int A[114514],B[114514];
    int Ans[114514]={};
    cin >> N >> M;
    REP(i,M){cin >> A[i] >> B[i]; A[i]--;B[i]--;}
    
    int now=N*(N-1)/2;
    REP(i,N+1){UFnum[i]=1;}
    UFinit(N);
    Ans[M]=now;
    for(int i=M-1;i>=0;--i){
        
        if(!UFsame(A[i],B[i])){
            now-=UFnum[UFroot(A[i])]*UFnum[UFroot(B[i])];
            
            UFnum[min(UFroot(A[i]), UFroot(B[i]))]+=UFnum[max(UFroot(A[i]), UFroot(B[i]))];
            UFnum[max(UFroot(A[i]), UFroot(B[i]))]=0;
            UFunite(A[i],B[i]);
        }
        Ans[i]=now;
        
        //REP(j,N){cout << UFnum[j] << " ";}cout << "   ";
        //REP(j,N){cout << UFroot(j) << " ";}cout << endl;
    }
    
    REP(i,M-1){
        cout << Ans[i+1] << endl;
    }
    cout << N*(N-1)/2;
    
    return 0;
}


Measured memory_bytes: 5376
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>

using namespace std;

int main(void)
{
    int M, D, i, j, ans=0;

    cin >> M >> D;

    for(i=1; i<=M; i++){
        for(j=1; j<=D; j++){
            if(j/10>=2 && j%10>=2 && j/10*(j%10)==i){
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#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 long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

char func(){
    char c;
    cin>>c;
    return c;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,m;
    cin>>n>>m;
    
    rep(i,n+2){
        rep(j,m+2){
            if(i==0||j==0||i==n+1||j==m+1){
                cout<<"#";
            }else{
                cout<<func();
            }
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
import numpy as np
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()

if(m-n<=0):
	print(0)
	exit()


#print(x)
y=np.array(x)
dy = y[1:]-y[:-1]
#print(dy)
dy.sort()
dy=dy[::-1]
#print(dy)
print(sum(dy[n-1:]))

"""
mi = min(dy)
ma = max(dy)
dy = np.append(dy,[ma+1])
print(dy)
for dif in range(mi,ma+1):
	if(len(dy[dy>dif]) <= n):
		lis = np.where(dy>dif)[0]
		print(dif)
		print(lis)
		s=sum(dy[0:lis[0]])
		print(s)
		for i in range(len(lis)-1):
			idx = lis[i]+1
			idx2 = lis[i+1]
			s += (sum(dy[idx:idx2]))
		break
print(s)




"""



"""
dp[i][j]	jまでの部分配列をi回分割した時の和の最小値

dp[0][j] = sum(dy[:j])
dp[i][j](i>=j) = NAN
dp[i][j](i=j-1) = 0
dp[i][j](i<j) = 
"""

Measured memory_bytes: 23060
#include <bits/stdc++.h>
using namespace std;
int K, N;
int main() {
    cin >> K >> N;
    if(K % 2) {
        vector<int> v(N, (K + 1) / 2);
        for(int i{}; i < N / 2; ++i) {
            if(v.back() == 1) v.pop_back();
            else {
                --v.back();
                while((int)v.size() < N) v.emplace_back(K);
            }
        }
        for(int i{}; i < v.size(); ++i)
            cout << v[i] << (i == v.size() - 1 ? '\n': ' ');
    }
    else {
        cout << K / 2;
        for(int i{}; i < N - 1; ++i) cout << ' ' << K;
        cout << endl;
    }
}


Measured memory_bytes: 3456
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0510

#include <algorithm>
#include <iostream>
#include <vector>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

//テ」ツδ榲」ツつッテ」ツδュテ・ツョツ堙ァツセツゥ
#define ALL(v) (v).begin(),(v).end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define REP(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 SORT(x) sort(begin(x),end(x))
#define SELECT_SORT(x, n) sort(begin(x),begin(x)+n)
#define SWAP(type, a, b) do {type tmp = a; a = b; b = tmp;} while (0)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))

//テ・ツョツ堙ヲツ閉ー
#define INF 2000000000000
#define MAX 10

//DEBUGテァツ板ィ
#define BAR() cout << "----------------------------" << endl;
#define DUMP(v) (cerr << #v << ": " << v << endl)
#define PRINT(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;


int main()
{
	int a[]={0};
	int b[]={0};
	int S= 0;
	int T=0;
	
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	cin >> b[0] >> b[1] >> b[2] >> b[3];
	
	rep(i,4){
		S += a[i];
		T += b[i];
	}
	
	if(S >= T){
		cout << S << endl;
	}else{
		cout << T << endl;
	}
	
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

lint n, F;
lint id(lint i, lint s){
    return i + s*n;
}

struct edge{
    int from, to; lint cost;
    edge(int f, int t, lint c) : from(f), to(t), cost(c) {}
    edge(int t, lint c) : from(-1), to(t), cost(c) {}
};
vector<edge> G[MAX];
lint d[MAX];
int V;

void dijkstrb(int s){
    fill(d, d + V, INF);
    priority_queue<P, vector<P>, greater<P> > que; que.push(P(0, s));
    d[s] = 0;
    while(!que.empty()){
        P p = que.top(); que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(int i = 0; i < G[v].size(); i++){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main(){
    lint m, s;
    cin >> n >> m >> s;

    F = 50*(n-1);
    rep(i, m){
        lint u, v, a, b; cin >> u >> v >> a >> b;
        u--; v--;
        rep(k, F-a+1){
            lint u1 = id(u, a+k), v1 = id(v, k);
            lint u2 = id(u, k), v2 = id(v, a+k);
            G[u1].push_back(edge(u1, v1, b));
            G[v2].push_back(edge(v2, u2, b));
        }
    }

    rep(i, n){
        lint c, d; cin >> c >> d; c = min(c, F);
        rep(k, F-c+1){
            lint uu = id(i, k), vv = id(i, k+c);
            G[uu].push_back(edge(uu, vv, d));
        }
    }
    V = (F+1)*n;
    dijkstrb(id(0, min(s, F)));

    rep(_t, n-1){
        lint t = _t+1;
        lint ans = INF;
        rep(k, F+1){
            ans = min(ans, d[id(t, k)]);
        }
        out(ans);
    }
}

Measured memory_bytes: 25152
#include <stdio.h>
#include <stdlib.h>
int parent[200001],max,component;void _union_(int a,int b);int find(int a);
int find(int a)
{
    if(parent[a]<0)
        return(a);
    else
    {
        return(parent[a]=find(parent[a]));
    }
}
void _union_(int a,int b)
{
    int pa,pb;pa=find(a);pb=find(b);
    if(pa==pb)
        return;
    else
    {
        if((-parent[pa])<=(-parent[pb]))
        {
          parent[pb]=parent[pa]+parent[pb];parent[pa]=pb;if(max<(-parent[pb]))max=-parent[pb];component--;return;
        }
        if((-parent[pa])>(-parent[pb]))
        {
          parent[pa]=parent[pa]+parent[pb];parent[pb]=pa;if(max<(-parent[pa]))max=-parent[pa];component--;
        }
    }
}
int main()
{
    int j,n,m;scanf("%d %d",&n,&m);
    for(j=0;j<=n;j++)
        parent[j]=-1;
    component=n;max=1;
    for(j=0;j<m;j++)
    {
        int a,b;scanf("%d %d",&a,&b);
        _union_(a,b);
        //printf("%d %d\n",component,max);
    }
    printf("%d\n",max);
    return 0;
}


Measured memory_bytes: 2480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ll N,X;
	cin >> N >> X;
	vector<ll> S(N);
	FOR(i,0,N)cin>>S[i];
	SORT(S);
	REV(S);
	ll dp[N+2][X+1]={};
	dp[0][X]=1;

	FOR(i,0,N){
		FOR(j,0,X+1){
			(dp[i+1][j%S[i]] += dp[i][j])%=MOD;
			(dp[i+1][j] += dp[i][j]*(N-i-1))%=MOD;
		}
	}
	ll ans = 0;
	FOR(j,1,X+1){
		(ans += dp[N][j]*j)%=MOD;
	}
	cout << ans << endl;
}


Measured memory_bytes: 158080
//Zory-2019
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pii pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    #define GG(x) if(x) {puts("error");exit(666);}
    #define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
    #define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=1e9+7;
    int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
    ll qpower(ll x,ll e,int mod=MOD){ll ans=1;GG(e<0)while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=3e5+10;

    int a[N];
	void main()
	{
		ll n=qread(),mi=qread(),mx=qread();
		if(n==1 and mi!=mx) write(0);
		else write( mx>=mi?(mx-mi)*(n-2)+1:0 );
	}
};//(ans+MOD)%MOD
signed main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

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

const ll mod = 1e9+7;
ll r,c,k;

ll item[3005][3005];
ll dp[3005][3005][4];


int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    cin >> r >> c >> k;
    rep(i,r)rep(j,c)item[i][j] = 0;
    vector<ll>val(k);
    rep(i,k){
        ll ri,ci;
        cin >> ri >> ci >> val[i];
        ri--;ci--;
        item[ri][ci] = val[i];
    }

    cerr << "dpの初期値" << dp[10][10][3] << endl;
    dp[0][0][0] = 0;
    rep(i,r)rep(j,c){
        for(int k = 2; k>= 0; --k){
            dp[i][j][k+1] = max(dp[i][j][k+1],dp[i][j][k] + item[i][j]);
        }
        rep(k,4){
            dp[i+1][j][0] = max(dp[i+1][j][0],dp[i][j][k]);
            dp[i][j+1][k] = max(dp[i][j][k],dp[i][j+1][k]);
        }
    }

    ll ans = -1e18;
    rep(i,4){
        ans = max(dp[r-1][c-1][i],ans);
    }

    cout << ans << endl;
    return 0;


}


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;

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

	map<int,int> mp;
	for (int i = 0; i < n; ++i){
		int x;
		cin>>x;
		mp[x]++;
	}

	int sum=0;
	for(auto p: mp){
		if(p.first>p.second){
			sum+=p.second;
		}else{
			sum+=p.second-p.first;
		}
	}

	cout<<sum<<endl;


	return 0;
}


Measured memory_bytes: 4736
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on
void main()
{
    auto input = stdin.byLine.map!split.joiner;

    long N;
    N = input.front.to!long;
    input.popFront;

    long X;
    X = input.front.to!long;
    input.popFront;

    long T;
    T = input.front.to!long;
    input.popFront;

    solve(N, X, T);
}

void solve(long N, long X, long T)
{
    writeln(((N + X - 1) / X) * T);
}


Measured memory_bytes: 3668
//g++  7.4.0

#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;int flag=0;
   cin>>s;
    int a[26]={0};
    for(int i=0;i<s.length();i++){
        int k=(int)s[i];
        a[k-97]++;
    }
    for(int i=0;i<26;i++){
        if(a[i]==0){
            cout<<(char)(i+97);
            flag = 1;
            break;
        }
    }
    if(flag==0){
        cout<<"None";
    }
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long LL;

const int maxn=2e5+5;

int n;
char s[maxn];

int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	
	int r=0, b=0;
	fo(i,1,n) if (s[i]=='R') r++; else b++;
	
	puts((r>b) ?"Yes" :"No");
}

Measured memory_bytes: 256
/**
 *    This code has been written by YueGuang, feel free to ask me question. Blog: http://www.yx.telstudy.xyz
 *    created:
 */
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;

using namespace std;


int main(){int n,a[100002];long t=0;scanf("%d",&n);for(int i=1;i<= n;i++)scanf("%d",&a[i]),t+=abs(a[i]-a[i-1]);t+=abs(a[n]);for(int i=1;i<=n;i++)printf("%ld\n",t-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]));}


Measured memory_bytes: 1664
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_K=1e5;
typedef long long ll;
int K;
ll A[MAX_K];

int main(){
	cin>>K;
	REP(i,K){
		cin>>A[i];
	}
	ll lb=2,ub=3;
	bool flg=false;
	for(int i=K-1;i>=0;i--){
		ll lb2=(lb+A[i]-1)/A[i]*A[i],ub2=(ub+A[i]-1)/A[i]*A[i];
		if (lb2==ub2) {
			flg=true;
			break;
		}
		lb=lb2;
		ub=ub2;
	}
	if (flg){
		cout<<-1<<endl;
	}else {
		cout<<lb<<" "<<ub-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

typedef complex<double> P;

bool used[100];
char c;
int n;
double x,y;
P p[100];

double dot(P a, P b) {
  return (a.real() * b.real() + a.imag() * b.imag());
}

int main(){
	while(cin>>n&&n){
		fill(used,used+100,0);
		int mx,my=INF,m;
		rep(i,n){
			cin>>x>>c>>y;
			p[i]=P(x,y);
			if(y<my||y==my&&x<mx){my=y;mx=x;m=i;}
		}
		int ans=n,prv=-1;
		P v(1,0);
		while(!used[m]){
			used[m]=1;
			ans--;
			int nx;
			double M=-2;
			rep(i,n)if(i!=m&&i!=prv&&dot(v,(p[i]-p[m])/abs(p[i]-p[m]))>M){M=dot(v,(p[i]-p[m])/abs(p[i]-p[m]));nx=i;}
			v=(p[nx]-p[m])/abs(p[nx]-p[m]);
			//cout<<p[nx]<<" "<<v<<" "<<M<<endl;
			prv=m;
			m=nx;
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 0
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = input()
    if S[-1]=='s':
        print(S+'es')
    else:
        print(S+'s')

if __name__ == '__main__':
    main()


Measured memory_bytes: 9104
#include <bits/stdc++.h>
// #define IOFILE
#define F first
#define S second
#define pb push_back
#define eb emplace_back
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define debug(...) do{\
	fprintf(stderr, "%s - %d : (%s) = ", __func__, __LINE__, #__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename T> void _DO(T&&x){cerr << x << '\n';}
template<typename T, typename... A> void _DO(T&&x, A&&...As){cerr << x << ", ";_DO(As...);}
constexpr ll MOD = 1e9 + 7;

inline void solve() {
	int n, k; cin >> n >> k;
	int h[n], dp[n];
	fill(dp, dp + n, 1e9);
	for(int i = 0; i < n; ++i)
		cin >> h[i];
	dp[0] = 0;
	for(int i = 0; i < n; ++i) for(int j = i; j <= i + k && j < n; ++j)
		dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]));
	cout << dp[n - 1] << '\n';
}	

int main() {
	cin.tie(nullptr), cout.tie(nullptr), ios::sync_with_stdio(false);
#ifdef IOFILE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
	clock_t time = clock();
#endif
	solve();

#ifdef IOFILE
	cout << "\nUse " << static_cast<double>(clock() - time) / CLOCKS_PER_SEC << " seconds";
#endif
}


Measured memory_bytes: 4388
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>

#define REP(i, m, n) for(int i = m; i < static_cast<int>(n); ++i)
int main()
{
    int height, width;
    std::vector<std::string> tile = {">", "<", "^", "v", "."};
    
    while (std::cin >> height >> width) {
        if (height == 0 && width == 0) {
            break;
        }
        
        std::vector< std::vector<std::string> > table;
            
        REP(i, 0, height) {
        table.push_back( std::vector<std::string>() );
            
        REP(j, 0, width) {
            std::string data;
            std::cin >> std::setw(1) >> data;
            table[i].push_back(data);
        }
    }
            
        
        bool flag = true;

        while (flag){
            static int i = 0;
            static int j = 0;
            
            if (table[i][j] == tile[0]) {
                table[i][j] = ",";
                j++;
                continue;
            } else if (table[i][j] == tile[1]) {
                table[i][j] = ",";
                j--;
                continue;
            } else if (table[i][j] == tile[2]) {
                table[i][j] = ",";
                i--;
                continue;
            } else if (table[i][j] == tile[3]) {
                table[i][j] = ",";
                i++;
                continue;
            } else if (table[i][j] == ",") {
                flag = false;
                std::cout << "LOOP" << std::endl;
                i = j = 0;
            } else {
                flag = false;
                std::cout << j << " " << i << std::endl;
                i = j = 0;
            }
        }
    }
    
    return 0;
}
    

Measured memory_bytes: 1800
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define ll long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int n; 
class bit{
	public:
	int s[500005];
	void up(int p,int x){
		p++;
		while(p){
			s[p]+=x;
			p-=p&-p;
		}
	}
	int get(int p){
		p++;
		int re=0;
		while(p<=n+1){
			re=re+s[p];
			p+=p&-p;
		}
		RE re;
	}
	void clear(){
		FILL(s,0);
	}
}tree;
int lst[500005],a[500005],ans[500005];
V<P<int,int>> v[500005];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int q;
	cin>>n>>q;
	FOR(i,1,n)cin>>a[i];
	int x,y;
	FOR(i,1,q){
		cin>>x>>y;
		v[y].PB(MP(x,i));
	}
	FOR(i,1,n){
		tree.up(lst[a[i]],-1);
		tree.up(i,1);
		for(auto u:v[i]){
			ans[u.S]=-tree.get(i+1)+tree.get(u.F);
		}
		lst[a[i]]=i;
	}
	FOR(i,1,q)cout<<ans[i]<<'\n';
	RE 0;
}




Measured memory_bytes: 33260
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;
 
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x first
#define y second
 
const int MOD = 1e9 + 7;
 
void setIO() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}
 
//ctrl q is comment
//ctrl b is run
//ctrl s is compile
//alt r is search & replace
//alt d is delete a line


int main(){
    setIO();
    int n; cin >> n;
    int div[n + 1];
    fill(div, div + n + 1, 2);
    div[1] = 1;
    int sqrt = 0;
    for(int i = 0; i * i <= n; ++i) sqrt = i;
    for(int i = 2; i * i <= n; ++i){
        for(int j = i * 2; j <= n; j += i){
            ++div[j];
            if(j / i > sqrt) ++div[j];
        }
    }
    ll ans = 0;
    for(int i = 1; i <= n; ++i){
        ans += (ll) i * div[i];
    }
    cout << ans << "\n";
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}
int n,m;
vector<ll>a; 
vector<ll>b; 
vector<ll>c;

ll Calc(int bf){
  vector<ll> aa(n); 
  vector<ll> bb(n); 
  vector<ll> cc(n);
  for(int i = 0; i < n; ++i){
    aa[i] = a[i];
    bb[i] = b[i];
    cc[i] = c[i];
    if(bf&1) aa[i]*=-1;
    if(bf&2) bb[i]*=-1;
    if(bf&4) cc[i]*=-1;
  }
  vector<ll> sum(n);
  for(int i = 0; i < n; ++i)sum[i] = aa[i] + bb[i] + cc[i];
  sort(sum.begin(), sum.end(), greater<ll>());
  ll ans = 0;
  for(int i = 0; i < m; ++i)ans += sum[i];
  return ans;
}

int main(){
  cin >> n >> m;
  a.resize(n);
  b.resize(n);
  c.resize(n);
  for(int i = 0; i < n; ++i)cin >> a[i] >> b[i] >> c[i];
  ll ans = 0;
  for(int i = 0; i < 8; ++i)ChangeMax(ans,Calc(i));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main() {
    int r, c, total;
    cin >> r >> c;
    int data[r+1][c+1];

    for (int i = 0; i < r; i++) {
        total = 0;
        for (int j = 0; j < c; j++) {
            cin >> data[i][j];
            total += data[i][j];
        }
        data[i][c] = total;
    }

    for (int i = 0; i <= c; i++) {
        data[r][i] = 0;
    }

    for (int i = 0; i < r+1; i++) {
        for (int j = 0; j < c+1; j++) {
            if (i != r) {
                data[r][j] += data[i][j];
            }
            if (j != c) {
                cout << data[i][j] << " ";
            } else {
                cout << data[i][j] << endl;
            }
        }
    }
    return 0;
}

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

#define     FasterIO        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     bug(a,b)        cout<<a<<"\t"<<b<<"\n";
#define     Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";
#define     precision(a,b)  fixed<<setprecision(a)<<b
#define     lp(i,a,b)       for(int i=a;i<b;i++)
#define     Endl            "\n"
#define     tab             "\t"
#define     reset(a,b)      memset(a,b,sizeof(a));
#define     sf(a)           scanf(" %d", &a);
#define     sfl(a)          scanf(" %lld", &a);
#define     srt(a)          sort(a.begin(),a.end());
#define     ALL(a)          a.begin(),a.end()
#define     pi              2*acos(0.0)

typedef long long int ll;
typedef unsigned long long int ull;

const int sz=1e5+9 , inf=INT_MAX ,mod=1e9+7;


void solve(){
    ll  l,r,d,ans=0 ;
    cin>>l;
    for(int i=1;i<=l;i++){
        cin>>r;
        if(i&1 && r&1)ans++;
    }
    cout<<ans<<Endl;

    
}

int main(){
    FasterIO;
    #ifndef ONLINE_JUDGE
        freopen("input.in","r",stdin);
        freopen("output.in","w",stdout);
    #endif
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}


Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <stack>
#include <queue>
using namespace std;

int a[15];
int b[15];
int n;

struct node {
	int cnt;
	int pos1,pos2;
	int an[15];
	int bn[15];
}ball,tmp,t;

bool bfs(){
	queue<node> q;
	ball.an[0]=a[0];
	ball.pos1=0;
	ball.pos2=0;
	ball.cnt=0;
	q.push(ball);
	while(!q.empty()){
		tmp=q.front();
		int f=1;
		if(tmp.an[tmp.pos1]<a[tmp.cnt+1]){
			tmp.an[tmp.pos1+1]=a[tmp.cnt+1];
			tmp.pos1++;
			tmp.cnt++;
			q.push(tmp);
			f=0;
		}
		tmp=q.front();
		if(tmp.pos2==0||tmp.bn[tmp.pos2]<a[tmp.cnt+1]){
			tmp.bn[tmp.pos2+1]=a[tmp.cnt+1];
			tmp.pos2++,tmp.cnt++;
			q.push(tmp);
			f=0;
		}
		/*
		for(int i=0;i<q.front().pos1;i++){
			cout<<q.front().an[i]<<"  ";
		}cout<<endl;
		for(int i=0;i<q.front().pos2;i++){
			cout<<q.front().bn[i]<<"  ";
		}cout<<endl;
		cout<<"   "<<tmp.cnt<<endl;
		q.pop();
	//	if(f) return 0;
	*/
	q.pop();
		if(tmp.cnt==9) return 1;
	}
	return 0;
} 

int main(){
	while(cin>>n){
		while(n--){
			ball.pos1=0,ball.pos2=0,ball.cnt=0,ball.bn[0]=0;
			for(int i=0;i<10;i++) cin>>a[i];
			if(bfs()) cout<<"YES\n";
			else cout<<"NO\n";
		}
	//	
	}
	return 0;
}


Measured memory_bytes: 2936
import java.util.*;

public class Main {

	public static void main(String[] args) {

		// A 以上 B 以下の整数の中で、小さい方から K 番目以内であるか、大きい方から K 番目以内である
		Scanner sc = new Scanner(System.in);

		// 1≤A≤B≤109
		// 1≤K≤100
		int A = sc.nextInt();
		int B = sc.nextInt();
		int K = sc.nextInt();

		int i;
		for (i = A; i < A + K && i <= B; i++) {
			System.out.println(i);
		}

		int t = B - K + 1;
		if (i >= t) {
			t = i;
		}
		for (i = t; i <= B; i++) {
			System.out.println(i);
		}

	}
}


Measured memory_bytes: 22740
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int r,g,b,n;
    long long int ans=0;
    scanf("%d%d%d%d",&r,&g,&b,&n);
    REP(i,n/r+1){
        REP(j,n/g+1){
            if((n-r*i-g*j)%b==0 && n-r*i-g*j>=0){
                ans++;
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256