akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<complex>
#include<vector>
#include<iomanip>

using namespace std;

typedef complex<double> P;

#define EPS 1e-9
#define shosu(x) fixed<<setprecision(x)

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
  L(){;}
};
struct C{
  P c;double r;
  C(const P &c,double r):c(c),r(r){}
};

namespace std{//演算子の定義
  bool operator < (const P& a,const P& b){
    return real(a)!= real(b) ? real(a) < real(b) : imag(a) < imag(b);
    //return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b)
  }
  bool operator == (const P& a,const P& b){
    return a.real()==b.real() && a.imag()==b.imag();
  }
}

double dot(P a,P b){
  return real(conj(a)*b);
}

double cross(P a,P b){
  return imag(conj(a)*b);
}

int ccw(P a, P b, P c) {//3点の関係性
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;                               // a--c--b on line
}

P projection(L l, P p){//pの直線l上の射影の点
  double t=dot(p-l[0],l[0]-l[1])/norm(l[0]-l[1]);
  return l[0]+t*(l[0]-l[1]);
}

P reflection(L l, P p){//点pの直線lに関して対称な点
  return p+2.0*(projection(l,p)-p);
}

bool isOrthogonal(L l1, L l2){//2直線の直交判定
  return fabs(dot(l1[1]-l1[0],l2[1]-l2[0])) < EPS;
}

bool isParallel(L l1, L l2){//2直線の平行判定
  return fabs(cross(l1[1]-l1[0],l2[1]-l2[0])) < EPS;
}

P inP(){
  double x,y;
  cin >> x >> y;
  P p(x,y);
  return p;
}

L inL(){
  P p1=inP();
  P p2=inP();
  L l(p1,p2);
  return l;
}

int main(){

  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    L l1,l2;
    l1=inL();
    l2=inL();
    /*
    L l1=inL();
    L l2=inL();
    */
    if(isOrthogonal(l1,l2)){
      cout<<1<<endl;
    }else if(isParallel(l1,l2)){
      cout<<2<<endl;
    }else{
      cout<<0<<endl;
    }
  }

}



Measured memory_bytes: 3216
#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>;

int main() {
    int n, k, x;
    cin >> n >> k;
    int a[n];
    rep(i,n) {
        cin >> x;
        a[i] = -x;
    }
    sort(a, a+n);
    int ans = 0;
    rep(i,k) {
        ans += -a[i];
    }
    cout << ans << endl;
}

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

int main(){
    int n; cin >> n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    rep(i, n){
        string res; cin >> res;
        if(res == "AC") ac++;
        else if(res == "WA") wa++;
        else if(res == "TLE") tle++;
        else if(res == "RE") re++;
    }

    printf("AC x %d\n", ac);
    printf("WA x %d\n", wa);
    printf("TLE x %d\n", tle);
    printf("RE x %d\n", re);

    return 0;
}

Measured memory_bytes: 3720
#include<iostream>
using namespace std;
int a[500000];
int i;
int h;
void maxheapify(int i) {
	int largest;
	int l = i * 2 + 1;
	int r = i * 2 + 2;
	if (l < h&&a[i] < a[l]) {
		largest = l;
	}
	else largest = i;
	if (r < h&&a[largest] < a[r]) {
		largest = r;
	}
	if (largest != i) {
		swap(a[largest], a[i]);
		maxheapify(largest);
	}


}
void builedMaxheap() {
	for (int j = h / 2; j >= 0; j--) {
		maxheapify(j);
	}
}
int main() {
	cin >> h;
	for (int k = 0; k < h; k++) {
		cin >> a[k];
	}
	builedMaxheap();
	for (int k = 0; k < h; k++) {
		cout << " " << a[k];
	}
	cout << endl;
	return 0;
}

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

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

  rep(i, 10) rep(j, 10) {
    if (i * j == N) {
      puts("Yes");
      return 0;
    }
  }

  puts("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
int main(){
    double N;
    cin>>N;
    cout << fixed << setprecision(10);//double型を今後小数第10位まで出力 
    for(int i=1;i<=3500;i++){
        for(int j=1;j<=3500;j++){
            double h = i;
            double n = j;
            double w =1/(4/N-1/h-1/n);
            if(abs(w-round(w))<=0.000000001 && w>0 && w<=3500){
                cout<<i<<" "<<j<<" "<<int64_t(round(w))<<endl;
                return 0;
            }
        }
    }
}

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

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> pl;

ld const PI = 4*atan((ld)1);

int const N = 303;

int n;
ld dp[N][N][N];

ld solve(ll a, ll b, ll c)
{
	if (a < 0 || b < 0 || c < 0)
		return 0;

	if (dp[a][b][c] != -1)
		return dp[a][b][c];	

	ld res = (n * 1.0) / ((a + b + c) * 1.0);
	if (a) res += (a * 1.0) / ((a+b+c) * 1.0) * solve(a-1, b, c);
	if (b) res += (b * 1.0) / ((a+b+c) * 1.0) * solve(a+1, b-1, c);
	if (c) res += (c * 1.0) / ((a+b+c) * 1.0) * solve(a, b+1, c-1);

	return dp[a][b][c] = res;
}

int main()
{
	fastio;

	cin >> n;

	int a, b, c;
	a = b = c = 0;

	for (int i = 0; i < n; ++i)
	{
		int k;
		cin >> k;

		if (k == 1) a++;
		else if (k == 2) b++;
		else c++;
	}

	for (int i = 0; i < N; ++i)
		for (int j = 0; j < N; ++j)
			for (int k = 0; k < N; ++k)
				dp[i][j][k] = -1;
	dp[0][0][0] = 0;

	cout << fixed << setprecision(15) << solve(a, b, c) << '\n';
	return 0;
}


Measured memory_bytes: 438536
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
#define MOD (ll)(1e9+7)
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


struct unionfind {
    vector<int> par;
    vector<int> sizes;

    unionfind(int n) : par(n),sizes(n,1){
        rep(i,0,n) par[i] = i;
    }

    int root(int x){
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x,int y){
        x = root(x);
        y = root(y);

        if(x == y) return;

        if(sizes[x] < sizes[y] ) swap(x,y);

        par[y] = x;
        sizes[x] += sizes[y];
        sizes[y] = 0;

        return;
    }

    bool same(int x,int y){
        return root(x) == root(y);
    }

    int size(int x){
        return sizes[root(x)];
    }
};

signed main(){
    ll n,m,k;
    cin >> n >> m >> k;
    unionfind uni(n);
    ll cnt[n] = {};

    rep(i,0,m){
        ll a,b;
        cin >> a >> b;
        a--;b--;
        uni.unite(a,b);
        cnt[a]--;
        cnt[b]--;
    }


    rep(i,0,k){
        ll c,d;
        cin >> c >> d;
        c--;d--;
        if(uni.same(c,d)){
            cnt[c]--;
            cnt[d]--;
        }
    }

    rep(i,0,n){
        cout << uni.size(i) + cnt[i] - 1 << ((i == n-1?"":" ")); 
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2432
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int n,tmp,min,num;
  scanf("%d",&n);
  vector<int> a(100001,0);
  for (int i = 0; i < n; i++) scanf("%d",&a[i]);
  sort(a.begin(),a.begin()+n);
  min = abs(a[n-1]/2 - a[0]);
  num = a[0];
  for (int i = 1; i < n - 1; i++) {
    tmp = abs(a[n-1]/2 - a[i]);
    if (tmp <= min) {
      num = a[i];
      min = tmp;
    }
  }
  printf("%d %d\n",a[n-1],num);
  return 0;
}

Measured memory_bytes: 640
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()
A = iln()

odd_count = 0
for a in A:
    if a % 2 == 1:
        odd_count += 1

print('YES' if odd_count % 2 == 0 else 'NO')

Measured memory_bytes: 16108
import sys

input = sys.stdin.readline

n, q = map(int, input().split(" "))
s = input()
cnt = 0
place_of_AC = [0] * n

for i in range(len(s) - 1):
  place_of_AC[i]=cnt
  if s[i:i+2] == "AC":
    cnt += 1


#print(place_of_AC)
  
for _ in range(q):
  l, r = map(int, input().split(" "))
  out = place_of_AC[r-1] - place_of_AC[l-1]
  print(out)

Measured memory_bytes: 52952
//By Vlgd
#include<bits/stdc++.h>
using namespace std;
//bool E[N];
int gcd(int x,int y){
	if(y==0) return x;
	else return gcd(y,x%y);
} 
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	if(a<b) swap(a,b);
	printf("%d\n",gcd(a,b));
}


Measured memory_bytes: 3156
// F - Minimum Bounding Box
#include <bits/stdc++.h>

using namespace std;

#define	EPS	1e-9

int n;
vector<pair<long long, long long> > p, m;

double func(double t)
{
	double minx = 1e18, miny = 1e18, maxx = -1e18, maxy = -1e18;
	for (int i = 0; i < n; i++) {
		double x = p[i].first + t * m[i].first, y = p[i].second + t * m[i].second;
		minx = min(minx, x); maxx = max(maxx, x);
		miny = min(miny, y); maxy = max(maxy, y);
	}
	return (maxx - minx) * (maxy - miny);
}

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

	cin >> n;
	for (int i = 0; i < n; i++) {
		long long x, y;
		string s;
		cin >> x >> y >> s;
		p.resize(n), m.resize(n);
		p[i] = make_pair(x, y);
		if (s[0] == 'R')      m[i] = make_pair(1, 0);
		else if (s[0] == 'L') m[i] = make_pair(-1, 0);
		else if (s[0] == 'U') m[i] = make_pair(0, 1);
		else if (s[0] == 'D') m[i] = make_pair(0, -1);
	}

	double l = 0, r = 1e9;
	for (int k = 0; k < 100; k++) {
		double m1 = l + (r - l) / 3, m2 = r - (r - l) / 3;
		if (func(m1) > func(m2)) l = m1;
		else r = m2;
	}
	double ans = func((l + r) / 2);

	cout << fixed << setprecision(15) << ans << endl;

	return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s; cin >> s;
	int a = -1, z = -1;
	for (int i = 0; i < s.size(); i++)
	{
		if(s[i] == 'A' && a == -1) a = i;
		else if(s[i] == 'Z') z = i;
	}

	cout << z - a + 1 << endl;
	return 0;
}


Measured memory_bytes: 3736
a = map(int, raw_input().split())
N = a[0]
W = a[1]

class Item(object):
    def __init__(self,v,w):
        self.v = v
        self.w = w

Items = [Item(0,0)]
for i in xrange(N):
    a = map(int,raw_input().split())
    Items.append(Item(a[0],a[1]))

C = [ [0] * (W+1) for _ in xrange(N+1)]
G = [ [''] * (W+1) for _ in xrange(N+1)] 

def knapsack():
    for i in xrange(1,N+1):
        for w in xrange(1,W+1):
            if Items[i].w <= w:
                if Items[i].v + C[i-1][w-Items[i].w] > C[i-1][w]:
                    C[i][w] = Items[i].v + C[i-1][w-Items[i].w]
                    G[i][w] = 'DIAGONAL'
                else:
                    C[i][w] = C[i-1][w]
                    G[i][w] = 'TOP'
            else:
                C[i][w] = C[i-1][w]
                G[i][w] = 'TOP'

    print C[N][W]
    return 0

knapsack()

Measured memory_bytes: 31304
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
    a = str(input())
    if  a == "AC":
        ac +=1
    elif a == "WA":
        wa+=1
    elif a == "TLE":
        tle+=1
    elif a == "RE":
        re+=1
print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re)



Measured memory_bytes: 9200
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    ll sum=0;
    vector <ll> p(a),q(b),r(c);
    rep(i,a)
    cin>>p[i];
    rep(i,b)
    cin>>q[i];
    rep(i,c)
    cin>>r[i];
    int cnt=0;
    ll summ=0;
    vector <pair <ll,ll> > ha;
    rep(i,a)
    ha.pb({p[i],1});
    rep(i,b)
    ha.pb({q[i],2});
    rep(i,c)
    ha.pb({r[i],0});
    sort(all(ha));
    reverse(all(ha));
    for (int i=0;i<ha.size();i++)
    {
        if (ha[i].se==1&&x==0)
            continue;
        if (ha[i].se==2&&y==0)
            continue;
      //  cout<<ha[i].fi<<" "<<ha[i].se<<" "<<x<<" "<<y<<'\n';
        if (ha[i].se!=0)
        {
            if (cnt<x+y-1)
            {
                if (ha[i].se==1) {
                    x--;
                }
                else
                    y--;
                sum+=ha[i].fi;
            }
            else
            {
               sum+=summ+ha[i].fi;
               break;
            }
        }
        else
        {
            cnt++;
            summ+=ha[i].fi;
            if (cnt==x+y)
            {
              sum+=summ;
              break;
            }
        }
    }
    cout<<sum;




}

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

#define N 123456

using namespace std;

int main()
{
  int n, cnt;
  bool a[2*N+1];
  fill(a, a+(2*N+1), true);
  a[0] = a[1] = false;

  for(int i = 2; i <= 2*N; i++)
    if(a[i])
      for(int j = i+i; j <= 2*N; j+=i)
	a[j] = false;
  
  while(cin>>n && n){
    cnt = 0;
    for(int i = n+1; i <= 2*n; i++)
      if(a[i]) cnt++;

    cout << cnt << endl;
  }

  return 0;
}

Measured memory_bytes: 0
h, w = map(int, input().split())
s = [['.'] + list(input()) + ['.'] for _ in range(h)]
s.insert(0, ['.'] * (w + 2))
s.append(['.'] * (w + 2))
direction = [(-1, 0), (0, -1), (1, 0), (0, 1)]

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if s[i][j] == '#':
            if all(s[i + dx][j + dy] == '.' for dx, dy in direction):
                print('No')
                exit()

print('Yes')

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

const int INF = 1001001001;

int main(){
	int n, in;
	ll ans = 0;
	
	cin >> n;
	vector<vector<int>> vi(n, vector<int>(n, 0));
	rep(i, n){
		rep(j, n){
			cin >> in;
			vi.at(i).at(j) = in;
			if(j > i)ans += in;
		}
	}
	rep(k, n){
		rep(i, n){
			for(int j = i+1; j < n; j++){
				if(vi[i][j] != INF && vi[i][j] > vi[i][k] + vi[k][j]){
					//cerr << i << j << k << endl;
					//cerr << vi[i][j] << " " << vi[i][k] + vi[k][j] << endl;
					cout << -1 << endl;
					return 0;
				}else if(vi[i][j] != INF && vi[i][j] == vi[i][k] + vi[k][j] && i != k && j != k){
					//cerr << i << j << k << endl;
					//cerr << vi[i][j] << endl;
					ans -= vi[i][j];
					vi[i][j] = INF;
					vi[j][i] = INF;
				}
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
//#include<fstream>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define endl '\n'
#define pb push_back
#define fi first
#define se second
typedef long long ll;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define all(con) con.begin(),con.end()
#define w(x) int x; cin>>x; while(x--)
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

/*ofstream fout("bcount.out");
ifstream fin("bcount.in");*/

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cout<<fixed<<setprecision(8);
    int n;
    cin>>n;
    vector<pii>v;
    rep(i,0,n)
    {
        int a,b;
        cin>>a>>b;
        v.pb({a,b});
    }
    for(int i = 1;i<n-1;i++)
    {
        if(v[i].fi == v[i].se && v[i-1].fi == v[i-1].se && v[i+1].fi == v[i+1].se)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3656
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

#include<bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
//#define hell          1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
// mp::cpp_int
#define pp pair<pii,pii>
const int hell =1000000007;




int solve( ){

int n,k;
cin>>n>>k;
vi a(n);
rep(i,0,n)cin>>a[i];

int dp[n]={0};
//rep(i,0,n)dp[i]=1e9+5;


rep(i,1,min(k,n))
{
  dp[i]=abs(a[i]-a[0]);
}

rep(i,k,n)
{  
    int mn=hell;

    rep(j,i-k,i)mn=min(mn,dp[j]+abs(a[i]-a[j]));
    dp[i]=mn;
}
cout<<dp[n-1];



return 0;
}

signed main()
{  int t=1;
 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   cin.exceptions(cin.failbit);


  clock_t time_req;

    // Without using pow function
    time_req = clock();
    
//cin>>t;

    int k=1;
   while(t--)
     {
       //cout<<"case #"<<k<<":"<<" ";k++;
      solve();
     }

         time_req = clock() - time_req;
 //cout << "Processor time taken is "
   // << (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;


    return 0;
}


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

#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define ST(n) sort(n.begin(),n.end())

using namespace std;
typedef long long ll;

int main(){
	int N,M;
	cin >> N >> M;
	int X[M];
	REP(i,M)cin >> X[i];
	sort(X,X+M);
	int feed[M-1];
	for(int i = 1;i < M;++i){
		feed[i-1]=X[i]-X[i-1];
	}
	sort(feed,feed+M-1);
	int ANS=0;
	for(int i=0;i<M-N;i++)ANS+=feed[i];
	cout << ANS << endl;
}

Measured memory_bytes: 1024
A,B,C,D=input().split()
A=int(A)
B=int(B)
C=int(C)
D=int(D)
if (1<=A<=100)and(1<=B<=100)and(1<=C<=100)and(1<=D<=100):
    while (A>0)and(C>0):
        C=C-B
        if C<=0:
            break
        A=A-D
    if C<=0:
        print("Yes")
    if A<=0:
        print("No")

Measured memory_bytes: 9140
#include<stdio.h>
#include<map>
using namespace std;
int k1[262144],b1[262144],k2[262144],b2[262144];
char s[262144];
map<long long,int> qaq;
int main()
{
	int n;
	scanf("%d",&n);
	scanf("%s",s+1);
	k1[0]=1;
	b1[0]=0;
	k2[0]=1;
	b2[0]=0;
	for(int i=1;i<=n;i++)
	{
		if(s[i]=='+')
		{
			k1[i]=k1[i-1];
			b1[i]=b1[i-1]+k1[i-1];
			if(b1[i]>=998244353)
			{
				b1[i]-=998244353;
			}
			k2[i]=k2[i-1];
			b2[i]=b2[i-1]+k2[i-1];
			if(b2[i]>=1000000007)
			{
				b2[i]-=1000000007;
			}
		}
		else if(s[i]=='-')
		{
			k1[i]=k1[i-1];
			b1[i]=b1[i-1]-k1[i-1];
			if(b1[i]<0)
			{
				b1[i]+=998244353;
			}
			k2[i]=k2[i-1];
			b2[i]=b2[i-1]-k2[i-1];
			if(b2[i]<0)
			{
				b2[i]+=1000000007;
			}
		}
		else if(s[i]=='>')
		{
			k1[i]=(long long)k1[i-1]*19260817%998244353;
			b1[i]=b1[i-1];
			k2[i]=(long long)k2[i-1]*19491001%1000000007;
			b2[i]=b2[i-1];
		}
		else
		{
			k1[i]=(long long)k1[i-1]*494863259%998244353;
			b1[i]=b1[i-1];
			k2[i]=(long long)k2[i-1]*301354971%1000000007;
			b2[i]=b2[i-1];
		}
	}
	long long ans=0;
	for(int i=0;i<=n;i++)
	{
		ans+=qaq[(long long)b1[i]*1000000007+b2[i]];
		int val1=((long long)k1[i]*b1[n]+b1[i])%998244353;
		int val2=((long long)k2[i]*b2[n]+b2[i])%1000000007;
		qaq[(long long)val1*1000000007+val2]++;
	}
	printf("%lld\n",ans);
	return 0;
}

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

const ll INF = (1LL<<60);

int main(){

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

    cout << t+s << endl;

    return 0;
}

Measured memory_bytes: 256
function Main(s) {
	s = s.split(" ").map(a => parseInt(a));
	var h = s[0] - 1;
	var w = s[1] - 1;
	var a = s[2];
	var b = s[3];
	var ans = nCrmod(h - a + w, w);
	for(var i = 1; i <= w - b; i++){
		ans += abmod(nCrmod(h - a + w - i, h - a), nCrmod(i + a - 1, i));
		ans %= mod;
	}
	console.log(ans);
}
function abmod(){
	var rt = arguments[0];
	for(var i = 1; i < arguments.length; i++){
		rt = (rt >>> 16) * arguments[i] % mod * 0x10000 + (rt & 0xFFFF) * arguments[i];
		rt %= mod;
	}
	return rt;
}
function powmod(a,n){//a^n%mod
	var rt = 1;
	while(n){
		if(n & 1) rt = abmod(a, rt);
		a = abmod(a, a);
		n >>>= 1;
	}
	return rt;
}
var mod = 1e9 + 7;
var fact = [1,1,2,6];
var factinv = [1,1];
function factmod(n){
	if(fact[n]) return fact[n];
	for(var i = fact.length; i <= n; i++){
		fact[i] = abmod(fact[i-1], i);
	}
	return fact[n];
}
function factinvmod(n){
	if(!fact[n]) factmod(n);
	factinv[n] = powmod(fact[n], mod-2);
	while(!factinv[n-1]){
		factinv[n-1] = abmod(factinv[n], n--);
	}
}
function nCrmod(n, r){
	if(!factinv[n]) factinvmod(n);
	return abmod(fact[n], factinv[r], factinv[n-r]);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 21436
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
#define pb push_back
#define INF 1e5
#define REP(i,a,b) for(int i=a;i<b;++i)
#define REPN(i,a,b) for(int i=a;i<=b;++i)

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);   
   
       int h,a;
       cin>>h>>a;
       int d=h%a;
       if(d==0)
       cout<<h/a<<"\n";
       else cout<<(h/a)+1<<'\n';
	return 0;
    
}

Measured memory_bytes: 256
# coding: utf-8

class Max
  def solve
    loop do
      n = gets.chomp.to_i
      break if n == 0

      max = -100000
      sum = 0
      n.times do
        a = gets.chomp.to_i
        sum += a
        if max < sum
          max = sum
        end
        if sum < 0 then
          sum = 0
        end
      end
      puts max
    end
  end
end

Max.new.solve

Measured memory_bytes: 6096
import numpy as np
n, k = list(map(int, input().split()))
H = np.array(list(map(int, input().split())), dtype = np.int)
dp = np.zeros((n, ), dtype = np.int)
for i in range(1, n):
    s, h = max(i - k, 0), H[i]
    dp[i] = np.min(dp[s:i] + abs(h - H[s:i]))
print(dp[n - 1])

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

namespace Sample101
{
    class Program
    {
        static int bubbleSort(int[] A, int N)
        {
            var flag = true;
            var i = 0;
            var count = 0;
            while (flag) {
                flag = false;
                for (var j = N - 1; j >= i + 1; j--) {
                    if (A[j] < A[j - 1])
                    {
                        var temp = A[j];
                        A[j] = A[j - 1];
                        A[j - 1] = temp;
                        flag = true;
                        count++;
                    }
                }
                i++;
            }
            return count;
        }

        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
            var result = bubbleSort(A, N);
            Console.WriteLine(string.Join(" ", A));
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 18268
/***
*	?´???° Prime Numbers
****/

#include <iostream>
#include <math.h>
using namespace std;

int isprime(long x)
{
	if (x == 2){	//x ???1??\????????´????????¨????????????
		return 1;
		
	}else if(x <2 || x%2==0){
		return 0;
	}	
	int i =3;
		
	while(i <= sqrt(x) ){
		
		if( x % i == 0){
			return 0;
		}
		i= i+2;
	}
	return 1;
}

int main(void)
{
	int  n;
	long x;
	int count = 0;	//?´???°????????°???????????????
	
	cin >> n;
	
	for(int i =0; i<n ; i++){	//n???????????????????????°??????????¢????
		cin >> x  ;
	
		if( isprime(x) == 1 ){
				count++;
		}else{
			//?´???°??§????????´???????????????????????????
		}
	}
	cout << count << endl;//?´???°??§???????????°?????¨?????????

	return 0;
}

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

#define int long long 

#define fs first
#define sc second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define pb push_back
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MP make_pair
#define sqr(x) ((x) * (x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
	fastio;
	#ifdef FlameDragon
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	
	int n, m;
	cin >> n >> m;
	if (n > m) swap(n, m);

	if (n == 1 && m == 1) {
		cout << "1\n";
		return 0;
	}
	if (n == 1) {
		cout << m - 2 << '\n';
		return 0;
	}

	int ans = n != 2 ? 4 : 0;
	if (n > 2 && m > 2)
		ans = (n - 2) * (m - 2);	
	cout << ans << '\n';
}

Measured memory_bytes: 3632
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<stack>
#include<map>
#include<queue>
#include<vector>
#include<cmath>
#include<set>
#define inf 0x3f3f3f3f
#define esp 1e-8
typedef long long ll;

const int maxn=1e5+5;

using namespace std;

ll a,b,c;

int main()
{
    scanf("%lld%lld%lld",&a,&b,&c);
    if(c>a+b&&c*c+a*a+b*b>2*(a*b+a*c+b*c))
        printf("Yes\n");
    else
        printf("No\n");
}


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

int main(){
  int N;
  cin >> N;
  string judge = "No";
  for(int i = 0;i <= N/7;i ++){
    N -= i*7;
    if(N % 4 == 0){
      judge = "Yes";
    }
    N += i*7;
  }
  cout << judge << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
#define mem(a,b) memset(a,b,sizeof(a))
const int maxn = 1e5+5;
const int ff = 0x3f3f3f3f;


int main()
{
	int x,t;
	cin>>x>>t;
	if(t<= x)
		cout<<x-t<<endl;
	else
		cout<<0<<endl;
	
	
	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  int n;
  cin >> n;
  vs w(n);
  re(i, n) cin >> w[i];

  bool srtr = true;
  re(i, n-1) {
    if(w[i].back() != w[i+1].front()) srtr = false;
  }
  re(i, n-1) {
    fo(j, i+1, n) {
      if(w[i] == w[j]) srtr = false; //配列内に重複があったらfalse
    }
  }
  if(srtr) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
public class Main{
	class Node{
		int idx;
		ArrayList<Node> next;
		int color;
		int distance;
		public Node(int idx){
			this.idx = idx;
			this.next = new ArrayList<>();
			this.distance = Integer.MAX_VALUE;
		}
	}
	
	
	int N;
	Node[] node;
	
	
	public void solve(){
		N = nextInt();
		node = new Node[N];
		for(int i = 0; i < N; i++){
			node[i] = new Node(i);
		}
		
		for(int i = 0; i < N - 1; i++){
			int a = nextInt() - 1;
			int b = nextInt() - 1;
			node[a].next.add(node[b]);
			node[b].next.add(node[a]);
		}
		dfs(node[0], 0, 1);
		dfs(node[N - 1], 0, 2);
		
		int[] sum = new int[3];
		for(int i = 1; i < N - 1; i++){
			sum[node[i].color]++;
		}
		
		if(sum[1] > sum[2]){
			out.println("Fennec");
		}else{
			out.println("Snuke");
		}
	}
	
	public void dfs(Node cur, int d, int c){
		cur.color = c;
		cur.distance = d;
		for(Node n : cur.next){
			if(n.distance > d + 1){
				dfs(n, d + 1, c);
			}
		}
	}
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

Measured memory_bytes: 69464
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())

//最大公約数
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;
}
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

int main(){
    int n,m;
    cin >> n >> m;
    int a[m],b[m];
    rep(i,m){
        cin >> a[i] >> b[i];
    }
    map<int,int>    x,y;

    rep(i,m){
        if(a[i]==1){
            x[b[i]]++;
        }else if(b[i]==1){
            x[a[i]]++;
        }else if(a[i]==n){
            y[b[i]]++;
        }else if(b[i]==n){
            y[a[i]]++;
        }
    }
    bool ans(false);

    for(auto a:x){
        if(y.count(a.first)){
            ans = true;
        }
    }

    if(ans){
        puts("POSSIBLE");
    }else{
        puts("IMPOSSIBLE");
    }

    return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int main(){
long long counter1,counter2,a,b;
counter1=0;
counter2=0;
long long N,H;
cin>>N>>H;
if(N==1){
cin>>a>>b;
counter2=1;
H-=b;
if(H%a>0){
cout<<counter2+H/a+1<<endl;}
else{
cout<<counter2+H/a<<endl;}}
else{
priority_queue<long long>aa;
priority_queue<long long>bb;
for(long long i=0;i<N;i++){
cin>>a>>b;
aa.push(a);
bb.push(b);}
counter1=aa.top();
while(H>0&&bb.size()>0){
if(bb.top()<=counter1){
break;
}
else
H=H-bb.top();
bb.pop();
counter2++;
}
if(H>0&&H%counter1>0){
cout<<counter2+(H/counter1)+1<<endl;}
else if(H>0&&H%counter1==0){
cout<<counter2+(H/counter1)<<endl;}
else{
cout<<counter2<<endl;}}}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<vector<int>> A(3,vector<int>(3));
  for (int i = 0; i < 3; i++){
    for (int j = 0; j < 3; j++){
      cin >> A[i][j];
    }
  }
  int N;
  cin >> N;
  int b;
  vector<vector<bool>> B(3,vector<bool>(3,false));
  for (int i = 0; i < N; i++){
    cin >> b;
    for (int j = 0; j < 3; j++){
      for (int k = 0; k < 3; k++){
        if (b == A[j][k]) B[j][k] = true;
      }
    }
  }
  if (B[0][0] && B[0][1] && B[0][2]){
    cout << "Yes";
  } else if (B[1][0] && B[1][1] && B[1][2]){
    cout << "Yes";
  } else if (B[2][0] && B[2][1] && B[2][2]){
    cout << "Yes";
  } else if (B[0][0] && B[1][0] && B[2][0]){
    cout << "Yes";
  } else if (B[0][1] && B[1][1] && B[2][1]){
    cout << "Yes";
  } else if (B[0][2] && B[1][2] && B[2][2]){
    cout << "Yes";
  } else if (B[0][0] && B[1][1] && B[2][2]){
    cout << "Yes";
  } else if (B[2][0] && B[1][1] && B[0][2]){
    cout << "Yes";
  } else {
    cout << "No";
  }
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  string ret;
  cout << n-1 << endl;
  cin >> ret;
  if(ret=="Vacant") return 0;
  cout << 0 << endl;
  cin >> ret;
  if(ret=="Vacant") return 0;
  int l=0,r=n-1,mid;
  string pre=ret;
  while(1){
    mid=(l+r)/2;
    cout << mid << endl;
    cin >> ret;
    if(ret=="Vacant") return 0;
    if((l+mid)%2){
      if(ret==pre){
        r=mid;
        if((l+r)%2) r++;
      }else{
        l=mid;
        if((l+r)%2) l--;
      }
    }else{
      if(ret==pre){
        l=mid;
        if((l+r)%2) l--;
      }else{
        r=mid;
        if((l+r)%2) r++;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 852
#include <bits/stdc++.h>
using namespace std;
int bn[11];
int bs[11][11]; 
int ps[11];
int check(int num,int m){
    for(int i=0;i<m;i++){
        int l = 0;
        for(int j=0;j<bn[i];j++){
            l += (num>>bs[i][j])&1;
        }
        if(l%2 != ps[i])
            return 0;
    }
    return 1;
}
int main(){
    int n,m;
    long long res = 0;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>bn[i];
        for(int j=0;j<bn[i];j++){
            cin>>bs[i][j];
            bs[i][j]--;
        }
    }
    for(int i=0;i<m;i++){
        cin>>ps[i];
    }
    for(int i=0;i<(1<<n);i++){
        if(check(i,m))
            res++;
    }
    cout<<res<<endl;
    return 0;
}

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

int main (){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B == C + D) {
    cout << "Balanced" << endl;
  }
  else if (A + B > C + D) {
    cout << "Left" << endl;
  }
  else if (A + B < C + D) {
    cout << "Right" << endl;
  }
}

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

int main() {
    int N;
    cin >> N;
    int A[N];
    map<int, int> mp;
    REP(i, N){
        int x;
        cin >> x;
        A[i] = x;
        mp[x]++;
    }

    int count = 0;

    REP(i, N){
        int x = A[i];
        mp[x]--;
        for(int i = 1; i <= sqrt(x); i++){
            
            if(x % i == 0){
                if(mp[i] > 0){
                count++;
                break;
                }

                if(mp[x/i] > 0){
                count++;
                break;
                }
            }
        }
        mp[x]++;
    }
    cout << N - count << "\n";
    return 0;
}

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

int main(){
  int n;cin>>n;
  vector<int> ans(10001,0);

  for(int x=1;x<=100;x++){
    for(int y=1;y<=100;y++){
      for(int z=1;z<=100;z++){
          int m=x*x+y*y+z*z+x*y+y*z+z*x;
          if(m<=n) ans.at(m)++;
      }
    }
  }

  for(int i=1;i<=n;i++) cout<<ans.at(i)<<endl;
}

Measured memory_bytes: 3636
N,M,X,Y = map (int, input ().split ())
lx = [int (x) for x in input().split()]
lx.append (X)
ly = [int (y) for y in input().split()]
ly.append (Y)
if X >= Y or max(lx) >= min(ly):
  print ('War')
else:
  print ('No War')

Measured memory_bytes: 9148
#include<cstdio>                                          
void trace(int A[],int N){ 
    int i;
    for(i=0;i<N;i++){
        if(i>0)
            printf(" ");
        printf("%d",A[i]);  
    }       
    printf("\n");
}


void insertionSort(int A[],int N){
    int j,i,v;
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0&&A[j]>v){
            A[j+1]=A[j];
            j--;            
        }       
        A[j+1]=v;
        trace(A,N);

    }
        
}

int main(void){
    int N,i,j;
    int A[100];

    scanf("%d",&N);
    for(i=0;i<N;i++)
        scanf("%d",&A[i]);
    trace(A,N);
    insertionSort(A,N);
        
   return 0;
}



Measured memory_bytes: 2616
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;
const int MOD=1e9+7;
const int INF=1<<29;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
int gcd(int a,int b){
	return (b==0?a:gcd(b,a%b));
}
int lcm(int a,int b){
  int g=gcd(a,b);
  return a/g*b;	
}
void solve(){
   int n;
   cin>>n;
   vector<int> v(n);
   for(auto &it:v)cin>>it;
   int ans=1ll;
   for(auto it:v)ans=lcm(ans,it);
   cout<<ans<<endl;
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>
#include <stack>
#include <iomanip>
#include <sstream>

using namespace std;

template <typename T>
inline bool sign(T A) {
    return (A>0)-(A<0);
}
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SREP(i,s,n) for(int i=s; (n-i)*sign(n-s)>0; i+=sign(n-s))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

bool _less(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}

template <template<class,class,class...> class C, typename K, typename V, typename... Args>
V map_get(const C<K,V,Args...>& m, K const& key, const V & defval)
{
    typename C<K,V,Args...>::const_iterator it = m.find( key );
    if (it == m.end())
        return defval;
    return it->second;
}

#define MOD (1'000'000'000+7)


int cdp[200001];

int main(void)
{
    ll N, M;
    cin >> N >> M;
    vector<vector<ll> > I(N), O(N);
    REP(i, M) {
        ll a, b;
        cin >> a >> b;
        I[b - 1].push_back(a - 1);
        O[a-1].push_back(b-1);
    }
    vector<ll> dp(N, 1e7);
    ll cnt = 0;
    ll lastc = 0;
    dp[0] = 0;
    SREP(i, 1, N) {
        dp[i] = dp[i - 1] + 1;
        REP(j, I[i].size()) {
            if (I[i][j] >= lastc)
                dp[i] = min(dp[i], dp[I[i][j]]);
        }
        if (dp[i-1] >= dp[i]) {
            cnt++;
            lastc = i;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 11128
import java.util.Scanner;

public class Main {
	Scanner scan = new Scanner(System.in);
	
	private void compute() {
		int M = scan.nextInt();
		int D = scan.nextInt();
		
		int cnt = 0;
		for (int i=0;i<=D;i++) {
			if (i / 10 >= 2 && i % 10 >= 2) {
				if ((i / 10) * (i % 10) <= M) {
					cnt++;
				}
			}
		}
		
		System.out.println(cnt);
	}
	
	public static void main(String...arg) {
		new Main().compute();
	}

}


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

int main()
{
  int n; cin >> n;
  vector<int> v(n);
  for(int i=0; i<n; i++) cin >> v[i];
  
  sort(v.begin(), v.end());
  
  double ans = v[0];
  for(int i=1; i<n; i++){
  	ans = (ans+v[i])/2.0;
  }
  
  cout << fixed << setprecision(10) << ans << endl;  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, start, end) for(int i = start; i < (int)(end); ++i)
int main(){
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double hdeg = (h * 60 + m) / 2;
    double mdeg = m * 6;
    double deg = abs(hdeg - mdeg);
    deg = 180 < deg ? 360 - deg : deg;
    double rad = deg / 180 * PI;
    double ans = 0;
    if(deg == 0){ ans = abs(a - b);}
    else if (deg == 180) ans = a + b;
    else ans = sqrt(pow(a,2) + pow(b,2) - 2*a*b*cos(rad));
    cout << fixed << setprecision(20) << ans << endl; 
    return 0;
}

Measured memory_bytes: 4192
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	const double PI = acos(-1);
	double a, b, x, ans; cin >> a >> b >> x;
	b /= a;
	x /= a * a * a;
	if(2 * x < b){
		double h = x / b * 2;
		dbg(b, h);
		ans = atan(b / h) * 180 / PI;
	}
	else{
		double h = (b - x) * 2;
		dbg(h);
		ans = atan(h) * 180 / PI;
	}
	printf("%.20f\n", ans);
	return 0;
}

Measured memory_bytes: 640
from collections import Counter

two_dict = Counter()

for i in range(1001):
  for j in range(1001):
    two_dict[i + j] += 1

while True:
  try:
    n = int(input())
    ans = 0
    for i in range(n + 1):
      ans += two_dict[i] * two_dict[n - i]
    print(ans)

  except EOFError:
    break



Measured memory_bytes: 6204