akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;


namespace ConsoleApplication31
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int r = int.Parse(str[0]);
            int c = int.Parse(str[1]);
            int[,] a = new int[r, c];

            for (int i = 0; i < r; ++i)
            {
                string[] str2 = Console.ReadLine().Split(' ');

                for (int j = 0; j < c; j++)
                {
                    a[i, j] = int.Parse(str2[j]);
                }
            }
            int[] rSum = new int[c + 1];

            for(int i = 0; i < r; i++)
            {
                int cSum = 0;
                for (int j = 0; j< c; j++)
                {
                    cSum += a[i,j];
                    rSum[j] += a[i,j];
                    Console.Write("{0} ", a[i,j]);
                }
                Console.WriteLine(cSum);
                rSum[c] += cSum;
            }
            for (int i = 0; i < rSum.Length - 1; i++)
            {
                Console.Write("{0} ", rSum[i]);
            }
            Console.WriteLine(rSum[c]);
            
        }
    }   
}

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

#include <iostream>


#define MOD 1000000007

typedef unsigned long long ull;
typedef long long ll;

using namespace std;
auto f=[]()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
};

int main()
{
	f();
	int x,a;cin>>x>>a;
	cout<<(x<a?0:10)<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    string a;
    cin >> a;
    a[5]=' ';
    a[13]=' ' ;
    cout << a;
    return 0;
}


Measured memory_bytes: 256
N=int(input())
lis_A=[]
for i in range(N):
    A=input()
    lis_A.append(int(A))
B=sorted(lis_A)
for i in range(N):
    if B[-1]==lis_A[i]:
        print(B[-2])
    else:
        print(B[-1])

Measured memory_bytes: 14112
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    std::string s;
    std::cin >> s;
    int win = 0;
    for (char ch : s)
    {
        if (ch == 'o') { win++; }
    }
    for (int i = 0; i < 15 - s.length(); i++) { win++; }
    if (win >= 8) { std::cout << "YES" << std::endl; }
    else
    {
        std::cout << "NO" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
a=[]
a[0] = gets.chomp.split(//)
a[1] = gets.chomp.split(//)
a[2] = gets.chomp.split(//)
hash={'a'=> 0, 'b'=> 1, 'c'=> 2}
turn = 'a'
while true
  if a[hash[turn]].empty?
    puts turn.upcase
    break
  end
  turn = a[hash[turn]].shift
end




Measured memory_bytes: 1788
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };
bool valid_pos(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }

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

	int w, h;
	cin >> w >> h;
	static char s[1024][1024];
	for (int i = 0; i < h; ++i)
		cin >> s[i];

	int n;
	cin >> n;
	int wx[1024], wy[1024];
	wx[0] = wy[0] = 0;
	for (int i = 1; i <= n; ++i)
		cin >> wx[i] >> wy[i];

	int res = -1;
	static bool visit[1024][1024];
	visit[0][0] = true;
	for (int t = 0; t <= n && res == -1; ++t)
	{
		s[wy[t]][wx[t]] = '.';
		if (!visit[wy[t]][wx[t]])
			continue;

		queue<pint> q;
		q.push(pint(wx[t], wy[t]));
		while (!q.empty())
		{
			pint c = q.front(); q.pop();
			int x = c.first, y = c.second;
			if (s[y][x] == '#')
				continue;
			else if (s[y][x] == 't')
			{
				res = t;
				break;
			}

			for (int i = 0; i < 4; ++i)
			{
				int tx = x + dx[i], ty = y + dy[i];
				if (valid_pos(tx, ty, w, h) && !visit[ty][tx])
				{
					visit[ty][tx] = true;
					q.push(pint(tx, ty));
				}
			}
		}
	}
	cout << res << endl;
}

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);
template<long long Mod = mod>
constexpr long long MOD(long long in) {
    return in % Mod;
}

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

    std::cin >> r;

    std::cout << 3 * r * r << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m,cnt;
char a[50][50];
int main()
{
    scanf("%d%d",&n,&m);
    int i,j;
    for(i=1;i<=n;i++){
        scanf("%s",&a[i][1]);
        for(j=1;j<=m;j++){
            if(a[i][j]=='#')
                cnt++;
        }
    }
    if(cnt==n+m-1)
        printf("Possible");
    else
        printf("Impossible");
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

struct X {
    long long x;
    long long y;
    long long h;
};

int main() {
    
    int N;
    cin >> N;
    vector< X > V(N);
    for ( int i = 0; i < N; i++ ) {
        long long x,y;
        long long h;
        cin >> x >> y >> h;
        V[i].x = x;
        V[i].y = y;
        V[i].h = h;
    }

    for ( long long i = 0; i <= 100; i++ ) {
    for ( long long j = 0; j <= 100; j++ ) {

        long long H = LLONG_MAX;
        long long H_l = LLONG_MAX;
        bool ok = true;
        for ( int k = 0; k < N; k++ ) {
            
            long long c = abs(i-V[k].x)+abs(j-V[k].y);

            if ( V[k].h > 0 ) {
                if ( H == LLONG_MAX ) {                    
                    H = V[k].h+c;
                }
                else {
                    if ( H != V[k].h+c ) { ok = false; break; }
                }
            }
            else if ( V[k].h == 0 ) {
                H_l = min( H_l, c );                
            }
            
        }        
        if ( H <= 0 ) { continue; }
        if ( H > H_l ) { continue; }
        if ( ok ) { cout << i << " " << j << " " << H << endl; return 0; }
        
    }
    }

    return 0;
}

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

four = 0
odd = 0

for a in A:
    if a % 4 == 0:
        four += 1
    elif a % 2 == 1:
        odd += 1

if odd == 0:
    print('Yes')
else:
    if four + odd == n:
        print('Yes' if four >= n // 2 else 'No')
    else:
        print('Yes' if four >= (four + odd + 1) // 2 else 'No')


Measured memory_bytes: 19992
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;
#include <tr1/unordered_map>
#include <tr1/unordered_set>
using namespace tr1;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;
typedef long long ll;
typedef pair<int,int> pii;

int w, h;
inline bool get(ll S, int y, int x) {
  return S>>(y*w+x)&1;
}
inline ll bit(int y, int x) {
  return 1LL<<(y*w+x);
}
inline bool ok(ll S, int y, int x) {
  if (y<0||y>=h||x<0||x>=w) return 0;
  if (get(S,y,x)) return 0;
  return 1;
}
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};

bool visited[7][7];
int sy,sx;
map<ll, int> mp[7][7];
bool dfs(ll S, int y, int x, int num) {
//  if (num < 30) {
  // if (y) { 
    if (mp[y][x].count(S)) return 0;
    mp[y][x][S] = 1;
  // }
//  }
  // cout << y << "," << x << "," << num << endl;
  // REP(i,h) {
  //   REP(j,w) cout << get(S,i,j);
  //   cout << endl;
  // }
  if (num == 0) {
    return abs(y-sy)+abs(x-sx) == 1;
  }
  {
    // 最初の場所の近傍が全部埋まってたらだめ
    int c = 0;
    REP(k,4) {
      int yy=sy+dy[k];
      int xx=sx+dx[k];
      if (ok(S,yy,xx)) c++;
    }
    if (c==0) return 0;
  }
  // BFSして領域が2つあったらだめ
  {
    REP(i,h)REP(j,w)visited[i][j]=0;
    REP(i,h)REP(j,w) {
      if (get(S,i,j)) continue;
      queue<pii>Q;
      Q.push(pii(i,j));
      visited[i][j] = 1;
      int cnt = 0;
      while(!Q.empty()) {
        pii p = Q.front(); Q.pop();
        ++cnt;
        REP(k,4) {
          int ii=p.first+dy[k];
          int jj=p.second+dx[k];
          if (!ok(S,ii,jj)) continue;
          if (visited[ii][jj]) continue;
          visited[ii][jj] = 1;
          Q.push(pii(ii,jj));
        }
      }
      if (cnt != num) return 0;
      goto next;
    }
  next:;
  }
  {
    // 今の場所と最初の場所以外で凸の部分があったらだめ
    int cnt = 0;
    REP(i,h)REP(j,w) {
      if (get(S,i,j)) continue;
      int c = 0;
      REP(k,4) {
        int ii=i+dy[k];
        int jj=j+dx[k];
        if (!ok(S,ii,jj)) {
          if (ii!=y||jj!=x) {
            if (ii!=sy||jj!=sx) {
              ++c;
            }
          }
        }
      }
      if (c >= 3) {
        ++cnt;
      }
    }
    if (cnt >= 1) return 0;
  }
  REP(k,4) {
    int yy=y+dy[k];
    int xx=x+dx[k];
    if (!ok(S,yy,xx)) continue;
    if (dfs(S|bit(yy,xx),yy,xx,num-1)) return 1;
  }
  return 0;
}

int main() {
  while(cin>>w>>h,w||h) {
    ll S = 0;
    int num = 0;
    REP(i,h) REP(j,w) {
      int a; cin >> a;
      if (a) S |= bit(i,j);
      else {
        sy=i,sx=j;
        ++num;
      }
    }
    if (num <= 3) {               // 空きマスが3以下
      puts("No");
      continue;
    }
    S |= bit(sy,sx); --num;
    REP(i,h)REP(j,w) mp[i][j].clear();
    cout << (dfs(S,sy,sx,num)?"Yes":"No") << endl;
  }
}

Measured memory_bytes: 20144
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <numeric>

using namespace std;

int main(){
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   if(a+b>c+d)cout<<"Left"<<endl;
   else if(a+b==c+d)cout<<"Balanced"<<endl;
   else cout<<"Right"<<endl;
   



}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc1 = new java.util.Scanner(System.in);
		int N = sc1.nextInt();
		int K = sc1.nextInt();

		if (N % K == 0) {
			System.out.println(0);
		} else {
			System.out.println(1);
		}
	}
}


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

int main(){
    int N;
    std::cin>>N;
    int a[101];
    int mina=10000,maxa=0;
    for(int i=0;i<N;++i){
        std::cin>>a[i];
        mina=std::min(mina,a[i]);
        maxa = std::max(maxa, a[i]);
    }
    if(mina == maxa){
        std::cout<<0<<std::endl;
        return 0;
    }
    int cost = 1000000;
    for(int i = mina; i <= maxa; ++i){
        int cos1 = 0;
        for(int j=0;j<N;++j){
            cos1 += (a[j] - i) * (a[j] - i);
        }
        cost = std::min(cost , cos1);
    }
    std::cout<<cost<<std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int MOD = 1e9 + 7;
int f[41][1 << 18];
int n , a , b , c;

int main(){
	cin >> n >> a >> b >> c;
	f[0][0] = 1;
	int st = (1 << (c - 1)) + (1 << (b + c - 1)) + (1 << (a + b + c - 1));
	int all = (1 << 18);
	for(int i = 1 ; i <= n ; ++ i)
		for(int S = 0 ; S < all ; ++ S){
			if((S & st) == st) continue;
			for(int p = 1 ; p <= 10 ; ++ p){
				int NS = (((S << p) + (1 << (p - 1))) & (all - 1));
				if((NS & st) == st) continue;
				(f[i][NS] += f[i - 1][S]) %= MOD; 
			}
		}
	int ans = 1;
	for(int i = 1 ; i <= n ; ++ i)
		ans = 1ll * ans * 10 % MOD;
	for(int i = 0 ; i < all ; ++ i)
		(ans += MOD - f[n][i]) %= MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 41216
#include <cstdio>
#include <cmath>
#include <utility>

void rec(int n, std::pair<double, double> p, std::pair<double, double> q) {
  if (n == 0) {
    printf("%f %f\n", q.first, q.second);
    return;
  }
  auto d = std::make_pair((q.first - p.first) / 3, (q.second - p.second) / 3);
  auto e = std::make_pair(d.first * 0.5 - d.second * sqrt(3) / 2, d.first * sqrt(3) / 2 + d.second * 0.5);
  auto r = std::make_pair(p.first + d.first, p.second + d.second);
  auto s = std::make_pair(r.first + e.first, r.second + e.second);
  auto t = std::make_pair(q.first - d.first, q.second - d.second);
  rec(n - 1, p, r);
  rec(n - 1, r, s);
  rec(n - 1, s, t);
  rec(n - 1, t, q);
}

int main() {
  size_t n;
  scanf("%zu", &n);
  printf("%f %f\n", 0.0, 0.0);
  rec(n, std::make_pair(0, 0), std::make_pair(100, 0));
  return 0;
}

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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;


int main() {

#ifndef ONLINE_JUDGE
    //freopen("in.in", "r", stdin);
    //freopen("in.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    vector<pair<pii, int> > edges, ans;
    int l, sum = 0, mn = 30, st, cur;
    cin >> l;
    int tmp = l;
    l--;
    int base = 0;
    while (base <= l) {
        st = 1, cur = -1, sum = 0;
        for (int i = 21; i >= 2; i--) {
            cur = i;
            sum += st;
            if (base + sum > l) {
                break;
            }
            st <<= 1;
        }
        mn = min(mn, cur);
        edges.push_back({{1, cur}, base});
        base += st;
    }

    st = 1;
    rloop(i, 20) {
        if (i == mn - 1 || i == 1)break;
        edges.pb({{i, i + 1},
                  st});

        edges.pb({{i, i + 1},
                  0});

        st <<= 1;
    }


    vector<int> v;
    for (auto edge : edges)if (edge.fr.fr != mn)v.pb(edge.fr.fr);
    for (auto edge : edges)if (edge.fr.sc != mn)v.pb(edge.fr.sc);
    sort(ALL(v));
    v.resize(unique(ALL(v)) - v.begin());
    for (auto &edge : edges)edge.fr.fr = upper_bound(ALL(v), edge.fr.fr) - v.begin();
    for (auto &edge : edges)edge.fr.sc = upper_bound(ALL(v), edge.fr.sc) - v.begin();
    for (auto edge : edges)if (edge.fr.fr != edge.fr.sc)ans.pb(edge);
    swap(edges, ans);
    cout << SZ(v) << " " << SZ(edges) << endl;
    for (auto edge : edges)cout << edge.fr.fr << " " << edge.fr.sc << " " << edge.sc << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
const int Maxn=1e5+5;
#define rep(i,n) for (int i=0;i<n;++i)
#define int long long
int n,mx;
std::vector <int> v[Maxn];
int dp[Maxn];
void dfs(int k,int p=-1)
{
	int s=0;
	int ss=0;
	std::vector <int> t;
	for (auto &x:v[k])
	{
		if (x==p)
		{
			continue;
		}
		ss++;
		t.push_back(x);
		dfs(x,k);
		if (dp[x])
		{
			s++;
		}
		dp[k]+=dp[x];
	}
	dp[k]+=std::max(ss-s-1,0ll);
}
signed main()
{
	std::cin>>n;
	for (int i=1;i<n;++i)
	{
		int x,y;
		std::cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	rep(i,n)
	{
		if (v[i].size()>v[mx].size())
		{
			mx=i;
		}
	}
	dfs(mx);
	std::cout<<std::max(1ll,dp[mx])<<std::endl;
	return 0;
}


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

int profit2(int a[], int n){
    int max = a[1] - a[0];
    int temp,min=a[0];
    for(int i=1; i<=n-1; i++){
        temp = a[i] - min;
        if(temp > max){
            max = temp;
        }
        if(a[i] < min){
            min = a[i];
        }
    }
    return max;
}

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    cout<<profit2(a,n)<<endl;

}


Measured memory_bytes: 3904
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){
    int n,m;
    cin>>n>>m;
    vector<vector<ll>> dist(n+1,vector<ll>(n+1,10000000000000));
    rep(i,0,n)dist[i][i]=0;

    vector<ll> from(m),to(m),cost(m);
    rep(i,0,m){
        cin>>from[i]>>to[i]>>cost[i];
        from[i]--; to[i]--;
        dist[from[i]][to[i]]=min(dist[from[i]][to[i]],cost[i]);
        dist[to[i]][from[i]]=min(dist[to[i]][from[i]],cost[i]);
    }

    rep(i,0,n){
        rep(j,0,n){
            rep(k,0,n){
                dist[j][k]=min(dist[j][k],dist[j][i]+dist[i][k]);
            }
        }
    }
    int ans=0;
    rep(i,0,m){
        bool ok=true;
        rep(j,0,n){
            if(dist[j][from[i]]+cost[i]==dist[j][to[i]])ok=false;
        }
        ans+=ok;
    }
    cout<<ans<<endl;

}

/*

*/


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    /*
    int a;
    cin >> a ;
    */

    //*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    //*/
    
    /*
    if( a % 2 == 0 ){
        cout << a << endl;
    } else {
        cout << a * 2 << endl;
    }
    */
    
    cout << vec.at(2) - vec.at(0) << endl;

    return 0; 
}


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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  string ans = "No";
  if (n%2 == 0) {
    int flag = 1;
    rep(i, n/2) {
      if (s[i] != s[n/2 + i]) flag = 0;
    }
    if (flag == 0) {
      ans = "No";
    } else {
      ans = "Yes";
    }
  } else {
    ans = "No";
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
class ModCombination
  attr_reader :fac, :inv, :finv, :mod

  MOD = 10 ** 9 + 7

  def initialize(n, mod: MOD)
    @mod = mod
    @fac = [1, 1]
    @inv = [1, 1]
    @finv = [1, 1]

    (2..n).each do |i|
      @fac[i] = fac[i - 1] * i % mod
      @inv[i] = mod - inv[mod % i] * (mod / i) % mod
      @finv[i] = finv[i - 1] * inv[i] % mod
    end
  end

  def combination(n, k)
    return 0 if n < k
    return 0 if n < 0 || k < 0

    fac[n] * (finv[k] * finv[n - k] % mod) % mod
  end

  def repeated_combination(n, k)
    combination(n + k - 1, k)
  end
end

MOD = 10 ** 9 + 7
N, K = gets.split.map(&:to_i)
mc = ModCombination.new(2 * N + 1)
ans = 0

0.upto([K, N - 1].min) do |m|
  ans += mc.combination(N, m) * mc.repeated_combination(N - m, m)
  ans %= MOD
end

puts ans


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

string itos(int x){
  string r;
  while(x){
    r+=x%10+'0';
    x/=10;
  }
  reverse(r.begin(),r.end());
  return r;
}

int main(){
  int n,cnt;
  string s;
  cin>>n;
  while(n--){
    cin>>s;
    cnt=0;
    for(int i=0;i<s.size()-1;i++){
      int cal=s[i]-'0'+s[i+1]-'0';
      string sub=s.substr(i+2,s.size()-i);
      string ts=itos(cal);
      s=ts+sub;
      cnt++;
      if(s.size()==1)break;
      i=-1;
    }
    if(cnt%2)cout<<"Fabre wins."<<endl;
    else cout<<"Audrey wins."<<endl;
  }
  return 0;
}

Measured memory_bytes: 1212
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v){
    if(v.empty()){
        os<<"{ }";
        return os;
    }
    os<<"{"<<v.front();
    for(auto itr=++v.begin();itr!=v.end();itr++){
        os<<", "<<*itr;
    }
    os<<"}";
    return os;
}

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll a,b,c,d; cin>>a>>b>>c>>d;
    ll ans=a*c;
    ans=max(ans,b*d);
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    if(a*b<=0 || c*d<=0) ans=max(ans,0LL);
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<math.h>

#define ALL(a) (a).begin(),(a).end()
#define ll long long
#define vi vector<int>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,k,n) for(int (i)=(k);(i)<(n);(i)++)

using namespace std;
  
int main(){
  int N;cin>>N;vi v(N);
  REP(i,N)v[i]=i+1;

  vi P(N),Q(N);
  REP(i,N)cin>>P[i];REP(i,N)cin>>Q[i];
  
  int countP=-1,countQ=-1;
  int k=0;
  do{/*
    cout<<"P:";REP(i,N)cout<<P[i]<<" ";
    cout<<"Q:";REP(i,N)cout<<Q[i]<<" ";
    cout<<"V:";REP(i,N)cout<<v[i]<<" ";cout<<endl;*/
    if(countP==-1)
      REP(i,N){
	if(P[i]!=v[i]){/*cout<<"x\n";*/break;}
	if(i==N-1){countP=k;/*cout<<"P ok"<<countP;*/}
      }
    if(countQ==-1)
      REP(i,N){
	if(Q[i]!=v[i]){/*cout<<"x\n";*/break;}
	if(i==N-1){countQ=k;/*cout<<"Q ok"<<countQ;*/}
      }
    if(countP>=0&&countQ>=0)break;
    k++;
  }while( next_permutation(ALL(v)) );
  cout <</* "\ncountP:"<<countP << " countQ:" << countQ << " val:" << */abs(countP-countQ) << endl;
      
  
  return 0;
}


Measured memory_bytes: 256
n=int(input())
s=[int(input()) for i in range(n)]
s.sort()
if sum(s)%10==0:
    pass
else:#sum(s)が10の倍数の場合、配点が10の倍数ではないもので最小のものを引く
    print(sum(s))
    exit()
for i in range(n):
    if s[i]%10!=0:
        print(sum(s)-s[i])
        exit()
print(0)

Measured memory_bytes: 2940
def getInts():
    return [ int(x) for x in input().split() ]

[N] = getInts()
As = getInts()
A = {}
for i in range(1, N+1):
    A[i] = As[i-1]

L = {}
R = {}
for i in range(1, N+1):
    if i - A[i] not in L:
        L[i-A[i]] = 1
    else:
        L[i-A[i]] += 1
    if i + A[i] not in R:
        R[i+A[i]] = 1
    else:
        R[i+A[i]] += 1
count = 0
for k in R.keys():
    if k in L:
        count += R[k]*L[k]
print(count)


Measured memory_bytes: 74680
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	int N; cin>>N;
	vector<ll> A(N);
	rep(i,N)cin>>A[i];
	vector<vector<ll>> e_ans(64, vector<ll> (2,0));
	for(ll bit = 0; bit < 64; ++bit){
		rep(i,N){
			if(A[i] & (1LL<<bit))e_ans[bit][1]++;
			else e_ans[bit][0]++;
		}
	}
	// rep(i,64){
	// 	printf("[%d] = [%lld & %lld]\n", i, e_ans[i][0], e_ans[i][1]);
	// }
	// cout<<line<<endl;
	ll ans = 0;
	rep(i,64){
		if(e_ans[i][1] == 0 || e_ans[i][0] == 0)continue;
		ans += (e_ans[i][0]*e_ans[i][1])%MOD * ((ll)pow(2,i) %MOD) %MOD;
		ans %= MOD;
		// printf("[%d] ans = %lld\n", i, ans);
	}
	if(ans < 0)ans += MOD;
	cout<<ans<<endl;
	return 0;
}

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

ans = 0
for i in range(n-1):
  p = a[i] + a[i+1] - x
  if p > 0:
    ans += p
    a[i+1] = max(0, a[i+1]-p)
    
print(ans)

Measured memory_bytes: 14160
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
int main()
{
	int n;
	while(cin >> n)
	{
		n%=39;
		if(n==0)n+=39;
		if(n>=10)printf("3C%d\n",n);
		else printf("3C0%d\n",n);
	}
	return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll a, b, x; cin >> a >> b >> x;
	
	ll res = b / x;
	res -= (a - 1LL) / x;

	cout << res + (a == 0LL && x != 1LL) << endl;

	return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
G = [list(input()) for i in range(H)]


up = [[0] * W for i in range(H)]  # あるマスから上に連続していくつ障害物のないマスが続くか
right = [[0] * W for i in range(H)]  # あるマスから右に連続していくつ障害物のないマスが続くか
down = [[0] * W for i in range(H)]  # あるマスから下に連続していくつ障害物のないマスが続くか
left = [[0] * W for i in range(H)]  # あるマスから左に連続していくつ障害物のないマスが続くか


# up
for w in range(W):
    for h in range(1, H):
        if G[h - 1][w] == '#':
            continue
        up[h][w] = up[h - 1][w] + 1

# right
for h in range(H):
    for w in reversed(range(W - 1)):
        if G[h][w + 1] == '#':
            continue
        right[h][w] = right[h][w + 1] + 1

# down
for w in range(W):
    for h in reversed(range(H - 1)):
        if G[h + 1][w] == '#':
            continue
        down[h][w] = down[h + 1][w] + 1

# left
for h in range(H):
    for w in range(1, W):
        if G[h][w - 1] == '#':
            continue
        left[h][w] = left[h][w - 1] + 1


ans = 0
for h in range(H):
    for w in range(W):
        if G[h][w] == '#':
            continue
        ans = max(ans, up[h][w] + right[h][w] + down[h][w] + left[h][w] + 1)

print(ans)


Measured memory_bytes: 309128
import os,re,sys,operator
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq

setrecursionlimit(10**6)

def dfs(now,depth):
    global used
    global gragh
    global n
    ans=0

    if used[now]:
        return 0
    if depth==n:
        return 1
    used[now]=1
    for i in range(n):
        if gragh[now][i]:
            ans+=dfs(i,depth+1)
    used[now]=0
    return ans

n,m=map(int,stdin.readline().rstrip().split())
gragh=[[0]*n for _ in range(n)]

for i in range(m):
    a,b=map(int,stdin.readline().rstrip().split())
    gragh[a-1][b-1]=gragh[b-1][a-1]=1

used=[0]*n
print(dfs(0,1))

Measured memory_bytes: 42844
#include<cstdio>
#include<algorithm>
#include<cctype>
#include<cstring>
#include<cmath>

using namespace std;

#define bomb exit(1)
#define INF 1061109567
#define LINF 4557430888798830399ll
#define pprint(x) print(x),putchar(' ')
#define fprint(x) print(x),putchar('\n')
#define EE(x); struct edge { int nxt,to,w; }e[M << 1]; int head[N],ecnt = 1;\
	void add(int u,int v,ll w = 0) { e[++ecnt].w = w,e[ecnt].to = v,e[ecnt].nxt = head[u];head[u] = ecnt; }\
	void add_edge(int u,int v,ll w = 0) { add(u,v,w),add(v,u,w * x); }
#define ll long long
const double pi = acos(-1.0);
int mod;
ll Mod(ll x) { return x >= mod ? x - mod : x; }
#define eps 0.0000000001
#define sqr(x) ((x) * (x))
#define iter iterator
#define fi first
#define se second
//#define getchar() (SS == TT && (TT = (SS = BB) + fread(BB,1,1 << 15,stdin),TT == SS) ? EOF : *SS++)
//char BB[1 << 15],*SS = BB,*TT = BB;
ll read()
{
	ll x = 0;int f = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') f = -1;
	for(;isdigit(ch);ch = getchar()) x = x * 10 + (ch ^ 48);
	return x * f;
}
void print(ll x)
{
	if(x < 0) putchar('-'),x = -x;
	if(x > 9) print(x / 10);putchar(x % 10 + '0');
}

const int N = 200010;
ll n,x,d,ans;
struct line { ll l,r,m; }a[N];
ll solve(int L,int R)
{
	ll now = a[L].l,ans = 0;
	for(int i = L;i <= R;i++)
	{
		if(a[i].r < now) continue;
		now = max(now,a[i].l);
		ans += (a[i].r - now + mod);
		now = a[i].r + mod;
	}return ans / mod;
}
int main()
{
	n = read(),x = read(),d = read();
	if(!d) { fprint((!!x) * n + 1);return 0; }
	if(d < 0) x += (n - 1) * d,d = -d;
	x -= d;mod = 2 * d;
	for(ll k = 0;k <= n;k++)
	{
		ll down = (1 + k) * k - (1 + n) * n / 2,up = (n - k + 1 + n) * k - (1 + n) * n / 2;
		a[k].l = k * x - (n - k) * x + down * d;
		a[k].r = k * x - (n - k) * x + up * d;
		a[k].m = (a[k].l % mod + mod) % mod;
	}
	sort(a,a + n + 1,[&](line a,line b)
	{
		if(a.m == b.m) return a.l < b.l;
		else return a.m < b.m;
	});
	int lst = a[0].m,pos = 0;
	for(int i = 0;i <= n;i++)
	{
		if(a[i].m != lst)
		{
			ans += solve(pos,i - 1);
			pos = i,lst = a[i].m;
		}
	}ans += solve(pos,n);
	fprint(ans);
	return 0;
}

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

string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename T> string to_string(T v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }
template <typename T, typename U> string to_string(pair<T, U> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
void print_debug() { cerr << endl; }
template <typename T, typename... U> void print_debug(T t, U... u) { cerr << " " << to_string(t); print_debug(u...); }
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", print_debug(__VA_ARGS__)
#else
#define debug(...)
#endif

typedef long long ll;

const int MAX_N = 1e5 + 10;
const ll MAX_A = 1e18;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  int n;
  cin >> n;
  ll a[MAX_N];
  for (int i=0; i<n; i++) {
    cin >> a[i];
    if (a[i] == 0) {
      cout << 0;
      return 0;
    }
  }
  ll ans = 1;
  for (int i=0; i<n; i++) {
    if (a[i] <= MAX_A/ans) {
      ans *= a[i];
    }
    else {
      cout << -1;
      return 0;
    }
  }
  cout << ans;
}



Measured memory_bytes: 4416
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String[] args) {
		try {
			boolean[][] cards = new boolean[4][13];
			
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 13; j++) {
					cards[i][j] = false;
				}
			}

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String s = reader.readLine();
				
			int n = Integer.parseInt(s);
			String[] trump;
			int num = 0;
			for (int k = 0; k < n; k++) {
				String t = reader.readLine();
				trump = t.split(" ");
				num = Integer.parseInt(trump[1]);
				if ("S".equals(trump[0])) {
					cards[0][num - 1] = true;
				} else if ("H".equals(trump[0])) {
					cards[1][num - 1] = true;
				} else if ("C".equals(trump[0])) {
					cards[2][num - 1] = true;
				} else if ("D".equals(trump[0])) {
					cards[3][num - 1] = true;
				}
			}
			
			String[] picture = {"S", "H", "C", "D"};
			
			for (int l = 0; l < 4; l++) {
				for (int m = 0; m < 13; m++) {
					if (!cards[l][m]) {
						System.out.print(picture[l] + " ");
						System.out.println(m + 1);
					}
				}
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Measured memory_bytes: 24128
#include<iostream>
#include <numeric>
// #include<string>
#include<vector>
#include <algorithm>
#include <cmath>
// #include <functional>
#include <iomanip>

using namespace std;

int main()
{
    // std::cout<<std::fixed<<std::setprecision(10);

    // Input
    unsigned long long k, n;
    cin >> k >> n;

    vector<unsigned long long> list;

    unsigned long long before = 0;
    unsigned long long first;

    for (unsigned long long i = 0; i < n; i++) {
        unsigned long long in;

        cin >> in;

        if (i == 0) {
            first = in;
        } else if (i == (n - 1)) {
            list.push_back(in - before);
            list.push_back(first + k - in);
        } else {
            list.push_back(in - before);
        }
        before = in;
    }

    sort(list.begin(), list.end());

    unsigned long long ans = 0;
    for (unsigned long long i = 0; i < n - 1; i++) {
        ans += list[i];
        // cout << list[i] << endl;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 2420
import java.util.*;
public class Main {
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      int K = sc.nextInt();
      
      // 最大公約数の和を算出
      int sum = 0;
      for(int i = 1; i <= K; i++){
        for(int j = i; j <= K; j++){
          for(int k = j; k <= K; k++){
            if(i == j && j == k){
              // 3数が等しい場合、GCD * 1を加算
              sum = sum + extgcd(i,j,k);
            }else if(i == j || j == k){
              // 2数が等しい場合、GCD * 3を加算
              sum = sum + extgcd(i,j,k) * 3;
            }else{
              // 3数が異なる場合、GCD * 6を加算
              sum = sum + extgcd(i,j,k) * 6;
            }
          }
        }
      }
      
      // 出力
      System.out.println(sum);
    }
    
    // 2数の最大公約数を求める関数
    public static int gcd(int a, int b){
      if(b == 0){
        return a;
      }
      
      return gcd(b, a % b);
    }
    
    // 3数の最大公約数を求める関数
    public static int extgcd(int a, int b, int c){
      return gcd(gcd(a, b), c);
    }
}

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

using namespace std;

int main(){

  string s,t;
  cin >> s;
  bool check = true;

  reverse(s.begin(),s.end());
  string dic[4] = {"dream", "dreamer", "erase", "eraser"};
  for (int i = 0; i < 4; i++) {
    reverse(dic[i].begin(),dic[i].end());
  }

  for (int i = 0; i < s.size();) {
    bool check2 = false;
    for (int j = 0; j < 4; j++) {
      if (s.substr(i,dic[j].size()) == dic[j]) {
        i += dic[j].size();
        check2 = true;

      }
    }
    if (!check2) {
      check = false;
      break;
    }
  }

  check ? cout << "YES" : cout << "NO";

  cout << endl;

}


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

int main(){
    char s[3];
    for(int i=0;i<3;i++){
        cin >> s[i];
    }

    if(s[0]=='M'){
        cout << "6"<< endl;
    }else if(s[0]=='T'){
        if(s[1]=='U'){
            cout << "5"<<endl;
        }else{
            cout << "3" << endl;
        }
    }else if(s[0]=='W'){
        cout << "4" << endl;
    }else if(s[0]=='F'){
        cout << "2"<< endl;
    }else{
        if(s[1]=='A'){
            cout << "1"<< endl;
        }else{
            cout << "7"<< endl;
        }
    }
    return 0;
}

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

using namespace std;

#define int long long

#ifndef bhupixb
    #define var(...)
    #define stl(...)
#endif

#define rep(i,a,b) for (int i = a; i <= (int)b; ++i)
#define f first
#define s second

#define single_test

const int maxn = 1e5 + 4;
int a[101], n;
int dp[maxn];

int go(int rem) {
    int &ref = dp[rem];
    if (ref != -1) {
        return ref;
    }
    for (int i = 0; i < n; ++i) {
        if (a[i] > rem) break;
        bool calc = go(rem - a[i]);
        // cout << "ever in" << '\n';
        // cout << rem << ' ' << a[i] << ' ' << calc << '\n';
        if (!calc) {
            return ref = 1^calc;
        }
    }
    return ref = false;
}

void solve() {
    memset(dp, -1, sizeof dp);
    int k;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    // cout << "a" << '\n';
    cout << (go(k) ? "First" : "Second") << '\n';
}

signed main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t = 1;
    #ifndef single_test
        cin >> t;
    #endif
    for (int i = 1; i <= t; ++i) {
        // cout << "Case #" << i << ": ";
        solve();
    }

    return 0;
}

Measured memory_bytes: 7520
import java.io.*;
public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
        String line=br.readLine();
        int time = Integer.parseInt(line);
        int sec=0,min=0,hour=0;
        
        if (time>=3600) {
            hour=time/3600;
            time=time%3600;
            min=time/60;
            sec=time%60;
            System.out.println(hour+":"+min+":"+sec);
        }
        else if (time>=60) {
            min=time/60;
            sec=time%60;
            System.out.println(hour+":"+min+":"+sec);
        }
        else{
            System.out.println(hour+":"+min+":"+sec);
        }
    }
}

Measured memory_bytes: 17004
#include <stdio.h>

int main(void){

    int x1, x2, i, r, d;

    scanf("%d", &r);
    scanf("%d", &d);
    scanf("%d", &x1);

    for (i=0;i<10;i++){
        x2 = r * x1 - d;
        printf("%d\n", x2);
        x1 = x2;
    }
    return 0;
}

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

#define FOR(i,a,b)  for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      (v).begin(),(v).end()
#define BIT(n)      (1LL<<(n))
#define IN(x,l,r)   ((l)<=(x)&&(x)<=(r))
#define SHOW(x)     cout<<#x<<" = "<<x<<endl
#define SORT(v)     sort(ALL(v))
#define SZ(v)       (ll)(v).size()
#define UNIQ(v)     SORT(v);(v).erase(unique(ALL(v)),(v).end())
#define PERM(v)     for(bool p=1;p;p=next_permutation(ALL(v)))
#define PQ(T)       priority_queue<T,vector<T>,greater<T>>

template<typename T>string join(const vector<T>& v, string d=" ")
{stringstream s;REP(i,SZ(v))s<<d<<v[i];return s.str().substr(d.length());}

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v)
{if(SZ(v))s<<join(v,", ");return s;}

const ll INF = 1e15;
const ll MOD = 1e9+7;
const double EPS = 1e-10;

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

int main() {
    ll A, B, C; cin >> A >> B >> C;
    
    if (A == B and B == C and A % 2 == 0) {
        cout << -1 << endl;
        return 0;
    }
    
    ll ans = 0;
    while ( A % 2 == 0 and B % 2 == 0 and C % 2 == 0 ) {
        ans++;
        
        ll a = A, b = B, c = C;
        a = B / 2 + C / 2;
        b = A / 2 + C / 2;
        c = A / 2 + B / 2;
        
        A = a, B = b, C = c;
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
while True:
    try:
        k = input()
        ad = 0

        if ('IV' in k) or ('IX' in k) or ('IL' in k) or ('IC' in k) or ('ID' in k) or ('IM' in k):
            ad += 2

        if ('VX' in k) or ('VL' in k) or ('VC' in k) or ('VD' in k) or ('VM' in k):
            ad += 10

        if ('XL' in k) or ('XC' in k) or ('XD' in k) or ('XM' in k):
            ad += 20

        if ('LC' in k) or ('LD' in k) or ('LM' in k):
            ad += 100

        if ('CD' in k) or ('CM' in k):
            ad += 200

        if 'DM' in k:
            ad += 1000

        s = list(k)

        for i in range(len(s)):
            if s[i] == 'I':
                s[i] = 1
            elif s[i] == 'V':
                s[i] = 5
            elif s[i] == 'X':
                s[i] = 10
            elif s[i] == 'L':
                s[i] = 50
            elif s[i] == 'C':
                s[i] = 100
            elif s[i] == 'D':
                s[i] = 500
            else:
                s[i] = 1000

        print(sum(s) - ad)


    except EOFError:
        break


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

int main() {
    int L, R;
    cin >> L >> R;
    if (R - L > 2019) {
        cout << 0 << endl;
    } else {
        L %= 2019; R %= 2019;
        int ans = 2020;
        for(int i = L; i < R; i++){
            for(int j = i + 1; j < R + 1; j++) {
                if(ans > ((i * j) % 2019)){
                    ans = (i * j) % 2019;
                }
            }
        }
        cout << ans << endl;
    }
}


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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)


typedef long long ll;
typedef unsigned long long int llt;

const int N = 1e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

string ans ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ans += to_string(x);
     return;
}

llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

int main()
{
  string s;
  cin>>s;
  cin>>s;
  cout<<"A"<<s[0]<<"C"<<endl;
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>

using namespace std;

int main(){
	int charCount[26] = { 0 };
	string S;
	cin >> S;
	for (unsigned int i = 0; i < S.length(); ++i){
		char c = S[i];
		++charCount[c - 'a'];
		if (charCount[c - 'a'] >1){
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll n;cin>>n;
    ll a[n];rep(i,0,n)cin>>a[i];

    ll s=0,t=0,res=0,sum=0,x=0;
    while(1){
        while(t<n && (sum+a[t]) == (x^a[t])){
          	x = x^a[t];
			sum += a[t++];
        } 	
       	if((sum+a[t]) == (x^a[t])){
          	res+=(t-s)*(t-s+1)/2;
          	break;
        }
      	//cout << s << " " << t << " " << sum <<endl;
        res+=t-s;
        x = x^a[s];
        sum -= a[s++];
    }
    cout << res << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
    int x;
    cin >> x;
    for (int i = x;; ++i) {
        if(IsPrime(i)){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin>>n;
  int max=0;
  int x=0;
  for(int i=0;i<n;i++){
    char s;
    cin>>s;
    if(s=='I'){
      x++;
    }
    if(s=='D'){
      x--;
    }
    if(x>max){
      max=x;
    }
  }
  cout<<max<<endl;
}

Measured memory_bytes: 3580