akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

signed main() {
  string N;
  cin >> N;

  rep(i, N.size()) {
    char c = N[i];
    if (i % 2 == 0) {
      if (c == 'L') {
        COUT("No");
        return 0;
      }
    } else {
      if (c == 'R') {
        COUT("No");
        return 0;
      }
    }
  }
  COUT("Yes");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define f first
#define sec second
#define pb push_back
#define pf push_front
#define po pop_back
#define fast ios_base::sync_with_stdio(false)
#define vi vector<ll>
#define vii vector< pair<ll,ll> >
#define pi pair<ll,ll>
#define map map<ll,ll>
#define set set<ll>
#define tostr to_string
#define toint stoi
#define gcd __gcd


int main()
{
    fast;
   ll n,i;string s,t,g="";
   cin>>n>>s>>t;
   ll j=0,k=0;
   for(i=0;i<2*n;i++)
   {
       if(i%2==0)
        g+=s[j++];
        else
        g+=t[k++];
   }
   cout<<g<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX



 
void solve()
{
  int k,x;
  cin >> k >> x;
  k--;
  rep(i,x-k,x+k)
    cout << i << " ";
 
}


signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

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

int main()
{
    long long n,q;
    string S;
    cin >> n >> q;
    cin >> S;

    vector<pair<int, int>> Q(q);
    long long counts[n]={},count=0;
    int l, r, ans;

    for(int i=0;i<q;i++){
        cin >> l >> r;
        Q[i] = make_pair(l,r);
    }
    for(int i=0;i<S.length();i++){
        if(S[i]=='A'){
            if(S[i+1]=='C'){
              	count++;
            }
        }
      counts[i+1] = count;
    }
    for(int i=0;i<q;i++){
        ans = counts[Q[i].second-1]-counts[Q[i].first-1];
        cout << ans << endl;
    }
    return 0;
}


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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) (int)((a).size())
#define all(c) (c).begin(), (c).end()
#define debug(v) {for (auto z : v) {cerr << z << ' ';} cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	ll n; cin >> n;
	ll ans = 1;
	for (ll x = 2; x * x <= n; x++) {
		ll m = n;
		while (m % x == 0) m /= x;
		if ((m-1) % x == 0) ++ans;
	}
	for (ll x = 1; x * x < n - 1; x++)
		if ((n-1) % x == 0) ++ans;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 400


int main() {
	vector<int>r;
	vector<int>c[N];
	vector<int>l[N];
	vector<int>ll[N];
	vector<int>u;
	vector<int>d;
	int f[N][N];
	char a[N];

	int n, m, k;
	int x, y, z;
	int s, ans;
	bool v = true;
	ans = 0;
	scanf("%d %d %d", &n, &m, &k);
	f(i, n) {
		f(j, N)a[j] = 0;
		scanf("%s", a);
		f(j, m) {
			if (a[j] == '#') {
				c[i].push_back(j);
			}
		}
		if (!c[i].empty())r.push_back(i);
	}
	f(i, r.size()) {
		if (i == 0)u.push_back(1);
		else u.push_back(r[i - 1] + 2);
		if ((i + 1) < r.size())d.push_back(r[i] + 1);
		else d.push_back(n);
	}
	f(i, r.size()) {
		f(j, c[r[i]].size()) {
			if (j == 0)l[i].push_back(1);
			else l[i].push_back(c[r[i]][j - 1] + 2);
			if ((j + 1) < c[r[i]].size())ll[i].push_back(c[r[i]][j] + 1);
			else ll[i].push_back(m);
		}
	}
	x = 1;
	f(i, u.size()) {
		f(j, l[i].size()) {
			for (int ii = u[i] - 1; ii < d[i]; ii++) {
				for (int jj = l[i][j] - 1; jj < ll[i][j]; jj++) {
					f[ii][jj] = x;
				}
			}
			x++;
		}
	}
	f(i, n) {
		f(j, m) {
			printf("%d", f[i][j]);
			if (j < (m - 1))printf(" ");
			else printf("\n");
		}
	}

	return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;

template<typename A,typename B> inline void chmin(A &a,B b){if(a>b) a=b;}
template<typename A,typename B> inline void chmax(A &a,B b){if(a<b) a=b;}
//-----------------------------------------------------------------------

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

    int e;
    while(cin>>e,e)
    {
        int ans=1e9;
        for(int z=0;e-z*z*z>=0;z++){
            for(int y=0;e-z*z*z-y*y>=0;y++){
                int x=e-z*z*z-y*y;
                chmin(ans,x+y+z);
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,x,y;
	cin >> n >> m;
	vector <int> adj[n+1];
	int out[n+1],in[n+1],vis[n+1];
	memset(vis,0,sizeof(vis));
	memset(out,0,sizeof(out));
	memset(in,0,sizeof(in));
	for(int i=0;i<m;i++)
		cin >> x >> y,adj[x].push_back(y),out[x]++,in[y]++;
	queue <int> q;
	for(int i=1;i<=n;i++)
		if(in[i]==0) q.push(i);
	vector <int> topo_sort;
	while(!q.empty())
	{
		int cur = q.front();
		vis[cur] = 1;
		topo_sort.push_back(cur);
		q.pop();
		for(int j=0;j<adj[cur].size();j++)
		{
			int child = adj[cur][j];
			in[child]--;
			if(in[child]==0)
				q.push(child);
		}
	}
	int dist[n+1];
	int ans = 0;
	memset(dist,0,sizeof(dist));
	for(int i=0;i<topo_sort.size();i++)
	{
		int parent = topo_sort[i];
		for(int j=0;j<adj[parent].size();j++)
		{
			int child = adj[parent][j];
			dist[child] = max(dist[child],dist[parent]+1);
			ans = max(ans,dist[child]);
		}	
	}
	// cout << topo_sort.size() << "\n";
	cout << ans << "\n";
}


Measured memory_bytes: 10780
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;

using namespace std;
using ll = long long;
typedef pair<int, int> P;

int main(){
    int n; cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];
    sort(a, a+n, greater<int>());

    bool turn=true;
    int al=0, bo=0;
    rep(i, n){
        if(turn==true){
            al+=a[i];
            turn=false;
        }
        else{
            bo+=a[i];
            turn=true;
        }
    }
    out(al-bo);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

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; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9 + 5;
constexpr long long INFLL = 1LL << 62;
constexpr double eps = (1e-9);

bool is_out(const pair<ll, ll>& range, const pair<ll, ll>& t) {
  if (t.second <= range.first) return true;
  if (t.first >= range.second) return true;
  else return false;
}

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

  int n;
  cin >> n;
  vector<pair<ll, ll>> rx;
  rep(i, n) {
    ll x, l;
    cin >> x >> l;
    rx.push_back({x+l, x});
  }

  sort(ALL(rx));

  int ans = 0;
  pair<ll, ll> range(-INF, -INF);
  for (int i = 0; i < n; i++) {
    auto& p = rx[i];
    ll l = p.second * 2 - p.first;
    if (is_out(range, {l, p.first})) {
      ans++;
      range = {l, p.first};
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5324
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

void solve(){
  int N; cin >> N;
  vector<vector<int>> tree(N);
  vector<vector<ll>> cost(N);
  int a,b;
  ll c;
  rep(i,N-1){
    cin >> a >> b >> c; a--; b--;
    tree[a].pb(b); tree[b].pb(a);
    cost[a].pb(c); cost[b].pb(c);
  }


  int Q, K; cin >> Q >> K;
  K--;
  vector<ll> d(N,-1);
  d[K]=0;
  queue<int> qu;
  qu.push(K);
  while(!qu.empty()){
    int now = qu.front(); qu.pop();
    rep(i,sz(tree[now])){
      if(d[tree[now][i]]!=-1)continue;
      qu.push(tree[now][i]);
      d[tree[now][i]] = d[now]+cost[now][i];
    }
  }
  rep(q,Q){
    int x, y; cin >> x >> y;
    x--;y--;
    cout<<d[x]+d[y]<<'\n';
  }
}

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


Measured memory_bytes: 16660
n,m=map(int,input().split())
A=[list(map(int,input().split()))[1:] for _ in range(m)]
P=list(map(int,input().split()))

ans=0
for i in range(2**n):
    num=format(i,"b").zfill(n)
    point=0
    for j in range(m):
        cnt=0
        for k in A[j]:
            if num[k-1]=="1":cnt +=1
        if cnt%2==P[j]:point +=1
    if point==m:ans +=1
print(ans)

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

/*
,,,,
　　　　　　　　　　　　　　　　　　　　　　　　　　,.斗*''“i:i:{
　　　　　　　　　　　　　,.　｡. . . * : : : ''' : : : :” :”“ ''ｰ - 弋,,_
　　　　　 　 　 ,.斗*''“ : : : : : : : : : : : : : ' ' ' ' ' ' : : : : : : : : : : :”: '':* ｡ ,
　　　 ,.斗*''“ ” ＼：　　 ”・・． ' ' ' '　　　　　　　　 ' ' ' ' : : : : : : : : : : : : ”ミ*｡,,,,,,　　　　　　 　 　 　 ＿
　　く.　 ◎　 ﾞ:.ﾞ:..　ﾟ:,　:　───────────　　　--　　,,,,,,__ ' ' ' :.:.:.:.:.”≧s｡.　　＿,,,｡s*i:i:i:i:<
　　ﾏ*s｡ :,　 }　ﾟ:,　 :}　　　　　　　　　　　　　　　　　　　　　　　　　　　　”　''　-　”””：：”：：`*｡i:i:i:i:i:i:i;:’
　　　` .｡`　 ,　,ノ ／｡ ,,,_　　　　　　　　　　　　　　　　　　　　　　　　　　　　　＿＿`　　} }　　ﾉi:i:i:i:i:ﾂ
　　　　　 `　*　｡　　`*｡i:i:i::*=-　　　　　　　　　　　＿＿　　　　　　,,,....｡s*'i,:’　　　”`*｡＿,*’i:i:i:i:r’
　　　　　　　　　　　”　─ --　　　　｡｡｡｡｡　　 -　－`''''''''ヽ ─ '''”　　　｀ｰ“　　　　　　　`*｡i:i:i:i:i:i:
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*｡i:i:::
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*ﾟ:,
         fozubaoyou    no BUGs alive!
*/

typedef long long ll;
//{
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define dumo dump
//}

#define debug_interval ','
#define dump_interval endl
#define debug_toggle 0

//{
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();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cout<<endl;}
template<class...A> inline void debug_rest() {cout<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cout<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cout<<first,debug_rest(rest...);}
//}

int n;
ll ans;
array<vector<string>,5 >h;

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    if(s[0]=='M'){
      h[0].push_back(s);
    }
    else if(s[0]=='A'){
      h[1].push_back(s);
    }
    else if(s[0]=='R'){
      h[2].push_back(s);
    }
    else if(s[0]=='C'){
      h[3].push_back(s);
    }
    else if(s[0]=='H'){
      h[4].push_back(s);
    }
  }
  for(int i=0;i<3;i++){
    for(int j=1+i;j<4;j++){
      for(int k=1+j;k<5;k++){
        ans+=h[i].size()*h[j].size()*h[k].size();
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 5748
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
const int INF=100000000;
const int MOD=1000000007;
 
int main()
{
 int a,b,ans;
 cin >> a >> b;
 ans=(b+a-3)/(a-1);    
 cout << ans;
 return 0;
}


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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    string s;
    int k;
    cin >> s >> k;

    rep (i, s.size())
    {
        if (s[i] != 'a' && k >= 'z' + 1 - s[i])
        {
            k -= 'z' + 1 - s[i];
            s[i] = 'a';
        }
    }
    if (k > 0)
    {
        s[s.size() - 1] += k % 26;
    }
    cout << s << "\n";
    return 0;
}



Measured memory_bytes: 592
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
const int N = 1e6;
const int inf = 0x3f3f3f3f;
vector<ll>v;
int a[105];
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int n,m,ans=0;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		ans+=a[i];
	}
	sort(a,a+n,cmp);
	if(a[m-1]*4*m>=ans)cout<<"Yes";
	else cout<<"No";
	return 0;
	return 0;
}

Measured memory_bytes: 256
program main
  integer flag, n, y
  flag = 0
  read *, n, y
  do i=0, n
     do j=0, n
        if(i+j<=n .and. (1000*i + 5000*j + 10000*(n-i-j)) ==y ) then
           print '(i5 i5 i5)', n-i-j, j, i
           stop
        end if
     end do
  end do
  print '(a)', "-1 -1 -1"
  stop
end program main


Measured memory_bytes: 2844
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, ll> state;
typedef vector<vector<ll>> matrix;

void solve() {
  int x, a;
  cin >> x >> a;
  if(x < a) cout << "0\n";
  else cout << "10\n";
}

void casesolve() {
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  // casesolve();
}


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

//整数i,j,kに対しそれらの最大公約数を返す
int gcd (int &i, int &j, int &k) {
  
  int max_divisor = 1;
  for (int l = 2; l < min (i, min (j, k)) + 1; l++) {
    if ((i % l == 0) && (j % l == 0) && (k % l == 0))
      max_divisor = l;
  }
  return max_divisor;
  
}

int main () {
  int K;
  cin >> K;
  int sum = 0;
   for (int i = 1; i < K+1; i++) {
     for (int j = 1; j < K+1; j++) {
       for (int k = 1; k < K+1; k++)
         sum += gcd (i, j, k);
     }
   }
  cout << sum << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<=n/4;i++)
	{
		if((n-4*i)%7==0)
		{
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
/*
AIZU ONLINE JUDGE ??????
Matrix Vector Multiplication ???????????????
-------------------------------------------------------------------*/

/*????????????????????????????????????*/
#include<iostream>//???????????????<iostream>?????????????????????
using namespace std;


/*??????????????????*/
int main(){

	/*??°?????????????????°?????????*/
	int m,n;
	cin>>n>>m;
	
	int B[100]={};
	int A[100][100]={};
	int C[100]={};//???????????°?????????
	
	
	/*???????????°?????\???*/
	int input=0;
	
	for(int i=0;i<n;i++){
	
		for(int j=0;j<m;j++){
		
			cin>>A[i][j];
		
		}
	
	}
	
	for(int k=0;k<m;k++){
	
		cin>>input;
		B[k]=input;
	
	}
	
	/*?¨???????C?????\???*/
	for(int x=0;x<n;x++){
		
		for(int y=0;y<m;y++){
		
			C[x]+=A[x][y]*B[y];
		
		}
	
	}
	
	
	/*??????*/
	
	for(int z=0;z<n;z++){
	
		cout<<C[z]<<"\n";
	
	}
	
	return 0;//??????

}

Measured memory_bytes: 1208
#include <stdio.h>
#include <iostream>
#include <math.h>

using namespace std;

int main() {
	int n;
	int k[3];
	int MAX,MIN,t1,t2;
	int kari;
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> k[i];
	}
	MAX = max(k[0],k[1]);
	MIN = min(k[0],k[1]);

	while(1) {
		if (MAX % MIN == 0) {
			t1 = MIN;
			break;
		} else {
			kari = MAX % MIN;
			MAX = max(MIN,kari);
			MIN = min(MIN,kari);
		}
	}
	
	if (n == 2) {
		for (int i = t1; i > 0; i--) {
			if (t1 % i == 0) {
				cout << t1/i << endl;
			}
		}
	} else {
		MAX = max(k[2],t1);
		MIN = min(k[2],t1);
		while(1) {
			if (MAX % MIN == 0) {
				t2 = MIN;
				break;
			} else {
				kari = MAX % MIN;
				MAX = max(MIN,kari);
				MIN = min(MIN,kari);
			}
		}
		for (int i = t2; i > 0; i--) {
			if (t2 % i == 0) {
				cout << t2/i << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
char str[N];
int cut1,cut2,n;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>str[i];
	for(int i=1;i<=n;i++)
	{
		if(str[i]=='(')	cut1++;
		if(str[i]==')')
		{
			cut1--;
			if(cut1<0) cut2++,cut1 = 0;
		}
	}
	for(int i=1;i<=cut2;i++)
		cout<<"(";
	for(int i=1;i<=n;i++)
		cout<<str[i];
	for(int i=1;i<=cut1;i++)
		cout<<")";
	cout<<"\n";
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<ll, ll, ll> T;

int H, W, D, Q;
map<int, P> mp;

int main(void){
    
    scanf("%d %d %d", &H, &W, &D);
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            int a; scanf("%d", &a);
            mp[a] = make_pair(i, j);
        }
    }
    
    bitset<90001> used;
    map<int, int> v;
    for(int i = 1; i <= H * W; ++i){
        if(used[i]) continue;
        int sum = 0;
        for(int n = i; n <= H * W; n += D){
            used[n] = true;
            if(n == i) v[n] = sum;
            else sum += abs(mp[n - D].first - mp[n].first) + abs(mp[n - D].second - mp[n].second), v[n] = sum;
        }
    }
     
    scanf("%d", &Q);
    for(int i = 0; i < Q; ++i){
        int L, R; scanf("%d %d", &L, &R);
        if(L == R) printf("0\n");
        else if(L - D <= 0) printf("%d\n", v[R]);
        else printf("%d\n", v[R] - v[L]);
    }
    
    return 0;
}


Measured memory_bytes: 11008
import java.io.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int n = sc.nextInt();
        sc.nextLine();
        String s = sc.next();

        int max = 0;
        int x = 0;
        for (int i = 0; i < n; ++i) {
            char ch = s.charAt(i);
            if (ch == 'I') {
                ++x;
            } else if (ch == 'D') {
                --x;
            }
            if (x > max) {
                max = x;
            }
        }
        _out.println(max);
    }
    private long C(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        for (long i = r; i > 1; --i) {
            res /= i;
        }
        return res;
    }
    private long P(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

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

int main()
{
    int n, one=0;
    cin >> n;
    n = n % 10; 
    if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
        cout << "hon" << endl;
    else if (n == 0 || n == 1 || n == 6 || n == 8)
        cout << "pon" << endl;
    else
        cout << "bon" << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpii vector<pii>
#define vpiii vector<piii>
#define vpll vector<pll>
#define vplll vector<plll>
#define mod 1000000007

int modInverse(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) 
      return 0; 
    while (a > 1) 
    { 
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
    return x; 
} 


int main() {
   string s,u;
   cin>>s>>u;
   vector<ll> l[28];
   
   for(int i=0;i<s.length();i++)
   {
   		l[s[i]-'a'].push_back(i+1);
   }
   ll r=-1;
   ll ans=0;
   ll cnt=0;
   for(int i=0;i<u.length();i++)
   {

   		ll z=l[u[i]-'a'].size();
   		if(z==0)
   		{	ans=mod;
   			break;
   		}
   		ll v=upper_bound(l[u[i]-'a'].begin(),l[u[i]-'a'].end(),r)-l[u[i]-'a'].begin();
   		if(v==l[u[i]-'a'].size())
   		{
   			r=l[u[i]-'a'][0];
   			cnt++;
   		}
   		else
   		{
   			r=l[u[i]-'a'][v];
   			
   		}
   		
   }

   if(ans==mod)
   	ans=-1;
   else{
   ans=cnt*s.length();
   
   ans+=r;
}
   
   cout<<ans;
}


Measured memory_bytes: 1724
#include<cstdio>
#include<algorithm>
#include<vector>
#define ll long long
#define mod 998244353
using namespace std;
ll Comb[4010][4010];
ll mypow[4010];
ll reH(ll x, ll y) {
	if (y < 0)return 0;
	return Comb[x + y - 1][y];
}
ll sum(ll x, ll y) {
	return (x + y) % mod;
}
int main() {
	mypow[0] = 1;
	Comb[0][0] = 1;
	for (int i = 1; i <= 4000; i++)
		mypow[i] = (mypow[i - 1] * 2) % mod;
	for (int i = 0; i <= 4000; i++) {
		Comb[i][0] = 1;
		Comb[i][i] = 1;
		for (int y = 1; y < i; y++)
			Comb[i][y] = (Comb[i - 1][y] + Comb[i - 1][y - 1]) % mod;
	}
	ll n, m;
	scanf("%lld %lld", &m, &n);
	for (int i = 2; i <= 2 * m; i++) {
		ll xx = 0;
		ll dap = 0;
		for (int y = 1; y <= (i - 1) / 2; y++) {
			if (i - y <= m)xx++;
		}
		ll yy = m - (xx * 2);
		if (i % 2 == 0)
			yy--;
		dap = reH(yy, n);
		for (int y = 1; y <= xx; y++) {
			dap = (((reH(yy + y, n - y)*Comb[xx][y]) % mod)*mypow[y]) % mod + dap;
			dap %= mod;
		}
		if (i % 2 == 0) {
			dap += reH(yy, n - 1);
			dap %= mod;
			for (int y = 1; y <= xx; y++) {
				dap = (((reH(yy + y, n - y - 1)*Comb[xx][y]) % mod)*mypow[y]) % mod + dap;
				dap %= mod;
			}
		}
		printf("%lld\n", dap);
	}
}

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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

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

const ll SIZE = 1e5+10;

ll n, m;

int main(){
    cin >> n >> m;
    ll ans = (n*(n-1))/2 + (m*(m-1))/2;
    cout << ans << endl;
}

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

#define vi vector<int>

int main() {

    int N;
    cin >> N;
    string S;
    cin >> S;

    if (N%2 == 1) {
        cout << "No" << endl;
        return 0;
    }

    for (int i = 0; i < N/2; i++) {
        if (S[i] != S[i+N/2]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(n) for (int i = 0; i < int(n); i++)
#define FOR1(m, n) for (int i = int(m); i < int(n); i++)
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))

int main(int argc, char *argv[]) {
  int N, M, Q;
  cin >> N >> M >> Q;

  vector<int> vs[501];

  FOR(M) {
    int L, R;
    cin >> L >> R;
    vs[L].push_back(R);
  }

  FOR(N + 1) { sort(begin(vs[i]), end(vs[i])); }

  while (Q--) {
    int p, q;
    cin >> p >> q;

    int count = 0;
    FOR1(p, q + 1) {
      count += upper_bound(begin(vs[i]), end(vs[i]), q) - begin(vs[i]);
    }

    cout << count << "\n";
  }

  return 0;
}


Measured memory_bytes: 2176
def main():
    from collections import namedtuple
    from itertools import product
    from operator import mul
    import sys
    input = sys.stdin.readline

    Cake = namedtuple('Cake', 'x y z')

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

    cakes = [Cake(*map(int, input().split())) for _ in range(N)]

    ans = 0
    for signs in product([-1, 1], repeat=3):
        e = []
        for c in cakes:
            e.append(sum(map(mul, c, signs)))
        e.sort(reverse=True)
        ans = max(ans, sum(e[:M]))

    print(ans)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 1,0 },{ 0,1 }
};


template<int MOD>
struct ModInt {
	static const int Mod = MOD;
	unsigned x;
	ModInt() : x(0) {}
	ModInt(signed sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	ModInt(signed long long sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	int get() const { return (int) x; }

	ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
	ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }

	ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
	ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
	ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
	ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }

	ModInt inverse() const {
		signed a = x, b = MOD, u = 1, v = 0;
		while (b) {
			signed t = a / b;
			a -= t * b; std::swap(a, b);
			u -= t * v; std::swap(u, v);
		}
		if (u < 0) u += Mod;
		ModInt res; res.x = (unsigned) u;
		return res;
	}
};
typedef ModInt<1000000007> mint;

ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%mod;
		x = x*x%mod;
		n >>= 1;
	}
	return res;
}

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

	char str [5001];

	scnaf("%s", str);
	int len = strlen(str);

	mint dp[5001][5001] = {};
	dp[0][0] = 1;

	REP(i, n) {
		dp[i + 1][0] += dp[i][0];
		dp[i + 1][1] += (dp[i][0] * 2);
		rep(j, 1, n) {
			dp[i + 1][j - 1] += dp[i][j];
			dp[i + 1][j + 1] +=dp[i][j]*2;
		}
	}

	printf("%d\n", dp[n][len] / (mint)mod_pow(2, len, MODU));

	return 0;
}

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

signed main(){
	int n;
	cin>>n;
	int a[n];
	r(i,n)cin>>a[i];

	int sum=0,MAX=0;

	r(i,n-1){
		if(a[i]>=a[i+1])sum++;
		else sum=0;
		MAX=max(MAX,sum);
	}
	cout<<max(MAX,sum)<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
        int N;
        int a[100];
        int max_num,min_num;
        cin >> N;
        for (size_t i = 0; i < N; i++) {
                cin >> a[i];
        }
        max_num = a[0]; min_num = a[0];
        for (size_t i = 1; i < N; i++) {
                max_num = max(max_num,a[i]);
                min_num = min(min_num,a[i]);
        }
        cout << max_num - min_num << endl;

        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
int main()
{
  int n;
  cin >> n;
  vector<ll> l(n);
  for(int i=0;i<n;i++) cin >> l[i];

  sort(l.begin(),l.end(),greater<ll>());

  ll cnt = 0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        if(l[i] != l[j] && l[i] != l[k] && l[j] != l[k]){
          if(l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[k] + l[i] > l[j]){
            cnt++;
          }
        }
      }
    }
  }

  cout << cnt << endl;
}


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

using namespace std;

int main(){
  int m1, m2;
  int d1, d2;
  cin >> m1 >> d1;
  cin.ignore();
  cin >> m2 >> d2;
  cin.ignore();

  if((m2 == 1) && (m1 == 12)){
    cout << 1 << endl;
    return 0;
  } else if(m2 == m1 + 1){
    cout << 1 << endl;
    return 0;
  }
  cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
n=*0...gets.to_i
g=$<.map{|l|l.split.map &:to_i}.sort
r=n.-g.map{|v|v[1,2]}.reduce:+
x,y,*z=[],[]
w=->f,i{i<0&&next
x<<i
f[f,g[i][1]]
y<<i
f[f,g[i][2]]
z<<i}
w[w,r[0]]
s=" "
puts :Preorder,s+x*s,:Inorder,s+y*s,:Postorder,s+z*s

Measured memory_bytes: 6116
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int n,m,i,p,q;
  string s,t;
  
  cin >> n >> s >> t;
  
  p=n*2;  
  string x(p,'q');

  
  
  
  m=0;
    
  for (i=0; i<n; i++){
    x.at(m)=s.at(i);
    m=m+1;
    x.at(m)=t.at(i);
    m=m+1;
  }
      
  cout << x << endl;
}
  
  

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

using namespace std;

typedef long long int ll;
const int MAXN = 100005;

int n;
ll ans;
ll a[MAXN], B[MAXN];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n + 1; ++i) 
	{
        scanf("%lld", &a[i]);
    }
    for (int i = 1; i < n + 1; ++i)
	{
        scanf("%lld", &B[i]);
        if (B[i] <= a[i])
            ans += B[i];
        else if (B[i] <= a[i] + a[i + 1]) 
		{
            ans += B[i];
            a[i + 1] -= (B[i] - a[i]);
        }
        else 
		{
            ans += (a[i] + a[i + 1]);
            a[i + 1] = 0;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

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

	string S;
	cin >> S;
	string T;
	cin >> T;

	int cnt = 0;
	rep(i, 3) {
		if (S[i] == T[i]) ++cnt;
	}

	std::cout << cnt << std::endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int spotCnt = sc.nextInt();
        int spots[] = new int[spotCnt];
        for (int i = 0; i < spotCnt; i++) {
            spots[i] = sc.nextInt();
        }
        int sum = Math.abs(spots[0]);
        for (int i = 0; i < spotCnt; i++) {
            if (i == spotCnt - 1) {
                sum += Math.abs(spots[i]);
            } else {
                sum += Math.abs(spots[i + 1] - spots[i]);
            }
        }

        for (int skipSpot = 0; skipSpot < spotCnt; skipSpot++) {
            int d = 0;
            if (skipSpot == spotCnt - 1) {
                d = Math.abs(spots[skipSpot]) + Math.abs(spots[skipSpot] - spots[skipSpot - 1])
                    - Math.abs(spots[skipSpot - 1]);
            } else if (skipSpot == 0) {
                d = Math.abs(spots[skipSpot]) + Math.abs(spots[skipSpot + 1] - spots[skipSpot])
                    - Math.abs(spots[skipSpot + 1]);
            } else {
                d = Math.abs(spots[skipSpot + 1] - spots[skipSpot]) + Math.abs(spots[skipSpot] - spots[skipSpot - 1])
                    - Math.abs(spots[skipSpot + 1] - spots[skipSpot - 1]);
            }
            System.out.println(sum - d);
        }
    }
}

Measured memory_bytes: 64436
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
using namespace std;

int main(){
	int a,b;cin>>a>>b;
	double c=2*b-a;
	cout<<c<<endl;
}


Measured memory_bytes: 256
n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))

S.append(-1)
sum = 0
for i in T:
    count = 0
    while True:
        if i != S[count]:
            count += 1
        else:
            sum += 1
            break
        if S[count] == -1:
            break
print(sum)

Measured memory_bytes: 8520
#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 UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define DEBUG(a)    cerr << #a << " = " << a << endl

const int inf = 1001001001;
const int mod = (int)1e9+7;
//const ll inf = 1e15;
//const ll mod = 1e9+7;

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

const double PI = acos(-1);

int main() {
    int N, M;
    cin >> N >> M;
    int con = 0;
    if (N > 1) con += N*(N-1)/2;
    if (M > 1) con += M*(M-1)/2;
    cout << con << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
  
  int n; cin>>n;
  vector<int> a(n);
  for(auto &i:a) cin>>i;
  sort(a.rbegin(),a.rend());
  ll ans{};
  for(int i=0; i<n/2; i++){
    ans += a.at(i);
  }
  ans *= 2;
  ans -= a.front();
  if(n%2==1) ans += a.at(n/2);
  cout<<ans << endl;
}


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

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

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

int A,B,m;
string s;
int x,y,c;

void solve(){
  cin >> A >> B >> m;
  vector<int>a(A);
  vector<int>b(B);
  for(int i=0;i<A;i++)cin >> a[i];
  for(int i=0;i<B;i++)cin >> b[i];
  int ans= *min_element(a.begin(),a.end())+ *min_element(b.begin(),b.end());
  for(int i=0;i<m;i++){
    cin >> x >> y >> c;
    x--;y--;
    ans=min(ans,a[x]+b[y]-c);
  }
  cout << ans << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
template<class T> inline void chmin(T& a, T b) {if (a>b) a=b; }
template<class T> inline void chmax(T& a, T b) {if (a<b) a=b; }
inline void print() { cout << endl; }
template <class Head, class... Tail> inline void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...);}
template <class T> inline void print(vector<T>& vec) { for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " "; } cout << endl;}
template <class T> inline void print(vector<vector<T>>& df) { for (auto& vec : df) { print(vec); }}
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;


int main() { 
    int N, M; cin >> N >> M;
    vector<vector<int>> vals(N);
    vector<int> P, Y;
    REP(i, M) {
        int p, y; cin >> p >> y; --p;
        P.push_back(p); Y.push_back(y);
        vals[p].push_back(y);
    }

    REP(i, N) {
        sort(vals[i].begin(), vals[i].end());
    }

    REP(i, M) {
        int p = P[i];
        printf("%06d", p+1);
        int id = lower_bound(vals[p].begin(), vals[p].end(), Y[i]) - vals[p].begin();
        printf("%06d\n", id+1);
    }


    // print(table);

    return 0;
}

Measured memory_bytes: 7792
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

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

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

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

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	for(int n; cin >> n && n;) {
		vector<int> arr(n);
		vector<int> cur(n);
		rep(i,n) cin >> arr[i];
		if(arr[0] > 0) cur[0] = arr[0];
		for(int i = 1; i < n; i++)
			cur[i] = max(arr[i], cur[i - 1] + arr[i]);
		int vmax = *max_element(all(cur));
		cout << (vmax == 0 ? *max_element(all(arr)) : vmax) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >> s;
    int len = s.length();
    for (int i = 1; i < len; i++) {
        int leng = len - i;
        if (leng % 2 == 1) continue;
        string t, u;
        t = s.substr(0, leng / 2);
        u = s.substr(leng / 2, leng / 2);
        if (t == u) {
            cout << leng << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
aas = {'a':'b','b':'c','c':'d','d':'e','e':'f','f':'g','g':'h','h':'i','i':'j','j':'k','k':'l','l':'m','m':'n','n':'o','o':'p','p':'q','q':'r','r':'s','s':'t','t':'u','u':'v','v':'w','w':'x','x':'y','y':'z'}
print(aas[input()])

Measured memory_bytes: 9040
#include<iostream>
#include<vector>
#include<string>
#include<sstream>
int main()
{
	std::vector<int>this_month(1000, 0);
	for (std::string str; std::getline(std::cin, str) && str.length() > 0;)
	{
		std::string num;
		std::getline(std::stringstream(str), num, ',');
		this_month[std::stoi(num) - 1]++;
	}
	std::vector<int>last_month(1000, 0);
	for (std::string str; std::getline(std::cin, str);)
	{
		std::string num;
		std::getline(std::stringstream(str), num, ',');
		last_month[std::stoi(num) - 1]++;
	}
	for (int i = 0; i < 1000; i++)
	{
		if (this_month[i] * last_month[i] != 0)
		{
			std::cout << i + 1 << ' ' << this_month[i] + last_month[i] << std::endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3172
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int X = (A); X <= (Y);++X)
#define _rep2(X, Y) for (int X = 0; X < (Y); ++X)
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X, Y) for (int X = (Y-1); X >= 0; --X)
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%(m))
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int N, M;

int main() {

    cin >> N >> M;

    if (M % 2 == 0) {
        rep(i, M / 2) {
            cout << i + 1 << ' ' << M + 1 - i << endl;
        }
        rep(i, M / 2) {
            cout << M + 2 + i << ' ' << 2 * M + 1 - i << endl;
        }
    } else {
        rep(i, M / 2) {
            cout << 1 + i << ' ' << M - i << endl;
        }
        rep(i, (M + 1) / 2) {
            cout << M + 1 + i << ' ' << 2 * M + 1 - i << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3600
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;

int w,h;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(void){
	while(1){
		scanf("%d %d",&w,&h);
		if(w+h==0)break;
		int x=1,y=1,dir=0;
		while(1){
			string str;
			cin >> str;
			if(str=="STOP")break;
			if(str=="LEFT"){
				dir=(dir+3)%4;
			}
			if(str=="RIGHT"){
				dir=(dir+1)%4;	
			}
			if(str=="FORWARD"){
				int d;
				scanf("%d",&d);

				while(d>0){
					int nx=x+dx[dir],ny=y+dy[dir];
					if(nx>=1 && nx<=w && ny>=1 && ny<=h){
						x=nx;
						y=ny;
					}
					d--;
				}
			}
			if(str=="BACKWARD"){
				int d;
				scanf("%d",&d);
				while(d>0){
					int nx=x+dx[(dir+2)%4],ny=y+dy[(dir+2)%4];
					if(nx>=1 && nx<=w && ny>=1 && ny<=h){
						x=nx;
						y=ny;
					}
					d--;
				}
			}
		}
		printf("%d %d\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 1252
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    int ans=0,bns=0,cns=0,dns=0;
    string s;
    cin>>s;
    for(int i=0;i<1000;i++)
    {
        if(s[i]=='W')ans++;
        if(s[i]=='E')bns++;
        if(s[i]=='N')cns++;
        if(s[i]=='S')dns++;
    }
    if((ans!=0&&bns!=0||ans==0&&bns==0)&&(cns!=0&&dns!=0||cns==0&&dns==0))printf("Yes\n");
        else printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int i,k=0;
	for (i=a;i<=b;i++)
	{
		if (i%c==0) k++;
	} 
	printf("%d\n",k);
	return 0;
}

Measured memory_bytes: 1708