akhauriyash/Code-Regression huggingface dataset:
/*
They turn the lights down low,
In shadows hiding from the world,
Only coming out when it gets cold

The seas part when they hit the floor,
The voices carry on and out the door
And everything you touch turns into gold

Like the angel you are you laugh creating
A lightness in my chest,
Your eyes they penetrate me,
(your answer's always 'maybe')
That's when I got up and left

A beating heart and a microphone,
A ticking clock in an empty home
Still tells of these times so long ago,

Even though I've come so far,
I know I've got so far to go
And any day now I'll explode

Like the angel you are you laugh creating
A lightness in my chest,
Your eyes they penetrate me,
(your answer's always 'maybe')
That's when I got up and left

And each and everyday will lead into tomorrow
Tomorrow brings one less day without you
But don't wait up just leave the light on
'Cause all the roads that I might take
Will all one day lead back to you

And like the angel you are you laugh creating
A lightness in my chest,
Your eyes they penetrate me,
(never cease to amaze me)
That's when I got up and left
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-12
#define M_PI 3.141592653589793
#define bsize 300

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 600031;

int n,s,mx;

int main(){
//    freopen("apache.in","r",stdin);
//    freopen("apache.out","w",stdout);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);

	cin>>n;
	for (int i=0;i<n;i++){
		int val;
		cin>>val;
		mx=max(mx,val);
		s+=val;
	}

	if (mx<(s-mx))
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;

//    cin.get(); cin.get();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,K;cin>>N>>K;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin>>A[i];
    
    for(int i=K;i<N;i++){
        if(A[i]>A[i-K]) cout<<"Yes\n";
        else cout<<"No\n";
    }
}





Measured memory_bytes: 3988
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;


int main(){
    string S;
    cin >> S;
    bool ok = true;
    vector<char> mozi(100);
    for(int i = 0;i<4;i++){
        mozi.at(S.at(i))++;
    }
    for(int j = 0;j<100;j++){
        if(mozi.at(j)==0 || mozi.at(j)==2){
        }
        else{
            ok = false;
        }
    }
    if(ok==false){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }

}

Measured memory_bytes: 256
import sys
readline=sys.stdin.readline
read=sys.stdin.read

n=int(readline())
m=map(int,read().split())
robots=list(zip(m,m))
lr=[[i-j,i+j] for i,j in robots]
lr.sort(key=lambda x:x[1])
prep=lr[0][1]
res=1
for l,r in lr[1:]:
  if l>=prep:
    res+=1
    prep=r
print(res)


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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int n = s.length();
    vector<char> v(26, '.'), v2(26, '.');
    for (int i = 0; i < n; i++) {
        if (v[s[i] - 'a'] == '.') {
            if (v2[t[i] - 'a'] != '.') {
                cout << "No" << endl;
                return 0;
            }
            v[s[i] - 'a'] = t[i];
            v2[t[i] - 'a'] = s[i];
        } else {
            if (v[s[i] - 'a'] != t[i]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 916
n = int(input())
a = list(map(int,input().split()))
q = int(input())

g = [0]*(10**5+1)
t = sum(a)
s = []

for aj in a:
    g[aj]+=1

for i in range(q):
    b,c = map(int,input().split())
    if g[b] != 0:
        t = t + c*g[b] - b*g[b]
        g[c] = g[c] + g[b]
        g[b] = 0
        s.append(t)
    else:
        s.append(t)

for m in range(q):
    print(s[m])


Measured memory_bytes: 20588
N = int(input())
A = list(map(int, input().split()))
temp = [0 for _ in range(N)]
ans = [0 for _ in range(N)]
for i,a in enumerate(A):
    temp[i] = [i+1, a]
temp.sort(key=lambda x:x[1])
for i,t in enumerate(temp):
    ans[i] = t[0]
print(*ans)

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  int n, k;
  cin >> n >> k;
  if(k == 1) {
    cout << 0 << endl;
    return 0;
  }
  cout << n-k << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;
ll A[100001];
ll h1,h2;
int main(){
	int N;
	cin>>N;
	rep(i,N)
		cin>>A[i];
	sort(A,A+N);


	for(int i=N-1;i>=0;i--){
		if(h1==h2){
		if(A[i]==A[i-1]){
			h1=A[i];
			A[i]=10000001;
			A[i-1]=10000002;
		}	
		}
		if(h1!=0){
			if(A[i]==A[i-1]){
				h2=A[i];
				goto ans;
			}
		
		}
	}
	cout<<"0"<<endl;
	return 0;

ans:
	cout<<h1*h2<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    vector<pair<double, pair<int, int> > > data(24);

    for(int i=0; i<24; ++i){
        cin >> data[i].second.first >> data[i].first;
        data[i].second.second = i/8;
    }
    sort(data.begin(), data.end());

    vector<vector<pair<double, int> > > winner(4);
    for(int i=0; i<24; ++i){
        int j = data[i].second.second;
        if(winner[j].size() < 2)
            winner[j].push_back(make_pair(data[i].first, data[i].second.first));
        else if(winner[3].size() < 2)
            winner[3].push_back(make_pair(data[i].first, data[i].second.first));
    }

    for(int i=0; i<4; ++i){
        for(int j=0; j<2; ++j){
            printf("%d %.2f\n", winner[i][j].second, winner[i][j].first);
        }
    }

    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <sstream>
#include <iomanip>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <set>
#include <map>
#include <stdlib.h>
#include <cctype>
#include <bitset>
using namespace std;
int main(){
    int a,p;
    cin >> p >> a;
    if(p % 500 <= a){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3516
N = int(input())
a, b, c, d = 0, 0, 0, 0 

for i in range(N):
    i = input()
    if i == "AC":
        a += 1
    elif i == "WA":
        b += 1
    elif i == "TLE":
        c += 1   
    elif i == "RE":
        d += 1

print("AC x " + str(a))
print("WA x " + str(b))
print("TLE x " + str(c))
print("RE x " + str(d))


Measured memory_bytes: 9180
K,N=map(int,input().split())
A=list(map(int,input().split()))
C=K-A[-1]+A[0]
B=[]
#print(B,C)
for i in range(1,N):
  B.append(A[i]-A[i-1])
B.append(C)
ans=K-max(B)
print(ans)

Measured memory_bytes: 25452
var GET = (function(){
  function f(s){return new g(s);}
  function g(s){this._s=s.trim().split("\n");this._y=0;}
  g.prototype.a = function(f){
    var s = this._s, y = this._y, r;
    if(typeof s[y] === "string")s[y]=s[y].split(" ").reverse();
    r = s[y].pop();
    if(!s[y].length)this._y++;
    return f?r:+r;
  }
  g.prototype.l = function(f){
    var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);
  }
  g.prototype.m = function(n,f){
    var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));
    return f?r:r.map(a=>a.map(a=>+a));
  }
  g.prototype.r = function(n,f){
    var r = this._s.slice(this._y,this._y+=n);
    return f?r:r.map(a=>+a);
  }
  return f;
})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var k = o.a();
  var a = o.l();
  var s = [0];
  for(var i = 0; i < n;i++)s[i+1] = s[i] + a[i];
  var w = [];
  for(var l = 0; l < n; l++){
    for(var r = l+1; r <= n; r++){
      var t = s[r]-s[l];
      w.push(t);
    }
  }
  var ans = 0;
  for(i = 39; i > 30; i--){
    var t = [], z = Math.pow(2,i);
    for(var j = 0; j < w.length; j++){
      if((w[j] / z | 0) & 1)t.push(w[j]);
    }
    if(t.length >= k){ans += z; w = t;}
  }
  for(;i >= 0; i--){
    var t = [], z = 1 << i;
    for(j = 0; j < w.length; j++){
      if((z & w[j]) !== 0)t.push(w[j]);
    }
    if(t.length >= k){ans += z; w = t;}
  }
  return ans;
}


Measured memory_bytes: 26316
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int main() {
  double n, t, a;
  cin >> n >> t >> a;
  vector<double> h(n);
  rep(i, n) cin >> h[i];
  vector<double> dif(n);
  rep(i, n) {
    dif[i] = abs(t-h[i]*0.006 - a);
  }
  double mn = 1e9, mn_i;
  rep(i, n) {
    if (dif[i] < mn) {
      mn = dif[i];
      mn_i = i;
    }
  }
  cout << mn_i + 1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
typedef long long ll;
typedef double db;
typedef vector<int> ve;
typedef pair<int, int> pa;
typedef vector<pair<int,int> > vepa;
typedef map<int, int> mp;
const ll N=1e5+5;
ll arr[N],A[N],ARR[N]  ;
bool visited[N]={};
ll cnt[N]={};
bool f;
 int main()
{
    ll n;
    cin>>n;
    for(int i=0;i<5&&cin>>arr[i];i++);
    sort(arr,arr+5);
    cout<<((n+arr[0]-1)/arr[0]+4);
go;
}


Measured memory_bytes: 256
#最大公約数
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

 #最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

A, B, C, D = map(int, input().split())

# 0 => A-1 で割りきれる
cnt_c = (A-1) // C
cnt_d = (A-1) // D

cnt_cd = (A-1) // lcm(C, D)

cnt_a = cnt_c + cnt_d - cnt_cd

# 0 => Bで割りきれる
cnt_c2 = B // C
cnt_d2 = B // D
cnt_cd2 = B // lcm(C, D)

cnt_b = cnt_c2 + cnt_d2 - cnt_cd2

cnt_ab = cnt_b - cnt_a

cnt_n = B - A + 1

print(cnt_n - cnt_ab)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

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

int main() {
  double N;
  vector<double> v;
  cin >> N;
  for(double i = 0; i < N; i++) {
    double temp;
    cin >> temp;
    v.push_back(temp);
  }
  sort(v.begin(), v.end());
  double ans = v[0];
  for(double i = 1; i < N; i++) {
    ans = (ans + v[i]) / 2;
  }
  cout << std::fixed << std::setprecision(6) << ans << endl;
  return 0;
}

Measured memory_bytes: 3752
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double n=sc.nextInt();
        int k=sc.nextInt();
        double ans=0;
        int count;
        int tmp;
        for(int i=1;i<=n;i++){
            count=0;
            tmp=i;
            while(tmp<k){
                tmp*=2;
                count++;
            }
            
            ans+=Math.pow(2, -count)/n;
        }
        System.out.println(ans);
 
    }

}

Measured memory_bytes: 22868
#include <iostream>

using namespace std;

typedef long long ll;

int main() {
	ll x;
	cin >> x;
	ll y = x / 11;
	ll z = x % 11;
	if (z != 0) {
		if (z <= 6) z = 1;
		else z = 2;
	}
	ll ans = y * 2 + z;
	cout << ans << endl;
	return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int a, b; cin >> a >> b;
  cout << (a+b)%24 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define MAX 100

int main(){
  int H,W,D;
  cin>>H>>W>>D;
  vector<vector<int>> A(H,vector<int>(W));
  vector<pair<int,int>> xy(H*W);
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>A.at(i).at(j);
      xy.at(A.at(i).at(j)-1)=make_pair(i,j);
    }
  }
  vector<int> cost(H*W,0);
  for(int i=0;i<H*W-D;i++){
    cost.at(i+D)=cost.at(i)+abs(xy.at(i+D).first-xy.at(i).first)+abs(xy.at(i+D).second-xy.at(i).second);
  }
  int Q;
  cin>>Q;
  vector<int> L(Q),R(Q);
  for(int i=0;i<Q;i++){
    cin>>L.at(i)>>R.at(i);
  }
  for(int i=0;i<Q;i++){
    cout<<cost.at(R.at(i)-1)-cost.at(L.at(i)-1)<<endl;
  }
}


Measured memory_bytes: 3328
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, a, b = list(map(int, input().rstrip('\n').split()))
    h = [int(input().rstrip('\n')) for _ in range(n)]
    ok = 10 ** 9
    ng = -1
    while ok - ng > 1:
        mid = (ok + ng) // 2
        d1 = b * mid
        d2 = a - b
        cnt = 0
        for v in h:
            cnt += max((v - d1 + d2 - 1) // d2, 0)
        if cnt <= mid:
            ok = mid
        else:
            ng = mid
    print(ok)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 45404
w,h, n = map(int, input().split())

ps = [[] for i in range(h)]
blocks = set()
for i in range(n):
    x, y = map(lambda x: int(x)-1, input().split())
    # if x < y:
    #     continue
    ps[y].append(x)
    blocks.add((x, y))
x, y = (0, 0)
cands = [w]
while y < h:
    if (x+1, y) in blocks:
        # 高橋君は移動できなければ = 障害物に移動すると即死
        cands.append(x+1)
        break
    else:
        x += 1
        ps[y] = [p for p in ps[y] if p > x]
        if ps[y]:
            cands.append(min(ps[y]))
        while (x, y+1) in blocks and (x+1, y) not in blocks and x+1 < w:
            x += 1
    
    if (x, y+1) in blocks:
        break
    y += 1
print(min(cands))


Measured memory_bytes: 91340
/* ********************************* JAI SAI RAM ************************************* */
//kash E C SE pahle dekha hota 
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n"
ll P=1000000007;
ll dp[301][301][2];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll i,j,k,l,m,n,o,p,q,r,t,h1,m1,h2,m2;
    cin>>h1>>m1>>h2>>m2>>k;
    t=(h2-h1-1)*60;
    t+=60-m1+m2;
    t-=k;
    cout<<t<<endl;
    return 0;
}


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

long long n, k, result = 0, sizee;
long long MOD = 1000000007;
vector<long long> sizes(100001,0);

long long modpow(long long x, long long y, long long n) {
    long long res = 1;
    x%=n;
    while (y>0) {
        if (y%2==1) {
            res*=x;
            res%=n;
        }
        y/=2;
        x*=x;
        x%=n;
    }
    return res;
}

int main() {
    cin >> n >> k;
    for (long long i=k; i>=1; i--) {
        sizee = modpow(k/i,n,MOD);
        for (long long j=i+i; j<=k; j+=i) {
            sizee-=sizes[j];
        }
        sizes[i] = sizee;
        sizee*=i;
        sizee%=MOD;
        result+=sizee;
    }
    result%=MOD;
    cout << result;
    return 0;
}

Measured memory_bytes: 3904
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)

#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define op(i) cout << (i) << endl;
#define F first
#define S second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const ll mod = 1e9 + 7;
const int infi = 2147483647;
const ll infl = 1e17;

int main()
{
    ll n, k;
    cin >> n >> k;
    map<ll, ll> data;
    ll S = 0;
    rep(i,n){
        ll a, b;
        cin>>a>>b;
        if (a>k)
            continue;
        else{
            S += b;
            repr(j,30,-1){
                if (!((a>>j)&1))
                    continue;
                if ((k>>j)&1){
                    data[j] += b;
                }
                else {
                    data[j]+=b;
                    break;
                }
            }
        }
    }
    ll ans = 0;
    repr(i,30,-1){
        if((k>>i)&1){
            ans = max(S - data[i], ans);
        }
        else
            S -= data[i];
    }
    ans = max(S, ans);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	vector<ll> a(n+1),sum(n+1,0);
	FOR(i,1,n+1){
		cin>>a[i];
		a[i]--;
		sum[i]=sum[i-1]+a[i];
		sum[i]%=k;
	}
	//cout<<sum<<endl;
	map<ll,ll> now;
	FOR(i,1,k){
		if(i<=n){
			now[sum[i]]++;
		}else{
			break;
		}
	}
	ll ans=0;
	//cout<<now<<endl;
	rep(i,n){
		ans+=now[sum[i]];
		now[sum[i+1]]--;
		//now[sum[min(n-1,(int)i+k)]]++;
		if(i+k<=n) now[sum[i+k]]++;
		//cout<<sum[i]<<' '<<ans<<endl;
		//cout<<now<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 15872
#include<stdio.h>
#include<string.h>
#include<stdlib.h>


int main(void) {
	char i_str[1000];
	int i, len, tmp;

	while(1) {
		scanf("%s", i_str);
		if(*i_str=='0')	break;
		len = strlen(i_str);
		tmp=0;
		for(i=0;i<len;i++) {
			tmp+=i_str[i] - '0';
		}
		printf("%d\n", tmp);
	}

	return 0;
}

Measured memory_bytes: 536
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a,b,c,d,x,y,z,w;
    cin>>a>>b>>c>>d;
    while(1)
    {
        c= c-b;
	if (c<=0)
    {
		cout<<"Yes"<<endl;
		break;
    }
	a= a-d;
	if (a<=0)
    {
		cout<<"No"<<endl;
		break;
    }
    }
}



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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) {
        cin >> A[i];
    }
    int res = *max_element(ALL(A)) - *min_element(ALL(A));
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a, b;
    scanf("%d%d", &a, &b);
    if(a <= 0 && b >= 0) printf("Zero");
    else if(a > 0) printf("Positive");
    else{
        int t = a-b+1;
        if(t%2) printf("Negative");
        else printf("Positive");
    }
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int weight;
	int print_first;
	int lsb; // least significant bit (??????????????????)
	
	while (scanf("%d", &weight) != EOF){
		print_first = 0;
		while (weight > 0){
			if (print_first){
				printf(" ");
			}
			else {
				print_first = 1;
			}
			lsb = weight & -weight; // x & -x ??§ lsb ??????????????????
			weight -= lsb;
			printf("%d", lsb);
		}
		printf("\n");
	}
	
	return (0);
}

Measured memory_bytes: 600
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
int X;
int main(){
  rd(X);
  if(X>=30){
    wt_L("Yes");
    wt_L('\n');
  }
  else{
    wt_L("No");
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// int X;
// {
//   rd(X);
//   wt(if[X>=30, "Yes", "No"]);
// }


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  int K;
  cin >> K;
  
  for(unsigned int i = 0; i < s.size(); i++){
    if(s[i] == 'a') continue;
    if(K >= (long long)('z' - s[i] + 1)){
      K -= (long long)('z' - s[i] + 1);
      s[i] = 'a';
    }
  }
 
  K = K % 26;
  while(K > 0){
    s[s.size() - 1]++;
    if(s[s.size() - 1] >'z') s[s.size() - 1] ='a';
    K--;
  }
  cout << s;
  return 0;
}

Measured memory_bytes: 640
#from math import factorial as f

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

x, y = map(int, input().split())


a = (2*x - y) / 3
b = (2*y - x) / 3

if a % 1 or b % 1:
    print(0)
else:
    a = int(a)
    b = int(b)
    n = a + b
    ans = cmb(n, a, mod)
    print(ans)



Measured memory_bytes: 127560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

// 逆元のmod MOD
ll rev_mod(ll num){
	ll pow_num = MOD - 2;
	ll mod_num = MOD;
	ll pow_cur = num;
	ll ret = 1;
	while(pow_num > 0){
		if(pow_num % 2 == 1){
			ret *= pow_cur;
			ret %= mod_num;
		}
		pow_cur *= pow_cur;
		pow_cur %= mod_num;
		pow_num /= 2;
	}
	return ret;
}

int main(){
    double h, a;
    cin >> h >> a;
    cout << (int) ceil(h/a) << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;

int main()
{
  long long minutes=0;
  int ans=0,j; 
  int n,m,k;
  cin >> n >> m >> k;
  vector<int> a(n);
  vector<int> b(m);
  rep(i,n) cin >> a[i];
  rep(i,m){
    cin >> b[i];
    minutes+=b[i];
  }
  
  j=m;  
  rep(i,n+1){
    while(k<minutes && j>0){
      --j;
      minutes-=b[j];
    }
    if(k>=minutes)
      ans=max(ans,i+j);
    if(i==n) break;
    minutes+=a[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4812
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,m,q = LI()
    aa = [LI() for _ in range(q)]
    r = 0
    for l in itertools.combinations_with_replacement(range(1,m+1), n):
        t = 0
        for a,b,c,d in aa:
            if l[b-1] - l[a-1] == c:
                t += d
        if r < t:
            r = t
    return r

print(main())





Measured memory_bytes: 10952
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

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

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

int main() {
    ll n, x;
    cin >> n >> x;
    vector<ll> a(n);
    rep(i, n) {
        ll ai;
        cin >> ai;
        a[i] = abs(ai - x);
    }

    ll ans = a[0];
    rep(i, n-1) ans = gcd(ans, a[i+1]);
    cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    for(int i = 0;i < s.length();i++){
      if(i % 2 == 0){

        if(s.charAt(i) == 'L'){
          System.out.println("No");
          return;
        }

      }else{

        if(s.charAt(i) == 'R'){
          System.out.println("No");
          return;
        }

      }
    }

    System.out.println("Yes");

  }

}


Measured memory_bytes: 21844
using System;

namespace A___Restricted
{
    class Program
    {
        static void Main (string[] args)
        {
            var input = Console.ReadLine ().Split (' ');
            var a = int.Parse (input[0]);
            var b = int.Parse (input[1]);
            if (a + b >= 10)
            {
                Console.WriteLine ("error");
            }
            else
            {
                Console.WriteLine (a + b);
            }
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

int main(){
	
	int n;
	
	while(true){
		cin >> n;
		if(n == 0){
			break;
		}
		
		int pmax;
		int dmax = 0;
		
		for(int i = 0; i < n; i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;
			if(dmax < d1 + d2){
				dmax = d1 + d2;
				pmax = p;
			}
		}
		
		cout << pmax << " " << dmax << endl;;
		
	}
	
	return 0;
}

Measured memory_bytes: 3076
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
    // Your code here!
    char s[11], cpy[4];
    int min = 10000, n;
    scanf("%s",s);
    n = strlen(s);
    for(int i = 1; i <= n-2; i++)
    {
        strncpy(cpy,&s[i-1],3);
        if(abs(atoi(cpy)-753) < min) min = abs(atoi(cpy)-753);
    }
    printf("%d\n",min);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
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...);
}
long long pows(long long a, long long b) {
  long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){if(m == 1)return 0;ll m0=m,y=0,x=1;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0) x+=m0;return x;}
int main()
{
fastIO
ll n,m,i,j,k,x,y,z,t,e,f,p,q,g,l,r,w,h,count1=0,prod=1,a,b,c,d,index,diff,ans=0,sum=0,sum1=0,sum2=0,flag=0,flag1=0,flag2=0;
string s,s1,s2;
cin>>n>>k;
ll ar[n];
for(i=0;i<n;i++)
{
  cin>>ar[i];
}
sort(ar,ar+n);
for(i=0;i<k;i++)
{
  sum+=ar[i];
}
cout<<sum;
}


Measured memory_bytes: 3652
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

#define LIMIT 1000000000000
char ss[10];
int main(){
	ll s=10;
	while(s<LIMIT){
		printf("? %lld\n",s);
		fflush(0);
		scanf("%s",ss);
		if(*ss=='N')break;
		s*=10;
	}
	if(s==1000000000000){
		//答えは10べき
		s=2;
		while(s<LIMIT){
			printf("? %lld\n",s);
			fflush(0);
			scanf("%s",ss);
			if(*ss=='Y')break;
			s*=10;
		}
		printf("! %lld\n",s/2);
		fflush(0);
	}else{
		ll l=s/10+1,r=s-1;//[l,r]
		while(l!=r){
			ll m=(l+r)/2;
			printf("? %lld0\n",m);
			fflush(0);
			scanf("%s",ss);
			if(*ss=='N')l=m+1;
			else r=m;
		}
		printf("! %lld\n",l);
		fflush(0);
	}
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007

int fn(int A,int B,int C)
{
  return abs(A-B) + abs(B-C) + abs(C-A);
}

void solve(void)
{
  int N;
  cin>>N;
  set<int> st;
  for (int i = 0; i < N; i++)
  {
    int A;
    cin>>A;
    auto itr = st.find(A);
    if(itr == st.end())
    {
      st.insert(A);
    }
    else
    {
      st.erase(itr);
    }
  }

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



int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 4992
s=chomp(readline())
t=length(s)
for i=1:t-1
	if s[i]==s[i+1]
		println("$i $(i+1)")
		exit()
	end
end
for i=1:t-2
	if s[i]==s[i+2]
		println("$i $(i+2)")
		exit()
	end
end
println("-1 -1")


Measured memory_bytes: 125520
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main() {
  int k, even{}, odd{};
  cin >> k;
  for (int i = 1; i <= k; ++i) {
    if (i % 2 == 0) ++even;
    else ++odd;
  }
  cout << even * odd << endl;
}


Measured memory_bytes: 256
import math

n, m = map(int, input().split())
ns, ms = range(n), range(m)
students = []
for i in ns:
    a, b = map(int, input().split())
    students.append([a, b])
checkpoints = []
for i in ms:
    c, d = map(int, input().split())
    checkpoints.append([c, d])

for i in ns:
    ans = [0, float('inf')]
    for j in ms:
        dist = abs(students[i][0] - checkpoints[j][0]) + abs(students[i][1] - checkpoints[j][1])
        if dist < ans[1]:
            ans = [j + 1, dist]
    print(ans[0])

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

public class Main  {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    static HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); 
    static int[][] Factor;
    static long mod = (long)1e9 + 7;
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
       
        int S = nextInt();
        
        if(S<3){
            System.out.println(0);
            return;
        }

        //build prime map
        int index = 1;
        for (int i=2; i<=S; i++) {
            if(isPrime(i)){
                map.put(index, i);
                index++;
            }
        } 


        Factor = new int[S+1][map.size()+1];
        // each number we convert to prime Factor
        for (int i=2; i<= S; i++) {
            int row = i;
            for (int j=1; j<= map.size(); j++) {
                int prime = map.get(j);
                while(row%prime==0){
                    row = row/prime;
                    Factor[i][j]++;
                }  
                if(row==1){
                    break;
                }
            } 
        } 

        int p = S/3; // max group you can get

        long sum = 0;
        for (int x=1; x<=p; x++) {
            // this is bar and star question
            int temp = S - 3*x; // all number should >=3
            int bar = x - 1;
            sum += Combin(temp+bar,bar);
            sum %= mod;
        }

        System.out.println(sum);
       
    }
  
    public static long Combin(int a, int b) {
        if(b==0) return 1;

        long total = 1;
        int[] result = new int[map.size()+1];
        int loop = Math.min(b, a-b);

        for (int i=a; i>= a-loop+1; i--) {
            for (int j=1; j<= map.size(); j++) {
                result[j] += Factor[i][j];
            } 
        } 
        for (int i=loop; i>= 1; i--) {
            for (int j=1; j<= map.size(); j++) {
                result[j] -= Factor[i][j];
            } 
        } 

        for (int j=1; j<= map.size(); j++) {
            if(result[j]>0){
                for (int x=1; x<= result[j]; x++) {
                    total *= map.get(j);
                    total %= mod;
                }
            }
        } 

        return total;
    }

    public static boolean isPrime(int n) {  
        if (n <= 1) {  
            return false;  
        }  
        for (int i = 2; i <= Math.sqrt(n); i++) {  
            if (n % i == 0) {  
                return false;  
            }  
        }  
        return true;  
    }  

    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

Measured memory_bytes: 39340
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  
 double a,b;
  cin>>a>>b;
  ll A = a;
  b*=100;
  b+=1e-5;
  ll B = b;
  A*=B;
  cout<<A/100<<endl;
}

Measured memory_bytes: 3720
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <string>
#include <deque>
#include <stack>
#include <cmath>

using namespace std;

#define PB push_back
#define MP make_pair
#define f first
#define s second
#define FOR(i,a,b) for (LL i = a; i < b; ++i)
#define RFOR(i, b, a) for (int i = b-1; i>=a; --i)
#define FILL(a, b) memset(a, b, sizeof a)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)a.size()

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<LL> VI;
typedef pair<LL, LL> PLL;

const int INF = 1000 * 1000 * 1000;
const LL LINF = 1LL * INF*INF;
const int MAX = 400040	;
const long double PI = acos(-1.);
const double EPS = 1e-6;
LL mod = 1000LL * 1000 * 1000 + 7;

int n,k;
LL arr[300];
LL dpT[200007];
LL dp(int K)
{
	if(K<0)
		return 1;
	if(dpT[K]!=-1LL)
		return dpT[K];
	int ans = 0;
	FOR(i,0,n)
		ans|=!dp(K-arr[i]);
	return dpT[K] = ans;
}



int main()
{
	//freopen("input.tXXt", "r", stdin);
	ios_base::sync_with_stdio(0);
	FILL(dpT,-1);
	cin >> n>>k;
	FOR(i,0,n)
		cin >> arr[i];
	if(dp(k))
		cout<<"First";
	else
		cout<<"Second";
	return 0;
}


Measured memory_bytes: 5120
using System;
using System.Collections.Generic;
using System.Linq;

class C
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		map = new int[n].Select(_ => Read().Skip(1).ToArray()).ToArray();
		var q = int.Parse(Console.ReadLine());
		var qs = new int[q].Select(_ => Read()).ToArray();

		tour = new List<int>();
		order = Array.ConvertAll(new int[n], _ => new List<int>());
		minDepth = new ST_Min(2 * n);
		EulerTourDfs(0, 0);

		Console.WriteLine(string.Join("\n", qs.Select(x => Lca(x[0], x[1]))));
	}

	static int[][] map;
	static List<int> tour;
	static List<int>[] order;
	static ST_Min minDepth;
	static void EulerTourDfs(int v, int depth)
	{
		order[v].Add(tour.Count);
		minDepth.SetMin(tour.Count, depth);
		foreach (var nv in map[v])
		{
			tour.Add(v);
			EulerTourDfs(nv, depth + 1);
			tour.Add(-nv);
			order[v].Add(tour.Count);
			minDepth.SetMin(tour.Count, depth);
		}
	}

	static int Lca(int u, int v)
	{
		if (u == v) return u;
		if (order[u][0] > order[v][0]) { var t = u; u = v; v = t; }
		if (order[u].Last() > order[v][0]) return u;
		return tour[minDepth.ArgMin(order[u].Last(), order[v][0])];
	}
}

class ST_Min
{
	struct KI
	{
		public int k, i;
	}

	int kMax;
	List<long[]> vs = new List<long[]> { new long[1] };
	public ST_Min(int n)
	{
		for (int c = 1; c < n; vs.Add(new long[c <<= 1])) ;
		foreach (var a in vs)
			for (int i = 0; i < a.Length; i++)
				a[i] = long.MaxValue;
		kMax = vs.Count - 1;
	}

	KI[] GetLevels(int i)
	{
		var r = new List<KI>();
		for (int k = kMax; k >= 0; --k, i >>= 1) r.Add(new KI { k = k, i = i });
		return r.ToArray();
	}

	KI[] GetRange(int minIn, int maxEx)
	{
		var r = new List<KI>();
		for (int k = kMax, f = 1; k >= 0 && minIn < maxEx; --k, f <<= 1)
		{
			if ((minIn & f) != 0) r.Add(new KI { k = k, i = (minIn += f) / f - 1 });
			if ((maxEx & f) != 0) r.Add(new KI { k = k, i = (maxEx -= f) / f });
		}
		return r.ToArray();
	}

	public long Get(int i) => vs[kMax][i];

	public void SetMin(int i, long v)
	{
		foreach (var x in GetLevels(i)) vs[x.k][x.i] = Math.Min(vs[x.k][x.i], v);
	}

	public long Submin(int minIn, int maxEx) => GetRange(minIn, maxEx).Select(x => vs[x.k][x.i]).Aggregate(Math.Min);

	public int ArgMin(int minIn, int maxEx)
	{
		var m = Submin(minIn, maxEx);
		var ki = GetRange(minIn, maxEx).First(x => vs[x.k][x.i] == m);

		for (int j; ki.k < kMax; ki = new KI { k = ki.k + 1, i = j })
		{
			j = 2 * ki.i;
			if (vs[ki.k + 1][j] > m) j++;
		}
		return ki.i;
	}
}



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

void solve()
{
    int n;
    cin>>n;
    int dp[3];
    cin>>dp[0]>>dp[1]>>dp[2];
    for(int i=1; i<n; i++){
        int temp[3];
        for(int i=0; i<3; i++){
            int t;cin>>t;
            temp[i]=t+max(dp[(i+1)%3],dp[(i+2)%3]);
        }
        for(int i=0; i<3; i++){
            dp[i]=temp[i];
        }
    }
    cout<<max(dp[0],max(dp[1],dp[2]));
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back
#define ll long long
#define rep(i,n) for (i = 0; i < n; ++i) 
#define REP(i,k,n) for (i = k; i <= n; ++i) 
#define REPR(i,k,n) for (i = k; i >= n; --i)
using namespace std;
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE 
   freopen("input.txt", "r", stdin); 
   //freopen("error.txt", "w", stderr); 
  freopen("output.txt", "w", stdout); 
#endif   
 ll T = 1 ;
 //cin>>T;
 for(ll t=1;t<=T;t++)
{
  ll n , f = 1;
  string s;
  cin>>n>>s;
  if(n&1)
    cout<<"No"<<endl;
  else {
    for(ll i=0;i<n/2;i++)
    {
      if(s[i]!=s[n/2+i])
        {f = 0; break;}
    }
    if(f)
      cout<<"Yes";
    else cout<<"No";
  }
}
  return 0;
}


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

int main(void){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		int a[3];
		cin >> a[0] >> a[1] >> a[2];
		sort(a, a+3);
		if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])
			cout << "YES" << endl;
		else 
			cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
lis = list(map(int,input().split()))
ans = [10 ** 9 for i in range(n+5)]
ans[0] = 0
for i in range(n):
    if i < n-1:
        ans[i+1] = min(ans[i+1],ans[i]+abs(lis[i+1]-lis[i]))
    if i < n-2:
        ans[i+2] = min(ans[i+2],ans[i]+abs(lis[i+2]-lis[i]))
print(ans[n-1])


Measured memory_bytes: 13924
#define M(x,y)(x>y?x:y)
#define m(x,y)(x<y?x:y)
I;int parse(char *p){switch(*p){
	case'0':return 0;
	case'1':return 1;
	case'2':return 2;
	case'P':return I%3;
	case'Q':return I/3%3;
	case'R':return I/9%3;
	case'-':return 2-parse(p+1);
	case'(':{
		int x=0;
		char*q=++p;
		for(;;p++){
			if(*p=='(')x++;
			if(*p==')')x--;
			if(x==0&&*p!='-')break;
		}
		return (*(++p)=='*')?m(parse(q),parse(p+1)):M(parse(q),parse(p+1));
	}
}}
char p[81];main(s){for(;scanf("%s",p),*p-'.';printf("%d\n",s))for(s=I=0;I<27;I++)s+=parse(p)==2;exit(0);}

Measured memory_bytes: 536