akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
ll n;
ll mod=1000000007;
map<ll,ll>dp;
ll akioi(ll p)
{
    if(dp[p]!=0)
        return dp[p];
    else
    	return dp[p]=((akioi(p/2)+akioi((p-1)/2)+akioi((p-2)/2)))%mod;
}
int main()
{
	dp[0]=1;
	dp[1]=2;
	cin>>n;
	cout<<akioi(n)<<endl;
	return 0;
} 

Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).expect("error");
    let n: i64 = s.trim().parse().unwrap();
    let mut a = [1; 1000];
    let mut m;

    for j in 2..(n + 1) {
        m = j;
        for i in 2..(j + 1) {
            while m % i == 0 {
                m /= i;
                a[(i - 1) as usize] += 1;
            }
            if n == 1 {
                break;
            }
            //println!("{}", i);
        }
    }

    //println!("{}", ans);
    let mut ans: i64 = 1;
    for i in 0..n {
        ans *= a[i as usize] % 1000000007;
        ans %= 1000000007;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<string> split_naive(const string &s, char delim) {
	vector<string> elems;
	string item;
	for(char ch:s){
		if(ch==delim){
			if(!item.empty()) elems.push_back(item);
			item.clear();
		}
		else{
			item += ch;
		}
	}
	if(!item.empty()) elems.push_back(item);
	return elems;
}

int main(){
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	string S;
	while(cin>>S){
		auto T = split_naive(S,',');
		double x1,y1,x2,y2,xq,yq;
		sscanf(T[0].c_str(),"%lf",&x1);
		sscanf(T[1].c_str(),"%lf",&y1);
		sscanf(T[2].c_str(),"%lf",&x2);
		sscanf(T[3].c_str(),"%lf",&y2);
		sscanf(T[4].c_str(),"%lf",&xq);
		sscanf(T[5].c_str(),"%lf",&yq);
		
		double dx=x2-x1,dy=y2-y1;
		double nd = hypot(dx,dy);
		dx /= nd;
		dy /= nd;
		double qx=xq-x1,qy=yq-y1;
		double nh = qx*dx+qy*dy;
		double hx=nh*dx,hy=nh*dy;
		out(xq+2*(hx-qx),yq+2*(hy-qy));
	}

	return 0;
}


Measured memory_bytes: 3332
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h>/*限界*/
//---------------------------------------------------
#define rep(i, n) for(int  i = 0; i < (n); i++)
#define max(a,b) ((a>b)?a:b)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)
//---------------------------------------------------
void swap(int *a, int *b)
{
  int temp;
  temp = *a;*a = *b;*b = temp;
}
//---------------------------------------------------

int main(void)
{
  LL n;
  LL m;
  LL ans = 0;
  scanf("%lld %lld",&n,&m);
  for (LL i = m; i <= n+1; i++) {
    ans += ((2*n - i + 1) - (i-1))*i/2 + 1;
    ans %= MOD;
  }
  printf("%lld\n",ans );

  return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    vint a(3);
    rep(i, 3) cin >> a[i];
    sort(rall(a));

    int ans = 0;
    ans += a[0] - a[1];
    ans += (a[1] - a[2] + 1) / 2;
    if ((a[1] - a[2]) % 2 == 1) ans++;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll gcd(ll  a,ll b){
        return b?gcd(b,a%b):a;
}

ll  a[110];
int main(){
        int n;
        scanf("%d",&n);
        for(int i=0;i<n;i++)
        cin>>a[i];
        ll ans=a[0];
        for(int i=1;i<n;i++){
         ans=ans/gcd(ans,a[i])*a[i];
        }
        return !printf("%lld\n",ans);
}


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

int main() {
	ll n,a[300010],b[300010],ans=1<<30;
	string s;
	cin>>n>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='E'){
			a[i]=1;
			b[i]=0;
		}
		else{
			a[i]=0;
			b[i]=1;
		}
	}
	for(int i=1;i<s.size();i++){
		b[i]=b[i]+b[i-1];
	}
	for(int i=s.size()-2;i>=0;i--){
		a[i]=a[i]+a[i+1];
	}
	for(int i=0;i<s.size();i++){
		ll sum=a[i]+b[i]-1;
		ans=min(sum,ans);
	}
	cout <<ans;
	return 0;
}

Measured memory_bytes: 5380
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

vector<vector<int>> adj;
vector<bool> visited;
vector<bool> assigned;
vector<int> sz;
int c = 1;

void dfs1(int v)
{
  	visited[v] = 1;
  	for(int i = 0; i < adj[v].size(); i++) if(!visited[adj[v][i]])
    {
      	c++;
      	dfs1(adj[v][i]);
    }
}
 
void dfs2(int v)
{
  	sz[v] = c;
  	assigned[v] = 1;
  	for(int i = 0; i < adj[v].size(); i++) if(!assigned[adj[v][i]]) dfs2(adj[v][i]);
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m; cin >> n >> m;
	adj.resize(n);
	visited.resize(n);
	assigned.resize(n);
	sz.resize(n);
	for(int i = 0; i < m; i++)
	{
		int u, v; cin >> u >> v;
		u--; v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	for(int i = 0; i < n; i++) if(!visited[i])
	{
		dfs1(i);
		dfs2(i);
		c = 1;
	}
	cout << *max_element(sz.begin(), sz.end());

	return 0;
}

Measured memory_bytes: 24188
N = int(input())
A = list(map(int, input().split()))

money = 1000
temp = A[0]
up = None

for i in range(N-1):
  # print((i, up))
  if A[i] == A[i+1]:
    continue

  if up is None:
    if temp < A[i+1]:
      up = True
    elif temp > A[i+1]:
      up = False
    continue

  if up:
    if A[i] < A[i+1]:
      continue
    else:
      up = False
      d = money // temp
      money += d * (A[i] - temp)
      temp = A[i+1]
  else:
    if A[i] < A[i+1]:
      up = True
      temp = A[i]
    else:
      temp = A[i+1]

if up:
  d = money // temp
  money += d * (A[-1] - temp)

print(money)


Measured memory_bytes: 9224
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

#define MAX_N 100001
#define MAX_M 200001

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



class DDoubleDots {
public:
    int dy[4]={-1,1,0,0};
    int dx[4]={0,0,1,-1};
    int d[MAX_N];
    vector<vector<int> > edges;
    int N, M;


    void dijkstra() {
        fill(d, d+N, INF);
        d[0] = 0;
        priority_queue<p, vector<p>, greater<p> > q;
        q.push(make_pair(0, 0));
        while (!q.empty()) {
            p node = q.top(); q.pop();
            int dist = node.first;
            int v = node.second;
            for(auto nv: edges[v]) {
                if (dist+1 < d[nv]) {
                    d[nv] = dist + 1;
                    q.push(make_pair(dist+1, nv));
                }
            }
        }
    }

	void solve(std::istream& in, std::ostream& out) {
        in >> N >> M;
        edges.resize(N);
        REP(i, M) {
            int a, b;
            in >> a >> b;
            a--;b--;
            edges[a].pb(b);
            edges[b].pb(a);
        }
        dijkstra();
        vector<p> dists(N);
        REP(i, N) {
            dists[i] = p(d[i], i);
        }
        sort(dists.rbegin(), dists.rend());
        out << "Yes" << endl;
        vector<int> ans(N);
        for(auto node: dists) {
            int dist = node.first;
            int v = node.second;
            for(auto nv: edges[v]) {
                if (d[nv] < dist) {
                    ans[v] = nv + 1;
                    break;
                }
            }
        }
        REP(i, N-1) {
            out << ans[i+1] << endl;
        }
	}
};


int main() {
    ios::sync_with_stdio(false);
	DDoubleDots solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 11084
import java.util.*;

 class Main
 {
   public static void main(String args[])
   { 
     int[][][] i = new int[4][3][10];
     
    input(i);
    
    output(i);
   }
   static int[][][] input(int info[][][])
   {
     Scanner sc = new Scanner(System.in);
     
     int n = sc.nextInt();
    
     for(int i = 0; i < n; i ++)
     {
       int b = sc.nextInt();
       
       int f = sc.nextInt();
       
       int r = sc.nextInt();
       
       int v = sc.nextInt();
       
       info[b - 1][f - 1][r - 1] += v;
     }
     return info;
   }
   
   static void output(int info[][][])
   {
     for(int b = 0;b < 4;b ++)
     {
       if(b != 0){
         System.out.println("####################");
       }
       for(int f = 0;f < 3;f ++)
       {
         for(int r = 0;r < 10;r ++)
         {
           System.out.print(" " + info[b][f][r]);
         }
         System.out.println();
       }
     }
   }
 }
    
    


Measured memory_bytes: 29376
def calc_matrix_product(M, x, row, col):

    #res = list()

    for r in range(row):
        s = 0
        for c in range(col):
            s += M[r][c] * x[c]
        print(str(s))
        #res.append(s)
        # if r != row - 1:
        #     print(str(s))
        # else:
        #     print(str(s), end="")
        #     print("\n")


if __name__ == "__main__":
    param = input().split(" ")
    row = int(param[0])
    col = int(param[1])

    # create matrix
    M = list()
    r = row

    while(r > 0):

        param = input().split(" ")
        M.append([ int(a) for a in param ])

        r = r - 1

    #create vector
    c = col
    x = list()

    while( c > 0 ):

        param = input()

        x.append(int(param))

        c = c - 1

    calc_matrix_product(M, x, row, col)


Measured memory_bytes: 6008
#include <iostream>

using namespace std;

const int MOD = 1000000007;
char grid[1005][1005];
int dp[1005][1005];

int main() {
    int h, w;
    cin >> h >> w;
    for (int j = 0; j <= w; ++j) grid[0][j] = '#';
    for (int i = 1; i <= h; ++i) {
        grid[i][w] = '#';
        for (int j = 1; j <= w; ++j) cin >> grid[i][j];
    }
    dp[0][1] = 1;
    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) {
            if (grid[i][j] == '#') continue;
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
        }
    }
    cout << dp[h][w] << endl;
}


Measured memory_bytes: 5120
import sys
import math
import bisect

def solve(a, b, k):
    #print('%d %d %d' % (a, b, k))
    if k < a:
        a -= k
        k = 0
    else:
        k -= a
        a = 0
    #print('%d %d %d' % (a, b, k))
    if k < b:
        b -= k
        k = 0
    else:
        k -= b
        b = 0
    return (a, b)

def main():
    a, b, k = map(int, input().split())
    ans = solve(a, b, k)
    print('%d %d' % (ans[0], ans[1]))

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	string s, t;
	cin >> s >> t;

	set<int> ps[30];
	bool tcon[30] = { false };
	bool scon[30] = { false };

	rep(i, 0, SZ(t))
	{
		tcon[t[i] - 'a'] = true;
	}

	rep(i, 0, SZ(s))
	{
		scon[s[i] - 'a'] = true;
		ps[s[i] - 'a'].insert(i);
	}

	rep(i, 0, 30)
	{
		if (tcon[i] && !scon[i])
		{
			cout << -1 << endl;
			return 0;
		}
	}

	int p = *ps[t[0] - 'a'].begin();

	rep(i, 1, SZ(t))
	{
		auto itr = ps[t[i] - 'a'].upper_bound(p%SZ(s));
		if (itr == ps[t[i] - 'a'].end())
		{
			p = (p / SZ(s) + 1)*SZ(s) + (*ps[t[i] - 'a'].begin());
		}
		else
		{
			p += (*itr) - (p%SZ(s));
		}
	}

	cout << p + 1 << endl;

	return 0;
}

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

int main(){
   int K; cin >>K;
   if (((K%2)==0) || ((K%5)==0)){
      cout << -1;
   }
   
   else{
     if (K%7==0){K = K/7;}
      int compte = 1;
        unsigned long long int mult=1;
        
        while ((mult%K)!=0){
            mult=mult*10;
            mult+=1;
            mult= (mult%K); 
            compte+=1;
      }
      cout << compte;
   }
}








Measured memory_bytes: 3160
#include <iostream>
    #include <iomanip>
    #include <cmath>
    #include <queue>
    #include <map>
    #include <cstdlib>
    #include <algorithm>
    #include <utility>
    #include <queue>
    #include <string>
    #include <functional>
    #define rep(i, a, b) for(int i=a;i<b;++i)
    #define MOD 1000000007
    #define RAND 1000
    //#define LLONG_MIN -9223372036854775808
    using namespace std;
     
    bool Group(int a[], int n, int x)
    {
    	for (int i = 0; i < n; ++i) {
    		if (x == a[i])
    			return 1;
    	}
    	return 0;
    }
     
    int a[] = { 1, 3, 5, 7, 8, 10, 12 }, b[] = { 4, 6, 9, 11 }, c[] = { 2 };
     
    int main(void)
    {
    	int x, y;
    	cin >> x >> y;
    	if (Group(a, 7, x) && Group(a, 7, y)) {
    		cout << "Yes" << endl;
    		return 0;
    	}
    	if (Group(b, 4, x) && Group(b, 4, y)) {
    		cout << "Yes" << endl;
    		return 0;
    	}
    	if (Group(c, 1, x) && Group(c, 1, y)) {
    		cout << "Yes" << endl;
    		return 0;
    	}
    	cout << "No" << endl;
    	system("pause");
    	return 0;
    }

Measured memory_bytes: 504
name1,x1,y1=input().split()
name2,x2,y2=input().split()
name3,x3,y3=input().split()
name4,x4,y4=input().split()
name5,x5,y5=input().split()
name6,x6,y6=input().split()
name7,x7,y7=input().split()
name8,x8,y8=input().split()
name9,x9,y9=input().split()

x1=int(x1)
x2=int(x2)
x3=int(x3)
x4=int(x4)
x5=int(x5)
x6=int(x6)
x7=int(x7)
x8=int(x8)
x9=int(x9)

y1=int(y1)
y2=int(y2)
y3=int(y3)
y4=int(y4)
y5=int(y5)
y6=int(y6)
y7=int(y7)
y8=int(y8)
y9=int(y9)

print(name1,x1+y1,x1*200+y1*300)
print(name2,x2+y2,x2*200+y2*300)
print(name3,x3+y3,x3*200+y3*300)
print(name4,x4+y4,x4*200+y4*300)
print(name5,x5+y5,x5*200+y5*300)
print(name6,x6+y6,x6*200+y6*300)
print(name7,x7+y7,x7*200+y7*300)
print(name8,x8+y8,x8*200+y8*300)
print(name9,x9+y9,x9*200+y9*300)



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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

class NumberOfCase {
    public:
        // 初期化 O(n log m) m は素数
        // n : 求めたい組み合わせの最大値, m : 剰余(素数)
        NumberOfCase(ll n, ll m) : m_Size(n), m_Mod(m) {
            m_Fact = new ll[m_Size + 1];
            m_Inv = new ll[m_Size + 1];
            // 0! ～ m_Size! までの階乗を保管する配列の作成 (mod m_Mod をとってある)
            m_Fact[0] = 1;
            for(int i = 1; i <= m_Size; ++i) { m_Fact[i] = (m_Fact[i-1] * i) % m_Mod; }
            // m_Size! の逆元 1/m_Size! を二分累乗法で求める
            // フェルマーの小定理より a^-1 = a^(p-2) mod p -> (m_Size!)^-1 = (m_Size!)^(p-2) mod p
            m_Inv[m_Size] = ModPow(m_Fact[m_Size], m_Mod-2, m_Mod);
            // 以下 1 / (N-1)! = N / N! であることを利用
            for(int i = m_Size - 1; i >= 0; --i) { m_Inv[i] = (m_Inv[i + 1] * (i + 1)) % m_Mod; }
        }
        ~NumberOfCase() {
            delete[] m_Fact;
            delete[] m_Inv;
        }
        // 階乗 n! の取得 O(1)
        ll Factorial(ll n) { return m_Fact[n]; }
        // n! の逆元の取得 O(1)
        ll Inverse(ll n) { return m_Inv[n]; }
        // 順列 nPr の取得 O(1)
        ll Permutation(ll n, ll r) { return (m_Fact[n] * m_Inv[n - r]) % m_Mod; }
        // 組み合わせ nCr の取得 O(1)
        ll Combination(ll n, ll r) {
            ll ret = (m_Fact[n] * m_Inv[n - r]) % m_Mod;
            ret = (ret * m_Inv[r]) % m_Mod;
            return ret;
        }
        // 重複組み合わせ nHr の取得 O(1)
        ll Homogen(ll n, ll r) { return Combination(r+n-1, r); }
    private:
        // x の n 乗 を m で余りをとったもの O(log n)
        ll ModPow(ll x, ll n, ll mod) {
            ll res = 1;
            while ( n > 0) {
                if (n & 1) { res = res * x % mod; } // 最下位ビットが立っているときに x^(2^i) を掛ける
                x = x * x % mod;                    // x を順次 2 乗していく
                n >>= 1;
            }
            return res;
        }
    private:
        const ll    m_Size;     // 導出する範囲 (10^5 くらいまでにして欲しい)
        const ll    m_Mod;      // 剰余
        ll*         m_Fact;     // 階乗
        ll*         m_Inv;      // 逆元
};

ll N, K;

signed main()
{
    cin >> N >> K;
    ll cnt = 0;
    for(ll a = 1; a <= N; ++a) {
        ll b = K - (a % K);
        if((b + b) % K == 0) {
            ll pat = N / K;
            if(b + pat * K <= N) { pat++; }
            cnt += pat * pat;
        }
    }

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


Measured memory_bytes: 256
N = int(input())
import numpy as np
results = np.array([0,0,0,0])
for i in range(N):
  result = input()
  if result == 'AC':
    results[0]=results[0]+1
  elif result == 'WA':
    results[1]=results[1]+1
  elif result == 'TLE':
    results[2]=results[2]+1
  elif result == 'RE':
    results[3]=results[3]+1
print("AC x "+str(results[0]))
print("WA x "+str(results[1]))
print("TLE x "+str(results[2]))
print("RE x "+str(results[3]))

Measured memory_bytes: 27128
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[N];
        int[] B = new int[M];
        for(int i=0;i<N;i++){
            A[i] = sc.nextInt();
        }
        for(int i=0;i<M;i++){
            B[i] = sc.nextInt();
        }
        Arrays.sort(A);
        Arrays.sort(B);
        int maxnum = N * M;
        int reg,reg2;
        long sum = 1;
        int Mlarge = 0;
        int Nlarge = 0;
        while(maxnum > 0){
            reg = 0;
            reg2 = 0;
            if(Arrays.binarySearch(A, maxnum) >= 0 && Arrays.binarySearch(B, maxnum) >= 0){
                maxnum--;
                Mlarge++;
                Nlarge++;
            }else if(Arrays.binarySearch(A, maxnum) >= 0){
                sum *= Mlarge;
                sum = sum % 1000000007;
                maxnum--;
                Nlarge++;
            }else if(Arrays.binarySearch(B, maxnum) >= 0){
                sum *= Nlarge;
                sum = sum % 1000000007;
                maxnum--;
                Mlarge++;
            }else{
                sum *= (Nlarge * Mlarge - (N * M - maxnum));
                sum = sum % 1000000007;
                maxnum--;
            }
        }
        System.out.println(sum % 1000000007);
    }
}

Measured memory_bytes: 30272
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;

int main() {
    fast();
    // ll t;
    // cin>>t;
    // while(t--)			
    // {
         
    // }
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=max(a*c,b*d);
    ans=max(ans,max(a*d,b*c));
    cout<<ans;
}



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

int main() {

	string S;
	bool check = true;

	cin >> S;

	for (int i = 0; i < S.size() - 1; i++) {

		for (int j = i + 1; j < S.size(); j++) {

			if (S[i] == S[j]) {

				check = false;
				break;

			}

		}

	}

	if (check)cout << "yes" << endl;
	else cout << "no" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
	int N, T;
	cin >> N >> T;
	int minA = 1e9;
	int maxDiff = 0;
	int num = 0;
	for( int i = 0; i < N; ++i )
	{
		int A;
		cin >> A;

		int diff = A - minA;
		if( diff > maxDiff )
		{
			maxDiff = diff;
			num = 1;
		}
		else if( diff == maxDiff )
		{
			++num;
		}

		if( A < minA )
		{
			minA = A;
		}
	}
	cout << num << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  int D;
  cin>>D;
  if(D==25){
    cout<<"Christmas"<<endl;
  }
  else if(D==24){
  cout<<"Christmas Eve"<<endl;
  }
  else if(D==23){
    cout<<"Christmas Eve Eve"<<endl;
  }
  else if(D==22){
    cout<<"Christmas Eve Eve Eve"<<endl;
  }
  
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<string> blue(n);
	for (int i = 0; i < n; i++) {
		cin >> blue[i];
	}

	int m;
	cin >> m;
	vector<string> red(m);
	for (int i = 0; i < m; i++) {
		cin >> red[i];
	}

	int ans = 0;
	auto calc = [&](string s) {
		int buf = 0;
		for (string t : blue) {
			if (t == s) buf++;
		}
		for (string t : red) {
			if (t == s) buf--;
		}
		return buf;
	};
	
	for (string t : blue) {
		ans = max(ans, calc(t));
	}

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

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

int q(int x) {
	if (x < 0) return x * -1;
	return x;
}

int main() {
	vector<int> o(5);
	int k, w = 0;
	rep(i, 5) {
		cin >> o[i];
	}
	cin >> k;
	rep(i, 5) {
		rep(j, 4) {
			if (q(o[i] - o[j])>k) {
				w++;
			}
		}
	}
	if (w == 0) {
		cout << "Yay!" << endl;
	}
	else {
		cout << ":(" << endl;
	}
}

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;
using P = pair<int,int>;
const int INF = 1001001001;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h1, h2, m1, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int h = k / 60;
  int m = k % 60;
  int res = (h2 - h - h1) * 60 + m2 - m - m1;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3652
<?php

fscanf(STDIN, '%d %d', $X, $Y);

$tsuru = 2;
$kame = 4;

$ok = false;
for ($i=0; $i <= $X; $i++) {
    if ($tsuru * $i + $kame * ($X - $i) === $Y) {
        $ok = true;
        break;
    }
}

if ($ok) {
    echo 'Yes';
} else {
    echo 'No';
}

echo PHP_EOL;


Measured memory_bytes: 16188
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author kishore
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int size = in.nextInt();
            int[] arr = new int[size];
            int sum = 0;
            for (int i = 0; i < size; i++) {
                arr[i] = in.nextInt();
                sum += arr[i];
            }
            sum = Math.round(sum / (float) size);
            int res = 0;
            for (int i = 0; i < size; i++) {
                int diff = arr[i] - sum;
                res += diff * diff;
            }
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
program garden
  integer n,ans,i,flag
  integer,allocatable :: h(:)

  read *, n
  allocate(h(n))
  read *, h
  ans = 0
  do while (maxval(h) > 0)
    flag = 0!search flowers to water
    do i = 1, n
      if (h(i) /= 0 .and. flag == 0) then
        h(i) = h(i) - 1
        flag = 1!watering now
        ans = ans + 1
      else if (h(i) /=0 .and. flag == 1) then
        h(i) = h(i) - 1
      else if (h(i) == 0 .and. flag == 1) then
        exit
      end if
    end do
  end do
  print '(i0)', ans


end program garden

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    stack<int> st;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(!st.empty() && s[i] == '0' && st.top() == 1){
            st.pop();
            cnt++;
        }
        else if(!st.empty() && s[i] == '1' && st.top() == 0){
            st.pop();
            cnt++;
        }else if(s[i] == '1') st.push(1);
        else if(s[i] == '0') st.push(0);
    }
    cout << cnt * 2 << endl;
    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <stack>
#include <queue>

typedef long long ll;
using namespace std;

int main(){
  ll n,k,i,j,d,e;
  cin >> n >> k;
  vector<ll> a(n);
  for(i=0;i<n;i++)cin >> a[i];
  ll ret = 0;
  for(d=45;d>=-1;d--){
    if(d != -1 && !(k & (1LL<<d))) continue;
    /*
      dはxとkが初めて異なる値になったbit
      k & (1LL<<d)になった時はkのdbit目が1
      d=-1はkとxがすべて一致した場合
    */
    ll tmp = 0;
    for(e=45;e>=0;e--){
      ll mask = 1LL<<e;
      ll cnt = 0LL;
      for(i=0;i<n;i++){
        if(mask & a[i])cnt++;
      }
      if(e>d){
        if(k & mask)tmp+=(n-cnt)*mask;
        else tmp+=cnt*mask;
      }else if(e==d){
        tmp += mask*cnt;
      }else{
        tmp += mask*max(cnt,n-cnt);
      }
    }
    ret = max(ret,tmp);
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
bool dp[2][2500][2500];

int main(){
  int n;
  cin>>n;
  int p[51];
  for(int i=0;i<n;i++)cin>>p[i];



  int ans=10000000;
  dp[1][0][0]=1;
  for(int i=0,sum=0;i<n;i++){
    sum+=p[i];
    for(int j=0;j<2500;j++)
      for(int k=0;k<2500;k++){
	dp[i%2][j][k] |=dp[(i+1)%2][j][k];
	if(j>=p[i])dp[i%2][j][k] |=dp[(i+1)%2][j-p[i]][k];
	if(k>=p[i])dp[i%2][j][k] |=dp[(i+1)%2][j][k-p[i]];
	if(i==n-1&&dp[i%2][j][k]) ans=min(ans,max(j,max(k,sum-j-k)));
      }
  }
  
  cout <<ans<<endl;

  return 0;
}

Measured memory_bytes: 13372
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <cstdio>

using namespace std;

int main(){
    int n, k; cin >> n >> k;
    cout << (n%k ? 1 : 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,r) for((i)=(l);(i)<(r);(i)++)
using namespace std;
int main(){
	int n,i,ng=0,buf,a1=-1,a2=-1,b1=-1,b2=-1;
	cin>>n;
    int a[n];
    rep(i,0,n){
        cin>>a[i];
        if(i!=0&&buf>a[i]){
            ng++;
            if(ng==1){
                a1=i-1;
                b1=i;
            }
            else if(ng==2){
                a2=i-1;
                b2=i;
            }
        }
        buf=a[i];
    }
    if(ng==0||(ng==1&&(a[a1-1]<=a[b1])&&(a[a1]<=a[b1+1]))){
        cout<<"YES"<<endl;
        return 0;
    }
    else if(ng==2&&(a[a2]<=a[a1])&&(a[b2]<=a[b1])){
        cout<<"YES"<<endl;
        return 0;
    }
	cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
using namespace std;


int main() {
    int n,k;
    cin>>n>>k;
    double prob=0;
    for(int i=1;i<=n;++i){
        int tmp=i;
        double cur=1;
        while(tmp<k){
            tmp*=2;
            cur/=2;
        }
        prob+=cur;
    }
    cout.precision(17);
    cout<<prob/n<<endl;
    return 0;
}


Measured memory_bytes: 256
// OURL: https://atcoder.jp/contests/abc140/tasks/abc140_a
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));  }

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v);  }

template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", ";  } first = false; res += to_string(x);  } res += "}"; return res;  }

string to_string(string s) { return '"' + s + '"';  }
string to_string(const char* s) { return to_string((string) s);  }
string to_string(bool b) { return (b ? "true" : "false");  }
string to_string(vector<bool>::reference b) { return to_string(bool(b));  }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";  }
template <typename A>
string to_string(vector<vector<A>> v) { string res; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res; }

void debug_out() { cerr << endl;  }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...);  }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

  int n;
  cin >> n;

  cout << pow(n, 3) << endl;

  return 0;
}


Measured memory_bytes: 256
N = input()
N = int(N)
s = [[ i for i in input().split()] for i in range(N)]
for i in range(N):
    s[i][1] = int(s[i][1])
    s[i].append(i + 1)
sorteds = sorted(s, key=lambda x:x[1],reverse = True)
sorteds.sort(key=lambda x:x[0])


for k in sorteds:
  print(k[2])


Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
char a[10000];
int main()
{
    int i,j,len,u=0;
    scanf("%s",a);
    len=strlen(a);
    for(i=1;i<=((len-1)/2);i++)
    {
        j=len-i+1;
        if(a[i-1]!=a[j-1])
        {
            u=1;
            break;
        }
    }
    for(i=1;i<=(((len-1)/2)/2);i++)
    {
        j=((len-1)/2)-i+1;
        if(a[i-1]!=a[j-1])
        {
            u=1;
            break;
        }
    }
    for(i=((len+3)/2);i<=(((len+3)/2)+(((len-1)/2)/2)-1);i++)
    {
        j=len-i+1;
        if(a[i-1]!=a[j-1])
        {
            u=1;
            break;
        }
    }
    if(u==1)
        printf("No\n");
    else
        printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <atcoder/all>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

using namespace atcoder;

int op(int a,int b){
    return max(a,b);
}

int e(){
    return -1;
}

int target;

bool f(int v){
    return v<target;
}

int main(){
    int n,q;
    cin >> n >> q;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    }
    segtree<int,op,e> seg(a);
    
    rep(i,q){
        int t;
        cin >> t;
        if(t==1){
            int x,v;
            cin >> x >> v;
            x--;
            seg.set(x,v);
        }
        if(t==2){
            int l,r;
            cin >> l >> r;
            l--;
            cout << seg.prod(l,r) << endl;
        }
        if(t==3){
            int x,v;
            cin >> x >> v;
            x--;
            target=v;
            cout << seg.max_right<f>(x)+1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 6204
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7


def ns(): return stdin.readline().rstrip()


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


N = ni()
K = ni()
x = na()
ans = 0
for xi in x:
    ans += min(2 * xi, 2 * abs(xi - K))
print(ans)


Measured memory_bytes: 3316
#10
#33 18 45 28 8 19 89 86 2 4

n = int(input().rstrip("\n"))
a = [int(_) for _ in input().rstrip("\n").split(" ")]
a.sort()
from collections import defaultdict

counter = defaultdict(int)

limit = 10 ** 6
for num in a:
  counter[num] += 1
  if counter[num] >= 2:
    continue
  current = num
  while current <= limit:
    current += num
    counter[current] += 1

answer = 0
for num in a:
  if counter[num] == 1:
    answer += 1

#print(counter)
print(answer)


Measured memory_bytes: 101968
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastReader sc = new FastReader();
        int n = sc.nextInt();
        int[] group = new int[n + 1];

        for (int i = 0; i < n - 1; i++) {
            group[sc.nextInt()]++;
        }

        for (int i = 1; i < group.length; i++) {
            System.out.println(group[i]);
        }

        System.exit(0);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try{
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 56680
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
//#define rep(i, n) for(int (i) = 0, TmP = (n); (i) < (int)TmP ; ++(i))
//#define int long long
#define asort(v, n) sort((v), (v + n)) //Using array
#define vsort(v) sort((v).begin(), (v).end()) // Using vector
#define vint vector<int>

using namespace std;

signed main(){
  int n, m; 
  int a[10005];
  cin >> n >> m;
  rep(i, m){
    cin >> a[i];
  }

  rep(i, m){
    n -= a[i];
  }

  if(n >= 0)cout << n << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 3656
l = list(map(int,input().split()))
l.sort()
if l[0]==l[1]:
    if l[1] != l[2]:
        print("Yes")
    else:
        print("No")
elif l[1] == l[2]:
    if l[0] != l[1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")



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

int main()
{
	int a[3];
	int b=0,c=0;
    cin>>a[0]>>a[1]>>a[2];
        for(int i=0;i<3;i++){
            if(a[i]==5)
            b++;
        else
            if(a[i]==7)
            c++;
        }
        if(b==2&&c==1)
            cout <<"YES"<<endl;
        else
            cout<<"NO"<<endl;

return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
int main()
{
	string s;
	map<string,int> mp;
	mp["SUN"]=7;
	mp["SAT"]=1;
	mp["MON"]=6;
	mp["TUE"]=5;
	mp["WED"]=4;
	mp["THU"]=3;
	mp["FRI"]=2;
	cin>>s;
	cout<<mp[s]<<endl;
	return 0;
}

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


int main(){
	
	//ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    
	int t;
	cin>>t;
	if(t==1){
		cout<<"0";
	}else{
		cout<<"1";
	}
	return 0;
}

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

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  int rest;
  rest = C-(A-B);
  if (rest > 0){
    cout << rest <<endl;
  }
  else{
    cout << 0 << endl;
  }
}
  

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/

int32_t main()
{
	fastio();
	int n,m;
	cin>>n>>m;
	cout<<(n*(n-1))/2+((m-1)*m)/2<<endl;
}


Measured memory_bytes: 384
N,K=map(int,input().split())
p=list(map(int,input().split()))
for i in range(N):
  p[i] = (p[i]+1)/2
C = [ 0 for _ in range(N+1) ]
C[0] = 0
for i in range(1,N+1):
  C[i] = p[i-1] + C[i-1]
ans = 0
for i in range(0,N-K+1):
  ans = max( C[i+K]-C[i], ans )
print(ans)



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

using namespace std;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }

template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }

using int64 = long long;
const int INF = (1 << 30) - 1;
const int mod = (int) (1e9 + 7);

struct Bipartite_Matching {
  vector< vector< int > > graph;
  vector< int > match, alive, used;
  int timestamp;

  Bipartite_Matching(int n) {
    timestamp = 0;
    graph.resize(n);
    alive.assign(n, 1);
    used.assign(n, 0);
    match.assign(n, -1);
  }

  void add_edge(int u, int v) {
    graph[u].push_back(v);
    graph[v].push_back(u);
  }

  bool dfs(int v) {
    used[v] = timestamp;
    for(int i = 0; i < graph[v].size(); i++) {
      int u = graph[v][i], w = match[u];
      if(alive[u] == 0) continue;
      if(w == -1 || (used[w] != timestamp && dfs(w))) {
        match[v] = u;
        match[u] = v;
        return (true);
      }
    }
    return (false);
  }

  int bipartite_matching() {
    int ret = 0;
    for(int i = 0; i < graph.size(); i++) {
      if(alive[i] == 0) continue;
      if(match[i] == -1) {
        ++timestamp;
        ret += dfs(i);
      }
    }
    return (ret);
  }
};

int main() {
  int N, A[100], B[100];
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }
  Bipartite_Matching flow(N + N);
  for(int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    for(int j = 0; j < N; j++) {
      if(A[j] < x && B[j] < y) {
        flow.add_edge(j, i + N);
      }
    }
  }
  cout << flow.bipartite_matching() << endl;
}



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

int checkPalindrome(string s)
{
	int n = s.length();
	string ans = ""; 
	for (int i = n - 1; i >= 0; i--){
		ans += s[i];
	}
	if (s == ans) return 1;
	return 0;
}

int checkStrongPalindrome(string s)
{
	if (checkPalindrome(s) == 0) return 0;
	int n = s.length();
	string ans = "";
	for (int i = 0; i < (n - 1) / 2; i++){
		ans += s[i];
	}
	if (checkPalindrome(ans) == 0) return 0;
	return 1;
}

int main()
{
	//freopen("main.inp", "r", stdin);
	//freopen("main.out", "w", stdout);
	string s;
	cin >> s;
	if (checkStrongPalindrome(s)) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256