akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll> 
#define clr(x) memset(x,0,sizeof(x))
const ll size=1e6+7;
ll arr[size];
ll findpw(ll x)
{
    ll ans=0;
    while(x>0 and x%2==0)x=x/2,ans++;
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n;cin>>n;ll ans=0;
    for(ll i=0;i<n;i++)
    {
        ll x;cin>>x;
        ans=ans+findpw(x);
    }
    cout<<ans<<endl;
}   

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

using namespace std;

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

	int n ; cin >> n;
	string s ; cin >> s;
	int cnt = 0 ;
	string sb = s;
	int t = s.length();
	sort(s.begin(), s.end());
	for(int i = 1 ; i < t; i++){
		if(sb[i] != s[i]) cnt++;
	}    
	cout << (cnt + 1)/2;
  return 0;
}


Measured memory_bytes: 3784
public class Main {
	static java.util.Scanner scan = new java.util.Scanner(System.in);
	public static void main(String[] args) {
		int input = scan.nextInt();
		double total = 100;
		while (0 < input--) {
			total = Math.ceil(total * 1.05);
		}
		total *= 1000;
		print((int) total);
	}
	
	public static void print(Object out) {
		System.out.println(out);
	}
}

Measured memory_bytes: 17168
def main():
	# n,m = map(int,input().split())
	n = int(input())
	# s = str(input())
	a = list(map(int,input().split()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	import itertools

	kumi = list(itertools.combinations(a,2))
	# print(kumi)
	ans = 0
	for i in kumi:
		ans += i[0] * i[1]

	print(ans)



if __name__ == '__main__':
	main()

Measured memory_bytes: 38640
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

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

int a,b,c,d;
int n;
int cou[55]={0};

int main(){
	rep(i,10) rep(j,10) rep(k,10) rep(l,10){
		cou[i+j+k+l]++;
	}
	while(cin>>n){
		cout<<cou[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,ans=0;
  cin>>N;
  map<ll,ll> M;
  REP(i,N){
    ll a;
    cin>>a;
    M[a]++;
  }
  
  FORE(v,M) ans++;
  
  cout<<(ans-1)/2*2+1<<endl;
  return 0;
}

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

using namespace std;

#define int long long
#define FR first
#define SC second
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, f, n) for(int i = (int)(f); i < (int)(n); i++)
#define each(a, b) for(auto& a : b)

typedef pair<int, int> P;

const int inf = 1LL << 55;

struct edge
{
  int to, cap, cost, rev;
  edge(){}
  edge(int to, int cap, int cost, int rev):to(to), cap(cap), cost(cost), rev(rev){}
};


struct PrimalDual
{
  vector< vector<edge> > graph;
  vector<int> mincost;

  PrimalDual(int n):graph(n), mincost(n){}
  void add_edge(int f, int t, int cap, int cost)
  {
    graph[f].push_back(edge(t, cap, cost, graph[t].size()));
    graph[t].push_back(edge(f, 0, -cost, graph[f].size()-1));
  }
  int min_cost_flow(int s, int t, int f)
  {
    int ret = 0;

    vector<int> h(graph.size(), 0);
    vector<int> pv(graph.size(), -1);
    vector<int> pe(graph.size(), -1);

    while(f > 0) {
      priority_queue<P, vector<P>, greater<P> > que;
      fill(all(mincost), inf);
      mincost[s] = 0;
      que.push(P(0, s));
      while(!que.empty()) {
	P p = que.top(); que.pop();
	int v = p.second;
	if(mincost[v] < p.first) continue;
	rep(i, graph[v].size()) {
	  edge& e = graph[v][i];
	  int cost = mincost[v] + e.cost + h[v] - h[e.to];
	  if(e.cap > 0 && cost < mincost[e.to]) {
	    mincost[e.to] = cost;
	    pv[e.to] = v, pe[e.to] = i;
	    que.push(P(mincost[e.to], e.to));
	  }
	}
      }

      if(mincost[t] == inf) return -1;
			      
      rep(i, graph.size()) h[i] += mincost[i];
      int d = f;
      for(int v = t; v != s; v = pv[v]) d = min(d, graph[pv[v]][pe[v]].cap);
      f -= d;
      ret += h[t] * d;
      for(int v = t; v != s; v = pv[v]) {
	edge& e = graph[pv[v]][pe[v]];
	e.cap -= d;
	graph[v][e.rev].cap += d;
      }
    }
    
    return ret;
  }
};

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

  int n; cin >> n;
  int W[101][101], E[101][101];
  char F[101][101];
  rep(i, n) rep(j, n) cin >> W[i][j];
  rep(i, n) rep(j, n) cin >> E[i][j];
  rep(i, n) rep(j, n) cin >> F[i][j];

  int s = 2*n, t = s + 1, v = t + 1;
  
  PrimalDual graph(v);

  rep(i, n) {
    graph.add_edge(s, i, 1, 0);
    graph.add_edge(n+i, t, 1, 0);
  }

  rep(i, n) rep(j, n) {
    int cost = 0;
    rep(k, n) {
      if(k == j && F[i][k] == '.') cost += W[i][k];
      if(k != j && F[i][k] == 'o') cost += E[i][k];
    }
    graph.add_edge(i, n + j, 1, cost);
  }

  int mcf = graph.min_cost_flow(s, t, n);
  cout << mcf << endl;

  vector< tuple<int, int, string> > ops;

  rep(i, n) {
    for(edge e : graph.graph[i]) {
      if(e.cap == 0 && F[i][e.to-n] == '.') ops.emplace_back(i+1, e.to-n+1, "write");
      if(e.cap != 0 && F[i][e.to-n] == 'o') ops.emplace_back(i+1, e.to-n+1, "erase");
    }
  }

  cout << ops.size() << endl;
  for(auto o : ops) {
    int r, c; string op;
    tie(r, c, op) = o;
    cout << r << " " << c << " " << op << endl;
  }
  
  return 0;
}

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

using namespace std;

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

inline int sign(const double &x){
    if(x>EPS) return 1;
    else if(x<-EPS) return -1;
    return 0;
}

/*   点  */
struct Point{
    double x,y;

    Point(double x=0,double y=0):x(x),y(y){}

    Point operator + (Point p) { return Point(x+p.x,y+p.y); }
    Point operator - (Point p) { return Point(x-p.x,y-p.y); }
    Point operator * (double k) { return Point(k*x,k*y); }
    Point operator / (double k) { return Point(x/k,y/k); }

    //向量的大小
    double abs(){ return sqrt(norm()); }
    double norm() { return x*x+y*y; }

    bool operator < (const Point & p) const{
        return x!=p.x?x<p.x:y<p.y;
    }

    bool operator == (const Point & p) const {
        return fabs(x-p.x)<EPS&&fabs(y-p.y)<EPS;
    }
};

//两点间的距离
double getDistance(Point a,Point b){
    return (a-b).abs();
}

/*   向量  */
typedef Point Vector;

//向量a和b的内积
double dot(Vector a,Vector b){
    return a.x*b.x+a.y*b.y;
}
//向量a和b的外积
double cross(Vector a,Vector b){
    return a.x*b.y-a.y*b.x;
}

/*   线段  */
struct Segment{
    Point p1,p2;
};

/*   直线  */
typedef Segment Line;

//点到直线的距离
double getDistanceLP(Line l,Point p){
    return abs(cross(l.p2-l.p1,p-l.p1)/(l.p2-l.p1).abs());
}

//点到线段的距离
double getDistanceSP(Segment s,Point p){
    if(dot(s.p2-s.p1,p-s.p1)<0.0) return (p-s.p1).abs();
    if(dot(s.p1-s.p2,p-s.p2)<0.0) return (p-s.p2).abs();
    return getDistanceLP(s,p);
}

//判断p2与向量p1-p0的位置关系

const int COUNTER_CLOCKWISE = -1;   //逆时针
const int CLOCKWISE = 1;            //顺时针
const int ON_SEGMENT = 0;           //在线段上

int ccw(Point p0,Point p1,Point p2){
    Vector a=p1-p0;
    Vector b=p2-p0;
    if(cross(a,b)>EPS) return COUNTER_CLOCKWISE;
    if(cross(a,b)<EPS) return CLOCKWISE;
    return ON_SEGMENT;
}

//判断线段p1p2与线段p3p4是否相交
bool intersect(Point p1,Point p2,Point p3,Point p4){
    return ( ccw(p1,p2,p3)*ccw(p1,p2,p4)<=0 &&
             ccw(p3,p4,p1)*ccw(p3,p4,p2)<=0 );
}

bool intersect(Segment s1,Segment s2){
    return intersect(s1.p1,s1.p2,s2.p1,s2.p2);
}

//线段与线段的距离
double getDistance(Segment s1,Segment s2){
    if(intersect(s1,s2)) return 0.0;
    return min(min(getDistanceSP(s1,s2.p1),getDistanceSP(s1,s2.p2)),
               min(getDistanceSP(s2,s1.p1),getDistanceSP(s2,s1.p2)));
}

/* 直线正交
 * 判断向量a，b是否正交 =》a，b的内积为0
 */
bool isOrthogonal(Vector a,Vector b){
    return equals(dot(a,b),0.0);
}

bool isOrthogonal(Point a1,Point a2,Point b1,Point b2){
    return isOrthogonal(a1-a2,b1-b2);
}

/* 直线平行
 * 判断向量a，b是否平行 =》a，b的内积为0
 */
bool isParallel(Vector a,Vector b){
    return equals(cross(a,b),0.0);
}

bool isParallel(Point a1,Point a2,Point b1,Point b2){
    return isParallel(a1-a2,b1-b2);
}

struct Circle{
    Point c;
    double r;
    Circle(Point c = Point() ,double r = 0.0 ):c(c),r(r){}
};

/*   多边形  */
typedef vector<Point> Polygon;

int main(){
    int n;
    scanf("%d",&n);
    while(n--){
        Point p1,p2,p3,p4;
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y,&p3.x,&p3.y,&p4.x,&p4.y);
        printf("%.10f\n",getDistance(Segment{p1,p2},Segment{p3,p4}));
    }
    return 0;
}



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

using namespace std;
int a,b,c,n,t;
int main() {
    list<int> q[1005];
    cin>>n>>t;
    while(t--){
        cin>>a;
        if(a==0){
            cin>>b>>c;
            q[b].push_back(c);
        }
        else if(a==1){
            cin>>b;
            int f=0;
            for(int i:q[b]){
                if(f==1) cout<<" ";
                f=1;
                cout<<i;
            }
            cout<<endl;
        }
        else {
            cin>>b>>c;
            q[c].splice(q[c].end(),q[b]);
        }
    }
    return 0;
}



Measured memory_bytes: 18656
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
int main() {
	int n;
	cin >> n;
	vector<int> geko;
	REP(i, n) {
		int a;
		cin >> a;
		geko.push_back(a);
	}
	sort(geko.begin(), geko.end());
	int nya = geko.size() / 2;
	cout << geko[nya] - geko[nya - 1] << endl;
	return 0;
}

Measured memory_bytes: 892
from collections import defaultdict
N, M = map(int, input().split())
A = list(map(int, input().split()))

amount = [0] * (N+1)
for i in range(N):
    amount[i+1] = amount[i] + A[i]
    amount[i+1] %= M

ans = 0
di = defaultdict(int)
for i in range(N):
    ans += di[amount[i+1]]
    di[amount[i+1]] += 1

print(ans + di[0])



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


int sortList(const void *a, const void *b)
{
	return *(int*)b - *(int*)a;
}
int main()
{
	int nCnt = 0;
	int nA[100];
	memset(nA, 0, sizeof(nA));

	cin >> nCnt;
	for(int i=0; i<nCnt; i++)
		cin >> nA[i];

	qsort(nA, nCnt, sizeof(int), sortList);

	int nMaxA = 0;
	int nMaxB = 0;
	for (int i = 0; i < nCnt; i++)
	{
		if (i % 2)
			nMaxB += nA[i];
		else 
			nMaxA += nA[i];
	}
	cout << nMaxA - nMaxB;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    HashMap<Long, Integer> map = new HashMap<Long, Integer>();
    long m = n;
    for(long i = 2; (i * i) <= n; i++) {
      int t = 0;
      while((m % i) == 0) {
        t++;
        m /= i;
      }
      if(t > 0) map.put(i, t);
    }
    if(m > 1) map.put(m, 1);
    long ans = 0;
    for(long key : map.keySet()) {
      int c = map.get(key);
      int p = 1;
      while(c > 0) {
        ans++;
        if((c - p) > p) {
          c -= p;
          p++;
        } else {
          c = 0;
        }
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 37228
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;

int main()
{
    ll a, b, n;
    cin >> a >> b >> n;
    int ans;
    if(b == 1) ans = 0;
    else{
        ll c = min(b-1, n);
        ans = floor(a*c/b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3544
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
    int K, S;
    
    cin >> K >> S ;

    int X, Y, Z;
    int count=0;


    for (int X = 0; X <= K; X++) {
        for (int Y = 0; Y <= K; Y++) {
            Z = S - X - Y;
            if (Z >= 0 && Z <= K) count++;
        }
    }
    // 出力
    cout << count << endl;
    
}


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

int main(){
    int n;
    cin >> n;
    long long h[n];
    int cnt = 0;
    int ans = 0;
    REP(i,n){
        cin >>h[i];
        if(i == 0){
        }
        else if(i == n - 1){
            if(h[i - 1] >= h[i]){
            cnt++;
            ans = max(ans, cnt);
            }
            else{
                ans = max(ans, cnt);
                cnt = 0;
            }
        }
        else if(h[i - 1] >= h[i]){
            cnt++;
        }
        else{
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    string s;
    cin>>s;
    int n=s.size();
    rep(i,0,n-1){
        if(s.substr(i,2)=="AC"){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr size_t N = 200000;
int v[N];
int main(void){
    long t, n;
    cin >> n;
    for(long i=0; i<n; i++){
        cin >> t;
        v[i] = t-(i+1);
    }
    sort(v, v+n);
    long ans = 0;
    for(long i=0; i<n; i++){
        ans += labs(v[i]-v[n/2]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;

class Main{
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        int add = 0;
        for(int i=1;i<=2;i++){

            if(a>b){
                add +=a;
                a -=1; 
            }else{
                add +=b;
                b -=1 ;
            }
        }
        System.out.println(add);
    }
}

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

int main(){
  int n;
  cin>>n;
  int ans=0;
  for(int i=1;i<=n;i+=2){
    int cnt=0;
    for(int j=1;j<=n;j++){
      if(i%j==0) cnt++;
    }
    if(cnt==8) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3636
# AOJ 0154 Sum of Cards
# Python3 2018.6.19 bal4u

MAX = 1001

while True:
	m = int(input())
	if m == 0: break
	ab = [0]
	for i in range(m):
		ab.append(list(map(int, input().split())))
	
	dp = [[0 for j in range(MAX)] for r in range(8)]
	dp[0][0] = 1
	for i in range(1, m+1):
		for j in range(MAX):
			if dp[i-1][j] == 0: continue;
			s = j
			for k in range(ab[i][1], -1, -1):
				if s < MAX: dp[i][s] += dp[i-1][j]
				s += ab[i][0]
	
	for i in range(int(input())):
		print(dp[m][int(input())])


Measured memory_bytes: 5752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define X first
#define Y second

ll inp[100001];
int main() {
	ll out = 0;
	int N;
	ll x;
	cin >> N >> x;
	for (int i = 0; i < N; i++) {
		cin >> inp[i];
	}
	/*
	if (inp[0] + inp[1] > x){
		out += x - (inp[0] + inp[1]);
		inp[1] = x - inp[0];
		if (inp[1] < 0) {
			inp[0] -= inp[1];
			inp[1] = 0;
		}
	}
	*/
	for (int i = 1; i < N; i++) {
		if (inp[i-1] + inp[i] > x) {
			out += (inp[i-1] + inp[i]) - x;
			inp[i] = x - inp[i-1];
			if (inp[i] < 0) {
				inp[i-1] -= inp[i];
				inp[i] = 0;
			}
		}
	}
	

	cout << out << endl;

	return 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
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; }
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main()
{

    int x;
    cin >> x;
    int ans = 0;
    for(int b=1; b<1001; ++b)
    {
        for (int p=2; p<11; p++)
        {
            int power = pow(b,p);
            if(ans<power && power<=x) ans = power;
        }
    }

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

Measured memory_bytes: 768
n, k = map(int, input().split())
pn = list(map(int, input().split()))

p = [0]*1001
for i in range(1, 1001):
    p[i] = p[i-1] + i
pn = list(map(lambda x: p[x] / x, pn))

ans = sum(pn[:k])
spn = sum(pn[:k])
for i in range(1, n-k+1):    
    spn = spn - pn[i-1] + pn[i+k-1]
    ans = max(ans, spn)

print(ans)

Measured memory_bytes: 25060
#include<stdio.h>

int main ()
{
	int mx,a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	mx=a>b?a:b;
	mx=mx>c?mx:c;
	if((mx*3-a-b-c)%2==0)
		printf("%d\n",(mx*3-a-b-c)/2);
	else
		printf("%d\n",(mx*3-a-b-c+3)/2);
} 

Measured memory_bytes: 128
#include<stdio.h>

int main( void ){
    int i,cnt = 0;
    char s[101];
    char t[101];
    char p[201];
    int n;
    scanf("%d", &n);
    scanf("%s%s", s, t);
    for(i = 0; i < n; i++){
        p[cnt] = s[i];
        cnt ++;
        p[cnt] = t[i];
        cnt ++;
    }
    p[cnt] = '\0';
    printf("%s\n", p);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define DEBUG 0
#define nl          '\n'
#define fori(n)			for(int i = 0; i < n; ++i) 
#define forj(n)			for(int j = 0; j < n; ++j)
#define fork(n)			for(int k = 0; k < n; ++k)
#define forl(n)			for(int l = 0; l < n; ++l)
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define ppb push_back
typedef long long ll;typedef pair<int,int> pii;typedef vector<bool> vbool;
typedef vector<int> vint;typedef vector<ll> vll;typedef long double ld;
typedef vector<vector<int>> vvi; typedef vector<vbool> vvb;

const ll N = 100010;
const ll INF = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; string s; cin >> n >> s;
	int ans = 0;
	for(int i = 2; i < s.size(); ++i) if (s[i-2] == 'A' && s[i-1] == 'B' && s[i] == 'C') ans++; 

	cout << ans << nl;
	#if DEBUG
	cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << " s" << nl;
	#endif
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const long long int MOD = 1e9 + 7;
using namespace std;
int res_factorial;
long long int factorial(int n){
	long long int res = 1;
	for(int i = 1; i <= n; i++) {
		res *= i;
		res %= MOD;
	}
	return res;
}
int main(){
	long long int n, m;
	long long int ans = 0;
	cin >> n >> m;
	if(abs(n-m) > 1){
		ans = 0;
	}else{
		ans = factorial(n)*factorial(m);
		ans %= MOD;
		if(n == m) {
			ans *= 2;
		}
	}
	cout << ans%MOD << endl;
}

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

#define ll long long int
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define sep(i,b,a) for(ll i=b-1;i>=a;i--)
#define vi vector <ll>
#define hell 998244353
#define pii pair <ll,ll>
#define inf (ll)(1e16)
#define pb push_back

using namespace std;

void solve()
{
    ll n;
    cin>>n;
    vi a(n+1),b(n+1),c(n+1);
    rep(i,1,n+1)
        cin>>a[i];
    rep(i,1,n+1)
        cin>>b[i];
    rep(i,1,n)
        cin>>c[i];
    ll ans=0;
    rep(i,1,n+1)
    {
        ans+=b[a[i]];
        if(i!=1&&a[i]==(a[i-1]+1))
        {
            ans+=c[a[i-1]];
        }
    }
    cout<<ans;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t;
	//cin>>t;
	t=1;
	while(t--)
	{
		solve();
	}
	return 0;
}


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

int main() {
    for (size_t i = 0; i < 5; i++)
    {
        int a;
        cin >> a;
        if (a == 0)
        {
            cout << i+1 << endl;
        }
    }
}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)

int main() {
  ll n,k;cin >> n >>k;
  vector<ll> v(n);
  repi(i,0,n) cin >> v[i];
  vector<ll> vsum(n-k+1);
  ll sum =0;
  for(ll j=0;j<k;++j)sum += v[j];
  vsum[0] = sum;
  for(ll l=1;l<n-k+1;++l){
  	vsum[l] = vsum[l-1] - v[l-1] + v[k-1+l];
  }
  sort(all(vsum));
  ll out = vsum[vsum.size()-1];
  cout << fixed << setprecision(10) << (double)(out+k)/2.0d<< endl;
  return 0;
}

Measured memory_bytes: 3328
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    static StringTokenizer st;
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) throws IOException {
        int a = nextInt();
        int b = nextInt();
        int c = nextInt();
        int k = nextInt();

        int result = 0;
        int sum = 0;
        for (int i = 0; i < a; i++) {
            result += 1;
            sum += 1;
            if (sum == k) {
                System.out.println(result);
                return;
            }
        }
        for (int i = 0; i < b; i++) {
            result += 0;
            sum += 1;
            if (sum == k) {
                System.out.println(result);
                return;
            }
        }
        for (int i = 0; i < c; i++) {
            result -= 1;
            sum += 1;
            if (sum == k) {
                System.out.println(result);
                return;
            }
        }

    }

    static char nextChar() throws IOException {
        return next().charAt(0);
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

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

    static int[] readArray(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    static long[] readLongArray(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextLong();
        }
        return a;
    }

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

    static int Char2Int(Character c) {
        return Character.getNumericValue(c);
    }

    static double Char2Double(Character c) {
        return (double) Char2Int(c);
    }

    static int nCr(int n, int r) {
        return fact(n) / (fact(r) * fact(n - r));
    }

    // Returns factorial of n
    static int fact(int n) {
        int res = 1;
        for (int i = 2; i <= n; i++) {
            res = res * i;
        }
        return res;
    }

    static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        } else {
            a = a % b; // 残り部分
            return gcd(b, a); // 残り部分から最小の正方形を見つける
        }
    }
}

Measured memory_bytes: 25712
#include <iostream>
using namespace std;
int w[101],l[101],visited[101],ans;
 
 
void saiki(int m){
  if(visited[m])ans=1;
  if(!w[m] || ans)return;
  visited[m]=1;
  saiki(l[w[m]]);
}
 
 
int main(){
  int n;
  cin>> n;
  for(int i=0;i<101;i++) l[i]=w[i]=visited[i]=0;
 
  for(int i=0;i<n;i++){
    string str;
    int u,d;
    cin>>u>>str>>d;
    if(str=="lock")l[d]=u;
    else w[u]=d;
  }
 
  ans=0;
  for(int i=0;i<101;i++){
    for(int j=0;j<101;j++) visited[j]=0;
    saiki(i);
  }
  cout << ans<<endl;
  return 0;
}

Measured memory_bytes: 1208
/*
  Contest 088
  A - Infinite Coins
  Rakesh Kumar --> 18/09/2020
 */

#include <bits/stdc++.h>

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

    int n = 0, a = 0;
    std::cin >> n >> a;
    const int t = n % 500;
    if (t <= a)
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;

    return 0;
}


Measured memory_bytes: 3620
import java.util.*;

class Main {
    class BinaryHeap {
        private long[] heap;
        private int size;

        public BinaryHeap(int capacity) {
            this.heap = new long[capacity];
            this.size = 0;
        }

        public void dumpNodes() {
            for (int i = 0; i < this.size; i++) {
                System.out.printf("node %d: key = %d, ", i + 1, this.heap[i]);

                int parent = this.parentIndexOf(i);
                if (i > 0 && parent < this.size) {
                    System.out.printf("parent key = %d, ", this.heap[parent]);
                }

                int left = this.leftIndexOf(i);
                if (left < this.size) {
                    System.out.printf("left key = %d, ", this.heap[left]);
                }

                int right = this.rightIndexOf(i);
                if (right < this.size) {
                    System.out.printf("right key = %d, ", this.heap[right]);
                }

                System.out.print("\n");
            }
        }

        public void insert(long key) {
            this.heap[this.size] = key;
            this.size++;
        }

        private int parentIndexOf(int i) {
            return ((i + 1) / 2) - 1;
        }

        public int leftIndexOf(int i) {
            return ((i + 1) * 2) - 1;
        }

        public int rightIndexOf(int i) {
            return (i + 1) * 2;
        }
    }

    public static void main(String[] args) {
        new Main().main();
    }

    public void main() {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        String[] line = scanner.nextLine().split(" ", n);

        BinaryHeap heap = new BinaryHeap(n);
        for (int i = 0; i < n; i++) {
            long a = Long.parseLong(line[i]);
            heap.insert(a);
        }

        heap.dumpNodes();
    }
}



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

int main(int argc, char *argv[]) {
  int N;
  cin >> N;
  string W[N];
  vector<string> W2;
  for(int i = 0; i < N; i++) {
    cin >> W[i];
    W2.push_back(W[i]);
  }
  sort(W2.begin(), W2.end());
  W2.erase(unique(W2.begin(), W2.end()), W2.end());
  if(W2.size() != N) {
    cout << "No" << endl;
    return 0;
  }
  for(int i = 1; i < N; i++) {
    if(W[i-1][W[i-1].size()-1] != W[i][0]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n,a[111111],b[111111];
char s[111111];
ll f()
{
	for(ll i=2;i<n;i++)
		if(a[i]==0)
		{
			if(b[i]==1&&a[i+1]!=a[i-1])
				return 0;
			if(b[i]==0&&a[i+1]==a[i-1])
				return 0;
		}
		else
		{
			if(b[i]==1&&a[i+1]==a[i-1])
				return 0;
			if(b[i]==0&&a[i+1]!=a[i-1])
				return 0;
		}
	if(a[1]==0)
	{
		if(b[1]==1&&a[2]!=a[n])
			return 0;
		if(b[1]==0&&a[2]==a[n])
			return 0;
	}
	else
	{
		if(b[1]==1&&a[2]==a[n])
			return 0;
		if(b[1]==0&&a[2]!=a[n])
			return 0;
	}
	if(a[n]==0)
	{
		if(b[n]==1&&a[n-1]!=a[1])
			return 0;
		if(b[n]==0&&a[n-1]==a[1])
			return 0;
	}
	else
	{
		if(b[n]==1&&a[1]==a[n-1])
			return 0;
		if(b[n]==0&&a[1]!=a[n-1])
			return 0;
	}
	return 1;
}
int main()
{
	cin>>n;
	scanf("\n%s",s);
	for(ll i=n;i>=1;i--)
		b[i]=(s[i-1]=='o');
	for(ll i=0;i<2;i++)
		for(ll j=0;j<2;j++)
		{
			a[1]=i,a[2]=j;
			for(ll k=3;k<=n;k++)
			{
				if(a[k-1]==0)
					a[k]=a[k-2]^b[k-1]^1;
				else
					a[k]=a[k-2]^b[k-1];
			}
			if(f())
			{
				for(ll k=1;k<=n;k++)
					printf("%c",(a[k]?'W':'S'));
				return 0;
			}
		}
	cout<<-1;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define REP(i, n) for (long i = 0; i < n; ++i)

using namespace std;

void solve(long N, vector<string> s) {
  unordered_map<string, long> count;
  REP(i, N) {
    string si = s[i];
    sort(si.begin(), si.end());
    count[si]++;
  }
  long ans(0);
  for (const auto& kv : count) {
    long v = kv.second;
    if (v < 2)
      continue;
    ans += v * (v - 1) / 2;
  }
  cout << ans << endl;
}

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

  long N;
  cin >> N;
  vector<string> s(N);
  REP(i, N)
    cin >> s[i];

  solve(N, move(s));

  return 0;
}


Measured memory_bytes: 16036
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >=0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
 
typedef long long ll;
#define INF 1e9


int main(){
  int N;
  string S;
  cin >> N >> S;
  vector<int> E(N+1,0), W(N+1, 0);

  REP(i, N){
    if(S[i] == 'E'){
      E[i+1] = E[i] + 1;
      W[i+1] = W[i];
    }
    else{
      E[i+1] = E[i];
      W[i+1] = W[i] + 1;
    }
  }
  int minc = 1e9;
  FOR(i, 1, N+1){
    minc = min(minc, W[i-1] + E[N]-E[i]);
  }
  cout << minc << endl;

  return 0;
}

Measured memory_bytes: 3076
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    if(K == 1){
      System.out.println("0");
    }else{
      System.out.println(N-K);
    }
  }
}

Measured memory_bytes: 21844
from __future__ import print_function

from functools import reduce
from operator import mul
from collections import Counter
from collections import deque
from itertools import accumulate
from queue import Queue
from queue import PriorityQueue as pq
from heapq import heapreplace
from heapq import heapify
from heapq import heappushpop
from heapq import heappop
from heapq import heappush
import heapq
import time
import random
import bisect
import itertools
import collections
from fractions import Fraction
import fractions
import string
import math
import operator
import functools
import copy
import array
import re
import sys
sys.setrecursionlimit(500000)


input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    #
    n, q = map(int, input().strip().split())
    G = [[] for _ in range(n)]
    for i in range(0, n-1):
        temp1, temp2 = map(lambda x: int(x) - 1, input().strip().split())
        G[temp1].append(temp2)
        G[temp2].append(temp1)

    px = [0 for _ in range(n)]
    for _ in range(q):
        temp1, temp2 = map(int, input().strip().split())
        px[temp1-1] += temp2

    #
    # eprint('px ', end=':\n')
    # eprint(px)

    # 木の頂点から順番に頂点を見ていき，頂点j
    # 頂点iについて，その子すべてにカウンタを"配る"
    usedlist = [False for _ in range(n)]
    imos = [0 for _ in range(n)]
    Q = Queue()

    # 木の頂点から順番に頂点を見ていき，頂点j
    Q.put(0)
    while not(Q.empty()):
        v = Q.get()
        usedlist[v] = True
        imos[v] += px[v]
        for u in G[v]:  # uは，「今見ているノード」の「子ノード」を表す
            if usedlist[u] == False:
                imos[u] += imos[v]
                Q.put(u)
    # eprint('imos ', end=':\n')
    # eprint(imos)

    #
    for value in imos:
        print(value, end=" ")


if __name__ == '__main__':
    main()


Measured memory_bytes: 122824
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

lint gcd(lint a, lint b) {
	//aとbの最大公約数を返す
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	return a / gcd(a, b) * b;
}

/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	int A, B, C;
	cin >> A >> B >> C;
	cout << min(C, A + B + 1) + B << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, l, r) for(ll i = l; i < r; i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll MOD = 1000000007;

int main() {
    int n; cin >> n;
    int ans = 1000*(n/1000+1)-n;
    if(n%1000==0) ans = 0;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
n, m = gets.chomp.split.map(&:to_i)
a = n.times.map{ gets.chomp.split.map(&:to_i) }
b = m.times.map{ gets.chomp.to_i }

a.each {|row| 
  p row.zip(b).reduce(0){|total,(a_i, b_i)| total + a_i * b_i}
}


Measured memory_bytes: 7052
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

typedef long long ll;

const int HMAX = 20, NB_DEPL = 4;

int h, w, distances[HMAX][HMAX], depl[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
char s[HMAX][HMAX];
bool vu[HMAX][HMAX];

queue< pair<int,int> > enAttente;


pair<int, int> findFarthest(int row, int col){
	
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j ++){
			vu[i][j] = false;
		}
	}
	int row_cur, col_cur, row_next, col_next;
	
	distances[row][col] = 0;
	
	pair<int, int> depart = make_pair(row, col), current;
	enAttente.push(depart);
	
	while(! enAttente.empty()){
		current = enAttente.front();
		enAttente.pop();
		row_cur = current.first;
		col_cur = current.second;
		
		vu[row_cur][col_cur] = true;
		
		for(int i = 0; i < NB_DEPL; i++){
			row_next = row_cur + depl[i][0];
			col_next = col_cur + depl[i][1];
			
			if(h > row_next && row_next >=0 && w > col_next && col_next >=0
			 && s[row_next][col_next] == '.' && ! vu[row_next][col_next]){
				 vu[row_next][col_next] = true;
				 distances[row_next][col_next] = distances[row_cur][col_cur] + 1;
				 enAttente.push( make_pair(row_next, col_next) );
			}
		}
	}
	
	return make_pair(row_cur, col_cur);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
	
	cin >> h >> w;
	pair<int, int> p;
	int colBegin, rowBegin;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cin >> s[i][j];
			
		}
	}
	int ans = 0;
	for(int i = 0; i <h ;i++){
		for(int j =0;j < w; j++){
			if(s[i][j] == '.'){
				p = findFarthest(i,j);
				//cout << i << ' ' << j << ' ' << distances[p.first][p.second] << '\n';
				ans = max(ans, distances[p.first][p.second]);
			}
		}
	}
	
	//cout << colBegin << ' ' << rowBegin << '\n';
	//cout << rowInt << ' ' << colInt << '\n';
	//cout << p.first << ' ' << p.second << '\n';
	cout <<  ans << '\n';
    return 0;
}


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

int main(){
  char ch;
    int cnt[26] = {};
    
    while( cin >> ch ){
      ch = tolower(ch);
        if ( isalpha(ch) ){
          cnt[ch-'a']++;
        }
    }
    
    for( int i = 0; i < 26; i++ ){
      printf("%c : %d\n", i+'a', cnt[i]);
    }   


    
    return 0;
}   

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

ll n, m;
string a, b;

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

bool valid() {
    ll fpb = __gcd(n, m);
    for(ll i = 0; i < fpb; i++) {
        if(a[i * n / fpb] != b[i * m / fpb]) return false;
    }
    return true;
}

void solve() {
    cin >> n >> m >> a >> b;
    if(valid()) cout << lcm(n, m) << "\n";
    else cout << "-1\n";
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    solve();

}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll chk(ll n,ll a,ll b)
{
    ll s=a*n;
    ll s1=0;
    while(n)
    {
        s1++;
        n/=10;
    }
    s+=b*s1;
    return s;
}
int main()
{
    ll r;
    cin>>r;
    cout<<r*r;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		String input = new Scanner(System.in).nextLine();
		String[] num = input.split("\\s");
		int a = Integer.parseInt(num[0]);
		int b = Integer.parseInt(num[1]);
		int c = Integer.parseInt(num[2]);
		if((a < b) && (b < c)){
			System.out.println("Yes");
		} else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26208
#include <iostream>
#include <unordered_map>
#include <cstring>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

using namespace std;

typedef long long ll;

int K, N;

ll solve() {
  
  if (K%2!=0) {
    ll c= 0;
    REP(i, 1, N+1){
      if(i%K==0) c++;
    }
    return c*c*c;
  } else {
    ll c = 0;
    ll hc = 0;
    REP(i, 1, N+1) {     
      if (i%K == 0) c++;
      else if (i%K==(K/2)) hc++;
    }
    return c*c*c+hc*hc*hc;
  }
  

}


int main(void) {
    scanf("%d %d", &N, &K);

    printf("%lld\n", solve());

	return 0;
}


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

#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

int main(){
   
  long double A,B;
  cin >> A >> B;
  ll res = (long double)A*B;
  
  cout << res << endl;
}

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

int main()
{
    int N;
    std::cin >> N;
    std::vector<long long> A(N);
    for(auto&& a : A) {
        std::cin >> a;
    }
    std::sort(A.begin(), A.end());
    for(int i = 0; i < N - 1; ++i) {
        if(A[i] == A[i + 1]) {
            std::cout << "NO";
            return 0;
        }
    }
    std::cout << "YES";
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n ,x=0 ,max=0;
	scanf("%d",&n);
	char s[n];
	for(int i=0 ;i<n;){
	 cin>>s[i];
	 if(s[i]=='I') {
	 	++x;
	 	++i;
	 	
	 }
	 else if(s[i] =='D'){
	 	--x;
     	++i;
	 }
	 if(x>max)
	 max=x;
	}
	printf("%d",max);
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{

        //List<int> a = new List<int>();
        //List<int> b = new List<int>();

        //long[] a = new long[n];


		//string[] s = Console.ReadLine().Split(' ');

		// int a = int.Parse(Console.ReadLine());

		


		for (int i = 1; i <= 9; i++)
		{
			for (int j = 1; j <= 9; j++)
			{
				

                Console.WriteLine("{0}x{1}={2}",i,j,i*j);
				
			}
			
		}

		//Console.WriteLine("");


	}
}

Measured memory_bytes: 9012
#include <vector>
#include <iostream>
#include <algorithm>
 
using namespace std;
 
bool is_prime(int n, int k = 3)
{
    if(n < k * k) { return true; }
     
    if(n % k == 0) { return false; }
     
    return is_prime(n, k + 2);
}
 
int main()
{
    vector<int> prime = {2};
     
    for(int i = 3; i < 101300; i += 2)
    {
        if(is_prime(i))
        {
            prime.push_back(i);
        }
    }
     
    int n, m;
     
    while(true)
    {
        scanf("%d", &n);
        scanf("%d", &m);
         
        if(n == -1 && m == -1) { break; }
         
        int ptr = distance(prime.begin(), lower_bound(prime.begin(), prime.end(), n + 1));
         
        vector<int> c;
        
        for(int i = ptr + m - 1; i >= ptr; i--)
        {
            for(int j = ptr + m - 1; j >= i; j--)
            {
                c.push_back(prime[i] + prime[j]);
            }
        }
        
        sort(c.begin(), c.end());
         
        printf("%d\n", c[m - 1]);
    }
     
    return 0;
}

Measured memory_bytes: 3372
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
set<string>t;
int n,w,h;
const int MA=200011;
int y[MA],x[MA],a[MA];
int ox[MA],oy[MA];
int main(){
cin>>n>>w>>h;
rep(i,n)cin>>x[i]>>y[i]>>a[i];

rep(i,n){
	int lx,rx,ly,ry;
	lx=max(0,x[i]-a[i]);
	rx=min(w,x[i]+a[i]);


	ly=max(0,y[i]-a[i]);
	ry=min(h,y[i]+a[i]);


	ox[lx]++;
	ox[rx]--;
	oy[ly]++;
	oy[ry]--;
}
for(int i=1;i<=w;i++)ox[i]+=ox[i-1];
for(int i=1;i<=h;i++)oy[i]+=oy[i-1];
bool ok=1,ok2=1;
//rep(i,w+1)cout<<ox[i];cout<<endl;
//rep(i,h+1)cout<<oy[i];cout<<endl;

rep(i,w)if(ox[i]<1)ok=0;
rep(i,h)if(oy[i]<1)ok2=0;
if(ok||ok2)cout<<"Yes"<<endl;
else cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 5072
#include <bits/stdc++.h>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void){
    ll n;
    cin>>n;
    vector<ll> a(n+1),b(n);
    rep(i,0,n+1) cin>>a[i];
    rep(i,0,n)cin>>b[i];
    ll ans=0;
    rep(i,0,n){
        ll c=min(a[i],b[i]);
        b[i]-=c;
        a[i]-=c;
        ans+=c;
        c=min(a[i+1],b[i]);
        b[i]-=c;
        a[i+1]-=c;
        ans+=c;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define print(X) cout << (X) << "\n"
#define _ << " " <<
static const int INF = 1e+9+7;

int main(){
  while(true){
    int x,y;
    cin >> x >> y;
    if(x == 0 && y == 0) break;
    if(x <= y) cout << x << " " << y << "\n";
    else cout << y << " " << x << "\n";
  }

  return 0;
}





Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define ninf -2147483648
#define INF 1e9    

#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 





int a[300005];
bool b[105];
char c[1000005];



int main() {
    fastio();
    //int t;cin>>t;
  
    
    int x,y;
  	cin>>x>>y;
  	if(x>9 || y>9)
      cout<<"-1";
    else 
      cout<<x*y;
    
    
    
    
return 0;
}
 


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

int main(){
  int n;
  cin >> n;
  string ans = "Yes";
  if(n == 1){
    cout << "Yes" << endl;
    return 0;
  }
  vector<int> h(n);
  rep(i, n) {
    cin >> h[i];
  }
  int num = h[0];
  rep(i, n - 1) {
    num = max(num, h[i + 1]);
    if((h[i] > h[i + 1] && h[i] - h[i + 1] > 1) || num - h[i + 1] > 1) {
      ans = "No";
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long mod = 1e9+7;
#define pb push_back


int main() 
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    double r;
    cin >> r;
    cout << 44*r/7;
    return 0;                                                  

  
}

Measured memory_bytes: 3804