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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=1'000'000'007;
const double EPS=1e-14;
const bool DEBUG=true;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

/////


void answer(){
    int a, b;
    cin>>a>>b;
    cout<<a*b<<endl;


    return;
}

/////

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

    answer();

    return 0;
}


Measured memory_bytes: 3656
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, k;
  cin >> n >> k;
  
  vector<int> h(n);
  REP(i,n){
    cin >> h[i];
  }

  int dp[100001];
  REP(i,n){
    dp[i] = 1 << 30;
  }
  dp[0] = 0;
  REP(i,n){
    for(int j = 1; j <= k; ++j){
      if(i + j < n){
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
      }
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}



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

int n, m;
vector<string> b;
int ans;
string kZero;

void dfs(int cur, int cnt, string bit) {
  if (cur == n) {
    if (bit == kZero) ans = max(ans, cnt);
    return;
  }
  dfs(cur + 1, cnt, bit);
  string nxt;
  for (int i = 0; i < m; ++i) nxt += "01"[(bit[i] ^ b[cur][i]) % 2];
  dfs(cur + 1, cnt + 1, nxt);
}

void bitDP() {
  auto bit = vector<ll>(n);
  for (int i = 0; i < n; ++i) bit[i] = stoll(b[i], nullptr, 2);

  auto cur = vector<int>(1 << m, -1);
  auto nxt = vector<int>(1 << m, -1);
  cur[0] = 0;
  for (int i = 0; i < n; ++i) {
    for (ll j = 0; j < 1 << m; ++j) {
      if (cur[j] == -1) continue;
      nxt[j] = max(nxt[j], cur[j]);
      nxt[j ^ bit[i]] = max(nxt[j ^ bit[i]], cur[j] + 1);
    }
    swap(cur, nxt);
  }
  ans = cur[0];
}

int main() {
  while (cin >> n >> m, n) {
    b = vector<string>(n);
    for (int i = 0; i < n; ++i) cin >> b[i];
    ans = 0;
    if (m <= 22) {
      bitDP();
    } else {
      kZero = string(m, '0');
      dfs(0, 0, kZero);
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 35760
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> x1 >> y1 >> x2 >> y2;
  x3 = y1+x2-y2;
  y3 = -x1+x2+y2;
  x4 = x1+y1-y2;
  y4 = -x1+y1+x2;
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}

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

typedef long long 		ll;
typedef vector<ll> 		vll;
typedef pair<ll,ll> 	pll;
typedef vector<pll> 	vpll;
typedef vector<int> 	vi;
typedef pair<int,int> 	pii;
typedef vector<pii> 	vpii;

#define fi				first
#define se 				second
#define pb 				push_back
#define mp 				make_pair
#define all(v)			v.begin(),v.end()
#define sz(v)			s.size()
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define per(i,a,b) 		for(int i=a;i>=b;i--)
#define fill(a,v)		memset(a,v,sizeof(a))
#define tc				int T;cin>>T;while(T--)
#define nl				printf("\n")
#define aya				cerr<<"yaha aya"<<"\n"
#define debug(x,y)		printf("%d %d\n",x,y)
#define fast_io			ios_base::sync_with_stdio(false);cin.tie(NULL);
#define grt				greater<int>()

const int mod = 1e9+7;
const int mod2= 1e9+9;

inline int pow_(ll a, int n, int p=mod){
	int r=1;while(n){if(n&1)r=r*a%p;n>>=1;a=a*a%p;}return r;
}

int main(void)
{
	double R;
	cin >> R;
	double ans = 2 * M_PI * R;
	cout << fixed << setprecision(12) << ans << "\n";
}

Measured memory_bytes: 3784
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100000

int N = 1;
int data[4*NUM];

void init(int first_N){
	while(N < first_N)N *= 2;
}

void update(int update_left,int update_right,int new_value,int node_id,int node_left,int node_right){
	if(update_right < node_left || update_left > node_right)return;
	else if(update_left <= node_left && update_right >= node_right){
		data[node_id] = new_value;
	}else{
		if(data[node_id] != -BIG_NUM){
			data[2*node_id+1] = data[node_id];
			data[2*node_id+2] = data[node_id];
			data[node_id] = -BIG_NUM;
		}
		update(update_left,update_right,new_value,2*node_id+1,node_left,(node_left+node_right)/2);
		update(update_left,update_right,new_value,2*node_id+2,(node_left+node_right)/2+1,node_right);
	}
}

int getSum(int search_left,int search_right,int node_id,int node_left,int node_right){
	if(search_right < node_left || search_left > node_right){
		return 0;
	}else{
		if(data[node_id] == -BIG_NUM){
			int left = getSum(search_left,search_right,2*node_id+1,node_left,(node_left+node_right)/2);
			int right = getSum(search_left,search_right,2*node_id+2,(node_left+node_right)/2+1,node_right);
			return left+right;
		}else{
			return (min(search_right,node_right)-max(search_left,node_left)+1)*data[node_id];
		}
	}
}


int main(){

	int first_N,num_query;
	scanf("%d %d",&first_N,&num_query);

	init(first_N);

	for(int i = 0; i <= 2*N-2; i++){
		data[i] = 0;
	}

	int command,left,right,value;

	for(int loop = 0; loop < num_query; loop++){
		scanf("%d",&command);

		if(command == 0){ //update
			scanf("%d %d %d",&left,&right,&value);
			update(left,right,value,0,0,N-1);
		}else{
			scanf("%d %d",&left,&right);
			printf("%d\n",getSum(left,right,0,0,N-1));
		}
	}

	return 0;
}



Measured memory_bytes: 4236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 10100000
#define INF 1e15
#define MAP 110
#define initial_value -1
#define LINF 1LL << 60
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
long long NN(ll x){
    if(x % 4 == 0) return x;
    else if(x % 4 == 1) return 1;
    else if(x % 4 == 2) return x+1;
    else return 0;
}
int main(){
    ll A,B; cin >> A >> B;
    ll ans;
    ans = NN(B)^NN(A-1);
    cout << ans << endl;
}


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

#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define out(a) cout << a << endl
#define PRINT(V) for (auto v : (V)) cout << v << " "

const int MOD = 1000000007;
const double PI = acos(-1.0);

void solve() {
    ll N;
    cin >> N;
    ll a=100, count=0;
    while(1){
        count++;
        a = a+a/100;
        if(N<=a) break;
    }
    out(count);
}
int main() {
    INCANT;
    solve();
    return 0;
}




Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;

string s;

bool used[2000][2000];
int ans[2000][2000];

int dfs(int l, int r) {
	if (l >= r)return 0;
	if (used[l][r])return ans[l][r];
	used[l][r] = true;
	if (s[l] == s[r]) {
		return ans[l][r] = dfs(l + 1, r - 1);
	}
	else {
		int ret = min(dfs(l + 1, r), dfs(l, r - 1))+1;
		return ans[l][r] = ret;
	}
}

bool chked[2000][2000];
ll num[2000][2000];
ll dfs2(int l, int r) {
	if (l >= r)return 1;
	if (chked[l][r])return num[l][r];
	chked[l][r] = true;
	if (s[l] == s[r]) {
		return num[l][r] = dfs2(l + 1, r - 1);
	}
	else {
		ll ret = 0;
		if (ans[l][r] == dfs(l + 1, r)+1) {
			ret += dfs2(l + 1, r);
		}
		if (ans[l][r] == dfs(l, r - 1)+1) {
			ret += dfs2(l, r - 1);
		}
		if (ret > INF)ret = INF;
		return num[l][r] = ret;
	}
}



void solve() {
	ll k; cin >> s >> k;
	int n = s.length();
	dfs(0, n - 1);
	dfs2(0, n - 1);
	int l = 0, r = n - 1;
	string out;
	while (l < r) {
		//cout << k << " " << l << " " << r << endl;
		if (s[l] == s[r]) {
			out.push_back(s[l]); l++; r--;
		}
		else {
			if (s[l] < s[r]) {
				if (ans[l][r] == dfs(l + 1, r) + 1) {
					ll c = dfs2(l + 1, r);
					if (k <= c) {
						out.push_back(s[l]); l++;
					}
					else {
						if (ans[l][r] == dfs(l, r - 1) + 1) {
							k -= c;
							out.push_back(s[r]); r--;
						}
						else {
							cout << "NONE" << endl; return;
						}
					}
				}
				else {
					out.push_back(s[r]); r--;
				}
			}
			else {
				if (ans[l][r] == dfs(l, r - 1) + 1) {
					ll c = dfs2(l, r - 1);
					if (k <= c) {
						out.push_back(s[r]); r--;
					}
					else {
						if (ans[l][r] == dfs(l + 1, r) + 1) {
							k -= c;
							out.push_back(s[l]); l++;
						}
						else {
							cout << "NONE" << endl; return;
						}
					}
				}
				else {
					out.push_back(s[l]); l++;
				}
			}
		}
	}
	if (k != 1) {
		cout << "NONE" << endl; return;
	}
	string out2 = out; reverse(out2.begin(), out2.end());
	if (l == r)out.push_back(s[l]);
	out += out2;
	cout << out << endl;
}

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

	//cout << fixed << setprecision(10);
	//init();
	solve();
	//stop
		return 0;
}


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

int main(){
	int n;
	int pointOfTaro = 0;
	int pointOfHanako = 0;

	cin >> n;

	string cardTaro, cardHanako;
	for(int i = 0; i < n; i++){
		cin >> cardTaro >> cardHanako;
		if(cardHanako > cardTaro){
			pointOfHanako += 3;
		}else if(cardHanako < cardTaro){
			pointOfTaro += 3;
		}else{
			pointOfTaro += 1;
			pointOfHanako += 1;
		}
	}
	cout << pointOfTaro << " " << pointOfHanako << endl;

	return 0;
}


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

# if A[0] < 0:
#     if abs(A[0]) >= abs(A[1]):
#         A[0] = -A[0]
#         A[1] = -A[1]

# for i in range(1, N-1):
#     if A[i] < 0:
#         if A[i-1] < A[i+1]:
#             if abs(A[i]) >= abs(A[i-1]) or A[i-1] < 0:
#                 A[i-1] = -A[i-1]
#                 A[i] = -A[i]
#         else:
#             if abs(A[i]) >= abs(A[i+1]) or A[i+1] < 0:
#                 A[i+1] = -A[i+1]
#                 A[i] = -A[i]

cou = 0
min_abs = 10000000000
for i in range(N):
    if A[i] < 0:
        cou += 1
    min_abs = min(min_abs, abs(A[i]))
    A[i] = abs(A[i])

if cou % 2 == 0:
    print(sum(A))
else:
    print(sum(A)-2*min_abs)


Measured memory_bytes: 14332
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  string s;
  cin >> s;
  int n = 0;
  int r = 0;
  F0R(i, s.size()) {
    if (s[i] == 'R') n++;
    else n = 0;
    chmax(r, n);
  }
  cout << r;
}
#endif


Measured memory_bytes: 3668
# 参考:http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3701512#1
import sys
sys.setrecursionlimit(100000)

dir = ((0, 1), (0, -1), (1, 0), (-1, 0))
def search(x, y, target):
    mp[y][x] = "X"
    for dx, dy in dir:
      nx = x + dx
      ny = y + dy
      if mp[ny][nx] == target:
        search(nx, ny, target)

while True:
  h, w = map(int, input().split())
  if h == 0:
    break

  mp = [list("X" + input() + "X") for _ in range(h)]
  mp.insert(0, ["X"] * (w + 2))
  mp.append(["X"] * (w + 2))
  ans = 0
 
  for x in range(1, w + 1):
    for y in range(1, h + 1):
      target = mp[y][x]
      if target != "X":
        search(x, y, target)
        ans += 1
  print(ans)


Measured memory_bytes: 15908
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;

template<class T> T umax(T a,T b) {return (a>b?a:b);}
template<class T> T umin(T a,T b) {return (a<b?a:b);}
template<class T,class P> T umax(T a,P b) {return (a>b?a:b);}
template<class T,class P> T umin(T a,P b) {return (a<b?a:b);}

typedef long long int ll;
const int maxn = 1e5+7;
const ll mod = 1e9+7;

bool compare(const pair<ll,ll>& x, const pair<ll,ll>& y) {
    if(x.second == y.second) return x.first < y.first;
    return x.second < y.second;
}

ll power(ll a,ll b) {
    ll res = 1;
    while(b) {
        if(b&1) {
            res = (res*a)%mod;
        }
        a = (a*a)%mod;
        b >>= 1;
    }
    return res;
}

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



int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++) {
        cin >> a[i];
    }
    vector<int> dp(n,1e9);
    dp[0] = 0;
    for(int i=1;i<n;i++) {
        for(int j=1;j<=2;j++) {
            if(i-j >= 0) {
                dp[i] = min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
            }
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

template <long long mod>
long long mod_pow(long long a, long long b) {
    if (b == 0) return 1;
    long long ret = mod_pow<mod>(a, b / 2);
    ret = ret * ret % mod;
    if (b % 2 == 1) ret = a * ret % mod;
    return ret;
}

template <long long mod>
struct Comb {
    int n;
    vector<long long> fact, inv;

    Comb(int n)
        : n(n), fact(n + 1, 0), inv(n + 1, 0) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % mod;
        inv[n] = mod_pow<mod>(fact[n], mod - 2);
        for (int i = n; i >= 1; i--) inv[i - 1] = inv[i] * i % mod;
    }

    long long operator()(int m, int k) {
        if (m > n || m < k || k < 0)
            return 0;
        else
            return fact[m] * inv[m - k] % mod * inv[k] % mod;
    }
};

const ll MOD = TEN(9) + 7;

ll k;
string s;

int main() {
    fastio();

    cin >> k >> s;

    Comb<MOD> comb(k + s.size());

    ll ans = 0;
    for (int i = s.size() - 1; i < k + s.size(); i++) {
        ll c1 = i + 1 - s.size();
        ll c2 = k + s.size() - (i + 1);
        ans = (ans + mod_pow<MOD>(25, c1) * comb(i, s.size() - 1) % MOD * mod_pow<MOD>(26, c2) % MOD) % MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 35648
from collections import Counter

N = int(input())
As = map(int, input().split())

counter = Counter(As)

sum = 0
for key in counter:
    sum += int(key) * counter[key]

Q = int(input())
for _ in range(Q):
    b, c = map(int, input().split())
    if b in counter:
        counter[c] += counter[b]
        sum += counter[b] * (c-b)
        del counter[b]

    print(sum)


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

int main()
{


	int a, b;
	cin >> a >> b;
	double A = a;
	double B = b;
	double C = A / B;
	
	printf("%d %d %lf\n", a/b, a%b, C);

	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
#define lo long
const long long lmax=1999999999;
const long long lmx=1999999999999999999;
string a,b;
int main(){std::ios::sync_with_stdio(false);
	cin>>a>>b;
	if(a.size()!=b.size())
	{
		cout<<"No"<<endl;
		return 0;
	}
	int n=(int)b.size()+5;
	while(n--)
	{
		if(a==b)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
		string c="";
		c+=b[(int)b.size()-1];
		for(int i=0;i<b.size()-1;i++)
			c+=b[i];
		b=c;
	}
	cout<<"No"<<endl;
	return 0;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
               *       * *       *
               *        *        *
                *               *
                 *             *
                  *           *
                   *         *
                    *       *
                     *     *
                      *   *
                       * *
                        *



*/





Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        mut an:chars,
    }
    an.dedup();
    let ans = if an.len() == 4 {
        "Good"
    } else {
        "Bad"
    }; 
    println!("{}",ans);
}



Measured memory_bytes: 4352
s = input()

if s[0] == "A" and s[2 : len(s) - 1].count("C") == 1 and s.count("C") == 1:
    s = s[1:].replace("C", "c")
    if s.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")

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

int main() {
  double a, h, x;
  double pi = 3.14159265358979;
  cin >> a >> h >> x;
  if (h*a*a < x*2) {
    double l = 2*(h - x/a/a);
    cout << fixed << setprecision(12);
    cout << 180*atan(l/a)/pi << endl;
  }
  else {
    double d = 2*x/(a*h);
    cout << fixed << setprecision(12);
    cout << 180*atan(h/d)/pi << endl;
  }
}

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

int isPrime (int n) {
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) return 0;
    }
    return 1;
}

int main() {
    int dp[1000100] = {0};
    for (int i = 2; i <= 1000000; i++) {
        if (isPrime(i)) dp[i] = dp[i - 1] + 1;
        else dp[i] = dp[i - 1];
    }

    int n;
    while (cin >> n) cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 6920
n, m= list(map(int, input().split()))
a = list(input())
dig = "1234567890"
ans = "Yes"
for i in range(n):
    if a[i] not in dig:
        ans = "No"
if a[n] != "-":
    ans = "No"
for l in range(n+1, n+m+1):
    if a[l] not in dig:
        ans = "No"
print(ans)

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int N; cin >> N;
  vector<int> A(N); REP(i, N) cin >> A[i];
  vector<int> odd(N); REP(i, N) odd[i] = 0;
  vector<int> even(N); REP(i, N) even[i] = 0;
  ll INF = pow(10, 9) + 7;
  if(N % 2 == 1) {
    for(int i = 0; i < N; ++i) {
      odd[A[i]]++;
    }
    bool flag = false;
    for(int i = 1; i < N; ++i) {
      if(i % 2 == 0) {
        if(odd[i] != 2) {
          flag = true;
        }
      }
    }
    if(flag == true) cout << 0 << endl;
    else {
      ll ans = 1;
      for(int i = 0; i < (N - 1) / 2; ++i) {
        ans *= 2;
        ans %= INF;
      }
      cout << ans << endl;
    }
  } else {
    for(int i = 0; i < N; ++i) {
      even[A[i]]++;
    }
    bool flag = false;
    for(int i = 1; i < N; ++i) {
      if(i % 2 == 1) {
        if(even[i] != 2) {
          flag = true;
        }
      }
    }
    if(flag == true) cout << 0 << endl;
    else {
      ll ans = 1;
      for(int i = 0; i < N / 2; ++i) {
        ans *= 2;
        ans %= INF;
      }
      cout << ans << endl;
    }
  }
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
ll fact[110000];
// Binary Indexed Tree (Fenwick Tree)
// https://youtu.be/lyHk98daDJo?t=7960
const int mod = 1000000007;
template<typename T>
struct BIT {
int n;
vector<T> d;
BIT(int n=0):n(n),d(n+1) {}
void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
    d[i] += x;
    }
}
T sum(int i) { //[0,i]のsum
    T x = 0;
    for (i++; i; i -= i&-i) {
    x += d[i];
    }
    return x;
}
T sum(int l, int r) { // [l,r)のsum
    return sum(r-1) - sum(l-1);
}
};
int main()

{
    rep(i,110000)fact[i] = 1LL;
    for(int i = 1;i<110000;i++){
        fact[i] = (fact[i-1]*i)%mod;
        fact[i] %= mod;
        
        if(fact[i] <0)fact[i] += mod;
    }

    while(1){
    int n;cin >> n;
    if(n == 0)break;
    int r;cin >> r;
    vector<int> a(n+1);
    for(int i = 1;i <=n;i++){
        a[i] = i;

    }
    rep(i,r){
        int s,t;cin >> s >> t;
        swap(a[s],a[t]);

    }
 
    BIT<int> bit(n+1);
    rep(i,n)bit.add(i+1,1);
    int res = 0;
    int num = n;
    rep(i,n){
        
        int x = a[i+1];
        num--;
        bit.add(x,-1);
        int tmp = bit.sum(x);
  
        tmp = (tmp*fact[num])%mod;
        tmp%= mod;
        if(tmp < 0 )tmp += mod;
       
        res = (res + tmp)%mod;
        
        if(res<0)res += mod;
        
        
    }
    cout << (res+mod )%mod<< endl;
      
    }
    
  

    return 0;
}



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

long long a,b;

int main(){

	cin>>a>>b;

    if(a==1 && b==1){
        cout<<"1 2"<<endl<<".#"<<endl;
        return 0;
    }
    
    
    if(a==1){
        b++;
    }
    if(b==1){
        a++;
    }

    char m[101][101];
    int y=0;
    
    
    while(a>1){
        
    for(int i=0;i<100;i++){
        if(i%2 && a>1){
        m[y][i]='.';
        a--;
        }
        else
        m[y][i]='#';
    }
    y++;
    for(int i=0;i<100;i++){
        m[y][i]='#';
    }
    y++;
    }
    
    while(b>1){
        
        for(int i=0;i<100;i++){
        m[y][i]='.';
        }
        y++;
        for(int i=0;i<100;i++){
        if(i%2 && b>1){
        m[y][i]='#';
        b--;
        }
        else
        m[y][i]='.';
        }
    y++;
        
    }
    
    cout<<y<<" "<<100<<endl;
    
    for(int i=0;i<y;i++){
        for(int j=0;j<100;j++)
        cout<<m[i][j];
        
        cout<<endl;
    }
return 0;
}


Measured memory_bytes: 256
ab = [list(map(int,input().split())) for _ in range(3)]
d = {}
for a,b in ab:
  if(a not in d):
    d[a] = 1
  else:
    d[a] += 1
  if(b not in d):
    d[b] = 1
  else:
    d[b] += 1
for k, v in d.items():
  if(v > 2):
    print("NO")
    break
else:
  print("YES")

Measured memory_bytes: 3064
#include <iostream>
#include <set>
int main()
{
    for (int i = 1; true; i++)
    {
        int a;
        int b;
        std::cin >> a;
        std::cin >> b;
        if(b < a)
        {
            std::swap(a,b);
        }
        if (a == 0 && b == 0)
        {
            break;
        }
        else
        {
            std::cout << a << " " << b << "\n";
        }
    }
    return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;

long long dp[101][1000000];

int main() {
    long long N, W;
    cin >> N >> W;

    long long w, v;
    for (int i = 1; i <= N; i++) {
        cin >> w >> v;

        for (int j = 0; j <= W; j++) {
            if (j - w >= 0) {
                chmax(dp[i][j], dp[i - 1][j]);
                chmax(dp[i][j], dp[i - 1][j - w] + v);
            } else {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }

    cout << dp[N][W];
}

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

int main(){
  int a,b,k;
  cin >> k;
  cin >> a >> b;
  bool frg = 0;
  for(int i=0; i<=b; i=i+k){
    if(a <= i && b >= i){
      frg = 1;break;
    }
  }
  if(frg){
    cout << "OK" << endl;
  }else{
    cout << "NG" << endl;
  }
  return 0;
}


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

int main(){
  long long int X, K, D ;
  cin >> X >> K >> D ;
  X = abs(X);
  if(X / D > K) cout << X - K * D << endl;
  else {
    K -= X / D;
    if(K % 2 == 0) cout << X % D << endl;
    else cout << abs(X % D - D);
  }
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{
  gearup;
  int n; cin >> n;
  int now_x = 0,now_y = 0;
  int time = 0;
  rep(i,n){
    int t,x,y; cin >> t >> x >> y;
    int dist = abs(x-now_x)+abs(y-now_y);
    int dif = t - time;
    if(dif < dist){
      out("No");
      return 0;
    }
    if(abs(dist - (dif))%2 == 1){
      out("No");
      return 0;
    }
    now_x = x,now_y = y;
    time = t;
  }
  out("Yes");
}

Measured memory_bytes: 256
H,W,h,w = map(int,input().split())
if not (H%h or W%w):
  print("No")
  exit()
if H%h:
  flg = "tate"
  n = H
  r = h
else:
  flg = "yoko"
  n = W
  r = w
ans = []
if r%2 == 0:
  s = r//2
  for i in range(n):
    if (i//s)%2 == 0:
      ans.append(2000)
    else:
      ans.append(-2001)
else:
  for i in range(n):
    if (i%r) < r//2+1:
      ans.append(2000)
    else:
      ans.append(-(int(2000/(r//2)*(r//2+1)))-1)
print("Yes")
if flg == "tate":
  for i in range(H):
    print(*([ans[i]]*W))
else:
  for i in range(H):
    print(*ans)

Measured memory_bytes: 4724
#include <stdio.h>
int main()
{
	long long int n,i,x=0;
	char nem[100];
	scanf("%lld",&n);
	while(n!=0){
		n--;
		int b=n%26;
		nem[x]='a'+b;
		n/=26;
		x++;
	}
	for(i=x-1;i>=0;i--){
		printf("%c",nem[i]);
	}
	return 0;
}

Measured memory_bytes: 1636
import java.util.*;
class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		// int n = sc.nextInt();
		
		String S = sc.nextLine();
		String T = sc.nextLine();
		
		String U = T.substring(0, (T.length() - 1));
		
		if(S.equals(U))
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35792
#include <iostream>
#include <algorithm>
#include<functional>
#include<stdio.h>
#include<stdlib.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#include<vector>
#include<cmath>
using namespace std;
int main() {
	int a, b,max;
	cin >> a >> b;
	max = a + b;
	if (max < a - b) {
		max = a - b;
	}
	if (max < a * b) {
		max = a * b;
	}
	cout << max;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
//long long ccw(const Point& A, const Point& B, const Point& C) {
//	return 1LL * (B.x - A.x)*(C.y - A.y) - 1LL * (B.y - A.y)*(C.x - A.x);
//}
int x, y, z;
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> x >> y >> z;
	cout << max(0, z - (x - y)) << '\n';








}

Measured memory_bytes: 256
using namespace std;
#include<string>
#include<cmath>
#include <map>
#include <list>
#include <unordered_map>
#define ppl pair<ll,ll>
#define ll long long
#define ld long double
#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

#define fr(i,a,b) for(ll i=a;i<b;i++)
#define ffr(i,a,b) for(ll i=a;i>=b;i--)
#include<bits/stdc++.h>
#include<vector>
#define vl vector<ll>
#define PI 3.141592654
const ll N = 1e5 + 1;
const ll P = 1e9 + 7;
#include<iterator>




void solve() {
	ll n, cnt = 0; cin >> n;
	ll l[n];
	fr(i, 0, n)cin >> l[i];
	sort(l, l + n);
	fr(i, 0, n - 2) {
		fr(j, i + 1, n - 1) {
			fr(k, j + 1, n) {
				if (l[i] + l[j] > l[k] && l[i] + l[k] > l[j] && l[j] + l[k] > l[i] && l[i] != l[j] && l[j] != l[k] && l[i] != l[k])cnt++;
			}
		}
	}
	cout << cnt;
}



int main() {
	fio;
#ifndef ONLINE_JUDGE
	// for getting input
	freopen("input.txt", "r", stdin);
	//for writing output
	freopen("jout.txt", "w", stdout);
#endif
	ll t;
	if (1)
		t = 1;
	else
		cin >> t;
	while (t--) {
		//cout << "Case #" << h << ":\n";
		solve();
		//h++;
		//cout << '\n';
	}
	return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>

int main() {
	int i,j,N,tmp,A=0,B=0;
	scanf("%d",&N);
	int a[N];
	for(i=0;i<N;i++)scanf("%d",&a[i]);
	
	for(i=1;i<N;i++){
		for(j=1;j<N;j++){
			if(a[j-1]<a[j])tmp=a[j-1],a[j-1]=a[j],a[j]=tmp;
		}
	}
	for(i=0;i<N;)A+=a[i],i+=2;
	for(i=1;i<N;)B+=a[i],i+=2;
	printf("%d\n",A-B);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#define int long long
#define MAX(a,b) ((a) > (b)) ? (a) : (b)
#define MIN(a,b) ((a) < (b)) ? (a) : (b)
using namespace std;

signed main()
{
	int a[50][50];
	int b[50][50];
	int n, m;
	
	cin >> n >> m;
	for (int y = 0; y < n; y++)
	{
		string s;
		cin >> s;
		for (int x = 0; x < n; x++)
		{
			a[x][y] = s.at(x) == '#' ? 1 : 0;
		}
	}
	for (int y = 0; y < m; y++)
	{
		string s;
		cin >> s;
		for (int x = 0; x < m; x++)
		{
			b[x][y] = s.at(x) == '#' ? 1 : 0;
		}
	}

	for (int y0 = 0; y0 < n; y0++)
	{
		if (y0 + m > n) continue;
		for (int x0 = 0; x0 < n; x0++)
		{
			if (x0 + m > n) continue;

			bool is_match = true;
			for (int y1 = 0; y1 < m; y1++)
			{
				for (int x1 = 0; x1 < m; x1++)
				{
					if (a[x1 + x0][y1 + y0] != b[x1][y1])
					{
						is_match = false;
						break;
					}
				}
				if (!is_match)
				{
					break;
				}
			}

			if (is_match)
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
}


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

#define fast ios_base::sync_with_stdio(0)

typedef long long LL;
typedef vector<LL>vll;
typedef map<LL, LL>mplli;

vll v;
mplli mp;

set<LL>st;

int main()
{
    fast;
    int N;
    cin >> N;
    int i;
    for(i=0; i<N; i++)
    {
        LL x;
        cin >> x;
        st.insert(x);
        mp[x]++;
    }

    set<LL>::iterator it;

    for(it=st.begin(); it!=st.end(); it++)
    {
        // cout << *it << "; ";
        v.push_back(*it);
    }

    int len = v.size();

    LL mul = 1;
    int cnt = 0;

    if(mp[v[len-1]] >= 4) cout << v[len-1] * v[len-1] << "\n";
    else
    {
        cnt = 0;
        mul = 1;

        for(i=len-1; i>=0; i--)
        {
            if(mp[v[i]] >= 2)
            {
                cnt+=1;
                mul *= v[i];
            }

            if(cnt == 2) break;
        }

        if(cnt == 2) cout << mul << "\n";
        else cout << "0\n";
    }

    return 0;
}


Measured memory_bytes: 12408
#include<iostream>
using namespace std;
int main()
{
    long long int a[100000],l,p,n,ans,j,i;
    cin>>n>>l;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    ans=a[0]+a[1];
    for(i=1;i<n;i++)
    {
        if(ans<a[i]+a[i+1])
        {
            ans=a[i]+a[i+1];
             p=i;
        }
    }
    if(ans>=l)
    {
        cout<<"Possible"<<endl;
        for(i=1;i<p;i++)
    {
        cout<<i<<endl;
    }
    for(i=n-1;i>=p;i--)
    {
        cout<<i<<endl;
    }
    }
    else
    {
        cout<<"Impossible"<<endl;
    }
}


Measured memory_bytes: 4368
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		int q = sc.nextInt();
      
      	int ns[] = new int[n];
      	int qc[] = new int[q];
      
      	for(int i = 0; i < n; i++) ns[i] = k;
      	for(int i = 0; i < q; i++) qc[i] = sc.nextInt();
      
      	for(int i = 0; i < q;i++){
          ns[qc[i]-1] += 1;
        }
		
      	for(int i = 0; i < n; i++){
			if((ns[i]-q) > 0) System.out.println("Yes");
      		else System.out.println("No");
        }
	}
}

Measured memory_bytes: 60544
import sys

n = int(input())

line_number = [int(i) for i in sys.stdin.readline().split()]

print(' '.join([str(s) for s in line_number]))

for i in range(1, n):
    v = line_number[i]
    j = i-1
    while (j >= 0) and (line_number[j] > v):
        line_number[j+1] = line_number[j]
        j = j-1
    line_number[j+1] = v
    print(' '.join([str(s) for s in line_number]))



Measured memory_bytes: 5612
# coding: utf-8

pointCount = int(input())
(t, a) = [int(i) for i in input().rstrip().split(" ")]

point_lit = [int(i) for i in input().rstrip().split(" ")]


min_diff = 100000
ans = 0
for i in range(len(point_lit)):
    kion = t - (point_lit[i] * 0.006)
    diff = abs(a - kion)
    if diff < min_diff:
        min_diff = diff
        ans = i + 1

print(ans)

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

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ALL(a) begin(a), end(a)
#define SZ(a) ((int)(a).size())

#define REP(a, b) for (int a = 0; a < (b); a++)
#define FOR(a, b, c) for (int a = (b); a <= (c); a++)
#define REPD(a, b) for (int a = (b) - 1; a >= 0; a--)
#define FORD(a, b, c) for (int a = (b); a >= (c); a--)

#define MIN(a, b) (a) = min((a), (b))
#define MAX(a, b) (a) = max((a), (b))

#ifdef __DEBUG
#define debug if (true)
#else
#define debug if (false)
#endif

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T> using VVV = vector<VV<T>>;

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2> &p) {
  return is >> p.fi >> p.se;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vi a(n);
  REP(i, n) cin >> a[i];
  vi dp(k + 1);
  dp[0] = 0;
  FOR(i, 1, k) {
    unordered_set<int> st;
    for (int x : a) if (x <= i) st.insert(dp[i - x]);
    int nim = 0;
    while (st.count(nim)) nim++;
    dp[i] = nim;
  }
  puts(dp[k] > 0 ? "First" : "Second");
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  vector<ll> p(n);
  rep(i,n){
    cin>>p[i];
  }

  ll a=0;
  ll now=0;
  rep(i,n){
    if(i%2==0){
      if(now+p[i]<=0) {
        a+=1-(now+p[i]);
        now=1;
      }
      else now+=p[i];
    }
    else {
      if(now+p[i]>=0) {
        a+=(now+p[i])-(-1);
        now=-1;
      }
      else now+=p[i];
    }
  }

  ll b=0;
  now=0;
  rep(i,n){
    if(i%2==1){
      if(now+p[i]<=0) {
        b+=1-(now+p[i]);
        now=1;
      }
      else now+=p[i];
    }
    else {
      if(now+p[i]>=0) {
        b+=(now+p[i])-(-1);
        now=-1;
      }
      else now+=p[i];
    }
  }

  cout << min(a,b) << endl;
}

Measured memory_bytes: 1024
n,k=map(int,input().split())
A=list(map(int,input().split()))

right=10**9
left=0

while right-left>1 :
    mid=(left+right)//2
    count=0
    for a in A :
        count+=a//mid
        if a%mid==0 :
            count-=1
    if count<=k :
        right=mid
    else :
        left=mid

print(right)

Measured memory_bytes: 30600
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
ll dp[105][2][5];
int main(){
  ll n; cin >> n;
  ll ans = 0;
  if(n>=10000){
    ans+=min(n-10000+1,(ll)90000);
  }
  if(n>=100){
    ans+=min(n-100+1,(ll)900);
  }
  if(n>=1){
    ans+=min(n,(ll)9);
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
s=[int(input()) for _ in range(n)]
score=sum(s)
t=[i for i in s if i%10!=0]
t.sort()
    
if score%10!=0:
    print(score)
else:
    if len(t)==0:
        print(0)
    else:
        print(score-t[0])

Measured memory_bytes: 38256
x1,y1,x2,y2 = map(int,input().split())

x3 = y1 + x2 - y2  
y3 = -x1 + x2 + y2
x4 = x1 + y1 - y2
y4 = -x1 +y1 + x2

print(x3,y3,x4,y4)

Measured memory_bytes: 2940
N, X = map(int, input().split())
L, C = [1], [1]
for n in range(1,N+1):
    L.append(2*L[-1]+3)
    C.append(2*C[-1]+1)
C.append(0)
step = 0
res = 0
for i in reversed(range(N+1)):
    if X<=step+L[i]//2:
        step+=1
    elif X>step+L[i]//2+1:
        step += L[i]//2+1
        res += C[i-1]+1
    else:
        res += C[i-1]+1
        break
print(res)

Measured memory_bytes: 62032
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const long long MOD = 998244353;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


template <i64 mod = MOD>
struct ModInt{
    i64 p;

    ModInt() : p(0){}
    ModInt(i64 x){p = x >= 0 ? x % mod : x + (-x + mod - 1) / mod * mod;}

    ModInt& operator+=(const ModInt& y){p = p + *y - ((p + *y) >= mod ? mod : 0); return *this;}
    ModInt& operator-=(const ModInt& y){p = p - *y + (p - *y < 0 ? mod : 0); return *this;}
    ModInt& operator*=(const ModInt& y){p = (p * *y) % mod; return *this;}
    ModInt& operator%=(const ModInt& y){if(y)p %= *y; return *this;}

    ModInt operator+(const ModInt& y) const{ModInt x = *this; return x += y;}
    ModInt operator-(const ModInt& y) const{ModInt x = *this; return x -= y;}
    ModInt operator*(const ModInt& y) const{ModInt x = *this; return x *= y;}
    ModInt operator%(const ModInt& y) const{ModInt x = *this; return x %= y;}

    friend ostream& operator<<(ostream& stream, const ModInt<mod>& x){
        stream << *x;
        return stream;
    }

    friend ostream& operator>>(ostream& stream, const ModInt<mod>& x){
        stream >> *x;
        return stream;
    }

    ModInt& operator++(){p = (p + 1) % mod; return *this;}
    ModInt& operator--(){p = (p - 1 + mod) % mod; return *this;}

    bool operator==(const ModInt& y) const{return p == *y;}
    bool operator!=(const ModInt& y) const{return p != *y;}

    const i64& operator*() const{return p;}
    i64& operator*(){return p;}

};

using mint = ModInt<>;


void solve(long long n, long long s, std::vector<long long> a){
    auto mpow = [](auto x, i64 y){
     auto z = x;
     decltype(x) val = y & 1 ? x : decltype(x)(1);
     while(z *= z, y >>= 1)
      if(y & 1)
       val *= z;
     return val;
    };

    mint inv = mpow(mint(2), MOD - 2);
    vector<vector<mint>> dp(n + 1, vector<mint>(s + 1, 0));
    dp[0][0] = 1;
    mint ans = 0;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j <= s; ++j){
            if(j + a[i] <= s){
                dp[i + 1][j + a[i]] += dp[i][j] * inv;
            }
            dp[i + 1][j] += dp[i][j];
        }
    }
    ans += dp.back().back();
    ans *= mpow(mint(2), n);
    cout << ans << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    long long S;
    scanf("%lld",&S);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, S, std::move(A));
    return 0;
}


Measured memory_bytes: 73748
#include <stdio.h>
int main(void){
  int i, N, c=1;
  scanf("%d", &N);
  int a[N], x[N];
  for(i = 0; i < N; i++){
    scanf("%d", &a[i]);
  }
  x[0] = 0;
  for(i = 0; i < N; i++){
    x[0] = x[0] + a[i] * c;
    c = c * -1;
  }
  x[N-1] = 2 * a[N-1] - x[0];
  for(i = 0; i < N-1; i++){
    x[N-i-2] = 2 * a[N-i-2] - x[N-i-1];
  }
  for(i = 0; i < N; i++){
    printf("%d ", x[i]);
  }
  return 0;
}
          

Measured memory_bytes: 2048
#include <stdio.h>

int main(){
int a,b,l,s;
do{
scanf("%d %d",&a,&b);
}while(a<1 || a>100 || b<1 || b>100);
l=2*(a+b);
s=a*b;
printf("%d %d\n",s,l);
return 0;
}

Measured memory_bytes: 596