akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  long long N;
  cin >> N;
  
  vector<long long>A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }

  vector<long long>B(N+1,0);
  for(int i=0;i<N;i++){
    B[A[i]]++;
  }
  
  long long ans = 0;
  for(int i=0;i<N+1;i++){
    ans += B[i] * (B[i] - 1) / 2;
  }
  
  
  for(int i=0;i<N;i++){
    cout << ans - B[A[i]] + 1 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
 
int main() {
  int k;
  cin >> k;
  
  if(k == 1){
    cout << "ACL";
  }
  else if(k == 2){
    cout << "ACLACL";
  }
  else if(k == 3){
    cout << "ACLACLACL";
  }
  else if(k == 4){
    cout << "ACLACLACLACL";
  }
  else if(k == 5){
    cout << "ACLACLACLACLACL";
  }
 
  
  
}

Measured memory_bytes: 3636
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

struct UnionFind {
	UnionFind(size_t size){
        for(int i = 0;i < (int)size;i++){
            par.emplace_back(i);
            rnk.emplace_back(0);
        }
    }
	vector<int> par, rnk;

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

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y)return;
        if(rnk[x] < rnk[y]){
            par[x] = y;
        }else{
            par[y] = x;
            if(rnk[x] == rnk[y])rnk[x]++;
        }
    }
    bool same(int x,int y){
        return find(x) == find(y);
    }
};


int n;
int x[303030], y[303030];

int main(){
    cin >> n;
    UnionFind uf(303030);
    REP(i, n)cin >> x[i] >> y[i];
    REP(i, n)uf.unite(x[i], y[i] + 101010);
    map<int, LL> mx, my;
    REP(i, 101010)mx[uf.find(i)]++;
    REP(i, 101010)my[uf.find(i + 101010)]++;
    LL ans = 0;
    REP(i, 202020)ans += mx[i] * my[i];
    cout << ans - n << endl;
}

Measured memory_bytes: 28644
#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 mod = 2019;

int main() {
    ll l, r;
    cin >> l >> r;
    ll ans = mod;
    if (r-l+1<mod) for (ll i = l; i <= r-1; i++) for (ll j = i+1; j <= r; j++) ans = min(ans,((i%mod)*(j%mod))%mod);
    else ans = 0;
    cout << ans << endl;
    return 0;
}


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

int main() {
    int N;cin >> N;
    int B[N] = {};
    for (int i = 0;i < N - 1;i++){
        int A;cin >> A;
        B[A - 1]++;
    }
    for (int i = 0;i < N;i++){
        cout << B[i] << endl;
    }
}

Measured memory_bytes: 4348
use proconio::input;

fn main() {
    input! {
        w: i64,
        a: i64,
        b: i64,
    };
    let (b_l, b_r) = (b, b + w);
    let (a_l, a_r) = (a, a + w);
    let ans = if b_r < a_l {
        a_l - b_r
    } else if a_r < b_l {
        b_l - a_r
    } else {
        0
    };
    println!("{}", ans);
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using Pt = pair<int, int>;

void ABC172A()
{
	int a;
	cin >> a;
	cout << a + a * a + a * a * a << endl;
}

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


Measured memory_bytes: 3628
import numpy as np
H,W=map(int, input().split())
A=[]
for i in range(H):
    a=list(input())
    A.append(a)

A=np.array(A)
ok=True
for h in range(H):
    for w in range(W):
        
        lu=0
        rd=0
        if A[h,w]=="#":
            if 0<=h-1 and h-1<H:
                if A[h-1,w]=="#":
                    lu+=1
            if 0<=w-1 and w-1<W:
                if A[h,w-1]=="#":
                    lu+=1
            if 0<=h+1 and h+1<H:
                if A[h+1,w]=="#":
                    rd+=1
            if 0<=w+1 and w+1<W:
                if A[h,w+1]=="#":
                    rd+=1
            if h==0 and w==0:
                lu=1
            if h==H-1 and w==W-1:
                rd=1
            if lu!=1 or rd!=1:
                ok=False
if ok:
    print("Possible")
else:
    print("Impossible")

Measured memory_bytes: 12512
#pragma GCC optimize("O3")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>ll(b);i--)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
#define INF 1000000000000 
#define MOD 1000000007 
#define MAXR 100000 
#define PB push_back 
#define MP make_pair 
#define F first 
#define S second 
#define Umap unordered_map
#define Uset unordered_set


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

    int X, Y;
    cin >> X >> Y;;
    
  	bool flag = false;
  	REP(i, X+1) {
        int sosu = i*2 + (X-i)*4;
        if (sosu == Y) flag = true;
    }
  
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3648
n, a, b, c, d = map(int, input().split())
s = input()
if '##' in s[a-1:c] or '##' in s[b-1:d]:
    print('No')
elif c < d:
    print('Yes')
else:
    if '...' in s[b-2:d+1]:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
  int A, B;
  cin >> A >> B;
  if (A >= 13) {
    cout << B << endl;
  } else if (A >= 6) {
    cout << B/2 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


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


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


int Sint(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int Svec(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}


int GCD(int a,int b){
  int r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


int LCM(int a,int b){
  int c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  long long int n;
  cin>>n;
  vector<long long int> v(n),w1,w2;
  rep(i,n) cin>>v[i];
  map<long long int,long long int> mp;
  rep(i,n){
    mp[v[i]]++;
  }
  for(auto c:mp){
    if(c.second>=4){
      w1.push_back(c.first);
      w2.push_back(c.first);
    }else if(c.second>=2){
      w2.push_back(c.first);
    }
  }
  sort(w1.begin(),w1.end(),greater<long long int>());
  sort(w2.begin(),w2.end(),greater<long long int>());
  long long int ans1,ans2;
  if(w1.size()<=0){
    ans1=0;
  }else{
    ans1=w1[0]*w1[0];
  }
  if(w2.size()<=1){
    ans2=0;
  }else{
    ans2=w2[0]*w2[1];
  }
  cout<<max(ans1,ans2)<<endl;
}

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

	string s;
	cin >> s;
	
	ll n = (ll)s.size();
	ll ans = 0, cnt = 0;
	rep(i,n) {
		if( s[i] == 'B' ){
          cnt++;
        }
		else {
          ans += cnt;
        }
	}
	
	cout<<ans<<endl;

	return 0;
}



Measured memory_bytes: 3736
n=int(input())
a=[None]*n
b=[None]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())

a.sort()
b.sort()
if n%2==1:
    ans=b[n//2]-a[n//2]+1
else:
    ans = (b[n//2] +b[n//2-1]) - (a[n//2] +a[n//2-1]) +1
print(ans)

Measured memory_bytes: 86300
from collections import Counter

N = int(input())
*D, = map(int, input().split())
mod = 998244353
c = Counter(D)
v = max(D)

if c[0]!=1 or D[0]!=0:
    print(0)
else:
    ans = 1
    for i in range(1, v+1):
        ans *= (c[i-1]**c[i])
        ans %= mod
    print(ans)

Measured memory_bytes: 19936
#include <cstdio>
#include <algorithm>
using namespace std;

int main(void)
{
    int n;
    unsigned int sum, wait;
    unsigned int milk[10000];
    
    while (1) {
        scanf("%d", &n);
        
        if (n == 0) break;
        
        for (int i = 0; i < n; i++){
            scanf("%d", &milk[i]);
        }
        
        sort(milk, milk + n);
        
        sum = 0;
        wait = 0;
        for (int i = 0; i < n; i++){
            sum += wait;
            wait += milk[i];
        }
        printf("%u\n", sum);
    }
}

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

count = 1
is_up = False
is_down = False
for i in range(1, n):
    if a[i] < a[i-1] and is_up:
        count += 1
        is_up = False
    elif a[i] > a[i-1] and is_down:
        count += 1
        is_down = False
    elif a[i] < a[i-1]:
        is_down = True
    elif a[i] > a[i-1]:
        is_up = True
print(count)


Measured memory_bytes: 14224
import collections
import itertools
import sys

readline = sys.stdin.buffer.readline


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)


def main():
    N, M, K = map(int, readline().split())
    AB = [list(map(int, readline().split())) for _ in range(M)]
    CD = [list(map(int, readline().split())) for _ in range(K)]

    E = UnionFind(N)

    ans = [0 for _ in range(N)]
    for a, b in AB:
        a -= 1
        b -= 1
        E.unite(a, b)
        ans[a] -= 1
        ans[b] -= 1

    for i in range(N):
        E.find(i)

    ll = collections.defaultdict(int)
    for i in E.par:
        ll[i] += 1

    for i in range(N):
        ans[i] += ll[E.par[i]] - 1

    for i, j in CD:
        i -= 1
        j -= 1
        if E.same(i, j):
            ans[i] -= 1
            ans[j] -= 1

    print(*ans)


main()


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b;return true;} return false;}
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b;return true;} return false;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

int main(){
  ll n, l;
  cin >> n >> l;
  ll ans = 0, minn = mod;
  rep(i, 0, n) if(abs(l + i) < minn) {ans = i; minn = abs(l + i);};
  cout << n * l + (n - 1) * n / 2 - (l + ans) << endl;
}

Measured memory_bytes: 256
/*
          , -- 、
        /;;;;;;', 　　　
        i二二二i
      , ' 　    ヽ ???
     i　ﾉﾉﾉﾉﾉﾍ .', 　　
     〉ﾘi' ﾟ ヮﾟﾉﾚく　 WAyon..........
  ○⊂}〈lﾄ--ｲl〉{つ● 　　
      ,ｒ/ー i-ヽヽ 　　　
     ｀｀i_ﾗi_ﾗ
*/

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const int INF=(int)1e12;
const int mod=(int)1e9+7;
#define all(a) (a).begin(),(a).end()
typedef vector<vector<int>> graph;

#define pb push_back

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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



signed main () {
    int n,a,b,c,d,e;string s;
    cin >>a>>b>>c>>d;
    while(1){
        c-=b;
        if(c<=0){
            cout <<"Yes"<<endl;
            return 0;
        }
        a-=d;
        if(a<=0){
            cout <<"No"<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3636
#!/usr/bin/env python3
import sys


def solve(x: int):
    print(1 - x)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    x = int(next(tokens))  # type: int
    solve(x)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61796
#include<bits/stdc++.h>
using namespace std;
#define pa pair<int,int>
#define N 100011
int head[N<<2],cnt,vis[N],val[N],a,b,n,k;
priority_queue<pa> p;
typedef struct{
	int to,nxt;
}edge;
edge e[N<<2];
void add(int a,int b){
	cnt++;
	e[cnt].to=b;
	e[cnt].nxt=head[a];
	head[a]=cnt;
}
int main(){
	memset(head,-1,sizeof(head));
	scanf("%d",&n);
	for(int i=1;i<=n-1;i++){
		scanf("%d%d",&a,&b);
		add(a,b);add(b,a);
	}
	scanf("%d",&k);
	while(k--){
		scanf("%d%d",&a,&b);
		val[a]=b;
		vis[a]=1;
		p.push(pa(-b,a));
	}
	while(!p.empty()){
		int a=p.top().first;int b=p.top().second;p.pop();
		for(int i=head[b];i!=-1;i=e[i].nxt){
			int v=e[i].to;
			if(vis[v]){
				if(abs(val[v]-val[b])!=1){
					printf("No\n");
					return 0;
				}
			}else{
				vis[v]=1;
				val[v]=-a+1;
				p.push(pa(-val[v],v));
			}
		}
	}
	printf("Yes\n");
	for(int i=1;i<=n;i++)
	  printf("%d\n",val[i]);
}

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

namespace B___Minesweeper
{
    class Program
    {
        struct Sharp
        {
            public int i;
            public int j;
        }

        static void Main(string[] args)
        {
            var H_W = Console.ReadLine().Split();
            var H = int.Parse(H_W[0]);
            var W = int.Parse(H_W[1]);

            var Si = Enumerable.Range(1, H).Select(_ => Console.ReadLine()).SelectMany(x => x).ToArray();
            var sharp = new Sharp[Si.Count(x => x == '#')];
            var grid = Enumerable.Repeat('0', H * W).ToArray();

            for (int i = 0, cnt = 0; i < H * W; i++)
                if (Si[i] == '#')
                {
                    sharp[cnt].i = i / W;
                    sharp[cnt].j = i % W;
                    cnt++;
                }

            for (int i = 0; i < H * W; i++)
                foreach (var s in sharp)
                {
                    if (s.i == i / W & s.j == i % W)
                    {
                        grid[i] = '#';
                        break;
                    }
                    else if (Math.Abs(i / W - s.i) <= 1 & Math.Abs(i % W - s.j) <= 1)
                        grid[i]++;
                }

            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                    Console.Write(grid[W * i + j]);
                Console.WriteLine();
            }

        }
    }
}


Measured memory_bytes: 13396
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    S = input()
    sl = len(S)
    S = S[:-1]
    sl -= 1
    while True:
        if sl % 2 != 0:
            S = S[:-1]
            sl -= 1
        else:
            if S[:sl//2] == S[sl//2:]:
                print(sl)
                exit()
            else:
                S = S[:-1]
                sl -=1
if __name__ == '__main__':
  main()


Measured memory_bytes: 5660
#include<bits/stdc++.h>
using namespace std;
 
int main() {
		int n;
		cin >> n;
		vector<int> d(3);
		for(int days = 0;days < n;++days){
			vector<int> c(3), n_d(3,0);
			for(int i = 0;i<3;++i){
				cin >> c[i];
			}
			for(int i = 0; i<3;++i){
				for(int j = 0; j < 3;++j){
					if(i!=j){
						n_d[j] = max(d[i] + c[j], n_d[j]); 
					}
				}
			}
			d = n_d;
		}
		cout << max({d[0],d[1],d[2]}) << endl;
	return 0;
}

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

using namespace std;

const int DIM = 1e5 + 7;

bitset <DIM> vis;

vector <int> st;
vector <int> v[DIM];
vector <int> res;

void dfs(int nod)
{
	vis[nod] = true;
	st.push_back(nod);
	
	for(auto i : v[nod])
		if(i == st[0] && nod != st[0] && (res.size() == 0 || res.size() > st.size()))
		{
			res = st;
		}
		else
			if(vis[i] == 0)
			{
				vis[i] = true;
				dfs(i);
			}
	
	st.pop_back();
}

main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m;
	cin >> n >> m;
	
	for(int i = 1; i <= m; i++)
	{
		int x, y;
		cin >> x >> y;
		
		v[x].push_back(y);
	}
	
	for(int i = 1; i <= n; i++)
	{
		vis.reset();
		dfs(i);
	}
	if(res.size() == 0)
		cout << -1;
	else
	{
		cout << res.size() << '\n';
		
		for(auto i : res)
			cout << i << '\n';
	}
}

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

int main(){
    int n,ans=1;cin>>n;vector<int> h(n);
    for(int i=0;i<n;i++) cin>>h.at(i);
    for(int i=1;i<n;i++){
        int count=0;
        for(int j=i-1;j>=0;j--){
            if(h.at(i)>=h.at(j)) count++;
        }
        if(count==i) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const string ss="CODEFESTIVAL2016";
int main(){
	string s;
	int ans=0;
	cin>>s;
	for(int i=0;i<16;i++)
		if(s[i]!=ss[i])ans++;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

int main(void) {
	int N, K;
	cin >> N >> K;
	cout << (N % K ? 1 : 0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[50][50];
int c,d,b[55][55];
int main(){
    cin>>c>>d;
    for(int i=0;i<c;i++) cin>>a[i];
    for(int i=0;i<c;i++)
        for(int j=0;j<d;j++)
            if(a[i][j]=='#')
                b[i][j]++,b[i][j+1]++,b[i][j+2]++,b[i+1][j]++,b[i+1][j+1]++,b[i+1][j+2]++,b[i+2][j]++,b[i+2][j+1]++,b[i+2][j+2]++;
    for(int i=0;i<c;i++){
        for(int j=0;j<d;j++)
            if(a[i][j]=='#') cout<<'#';
            else cout<<b[i+1][j+1];
        cout<<endl;
    }

}

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

ll powll(ll a,ll n){
  if(n==0)
  {
    return 1;
  }
  return powll(a,n-1)*a;
}

int main() {
   ll i,j,k;
    ll a,b,c;
    cin >>a>>b>>c ;
if(c-a-b<0)
{
     cout <<"No"  << endl;
     return 0;
}
    if(4*a*b<(c-a-b)*(c-a-b))
    {
         cout <<"Yes"  << endl;
         return 0;
    }
  cout << "No" << endl;

// bool s=sqrt(c)-sqrt(a)-sqrt(b)>0;
// if(s)
// {
//     cout <<"Yes"  << endl;
// }else
// {
//     cout <<"No"  << endl;
// }
}


Measured memory_bytes: 256
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
//#define         ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         UNIQUE(v)                   v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define         mod                         1000000007
#define         INF                         2e18
#define         EPS                         1e-15
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;
//int dx[]={0,0,1,-1,1,1,-1,-1};
//int dy[]={1,-1,0,0,1,-1,1,-1};


int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    string s;
    cin >> s;
    ll sum = 0;
    for(ll i=0;i<s.size();i++){
        sum += s[i]-'0';
        sum %= 9LL;
    }
    if(sum){
        printf("No\n");
    }
    else{
        printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 3716
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

int main() {
	ios_base::sync_with_stdio( false );

	set<int> S;
	int q;
	cin >> q;
	while( q-- > 0 ) {
		int a, b;
		cin >> a >> b;

		if( a == 0 ) {
			S.insert( b );
			cout << S.size() << '\n';
		}
		else if( a == 1 ) {
			cout << (S.find( b ) != S.end()) << '\n';
		}
		else if( a == 2 ) {
			S.erase( b );
		}
		else if( a == 3 ) {
			int c;
			cin >> c;

			auto beg = S.lower_bound( b );
			auto end = S.upper_bound( c );
			while( beg != end ) { cout << *beg++ << '\n'; }
		}
	}

	return 0;
}



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

int main(){
    int n;
    cin >>n;
    int ans = 1000000000;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        int tmp=0;
        while(a%2==0){
            a/=2;
            tmp ++;
        }
        if(tmp < ans){
            ans = tmp;
        }
    }
    cout <<ans << endl;
    return 0;
}

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


//TEMPLATE
#define pb                push_back
#define mp                make_pair
#define ll                long long
#define ld                long double
#define pii               pair <ll, ll>
#define piii              pair <ll, pii>
#define F                 first
#define S                 second

#define newline           printf("\n")
#define minusone          printf("-1\n")
#define zeroo             printf("0\n")
#define scl1(a)           scanf("%lld", &a)
#define scl2(a, b)        scanf("%lld %lld", &a, &b)
#define scl3(a, b, c)     scanf("%lld %lld %lld", &a, &b, &c)
#define prl1(a)           printf("%lld\n", a)
#define prl2(a, b)        printf("%lld %lld\n", a, b)
#define ssl1(s)           scanf(" %[^\n]", s)
#define scd1(a)           scanf("%lf", &a)
#define scd2(a, b)        scanf("%lf %lf", &a, &b)
#define prd(a)            printf("%lf\n", a)
#define prld(a)           printf("%Lf\n", a)
#define prcase(cs)        printf("Case %lld: ", cs)
#define cin1(a)           cin >> a
#define cin2(a, b)        cin >> a >> b
#define cin3(a, b, c)     cin >> a >> b >> c
#define cin4(a, b, c, d)  cin >> a >> b >> c >> d
#define cot1(a)           cout << a << "\n"
#define cot2(a, b)        cout << a << " " << b << "\n"
#define cot3(a, b, c)     cout << a << " " << b << " " << c << "\n"
#define cot4(a, b, c, d)  cout << a << " " << b << " " << c << " " << d << "\n"
#define cotline           cout << "\n"
#define cotminus          cout << "-1\n"
#define cot0              cout << "0\n"
#define cotyes            cout << "YES\n"
#define cotno             cout << "NO\n"
#define cotcase(cs)       cout << "Case " << cs << ": "

#define reversed(s)       reverse(s.begin(), s.end())
#define asort(s)          sort(s.begin(), s.end())
#define dsort(s)          sort(s.rbegin(), s.rend())
#define all(s)            s.begin(), s.end()
#define uniq(s)           s.resize(distance(s.begin(),unique(s.begin(), s.end())))
#define found(s, x)       s.find(x) != s.end()

#define for0(i, n)        for (i = 0; i < n; i++)
#define for1(i, n)        for (i = 1; i <= n; i++)
#define fora(i, a, b)     for (i = a; i <= b; i++)
#define forb(i, b, a)     for (i = b; i >= a; i--)
#define fori(it, s)       for(auto it = s.begin(); it != s.end(); it++)

#define FR                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ms(a, x)          memset(a, x, sizeof a)
#define bitcount(n)       __builtin_popcountll(n)

//#define pi              3.1415926536
#define pi                acos(-1)

const ll INF = LLONG_MAX;
const ll SZ = 1e7+5;
const ll mod = 1e9+7;


ll n;
unsigned ll a[SZ];
//ll b[SZ];



int main() {
    FR;
    ll cs = 0, tc = 1, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, t = 0;
    //    ll a, b, d;
    string s, s1, s2;

    cin1(n);

    unsigned ll c = 0;
    for1(i, n) {
        for(j = i; j <= n; j += i) {
            a[j]++;
        }
    }

    for1(i, n) {
        c += (a[i] * i);
    }

    cot1(c);

    return 0;
}



Measured memory_bytes: 81772
#include "bits/stdc++.h"
using namespace std;
typedef long double ld;
#define int long long
typedef pair<int,int> pii;
#define RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(i=0; i <n; i++)
#define repv(i,k,n) for(int i=k; i<=n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define endl '\n'
#define deb(x) cout<<#x<<" = "<<x<<endl
#define gcd __gcd
#define inf LLONG_MAX
#define minf LLONG_MIN 
#define sp(n) fixed<<setprecision(n)
const int mod = (int)(1e9+7);
int power(int x,int n)
{   if(n==0)    return 1;
    if(n==1)    return x%mod;
    if(n%2==0)  {   int y = power(x,n/2)%mod;return (y*y)%mod;}
    if(n&1)     {   int y = power(x,n-1);return (x%mod * y%mod)%mod;}
    return 0;
}
void db()
{   RAGE;
    #ifndef  ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
void timeit()
{  
    #ifndef ONLINE_JUDGE
        cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}
bool is_power_2(int n)  { return log2(n)==floor(log2(n));}
bool is_prime(int n){for(int i=2; i*i<=n; i++)if(n%i==0)return 0; return 1;}

int dx[]    =  { -1 ,  0,  1,  0,  -1, -1, 1,  1};
int dy[]    =  { 0 ,  1,   0, -1,  -1,  1, 1, -1};
char dir[]  =  {'U', 'R', 'D','L' };
/* ------------------------------------------------------- */
const int maxn = 20005;
void solve()
{
    int n,i,j,k,m,q;
    int l,r,d;
    cin>>l>>r>>d;
    int ans = floor(1.0*r/d)-ceil(1.0*l/d)+1;
    cout<<ans;   
}
signed main()
{
    //db();    
    int t=1;
    //  cin>>t;
    while(t--)
    {
        solve();
    }
    //timeit();
    return 0;
}

Measured memory_bytes: 3652
n,k=gets.split.map(&:to_i)
x=gets.split.map(&:to_i)
ans=1e10.to_i
(n-k+1).times{|i|
  ans=[[(0-x[i]).abs+(x[k+i-1]-x[i]),
  (x[k+i-1]-0).abs+(x[k+i-1]-x[i])].min,ans].min
}
puts ans


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

int main()
{
    for(;;){
        int n, k, m;
        cin >> n >> k >> m;
        if(n == 0)
            return 0;

        vector<int> next(n);
        for(int i=0; i<n; ++i)
            next[i] = (i+1) % n;

        int curr = m - 1;
        int prev = (m - 2 + n) % n;
        for(int i=0; i<n-1; ++i){
            next[prev] = next[curr];
            int k1 = k % (n-i);
            for(int j=0; j<k; ++j){
                prev = curr;
                curr = next[curr];
            }
        }

        cout << (curr+1) << endl;
    }
}

Measured memory_bytes: 944
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
int main() {
  ll H, W;
  cin >> H >> W;
  ll ans = 0;
  if(H == 1 || W == 1){
    ans = 1;
  }
  else if(H*W % 2 == 1){
    ans = (H * W)/2 + 1;
  }
  else{
    ans = (H * W) / 2;
  }
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int n;
    cin >> n;
    ll a[3 * n];
    REP(i,3 * n){
        cin >> a[i];
    }
    ll sum = 0;
    priority_queue<ll, vector<ll>, greater<ll>> lque;
    for(int i = 0; i < n; i++){
        lque.emplace(a[i]);
        sum += a[i];
    }
    ll lsum[n + 1];
    lsum[0] = sum;
    for(int i = 0; i < n; i++){
        if(lque.top() < a[n + i]){
            sum += a[n + i] - lque.top();
            lque.pop();
            lque.push(a[n + i]);
        }
        lsum[i + 1] = sum;
    }
    sum = 0;
    priority_queue<ll> rque;
    for(int i = 2 * n; i < 3 * n; i++){
        rque.emplace(a[i]);
        sum += a[i];
    }
    ll rsum[n + 1];
    rsum[n] = sum;
    for(int i = n - 1; i >= 0; i--){
        if(rque.top() > a[n + i]){
            sum += a[n + i] - rque.top();
            rque.pop();
            rque.push(a[n + i]);
        }
        rsum[i] = sum;
    }
    ll ans = -LINF;
    for(int i = 0; i <= n; i++){
        ans = max(ans, lsum[i] - rsum[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5876
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template< typename T > using matrix = vector< vector< T > >;

//FUNCTION  

int euclidean_gcd(int a, int b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}


void solve(void)
{
  int N;
  cin>>N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  sort(ALL(vec));
  int ANS = 0;
  for (int i = 0; i < N; i++)
  {
    for (int j = i+1; j < N; j++)
    {
      int A = vec[i];
      int B = vec[j];
      int S = A + B;
      auto itr = lower_bound(ALL(vec),S);
      int D = distance(itr,vec.end());
      // DEBUG(D);
      int NUM = max(0LL,N - D -j-1);
      ANS += NUM;
    }
  }
  cout<<ANS<<endl;
  
  

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

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d', $num);
$line = explode(' ', trim(fgets((STDIN))));
$ans = [];
for ($i=0; $i < $num; $i++) { 
    $len = count($line);
    for ($j=$len; $j >= 0; $j--) { 
        if ($line[$j] == $j + 1) {
            $ans[] = $j + 1;
            unset($line[$j]);
            $line = array_values($line);
            break;
        }
    }
}

$ans = array_reverse($ans);

if (empty($line)) {
    echo implode("\n", $ans);
} else {
    echo "-1";
}
echo "\n";

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
#define faster() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl '\n'
int main()
{
    faster();

    int d,t,m;
    cin>>d>>t>>m;
    int ans = t*m;
    if(ans>=d) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
	return 0;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const double pi=acos(-1);
int n,L,a[3005];
double ansx,ansy;
int main(){
	scanf("%d%d",&n,&L);
	For(i,1,n) scanf("%d",&a[i]);
	ll val=1ll*n*(n-1)*(n-2)/6;
	For(i,1,n) For(j,i+1,n){
		int len=j-i-1,val=n-2-2*len;
		//printf("%d %d %d\n",i,j,val);
		ansx+=val*cos(pi*(a[i]+a[j])/L);
		ansy+=val*sin(pi*(a[i]+a[j])/L);
	}
	ansx/=val; ansy/=val;
	printf("%.15lf %.15lf\n",ansx,ansy);
}

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

int main(){
  int n, k; cin >> n >> k;
  vector<long long> v(n), vv(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    vv[i] = -v[i];
  }
  sort(vv.begin(), vv.end());
  long long ans = 1e18;
  for (int i = 0; i < n; i++) {
    if (i+k-1 >= n) break;
    ans = min(ans, v[i+k-1]-v[i] + abs(v[i]));
    ans = min(ans, vv[i+k-1]-vv[i] + abs(vv[i]));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REP1(i,n) for(int i=1; i<=(int)(n); i++)
#define SORT(v) sort(v.begin(), v.end())
#define REVERSE(v)  reverse(v.begin(), v.end())
using namespace std;

long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

int main() {
  int N; long long X;
  cin >> N >> X;
  long long x[N];
  for (int i = 0; i < N; i++) {
    cin >> x[i];
    x[i] -= X;
  }

  long long G = abs(x[0]);
  for (int i = 1; i < N; i++) {
    G = GCD(G, abs(x[i]));
  }

  cout << G << endl;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    static int mod = 998244353;
    static long pow(long a,int n) {
        long res=1;
        while (n>0) {
            if ((n-n/2*2)==1) {
                res=res*a%mod;
            }
            a=a*a%mod;
            n>>=1;
        }
        return res;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] D = new int[N];
        int[] map = new int[N+100];
        int flag = 0;
        for (int i=0;i<N;i++) {
            D[i] = Integer.parseInt(sc.next());
            map[D[i]]++;
            if (i!=0 && D[i]==0) {
                flag=1;
            }
        }
        if (D[0]!=0) {
            flag=1;
        }
        for (int i=1;i<N+100;i++) {
            if (map[i]!=0 && map[i-1]==0) {
                flag=1;
            }
        }
        long ans = 1L;
        for (int i=1;i<N+100;i++) {
            if (map[i]==0) {
                break;
            } else {
                ans = ans*pow(map[i-1], map[i])%mod;
            }
        }
        if (flag==1) {
            System.out.println(0);
        } else {
            System.out.println(ans);
        }
    }
}

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

h=list(map(int,input().split()))

c=[0]*n 
for i in range(1,n):
    if h[i]<= h[i-1]:
        c[i]=c[i-1]+1

v=c[0]
for i in range(n):
    if c[i]>v:
        v=c[i]
print(v)    

Measured memory_bytes: 20476
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

a = k()
print(a**2)


Measured memory_bytes: 10512
sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy

print('U' * dy + 'R' * dx +
      'D' * dy + 'L' * dx +
      'L' + 'U' * (dy + 1) + 'R' * (dx + 1) + 'D' +
      'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U')


Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	slice := make([]int, 3)
	for i := 0; i < 3; i++ {
		slice[i] = nextInt()
	}

	sort.Ints(slice)
	a, b, c := slice[0], slice[1], slice[2]

	cnt := 0

	if (c-b)%2 == 0 && (c-a)%2 == 0 {
		cnt += (c-b)/2 + (c-a)/2
	} else if ((c-b)%2 == 0 && (c-a)%2 == 1) || ((c-b)%2 == 1 && (c-a)%2 == 0) {
		cnt += (c-b)/2 + (c-a)/2 + 2
	} else {
		cnt += (c-b)/2 + (c-a)/2 + 1
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef __int64 LL;
typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;

const int MOD=1000000007;
LL INF=1000000000000;

LL dp[1010][4100];
LL a[1010],c[1010];
int main(){
	LL n,m;cin>>n>>m;
	for(LL i=0;i<m;i++)
	{
		cin>>a[i];
		LL b;cin>>b;
		for(LL j=0;j<b;j++)
		{
			LL po;cin>>po;po--;
			c[i]+=(1 << po);	
		}	
	}
	
	for(LL i=0;i<1010;i++)
	{
		for(LL j=0;j<4100;j++)
		{
			if(j==0)dp[i][j]=0;
			else dp[i][j]=INF;
		}
	}
	
	for(LL i=0;i<m;i++)
	{
		for(LL j=0;j<(1 << n);j++)
		{
			LL nj=j|c[i];
			dp[i+1][j]=min(dp[i][j],dp[i+1][j]);
			dp[i+1][nj]=min(dp[i][j]+a[i],dp[i+1][nj]);	
		}
	}
	LL ans=dp[m][(1 << n)-1];
	if(ans==INF)cout<<-1<<"\n";
	else cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 32640
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

#define P 1000000007

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  map<long long, long long> mp;
  for(int i = 0; i < n; i++) cin >> v[i];
  for(int i = 0; i < n; i++) mp[v[i]]++;
  long long ans = 0;
  for(auto it = mp.begin(); it != mp.end(); it++) {
    if(it->second >= it->first) ans += it->second - it->first;
    else ans += it->second;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7040
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str  = sc.nextLine();
        String[] astr = str.split(" "); //状況に合わせて
        int[] in_data = Stream.of(astr).mapToInt(x->{
            try{
                return Integer.parseInt(x);
            }
            catch(Exception e){
                e.printStackTrace();
            }
            return 0;
        }).toArray();

        int n = in_data[0];
        int k = in_data[1];
        int hito =0;
        String str2  = sc.nextLine();
        String[] astr2 = str2.split(" "); //状況に合わせて
        int[] in_data2 = Stream.of(astr2).mapToInt(x->{
            try{
                return Integer.parseInt(x);
            }
            catch(Exception e){
                e.printStackTrace();
            }
            return 0;
        }).toArray();
        sc.close();


        for(int i=0;i<in_data2.length;i++){
            if(in_data2[i]>=k){
                hito+=1;
            }
        }
        System.out.println(hito);
    }
}

Measured memory_bytes: 41072
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

inline vector<pair<ll,int>> sieve(ll n){
	vector<pair<ll,int>> sosuu;
	for(ll i = 2; i*i <= n; i++){
		int x = 0;
		while(n % i == 0){
			n /= i;
			x++;
		}
		sosuu.push_back(make_pair(i,x));
	}
	if(n != 1) sosuu.push_back(make_pair(n,1));
	return sosuu;
}

inline map<ll, int> sieve2(ll n) {
  map<ll, int> sosuu;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      sosuu[i]++;
      n /= i;
    }
  }
  if (n != 1) sosuu[n] = 1;
  return sosuu;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n; cin >> n;
  // auto res = sieve(n);
  auto res = sieve2(n);
  int ans = 0;
  for(auto x : res){
    int a = x.second, b = 1;
    while(b <= a){
      a -= b;
      b++;
      ans++;
    }
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3572
a[9999],s,r,i;main(n,j){for(;scanf("%d",&n),n;i=!printf("%d\n",r)){for(r=-(1e7);i<n;)scanf("%d",a+i++);for(i=0;i<n;s=0)for(j=i++;j<n;r=fmax(r,s))s+=a[j++];}}

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> a(H,vector<char>(W));
  // 取り込む
  for (int i = 0; i < H; i++) {
  	for (int j = 0; j < W; j++) {
  		cin >> a.at(i).at(j);	
  	}
  }
  // 横チェック
  vector<int> B;
  for (int i=0; i<H; i++) {
  	int cnt = 0;
  	for (int j=0; j<W; j++) {
  			if (a.at(i).at(j) == '#') {
  				cnt++;
  			}
  	}
  	if(cnt > 0) {
  		B.push_back(i);
  	}
  }
  // 横削除
  vector<vector<char>> A(B.size(),vector<char>(W));
  for (int i=0; i<B.size(); i++) {
  	for (int j=0; j<W; j++) {
  		A.at(i).at(j) = a.at(B.at(i)).at(j);
  	}
  }
  // 縦チェック
  vector<int> C;
  for (int j=0; j<W; j++) {
  	int cnt = 0;
  	for (int i=0; i<B.size(); i++) {
  			if (A.at(i).at(j) == '#') {
  				cnt++;
  			}
  	}
  	if(cnt > 0) {
  		C.push_back(j);
  	}
  }
  // 縦削除
  vector<vector<char>> D(B.size(),vector<char>(C.size()));
  for (int j=0; j<C.size(); j++) {
  	for (int i=0; i<B.size(); i++) {
  		D.at(i).at(j) = A.at(i).at(C.at(j));
  	}
  }
  // 表にする
  for (int i=0; i<B.size(); i++) {
  	for (int j=0; j<C.size(); j++) {
  			cout << D.at(i).at(j);
  			if (j == C.size()-1) {
  				cout << endl;
  			}
  	}
  }
}

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

using namespace std;
using ll = long long;

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

const int SIZE = 100005;
int group[SIZE];
void assignGroup(int v, int g, vector<int> to[]) {
  if (group[v] != 0) return;

  group[v] = g;
  for (int u : to[v]) {
    assignGroup(u, g, to);
  }
}

int main() {
  int n, m, k;
  cin >> n >> m >> k;

  vector<int> to[n];
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  vector<int> block[n];
  rep(i, k) {
    int c, d;
    cin >> c >> d;
    --c, --d;
    block[c].push_back(d);
    block[d].push_back(c);
  }

  int g = 1;
  rep(i, n) {
    if (group[i] == 0) {
      assignGroup(i, g, to);
      ++g;
    }
  }

  vector<int> gc(n);

  rep(i, n) { ++gc[group[i]]; }

  rep(i, n) {
    int ans = gc[group[i]] - 1;
    for (int v : to[i]) {
      if (group[v] == group[i]) --ans;
    }
    for (int v : block[i]) {
      if (group[v] == group[i]) --ans;
    }

    if (i) cout << ' ';
    cout << max(ans, 0);
  }

  return 0;
}


Measured memory_bytes: 13056