akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int m, d;
    cin>>m>>d;
    int ans = 0;
    for(int i = 1; i <= m; i++) {
        for(int j = 1; j <= d; j++) {
            int d1 = j % 10;
            int d2 = (j / 10) % 10;
            if(d1 >= 2 && d2 >= 2 && d1 * d2 == i) ans++;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAX = 2e5 ;
const int INF = 1e9 + 1e5 + 2;
const int mod= 1e9+7;
using namespace std;
typedef long long ll;
#define f first
#define s second
int main()
{
    int n;

    string s;

    cin>>n>>s;
    ll r=0,b=0,g=0;
    for (int i=0; i<n; ++i)
    {
        if (s[i]=='R')
          ++r;
        if (s[i]=='B')
          ++b;
        if (s[i]=='G')
           ++g;
          
    }

    ll ans=r*b*g;

    for (int i=0; i<n; ++i)
    {
        for (int j=i+1; j<n; ++j)
        {
            int k=2*j-i;
            if (k<n && s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k])
            {
                --ans;
            }
        }
    }
    cout<<ans;

    
}


Measured memory_bytes: 3624
n,t1 = map(int,input().split())
ls = []
ans = 1001
for i in range(n):
    c,t2 = map(int,input().split())
    if t1 >= t2:
        ans = min(c,ans)
    
if ans != 1001:
    print(ans)
else:
    print("TLE")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, r;
    cin >> n >> r;
    if (n < 10) cout << (10 - n) * 100 + r << '\n';
    else cout << r << '\n'; 
    return 0;
}

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

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

  vector<tuple<string,int,int>> t(N);
  for (int i=0; i<N; ++i) {
    string s;
    int p;
    cin >> s >> p;
    t[i] = make_tuple(s,p,i+1);
  }
  
  sort(t.begin(), t.end(),
       [&](auto& a, auto& b) {	 
	 return get<0>(a) < get<0>(b) || (get<0>(a) == get<0>(b) && get<1>(a) > get<1>(b));
       });

  for (auto& tt : t) {
    cout << get<2>(tt) << endl;
  }
      
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define ios; ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define ls(x) (x<<1)
#define rs(x) (ls(x)|1)
#define eps 1e-11
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef double db;
mt19937 rnd(random_device{}());
const int mod = 1e9 + 7;
const int N = 2e2 + 5;
const int M = 1e3 + 5;
inline ll gcd(ll a,ll b){ return b?gcd(b,a%b):a; }
inline ll lcm(ll a,ll b){ return a*b/gcd(a,b); }
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
int n, m, k;

int main(){
    scanf("%d",&n);
    ll cnt=1, p=7, q=10;
    ll ans=-1;
    while(1){
        if(p%n==0){
            ans=cnt;
            break;
        }
        p=(p+7*q)%n;
        q=q*10%n;
        ++cnt;
        if(cnt==1e7) break;
    }
    printf("%lld\n", ans);
    return 0;
}
/*
1
3 3
1 2 3
1 2 3
100 1 1

2 / 1
203 / 101
*/
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                           O\  =  /O
//                        ____/`---'\____
//                      .'  \|     |//  `.
//                     /  \|||  :  |||//  \
//                    /  _||||| -:- |||||-  \
//                    |   | \  -  /// |   |
//                    | \_|  ''\---/''  |   |
//                    \  .-\__  `-`  ___/-. /
//                  ___`. .'  /--.--\  `. . __
//               ."" '<  `.___\_<|>_/___.'  >'"".
//              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//              \  \ `-.   \_ __\ /__ _/   .-` /  /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//                     佛祖保佑      永无BUG


Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  int n,c,k;
  cin>>n>>c>>k;
  vector<int>arrivals(n);
  for(int i=0;i<n;i++){
  	cin>>arrivals[i];
  }
  sort(arrivals.begin(),arrivals.end());
  int pos = 0;
  int tot = 0;
  int done = 0;
  while(1){
  	int reach = arrivals[pos]+k;
  	int capacity = 0;
  	while(pos<n&&capacity<c&&arrivals[pos]<=reach){
  		capacity++;
  		done++;
  		pos++;
  	}
  	tot++;
  	if(done==n||pos==n){
  		break;
  	}
  }
  cout<<tot<<endl;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int a[101][101], b[101], c[101];
    int i, j;
    int n, m;
 
    scanf("%d%d", &n, &m);
    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) scanf("%d", &a[i][j]);
    }
    for (j = 0; j < m; j++) scanf("%d", &b[j]);
 
    for (i = 0; i < n; i++) {
        c[i] = 0;
        for (j = 0; j < m; j++) c[i] += a[i][j] * b[j];
    }
 
    for (i = 0; i < n; i++) {
        printf("%d\n", c[i]);
    }
    return 0;
}


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

using namespace std;
#define rep(i,n) for (int i =0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;

int main(){
    ll a,b,c,d;
    cin >>a>>b>>c>>d;
    ll ans=-1000100010001000100;
    ans =max(ans,a*c);
    ans =max(ans,a*d);
    ans =max(ans,b*c);
    ans =max(ans,b*d);

    cout <<ans;
    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <string.h>
int n, r[128]; bool used[22370000]; char com[7], s[13];
int main() {
	scanf("%d", &n); r[65] = 1, r[67] = 2, r[71] = 3;
	for(int i = 0; i < n; i++) {
		scanf("%s %s", com, s);
		int h = 0, l = strlen(s);
		for(int j = 0; j < l; j++) h = (h << 2) + r[s[j]];
		h += (1 << (2 * l));
		if(com[0] == 'i') used[h] = true;
		else puts(used[h] ? "yes" : "no");
	}
}

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

int main() {
	long long a, b;
	while ( cin >> a >> b ) {
		int ans = max( a, b );
		
		if ( a > b ) a-- ;
		else b-- ;
		
		ans += max( a, b );
		
		if ( a > b ) a-- ;
		else b-- ;
		
		cout << ans << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>

struct Node
{
	int key; // データ本体
	Node *next, *prev; // 前の要素と次の要素へのポインタ
};

Node *nil; // リストの先頭となる特別なノード（番兵）

void init()
{
	// mallocで動的にメモリ確保
	// 返り値は確保したメモリブロックを指すポインタ
	// 適切な値にキャストしてあげる
	// http://www9.plala.or.jp/sgwr-t/lib/malloc.html
	// https://bi.biopapyrus.jp/cpp/syntax/malloc.html
	nil = (Node *)malloc(sizeof(Node));
	nil->next = nil; // 自分自身
	nil->prev = nil; // 自分自身
}

Node* listSearch(int key)
{
	// 先頭のノード（番兵の次）から順番に探してゆく
	Node *cur = nil->next;
	// 一周する（nilまで戻ってくる）か、キーが見つかるまでループ
	while( cur != nil && cur->key != key){
		cur = cur->next;
	}
	return cur;
}

void printList()
{
	Node *cur = nil->next;
	int isf = 0;
	while(1){
		if( cur == nil ) break;
		if( isf++ > 0 ) printf(" "); // 一番先頭にはこの出力はいらないのでif文
		printf("%d", cur->key);
		cur = cur->next;
	}
	printf("\n");
}

void deleteNode(Node *t)
{
	if ( t == nil ) return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t); // 動的に確保したメモリは開放する
}

void deleteFirst()
{
	deleteNode(nil->next);
}

void deleteLast()
{
	deleteNode(nil->prev);
}

void deleteKey(int key)
{
	deleteNode(listSearch(key));
}

/**
 * 先頭に要素を追加する
 */
void insert(int key)
{
	Node *x = (Node *)malloc(sizeof(Node));
	// 構造体のポインタ変数からメンバーにアクセスする時は ->（arrow）
	x->key = key; // まず挿入する値を割り当てて
	x->next = nil->next; // 番兵のnextを xの次の要素にして
	nil->next->prev = x; // 逆向きのポインタ
	nil->next = x; // 番兵の次のポインタをxにして
	x->prev = nil; // 逆向き
}

int main()
{
	int key, n, i;
	// int size = 0;
	char com[20];
	// int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for (i = 0; i < n; i++)
	{
		scanf("%s%d", com, &key);
		if( com[0] == 'i' ) {
			insert(key);
			// np++;
			// size++;
		}else if(com[0] == 'd'){
			if ( strlen(com) > 6 ) {
				if(com[6] == 'F'){
					deleteFirst();
				}else if(com[6] == 'L'){
					deleteLast();
				}
			} else {
				deleteKey(key);
				// nd++;
			}
			// size--;
		}
	}

	printList();
	return 0;
}


Measured memory_bytes: 33992
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n=int(input())
alist=[0]*101
for i in range(2,n+1):
  for j in factorization(i):
    alist[j[0]]+=j[1]
if n==1:
  print(0)
else:
  ans=0
  for i in range(1,100):
    if alist[i]>=74:
      ans+=1
    if alist[i]>=24:
      for j in range(1,100):
        if i!=j and alist[j]>=2:
          ans+=1
    if alist[i]>=14:
      for j in range(1,100):
        if i!=j and alist[j]>=4:
          ans+=1
    if alist[i]>=2:
      for j in range(1,100):
        for k in range(j+1,100):
          if i!=j and  k!=i and alist[j]>=4 and alist[k]>=4:
            ans+=1
  print(ans)

Measured memory_bytes: 9540
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    const int N = 3000;
    static ll opt[N+2][N+1][2];
    for(int i = n; i >= 1; i--) {
        for(int j = 1; j <= n; j++) {
            if(i <= j) {
                opt[i][j][0] = max(a[i] + opt[i + 1][j][1], a[j] + opt[i][j - 1][1]);
                opt[i][j][1] = min(opt[i + 1][j][0] - a[i], opt[i][j - 1][0] - a[j]);
            }
        }
    }
    cout << opt[1][n][0] << endl;
    return 0;
}


Measured memory_bytes: 139648
n, m = map(int, input().split())
a_list = []
b_list = ["f"] * (10**5+1)
count_ac = 0
count_wa = 0
for i in range(m):
    a,b = map(str, input().split())
    a_list.append((int(a),b))
for i in range(m):
    if a_list[i][1] == "WA" and b_list[a_list[i][0]] == "f":
        count_wa += 1
    if a_list[i][1] == "AC":
        if b_list[a_list[i][0]] == "f":
            count_ac += 1
        b_list[a_list[i][0]] = "t"
for i in range(m):
    if b_list[a_list[i][0]] == "f" and a_list[i][1] == "WA":
        count_wa -= 1
print(count_ac,count_wa)

Measured memory_bytes: 19672
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())

typedef long long ll;

int N, K;
set<int> S;
vector<int> P;
vector<int> V;
bool srt[200002];

int main(){
	cin >> N >> K;
	P.resize(N);
	int last = -1;
	int sortCnt = 0;
	for(int i=0; i<N; i++){
		cin >> P[i];
		if(P[i] > last){
			sortCnt++;
		}
		else
			sortCnt = 1;
		last = P[i];
		if(sortCnt >= K){
			V.push_back(i);
			srt[i] = true;
		}
	}
	int cnt = 1;
	for(int i=0; i<K; i++){
		S.insert(P[i]);
	}
	for(int i=K; i<N; i++){
		S.insert(P[i]);
		auto it = S.begin();
		if(*it != P[i-K]){
			cnt++;
		}
		else{
			it = S.end();
			it--;
			if(*it != P[i]){
				cnt++;
			}
			else if(srt[i] && srt[i-1])
				cnt++;
		}
		S.erase(P[i-K]);
	}
	ll s = sz(V);
	if(s > 0)
		cnt -= s-1;
	//cout << s << endl;
	cout << cnt << endl;

  return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a[10];
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

    sort(a, a + 5, [](int a, int b){
        a = a % 10;
        b = b % 10;
        if (a == 0)
            a = 10;
        if (b == 0)
            b = 10;

        return a < b;
    });
    
    int ans = 0;
    for (int i = 4; i >= 1; i--){
        ans += a[i];
        if (a[i] % 10 != 0)
            ans += 10 - (a[i] % 10);
    }
    
    cout << ans + a[0] << '\n';

    return 0;
}


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

using ll = long long int;

ll arr[100010] = {};

int main(void){
    
    int n,a,b;
    cin >> n >> a >> b;
    
    ll l = 1,r = 10000000010,ans = 10000000010;
    
    for(int i = 0; i < n ;i++){
        cin >> arr[i];
    }
    
    while(l < r){
        ll mid = (r+l)/2;
        
        ll res = mid;
        
        for(int i = 0; i < n; i++){
            ll t = arr[i] - mid*b;
            
            if(t > 0){
                res -= (t+(a-b)-1) / (a-b);
            }
            
        }
        
        //cout << mid << " " << l << " " << r << " res:" << res << endl;
        if(res < 0){
            l = mid + 1;
        }else if(res >= 0){
            r = mid;
        }
        
    }
    
    cout <<l<< endl;
    
}


Measured memory_bytes: 1024
h,w = map(int,input().split())
area = [input() for i in range(h)]

for i in range(h):
  for j in range(w):
    count = 0
    if area[i][j] == ".":
      for s in range(-1,2):
        for t in range(-1,2):
          if 0 <= i + s <h and 0 <= j+t < w:
            if area[i+s][j+t] == '#':
              count += 1
          else:
            continue
      print(count, end='')
    else:
      print("#", end='')
  print()







Measured memory_bytes: 3444
#include <cstdio>
#include <utility>
#include <string>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in(gcu());}
_sc(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
template <typename H,typename... T> _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
template <typename T>
_vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
//_vo(string &s){for (char c: s) pcu(c);}
template <typename H,typename... T> _vo(H&& h, T&&... t){out(h);out(move(t)...);}
//template <typename T> _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
_vl(){out('\n');}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

bool solve(string &s, char &r) {
	static auto check = [&](int a, int b,int c) {
		r = s[a];
		return r == s[b] && r == s[c] && r != 's';};
	for (int i = 0, j; i < 3; i++)
		if (check(i, i + 3, i + 6) || (j = i * 3, check(j, j + 1, j + 2)))
			return true;
	if (check(0, 4, 8) || check(2, 4, 6))
		return true;
	return false;
}

int main() {
	char r;
	for (string s; scan(s);)
		outl(solve(s, r) ? r : 'd');
}


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

int main(){
  int x,y,s,i,j;
  while(1){
  cin >> x >> y >>s;
  if(x==0 && y==0 && s==0)break;
  int total;
  int max=-1;
 
  int ans;
  for(i = 1; i < 1000; i++){
    for(j = 1; j < 1000; j++){
      total = i*(100+x)/100+j*(100+x)/100;
      if(total==s){
	ans = i*(100+y)/100+j*(100+y)/100;
	if(max<ans)max=ans;
      }
    }
  }
    cout << max << endl;
 
    
  }

  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)


int main() {
    ll n,m,d;
    cin >> n >> m >> d;
    double ans;
    if(d==0){
        ans = double(m-1)/n;
    }
    else{
        ans = double((n-d)*2*(m-1))/(n*n);
    }
    printf("%.10lf\n",ans);
    return 0;
}


Measured memory_bytes: 256
import sys

def resolve():
    N, K = list(map(int, input().split(" ")))
    A = list(map(int, input().split(" ")))
    res = 0
    covered = 0
    while True:
        if covered >= N:
            break
        if res == 0:
            covered = K
        else:
            covered += K - 1
        res += 1
    print(res)

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 51948
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int count[][][] = new int[5][4][11];

		// ?????????
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		}

		// ??????
		for (int i = 0; i < n; i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			count[b][f][r] += v;
		}

		// ??????
		for (int i = 1; i < 5; i++) {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		}

	}

}

Measured memory_bytes: 29260
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

int main(){
    string a, b;
    cin >> a >> b;
    int x = stoi(a+b);
    bool found(false);
    for(int i = 1; i < 1000; ++i) {
        if (i*i==x)
        {
            found = true;
            break;
        }    
    }
    if(found)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define all(a) begin(a), end(a)
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;

int main()
{   _
    lli n, w, u, v; cin >> n >> w;
    lli MXV = 1e5 + 5;
    lli INF = 1e18;
    vector<lli> dp(MXV, INF);
    dp[0] = 0;
    fore(t, 0, n) {
        cin >> u >> v;
        for(int i = MXV - 1; i >= 0; --i) {
            if(dp[i] != INF) dp[i + v] = min(dp[i + v], dp[i] + u);
        }
    }
    lli ans = 0;
    fore(i, 1, MXV) if(dp[i] <= w) ans = i;
    cout << ans << ENDL;
    return 0;
}


Measured memory_bytes: 3976
// JOI13-quest2.cpp : Defines the entry point for the console application.
//

#include <stdio.h>


int main(void)
{
	int n, m, compe[1000], border[1000];
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%d", &compe[i]);
	}
	for (int i = 0; i < m; i++) {
		scanf("%d", &border[i]);
	}

	int vote[1000] = { 0 };

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			if (border[i] >= compe[j]) {
				vote[j]++;
				break;
			}
		}
	}

	int max = 0, save;
	for (int i = 0; i < n; i++) {
		if (max < vote[i]) {
			max = vote[i];
			save = i;
		}
	}

	printf("%d\n", save + 1);

	return 0;
}

Measured memory_bytes: 1036
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#define _USE_MATH_DEFINES

#include<math.h>
#include<map>

#define SENTINEL 1000000001

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

struct OwnNode
{
	int key;
	OwnNode* parent;
	OwnNode* left;
	OwnNode* right;

	OwnNode(int key):key(key),parent(nullptr),left(nullptr),right(nullptr){}
};

void Insert(OwnNode* &top, OwnNode* &z)
{
	OwnNode* y = nullptr;
	OwnNode* x = top;

	while (x != nullptr)
	{
		y = x;
		if (z->key < x->key)
		{
			x = x->left;
		}
		else
		{
			x = x->right;
		}
	}

	z->parent = y;

	if (y == nullptr)
	{
		top = z;
	}
	else if (z->key < y->key)
	{
		y->left = z;
	}
	else
	{
		y->right = z;
	}
}

void PrintPre(OwnNode* top)
{
	printf(" %d", top->key);
	if (top->left != nullptr)
	{
		PrintPre(top->left);
	}
	if (top->right != nullptr)
	{
		PrintPre(top->right);
	}
}

void PrintIn(OwnNode* top)
{
	if (top->left != nullptr)
	{
		PrintIn(top->left);
	}
	printf(" %d", top->key);
	if (top->right != nullptr)
	{
		PrintIn(top->right);
	}
}

void Print(OwnNode* top)
{
	if (top == nullptr)
	{
		return;
	}
	PrintIn(top);
	printf("\n");
	PrintPre(top);
	printf("\n");
}

int main()
{
	OwnNode* T;
	OwnNode* z;
	T = nullptr;

	int m;
	cin >> m;

	for (int i = 0; i < m; i++)
	{
		/*char command[10];
		int key;

		scanf("%s %d", command, key);*/

		string command;

		cin >> command;

		if (command[0] == 'i')
		{
			int key;
			cin >> key;
			z = new OwnNode(key);
			Insert(T, z);
		}
		else
		{
			Print(T);
		}
	}

	return 0;
}


Measured memory_bytes: 26508
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0082
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] Rides = new int[] { 4, 1, 4, 1, 2, 1, 2, 1 };

            while (true)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line)) return;

                int[] items = Array.ConvertAll(line.Trim().Split(' '), e => int.Parse(e));

                int maxArr = -1;
                int maxCapa = -1;
                for (int i = 0 ; i < Rides.Length ; i++)
                {
                    int[] curRides = Rides.Select((x, index) => Rides[(index + i) % Rides.Length]).ToArray();
                    int tmpCapa = items.Select((x, index) => x < curRides[index] ? x : curRides[index]).Sum();

                    int Arr = int.Parse(string.Join("", curRides.Select(x => x.ToString())));
                    if (tmpCapa > maxCapa || tmpCapa == maxCapa && Arr < maxArr)
                    {
                        maxArr = Arr;
                        maxCapa = tmpCapa;
                    }
                }
                Console.WriteLine(string.Join(" ", maxArr.ToString().Select(x => x).ToArray()));
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 14268
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
using namespace std;
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};


int main(int argc, char const *argv[]) {
  string s;
  std::cin >> s;
  bool f=true;
  int n=s.size();
  string dream="dream",dreamer="dreamer",erase="erase",eraser="eraser";
  for(int i=n-1; i>=0;){
    if(i<=4) break;
    if(s[i]=='m'){
      string t=s.substr(i-4,5);
      //std::cout << t << '\n';
      if(t!=dream){
        f=false; break;
      }
      i-=5;
    }

    else if(s[i]=='e'){
      string t=s.substr(i-4,5);
      //std::cout << t << '\n';
      if(t!=erase){
        f=false; break;
      }
      i-=5;
    }

    else if(s[i]=='r'){
      if(s[i-2]=='m'){
        string t=s.substr(i-6,7);
        //std::cout << t << '\n';
        if(t!=dreamer){
          f=false; break;
        }
        i-=7;
      }
      else{
        string t=s.substr(i-5,6);
        //std::cout << t << '\n';
        if(t!=eraser){
          f=false; break;
        }
        i-=6;
      }
    }

    else{
      f=false; break;
    }

  }

  if(f)std::cout << "YES" << '\n';
  else std::cout << "NO" << '\n';
  return 0;
}


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

int main() {
    long long w, h, x, y;
    cin >> w >> h >> x >> y;

    auto area = (w * h) * 0.5;
    auto multiple = (2 * x == w && 2 * y == h);

    cout << area << " " << (multiple ? 1 : 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
    
int main() {
    string a,b;
    cin>>a>>b;
    int number = stoi(a+b);
    
    for (int i=0;i<318;i++) {
        if (number==i*i) {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	LL ans = 0;
	for(int i=0;i<N;++i){
		int L,R;
		cin >> L >> R;
		ans += R-L+1;
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 256
#![doc = " # Bundled libraries"]
#![doc = ""]
#![doc = " ## `kyopro_lib` (private)"]
#![doc = ""]
#![doc = " ### Modules"]
#![doc = ""]
#![doc = " - `::__kyopro_lib::fewnick_tree` → `$crate::fewnick_tree`"]
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
fn main() {
    input! { n : usize , q : usize , a : [i64 ; n] }
    let mut ft = FewnickTree::from_slice(&a);
    for _ in 0..q {
        input! { t : i32 }
        if t == 0 {
            input! { p : usize , x : i64 }
            ft.add(p, x);
        } else {
            input! { l : usize , r : usize }
            println!("{}", ft.sum_range(l..r));
        }
    }
}
use self::fewnick_tree::FewnickTree;
pub mod fewnick_tree {
    pub struct FewnickTree<T>(Vec<T>);
    impl<T: Clone + num::Num + std::ops::AddAssign> FewnickTree<T> {
        pub fn new(n: usize) -> Self {
            Self(vec![T::zero(); n + 1])
        }
        pub fn from_slice(dat: &[T]) -> Self {
            let mut v = vec![T::zero()];
            v.extend_from_slice(dat);
            for i in 1..dat.len() {
                let j = i + (i & i.wrapping_neg());
                if j < v.len() {
                    let x = v[i].clone();
                    v[j] += x;
                }
            }
            Self(v)
        }
        pub fn clear(&mut self) {
            for x in &mut self.0 {
                *x = T::zero();
            }
        }
        pub fn add(&mut self, mut i: usize, x: T) {
            i += 1;
            while i < self.0.len() {
                (self.0)[i] += x.clone();
                i += i & i.wrapping_neg();
            }
        }
        pub fn sum(&self, mut i: usize) -> T {
            let mut res = T::zero();
            while 0 < i {
                res += (self.0)[i].clone();
                i ^= i & i.wrapping_neg();
            }
            res
        }
    }
    impl<T: Clone + num::Num + std::ops::AddAssign + std::ops::Sub> FewnickTree<T> {
        pub fn sum_range(&self, r: std::ops::Range<usize>) -> T {
            self.sum(r.end) - self.sum(r.start)
        }
    }
}


Measured memory_bytes: 25368
#include <stdio.h>

int main(){
	int N,sum=0;
	scanf("%d",&N);
	int h[N],C[N],a[N];
	for(int i=0;i<N;i++){
		scanf("%d",&h[i]);
	}
	for(int i=0;i<N;i++){
		scanf("%d",&C[i]);
		a[i]=h[i]-C[i];
	}

	for(int i=0;i<N;i++){
		if(a[i]>0){
			sum+=a[i];
		}
	}
printf("%d\n",sum);
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <set>
#include <map>

#define MAX 100

int main(int argc, char** argv) {
    char tmp[100];
    scanf("%100s", tmp);
    std::string s(tmp);

    // for (int i = 0; tmp[i] != '0'; ++i) {
    //     char c = tmp[i];
    //     std::cout << tmp[i] << std::endl;
    // }
    // std::cout << s << std::endl;
    // std::cout << s.size() << std::endl;
    std::map<char, int> diffMap;
    std::map<char, int> posMap;
    int size = s.size();
    for(int i = 0; i < size; ++i) {
        char c = s[i];
        // std::cout << c << std::endl;
        if (posMap.find(c) == posMap.end()) {
            diffMap[c] = i;
        } else {
            int nextDiff = (i - posMap[c]) - 1;
            if (nextDiff > diffMap[c]) {
                diffMap[c] = nextDiff;
            }
        }
        posMap[c] = i;

        // debug
        // if (c == 'a') {
        //     std::cout << i << std::endl;
        //     std::cout << c << std::endl;
        // }
    }

    for(auto& e : posMap) {
        int nextDiff = (size - 1) - e.second;
        if (nextDiff > diffMap[e.first]) {
            diffMap[e.first] = nextDiff;
        }
    }

    // For print
    // for(auto& e : diffMap) {
    //     std::cout << e.first << std::endl;
    //     std::cout << e.second << std::endl;
    // }

    int result = MAX;
    for(auto& e : diffMap) {
        if (e.second < result) {
            result = e.second;
        }
    }

    std::cout << result << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
main(){
	long k,q,n,x,m,a;cin>>k>>q;
  	int d[k];
	r(i,k)cin>>d[i];
	r(i,q){
		cin>>n>>x>>m;a=x%m;
		r(j,k)a+=((d[j]+m-1)%m+1)*((n-2+k-j)/k);
		cout<<n-1-a/m<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
using ll = long long;
template<typename T>
using vec = vector<T>;
using P = pair<ll, ll>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[51][52];

signed main(){
	IOS;
	int n;
	cin >> n;
	if(n == 3 || n == 5 || n == 7)dump("YES");
	else dump("NO");	
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main()
    {
        string[] a = Console.ReadLine().Split(' ');
        int[] person = new int[int.Parse(a[0])];
        string[] ret = new string[int.Parse(a[0])];

        for (int i = 0; i < int.Parse(a[2]); i++)
        {
            person[int.Parse(Console.ReadLine()) - 1] ++;
        }

        for (int i = 0; i < int.Parse(a[0]); i++)
        {
            if ((int.Parse(a[1]) + person[i] - int.Parse(a[2])) > 0)
            {
                ret[i] = "Yes";
            }
            else
            {
                ret[i] = "No";
            }

        }
        foreach (var item in ret)
        {
            Console.WriteLine(item);
        }
    }
}


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

int main() {
 int n;
 cin >> n;
 int k = n / 100;
 int l = (n / 10) - 7;
 int m = n - 7;
 if(k == 7 || l % 10 == 0 || m % 10 == 0){
     cout << "Yes" << endl;
 }
 else cout << "No" << endl;
 }

  

  
 

  


  

  


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

typedef long long LL;
const int mod = 998244353;
#define MAXN 300010
LL fac[MAXN], fac_inv[MAXN];

LL C(int n, int m)
{
	if (m == 0) return 1;
	if (n < m) return 0;
	LL res = fac[n] * fac_inv[m] % mod * fac_inv[n - m] % mod;
	return res;
}

LL power(LL x, LL p)
{
	LL res = 1;
	for (; p; p >>= 1)
	{
		if (p & 1) res = res * x % mod;
		x = x * x % mod;
	}
	return res;
}

int main()
{
	fac[0] = fac_inv[0] = 1;
	for (int i = 1; i < MAXN; ++i)
	{
		fac[i] = fac[i - 1] * i % mod;
		fac_inv[i] = power(fac[i], mod - 2);
	}
	int n;
	LL a, b, K, ans = 0;
	cin >> n >> a >> b >> K;
	for (int i = 0; i <= n; ++i)
	{
		if (a * i > K || (K - a * i) % b) continue;
		LL j = (K - a * i) / b;
		if (j > n) continue;
		//cout << i << " " << j << endl;
 		ans += C(n, i) * C(n, j) % mod;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4992
package main

import (
	"fmt"
	"math"
)

var N, M int

func main() {
	fmt.Scan(&N, &M)
	//reader := bufio.NewReaderSize(os.Stdin, 1000000)
	xxx := make([]LR, M)

	for i := 0; i < M; i++ {
		fmt.Scan(&xxx[i].L, &xxx[i].R)
	}
	L_max := 0
	R_min := 999999999

	for i := 0; i < M; i++ {
		L_max = max(L_max, xxx[i].L)
		R_min = min(R_min, xxx[i].R)
	}
	fmt.Println(max(R_min-L_max+1, 0))
}

/*  ----------------------------------------  */

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type LR struct {
	L int
	R int
}

// type LR []int

// func (a SortBy) Len() int           { return len(a) }
// func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
// func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }


Measured memory_bytes: 4992
fun main(args : Array<String>) {
    val (a, b, x) = readLine()!!.split(" ").map(String::toDouble)

    if (x > a * a * b / 2) {
        val tmp = 2 * x / (a * a) - b
        val atan = Math.atan2(b - tmp, a)
        val ans = Math.toDegrees(atan)
        println(ans)
    } else {
        val tmp = 2 * x / (a * b)
        val atan = Math.atan2(b, tmp)
        val ans = Math.toDegrees(atan)
        println(ans)
    }
}


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

using i64 = std::int_fast64_t;

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

signed main() {
  i64 N, M;
  scanf("%lld %lld", &N, &M);
  vector<i64> A(N);
  REP(i, N) scanf("%lld", &A[i]);
  sort(ALL(A));
  vector<i64> S(N + 1);
  REP(i, N) S[i + 1] = S[i] + A[i];
  i64 h_ng = 0;
  i64 h_ok = A[N - 1] * 2 + 1;
  i64 h = h_ok;
  i64 ans = 0;
  while (h_ok > h_ng + 1) {
    h = h_ng + h_ok >> 1;
    i64 s = 0;
    i64 q = 0;
    i64 gt = 0;
    RREP(i, N) {
      while (gt < N && !(A[i] + A[gt] > h)) gt++;
      q += N - gt;
      s += S[N] - S[gt] + A[i] * (N - gt);
    }
    if (q <= M) {
      h_ok = h;
      ans = s + (M - q) * h;
    } else {
      h_ng = h;
    }
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <sstream>
#include <map>

using namespace std;

typedef vector<string> vs;

pair<int,vs> solve(int t, int n){
    stringstream ss;
    ss << n;
    string s = ss.str();
    int l=s.size();
    map<int,vector<vs>> ans;

    if(n <= t)ans[n] = {{s}};
    for(int mask=1;mask<1<<(l-1);mask++){
        vs v = {""};
        v[0] += s[0];
        for(int i=0;i<l-1;i++){
            if(mask>>i & 1) v.push_back("");
            v.back() += s[i+1];
        }
        int sum=0;
        for(int i=0;i<v.size();i++){
            sum += atoi(v[i].c_str());
        }
        if(sum <= t){
            ans[sum].push_back(v);
        }
    }


    if(ans.size()==0) return make_pair(-1,vs{"error"});
    if(ans.rbegin()->second.size()>1) return make_pair(-1,vs{"rejected"});
    return make_pair(ans.rbegin()->first,*ans.rbegin()->second.begin());
}

int main(){
    int t,n;
    while(cin>>t>>n && t){
        auto a = solve(t,n);
        if(a.first!=-1){
            cout << a.first << " ";
            for(int i=0;i<(int)a.second.size();i++){
                cout << a.second[i] << (i+1==a.second.size() ? "\n" : " ");
            }
        }else{
            cout << a.second[0] << endl;
        }
    }
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

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

    ll ans = 0;
    REP(i, N-2) {
        if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C')
            ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int arr[N] = {};
int cnt[N] = {};
int main() {
    int n;
    long long ans = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> arr[i];
        if (i - arr[i] > 0)
            ans += cnt[i - arr[i]];
        if (arr[i] + i < N)
            cnt[arr[i] + i]++;
    }
    cout << ans << '\n';
    return 0;
}

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

const int N = (int)2e5;

int dat[N+5];
map< int, vector<int> > q;

int main() {
    int n,k; scanf("%d %d", &n, &k);

    for (int i=1; i<=n; i++) {
        scanf("%d", dat+i);
        dat[i] = (dat[i] - 1) % k;
    }

    int summ = 0;
    for (int i=1; i<=n; i++) {
        summ = (summ + dat[i]) % k;
        if (q.find(summ) == q.end()) q[summ] = vector<int>();
        q[summ].push_back(i);
    }

    int pos = 0;
    long long res = 0;
    for (int i=1; i<=n; i++) {
        if (q.find(pos) != q.end()) {
            res += (long long)(
                lower_bound(q[pos].begin(), q[pos].end(), i+k-1)
                - lower_bound(q[pos].begin(), q[pos].end(), i)
            );
        }
        pos = (pos + dat[i]) % k;
    }

    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 22912
#include <bits/stdc++.h>
using namespace std;
#define rep(i,i1,n) for(int i=(int)(i1);i<(int)(n);i++)
#define ll long long
#define vi vector<int>
#define vll vector<long long>
using graph = vector<vector<int>>;

vector<pair<ll, ll> > pfac(ll N) {
    vector<pair<ll, ll> > res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;

        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        res.push_back({a, ex});
    }

    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
  ll n;
  cin>>n;
  
  ll count=1;
  ll cou=1;
  
  rep(c,1,n){
    int d=n-c;
    vector<pair<ll,ll>> vecl=pfac(d);
    cou=1;
    rep(i,0,vecl.size()){
      cou*=vecl.at(i).second+1;
    }
    count+=cou;
  }
  cout<<count-1;
}

Measured memory_bytes: 3616
def is_even_str(s):
    if len(s)%2 == 0 and s[:len(s)//2] == s[len(s)//2:]:
        return True
    else:
        return False

if __name__ == '__main__':
    S = input()
    S = S[:len(S)-1]
    while not is_even_str(S):
        S = S[:len(S)-1]
    print(len(S))


Measured memory_bytes: 2940
#include <iostream>
#include<stdio.h>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<string.h>
#include<cmath>
#define maxn 1000010
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;

ll h[maxn];
ll dp[maxn];
ll n,k;

int main()
{
    memset(h,0,sizeof h);
    scanf("%lld%lld",&n,&k);

    for(int i=1;i<=n;i++)
    {
        dp[i]=inf;
        scanf("%lld",&h[i]);
    }
    dp[1]=0;
    dp[0]=0;
    dp[2]=abs(h[2]-h[1]);
    for(int i=2;i<=n;i++)
    {
        for(int j=i-1;j>=max(i-k,1ll);j--)
            dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
    }
    printf("%lld\n",dp[n]);
    return 0;
}


Measured memory_bytes: 10496
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_20190707_1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] A = Console.ReadLine().Split(' ');

            if(int.Parse(A[0]) + int.Parse(A[1]) + int.Parse(A[2]) > 21)
            {
                Console.Write("bust");
            }
            else
            {
                Console.Write("win");
            }
               
        }
    }
}


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

int main() {
  int a, b;
  string s;
  cin >> a >> b >> s;
  if (s.at(a) != '-') {
    cout << "No" << endl;
    return 0;
  }
  s.at(a) = '0';
  int i;
  for (i = 0; i < a + b + 1; i++) {
    if (!('0' <= s.at(i) && s.at(i) <= '9')) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int N,A,i;
    int sum,flag = 0;
    scanf("%d%d",&N,&A);

    for(i=0;i<=20;i++){
        sum = 500*i;
        if(N <= sum + A && N >= sum){
            flag = 1;
        }
    }
    if(flag == 1){
        printf("Yes\n");
    }else{
    printf("No\n");
    }
    return 0;

}

Measured memory_bytes: 128
n, m, x, y = map(int, input().split())
xarray = sorted([int(x) for x in input().split()])
yarray = sorted([int(x) for x in input().split()])

res = "War"
if xarray[-1] > yarray[0]:
    res = "War"
else:
    for i in range(xarray[-1], yarray[0]+1):
        if x < i <= y and xarray[-1] < i <= yarray[0]:
            res = "No War"
            break
print(res)


Measured memory_bytes: 3064
N=int(input())
M=N+1
A=[int(M) for M in input().split()]
B=[int(N) for N in input().split()]
num=0
for i in range(N,1,-1):
     if B[i-1]>=A[i]:
          num+=A[i]
          a=A[i-1]
          A[i-1]-=B[i-1]-A[i]
          if A[i-1]<0:
               A[i-1]=0
               num+=a
          else:
               num+=B[i-1]-A[i]
     else:
          num+=B[i-1]
if B[0]>A[0]+A[1]:
     num+=A[0]+A[1]
else:
     num+=B[0]
print(num)


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n, m; cin >> n >> m;
    vector<vector<int>> g(n);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b; a--, b--;
        g[a].push_back(b), g[b].push_back(a);
    }

    vector<int> d(n, -1);
    queue<int> q;
    q.push(0); d[0] = 0;
    while (!q.empty()) {
        int v = q.front(); q.pop();
        if (v == n - 1) break;
        for (auto &nxt: g[v]) {
            if (d[nxt] >= 0) continue;
            d[nxt] = d[v] + 1;
            q.push(nxt);
        }
    }
    cout << ((d[n - 1] == 2) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}

Measured memory_bytes: 13168
#include <iostream>

using namespace std;

int len, l;
string str, in;

bool check(int i, int j){
  for(int k = 0 ; k < l ; k++){
    if(i+j*k >= len) return false;
    if(str[k] != in[i+j*k]) return false;
  }
  return true;
}

int main(){
  int N, ans = 0;

  cin >> N >> str; l = str.size();
  for(int i = 0 ; i < N ; i++){
    cin >> in;
    len = in.size();
    for(int i = 0 ; i < len ; i++){
      for(int j = 1 ; j < len ; j++){
        if(check(i,j)){
          ++ans;
          goto next;
        }
      }
    }
  next:;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'

int main(int argc, char const *argv[]) {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    long long n,m;
    cin>>n>>m;
    long long sum=0;
    vector<long long>v(n);
    for(int i=0;i<n;i++) {
        cin>>v[i];
        sum+=v[i];
    }
    long long cnt=0;
    int temp=4*m;
    long long x=(sum+temp-1)/temp;
    for(int i=0;i<n;i++) {
        if(v[i]>=x) {
            cnt++;
        }
    }
    if(cnt>=m) {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll inf = 1e18;
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int s , d , t;
    cin >> d >> t >> s;
    if(t * s < d)
        cout<<"No\n";
    else
        cout<<"Yes\n";
}


Measured memory_bytes: 3656
#include <iostream>
#include <cstring>
#include <unordered_set>

using namespace std;
using LL = long long;

LL gcd(LL a, LL b) {
    return b == 0 ? a : gcd(b, a % b);
}

LL lcm(LL a, LL b) {
    return a / gcd(a, b) * b;
}

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

    LL dp[1 << N];
    memset(dp, 0, sizeof(dp));
    dp[0] = 1;

    unordered_set<LL> ans;
    int p;
    for (int i = 0; i < N; i++) {
        cin >> p;
        for (int j = 0; j < 1 << N; j++) {
            if (dp[j]) {
                dp[j | 1 << i] = lcm(dp[j], p);
                ans.insert(dp[j | 1 << i]);
            }
        }
    }

    cout << ans.size() << endl;
}


Measured memory_bytes: 11928