akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll l; cin >> l;
  vll a(l); REP(i, l) cin >> a[i];

  vvll dp(5, vll(l+1, HIGHINF));
  dp[0][0] = 0;
  REP(i, l) {
    REP(j, 5) {
      rep(k, j, 5) {
        ll cost;
        if (k==0 || k==4) cost = a[i];
        else if (k==1 || k==3) {
          if (a[i]%2==0 && a[i]>0) cost = 0;
          else if (a[i]>0) cost = 1;
          else cost = 2;
        } else {
          if (a[i]%2==0) cost = 1;
          else cost = 0;
        }
        chmin(dp[k][i+1], dp[j][i] + cost);
      }
    }
  }
  ll ans = HIGHINF;
  REP(i, 5) chmin(ans, dp[i][l]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
int GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
 int n,k;
 cin>>n>>k;
 V<bool> used(n+1,false);
 for(int i=0;i<k;i++){
     int d;cin>>d;
     for(int j=0;j<d;j++){
         int a;cin>>a;
         used[a]=1;
     }
 }
 int ans=0;
 for(int i=1;i<=n;i++)if(!used[i])ans++;
 cout<<ans<<"\n";
}



Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
class Card {
  public:
    char type;
    int number;
    Card(char _type, int _number) {
      type = _type;
      number = _number;
    }
    // Card(const Card &original) { // Copy Constractor
      // type = new char[1];
      // type = original.type;
      // number = new int[1];
      // number = original.number;
    // }
    string str() {
      stringstream ss;
      ss << type << number;
      // cout << ss.str() << endl;
      // return ss.str();
      return ss.str();
    }
    bool operator > (const Card &right) {
      return (number > right.number);
    }
    bool operator < (const Card &right) {
      return (number < right.number);
    }
    bool operator >= (const Card &right) {
      return (number >= right.number);
    }
    bool operator <= (const Card &right) {
      return (number <= right.number);
    }
    bool operator == (const Card &right) {
      return (number == right.number);
    }
    bool operator != (const Card &right) {
      return (number != right.number);
    }
};
 
void pResult(vector<Card> &, vector<Card> &);
vector<Card> BubbleSort(vector<Card>);
vector<Card> SelectionSort(vector<Card>);
string cardsToStr(vector<Card> &);
 
 
int main() {
  int n;
  cin >> n;
  vector<Card> cards;
  for(int i = 0; i < n; ++i) {
    string s_card;
    cin >> s_card;
    char c_card;
    int d_card;
    stringstream ss;
    ss << s_card;
    ss >> c_card;
    ss >> d_card;
    Card card(c_card, d_card);
    cards.push_back(card);
  }
  vector<Card> result1 = BubbleSort(cards);
  vector<Card> result2 = SelectionSort(cards);
  pResult(result1, result1);
  pResult(result2, result1);
  return 0;
}
 
void pResult(vector<Card> &sorted, vector<Card> &original) {
  string s_result = cardsToStr(sorted);
  cout << s_result << endl;
  cout << ((s_result == cardsToStr(original)) ? "Stable" : "Not stable") << endl;
}
 
string cardsToStr(vector<Card> &cards) {
  stringstream result;
  for(auto i = cards.begin(); i != cards.end(); ++i) {
    result << (*i).str();
    // cout << (*i).str() << endl;
    // cout << cards[0].str() << endl;
    if(i != cards.end() - 1) result << ' ';
  }
  return result.str();
}
 
vector<Card> BubbleSort(vector<Card> cards) {
  // result.resize(cards.size());
  // copy(cards.begin(), cards.end(), result.begin());
  for(int i = 0; i < cards.size(); ++i) {
    for(int j = cards.size() - 1; j > 0; --j) {
      if(cards[j] < cards[j - 1]) swap(cards[j], cards[j - 1]);
    }
  }
  return move(cards);
}
 
vector<Card> SelectionSort(vector<Card> cards) {
  for(auto i = cards.begin(); i != cards.end(); ++i) {
    auto itr_min = min_element(i, cards.end());
    iter_swap(i, itr_min);
  }
  return move(cards);
}


Measured memory_bytes: 3232
while True:
    N = int(raw_input())
    if N == 0: break
    t = 0
    for i in range(N):
        x, y, h, w = map(int, raw_input().split())
        if x+y+h <= 60 and w <= 2:
            t += 600
        elif x+y+h <= 80 and w <= 5:
            t += 800
        elif x+y+h <= 100 and w <= 10:
            t += 1000
        elif x+y+h <= 120 and w <= 15:
            t += 1200
        elif x+y+h <= 140 and w <= 20:
            t += 1400
        elif x+y+h <= 160 and w <= 25:
            t += 1600
    else:
        print t

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


int main() {
	int a ,b;
	cin >> a >> b ;
	int d = a/b;
	int r = a%b;
	long double f = (long double)(a)/b;
	cout << d << " " << r << " " << showpoint << fixed << setprecision(12) << f << endl;
	return 0;
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const long double PI = (acos(-1));
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d",&x)
#define scll(x) scanf("%lld",&x)
int main(){
    int n; sc(n);
    int x = n % 10;
    if (x==2 || x == 4 || x == 5 || x == 7 || x == 9){
        cout << "hon" << endl;
    }else if (x == 0 || x == 1 || x == 6 || x == 8){
        cout << "pon" << endl;
    }else cout << "bon" << endl;
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

class Graph
{
public:
    enum
    {
        WHITE = 0,
        GRAY = 1,
        BLACK = 2,
    };

    Graph() {}
    Graph(int n)
    : color(n, WHITE), M(n), d(n, INFTY)
    {}
    ~Graph() {}

    void dijkstra(int s)
    {
        d[s] = 0;
        priority_queue< pair<int, int> > pq;

        pq.push(make_pair(0, s));
        while (!pq.empty())
        {
            pair<int, int> du = pq.top(); pq.pop(); 

            int u = du.second;
            int minv = -du.first;

            color[u] = BLACK;

            if (d[u] < -minv) continue;

            for (auto dv : M[u])
            {
                int v = dv.first;
                int w = dv.second;
                if (color[v] != BLACK && d[v] > d[u] + w)
                {
                    d[v] = d[u] + w;
                    color[v] = GRAY;
                    pq.push(make_pair(-d[v], v));
                }
            }
        }
    }

    static const int INFTY = 1e9;
    vs32 color;
    vector< vector< pair<int, int> > > M;
    vs32 d;
};

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

    int n;
    cin >> n;

    Graph g(n);

    int u, v;
    int w;
    int c;
    rep (i, n)
    {
        cin >> u >> c;
        rep (j, c)
        {
            cin >> v >> w;
            g.M[u].emplace_back(v, w);
        }
    }

    g.dijkstra(0);
    rep (i, n)
    {
        cout << i << " " << g.d[i] << "\n";
    }
    return 0;
}



Measured memory_bytes: 7852
N, A, B = map(int,input().split())

if (A + B) == 0:
    print('0')
else:
    repeat = N // (A + B)
    blue = A * repeat
    remain = N % (A + B)
    if remain > A:
        blue += A
    else:
        blue += remain
    print(str(blue))


Measured memory_bytes: 3064
n = int(input())

l = [input() for _ in range(n)]

count = len(set(l))
flag = True
for i in range(len(l) -1 ):
    if l[i][len(l[i]) -1] != l[i+1][0]:
        flag = False
        break

if flag and count == n:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;
static const int MAX_N = 100000;
int Q;
bool primes[MAX_N + 1]; // 素数であるかどうか(true->素数,false->not素数)
int cnt[MAX_N + 2];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> Q;
    memset(primes, true, sizeof(primes));
    for (int i = 2; i <= MAX_N; ++i) {
        if (primes[i]) {
            for (int j = i + i; j <= MAX_N; j += i) {
                primes[j] = false;
            }
        }
    }
    for (int i = 3; i <= 100000; i += 2) {
        if (primes[i] && primes[(i + 1) / 2]) {
            ++cnt[i];
        }
    }

    for (int i = 3; i <= 100000; ++i) {
        cnt[i] += cnt[i - 1];
    }

    rep(i, Q)
    {
        ll l, r;
        cin >> l >> r;
        cout << cnt[r] - cnt[l - 1] << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
    map<long long, long> m;
    int n,a,contador = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a;
        m[a]++;
    }
    for(auto i:m){
        if(i.first > i.second) contador += i.second;
        else if(i.first < i.second){
            contador += i.second - i.first;
        }
        
    }
    cout << contador;
    return 0;
}

Measured memory_bytes: 6272
#include<iostream>
using namespace std;
int main(void)
{
  int n;
  int sum=0;
  int tmp1,tmp2=0;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>tmp1;
    if(tmp1<tmp2)
      sum+=tmp1;
    else{
      sum+=tmp2;
      tmp2=tmp1;
    }
  }
    if(sum>tmp2)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;


public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int n = sc.nextInt();
        int kai = 8;
        int nc = 600;
        while(true){
            if(n<nc){
                System.out.println(kai);
                break;
            }else{
                nc+=200;
                kai--;
            }
        }
    }
}

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int t = ((a + b + c) % 2 == max({a, b, c}) % 2) ? max({a, b, c}) : max({a, b, c}) + 1;
	cout << (3 * t - (a + b + c)) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O2")
#pragma GCC optimization("unroll-loops")
using namespace std;

void chmax (int &x, int a) {
    x = max(x, a);
}

int n, m, q, ans = 0;
int a[50], b[50], c[50], d[50];

void rec (vector < int > &vec) {
    if (int(vec.size()) == n) {
        int cur = 0;
        for (int i = 0; i < q; ++i) {
            if (vec[b[i]] - vec[a[i]] == c[i])
                cur += d[i];
        }
        chmax(ans, cur);
    }
    else {
        int lb = 1;
        if (!vec.empty())
            lb = vec.back();
        for (int i = lb; i <= m; ++i) {
            vec.push_back(i);
            rec(vec);
            vec.pop_back();
        }
    }
}

signed main () {
    cin >> n >> m >> q;
    for (int i = 0; i < q; ++i) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i]; 
        --b[i];
    }
    vector < int > vec;
    rec(vec);
    cout << ans << '\n';
}


Measured memory_bytes: 3640
#include <stdio.h>
int main(void) {
	int n;
	char s[100];

	scanf("%d", &n);
	scanf("%s", s);

	if (n % 2 == 1) {
		printf("No\n");
		return 0;
	}
	else
		for (int i = 0; i < n / 2; i++) {
			if (s[i] != s[n / 2 + i]) {
				printf("No\n");
				return 0;
			}
		}

	printf("Yes\n");
	return 0;
}

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

const int MAXN = 500050;

char s[MAXN];
int ans, l, r, n, a[MAXN];

inline bool chk(int x)
{
	int len = n, sum = 0;
	for( int i = 1 ; i <= n ; i++ ) a[ i ] = ( s[ i ] - '0' ) * 9;
	a[ 1 ] += 9 * x;
	for( int i = 1 ; i <= len ; i++ )
		if( a[ i ] > 9 )
		{
			if( i == len ) a[ ++len ] = 0;
			a[ i + 1 ] += a[ i ] / 10;
			a[ i ] %= 10;
		}
	for( int i = 1 ; i <= len ; i++ ) sum += a[ i ];
	return sum <= 9 * x;
}

int main()
{
#ifdef wxh010910
	freopen( "data.in", "r", stdin );
#endif
	scanf( "%s", s + 1 );
	l = 1, r = n = strlen( s + 1 );
	reverse( s + 1, s + n + 1 );
	while( l <= r )
	{
		int mid = l + r >> 1;
		if( chk( mid ) ) ans = mid, r = mid - 1;
		else l = mid + 1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector <ll>
#define mii map <ll,ll>
#define vpi vector <pair <ll,ll> >
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define ff(i,a,n) for(int i=a;i<n;i++)
#define vvi vector<vi > //v(r, vi (c,"#"))
// clock_t begin = clock(); f(n) ; clock_t end = clock(); cout<<(double)(end-begin)/ CLOCKS_PER_SEC;
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n,k;
    cin>>n>>k;
    int h[n+1], dp[n+1];
    ff(i,1,n+1) {
        cin >> h[i];
    }
    dp[1]=0;
    dp[2]=abs(h[2]-h[1]);
    ff(i,3,n+1)
    {
        dp[i]=INT_MAX;
        for(int j=min(k,i-1);j>0;j--)
        {
            dp[i]=min(dp[i-j]+abs(h[i]-h[i-j]),dp[i]);
        }
    }
    cout << dp[n];
    return 0;
}


Measured memory_bytes: 4392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define d(x) cerr<<#x<<"="<<x<<endl;

vector<ll> a,b,c;
int n;
ll tmp,need,ans;
int main(void){
    cin>>n;
    rep(i,n){cin>>tmp; a.push_back(tmp);}
    rep(i,n){cin>>tmp; b.push_back(tmp);}
    rep(i,n){c.push_back(b[i]-a[i]); if(b[i]-a[i]>0){ans++;need+=(b[i]-a[i]);}}
    sort(c.begin(),c.end());
    //rep(i,n)cout<<c[i]<<endl;
    //cout<<need<<endl;
    rep(i,n){
        if(c[i]>=0)break;
        if(need<=0)break;
        need+=c[i];
        ans++;
    }
    if(need<=0)cout<<ans<<endl;
    else cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 3316
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print() { cout << endl; }
template<typename Head,typename... Tail> void print(Head head,Tail... tail){cout<<head;if(sizeof...(Tail)>0)cout<<" ";print(tail...);}
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<head;print0(tail...);}
// clang-format on

bool dfs(ll keta, ll top, ll &total, vector<char> &chars, ll K) {
    if (keta == -1) {
        total++;
        if (total == K) {
            for (ll s = chars.size() - 1; s >= 0; s--) {
                print0(chars[s]);
            }
            print();
            return true;
        }
        return false;
    }
    if (top > 0) {
        chars[keta] = (char)top + '0' - 1;
        if (dfs(keta - 1, top - 1, total, chars, K)){
            return true;
        }
    }
    chars[keta] = (char)top + '0';
    if (dfs(keta - 1, top, total, chars, K)) {
        return true;
    }
    if (top < 9) {
        chars[keta] = (char)top + '0' + 1;
        if (dfs(keta - 1, top + 1, total, chars, K)) {
            return true;
        }
    }
    return false;
}
int main() {
    ll K;
    cin >> K;
    ll total = 0;
    for (ll keta = 1; true; keta++) {
        vector<char> chars(keta);
        for (ll top = 1; top <= 9; top++) {
            chars[keta - 1] = top + '0';
            if (dfs(keta - 2, top, total, chars, K)) {
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<stdbool.h>

#define N 8
#define F -1
#define NF 1

int row[N],iro[N],dpos[2*N-1],dneg[2*N-1];
bool X[N][N];

void init(){
  int i;
  for(i=0;i<N;i++){row[i]=F,iro[i]=F;}
  for(i=0;i<2*N-1;i++){dpos[i]=F;dneg[i]=F;}
}

void pB(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(X[i][j]){
	if(row[i]!=j)return;
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j){
	printf("Q");
      }
      else printf(".");
    }
    printf("\n");
  }
}

  void rs(int i){
    int j;
    if(i==N){
      pB();return;
    }
    for(j=0;j<N;j++){
      if(NF==iro[j]||NF==dpos[i+j]||NF==dneg[i-j+N-1])continue;
      row[i]=j;
      iro[j]=dpos[i+j]=dneg[i-j+N-1]=NF;
      rs(i+1);
      row[i]=iro[j]=dpos[i+j]=dneg[i-j+N-1]=F;
    }
  }

  int main(){
    int i,j,k,r,c;
    init();
    for(i=0;i<N;i++){
      for(j=0;j<N;j++){
	X[i][j]=false;
      }
    }
    scanf("%d",&k);
    for(i=0;i<k;i++){
      scanf("%d",&r);
      scanf("%d",&c);
      X[r][c]=true;
    }
    rs(0);
    return 0;
  }

Measured memory_bytes: 572
#include<stdio.h>
int main(void){
int H,W,h,w;
while(1){
scanf("%d %d",&H,&W);
if(H==0&&W==0)break;
for(h=1;h<=H;h++){
for(w=1;w<=W;w++){
if(h%2==1){
if(w%2==1)printf("#");
else printf(".");
}
else{
if(w%2==0)printf("#");
else printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}


Measured memory_bytes: 1932
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N;
  cin>>N;

  string ans = "No";
  for(Int i=1;i<=9;i++)
    for(Int j=1;j<=9;j++) if(i * j == N) ans = "Yes";
  cout<<ans<<endl;

  return 0;
}


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

#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector
#define beg begin
#define dbg(x) cerr << #x << " = " << x << endl;

template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}

template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i;
    }
    return str;
}

template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.first << " " << a.second;
    return str;
}

template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.first >> a.second;
    return str;
}

void solve(); signed main() {
#ifdef LOCAL
    freopen("C:\\Users\\artma\\CLionProjects\\problems\\input.txt", "r", stdin);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();
    return 0;
}

const int MOD = 1e9 + 7, MAXN = 1e6 + 10, INF = 1e18 + 10, BASE = 37;

void solve() {
    int n;
    cin >> n;
    vec<int> a(n);
    cin >> a;

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            for (int k = j + 1; k < n; ++k) {
                set<int> se;
                se.insert(a[i]), se.insert(a[j]), se.insert(a[k]);
                if ($(se) == 3) {
                    if (a[i] < a[j] + a[k] && a[j] < a[i] + a[k] && a[k] < a[i] + a[j]) {
                        ans++;
                    }
                }
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3644
def main():
    N = int(input())
    mod = 10 ** 9 + 7
    mod_1 = 1
    mod_2 = 1
    mod_3 = 1
    for _ in range(N):
        mod_1 = (mod_1 * 10) % mod
        mod_2 = (mod_2 * 9) % mod
        mod_3 = (mod_3 * 8) % mod
    v = (mod_1 - 2 * mod_2 + mod_3) % mod
    print(v)

if __name__ == '__main__':
    main()

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

int N, M, Q;
vector<vector<int>> ABCD;
int ans;

void dfs (vector<int> v, int dep, int pre) {
  if (dep == N) {
    int sum = 0;
    for (auto a : ABCD) {
      if (v.at(a.at(1) - 1) - v.at(a.at(0) - 1) == a.at(2)) {
        sum += a.at(3);
      }
    }
    ans = max(ans, sum);
    return;
  }
  for (int i = pre; i <= M; i++) {
    vector<int> nv = v;
    nv.push_back(i);
    dfs(nv, dep + 1, i);
  }
}

int main() {
  cin >> N >> M >> Q;
  for (int a, b, c, d; cin >> a >> b >> c >> d;) ABCD.push_back({a, b, c, d});
  vector<int> start;
  dfs(start, 0, 1);
  cout << ans << "\n";
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;


void solve()
{
    string s; cin >> s;
    reverse(ALL(s)); 

    vs a(4);
    a[0] = "dream";
    a[1] = "dreamer";
    a[2] = "erase";
    a[3] = "eraser";
    REP(i, 4) reverse(ALL(a[i]));

    int i = 0;
    while(i < s.length())
    {
        if(s.substr(i, 5) == a[0]) i += 5;
        else if(s.substr(i, 7) == a[1]) i += 7;
        else if(s.substr(i, 5) == a[2]) i += 5;
        else if(s.substr(i, 6) == a[3]) i += 6;
        else
        {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

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

    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		String[] d = new String[k];
		for (int i = 0; i < k; i++) {
			d[i] = scan.next();
		}
		int ans = 0;
		for (int i = n; i <= Integer.MAX_VALUE; i++) {
			String i_str = String.valueOf(i);
			boolean f = false;
			for (int j = 0; j < k; j++) {
				if (i_str.contains(d[j])) {
					f = true;
				}
			}
			if (f == false) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
}


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

int main() {
    // 頂点数 (木なので辺数は N-1 で確定)
    int n;
cin >> n;
int data[n];
int flag=0;
for(int i=0;i<n;i++){
 cin >> data[i];
if(data[i]%2==0){
if(data[i]%5==0 || data[i]%3==0){
}else{
flag=1;
}

} 
}




if(flag==0)
cout <<"APPROVED" ;
else
cout <<"DENIED" ;

}

Measured memory_bytes: 256
"use strict";
var fs=require("fs");
var input=fs.readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cx=0;
function next(){return +cin[cx++];};
function nexts(){return cin[cx++];};
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

var leng = 0, nextV = 0, day = 0, takeday = -1;
var score = 0;

const INF = 1e9;
const V = next(); //200-400
const E = next(); //1.5V-2V
const dist = xArray(INF,V,V);
const directDist = xArray(INF,V,V);
const e = xArray("[]",V);
getE();
const tmax = next(); //10000
const tmax2 = tmax*tmax;
const ans = Array(tmax);
const has = new Set();
const orderTime = xArray("[]",V);

console.log(main());
if(0){
  fs.writeFileSync("/dev/stdout", ans.join("\n"));
  console.log(score);
}
function main(){
  for(var k = 0; k < V; k++)
  for(var i = 0; i < V; i++)
  for(var j = 0; j < V; j++){
    if(dist[i][k]+dist[k][j]<dist[i][j])dist[i][j]=dist[i][k]+dist[k][j];
  }
  while(day < tmax){
    ans[day] = solve()+1;
    if(leng < 0){
      console.log(day,leng,nextV);
      return;
    }
    day++;
  }
  return ans.join("\n");
}

function getE(){
  for(var i = 0; i < V; i++)dist[i][i] = 0;
  for(var i = 0; i < E; i++){
    var v1 = next()-1, v2 = next()-1, d = next();
    dist[v1][v2] = dist[v2][v1] = directDist[v1][v2] = directDist[v2][v1] = d;
    e[v1].push(v2);
    e[v2].push(v1);
  }
}

function deliver(){
  if(has.size === 0){
    if(nextV === 0)return -2;
    return minPath(0);
  }
  var maxid = -1, max = 0;
  for(var v of has){
    if(max < orderTime[v].length)
    if(dist[nextV][v] <= tmax-day){
      maxid = v, max = orderTime[v].length;
    }
  }
  if(maxid === -1)return -2;
  return minPath(maxid);
}

function minPath(to){
  for(var v of e[nextV]){
    if(dist[nextV][to] === directDist[nextV][v]+dist[v][to]){
      leng = dist[nextV][v]-1;
      return nextV = v;
    }
  }
  return -2;
}

function solve(){
  if(leng){
    leng--;
    return nextV;
  }
  if(nextV === 0)take();
  else give();
  return deliver();
}

function take(){
  while(takeday < day){
    takeday++;
    var n = next();
    for(var i = 0; i < n; i++){
      var id = next()-1, d = next()-1;
      has.add(d);
      orderTime[d].push(takeday);
    }
  }
}

function give(){
  has.delete(nextV);
  while(orderTime[nextV].length){
    var t = day - orderTime[nextV].pop();
    score += tmax2 - t*t;
  }
}

Measured memory_bytes: 30952
#include<bits/stdc++.h>
#define ll int
#define pb push_back
#define MAX 1e9
#define MIN -1e9
#define MOD 1000000007
#define mod2 20071027
//#define mod 1000074259
#define base 139
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%d", &a)
#define in2(a, b) scanf("%d%d", &a, &b)
#define TC(c) printf("Case %d: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
const ll N=300010;
ll h, n, k, a[N], b[N], mem[10005][1005];
ll dp(ll H, ll pos)
{
    if(H<=0)
        return 0;
    ll &ret = mem[H][pos];
    if(pos>=n)
        return MAX;
    if(~ret)
        return ret;
    ret = min(b[pos]+dp(H-a[pos], pos), b[pos]+dp(H-a[pos], pos+1));
    ret=min(ret, dp(H, pos+1));
    return ret;
}

int main()
{
    memn(mem);
    in2(h, n);
    for(int i=0;i<n;i++)
        in2(a[i], b[i]);
    printf("%d\n", dp(h, 0));
    return 0;
}

/*

*/


Measured memory_bytes: 41984
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int n, a[100010], b[100010];
    cin >> n;

    int mina = 1000000010, maxa = -1;
    int minb = 1000000010, maxb = -1;
    for (int i=0; i<n; i++) {
        cin >> a[i] >> b[i];
        if (a[i] < mina) mina = a[i], maxb = b[i];
        if (a[i] > maxa) maxa = a[i], minb = b[i];
    }

    int ans = maxa;
    ans += minb;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#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 solve() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N), F(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> F[i];
    sort(A.rbegin(), A.rend());
    sort(F.begin(), F.end());
    auto f = [&](ll x) {
        ll c = 0;
        rep(i, N) {
            ll a = A[i];
            ll f = F[i];
            if (a * f <= x) {
                continue;
            } else {
                c += (a * f - x + f - 1) / f;
            }
        }
        return c <= K;
    };
    ll ok = 1e18;
    ll ng = -1;
    while (ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        if (f(mid)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cout << ok << '\n';
}

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


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, a, b;
    cin >> x >> a >> b;
    if(a >= b) {
        cout << "delicious\n";
    } else {
        cout << ((b - a) <= x ? "safe" : "dangerous") << "\n";
    }
}

Measured memory_bytes: 3608
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        StringTokenizer tokenizer = new StringTokenizer(input.readLine());
        int [] values = new int[n];
        for (int i = 0; i < n; i++) {
            values[i] = Integer.parseInt(tokenizer.nextToken());
        }
        Arrays.sort(values);

        boolean state = true;
        int sum1 =0, sum2 = 0;

        for (int i = n - 1; i > -1; i--) {
            if (state){
                sum1 += values[i];
                state = false;
            }else {
                sum2  += values[i];
                state = true;
            }
        }

        System.out.println(Math.abs(sum1 - sum2));
    }
}


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

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

int main() {
  int n;
  cin >> n;
  int ans  = 0;
  rep(i, n) {
    int yakusu  = 0;
    if (i % 2 == 0) continue;
    rep(j, i) {
      if (i % j == 0) yakusu++;
    }
    if (yakusu == 8) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

/**
 * Greatest Common Divisor
 * 
 *
 */
public class Main {
    
    public static void main(String[] args) {
        // input data
        List<String> input = inputLines();
        
        // get input
        int x = Integer.valueOf(input.get(0).split(" ")[0]);
        int y = Integer.valueOf(input.get(0).split(" ")[1]);
        if (y > x) {
            int tmp = x;
            x = y;
            y = tmp;
        }
        int gcd = 0;

        // main logic
        
        gcd = gcd(x,y);

        output(gcd);
    }

    private static int gcd(int n,int m) {
        if (m == 0) {
            return n;
        }
        return gcd(m, n % m);
    }

    private static List<String> mocups() {
        List<String> input = Arrays.asList(
                "6 15"
                );
        return input;
    }

    /** output data */
    private static void output(Object o) {
        System.out.println(o);
    }
    private static void output(String[] o) {
        System.out.println(Arrays.toString(o));
    }
    private static void output(int[] o) {
        System.out.println(Arrays.toString(o));
    }
    private static void output(Object[] o) {
        System.out.println(Arrays.toString(o));
    }

    /** input data */
    private static List<String> inputLines() {
        Scanner in = new Scanner(System.in);
        List<String> input = new ArrayList<String>();
        while(in.hasNext()) {
            String buf = in.nextLine();
            input.add(buf);
        }
        in.close();
        return input;
    }

}

Measured memory_bytes: 17304
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<set>
#include<functional>
#include<list>
#include<bitset>
#include<numeric>
#include<utility>
#define INF (int)1e9
#define MOD 1000000007
using namespace std;
typedef unsigned long long ull;
typedef long long ll;


vector<int>d;

bool f(int x) {
	while (x != 0) {
		int y = x % 10;
		for (auto itr : d) {
			if (itr == y) {
				return false;
			}
		}
		x = x / 10;
	}
	return true;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	d = vector<int>(k);
	for (int i = 0; i < k; i++) {
		cin >> d[i];
	}
	sort(d.begin(), d.end());
	
	/*auto itr = d.begin();
	for (int i = 0; i < 10; i++) {
		if (*itr == i) {
			itr++;
			continue;
		}
		p.push_back(i);
	}*/
	/*for (auto it : p) {
		cout << it << " ";
	}
	cout << endl;*/
	int ans = n;
	while (1) {
		if (f(ans)) {
			cout << ans;
			break;
		}
		ans++;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
#define ll long long 
#define jaldi_chal  ios_base::sync_with_stdio(0); cin.tie(0);
#define tr(c,i) for(auto i=(c).begin(); i != (c).end(); i++)
#define REP(i,k) for( ll i=0;i<k;i++)
#define REW(i,a,b) for(ll i=a;i<=b;i++)
#define M 1000000007
#define F first
#define dbg(x)  cout<<#x<<" " <<x<<endl;
#define S second
#define inf 1e10
#define endl "\n"

float power(float a,ll b)
{
    float res=1;
    while(b)
    {
        if(b%2)
        {
            b--;
            res=res*a;
        }else {
            b=b/2;
            a=a*a;
        }
    }
    return res;
    
}

int main() {
jaldi_chal
ll n;
cin>>n;
ll a[n];
map<ll,ll> m;
REP(i,n) {cin>>a[i]; m[a[i]]++;}

ll sum=0;


   for(auto x: m)
   {
       if(x.S>=2)
       {
           ll z=x.S;
           
           sum+=(z*(z-1))/2;
       }
   }
 
REP(i,n)
{
    if(m[a[i]]>=2)
    {
        cout<<sum-(m[a[i]]-1)<<endl;
    }
    else {
        cout<<sum<<endl;
    }
}



	return 0;
}

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

using namespace std;
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
const int N=1e9+5;///1e18+5

void solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(b*c>=a)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


int main()
{
    //freopen("input.txt","r",stdin);
    IO;
    int tc=1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3580
import sys
input=sys.stdin.readline
n=int(input())
l=[list(map(int,input().split())) for i in range(n-1)]
connection=[[] for i in range(n)]
for i in range(n-1):
  connection[l[i][0]-1].append(l[i][1]-1)
  connection[l[i][1]-1].append(l[i][0]-1)
 
distance1=[-1 for i in range(n)]
distance1[0]=0
next=connection[0]
next2=[]
check=[-1 for i in range(n)]
check[0]=1
checkct=1
ct=0
while len(next)!=0 and checkct!=n:
  ct+=1
  for i in range(len(next)):
    distance1[next[i]]=ct
    check[next[i]]=1
    checkct+=1
    for j in range(len(connection[next[i]])):
      if check[connection[next[i]][j]]==-1:
        next2.append(connection[next[i]][j])
  next=next2
  next2=[]

x=max(distance1)
x=distance1.index(x)

distance2=[-1 for i in range(n)]
distance2[x]=0
next=connection[x]
next2=[]
check=[-1 for i in range(n)]
check[x]=1
checkct=1
ct=0
while len(next)!=0 and checkct!=n:
  ct+=1
  for i in range(len(next)):
    distance2[next[i]]=ct
    check[next[i]]=1
    checkct+=1
    for j in range(len(connection[next[i]])):
      if check[connection[next[i]][j]]==-1:
        next2.append(connection[next[i]][j])
  next=next2
  next2=[]

if max(distance2)%3==1:
  print('Second')
else:
  print('First')

Measured memory_bytes: 121092
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using GraphI = vector<vector<int>>;
using GraphC = vector<vector<char>>;
using pint = pair<int, int>;

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  GraphC g(H, vector<char>(W));
  rep(y, H) rep(x, W) cin >> g[y][x];

  int ans = 0;
  rep(bitR, 1 << H) {
    rep(bitC, 1 << W) {
      int black = 0;
      rep(y, H) {
        rep(x, W) {
          if ((bitR >> y & 1) && (bitC >> x & 1) && g[y][x] == '#') {
            black++;
          }
        }
      }
      if (black == K) ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3552
import java.util.*;

 


public class Main {


    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int[] a = new int[3];
        for (int i = 0; i < 3; i++) {
            a[i] = cin.nextInt();
        }
        Arrays.sort(a);
        System.out.println(a[0] * a[1] / 2);
    }


}


Measured memory_bytes: 23252
/*input
32
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5
*/ 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define MP make_pair
const ll INF64=4e10;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
const ll maxn=1e3+5;
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n;
    cin>>n;
    map<int,int> mp;
    ll ans=0;
    REP1(i,n){
        int x;
        cin>>x;
        ans+=mp[i-x];
        mp[x+i]++;
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 20596
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

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

	if(a >= 13) co(b);
	else if(a >= 6) co(b/2);
	else co(0);

	return 0;
}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<char, int> P;

char mark[5] = "SHCD";
map<P, bool> m;

int main() {
	int N;
	scanf("%d", &N);
	rep(i, N) {
		char a;
		int b;
		cin >> a >> b;
		m[P(a, b)] = true;
	}
	rep(i, 4) FOR(j, 1, 14) {
		if(!m[P(mark[i], j)]) printf("%c %d\n", mark[i], j);
	} 
	return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
bool ask(string &s1, string &s2, int i, bool rev) {
    if (rev) cout << ".#"[i & 1];
    cout << s1;
    if (!rev) cout << ".#"[i & 1];
    cout << '\n';
    if (rev) cout << ".#"[(i >> 1) & 1];
    cout << s2;
    if (!rev) cout << ".#"[(i >> 1) & 1];
    cout << endl;
    string r; cin >> r;
    if (r == "T") {
        if (rev) {
            s1 = ".#"[i & 1] + s1;
            s2 = ".#"[(i >> 1) & 1] + s2;
        } else {
            s1.push_back(".#"[i & 1]);
            s2.push_back(".#"[(i >> 1) & 1]);
        }
        return true;
    } else if (r == "F") {
        return false;
    } else {
        exit(0);
    }
}
int main() {
    int N; cin >> N;
    string s1, s2;
    bool rev = false;
    while (s1.size() < N) {
        bool ok = false;
        for (int i = 0; i < 4; i++) {
            if (ask(s1, s2, i, rev)) {
                ok = true;
                break;
            }
        }
        if (!ok) {
            rev = !rev;
            continue;
        }
    }
    return 0;
}

Measured memory_bytes: 724
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

int main() {
    int D;
    cin >> D;
    vector<int>cs(26);
    vector<vector<int>>sds(D, vector<int>(26));
    for (int i=0; i<26; i++)cin >> cs[i];

    for (int i=0; i<D; i++){
        for (int j=0; j<26; j++){
            cin >> sds[i][j];
        }
    }

    vector<int>ts(D);
    for (int i=0; i<D; i++)cin >> ts[i];
    vector<int>lds(26);

    int stf = 0;
    for (int i=0; i<D; i++){
        int ti = ts[i];
        ti--;
        stf += sds[i][ti];
        lds[ti] = i+1;
        int cnt = 0;
        for (int j=0; j<26; j++){
            cnt += cs[j] * (i+1-lds[j]);
        }
        stf -= cnt;
        cout << stf << endl;

    }

}

Measured memory_bytes: 3692
//
// Created by Abhishek Bansal on 9/01/2020.
//
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

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

    ll d, t, s; cin >> d >> t >> s;
    if (d >s*t) cout << "No"; else cout << "Yes";
    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>

int main(void)
{
    while (1) {
        char str_num[1001];

        scanf("%s", str_num);

        if (str_num[0] == '0') break;

        int i = 0;
        int sum = 0;

        do {
            sum += (str_num[i] - '0');
            i++;
        } while (str_num[i] != '\0');

        printf("%d\n", sum);
    }

    return 0;
}

Measured memory_bytes: 536