akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
#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;
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef float f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
const int mod=998244353;
//const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
const int N=1005;
int dist[1005];
void solve() {
	int n,m;
	cin>>n>>m;
	vector<pair<pii,int>> edges;
	fr(i,1,m) {
		int u,v,w;
		cin>>u>>v>>w;
		edges.pb({{u,v},-w});
	}
	memset(dist,0x3f,sizeof(dist));
	dist[1]=0;
	bool relax=1;
	for(int i=1; i<=n+1&&relax; i++) {
		relax=0;
		for(auto j:edges) {
			if(dist[j.fi.se]>dist[j.fi.fi]+j.se) {
				dist[j.fi.se]=dist[j.fi.fi]+j.se;
				relax=1;
			}
		}
	}
	int distor=dist[n];
	for(int i=1; i<=n+1&&relax; i++) {
		relax=0;
		for(auto j:edges) {
			if(dist[j.fi.se]>dist[j.fi.fi]+j.se) {
				dist[j.fi.se]=dist[j.fi.fi]+j.se;
				relax=1;
			}
		}
	}
	if(relax&&distor!=dist[n]) {
		cout<<"inf"<<endl;
	} else
		cout<<-dist[n]<<endl;
}

signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


Measured memory_bytes: 384
# https://atcoder.jp/contests/abc048/tasks/arc064_a
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n, x = map(int, input().split())
    al = list(map(int, input().split()))
    ans = 0
    for i in range(n-1):
        if al[i] + al[i+1] > x:
            dec = (al[i] + al[i+1]) - x
            ans += dec
            al[i+1] = max(0, al[i+1] - dec)

    # print(al)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 63984
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, double> pdd;
const double eps = 1e-10;
const double pi = acos(-1);
inline int sgn(double d){if(fabs(d) < eps) return 0;if(d > 0) return 1;return -1;}
inline double rad(double _deg){return _deg / 180.0 * pi;}
inline double deg(double _rad){return _rad / pi * 180.0;}
struct Point{
	double x, y;
	void read(){scanf("%lf%lf", &x, &y);}
	Point():x(0.0), y(0.0){}
	Point(double a, double b = 0.0): x(a), y(b){}
	Point(const Point& p): x(p.x), y(p.y){}
	Point operator + (const Point& a){return {x + a.x, y + a.y};}
	Point operator - (const Point& a){return {x - a.x, y - a.y};}
	double operator * (const Point& a){return x * a.x + y * a.y;}
	double operator ^ (const Point& a){return x * a.y - y * a.x;}
	bool operator == (const Point& p){return sgn(x - p.x) == 0 && sgn(y - p.y) == 0;}
	bool operator < (const Point &p) const{
		if(sgn(x - p.x) == 0) 
			return sgn(y - p.y) == -1;
		return sgn(x - p.x) == -1;
	}
	double length(){return sqrt(x * x + y * y);}
}typedef Vector;
struct Line{
	Point a, b;
	void read(){a.read(); b.read();}
	Line() : a(0.0, 0.0) , b(0.0, 0.0){}
};
struct Segment{
	Point a, b;
	void read(){a.read(); b.read();}
	Segment() : a(0.0, 0.0) , b(0.0, 0.0){}
};
double Distance(const Point &a, const Point &b) 
{
	double x = a.x - b.x;
	double y = a.y - b.y;
	return sqrt(x * x + y * y);
}
Point Projection(Point p, Line l)
{ 
	// 点在直线上的投影点
	Vector v1 = l.b - l.a;
	Vector v2 = p - l.a;
	double k1 = v1 * v2;
	double k2 = v1.length();
	k1 /= k2 * k2;
	return {l.a.x + v1.x * k1, l.a.y+ v1.y * k1};
}
Point Reflection(Point p, Line l)
{
	// 点关于直线对称
	Point p0 = Projection(p, l);
	Vector v0 = p0 - p;
	return p0 + v0;
}
int ccw(Point p, Segment sg)
{	// Counter_Clockwise
	// p 关于(sg.a -> sg.b)的位置关系
	Vector v0 = sg.b - sg.a;
	Vector v1 = p - sg.a;
	
	int fcross = sgn(v0 ^ v1);
	
	if(fcross == 1) return 1; // 逆时针方向
	if(fcross == -1) return -1; // 顺时针方向
	
	int fdot = sgn(v0 * v1);
	
	if(fdot == -1) return 2; // 反向线段外共线
	if(v0.length() < v1.length()) return -2; //正向线段外共线
	return 0; //点在线段上
}
bool isParallel(Line l1, Line l2)
{
	//没有判断重合
	return sgn((l1.b - l1.a) ^ (l2.b - l2.a)) == 0;
}
bool isOrthogonal(Line l1, Line l2)
{
	return sgn((l1.b - l1.a) * (l2.b - l2.a)) == 0;
}
bool isIntersection(Segment sg1, Segment sg2)
{
	return ccw(sg2.a, sg1) * ccw(sg2.b, sg1) <= 0 && ccw(sg1.a, sg2) * ccw(sg1.b, sg2) <= 0;
}
int main()
{
	int n;
	scanf("%d", &n);
	while(n --)
	{
		Segment sg1, sg2;
		sg1.read(); sg2.read();
		bool ans = isIntersection(sg1, sg2);
		printf("%d\n", ans);
	}
	return 0;
}


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

int main()
{
    int t;
    cin >> t;
    int a = t/1000;
    int b = t/100 - a*10;
    int c = t/10 - a*100 - b*10;
    int d = t%10;
    
    char op[3] = {};
    for(int i=0; i<2; i++){
        for(int j=0; j<2; j++){
            for(int k=0; k<2; k++){
                int ans = a;
                ans += i==0? b: -b;
                ans += j==0? c: -c;
                ans += k==0? d: -d;
                if(ans == 7){
                    op[0] = i==0? '+': '-';
                    op[1] = j==0? '+': '-';
                    op[2] = k==0? '+': '-';
                }
                
            }
        }
    }
    cout << a << op[0] << b << op[1] << c << op[2] << d << "=7"<< endl;
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = INF;
	string	s , t;
	cin >> s >> t;
	
	a = s.size();
	b = t.size();

	for(i=0;i<=a-b;i++) {
		x = 0;
		for(j=0;j<b;j++) {
			if (s[i+j]!=t[j]) x++;
		}
		//printf("x:%d\n",x);
		ans = min(ans,x);
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  Int n;
  cin>>n;
  map<Int,int> m;
  for(Int i=0;i<n;i++){
    Int x;
    cin>>x;
    m[x]++;
  }
  Int ans=0;
  for(auto p:m){
    if(p.first>p.second) ans+=p.second;
    else ans+=p.second-p.first;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6272
//Author rahuliitkgp

/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void cpp(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int main(){
    cpp();
    ll n;
    cin>>n;
    vector<ll> v(n);
    for(auto& ele: v) cin>>ele;
    sort(v.begin(), v.end(), greater<ll>());
    ll ans = v[0];
    ll cnt = 1;
    for(ll i=2; i<=n-1; i++){
        ans+=(v[cnt]);
        if(i&1) cnt++;
    }
    cout<<ans<<endl;
    return 0;
}









Measured memory_bytes: 4732
#include<stdio.h>
int main(void)
{
    int S;
    int s;
    int m;
    int h;
    scanf("%d",&S);
    h = S/3600;
    m = S/60-h*60;
    s = S-m*60-h*3600;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}



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

string s;
string k = "keyence";

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> s;
	if(s == k){
		cout << "YES\n";
		return 0;
	}
	for(int i=0; i<s.size(); ++i){
		for(int j=i; j<s.size(); ++j){
			if(s.substr(0, i) + s.substr(j+1, s.size()-j-1) == k){
				cout << "YES\n";
				return 0;
			}
		}
	}
	cout << "NO\n";
}

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

int w, h, xs, ys, xg, yg, n, sc;
int map[101][101];
int dx[] = {1, 0, -1, 0},	dy[] = {0, 1, 0, -1};
int hx[] = {0, 1, 2, 3, 0, 1, 2 ,3}, hy[] = {0, 0, 0, 0, 1, 1, 1, 1};
int vx[] = {0, 0, 0, 0, 1, 1, 1, 1}, vy[] = {0, 1, 2, 3, 0, 1, 2, 3};
bool flag = false;

void dfs(int x, int y){
	if(x == xg && y == yg){
		flag = true;
		return;
	}
	map[y][x] = 9;
	for(int i = 0; i < 4; i++){
		int nx = x + dx[i], ny = y + dy[i];
		if(1 <= nx && nx <= w && 1 <= ny && ny <= h && map[ny][nx] == sc)	dfs(nx, ny);
	}
	return;
}

int main(void){
	while(true){
		int c, d, x, y;
		flag = false;
		cin >> w >> h;
		if(w == 0 && h == 0)	break;
		cin >> xs >> ys >> xg >> yg >> n;
		for(int i = 0; i < n; i++){
			cin >> c >> d >> x >> y;
			if(d == 0){
				for(int j = 0; j < 8; j++)	map[y+hy[j]][x+hx[j]] = c;
			}else{
				for(int j = 0; j < 8; j++)	map[y+vy[j]][x+vx[j]] = c;
			}
		}
		sc = map[ys][xs];
		dfs(xs, ys);
		if(flag)	cout << "OK" << endl;
		else cout << "NG" << endl;
	}
  return 0;
}

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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	string s;
	cin >> s;

	for(int mask = 0; mask < 1 << 3; mask++) {
		int tmp = s[0] - '0';
		string rsl = "";
		rsl += s[0];
		rep(i, 0, 3) {
			if(mask & 1 << i) {
				tmp += (s[i + 1] - '0');
				rsl += '+';
				rsl += s[i + 1];
			} else {
				tmp -= (s[i + 1] - '0');
				rsl += '-';
				rsl += s[i + 1];
			}
		}
		if(tmp == 7) {
			rsl += "=7";
			cout << rsl << endl;
			return 0;
		}
	}


}


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

long x[int(1e6)];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    long l, r;
    long ans = long(1e11);
    cin >> N >> K;
    if(K == 0){
        cout << "0\n";
        return 0;
    }
    for(int n=0; n<N; n++)cin >> x[n];
    for(int n=0; n<N-K+1; n++){
        l = x[n];
        r = x[n+K-1];
        if(r < 0)ans = min(abs(l), ans);
        else if(l < 0)ans = min(ans, min(2 * abs(l) + r, abs(l) + 2 * r));
        else ans = min(ans, r);
    }
    cout << ans << "\n";
    return 0;
}

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

using namespace std;
typedef long long ll;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int gcd(int a, int b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
 
vector<int> divisors(int n) {
  vector<int> res;
  for(int i = 1; i*i <= n; ++i) {
    if(n % i == 0) {
      res.push_back(i);
      if (i * i != n) {
        res.push_back(n/i);
      }
    }
  }
  return res;
}
 
int main() {
  int a, b, k;
  cin >> a >> b >> k;
  vector<int> vec = divisors(gcd(a, b));
  sort(vec.rbegin(), vec.rend());
  cout << vec[k - 1] << endl;
  return 0;
}

Measured memory_bytes: 256
//Code by Mukul Totla
#include<bits/stdc++.h>
using namespace std;
#define ll long long

void sublime(){ 
    #ifndef ONLINE_JUDGE 
    freopen ("input.txt", "r", stdin);
    freopen ("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
  cin.tie(NULL);
      }

ll dp[101][100001];

  ll knapsack(ll *value, ll *weight, ll n, ll capacity)
  {
  	 if(n==0 || capacity==0)
  	 	return 0;
  	 if(dp[n][capacity]!=-1)
  	 	return dp[n][capacity];

  	 if(capacity-weight[n]<0)
  	 	return dp[n][capacity]=knapsack(value, weight, n-1, capacity);
     
     ll a= value[n]+knapsack(value,weight,n-1,capacity-weight[n]);
     ll b=knapsack(value,weight,n-1,capacity);
     return dp[n][capacity]=max(a,b);

  }    
	
int main()
{   
	  //sublime();
	  ll n,i,capacity;
	   cin>>n>>capacity;
	   ll value[n+1],weight[n+1];
	   memset(dp,-1,sizeof(dp));

	   for(i=1; i<=n; i++)
	    cin >> weight[i] >> value[i];

	   ll ans=knapsack(value,weight,n,capacity);
	   cout<<ans;
	
	return 0;
}

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

class B
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var h = read();
		var b = read();
		var a = new int[h[0]].Select(_ => read()).ToArray();
		Console.WriteLine(Enumerable.Range(0, h[0]).Count(i => a[i].Select((x, j) => x * b[j]).Sum() + h[2] > 0));
	}
}


Measured memory_bytes: 13524
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < n; ++i)
#define FORR(i, m, n) for (ll i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
const int nmax=100005;
vector<vector<int>> e(nmax);
ll dp[nmax][2];
bool mem[nmax][2];
ll dfs(int cur,bool blk,int pre=-1){
    if(mem[cur][blk]){
        return dp[cur][blk];
    }
    ll res=1;
    for(int to:e[cur]){
        if(to==pre){
            continue;
        }
        if(blk){
            (res*=dfs(to,0,cur))%=mod;
        }
        else{
            (res*=(dfs(to,0,cur)+dfs(to,1,cur))%mod)%=mod;
        }
    }
    mem[cur][blk]=true;
    return dp[cur][blk]=res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    REP(i,n-1){
        int x,y;cin >> x >> y;
        x--,y--;
        e[x].push_back(y);
        e[y].push_back(x);
    }
    cout << (dfs(0,0)+dfs(0,1))%mod << endl;
}

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

#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
using namespace std;

#define sqr(a) ((a)*(a))
#define forn(i, n) for(int i = 0; i < (int)n; ++i)
#define rep(i, k, n) for(int i = (int)k; i <= (int)n; ++i)
#define nrof(i, n) for(int i = (int)n - 1; i >= 0; --i)
#define x first
#define y second
#define mp make_pair
#define sz(a) (int)(a.size())
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double dd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = 1e6 + 9;
const int M = 2e3 + 9;
const int INFINT = 1e9 + 9;
const ll INFLL = 1e18 + 9;
const ll MOD = (ll) (1000000007);


void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    forn(i, n) cin >> a[i];
    sort(all(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) {
                if ((a[i] + a[j] > a[k]) && (a[i] != a[j]) && (a[j] != a[k])) ++ans;
//                s.insert({a[i], {a[j], a[k]}});
            }
        }
    }
//    cout << sz(s) << endl;
    cout << ans << endl;
}

int main() {
    //  freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t;
    t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3660
def is_over_threshold_days(stay_days, threshold_days):

    if stay_days <= threshold_days:
        return False
    if stay_days > threshold_days:
        return True

def calc_accomodation_fee(stay_days, threshold_days, 
                                first_fee, second_fee):

    if is_over_threshold_days(stay_days, threshold_days):
        sum_of_first_fee = first_fee * threshold_days
        sum_of_second_fee = second_fee * (stay_days - threshold_days)
        return sum_of_first_fee + sum_of_second_fee
    else:
        return stay_days * first_fee

if __name__=='__main__':
    stay_days, threshold_days, first_fee, second_fee = [int(input()) for i in range(4)]
    print(calc_accomodation_fee(stay_days, threshold_days, first_fee, second_fee))


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

if(n <= 9):
    print(n)

elif(n <= 99):
    print(9)

elif(n <= 999):
    print(n - 90)

elif(n <= 9999):
    print(909)

elif(n <= 99999):
    print(n - 9090)

else:
    print(90909)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


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

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

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

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

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int n;
  cin >> n;
  const int mx = 1000005;
  vi a;
  vi na;
  vi hurui(mx,0);
  vi tyouhuku(mx,0);
  rep(i,n) {
    int t;
    cin >> t;
    tyouhuku.at(t)++;
  }
  rep(i,mx) {
    if(tyouhuku.at(i)) a.eb(i);
    if(tyouhuku.at(i)==1) na.eb(i);
  }


  rep(i,a.size()) {
    int ai = a.at(i);
    int tmp  = ai;
    while(ai<mx) {
      hurui[ai]++;
      ai+=tmp;
    }
  }
  int ans = 0;
  rep(i,na.size()) {
    if(hurui.at(na.at(i)) == 1) ans++;
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 12700
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        
        int now = 0;
        if (a < k) {
            now = now + a;
            k -= a;
        } else {
            now = now + k;
            System.out.println(now);
            return;
        }
        if (b < k) {
            k -= b;
        } else {
            System.out.println(now);
            return;
        }
        if (c < k) {
            now = now - c;
            k -= c;
        } else {
            now = now - k;
            System.out.println(now);
            return;
        }
    }
}


Measured memory_bytes: 35816
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int ans = 0;
    for (int i = 0; i < N; i++) {
      if (sc.nextInt() >= K) ans++;
    }
    System.out.println(ans);
  }
}


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

using namespace std;

priority_queue<int, vector<int>, less<int>> a, b, c, d;

int main() {
    int x, y, A, B, C;
    cin >> x >> y >> A >> B >> C;
    int t;
    for (int i = 1; i <= A; i++) {
        cin >> t;
        a.push(t);
    }
    for (int i = 1; i <= B; i++) {
        cin >> t;
        b.push(t);
    }
    for (int i = 1; i <= C; i++) {
        cin >> t;
        c.push(t);
    }
    for (int i = 1; i <= x; i++) {
        c.push(a.top());
        a.pop();
    }
    for (int i = 1; i <= y; i++) {
        c.push(b.top());
        b.pop();
    }
    long long ans = 0;

    for (int i = 1; i <= x + y; i++) {
        ans += (long long)c.top();
        c.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6056
/*
これを入れて実行
g++ code.cpp
./a.out
*/

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

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

ll nCr(ll n, ll r){
	if (r == 0 || r == n){
		return 1;
	}
	else if (r == 1){
		return n;
	}
	return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
	r = n - r;
	ll ret = 1;
	for (ll i = n; i >= r + 1; i--) ret *= i;
	return ret;
}

//-----------------------ここから-----------

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

	string s = to_string(n);

	if (s.size() == 1){
		std::cout << n << endl;
		return 0;
	}

	for (int i = 1; i < s.size(); i++){
		if (s[i] != '9'){
			std::cout << (s[0] - '0') + 9 * (s.size() - 1) - 1 << endl;
			return 0;
		}
	}
	std::cout << (s[0] - '0') + 9 * (s.size() - 1) << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 9e5 + 5, MOD = 1e9 + 7;
int fac[N], rev[N];
int mpow(int x, int n) {
	int res = 1;
	while (n) {
		if (n & 1) res = 1LL * res * x % MOD;
		x = 1LL * x * x % MOD;
		n >>= 1;
	}
	return res;
}
int C(int n, int m) {
	return 1LL * fac[n] * rev[m] % MOD * rev[n - m] % MOD;
}
int main() {
	fac[0] = rev[0] = 1;
	for (int i = 1; i < N; ++ i) {
		fac[i] = 1LL * fac[i - 1] * i % MOD;
		rev[i] = mpow(fac[i], MOD - 2);
	}
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	int ans = 0, l = 0, r = 0, sum = 1;
	for (int s = 0; s <= m + k; ++ s) {
		int res = 1LL * C(s + n - 1, s) * mpow(3, m + k - s) % MOD;
		int L = max(0, s - k), R = min(m, s);
		while (l > L) (sum += C(s, -- l)) %= MOD;
		while (r < R) (sum += C(s, ++ r)) %= MOD;
		while (l < L) (sum += MOD - C(s, l ++)) %= MOD;
		while (r > R) (sum += MOD - C(s, r --)) %= MOD;
		(ans += 1LL * res * sum % MOD) %= MOD;
		sum = (2LL * sum + MOD - C(s, l) + MOD - C(s, r)) % MOD;
		l ++;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 7296
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <vector>

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

using namespace std;

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

    vector<int> F(N);
    REP(i, N) {
        int key = 0;
        REP(j, 5) {
            REP(k, 2) {
                key <<= 1;
                int v;
                cin >> v;
                key += v;
            }
        }
        F[i] = key;
    }

    vector<vector<int>> P(N, vector<int>(11));

    REP(i, N)
    REP(j, 11)
    cin >> P[i][j];

    long long score_max = -1000000000;
    for (int i = 1; i < 1024; i++) {
        long long current = 0;
        REP(j, N) {
            int opens = i & F[j];
            bitset<sizeof(opens) * 8> values(opens);
            int k = 0;
            REP(l, sizeof(opens) * 8)
            if (values[l]) k++;
            current += P[j][k];
        }
        score_max = max(score_max, current);
    }

    cout << score_max << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>

#include <queue>
#include <cstdio>

#include <list>
#include <set>
#include <map>


#define PI (3.14159265358979323846)
#define INF (1e+9)
#define DIV_NUM (1000000007)

using namespace std;


bool seen[501][501];

int long long N, K;
int X, Y, Z;

int con;
//    string S;


char field[501][501];
int  dist[501][501];

typedef pair<int, int> P;
queue<P> que;


//typedef vector<vector<int>> v;
vector<double> ai;
vector<double> wi;


set<int> s1;
map<string, int> m1;
map<string, int> m2;

int weight[110], value[110];
int dp[110][10010];


int main(){
  
  
    //string ss ;


    cin >> N >> K ;

    int long long n1 = 0;
    int long long n2 = 0;

    n1 = N%K;
    n2 = min(n1, abs(n1 - K));


    std::cout << n2 << "\n";

        return 0;

}


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

#define INF 1e9
#define PI 3.141592653589793238
typedef long long ll;

int main() {
    string s,t;cin>>s>>t;
    int a,b;cin>>a>>b;
    string u;cin>>u;
    if(s==u) cout<<a-1<<" "<<b<<endl;
    else cout<<a<<" "<<b-1<<endl;

    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int n;
int maze[101][101];
int max_v = -1;
void dfs(int x, int y, int v){
    if(x == n and y == 2){
        max_v = max(max_v, v);
    }
    if(x > n) return;
    if(y > 2) return;
    dfs(x + 1, y, v + maze[y][x]);
    dfs(x, y + 1, v + maze[y][x]);
}

int main()
{
    cin >> n;
    for(int i=0; i < 2; i++){
        for(int j=0; j < n; j++) cin >> maze[i][j];
    }

    dfs(0, 0, 0);

    cout << max_v << endl;

    return 0;
}


Measured memory_bytes: 256
from math import ceil
from collections import deque

n, d, a = map(int, input().split())
m = sorted([list(map(int, input().split())) for _ in range(n)])
m = [[x, ceil(h / a)] for x, h in m]

acc_damage = 0
que = deque()
ans = 0
for x, h in m:
    while que and x > que[0][0]:
        limit, damage = que.popleft()
        acc_damage -= damage

    need = max(0, h - acc_damage)
    ans += need
    acc_damage += need

    if need:
        que.append([x + 2 * d, need])

print(ans)


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

using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    int rainy = 0, maxx = 0;
    string days;
    cin >> days;

    for (int i = 0; i < days.size(); i ++) {
        if (days[i] == 'R')
            rainy ++;

        if (rainy > maxx)
            maxx = rainy;
        if (days[i] == 'S')
            rainy = 0;
    }

    cout << maxx;

    return 0;
}

Measured memory_bytes: 3608
/*痛みを受け取れ，痛みを知れ*/
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 1e3 + 5;
bool vis[N][N];
int ans[N][N];
char s[N][N];
int dis[N][N];
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };
int n, m;
int sx, sy, ex, ey;
struct node
{
	int x, y, w;
	bool operator<(const node b)const
	{
		if (this->w == b.w)
		{
			if (this->x == b.x)return this->y < b.y;
			return this->x < b.x;
		}
		return this->w < b.w;
	}
};
void bfs()
{
	set<node> st;
	st.insert(node{ sx,sy,0 });
	while (!st.empty())
	{
		auto it = *st.begin();
		st.erase(st.begin());
		if (vis[it.x][it.y])continue;
		vis[it.x][it.y] = true;
		f(i, 0, 3)
		{
			int nx = it.x + dx[i], ny = it.y+dy[i];
			if (nx >= 1 && ny >= 1 && nx <= n && ny <= m&&s[nx][ny]=='.')
			{
				st.insert({ nx,ny,it.w });
				dis[nx][ny] = min(it.w,dis[nx][ny]);
			}
		}
		f(i, -2,2)
		{
			f(j, -2, 2)
			{
				int nx = it.x + i, ny = it.y + j;
				if (nx >= 1 && ny >= 1 && nx <= n && ny <= m&& s[nx][ny] == '.')
				{
					st.insert({ nx,ny,it.w+1 });
					dis[nx][ny] = min(it.w+1, dis[nx][ny]);
				}
			}
		}
	}
}
int main()
{
	//freopen("in.txt", "r", stdin);
	while (cin >> n >> m >> sx >> sy >> ex >> ey)
	{
		f(i, 1, n)scanf("%s", s[i] + 1);
		f(i, 1, n)f(j, 1, m)dis[i][j] = inf;
		bfs();
		if (dis[ex][ey] == inf)puts("-1");
		else printf("%d", dis[ex][ey]);
	}
	return 0;
}

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

int main(){
	int n;
	cin>>n;
	int num[4][3][10]={};
	for(int i=0;i<n;i++){
	int b,f,r,v;
	cin>>b>>f>>r>>v;
	num[b-1][f-1][r-1] +=v;
	}
	for(int i=0;i<4;i++){
	if(i) cout<<"####################"<<endl;
	for(int j=0;j<3;j++){
	for(int k=0;k<10;k++){
	cout<<" "<<num[i][j][k];
	}
	cout<<endl;
	}}
	return 0;

}


Measured memory_bytes: 3080
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() {
ll n,res=0,i;
cin>>n;
for(i=1;i<=1000000;i++)
{
	res=res*10+7;
	res=res%n;
//	cout<<res<<endl;
	if(res==0)
	break;
}
 
if(i==1000001)
cout<<"-1"<<endl;
else
cout<<i<<endl;
}

Measured memory_bytes: 3608
class UnionFindTrees:
    def __init__(self, n):
        self.parent = [-1] * n

    def find_root(self, x):
        p = self.parent
        while (0 <= p[x]):
            x, p[x] = p[x], p[p[x]]
        return x

    def unite(self, x, y):
        x_root = self.find_root(x)
        y_root = self.find_root(y)
        p = self.parent
        if (x_root == y_root):
            return
        if p[x_root] > p[y_root]:
            x_root, y_root = y_root, x_root
        # root の parent は -size になるようにする
        p[x_root], p[y_root] = (p[x_root] + p[y_root]), x_root

    def size(self, x):
        return -self.parent[self.find_root(x)]

    def is_same_set(self, x, y):
        return self.find_root(x) == self.find_root(y)


n, m, k = map(int, input().split())
ab = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]
cd = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(k)]
friend_trees = UnionFindTrees(n)
friend_or_block_cnts = [0] * n

for a, b in ab:
    friend_trees.unite(a, b)
    friend_or_block_cnts[a] += 1
    friend_or_block_cnts[b] += 1
for c, d in cd:
    if friend_trees.is_same_set(c, d):
        friend_or_block_cnts[c] += 1
        friend_or_block_cnts[d] += 1

print(*[(friend_trees.size(i) - friend_or_block_cnts[i] - 1) for i in range(n)])


Measured memory_bytes: 98776
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, m = sc.nextInt()
  val matrix = List.fill(n, m)(sc.nextInt())
  val vector = List.fill(m)(sc.nextInt())

  println(matrix.map(multiply(_, vector)).map(_.sum).mkString("\n"))

  def multiply(row: Seq[Int], vector: Seq[Int]): Seq[Int] = row.zip(vector).map(e => e._1 * e._2)
}

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

int ans[100];

void cal(ll a,ll b){
    printf("0.");
    for(int i=0;i<20;i++){
        a=a*10;
        printf("%lld",a/b);
        a%=b;
    }
    printf("\n");
}

void solve(){
    int n,k;
    cin>>n>>k;
    if(k==1){
        printf("1.000000000\n");
        return ;
    }
    ll ans=0;

    for(int i=1;i<=min(n,k-1);i++){
        int left=(k+i-1)/i;
        int cnt=0;
        while((1<<cnt)<left) cnt++;
        ans+=(1<<(20-cnt));
          //  cout<<left<<' '<<cnt<<endl;
    }
    if(k<=n) ans+=(1LL<<20)*(n-k+1);

    cal(ans,(1LL<<20)*n);
}

int main(){
    solve();
    return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

void YES(bool b) {cout << (b?"YES\n":"NO\n");}
void Yes(bool b) {cout << (b?"Yes\n":"No\n");}
void yes(bool b) {cout << (b?"yes\n":"no\n");}
void Yay(bool b) {cout << (b?"Yay!\n":":(\n");}

long long powmod(long long a,long long b){
    long long c=1;
    while(b>0){
        if(b&1) c=a*c%mod;
        a=a*a%mod;
        b>>=1;
    }
    return c;
}

ll d(ll n){
	ll cnt=0;
	while(n){
		cnt+=n%10;
		n/=10;
	}
	return cnt;
}

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n;
	cin >> n;
	Yes(n%d(n)==0);
	return 0;
}

Measured memory_bytes: 256
// Problem : B - An Odd Problem
// Contest : AtCoder - AIsing Programming Contest 2020
// URL : https://atcoder.jp/contests/aising2020/tasks/aising2020_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define ios std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mii map<int, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
using namespace std;
const long long MOD=LLONG_MAX; //1e5+7;
int gcd(int x, int y)
{
	if(y==0) return x;
	else return gcd(y,x%y);
}
int power(int x, unsigned int y)  
{  
    int res = 1;
    x = x % MOD;
    if (x == 0) return 0;
  
    while (y > 0)  
    { 
        if (y & 1)  
            res = (res*x) % MOD;
        y = y>>1;
        x = (x*x) % MOD;  
    }  
    return res;  
}
void solve()
{
	int n,m,b,c,d,ans=0;
	cin>>n;
	int a[n];
	rep(i,0,n){
		cin>>a[i];
		if((i+1)%2 && a[i]%2)ans++;
	}
	
	cout<<ans<<endl;
}

int32_t main()
{	
	ios;
	int t=1; 
	//cin>>t;
	while(t--) solve();
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { printf("ERROR%d!\n",num); }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};


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

    string S, T;
    cin >> S >> T;

    bool ok = 0;
    rep(i,S.length()){
        if(S[i]!=T[i]) ok = 1;
    }
    if(ok){
        cout << "No" << endl;
    }else{
         if(T.length()-S.length()==1){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

}

Measured memory_bytes: 3612
#include<cstdio>
#include<cstring>
int main(){
	char s[200001];
	int a,b;
	scanf("%s",s);
	int n = strlen(s);
	for(int i=0;i<n;i++){
		if(s[i]=='A'){
			a = i;
			break;
		}
	}
	for(int i=n-1;i>=0;i--){
		if(s[i]=='Z'){
			b = i;
			break;
		}
	}
	printf("%d\n",b-a+1);
}


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

int main(){
  int a,s;
  char c;

  cin >> s;
  for(;;){
    cin >> c;
    if(c == '=')break;
    cin >> a;
    if(c == '+'){
      s += a;
    }else if(c == '-'){
      s -= a;
    }else if(c == '*'){
      s *= a;
    }else{
      s /= a;
    }
  }
  cout << s << endl;
}

Measured memory_bytes: 1160
import math
from collections import Counter
N = int(input())
Nyakusu = []
Nruto = math.sqrt(N)
Nruto = math.ceil(Nruto)

for i in range(1, Nruto+1):
    if N % i == 0:
        Nyakusu.append(N//i-1)
        Nyakusu.append((N//(N//i))-1)
ans = 0
Nyakusu = Counter(Nyakusu)
for m in Nyakusu.keys():
    if m == 0:
        continue
    if N//m != N % m:
        continue
    ans += m
print(ans)

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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;
#define ret() return 0;

bool contain(set<char> &s, char a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

int main() {
    int r, g, b, n;
    cin >> r >> g >> b >> n;

    int ans = 0;
    for (int ri = 0; ri * r <= n; ri++) {
        for (int gi = 0; ri * r + gi * g <= n; gi++) {
            ll rg = ri * r + gi * g;
            ll nokori = n - rg;
            assert(nokori >= 0);
            if (nokori % b == 0) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
n = int(input())
w=list(map(int, input().split()))

s3=sum(w)
s1=[0]
s2=[0]

for i in range(n):
  s1.append(s1[-1]+w[i])
  s2.append(s3-s1[-1])

temp=s3
for i,j in zip(s1[1:],s2[1:]):
  temp = min(abs(i-j), temp)

print(temp)

Measured memory_bytes: 3064
s = input()

n = len(s)
t = s[:(n-1)//2]
u = s[(n+3)//2-1:]

def kaibun(string):
    l = len(string)
    for i in range(l//2):
        if string[i] != string[-(i+1)]:
            return False
    return True

if kaibun(s) and kaibun(t) and kaibun(u):
    print("Yes")
else:
    print("No")

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

#define pb push_back
typedef long long ll;
typedef vector<long long> vll;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;--i)


void solve(){
	ll a,b;
	cin>>a>>b;
	cout<<a*b;
}


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

	ll t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}



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

using namespace std;

const int maxn = 50 + 10;
long long int a[maxn];

int main()
{
    long long int n, k, e = 0, o = 0, jav = 0;
    cin >> n >> k;

    for (int i = 0; i < n; i ++)
    {
        cin >> a[i];
        if (a[i] % 2 == 0)
            e ++;
        else
            o ++;
    }

    /*jav *= (long long int) pow(2, e);
    jav *= (long long int) pow(2, o - 1);
    */

    if (e == 0 && k == 1)
    {
        jav = pow(2, (o - 1));
    }
    else if (o == 0 && k == 0)
    {
        jav = pow (2, e);
    }
    else if (o == 0 && k == 1)
    {
        jav = 0;
    }
    else if (k == 1 || k == 0)
    {
        jav = pow (2, e) * pow(2, (o - 1));
    }

    cout << jav;
    return 0;
}


Measured memory_bytes: 256
from sys import stdin, setrecursionlimit
from collections import defaultdict
from math import gcd

setrecursionlimit(10 ** 9)
INF = 1 << 60


def input():
    return stdin.readline().strip()


MOD = 1000000007
N, *AB = map(int, stdin.buffer.read().split())

d = defaultdict(int)
zeros = 0
for a, b in zip(*[iter(AB)] * 2):
    if a == 0 and b == 0:
        zeros += 1
    else:
        g = gcd(a, b)
        a //= g
        b //= g
        if a < 0:
            a *= -1
            b *= -1
        if a == 0 and b == -1:
            b = 1
        d[(a, b)] += 1

ans = 1
free = 0
for (a, b), n in d.items():
    if b > 0:
        if (b, -a) in d:
            m = d[(b, -a)]
            ans = ans * (pow(2, n, MOD) + pow(2, m, MOD) - 1) % MOD
        else:
            free += n
    else:
        if (-b, a) not in d:
            free += n

ans = (ans * pow(2, free, MOD) + zeros - 1) % MOD
print(ans)


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

int main() {
	// your code goes here
	long long a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	cout<<(a[0]*a[1])*abs((a[2]-((int)a[2]/2))-(int)a[2]/2);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    int N;
    cin >> N;
    vector<long> X(static_cast<unsigned long>(N)), Y(static_cast<unsigned long>(N));
    cin >> X[0] >> Y[0];
    bool check = ((X[0] + Y[0]) % 2 == 0);
    for (int i = 1; i < N; ++i) {
        cin >> X[i] >> Y[i];
        if (check != (((X[i]) + Y[i]) % 2 == 0)) {
            cout << -1 << endl;
            return 0;
        }
    }
    vector<long> d(34);
    int dLength = 33;
    if (!check) {
        cout << dLength << endl;
        for (int i = 0; i <= 32; ++i) {
            d[i] = static_cast<long>(pow(2, i));
            cout << d[i] << " ";
        }
    } else {
        dLength = 34;
        cout << dLength << endl;
        d[0] = 1;
        cout << 1 << " ";
        for (int i = 0; i <= 32; ++i) {
            d[i + 1] = static_cast<long>(pow(2, i));
            cout << d[i + 1] << " ";
        }
    }
    cout << endl;
    for (int i = 0; i < N; ++i) {
        string ans;
        for (int j = dLength - 1; j >= 0; --j) {
            long x = abs(X[i]), y = abs(Y[i]);
            if (x == max(x, y)) {
                if (X[i] < 0) {
                    ans += 'L';
                    X[i] += d[j];
                } else {
                    ans += 'R';
                    X[i] -= d[j];
                }
            } else {
                if (Y[i] < 0) {
                    ans += 'D';
                    Y[i] += d[j];
                } else {
                    ans += 'U';
                    Y[i] -= d[j];
                }
            }
        }
        reverse(ans.begin(), ans.end());
        cout << ans << endl;
    }
    return 0;
}


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

bool comp(int a, int b){
    return a>b;
}

int main(){

    int n,k;
    cin>>n>>k;
    int arr[n+1];
    for(int i =1;i<=n;i++){
        cin>>arr[i];
        arr[i]+=arr[i-1];
    }
    int ans = 0;
    for(int i =k;i<=n;i++){
        ans = max(ans , arr[i]-arr[i-k]);
    }
    cout<<setprecision(10)<<double(ans)/2 + k/2.0<<endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)
int main(){
    int n,k;
    cin >> n >> k;
    vector<ll> v(n);
    rep(i,n){
      ll t;
      cin >> t;
      t=0-t;
      v[i]= t; 
    }
    sort(v.begin(),v.end());
    ll ans=0LL;
    rep(i,n){
      if (k >= 1){
        k--;
        continue;
      }
      else ans+=(0-v[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
import math

graph = []
# input 
V, E, r = map(int, input().split())
# initialize
lens = [float('inf') for i in range(V)]
lens[r] = 0
# input
for i in range(E) :
    start, desti, distance = map(int, input().split())
    graph.append([start, desti, distance])
    
# judge 
while True :
    # set a flag
    flag = True
    for q in graph :
        # compare the distance 
        if lens[q[1]] > lens[q[0]] + q[2]:
          lens[q[1]] = min(lens[q[1]], lens[q[0]] + q[2])
          flag = False         
    if flag:
      break
# output results 
for item in lens :
    if math.isinf(item):
        print("INF")
    else :
        print(item)


Measured memory_bytes: 104856