akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  P a[n];
  rep(i,n) cin >> a[i].F >> a[i].S;
  ll sum=0,ans=-1;
  string s="";
  rep(i,n) {
    sum+=a[i].F*a[i].S;
    ans+=a[i].S;
  }
  rep(j,100) {
    ll ss=0;
    rep(i,20) {
      ss+=sum%10;
      ans+=sum/10;
      sum/=10;
    }
    sum=ss;
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}

Measured memory_bytes: 3328
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {
	int x,a,b;
	cin >>x>>a>>b;
	string s = "dangerous";
	if (a >= b) {
		s = "delicious";
	}
	else if (a + x >= b) {
		s = "safe";
	}
		cout <<s<< endl;
}


Measured memory_bytes: 256
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

ll a,b,k;
ll arr[200005];
ll brr[200005];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>a>>b>>k;
	rep(x,0,a) cin>>arr[x];
	rep(x,0,b) cin>>brr[x];
	
	rep(x,0,a) arr[x+1]+=arr[x];
	rep(x,0,b) brr[x+1]+=brr[x];
	
	int idx=b-1;
	while (idx>=0 && k<brr[idx]) idx--;
	int ans=idx+1;
	
	rep(x,0,a){
		if (arr[x]>k) break;
		
		while (idx>=0 && k-arr[x]<brr[idx]) idx--;
		//cout<<x<<" "<<idx<<endl;
		ans=max(ans,x+idx+2);
	}
	
	cout<<ans<<endl;
}


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

signed main(void)
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b >= c)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}

int main(void){
    int n,m;
    cin>>n>>m;
    vector<ll> dp(n+1);
    rep(i,0,m){
        int a;
        cin>>a;
        dp[a]=-1;
    }
    if(dp[1]==-1&&dp[2]!=-1){dp[1]=0;dp[2]=1;}
    else if(dp[2]==-1&&dp[1]!=-1){dp[1]=1;dp[2]=0;}
    else if(dp[1]==-1&&dp[2]==-1){dp[1]=dp[2]=0;}
    else {dp[1]=1;dp[2]=2;}
    rep(i,3,n+1){
        if(dp[i]==-1)dp[i]=0;
        else dp[i]=(dp[i-1]+dp[i-2])%INF;
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String result = "WA";
		if ('A' == (S.charAt(0))) {
			for (int i = 1; i < S.length(); i++) {
				if ('C' == S.charAt(i)) {
					if ("WA".equals(result) && i != 1 && i != S.length()-1) {
						result = "AC";
					} else {
						result = "WA";
						break;
					}
				} else if (!(String.valueOf(S.charAt(i)).toLowerCase()).equals(String.valueOf(S.charAt(i)))) {
					result = "WA";
					break;
				}
			}
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 26824
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int> > mat;

int main()
{
  ll a, b;
  cin >> a >> b;
  if (a <= 0 && 0 <= b)
  {
    cout << "Zero" << "\n";
  }
  else
  if (a > 0)
  {
    cout << "Positive" << "\n";
  }
  else
  {
    cout << ((b - a) % 2 != 0 ? "Positive" : "Negative") << "\n";
  }
}

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

using namespace std;

long long dfs(vector<int> &l, long long a_sum, long long b_sum, long long c_sum, int cur, int n, int a, int b, int c) {
    if (cur == n) {
        if ((a_sum == 0) || (b_sum == 0) || (c_sum == 0)) return 10000000000;
        else return abs(a_sum - a) + abs(b_sum - b) + abs(c_sum - c) - 30;
    }
    long long ret0 = dfs(l, a_sum, b_sum, c_sum, cur+1, n, a, b, c);
    long long ret1 = dfs(l, a_sum + l.at(cur), b_sum, c_sum, cur+1, n, a, b, c) + 10;
    long long ret2 = dfs(l, a_sum, b_sum + l.at(cur), c_sum, cur+1, n, a, b, c) + 10;
    long long ret3 = dfs(l, a_sum, b_sum, c_sum + l.at(cur), cur+1, n, a, b, c) + 10;
    long long mini = min(min(ret0, ret1), min(ret2, ret3));
    return mini;
}

int main () {
    int n = 0, a = 0, b = 0, c = 0;
    cin >> n >> a >> b >> c;
    vector<int> l(n);
    for (int i=0; i<n; i++) {
        cin >> l.at(i);
    }
    long long ans = dfs(l, 0, 0, 0, 0, n, a, b, c);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func abs(n int64) int64 {
	if n >= 0 {
		return n
	} else {
		return (-1) * n
	}
}

func main() {
	var x, k, d int64
	fmt.Scan(&x)
	fmt.Scan(&k)
	fmt.Scan(&d)
	ans := x

	if abs(x) > abs(k*d) {
		ans = abs(x) - abs(k*d)
	} else {
		if (k-abs(x)/abs(d))%2 == 0 {
			ans = abs(x) % abs(d)
		} else {
			temp := abs(x) % abs(d)
			if abs(temp+d) < abs(temp-d) {
				ans = abs(temp + d)
			} else {
				ans = abs(temp - d)
			}
		}
	}

	fmt.Println(abs(ans))
}


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

int main()
{
    int n,num;
    int fiveCount=0;
    while(cin>>n,n){
        for(int i=1;i<=n;i++){
            num=i;
            for(;;){
                if(num%5==0){
                    fiveCount++;
                    num /= 5;
                }
                else{
                    break;
                }
            }
        }
        cout<<fiveCount<<endl;
        fiveCount=0;
    }
    return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>
int main(void)

{
	int W, H, x, y, r;
	scanf("%d %d %d %d %d %d", &W, &H, &x, &y, &r);

	if ((x - r >= 0) && (x + r <= W) && (y - r >= 0) && (y + r <= H))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 2096
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
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 n;
    cin >> n;
    string s;
    cin >> s;
    int r = 0, g = 0, b = 0;
    rep(i, n){
        if(s.at(i) == 'R') r++;
        if(s.at(i) == 'G') g++;
        if(s.at(i) == 'B') b++;
    }
    ll sum = (ll)r*g*b;
    r = 0; g = 0; b = 0;
    REP(i, n){
        rep(j, i){
            for(int k = j; k < n; k+=i){
                if(s.at(k) == 'R') r = 3;
                if(s.at(k) == 'G') g = 3;
                if(s.at(k) == 'B') b = 3;
                if(r > 0 && g > 0 && b > 0) sum--;
                r--; g--; b--;
                //cout << k << " ";
                //cout << r <<" "<< g <<" "<<b << endl;
            }
            //cout << endl;
            r = 0; g = 0; b = 0;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> n;
	vector<ll>	aa(n);
	for(i=0;i<n;i++) cin >> aa[i];
	
	for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) {
		ans += aa[i]*aa[j];
	}

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


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

using namespace std;
long long dp[1005][(1 << 15)];
int n, m;
int a[1005], b[1005], c[1005][15];
int main()
{
    cin >> n >> m;
    memset( dp, -1, sizeof( dp ) );
    dp[0][0] = 0;
    for (int i = 1; i <= m; i++)
    {
        int state = 0, num;
        cin >> a[i] >> num;
        for( int j = 1; j <= num; ++ j )
        {
            int t; cin >> t;
            state |= ( 1 << ( t - 1 ) );
        }
        b[i] = state;
        dp[i][0] = 0;
    }
    for( int i = 1; i <= m; ++ i )
    {
        for( int j = 0; j <= ( 1 << n ) - 1; ++ j )
        {
            if( dp[i - 1][j] != -1 )
            {
                int st = b[i] | j;
//                char s[20];
//                itoa( st, s, 2 );
//                cout << s << endl;
                if( dp[i][st] == -1 ) dp[i][st] = dp[i - 1][j] + a[i];
                else dp[i][st] = min( dp[i][st], dp[i - 1][j] + a[i] );
                if( dp[i][j] == -1 ) dp[i][j] = dp[i - 1][j];
                else dp[i][j] = min( dp[i - 1][j], dp[i][j] );
            }
        }
    }
    cout << dp[m][( 1 << n ) - 1] << endl;
    return 0;
}

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

using namespace std;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

const ll mod=1e9+7;

int main(){
    ll d;
    cin >> d;
    vector<pll> c;
    rep(i,26){
        ll t;
        cin >> t;
        c.push_back(make_pair(t,i+1));
    }
    vector<vector<pll>> s(d);
    rep(i,d){
        rep(j,26){
            ll v;
            cin >> v;
            s[i].push_back(make_pair(v,j+1));
        }
        sort(s[i].rbegin(),s[i].rend());
    }
    vector<ll> ans(d),used(26);
    ll tot=d;
    ll cnt=0;
    sort(c.rbegin(),c.rend());
    while(tot){
        rep(i,26){
            ans[tot-1]=c[i].se;
            tot--;
            cnt++;
            if(tot==0) break;
        }
        if(cnt==26){
            cnt=0;
        }
    }
    rep(i,d){
        cout << ans[i] << endl;
    }
    return 0;
} 


Measured memory_bytes: 3836
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

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

  ll N, X; cin >> N >> X;

  vector<ll> vec(51);
  vector<ll> cnt(51);
  vec.at(0) = 1;
  cnt.at(0) = 1;
  for(int i=1; i<=50; i++) {
    vec.at(i) = vec.at(i-1)*2 + 3;
    cnt.at(i) = cnt.at(i-1)*2 + 1;
  }

  debugln(vec.at(50));
  debugln(cnt.at(50));

  ll ans = 0;

  for(int i=N; i>=0; i--) {
    if (X >= vec.at(i)) {
      ans += cnt.at(i);
      break;
    }
    if (i == 0) continue;
    if (X >= vec.at(i-1)+2) {
      X -= vec.at(i-1)+2;
      ans += cnt.at(i-1)+1;
    } else if (X == vec.at(i-1)+1) {
      ans += cnt.at(i-1);
      break;
    } else if (X >= 1) {
      X--;
    } else {
      break;
    }
    debug(i);
    debugln(X);
  }
  cout << ans << endl;
}

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

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

long long LCM(long long a, long long b)
{
    long long gcd=GCD(a,b);
     return (a*b)/gcd;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    long long i, j, k, n, m, t, x, y, z, s=0, c=0, l;
    string a;
    cin >> a;
    for(i=0; i<a.size(); i++)
    {
        if(a[i]=='1')
            cout << "9";
        else if(a[i]=='9')
            cout << "1";
        else 
            cout << a[i];
    }
}


Measured memory_bytes: 3660
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000

using namespace std;


int main(void) {
	string s, t;
	string p;
	int i;

	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	p = t;
	i = t.size();
	FOR(v, 0, i - 1) {
		p[v] = t[i - v - 1];
	}
	if (s < p) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

using namespace std;

typedef long long LL;
typedef long double LD;

int main()
{
  LL MOD = 1000000007;
  LL N, M;
  cin >> N >> M;
  vector<LL> A(M);
  for (LL i = 0; i < M; i++) {
    //LL a;
    //cin >> a;
    //A.push_back(a);
    cin >> A[i];
  }

  //! 連続で壊れてたら不可能
  for (LL i = 0; i < M - 1; i++) {
    if ((A[i] + 1) == A[i + 1]) {
      //cerr << (A[i] + 1) << "==" << A[i + 1] << endl;
      cout << 0;
      return 0;
    }
  }

  vector<LL> Cost(N+1);
  Cost[0] = 1;
  Cost[1] = 1;
  Cost[2] = 2;
  for (LL i = 3; i < N + 1; i++) {
    Cost[i] = (Cost[i - 1] + Cost[i - 2])%MOD;
    //cerr << Cost[i] << endl;
  }

  LL m = 0;
  vector<LL> Step;
  vector<LL> CCC;
  for (LL i = 0; i < M; i++) {
    LL idx = A[i] - m - 1;
    //cerr << idx << endl;
    LL cost = Cost[idx];
    CCC.push_back(cost);
    m = A[i] + 1;
  }

  LL cost = Cost[N - m];
  CCC.push_back(cost);
 
  //cerr << endl;

  LL total = 1;
  for (auto c : CCC) {
    //cerr << c << " ";
    total *= (c % MOD);
    total %= MOD;

  }
  cout << (total%MOD);


  return 0;
}

Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

template<int M>
struct ModInt {
public:
	using value_type = long long;
	
	ModInt(value_type val = 0) : val(val < 0 ? (M - (-val % M)) % M : val % M) {}
	
	explicit operator bool() const noexcept { return val; }
	bool operator ==(const ModInt & rhs) const noexcept { return val == rhs.val; }
	bool operator !=(const ModInt & rhs) const noexcept { return !(*this == rhs); }
	ModInt operator +() const noexcept { return ModInt(*this); }
	ModInt operator -() const noexcept { return ModInt(0) -= *this; }
	ModInt operator +(const ModInt & rhs) const noexcept { return ModInt(*this) += rhs; }
	ModInt operator -(const ModInt & rhs) const noexcept { return ModInt(*this) -= rhs; }
	ModInt operator *(const ModInt & rhs) const noexcept { return ModInt(*this) *= rhs; }
	ModInt operator /(const ModInt & rhs) const noexcept { return ModInt(*this) /= rhs; }
	
	ModInt & operator +=(const ModInt & rhs) noexcept {
		val += rhs.val;
		if (val >= M) val -= M;
		return *this;
	}
	ModInt & operator -=(const ModInt & rhs) noexcept {
		if (val < rhs.val) val += M;
		val -= rhs.val;
		return *this;
	}
	ModInt & operator *=(const ModInt & rhs) noexcept {
		val = val * rhs.val % M;
		return *this;
	}
	ModInt & operator /=(const ModInt & rhs) noexcept {
		*this *= rhs.inverse();
		return *this;
	}
	
	ModInt pow(value_type n) const {
		ModInt res = 1, x = val;
		if (n < 0) { x = x.inverse(); n = -n; }
		while (n) { if (n & 1) res *= x; x *= x; n >>= 1; }
		return res;
	}
	
	ModInt inverse() const {
		long long a = val, a1 = 1, a2 = 0, b = M, b1 = 0, b2 = 1;
		while (b > 0) {
			value_type q = a / b, r = a % b;
			value_type nb1 = a1 - q * b1, nb2 = a2 - q * b2;
			a = b; b = r;
			a1 = b1; b1 = nb1;
			a2 = b2; b2 = nb2;
		}
		assert(a == 1);
		return a1;
	}
	
	const value_type & get() const noexcept { return val; }
	static decltype(M) get_mod() noexcept { return M; }
	
	friend std::ostream & operator <<(std::ostream & os, const ModInt & rhs) { return os << rhs.val; }
	friend std::istream & operator >>(std::istream & is, ModInt & rhs) {
		value_type x;
		is >> x;
		rhs = ModInt(x);
		return is;
	}
private:
	value_type val;
};
using mint = ModInt<MOD>;


int main() {
	int N, K;
	cin >> N >> K;
	
	vector<mint> cnt(K + 1);
	
	mint ans = 0;
	for (int i = K; i >= 1; --i) {
		cnt[i] = mint(K / i).pow(N);
		for (int j = i + i; j <= K; j += i) cnt[i] -= cnt[j];
		ans += cnt[i] * i;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
#define MAXN 100001
using namespace std;
int fam[MAXN];
int size[MAXN];
bool check[MAXN];
vector<int> adj[MAXN];
int temp;
void dfs(int r)
{
    check[r]=1;
    fam[r]=temp;
    size[temp]++;
    for(int i=0;i<adj[r].size();i++)
    {
        if(!check[adj[r][i]])
        {
            dfs(adj[r][i]);
        }
    }
}
int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    for(int i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for(int i=1;i<=n;i++)
    {
        if(!check[i])
        {
            size[i]=0;
            temp=i;
            dfs(i);
        }
    }
    int ans[n+1];
    for(int i=1;i<=n;i++)
    {
        ans[i] = size[fam[i]]-adj[i].size()-1;
    }
    for(int i=0;i<k;i++)
    {
        int u,v;
        cin>>u>>v;
        if(fam[u]==fam[v])
        {
            ans[u]--;
            ans[v]--;
        }
    }
    for(int i=1;i<=n;i++)
        cout<<ans[i]<<" ";
    cout<<"\n";
    return 0;
}


Measured memory_bytes: 7680
using System;
using System.Linq;
using System.Numerics;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string[] str=Console.ReadLine().Split(' ');
    long N=long.Parse(str[0]);
    long K=long.Parse(str[1]);  
	long ans=N;
    
     if(N%K<(K-(N%K))){
      ans=N%K; 
     }else{
       ans=K-(N%K);
     }
      Console.WriteLine(ans);
	}
  }
}


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

using namespace std;

typedef long long ll;

const int mx = 100050;
int arr[mx];
int dp[mx];
int n;

int func(int idx)
{
    if(idx >= (n-1))return 0;
    if(dp[idx] != -1)return dp[idx];

    int nxt = idx+1;
    int ans  , ret;
    ans = 1e9;
    ans += 100;
    if(nxt < n)
    {
        ret = abs(arr[nxt]-arr[idx]) + func(nxt);
        ans = min(ans,ret);
    }
    nxt = idx+2;
    if(nxt < n)
    {
        ret = abs(arr[nxt]-arr[idx]) + func(nxt);
        ans = min(ans,ret);
    }

    return dp[idx] = ans;
}

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

    int i, j , k , p , q;

    for(i = 0 ; i < n ; i++)scanf("%d",arr+i);
    memset(dp,-1,sizeof(dp));
    int ans = func(0);

    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 5760
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use itertools::Itertools;
use std::process::exit;
use std::cmp::*;
use num::*;
use num::integer::Roots;

fn main() {
    input! {
    a:usize,
    }
    println!("{}",if (a/100)*5>=a%100{1}else{0})
}

Measured memory_bytes: 2144
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
const int maxn=100005;
const int mod=1e9+7;
int n,dp[maxn][2],nxt[2][maxn];
ll A,B,a[maxn],w[maxn];
template<class Type>Type read(){
    Type res=0,f_f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f_f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') res=(res<<3)+(res<<1)-'0'+ch,ch=getchar();
    return res*f_f;
}
#define iread() (read<int>())
#define lread() (read<long long>())
#define ulread() (read<unsigned long long>())
namespace RMQ{
    int lg[maxn];
    ll f[maxn][20];
    inline void prelog(){
        lg[1]=0;
        for (int i=2;i<=n;i++){
            lg[i]=lg[i-1];
            lg[i]+=((1<<lg[i]+1)<=i)?1:0;
        }
    }
    inline void init(){
        prelog();
        for (int i=2;i<=n;i++) f[i][0]=w[i];
        for (int i=1;(1<<i)<=n;i++){
            for (int j=2;j+(1<<i)-1<=n;j++){
                f[j][i]=min(f[j][i-1],f[j+(1<<i-1)][i-1]);
            }
        }
    }
    inline ll query(int x,int y){
        int w=lg[y-x+1];
        return min(f[x][w],f[y-(1<<w)+1][w]);
    }
}
inline void get_modu(int &x){
    while(x>=mod) x-=mod;
}
inline void solve_a(int x){
    int L=x+2,R=nxt[0][x]-1;
    if(L<=R&&RMQ::query(L,R)<B) return;
    dp[R][1]+=dp[x][0],get_modu(dp[R][1]);
}
inline void solve_b(int x){
    int L=x+2,R=nxt[1][x]-1;
    if(L<=R&&RMQ::query(L,R)<A) return;
    dp[R][0]+=dp[x][1],get_modu(dp[R][0]);
}
int main(){
    n=iread(),A=lread(),B=lread();
    int tota=1,totb=1;
    for (int i=1;i<=n;i++){
        a[i]=lread();
        if(i^1){
            w[i]=a[i]-a[i-1];
            while(tota<i&&a[i]-a[tota]>=A) nxt[0][tota++]=i;
            while(totb<i&&a[i]-a[totb]>=B) nxt[1][totb++]=i;
        }
    }
    while(tota<=n) nxt[0][tota++]=n+1;
    while(totb<=n) nxt[1][totb++]=n+1;
    RMQ::init();
    dp[1][0]=dp[1][1]=1;
    for (int i=1;i<n;i++){
        if(dp[i][0]){
            if(nxt[0][i]==i+1){
                dp[i+1][0]+=dp[i][0],get_modu(dp[i+1][0]);
                dp[i+1][1]+=dp[i][0],get_modu(dp[i+1][1]);
            }
            else solve_a(i);
        }
        if(dp[i][1]){
            if(nxt[1][i]==i+1){
                dp[i+1][0]+=dp[i][1],get_modu(dp[i+1][0]);
                dp[i+1][1]+=dp[i][1],get_modu(dp[i+1][1]);
            }
            else solve_b(i);
        }
    }
    printf("%d\n",(dp[n][0]+dp[n][1])%mod);
    return 0;
}

Measured memory_bytes: 22864
#include<cstdio>
using namespace std;
#define N 270001
#define mod 998244353
int a[N],b[N],n,su;
int pw(int a,int p){int as=1;while(p){if(p&1)as=1ll*as*a%mod;a=1ll*a*a%mod;p>>=1;}return as;}
int fwt(int *a,int n,int f)
{
	for(int l=2;l<=n;l<<=1)
	for(int j=0;j<n;j+=l)
	for(int k=j;k<j+(l>>1);k++)
	if(f)
	{
		int t1=a[k],t2=a[k+(l>>1)];
		a[k]=(t1+t2)%mod;
		a[k+(l>>1)]=(t1-t2+mod)%mod;
	}
	else
	{
		int t1=a[k],t2=a[k+(l>>1)];
		a[k]=1ll*(t1+t2)*(mod+1)/2%mod;
		a[k+(l>>1)]=1ll*(t1-t2+mod)*(mod+1)/2%mod;
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=0;i<1<<n;i++)scanf("%d",&a[i]),su+=a[i];
	for(int i=0;i<1<<n;i++)a[i]=1ll*a[i]*pw(su,mod-2)%mod-(i==0),b[i]=i==0?(1<<n)-1:mod-1;
	fwt(a,1<<n,1);fwt(b,1<<n,1);
	for(int i=0;i<1<<n;i++)a[i]=1ll*b[i]*pw(a[i],mod-2)%mod;
	fwt(a,1<<n,0);
	int tp=a[0];
	fwt(a,1<<n,1);
	a[0]=(a[0]+mod-1ll*tp*(1<<n)%mod)%mod;
	fwt(a,1<<n,0);
	for(int i=0;i<1<<n;i++)printf("%d\n",a[i]);
}

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

int A,B,C,D;

int main() {
  cin >> A >> B >> C >> D;
  bool canWin = false;
  rep(i, 200){
    int ret;
    if(i%2 == 0){
      C = C - B;
      if(C <= 0){
        canWin = true;
        break;
      }
    } else {
      A = A - D;
      if(A <= 0){
        canWin = false;
        break;
      }
    }
  }
  if(canWin) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

#define MOD 1000000007
using ll = long long;
using namespace std;

int main() {
    int N;
    ll ans = 0;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        A[i] -= i;
    }
    sort(A.begin(), A.end());
    for (int i = 0; i < N; i++)
    {
        ans += abs(A[i] - A[N / 2]);
    }
    cout << ans << endl;
    cin >> ans;
    return 0;
}

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

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;

const int INF = 1e9;
const int MAXN = 2e3 + 5;
const int MOD = 1e9 + 7;

int n, u, v, ans[MAXN];
vector<int> G[MAXN];

bool vis[MAXN];
int dis[MAXN];
void solve(int st) {
	memset(dis, 0, sizeof(dis));
	memset(vis, 0, sizeof(vis));
	queue<int> q; q.push(st); vis[st] = 1;
	while(!q.empty()) {
		int cur = q.front(); q.pop();
		for(int i : G[cur]) if(!vis[i]) {
			vis[i] = 1;
			q.push(i);
			dis[i] = dis[cur] + 1;
			if(i > st) ans[dis[i]]++;
		}
	}
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> u >> v;
	G[u].push_back(v); G[v].push_back(u);
	for(int i=1; i<n; i++) G[i].push_back(i+1), G[i+1].push_back(i);
	for(int i=1; i<n; i++) {
		solve(i);
	}
	for(int i=1; i<n; i++) cout << ans[i] << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <set>

using namespace std;

int main(){
int n;
  cin >> n;
set<int> st;
  int in;
  for(int i=0;i<n;++i){
    cin >> in;
    st.insert(in);
  }
  
  cout << st.size() << endl;
  
  
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        char[] s = sc.next().toCharArray();
        for (int i = a - 1; i <= c - 1; i++) {
            if (s[i] == '#' && s[i + 1] == '#') {
                System.out.println("No");
                return;
            }
        }
        for (int i = b - 1; i <= d - 1; i++) {
            if (s[i] == '#' && s[i + 1] == '#') {
                System.out.println("No");
                return;
            }
        }
        if (c > d) {
            boolean canJump = false;
            for (int i = b - 1; i <= d - 1; i++) {
                if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.') {
                    canJump = true;
                }
            }
            if (!canJump) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }

}


Measured memory_bytes: 40684
#include <iostream>
#include <vector>
#include <map>

using namespace	std;

int main(){
  int n;
  string s;
  map <char, int> ch_count, ch_count_tmp;
  cin >> n;
  for (int i=0;i<n;i++)	{
    cin >>s;
    for (char letter = 'a'; letter <= 'z'; ++letter) {
      ch_count_tmp[letter] = 0;
    }
    for	(string::iterator it=s.begin();it!=s.end();it++) {
      ch_count_tmp[*it]++;
    }
    for (char letter = 'a'; letter <= 'z'; ++letter) {
      if (ch_count.find(letter) == ch_count.end() || ch_count[letter] > ch_count_tmp[letter]) {
        ch_count[letter] = ch_count_tmp[letter];
      }

    }
  }

  for (char letter = 'a'; letter <= 'z'; ++letter) {
    if (ch_count[letter] > 0) {
      string res = string(ch_count[letter], letter);
      cout << res;
    }
  }
  cout << endl;
}



Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String args[]){//double 处理果盘
		Scanner in = new Scanner(System.in);
		String str = in.nextLine();
		char[] s = str.toCharArray();
		String sl = "",sr="";
		for (int i=0;i<str.length();i++){
			if(i % 2==0){
				sl += s[i];
			}else{
				sr += s[i];
			}
		}
//		if(sl.indexOf('L')!= -1 || sr.indexOf('R')!= -1){
//			System.out.println("No");
//		}else{
//			System.out.println("Yes");
//		}
		boolean f = true;
		char[] cl = sl.toCharArray();
		char[] cr = sr.toCharArray();
		for (int i=0;i<sl.length();i++){
			if(cl[i] == 'R' || cl[i] =='U' || cl[i] =='D'){
				
			}else{
				f = false;
				break;
			}
		}
		for (int i=0;i<sr.length();i++){
			if(cr[i] == 'L' || cr[i] =='U' || cr[i] =='D'){
				
			}else{
				f = false;
				break;
			}
		}
		if(f)
			System.out.print("Yes");
		else
			System.out.print("No");
	}
}	
	

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

int main()
{
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    int small = 0;
    rep(i, n)
    {
        cin >> a.at(i);
    }

    rep(i, n)
    {
        if (i == n - 1)
        {
            small = max(small, k - (a.at(n - 1) - a.at(0)));
        }
        else
        {
            small = max(small, a.at(i + 1) - a.at(i));
        }
    }

    cout << k - small << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main()
{
    int arr[4][3][10]= {0};
    int b,f,r,v,n,i,j,k;
    scanf("%d ",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d%d%d%d",&b,&f,&r,&v);
        arr[b-1][f-1][r-1]=arr[b-1][f-1][r-1]+v;

    }
    for(i=0; i<4; i++)
    {
        for(j=0; j<3; j++)
        {
            for(k=0; k<10; k++)
            {
                printf(" %d",arr[i][j][k]);
            }
            printf("\n");
        }
        if (i!=3)
        {
            printf("####################\n");
        }
    }


    return 0;
}



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

int main(){
	int n;
	cin >> n;
	vector<int> l;
	map<int,int> lmap;
	int lin,loopn=0;
	for(int loop=0;loop<n;loop++){
		cin >> lin;
		if(lmap.count(lin)==0){
			l.push_back(lin);
			loopn++;
			lmap[lin]=1;
		}else{
			lmap[lin]++;
		}
	}
	sort(l.begin(),l.end());
	int ans=0;
	if(loopn>=3){
		for(int loop=0;loop<loopn-2;loop++){
			for(int loop2=loop+1;loop2<loopn-1;loop2++){
				for(int loop3=loop2+1;loop3<loopn;loop3++){
					if(l[loop3]<l[loop2]+l[loop]){
						ans+=lmap[l[loop]]*lmap[l[loop2]]*lmap[l[loop3]];
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

const ll MOD = 1e9+7;
int main()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	for(auto &i:a)cin >> i;
	ll sum = 0;
	ll ans = 0;
	for(int i = n-1;i>0;i--)
	{
		sum += a[i];
		sum %= MOD;
		ans += sum*a[i-1]%MOD;
		ans %=MOD;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 4748
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) 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)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main(){
    unsigned long N,M;
    cin >> N >> M;

    vector<unsigned long> v(N,0);
    vector<unsigned long long> s(N+1,0);
    map<unsigned long, unsigned long> m;
    m.insert(make_pair(0,1));
    FOR(i, 0, ((int)N)){
        cin >> v[i];
        s[i+1] = s[i] + v[i];
        if(m.find(s[i+1] % M) != m.end())
            m[s[i+1] % M] = m[s[i+1] % M] + 1 ;
        else
            m.insert(make_pair(s[i+1] % M,1));
    }
    unsigned long  c;
    unsigned long long ans = 0;
    for(auto itr = m.begin(); itr != m.end(); ++itr){
        c = (*itr).second;
        if(c > 1)  ans+= c*(c-1)/2;
    }
    cout << ans << endl;
}



Measured memory_bytes: 5760
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>
#include <unordered_map>
#include <cstring>
#include <iostream>
#include <numeric>
#include <sstream>
#include <set>
#include <tuple>
#include <iomanip>

using namespace std;
#define MAX 1LL << 60

typedef long long ll;

#define rep(i, s, e) for(ll i = s; i < e; i++)
#define repR(i, s, e) for(ll i = s; i > e; i--)
#define reft0(i, j) setfill('0') << setw(i) << j

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(){
    ll A, P;
    cin >> A >> P;
    P += (A * 3);

    ll ans = P / 2;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


ll n, ans, sum;
int main() {
	cin >> n;
	vector<ll> s(n);
	REP(i, n) {
		cin >> s[i];
		sum += s[i];
	}
	sort(ALL(s));
	ans = sum;
	REP(i, n) {
		sum -= s[i] * 2;
		if (i % 2 == 1)ans = max(ans, sum);
	}
	cout << ans << endl;
}

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

int GCD(int p,int q){
	if(p<q){
		return GCD(q,p);
	}
	while(p%q!=0){
		int r=p%q;
		p=q;
		q=r;
	}
	return q;
}

int main(){
	int k;
	cin >> k;
	int sum=0;
	for(int a=1;a<=k;a++){
		for(int b=1;b<=k;b++){
			for(int c=1;c<=k;c++){
				sum = sum+GCD(a,GCD(b,c));
			}
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 3640
#include<iostream>
#include<queue>
#define dr direction
#define cl color
#define fi first
#define se second

using namespace std;
typedef pair<int, int> pii;

class Block{
public:
    int color;// 1~5
    int direction;// 0:-, 1:|
    int x, y;
    void init(int c, int d, int xx, int yy);
};

void Block::init(int c, int d, int xx, int yy){
    color=c;
    direction=d;
    x=xx;
    y=yy;
}

int w, h, xs, ys, xg, yg, n;
int fld[100][100], dis[100][100];
const pii dxdy[]={{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
const int inf=1e8;

string solve(){// bfs
    queue<pii> qu;
    qu.push(make_pair(ys, xs));
    int C=fld[ys][xs];
    fill(dis[0], dis[100], inf);
    dis[ys][xs]=0;

    if(C==0) return "NG";
    while(!qu.empty()){
        pii now=qu.front(); qu.pop();
        if(now.fi==yg&&now.se==xg){
            return "OK";
        }

        for(int k=0; k<4; k++){
            pii nx=make_pair(now.fi+dxdy[k].fi, now.se+dxdy[k].se);
            if(!(0<=nx.fi&&nx.fi<h&&0<=nx.se&&nx.se<w)) continue;
            if(fld[nx.fi][nx.se]!=C) continue;
            if(dis[nx.fi][nx.se]!=inf) continue;

            dis[nx.fi][nx.se]=dis[now.fi][now.se]+1;
            qu.push(nx);
        }
    }

    return "NG";
}

int main(){

    while(1){
        cin>> w>> h;
        if(w==0&&h==0) break;
        cin>> xs>> ys>> xg>> yg>> n;
        xs--; ys--; xg--; yg--;
        Block block[n];
        for(int i=0; i<n; i++){
            int c, d, xx, yy;
            cin>> c>> d>> xx>> yy;
            xx--; yy--;
            block[i].init(c, d, xx, yy);
        }

        // make field
        fill(fld[0], fld[100], 0);
        for(int k=0; k<n; k++){
            int X=block[k].x, Y=block[k].y;
            if(block[k].dr==0){
                for(int i=0; i<2; i++){
                    for(int j=0; j<4; j++){
                        fld[Y+i][X+j]=block[k].cl;
                    }
                }
            }else{
                for(int i=0; i<4; i++){
                    for(int j=0; j<2; j++){
                        fld[Y+i][X+j]=block[k].cl;
                    }
                }
            }
        }
/*
        for(int i=0; i<w; i++){
            for(int j=0; j<h; j++){
                cout<< fld[i][j]<<" ";
            }
            cout<< endl;
        }
//*/
        cout<< solve()<< endl;
    }

    return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    int n;cin>>n;
    int l;cin>>l;
    int sum=0;
    rep(i,1,n+1)sum+=l+i-1;
    int mi=1000000;
    rep(i,1,n+1){
        mi=min(mi,abs(l+i-1));
    }
    if(mi!=0){
        if(l<0)sum+=mi;
        else sum-=mi;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const image = input.slice(1, -1);

  return image.map(([line]) => `${line}\n${line}`).join("\n");
};

console.log(main(read()));


Measured memory_bytes: 29724
#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    vector<double> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    double ans = v[0];
    for (int i = 1; i < n; i++) {
        ans = (ans + v[i]) / 2;
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define range(i, a, b, s) for (int i = (a), __##i = (b); i < __##i; i += (s))
#define down(i, a, b, s) for (int i = (a), __##i = (b); __##i < i; i -= (s))

const int mod = 1e9 + 7;
const int maxn = 100002;

string a;

template <typename X, typename N>
X pow(X x, N n) {
  if (n == 0) return 1;
  if (n == 1) return x;
  X y = pow(x, n / 2);
  if (n % 2 == 0)
    return (y * y) % mod;
  else
    return ((y * y) % mod * x) % mod;
}

int main(int argc, char const *argv[]) {
  // freopen("E.txt", "r", stdin);

  while (cin >> a) {
    ll ans = 0, cnt = 0;
    range(i, 0, a.length(), 1) {
      if (a[i] == '1') {
        ans +=
            ((pow(2L, cnt) % mod) * (pow(3L, a.length() - i - 1) % mod)) % mod;
        cnt += 1;
      }
    }
    cout << (ans + pow(2L, cnt)) % mod << endl;
  }
  return 0;
}

Measured memory_bytes: 1144
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		if((n % 2) == 0) {
			System.out.println(n);
		}else {
			System.out.println(n * 2);
		}
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
const int MOD = 1e9 + 7;
#define INF ((1<<30)-1)
#define LINF (1LL<<30)

int h,w;
string a[1100];
int dp[1100][1100];

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

Measured memory_bytes: 5632
#include<bits/stdc++.h>
#define int long long
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
using namespace std;
const int N = 3000010;
inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc < '0' || cc > '9') {if(cc == '-') flus = - flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - '0'; cc = getchar();}
	return cn * flus;
}
string s,t,p;
int a,b;
bool cmp(string _i,string j)
{
	if(_i.size()==j.size())
	{
		for(int i=0;i<_i.size();i++)if(_i[i]!=j[i])return 0;
		return 1;
	}
	return 0;
}
signed main()
{
	cin>>s>>t;
	a = read();
	b = read();
	cin>>p;
	if(cmp(p,s)) a--;
	else b--;
	printf("%lld %lld",a,b);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(void)
{
  int n;
  scanf("%d", &n);
  
  int a[n];  
  int i;


  for( i = 0; i < n; i++ ){
    scanf("%d", (a+i) );
  }
  
  for( i = n-1; i >= 0; i-- ){
    printf("%d", a[i] );
    if( i ) printf(" ");
  }
  
  puts("");
  
  return 0;

 
}       

Measured memory_bytes: 612
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    string s;
    cin >> s;
    vint ans;
    int now = n;
    while(now>0){
        if(now<=m) {
            ans.pb(now);
            break;
        }
        bool f = true;
        for(int i=m;i>=1;i--){
            if(s[now-i]=='0'){
                f=false;
                ans.pb(i);
                now = now-i;
                break;
            }
        }
        if(f){
            cout << -1 << endl;
            return 0;
        }
    }
    int l = ans.size();
    cout << ans[l-1];
    for(int i=l-2;i>=0;i--){
        cout << " " << ans[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1096
def main():
    n = int(input())

    def nc2(n):
        return n*(n-1)//2

    dic = {}
    array = input().split()
    for k in array:
        if k in dic:
            dic[k] += 1
        else:
            dic[k] = 1

    ans = 0
    for k in dic:
        ans += nc2(dic[k])

    for a in array:
        print(ans - dic[a] + 1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 82252
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#define inf 1e9+7
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl;
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}
 
typedef pair<ll,ll> Pair;
const ll MAX_L=10000;
 



//Z[0]には0が入っている。これは適当にいじってもよい(以下のコードに影響はない)。
vector<ll> z_algorithm(string str){
    ll L = str.size();
    vector<ll> Z(MAX_L,0);
    for(int i=1, left=0, right=0; i<L; i++){
        if(i > right){
            left = right = i;
            for(;right < L && str[right-left] == str[right]; right++);
            Z[i] = right - left;
            right--;
        }
        else{
            int k = i - left;
            if(Z[k] < right - i + 1){
                Z[i] = Z[k];
            }
            else{
                left = i;
                for(;right < L && str[right-left] == str[right]; right++);
                Z[i] = right - left;
                right--;
            }
        }
    }
    return Z;
}

int main(){
    ll n;
    string s;
    cin >> n >> s;
    vector<ll> ans[MAX_L];
    for(ll i=0;i<n;i++){
        ans[i]=z_algorithm(s.substr(i));
    }
    ll answer=0;
    rep(i,n){
        for(ll j=0;j<ans[i].size();j++){
            if(ans[i][j]>j) ans[i][j]=j;
            answer=max(answer,ans[i][j]);
        }
    }
    kaku(answer);
}



Measured memory_bytes: 391168