akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n;
    cin >> n;
    vint a(n + 2, 0);
    rep(i, n) cin >> a[i + 1];

    ll sum = 0;
    rep(i, n + 1)
    {
        sum += abs(a[i + 1] - a[i]);
    }

    rep(i, n)
    {
        ll ans = sum;

        ans -= abs(a[i + 1] - a[i]);
        ans -= abs(a[i + 2] - a[i + 1]);
        ans += abs(a[i + 2] - a[i]);

        cout << ans << endl;
    }
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1664
from decimal import Decimal
[W,H,x,y] = list(map(int,input().split()))
sq = W*H / 2
x_tmp = W/2
y_tmp = H/2
id = 0
if abs(x - x_tmp) < 10**(-8) and abs(y - y_tmp) < 10**(-8):
    id = 1
print(Decimal(sq),id)

Measured memory_bytes: 5588
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 16:46:38 2020

@author: shinba
"""

n,m = map(int,input().split())

A = []
B = []

for i in range(n):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

C = []
D = []

for j in range(m):
    c,d = map(int,input().split())
    C.append(c)
    D.append(d)

for i in range(n):
    ans = float("inf")
    for j in range(m):
        if ans > abs(A[i]-C[j])+abs(B[i]-D[j]):
            ans = abs(A[i]-C[j])+abs(B[i]-D[j])
            num = j+1
    else:
        print(num)
    

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

//container util
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQUE(a)  (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,n,0)

//debug
#define dump(x)  cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";

int h,w,n,a[10000];
int ans[100][100];
int main() {
	cin >> h >> w >> n;
	REP(i,n) cin >> a[i];
	int now=0;
	int k=0;
	REP(i,(h+1)/2){
		REP(j,w){
			ans[j][i*2] = now+1;
			k++;
			if(a[now]<=k){
				now++;
				k=0;
			}
		}
		if(i!=h){
			RREP(j,w){
				ans[j][i*2+1] = now+1;
				k++;
				if(a[now]<=k){
					now++;
					k=0;
				}
			}
		}
	}
	REP(i,h){
		REP(j,w){
			cout << ans[j][i];
			if(j!=w-1)cout << " ";
		}
		cout << endl;
	}
}


Measured memory_bytes: 384
//written by libra9z
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <valarray>
#include <utility>
#include <numeric>
#include <memory>
#include <functional>
#include <stdexcept>
#include <typeinfo>
#include <limits>
#include <complex>
#include <locale>
using namespace std;
#define Debug(x) cerr << #x << " = " << x << endl
#define Debug22(x,y) cerr<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<endl;
#define Debug2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define Debug3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<")\n";
#define Debug_arr(v,n) for(int i=0;i<n;++i) cerr<<#v<<"["<<i<<"]"<<" = "<<v[i]<<endl;
#define SET(p,v) fill((__typeof(**p)*)p,(__typeof(**p)*)p+sizeof(p),v);
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define prl cerr << "called: " << __LINE__ << endl
#define all(s) s.begin(),s.end()
const int N = 1e5 + 5;
bool flag = 0;
int c[N], cnt[3];
vector <int> g[N];
int n,m;
void dfs(int x,int col=1) {
	if (c[x]) {
		flag|=(col!=c[x]);
		return;
	}
	c[x]=col;
	cnt[col]++;
	for (auto u:g[x]) dfs(u,3-col);
}
int main() {
	scanf("%d%d",&n,&m);
	for (int i=0;i<m;++i)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(1);
	if (flag)
	{
		printf("%lld\n",1LL*n*(n-1)/2-m);
	}
	else
	{
		printf("%lld\n",1LL*cnt[1]*cnt[2]-m);
	}
	return 0;
}

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

#define ll long long int
#define mod 1000000007

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;


int main()
{  
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin>>n;
    ll s=0;
    for(int i=1;i<=n;i++){
    if(i%3==0 && i%5==0){}
    else if(i%3==0){}
    else if(i%5==0){}
    else {s+=i;}
}
cout<<s<<"\n";
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;


const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()

int main(){
    int H,W,N;
    cin>>H>>W>>N;
    if(H>W){
        int a=0,Co=0;
        while(a<N){
            Co++;
            a+=H;
        }
        cout<<Co<<endl;
    }else
    {
        int Co=0,a=0;
        while(a<N){
            Co++;
            a+=W;
        }
        cout<<Co<<endl;
    }
    

    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
    int a,b,c,d; cin >> a >> b >> c >> d;

    for(int i=0; i<c-a; i++) cout << 'R';
    for(int i=0; i<d-b; i++) cout << 'U';
    for(int i=0; i<c-a; i++) cout << 'L';
    for(int i=0; i<d-b; i++) cout << 'D';
    cout << 'D';
    for(int i=0; i<c-a+1; i++) cout << 'R';
    for(int i=0; i<d-b+1; i++) cout << 'U';
    cout << 'L';
    cout << 'U';
    for(int i=0; i<c-a+1; i++) cout << 'L';
    for(int i=0; i<d-b+1; i++) cout << 'D';
    cout << 'R' << endl;
}

Measured memory_bytes: 256
n,m,l=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
b=[list(map(int,input().split())) for _ in range(m)]
[print(*x) for x in [[sum(j*k for j,k in zip(x,y)) for y in zip(*b)] for x in a]]


Measured memory_bytes: 7000
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

def calc(p,x):
    return p*(100+x)//100


while True:
    x,y,s = inpl()
    if x == 0 and y == 0 and s == 0:
        break
    else:
        ans = 0
        for a in range(1,s):
            ap = calc(a,x)
            for b in range(1,s):
                bp = calc(b,x)
                if ap + bp != s:
                    continue
                else:
                    tmp = calc(a,y) + calc(b,y)
                    ans = max(ans,tmp)
        print(ans)



Measured memory_bytes: 7456
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int w, h;
	char[][] map;
	char[] dir = {'<', '^', '>', 'v'};
	P player;
	
	int dx[] = {-1,0,1,0};
	int dy[] = {0,-1,0,1};
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for(int c=0;;c++) {
			h = sc.nextInt();
			w = sc.nextInt();
			map = new char[h+2][w+2];
			for(char[] a: map) fill(a, '#');
			
			for(int i=1;i<=h;i++) {
				String str = sc.next();
				for(int j=1;j<=w;j++) {
					map[i][j] = str.charAt(j-1);
					if(map[i][j] == '<' ) {
						map[i][j] = '.';
						player = new P(j, i, 0);
					}
					else if( map[i][j] == '>' ) {
						map[i][j] = '.';
						player = new P(j, i, 2);
					}
					else if( map[i][j] == '^' ) {
						map[i][j] = '.';
						player = new P(j, i, 1);
					}
					else if( map[i][j] == 'v' ) {
						map[i][j] = '.';
						player = new P(j, i, 3);
					}
				}
			}
			
			int n = sc.nextInt();
			String ops = sc.next();
			for(int op=0;op<n;op++) {
				int nx = player.x, ny = player.y;
				switch (ops.charAt(op)) {
				case 'S':
					for(int i=1;;i++) {
						int x = player.x+dx[player.d]*i;
						int y = player.y+dy[player.d]*i;
						if(map[y][x] == '*') {
							map[y][x] = '.';
							break;
						}
						if(map[y][x] == '#') break;
					}
					break;
				case 'L':
					nx = player.x + dx[0];
					ny = player.y + dy[0];
					player.d = 0;
					break;
				case 'U':
					nx = player.x + dx[1];
					ny = player.y + dy[1];
					player.d = 1;
					break;
				case 'R':
					nx = player.x + dx[2];
					ny = player.y + dy[2];
					player.d = 2;
					break;
				case 'D':
					nx = player.x + dx[3];
					ny = player.y + dy[3];
					player.d = 3;
					break;
				}
				if(map[ny][nx] != '*' && map[ny][nx] != '#' &&
				   map[ny][nx] != '-') {
					player.x = nx;
					player.y = ny;
				}
			}
			
			map[player.y][player.x] = dir[player.d];
			for(int i=1;i<=h;i++) {
				for(int j=1;j<=w;j++)
					System.out.print(map[i][j]);
				System.out.println();
			}
			if(c < t-1) System.out.println();
			else break;
		}
	}
	
	class P {
		int x, y, d;
		P(int x, int y, int d) {
			this.x = x;
			this.y = y;
			this.d = d;
		}
	}

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

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
using namespace std;
#define ll long long
string a,b;
int main()
{
    int i,j,k,m,n;
    cin>>a>>b;
    if(a.size()==b.size())
    {
        if(a>b)
            cout<<"GREATER"<<endl;
        else if(a<b)
            cout<<"LESS"<<endl;
        else
            cout<<"EQUAL"<<endl;
    }
    else if(a.size()>b.size())
        cout<<"GREATER"<<endl;
    else
        cout<<"LESS"<<endl;
    return 0;
}


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

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



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

  string s;
  cin >> s;
  if(s == "AAA" || s == "BBB") cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

ll n;
string s;
vector<pair<ll, ll>> state(2001);//個数、総和
vvl G = VV(2001, 0, 0, ll);

pair<ll, ll> dfs(ll now, ll from){
  pair<ll, ll> ret(0, 0);
  if(s[now]=='1') ret.first++;
  for(auto to:G[now]){
    if(from==to) continue;
    pair<ll, ll> p = dfs(to, now);
    p.second += p.first;
    ret.first += p.first;
    ret.second += p.second;
  }
  return state[now] = ret;
}

//操作の回数、深さの和
pair<ll, ll> dfs2(ll now, ll from){
  pair<ll, ll> ret(0, 0);
  ll m = -1, m_tm = -1;//深さ、操作回数
  pair<ll, ll> S(0, 0);
  for(auto to:G[now]){
    if(from==to) continue;
    pair<ll, ll> p = dfs2(to, now);
    p.second += state[to].first;
    ret.first += p.first;
    ret.second += p.second;
    S.first += p.first;
    S.second += p.second;

    if(m<p.second){
      m = p.second;
      m_tm = p.first;
    }
  }
  if(m==-1) return ret;
  S.first -= m_tm;
  S.second -= m;
  if(S.second+S.first*2>=m){
    ll tm = (S.second+m)/2;
    ret.first += tm;
    ret.second -= tm*2;
  }else{
    ll tm = S.second+S.first*2;
    ret.first -= S.first;
    ret.second += S.first*2;
    ret.first += tm;
    ret.second -= tm*2;
  }
  return ret;
}
ll ans = 10000000000;
void init(ll root){
  pair<ll, ll> S = dfs(root, -1);
  if(S.second%2) return;
  ll need = S.second/2;
  pair<ll, ll> num = dfs2(root, -1);
  if(num.first==need) ans = min(ans, need);
}
int main(int argc, char const *argv[]) {
  std::cin >> n;
  std::cin >> s;
  re(i, n-1){
    ll a, b;std::cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for(int i=0;i<n;i++) init(i);
  std::cout << (ans==10000000000?-1:ans) << '\n';
  return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<queue>
using namespace std;
int main(){
	priority_queue<int,vector<int>,greater<int> > q1;
	priority_queue<int > q2;
	int n,a;
	cin>>n;
	int i=0;
	for(i=0;i<n;i++){
		cin>>a;
		q1.push(a);
		q2.push(a);
	}
	int b,c;
	b=q1.top();
	c=q2.top();
	int d;
	d=c-b;
	cout<<d<<endl;
	return 0;
}


Measured memory_bytes: 256
from collections import deque


def main():

    def f(hi, wi):
        return hi * w + wi

    h, w = map(int, input().split())
    sh, sw = map(int, input().split())
    gh, gw = map(int, input().split())

    s = [input() for _ in range(h)]
    INF = 10 ** 9

    sh -= 1
    sw -= 1
    gh -= 1
    gw -= 1

    dq = deque([f(sh, sw)])
    dist = [[INF] * w for _ in range(h)]
    dist[sh][sw] = 0

    while dq:
        i = dq.popleft()
        hi, wi = divmod(i, w)

        for dh in range(-2, 3):
            for dw in range(-2, 3):
                if dh == 0 and dw == 0:
                    continue
                nh = hi + dh
                nw = wi + dw
                if 0 <= nh <= h - 1 and 0 <= nw <= w - 1 and s[nh][nw] == ".":
                    if abs(dh) + abs(dw) == 1:
                        if dist[hi][wi] < dist[nh][nw]:
                            dist[nh][nw] = dist[hi][wi]
                            dq.appendleft(f(nh, nw))
                    else:
                        if dist[hi][wi] + 1 < dist[nh][nw]:
                            dist[nh][nw] = dist[hi][wi] + 1
                            dq.append(f(nh, nw))

    ans = dist[gh][gw]
    if ans == INF:
        ans = -1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 90124
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#ifndef ONLINE_JUDGE
#define deb(x) cout<<#x<<" : "<<x<<"\n";
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define deb_arr(a,n) {cout<<#a<<":";for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';}
#define deb_mat(dist,n,m) {cout<<#dist<<"\n";for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}}
#else
#define deb(x) ;
#define debug(x,y) ;
#define deb_arr(a,n) ;
#define deb_mat(dist,n,m) ;
#endif
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define all(a) (a).begin(),(a).end()
#define bs binary_search
#define sz size()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define clr fflush(stdout);
//#define clr cout.flush();
#define N 200001
#define fpr(i,a,b) for(int i=a;i<b;i++)
#define fdr(i,a,b) for(int i=a;i>b;i--)
#define repp(i,a,b,d) for(int i=a;i<b;i+=d)
#define repd(i,a,b,d) for(int i=a;i>b;i-=d)
#define LLMIN LLONG_MIN
#define LLMAX LLONG_MAX
#define AKASH_PATEL ios_base::sync_with_stdio(false);
#define SVNIT_SURAT cin.tie(NULL);cout.tie(NULL);
#define mset(x,a) memset(x,a,sizeof(x));
#define nl cout<<'\n';
#define print(c) cout<<c<<'\n';
#define setp(n) cout << fixed << setprecision(n)
#define take_arr(a,n) fpr(i,0,n) cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';
#define take_mat(mat,n,m) fpr(i,0,n) fpr(j,0,m) cin>>mat[i][j];
#define set_mat(mat,n,m,k) fpr(i,0,n) fpr(j,0,m) mat[i][j]=k;
#define print_mat(dist,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}
template< class T > bool inside(T a, T b, T c) { return a<=b && b<=c; }
template< class T > bool odd(T a) { return a&1; }
template< class T > bool even(T a) { return !(a&1); }
int main()
{
//#ifndef ONLINE_JUDGE
//    freopen("../ip.txt", "r", stdin);
//    freopen("../op.txt", "w", stdout);
//#endif
    AKASH_PATEL;
    SVNIT_SURAT;

    int t=1;
    //cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        int c=0;
        fpr(i,0,s.size())
        {
            if(s[i]=='A')
            {
                c++;
            }
        }
        if(c==0 || c==s.sz)
        {
            print("No")
        } else{
            print("Yes")
        }
    }
    return 0;
}





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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >>s;
	
	int n=sz(s);
	ll ans = 0;
	rep(i, n) rep2(j, 1, n+1-i){
		ll w = stoll(s.substr(i, j));
		ans += w * max(1LL, 1LL<< (i-1)) * max(1LL, 1LL<<(n-i-j-1));
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdlib>
#include <cmath>
#define MAX 1000000000000000000LL

using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int a[51],b[51];
    for(int i=0; i<n; i++){
        cin>>a[i]>>b[i];
    }
    int x[105],y[105];
    for(int j=0; j<m; j++){
        cin>>x[j]>>y[j];
    }
    for(int i=0; i<n; i++){
        long long min=MAX;
        int key=0;
        for(int j=0; j<m; j++){
            if(abs(a[i]-x[j])+abs(b[i]-y[j])<min){
                min=abs(a[i]-x[j])+abs(b[i]-y[j]);
                key=j+1;
            }
        }
        cout<<key<<endl;
    }
    return 0;
}


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

int main(){
  int i,j,n,m;
  string id[300],id_2;
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> id[i];
  }

  cin >> m;
    int count=0;
    int k=1;
  while(m>0){
    m--;
    cin >> id_2;
    for(i = 0; i < n; i++){
      if(id_2==id[i]){
	count+=k;
	k++;
      }
    }
    
    if(count==0){
      cout << "Unknown" << " " << id_2 << endl;
    }
    else if(count%2==0){
      cout << "Closed by" << " " << id_2 << endl;
      count=0;
    }else if(count%2!=0){
      cout << "Opened by" << " " << id_2 << endl;
      count=0;
    }
  }
  return 0;
}

Measured memory_bytes: 1216
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
using namespace std;

#define ll long long int 
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;}
 
ll N,M;
ll a[100000];

ll ans = 0;

ll numof2(ll X){//約数の2の個数を返す
	ll ret = 0;
	ll n = X;
	while(1){
		if(n%2==1) return ret;
		n/=2;
		ret+=1;
	}
}
 
void solve(){
	sort(a,a+N);
	ll t = numof2(a[0]/2);
	for(int i=1;i<N;i++){
		if(t!=numof2(a[i]/2))return;
	}
	M >>= t;

	ll lcm_ak = a[0]>>(t+1);
	for(int i=1;i<N;i++){
		lcm_ak = lcm(lcm_ak,a[i]>>(t+1));
	}

	ans = (M/lcm_ak+1)/2;
}
 
int main(){
	cin>>N>>M;
	for(int i=0;i<N;i++) cin>>a[i];

	solve();

	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
N,*as=$<.read.split.map(&:to_i)
MOD=10**9+7

ret = 0

60.times do |i|
    x = y = 0
    as.each do |a|
        a[i]==1 ? x+=1 : y+=1
    end
    # n = as.count {|a| a[i] == 1 } * as.count {|a| a[i] == 0 }
    n = x*y
    ret = (ret + n * 2**i) % MOD
end

puts ret



Measured memory_bytes: 39616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <climits>
#include <sstream>
#include <functional>
#include <complex>

using namespace std;

#define len(array)  (sizeof (array) / sizeof *(array))
#define rep(i, s, e) for(int i = s;i < e;i++)
#define Rep(i, e) for(int i = 0;i < e;i++)
#define rrep(i, e, s) for(int i = e;s <= i;i--)
#define Rrep(i, e) for(int i = e;0 <= i;i--)
#define mrep(i, e, t1, t2) for(map<t1, t2>::iterator i = e.begin(); i != e.end(); i++)
#define vrange(v) v.begin(), v.end()
#define vrrange(v) v.rbegin(), v.rend()
#define vsort(v) sort(vrange(v))
#define vrsort(v) sort(vrrange(v))
#define arange(a) a, a + len(a)
#define asort(a) sort(arange(a))
#define arsort(a, t) sort(arange(a), greater<t>())
#define afill(a, v) fill(arange(a), v)
#define afill2(a, v, t) fill((t *)a, (t *)(a + len(a)), v)
#define fmax(a, b) (a < b? b : a)
#define fmin(a, b) (a > b? b : a)
#define fabs(a) (a < 0? -a : a)
#define pb push_back
#define rg(e, s, t) s <= e && e < t
#define PQDecl(name, tp) priority_queue< tp, vector<tp>, greater<tp> > name;
//#define X real()
//#define Y imag()
//typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
//typedef complex<double> p;
const int INF = (int)2e9;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-10;
//const int dx[] = {1, -1, 0, 0, 1, -1, -1, 1};
//const int dy[] = {0, 0, 1, -1, -1, -1, 1, 1};
//const ll weight[] = {1e0,1e1,1e2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13};
#define MAX_N 52
int H, W, h, w, a[MAX_N][MAX_N], b[MAX_N][MAX_N], c[MAX_N][MAX_N], ans = -1;


void doIt(){
  cin >> H >> W;
  Rep(i, H){
    Rep(j, W){
      cin >> a[i][j];
    }
  }
  Rep(i, H){
    Rep(j, W){
      cin >> b[i][j];
    }
  }
  cin >> h >> w;
  Rep(i, h){
    Rep(j, w){
      cin >> c[i][j];
    }
  }
  ll ans = -INF;
  Rep(i, H){
    if(H < i + h) break;
    Rep(j, W){
      if(W < j + w) break;
      bool bOK = true;
      ll tmp = 0;
      Rep(k, h){
        Rep(l, w){
          if(b[i + k][j + l] != c[k][l]){
            bOK = false;
            break;
          }
          tmp += a[i + k][j + l];
        }
      }
      if(bOK){
        ans = fmax(ans, tmp);
      }
    }
  }
  if(ans == -INF) cout << "NA" << endl;
  else cout << ans << endl;
}

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


Measured memory_bytes: 1188
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

int main(){
    int N;
    cin >> N;
    int W[N];
    Fp(i, 0, N) cin >> W[i];
    int r = 0, S[2] = {};
    S[0] = W[0];
    Fp(i, 1, N) S[1] += W[i];
    r = abs(S[1] - S[0]);
    Fp(i, 1, N - 1){
        S[1] -= W[i];
        S[0] += W[i];
        if(r > abs(S[1] - S[0])){
            r = abs(S[1] - S[0]);
        }
    }
    cout << r << endl;
}

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    char c1, c2;
    if (a < b) {
        c1 = '#';
        c2 = '.';
        swap(a, b);
    } else {
        c1 = '.';
        c2 = '#';
    }

    int H = 100, W = 100;
    vector<string> ans(H, string(W, c2));
    int cnt1 = a - 1 + (b == 1), cnt2 = b - 1;
    for (int i = 1; i < H; i += 2) {
        for (int j = 1; j < W; j += 2) {
            if (cnt2 > 0) {
                ans[i - 1][j] = c1;
                ans[i][j - 1] = c1;
                ans[i][j] = c1;
                cnt2--;
            } else if (cnt1 > 0) {
                ans[i][j] = c1;
                cnt1--;
            } else {
                break;
            }
        }
    }

    cout << H << " " << W << endl;
    for (int i = 0; i < H; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

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

int main(){
  int N, D;
  cin>>N>> D;
  int p;
  if (N%(2*D+1)!=0){
    cout<<N/(2*D+1)+1<<endl;
  }
  else{
    cout<<N/(2*D+1)<<endl;
  }
    
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
#define int long long
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    int k;
    cin >> s >> k;
    string t = s + s;
    int n  = s.length();
    int same = 0;
    if(s[0] == s[n-1])same = 1;
    int ans = 0;
    for(int i = 1; i < n; ++i){
        if(s[i] == s[i-1]){
            s[i] = '?';
            ++ans;
        }
    }
    if((s[n-1] == '?') || (same == 0)){
        cout << k*ans << '\n';
    }
    else {
        int ans2 = 0;
        for(int i = 1; i < 2*n; ++i){
            if(t[i] == t[i-1]){
                t[i] = '?';
                ++ans2;
            }
        }
        if(t[2*n-1] == '?'){
            cout << (k/2)*(ans2-ans) + (k-k/2)*ans<< '\n';
        }
        else {
           cout << ans + (k-1)*(ans2-ans) << '\n';
        }
    }
}

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

using namespace std;

int setPrimeNumberCount(int n) {
    int count = 0;
    vector<int> primeList;
    bool findList[n+1];
    
    if(n >= 2) {
        primeList.push_back(2);
        count++;
        
        for(int i = 2; i <= n; i++){
            findList[i] = false;
        }
        for(int i = 2; i <= sqrt(n); i++){
            if(findList[i]) {
                continue;
            }
            for(int j = i * 2; j <= n; j += i) {
                if(!findList[j]) {
                    findList[j] = true;
                }
            }
        }
    }
    for(int i = 3; i <= n; i += 2){
        if(!findList[i]) {
            primeList.push_back(i);
            count++;
        }
    }
    return count;
}

int main(void) {
    int n;
    int count = 0;
    
    while(cin >> n) {
        count = setPrimeNumberCount(n);
        cout << count << endl;
        count = 0;
    }
    return 0;
}

Measured memory_bytes: 2836
n,k = map(int,input().split())
p = list(map(int,input().split()))
for i in range(n):
    p[i] = (1 + p[i]) / 2
ans = 0.0
tmp = 0.0
for i in range(n):
    tmp += p[i]
    if i >= k:
        tmp -= p[i-k]
    ans = max(ans,tmp)

print(ans)

Measured memory_bytes: 24804
#include <cstdio>

int main(void) {
	int money = 100000;
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		money *= 1.05;
		if(money % 1000)
			money = money - (money % 1000) + 1000;
	}
	printf("%d\n", money);
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main()
{
	int a;
	int b;
	scanf("%d %d", &a, &b);

	if(a < b)
	{
		printf("a < b\n");
	}
	else if(a > b)
	{
		printf("a > b\n");
	}
	else
	{
		printf("a == b\n");
	}

	return 0;
}



Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
//const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

ll a[3030][3030], dp[3030][3030][5];

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

  ll r, c, k;
  cin >> r >> c >> k;
  rep(i, k) {
    ll x, y, v;
    cin >> x >> y >> v;
    a[x][y] = v;
  }
  FOR(i, 1, r + 1) {
    FOR(j, 1, c + 1) {
      rep(k, 4) {
        chmax(dp[i][j][0], dp[i - 1][j][k]);
        chmax(dp[i][j][1], dp[i - 1][j][k] + a[i][j]);
        chmax(dp[i][j][k], dp[i][j - 1][k]);
        if (k) chmax(dp[i][j][k], dp[i][j - 1][k - 1] + a[i][j]);
      }
    }
  }
  ll ans = 0;
  rep(k, 4) chmax(ans, dp[r][c][k]);
  cout << ans << '\n';

  
  return 0;
}

Measured memory_bytes: 429640
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int k = Integer.parseInt(sc.next());
        Set<String> set = new TreeSet<>();
        for (int i = 0; i < s.length(); i++) {
            for (int j = i; j < Math.min(s.length(), k + i); j++) {
                set.add(s.substring(i, j + 1));
            }
        }
        int idx = 0;
        for (String ans : set) {
            if (idx + 1 == k) {
                System.out.println(ans);
                break;
            }
            idx++;
        }
    }
}

Measured memory_bytes: 27348
#include<iostream>
using namespace std;
int main(){
    int n,m,x;
    int a[200];
    cin >>n>>m>>x;
    for(int i=0;i<m;++i){
        cin >>a[i];
    }
    int s,t;
    s=0;t=0;
    for(int i=0;i<m;++i){
        if(a[i]<x) ++s;
        if(a[i]>x) ++t;
    }
    if(s<t){
        cout << s <<endl;
    }else{
        cout <<t <<endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
int main(){
	/*ax+by=c
	 *dx+ey=f
	 *
	 *aex+bey=ce
	 *bdx+bey=bf
	 *(ae-bd)x=ce-bf
	 *x=(ce-bf)/(ae-bd)
	 *
	 *adx+bdy=dc
	 *adx+aey=af
	 *(bd-ae)y=dc-af
	 *y=(dc-af)/(bd-ae)*/
	int a,b,c,d,e,f;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF){
		printf("%.3lf %.3lf\n",(double)(c*e-b*f)/(a*e-b*d)+0.00049999,(double)(d*c-a*f)/(b*d-a*e)+0.00049999);
	}
	return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

bool isSame(const char* pS, const char* pTt, const uint n){
    for(uint i=0; i<n; ++i){
        if(pS[i]==pTt[i]){ continue; }
        return false;
    }
    return true;
}

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

    string s; cin >> s;
    string t; cin >> t;
    string tt = t + t;
    
    for(uint i=0; i<s.size(); ++i){
        if(!isSame(&s[0], &tt[i], s.size())){ continue; }
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

long long n, a[202020];

int main(){
  cin >> n;
  a[0] = 0;
  rep(i, n){
    long long tmp; cin >> tmp;
    a[i] = a[i - 1] + tmp;
  }
  map<long long, long long> mp;
  rep(i, n + 1){
    mp[a[i]]++;
  }
  long long res = 0;
  for(auto x : mp){
    long long tmp = x.second * (x.second - 1);
    tmp /= 2;
    res += tmp;
  }
  cout << res << endl;
}


Measured memory_bytes: 14336
import sys
import numpy as np
import math
import collections
import copy
import decimal
from collections import deque 
from functools import reduce
from itertools import product
from itertools import combinations
N, X, M = map(int, input().split())
# X^2がMより大きい場合はMで割った余り、小さければそのままを返却
def f(X, M):
    if X**2 >= M:
        return X**2 % M
    else:
        return X**2
appear = np.full(M, -1)
seq = []
fx = X
appear[fx] = 0
seq.append(fx)
for i in range(1, N):
    fx = f(fx, M)
#     print(fx, appear[fx])
    if appear[fx] != -1:
        loop_st = appear[fx]
        loop_en = i
        break
    seq.append(fx)
    appear[fx] = i
seq.insert(0, 0)
seq_sum = np.cumsum(seq)

if N <= len(seq)-1 :
    print(seq_sum[N])
else:
    # ループの前まで
    lp_b = seq_sum[loop_st-1]
    # ループしている個数
    loop_num = (len(seq_sum)-1) - loop_st
    qu = (N-(loop_st)) // loop_num
    mo = (N-(loop_st)) % loop_num
    lp_sum = (seq_sum[-1] - seq_sum[loop_st]) * qu
    lp_en = seq_sum[loop_st+mo] - seq_sum[loop_st-1]
    print(lp_b+lp_sum+lp_en)
    













Measured memory_bytes: 30620
#include <iostream> 
#include <cstdio> 
#include <cstdlib> 
#include <cstring> 
#include <cmath> 
#include <algorithm> 
using namespace std; 
const int Mod = 1e9 + 7; 
const int MAX_N = 3e3 + 5; 
int N, M; 
int f[MAX_N][MAX_N][2]; 
void pls(int &x, int y) { x += y; if (x >= Mod) x -= Mod; } 
int main () { 
	cin >> N >> M; 
	f[0][0][1] = 1; 
	for (int i = 1; i <= N; i++) f[0][i][0] = 1; 
	for (int i = 0; i < M; i++) 
		for (int j = 0; j <= N; j++) { 
			if (j >= 1) {
				//2 black
				pls(f[i + 1][j - 1][1], f[i][j][1]); 
				if (j == 1) pls(f[i + 1][j - 1][1], f[i][j][0]); 
				else pls(f[i + 1][j - 1][0], f[i][j][0]); 
			} 
			if (j < N) { 
				//2 white
				pls(f[i + 1][j + 1][1], f[i][j][1]); 
				pls(f[i + 1][j + 1][0], f[i][j][0]); 
			} 
			if (j >= 1) { 
				//1 black 1 white 
				pls(f[i + 1][j][1], f[i][j][1]); 
				if (j == 1) pls(f[i + 1][j][1], f[i][j][0]); 
				else pls(f[i + 1][j][0], f[i][j][0]); 
			} 
			if (j < N) { 
				//1 white 1 black 
				pls(f[i + 1][j][1], f[i][j][1]); 
				pls(f[i + 1][j][0], f[i][j][0]); 
			} 
		} 
	int ans = 0; 
	for (int i = 0; i <= N; i++) pls(ans, f[M][i][1]); 
	printf("%d\n", ans); 
    return 0; 
} 

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

int main() {
  int N;
  cin >> N;
  vi L(N);
  rep(i, N) cin >> L[i];
  sort(L.begin(), L.end());
  int ans = 0;
  rep(i, N) srep(j, i + 1, N) srep(k, j + 1, N) {
    if (L[i] == L[j]) continue;
    if (L[j] == L[k]) continue;
    if (L[k] == L[i]) continue;
    if (L[i] + L[j] > L[k]) ans++;
  }

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


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

int main(){
  int E;
  while(cin >> E){
    if(E==0) break;
    int min=E;
    int sum;
    for(int z=0;z*z*z<=E;++z){
      int y=sqrt(E-z*z*z);
      int x=E-z*z*z-y*y;
      sum=x+y+z;     
      if(min>sum) min=sum;
    }
    cout<< min <<endl;
  }
  return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 h,w;
  cin >> h >> w;
  if(h > w)swap(h,w);
  if(h == 1)ANS(1);
  else ANS((h*w+1)/2);
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int k, x; cin>>k>>x;
    for(int i=x-k+1; i<=x+k-1; i++){
        cout << i << " ";
    }
    cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<stdio.h>
using namespace std;

int main(){
    int n,x;
    cin >> n;
    string command;
    list<int> lst;
    list<int>::iterator s;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        cin >> command;
        if(command == "insert"){
            cin >> x;
            lst.push_front(x);
        }
        else if(command == "delete"){
            cin >> x;
            for(s = lst.begin();s != lst.end();s++){
                if(*s == x){
                    lst.erase(s);
                    break;
                }
            }
        }
        else if(command == "deleteFirst"){
            lst.pop_front();
        }
        else if(command == "deleteLast"){
            lst.pop_back();
        }
    }
    int i = 0;
    for(s = lst.begin();s != lst.end();s++){
        if(i > 0){
            cout << " ";
        }
        cout << *s;
        i++;
    }
    cout << endl;
}


Measured memory_bytes: 34468
#include <iostream>
  #include <string>
  #include <vector>
  #include <algorithm>
  #include <utility>
  using namespace std;
  typedef long long ll;
  #define rep(i,n) for (int i=0;i < (int)(n);i++)
  

  int main(){
      int n,m; cin >> n >> m;
      string s;
      cout << n*n-m << endl;
  }


Measured memory_bytes: 256
if __name__ == '__main__':
    s = list(input())
    ans = [0] * (len(s) + 1)
    for i in range(len(s)):
        if s[i] == "<":
            ans[i + 1] += ans[i] + 1
    for i in range(len(s) - 1, -1, -1):
        if s[i] == ">":
            ans[i] = max(ans[i], ans[i + 1] + 1)
    print(sum(ans))


Measured memory_bytes: 26800
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 110;
const int maxv = 100100;
bool dp[maxv];
int arr[maxn], n, k;

int main() {
    cin>>n>>k;
    for(int i=1;i<=n;i++) {
        cin>>arr[i];
    }

    dp[0] = false;
    for(int i=1;i<=k;i++) {
        bool check = false;
        for(int j=1;j<=n;j++) {
            if(i - arr[j] >= 0) {
                if(!dp[i-arr[j]]) {
                    check = true;
                }
            }
        }
        dp[i] = check;
    }

    if(dp[k]) {
        cout<<"First\n";
    }
    else {
        cout<<"Second\n";
    }
    return 0;
}


Measured memory_bytes: 384
use std::cmp;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let m: usize = sc.read();
    let mut graph = vec![vec![]; n];
    for i in 0..m {
        let a = sc.read::<usize>() - 1;
        let b = sc.read::<usize>() - 1;
        graph[a].push((b, i));
        graph[b].push((a, i));
    }

    let ge_six = graph.iter().filter(|g| g.len() >= 6).count();

    let all_even = graph.iter().all(|g| g.len() % 2 == 0);
    if !all_even {
        println!("No");
    } else if ge_six > 0 {
        println!("Yes");
    } else if graph.iter().filter(|g| g.len() == 4).count() >= 3 {
        println!("Yes");
    } else if graph.iter().filter(|g| g.len() == 4).count() <= 1 {
        println!("No");
    } else {
        let four2 = (0..n).filter(|&i| graph[i].len() == 4).collect::<Vec<_>>();

        let f1 = four2[0];
        let f2 = four2[1];

        let mut reach_f1 = 0;

        let mut used = vec![false; m];
        for i in 0..4 {
            if used[graph[f1][i].1] {
                continue;
            }
            used[graph[f1][i].1] = true;
            let mut cur = graph[f1][i].0;
            while cur != f1 && cur != f2 {
                assert_eq!(graph[cur].len(), 2);
                let next = &graph[cur];
                let i = if used[next[0].1] { 1 } else { 0 };
                assert!(!used[next[i].1]);
                used[next[i].1] = true;
                cur = next[i].0;
            }
            if cur == f1 {
                reach_f1 += 1;
            }
        }

        if reach_f1 == 1 {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 14588
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<array>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){


    int n;
    cin>>n;
    int ar[n+1][n+1];
    for(int i=0;i<n+1;i++){
        for(int j=0;j<n+1;j++){
            ar[i][j]=0;
         
        }
    }
    
    for(int i=1;i<n+1;i++){
        
        int x,y;
        cin>>x>>y;
        for(int j=0;j<y;j++){
            int t;
            cin>>t;
            ar[x][t]=1;
        }
    }
    
    for(int i=1;i<n+1;i++){
        for(int j=1;j<n+1;j++){
            cout<<ar[i][j];
            if(j!=n)cout<<" ";
            else cout<<endl;
        }
    }




return 0;
}



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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	string u[n];
	for (int i = 0; i < n; ++i) cin>>u[i];
	int m;
	cin>>m;
	string t;
	bool open=0;
	for (int i = 0; i < m; ++i)
	{
		cin>>t;
		bool find=0;
		for (int j = 0; j < n; ++j) if(t==u[j]) find=1;
		if(find)
		{
			if(open) cout<<"Closed by "<<t<<endl,open=0;
			else cout<<"Opened by "<<t<<endl,open=1;
		}
		else cout<<"Unknown "<<t<<endl;
	}
	return 0;
}


Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int X, Y, x, y;
  cin >> X >> Y >> x >> y;
  
  x -= X;
  y -= Y;
  
  for(int i; i < y; i++)
    cout << 'U'; 
  for(int i; i < x; i++)
    cout << 'R';
  for(int i; i < y; i++)
    cout << 'D'; 
  for(int i; i < x; i++)
    cout << 'L';
  cout << "LU";
  for(int i; i < y; i++)
    cout << 'U'; 
  for(int i; i < x; i++)
    cout << 'R';
  cout << "RDRD";
  for(int i; i < y; i++)
    cout << 'D'; 
  for(int i; i < x; i++)
    cout << 'L';
  cout << "LU" << endl;

}

Measured memory_bytes: 256
N,M = map(int, input().split())
AB = [[int(i) - 1 for i in input().split()] for _ in range(M)]

AB.sort(key=lambda x:x[1])

broken = [False] * (N - 1)

right = -1
for a,b in AB:
    if a > right:
        broken[b - 1] = True
        right = b - 1

print(broken.count(True))

Measured memory_bytes: 65436
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int r = scanner.nextInt();
        if (n >= 10) {
            System.out.println(r);
        }   else {
            int x = r + 100 * (10 - n);
            System.out.println(x);
        }
    }
}


Measured memory_bytes: 21844
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int pow1(int n)
{
int i,s=1;
for(i=0;i<n;i++)
	s=s*2;
return s;
}
int main()
{
int i,j,n,max=0,t,s;
scanf("%d",&n);
if(n==1){printf("1");return 0;}
if(n%2)n--;
for(i=n;i>0;i=i-2)
{
for(j=6;j>0;j--)
{
	s=pow1(j);
if(i%s==0)
{
	if(j>max){max=j;t=i;}
}
}
}
printf("%d",t);
return 0;
}


Measured memory_bytes: 128
import math
from pprint import pprint


def submit():
    n = int(input())
    p = list(map(float, input().split()))

    dp = [[0 for _ in range(i + 1)] for i in range(n + 1)]
    dp[0][0] = 1
    for i in range(n):
        for j in range(i + 1):
            dp[i + 1][j] += (1 - p[i]) * dp[i][j]
            dp[i + 1][j + 1] += p[i] * dp[i][j]

    thr = n // 2
    ans = 0
    for i in range(thr + 1, n + 1):
        ans += dp[n][i]

    print(ans)

submit()

Measured memory_bytes: 150280
#include<bits/stdc++.h>
using namespace std;
//int dp[3001][3001];
const int mod=1e9+7;
#define pb push_back
#define ll long long
int main()
{
    int n,x;
    cin>>x>>n;
    int a[n];
    int mi=INT_MAX,val=0;
    vector<int> ans,mark(106,0);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        mark[a[i]]++;
       // mi=max(mi,a[i]);
    }
    
    if(x<=0) {cout<<x<<endl;return 0;}
        for(int i=0;i<=106;i++)
    {
        if(mark[i]==0)
        {
            if(abs(i-x)<mi)
            {
                val=i;
                mi=abs(i-x);
            }
            // mi=min(mi,abs(i-x));

        }
    }
    cout<<val<<endl;
        
    
    
    
}

Measured memory_bytes: 3628