akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#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()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
ll powMod(ll x, ll k, ll m) {//x^k (mod n)
	if (k == 0)     return 1;
	if (k % 2 == 0) return powMod(x*x % m, k/2, m);
	else            return x*powMod(x, k-1, m) % m;
}
int N,K;
vi PP;

int invmap[114514];
map<int,int> mm;
vi datas;
int main(){
	int a;
	cin>>a;
	N=(1<<a);
	rep(i,N){
		int x;
		cin>>x;
		mm[x]++;
	}

	vi cnt(mm.size());
	for (auto x: mm){
        datas.push_back(x.second);
	}
	reverse(all(datas));
	cnt[0]++;
	rep(i,a){
        int pos=0, sum=0;
        while (pos < datas.size()){
            int z = cnt[pos];
            cnt[pos] = min(datas[pos], cnt[pos] + sum);
            sum -= cnt[pos]-z;
            sum += z;
            pos++;
        }
        if(sum > 0){
			cout << "No" << endl;
			return 0;
        }
 
	}
	cout << "Yes" << endl;

}




Measured memory_bytes: 14716
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String a = s.next();
		String b = s.next();
		String c = s.next();
		String b1=b.charAt(0)+"";
		String c1=c.charAt(0)+"";

		if(a.endsWith(b1)&&b.endsWith(c1)) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}

	}

}

Measured memory_bytes: 23252
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

const int N_MAX = 101;
string NAME[N_MAX];
map <string, int> INDEX;
int LC[N_MAX];
int BX1[N_MAX][N_MAX];
int BY1[N_MAX][N_MAX];
int BX2[N_MAX][N_MAX];
int BY2[N_MAX][N_MAX];
string LINK[N_MAX][N_MAX];
int BF[1000000];

bool hitcheck( int cur, int link, int x, int y ) {
    return BX1[cur][link] <= x && x <= BX2[cur][link] && BY1[cur][link] <= y && y <= BY2[cur][link];
}

int main() {
    int n;
    while ( cin >> n && n ) {
        int bw, bh;
        cin >> bw >> bh;
        for ( int i = 0; i < n; ++ i ) {
            cin >> NAME[i] >> LC[i];
            INDEX[NAME[i]] = i;
            for ( int j = 0; j < LC[i]; ++ j ) {
                cin >> BX1[i][j] >> BY1[i][j] >> BX2[i][j] >> BY2[i][j] >> LINK[i][j];
            }
        }
        int k;
        cin >> k;
        int cur = 0;
        int most = 0;
        BF[0] = 0;
        for ( int i = 0; i < k; ++ i ) {
            string cmd;
            cin >> cmd;
            if ( cmd == "click" ) {
                int cur_index = BF[cur];
                int mx, my;
                cin >> mx >> my;
                for ( int j = 0; j < LC[cur_index]; ++ j ) {
                    if ( hitcheck( cur_index, j, mx, my ) ) {
                        BF[cur+1] = INDEX[LINK[cur_index][j]];
                        cur += 1;
                        most = cur;
                        break;
                    }
                }
            } else if ( cmd == "show" ) {
                cout << NAME[BF[cur]] << endl;
            } else if ( cmd == "back" ) {
                if ( cur - 1 >= 0 ) {
                    cur -= 1;
                }
            } else if ( cmd == "forward" ) {
                if ( cur + 1 <= most ) {
                    cur += 1;
                }
            }
        }
    }
	return 0;
}

Measured memory_bytes: 0
n = int(input())
a = list(map(float,input().split()))
dp = [[0 for _ in range(n+1)]for _ in range(n+1)]
dp[0][0]=1
for i in range(n):
    for j in range(n):
        dp[i+1][j+1]+=dp[i][j]*a[i]
        dp[i+1][j]+=dp[i][j]*(1-a[i])
print(sum(dp[n][n//2+1:]))

Measured memory_bytes: 257544
n, m = map(int, input().split())

lefts = list()
rights = list()
for i in range(m):
    left, right = map(int, input().split())
    lefts.append(left)
    rights.append(right)

ans = min(rights) - max(lefts) + 1
if ans >= 0:
    print(ans)
else:
    print(0)
    

Measured memory_bytes: 10996
using System;
using System.IO;
using System.Text;

namespace Contest
{
    class Program
    {
        private Scanner sc;
        private string S, T;
        public void Solve()
        {
            sc = new Scanner();
            int N = sc.NextInt();
            long pow = 1;
            for (int i = 1; i <=N ; i++)
            {
                pow *= i;
                pow %= 1000000007;
            }
            Console.WriteLine(pow);
        }

        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }
    private readonly char _separator;
    private readonly StreamReader _stream;
    private int _pos;
    private string[] _line;
    #region get a element
    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }
        return _line[_pos++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    #endregion
    #region convert array
    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }
    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }
    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }
    #endregion
    #region get array
    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);
        _pos = _line.Length;
        return _line;
    }
    public int[] IntArray()
    {
        return ToIntArray(Array());
    }
    public long[] LongArray()
    {
        return ToLongArray(Array());
    }
    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }
    #endregion
}

Measured memory_bytes: 11092
//Be Name Khorgraph, Besmellah Rahmane Rahim, In The Name Of God;
//#include<bits/stweight++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>
#include <stdio.h>
#include <string.h>
#include<iomanip>
#include<unordered_map>
#include<unordered_set>


using namespace std;
 
const long long N = 2e5 + 5;
long long n, q;
const long long inf = 1e18;
 
vector <long long> stk;
long long t[N];
long long cnt[N];
 
int main() 
{
	cin >> n >> q;
	stk.push_back(n);
	for (long long i = 1; i <= q; i++) 
	{
		long long tmp;
		cin >> tmp;
		while (stk.size() && stk.back() >= tmp) 
		{
			stk.pop_back();
		}
		stk.push_back(tmp);
	}
	stk.push_back(inf);
	t[stk.size() - 2]++;
	for (long long i = stk.size() - 2; i > 0; i--) 
	{
		long long x = stk[i];
		while (x > stk[0]) 
		{
			long long k = lower_bound(stk.begin(), stk.end(), x) - stk.begin() - 1;
			t[k] += (x / stk[k]) * t[i];
			x %= stk[k];
		}
		cnt[x] += t[i];
	} 
	cnt[stk[0]] += t[0];
	for (long long i = n; i; i--) 
	{
		cnt[i] += cnt[i + 1];
	}
	for (long long i = 1; i <= n; i++) 
	{
		cout << cnt[i] << endl;
	}
}



Measured memory_bytes: 4212
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	string s;
	cin>>s;
	int ans=0;
	rep(i,6)ans+=(s[i]-'0');
	cout<<ans<<endl;
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
#define ll long long
ll mod = 1000000000+7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    cout.tie(NULL);
    ll T;
    T=1;
    //cin>>T;
    start:
    while(T--)
    {
        ll n;
        cin>>n;
        ll a[n];
        
        for(int i=0;i<n;i++){cin>>a[i];}
        if(n==1)
        {
            return 0;
        }
        sort(a,a+n,greater<ll>());
        ll pr = 2;
        ll sum = a[0];
        for(int i=1;i<n;i++)
        {
            if(pr==n){break;}
            sum += a[i];
            pr++;
            if(pr==n){break;}
            sum += a[i];
            pr++;
        }
        cout<<sum<<endl;
        
    }
    return 0;
}



Measured memory_bytes: 5212
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int[] mem;
		int MAX = 1000;
		int VAL = 4000;
		Scanner sc = new Scanner(System.in);
		mem = new int[VAL+1];
		for(int i=0;i<=MAX;i++) for(int j=0;j<=MAX;j++) {
			if( i+j <= VAL )mem[i+j]++;
		}
		for(;sc.hasNext();) {
			int n = sc.nextInt();
			int cnt = 0;
			for(int i=0;i<=VAL;i++) for(int j=0;j<=VAL;j++) {
				if(i==n-j) cnt += mem[i] * mem[j];
			}
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 19548
s = list(input())

t = []

i = 0
while i < len(s) - 1:
    if s[i] == 'A':
        t.append('A')
        i += 1
    elif s[i] == 'B':
        if s[i+1] == 'C':
            t.append('D')
            i += 2
        else:
            t.append('B')
            i += 1
    else:
        t.append('C')
        i += 1

mode = 0
ans = 0
count = 0

for x in t:
    if mode == 0:
        if x == 'A':
            count = 1
            mode = 1
    else:
        if x == 'A':
            count += 1
        elif x == 'D':
            ans += count
        else:
            mode = 0

print(ans)

Measured memory_bytes: 6436
#include<iostream>
#include<string.h>
using namespace std;

int main(){
	char c[200001];
	int x[200001];
	cin>>c;
	int length=strlen(c);
		for(int i=0;i<length;i++){
			if(!x[i]&&c[i]=='S'){
				for(int y=i+1;y<length;y++){
					if(!x[y]&&c[y]!='T'){
						break;
					}else if(!x[y]&&c[i]=='S'&&c[y]=='T'){
							x[i]=1;x[y]=1; 
							
							for(int n=1,m=1;n<=i&&y+m<length;){
								while(n<=i&&x[i-n]){if(x[i-n])n++;
								}
								while(y+m<length&&x[y+m])if(x[y+m])m++;
								if(!x[i-n]&&!x[y+m]&&c[i-n]=='S'&&c[y+m]=='T'){
									x[i-n]=1;x[y+m]=1;
								}else
								{
									break;
								}
							}
							break;
					}
				}
			}
		}
	int ans=0;
	for(int i=0;i<length;i++){
		if(!x[i]){
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1280
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};




ll h,w;
char s[30][30];
ll d[50][50];
ll sx,sy,gx,gy;


int bfs(){
    queue<pll> que;
    for(int i =0;i<h;i++){
        for(int j=0;j<w;j++){
            d[i][j] = INF;
        }
    }
    que.push(pll(sx,sy));
    d[sx][sy] = 0;
 
    while(que.size()){
        pll p = que.front();
        que.pop();
        if(p.first == gx && p.second == gy) break;
        for(int i=0;i<4;i++){
            int nx = p.first + dx[i] , ny = p.second + dy[i];
            if( nx>=0 && nx <h && ny >=0 && ny < w && s[nx][ny] != '#' && d[nx][ny] == INF ){
                que.push(pll(nx,ny));
                d[nx][ny] = d[p.first][p.second] +1;
            }
        }
    }
    return d[gx][gy];
}



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;


    
    cin>>h>>w;
    
    rep(i,h){
        rep(j,w){
            cin>>s[i][j];
        }
    }
    ll ans=0;
    rep(i,h){
        rep(j,w){
            if(s[i][j]=='#') continue;
            rep(k,h){
                rep(l,w){
                    if(s[k][l]=='#') continue;
                    sx=i,sy=j,gx=k,gy=l;
                    chmax(ans,bfs());
                    // cout<<bfs()<<endl;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

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

  std::string s;
  std::cin >> s;
  std::string::iterator it;

  bool was_found = false;
  ll a, b;
  for (it = s.begin(); it != s.end(); it++) {
    if (!was_found && *it == 'A') {
      was_found = true;
      a = it - s.begin();
    }
    if (*it == 'Z') {
      b = it - s.begin(); 
    }
  }

  ll ans = b - a + 1;
  std::cout << ans << std::endl;

  return 0;
}


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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

int main() {
  vector<ll> a(3);
  REP(i, 3) { cin >> a[i]; };

  sort(all(a));

  cout << fabs(a[0] - a[1]) + fabs(a[1] - a[2]) << endl;
}

Measured memory_bytes: 3736
#include<stdio.h>
int main(){
	int x;
	int A;
	int B;
	int result1;
	int result2;
	scanf("%d %d %d", &x, &A, &B);
	if(x < A){
		result1 = A - x;
	}else{
		result1 = x - A;
	}
	if(x < B){
		result2 = B - x;
	}else{
		result2 = x - B;
	}


	if(result1 < result2){
		printf("A");
	}else{
		printf("B");
	}
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MAX=100005;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin>>a>>b;
    ll ans=0;
    if(a>=13){
        ans = b;
    }else if(a>=6){
        ans = b/2;
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
k = int(input())
a, b = map(int,input().split())
c = b//k
ans=0
 
for i in range(c+1):
    i += 1
    ans = i*k
    if a<= ans <=b:
        print("OK")
        break
    else:
        ans = -1
 
if ans == -1:
    print("NG")

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

int main(){
    int a;
    double b;
    cin >> a >> b;
    double c = b*10.0;
    for(double i=0; i<10; i++){
        if(floor((c+i)*0.08) == a){
            cout << floor(c+i) << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> b[i];

    ll ret = 0;
    while(1) {
        bool update = false;
        REP(i, n) {
            ll pre = b[(i-1+n)%n], nxt = b[(i+1)%n];
            ll cnt = (b[i] - a[i]) / (pre + nxt);
            if(pre < b[i] && b[i] > nxt && cnt > 0) {
                update = true;
                b[i] -= cnt * (pre + nxt);
                ret += cnt;
                // cout << b << " " << ret << endl;
            }
        }
        if(!update) break;
    }

    REP(i, n) if(a[i]!=b[i]) { cout << -1 << endl; return 0; }
    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int INF = 100000000;
/* ちゃんと考えてわかって実装 */

vector<string> s;
int h, w;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int d[25][25];


int bfs(P st){

    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            d[i][j] = INF;
        }
    }

    int res = 0;
    queue<P> que;
    que.push(st);
    d[st.first][st.second] = 0;
    while(!que.empty()){
        P now = que.front(); que.pop();
        for(int i=0; i<4; i++){
            int nx = now.first + dx[i];
            int ny = now.second + dy[i];
            // 「次の状態」が条件を満たしていて、未訪問なら候補に追加
            if(0<=nx && nx<h && 0<=ny && ny<w && s[nx][ny] == '.' && d[nx][ny] == INF){
                que.push(make_pair(nx, ny));
                d[nx][ny] = d[now.first][now.second] + 1;
                res = max(res, d[nx][ny]);
            }
        }
    }
    return res;
}

int main(void){
    
    cin >> h >> w;
    s.resize(h);
    for(int i=0; i<h; i++){
        cin >> s[i];
    }

    int ans = 0;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(s[i][j] == '.') ans = max(ans, bfs(P(i, j)));
        }
    }

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	int N;
	double a[100];
	double ave = 0;
	cin >> N;
	vector<pair<double, int>> P(N);
	for(int i = 0; i < N; i++){
		cin >> a[i];
		ave += a[i];
	}
	ave /= N;
	for(int i = 0; i < N; i++){
		P[i] = make_pair(abs(ave - a[i]), i);
	}
	sort(P.begin(), P.end());
	cout << P[0].second << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )
#define SORT(x) sort(x.begin(), x.end())

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define pb push_back
#define pu push
#define mp make_pair
#define fi first
#define sc second

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

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


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

    int N; cin >> N;
    vi a(N + 2, 0);
    int dist = 0;
    REP(i, 1, N + 1) {
        cin >> a[i];
    }

    rep(i, N + 1) {
        dist += abs(a[i] - a[i + 1]);
    }
    
    rep(i, N) {
        int ans = dist - abs(a[i] - a[i + 1]) - abs(a[i + 1] - a[i + 2]) + abs(a[i] - a[i + 2]);
        COUT(ans);
    }
}

Measured memory_bytes: 1792
from operator import mul
from functools import reduce
import math
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
import itertools
N,M = [int(x) for x in input().split()]
e = {}
for j in range(2,int(math.sqrt(M)) +2):
  cnt=0
  while M%j==0:
    cnt+= 1
    M = M//j
  if cnt!=0:
    e[j]=cnt
if M!=1:
  e[M]=1


ans = 1
for i in e.values():
  ans *=cmb(i+N-1,i)
  ans %=10**9+7
print(ans)


Measured memory_bytes: 3700
n,k=map(int,input().split())

a=[0]+list(map(int,input().split()))

visited=[0]*(n+1)
visited[1]=1

now=1
loop=0
isloop=0
for i in range(k):
  #print(now,visited)
  if visited[a[now]]>0:
    loop=visited[now]-visited[a[now]]+1
    now=a[now]
    isloop=1
    k-=i+1
    break
  
  visited[a[now]]=visited[now]+1
  now=a[now]
  
#print("k=",k)
ans=now
if isloop:
  k%=loop
  #print("k=",k,"now:",now,"loop=",loop)
  for i in range(k):
    now=a[now]
  
print(now)

Measured memory_bytes: 32248
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1]*n
        self.rank = [0]*n

    def find(self, x):
        if self.par[x-1] < 0:
            return x
        else:
            self.par[x-1] = self.find(self.par[x-1])
            return self.par[x-1]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return
        elif self.rank[x-1] > self.rank[y-1]:
            self.par[x-1] += self.par[y-1]
            self.par[y-1] = x
        else:
            self.par[y-1] += self.par[x-1]
            self.par[x-1] = y
            if self.rank[x-1] == self.rank[y-1]:
                self.rank[y-1] += 1

    def same(self, x, y):
        return self.find(x)==self.find(y)

    def count(self, x):
        return -self.par[self.find(x)-1]

from collections import deque

N,M,K=map(int,input().split())
U=UnionFind(N)
q=deque([])
for _ in range(M):
  a,b=map(int,input().split())
  U.union(a,b)
  deque.append(q,(a,b))
G=[set([]) for _ in range(N)]
for _ in range(M):
  a,b=deque.pop(q)
  if U.same(a,b):
    G[a-1].add(b)
    G[b-1].add(a)
for _ in range(K):
  a,b=map(int,input().split())
  if U.same(a,b):
    G[a-1].add(b)
    G[b-1].add(a)
ans=[0]*N
for i in range(1,N+1):
  ans[i-1]=U.count(i)-len(G[i-1])-1
print(*ans)

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = getString(sc);
		String[] arr = s.split("");
		List<String> alphabetList = new ArrayList<>(Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
				"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"));

		for (String str : arr) {
			if (alphabetList.contains(str)) {
				alphabetList.remove(str);
			}
		}

		if (alphabetList.size() == 0) {
			System.out.println("None");
		} else {
			System.out.println(alphabetList.get(0));
		}
	}

	/**
	 * *汎用メソッド<br>
	 * 入力した配列に対する順列を取得
	 *
	 * @param numArray
	 * @return
	 */
	private static List<Integer[]> getPermutation(int[] numArray) {
		List<Integer[]> permutation = new ArrayList<>();
		Integer[] ans = new Integer[numArray.length];
		boolean[] used = new boolean[numArray.length];

		return buildPermutaion(permutation, numArray, ans, used, 0);
	}

	/**
	 * *汎用メソッド(内部)<br>
	 * 入力した配列に対する順列を作成
	 *
	 * @param list
	 * @param numArray
	 * @param ans
	 * @param used
	 * @param depth
	 * @return
	 */
	private static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,
			int depth) {

		// 全部使い切った時=>できた順列を返す
		if (depth == numArray.length) {
			list.add(ans.clone());
			return list;
		}
		// 使い切っていない場合

		for (int i = 0; i < numArray.length; i++) {
			if (used[i]) {
				continue;
			}
			ans[depth] = numArray[i];
			used[i] = true;
			list = buildPermutaion(list, numArray, ans, used, depth + 1);

			used[i] = false;
		}

		return list;
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}

class Status {
	int row = 0;
	int col = 0;
	int candies = 0;

	public Status(int row, int col, int candies) {
		this.row = row;
		this.col = col;
		this.candies = candies;
	}
}


Measured memory_bytes: 32532
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const int INF = 1e9;
const double pi=acos(-1);
using namespace std;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
  int c,a,b;
  cin >> c >> a >> b;
  cout << c*a/2 << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define double long double
#define INF LLONG_MAX/3
#define P pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int a[200010], b[200010];
signed main() {
	int n;
	string s;
	cin >> n >> s;
	rep(i, n) {
		if (s[i] == '#')a[i]++;
		if (i)a[i] += a[i - 1];
	}
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == '.')b[i]++;
		if (i != n - 1)b[i] += b[i + 1];
	}
	int ans = INF;
	ans = min(ans, b[0]);
	ans = min(ans, a[n - 1]);
	rep(i, n - 1) {
		ans = min(ans, a[i] + b[i + 1]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3716
#include <iostream>

using namespace std;

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

	int count = 0;
	for (int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		if (a == b)
			count++;
		else
			count = 0;
		if (count == 3)
			break;
	}

	if (count == 3)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;


	return 0;
}

Measured memory_bytes: 3620
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
int dp[1000000];
int main()
{
	int num;
	scanf("%d", &num);
	string s;
	cin >> s;
	s = "0" + s + "0";
	for (int i = 1; i < s.size() - 1; i++)
	{
		dp[i + 1] = max(dp[i + 1], dp[i]);
		if (s[i - 1] == '1'&&s[i] == '0'&&s[i + 1] == '1')
		{
			int a = i - 1, b = i + 1;
			for (;;)
			{
				if (s[a] == '0')break;
				dp[i + 1] = max(dp[i + 1], dp[a - 1] + (i - a));
				a--;
			}
			for (;;)
			{
				if (s[b] == '0')break;
				dp[b] = max(dp[b], dp[i - 2] + (b - i));
				b++;
			}
		}
	}
	printf("%d\n", dp[s.size() - 1]);
}

Measured memory_bytes: 2840
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

typedef int* vector;

int ans=0;

void make_perm(int n, int size, int* buffer, int* used, vector* Map){
    if (n == size){
        int tmp = 0;
        for(int i = 1; i < size; i++){
            tmp += Map[buffer[i-1]][buffer[i]];
        }
        if(tmp==size-1 && buffer[0] == 0){
            ans++;
        }
    }
    else {
        for (int i = 0; i < size; i++) {
            if (used[i]) continue;
            buffer[n] = i;
            used[i] = 1;
            make_perm(n + 1, size, buffer, used, Map);
            used[i] = 0;
        }
    }
}

int main(void){
    int N, M;
    scanf("%d%d",&N,&M);

    vector* Map;
    NEW(Map,N)
    for(int i=0;i<N;i++){
        NEW(Map[i],N)
        for(int j=0;j<N;j++) Map[i][j]=0;
    }

    for(int i=0;i<M;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        Map[a-1][b-1]=1;
        Map[b-1][a-1]=1;
    }

    int* buffer;
    int* used;
    NEW(buffer,N);
    NEW(used,N);
    for(int i=0;i<N;i++) used[i]=0;

    make_perm(0,N,buffer,used,Map);
    printf("%d\n",ans);

    return 0;
}

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

int dp[30009][4][1009];

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;

    dp[0][0][0] = 1;

    rep(p,N)rep(len,4)rep(c,1000){
      if(dp[p][len][c] != 1)continue;
      int s           = S[p] - '0';
      dp[p+1][len][c] = dp[p][len][c];
      if(len<=2){
        dp[p+1][len+1][c*10+s] = 1;
      }
    }

    int ans = 0;
    rep(i,1000) ans += dp[N][3][i];
    cout << ans << endl;
}

Measured memory_bytes: 473344
import math
[n,d] = [int(i) for i in input().split()]
x = []
tmp = 0
cnt = 0
for i in range(n):
    x.append([int(i) for i in input().split()])
#i = 0 ~ n-1
for i in range(n):
    #j = i ~ n-1
    for j in range(i+1,n):
        for k in range(d):
            tmp += (x[i][k]-x[j][k])**2
        tmp = math.sqrt(tmp)
        if tmp - math.floor(tmp) == 0:
            cnt += 1
        tmp = 0
print(cnt)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;



int main(){
    int p = 2019;
    string s;
    cin >> s;
    int n = s.size();
    ll ans = 0;
    if (p != 5 && p != 2){
        ll a[p] = {};
        a[0] = 1;
        ll tmp = 0, d = 1;
        rrep(i, n){
            tmp = (tmp + d * (s[i] - '0')) % p;
            ans += a[tmp];
            a[tmp]++;
            d *= 10;
            d %= p;
        }
        cout << ans << endl;
    }
    else {
        rrep(i, n) {
            if ((s[i] - '0') % p == 0) ans += (i + 1);
        }
        cout << ans << endl;
    }





    return 0;
}

Measured memory_bytes: 3768
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;

int main() {
	vector<string>t;
	int n, l; cin >> n >> l;
	string s;
	for (int i = 0; i < n; i++) {
		cin >> s;
		t.push_back(s);
	}
	sort(t.begin(), t.end());
	for (int i = 0; i < n; i++) {
		cout << t[i];
	}
	cout << endl;
	return 0;
}

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

using namespace std;

int a[1000000];
int ans[1000000] ;
int main()
{
int n,ans1 ;
cin >> n ;
n*=3 ;
for (int i=1;i<=n;i++){
cin >> a[i] ;
ans[i]+=a[i] ;
}
for (int i=4;i<=n;i++){
if (i%3==1)
ans[i]+=max(ans[i-1],ans[i-2]) ;
if (i%3==2)
ans[i]+=max(ans[i-2],ans[i-4]) ;
if (!(i%3))
ans[i]+=max(ans[i-4],ans[i-5]) ;
}
ans1=max(ans[n],ans[n-1]) ;
ans1=max(ans1,ans[n-2]) ;
cout << ans1 ;
}


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

int main() {
  string s;
  cin >> s;
  int n=s.size();
  vector<char> a(n);
  for(int i=0; i<n; i++){
    a[i] = s[i];
  }
  sort(a.begin(),a.end());
  string ans="yes";
  for(int i=0; i<n-1; i++){
    if(a[i] == a[i+1]){
      ans = "no";
    }
  }
  
  cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  double a, b, h, m;
  cin>>a>>b>>h>>m;
  double th = (PI/6.0) * h + (PI/6.0) * (m / 60.0);
  double tm = (PI / 30.0) * m;
  double td = abs(th - tm);
  double ans = sqrt(a * a + b * b - 2 * a * b * cos(td));
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}


Measured memory_bytes: 4196
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
	string a, op, b;
	cin >> a >> op >> b;
	int aa = stoi(a);
	int bb = stoi(b);
	int ans = aa + bb;
	if (op[0] == '-') ans = aa - bb;
	cout << ans << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}


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

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

int  main()
{
	int a ,b,k;
	cin >> a >> b >> k;
	int max = gcd(a, b);
	int i = max;
	int cnt = 0;
	while (i > 0)
	{
		if (a % i == 0 && b % i == 0)
			cnt++;
		if (cnt == k)
			break ;
		i--;
	}
	cout << i << endl;
	return (0);
}

Measured memory_bytes: 256
#include <iostream>
    using namespace std;
    int n,ans,a[100002];
    int main(){
		ios::sync_with_stdio(0);
		cin.tie(0);
    	cin >> n;
    	for(int i=1;i<=n;i++) cin >> a[i];
    	ans=a[0]=a[n+1]=0;
    	for(int i=1;i<=n+1;i++)ans+=abs(a[i]-a[i-1]);
    	for(int i=1;i<=n;i++) cout << ans-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]) << endl;
    	return 0;
    }


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	string ret;
	rep(i,3){
		string s;cin >> s;
		ret += toupper(s[0]);
	}
	cout << ret  << endl;
	
	return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int dp[50][50][50][50],dx[2][4]={{1,0,1,0},{-1,0,0,-1}},dy[2][4]={{0,1,0,1},{0,-1,-1,0}},u[50][50],INF=1<<29;
string s[50];
vector<P> v[26];

int dfs(int x1,int y1,int x2,int y2) {
  if(x1==x2&&y1==y2) return 0;
  if(dp[x1][y1][x2][y2]>=0) return dp[x1][y1][x2][y2];
  dp[x1][y1][x1][y1]=0;
  for(int i=x1;i<=x2;i++) {
    for(int j=y1;j<=y2;j++) {
      if(s[i][j]=='#') continue;
      if(i!=x1&&s[i-1][j]!='#') dp[x1][y1][i][j]=max(dp[x1][y1][i][j],dp[x1][y1][i-1][j]);
      if(j!=y1&&s[i][j-1]!='#') dp[x1][y1][i][j]=max(dp[x1][y1][i][j],dp[x1][y1][i][j-1]);
      if(islower(s[i][j])) {
        int c=s[i][j]-'a';
        for(int l=0; l<v[c].size(); l++) {
          int x=v[c][l].first,y=v[c][l].second;
          if(P(i,j+1)==P(x,y)||P(i+1,j)==P(x,y)) {
            if(i!=x1) dp[x1][y1][x][y]=max(dp[x1][y1][x][y],dp[x1][y1][i-1][j]+1);
            if(j!=y1) dp[x1][y1][x][y]=max(dp[x1][y1][x][y],dp[x1][y1][i][j-1]+1);
            if(i==x1&&j==y1) dp[x1][y1][x][y]=max(dp[x1][y1][x][y],dp[x1][y1][i][j]+1);
          }
          for(int k=0; k<4; k++) {
            int xx1=i+dx[0][k],yy1=j+dy[0][k];
            int xx2=x+dx[1][k],yy2=y+dy[1][k];
            if(xx1>xx2||yy1>yy2) continue;
            if(xx1<x1||xx1>x2||xx2<x1||xx2>x2) continue;
            if(yy1<y1||yy1>y2||yy2<y1||yy2>y2) continue;
            if(s[xx1][yy1]=='#'||s[xx2][yy2]=='#') continue;
            if(i!=x1) dp[x1][y1][x][y]=max(dp[x1][y1][x][y],dp[x1][y1][i-1][j]+dfs(xx1,yy1,xx2,yy2)+1);
            if(j!=y1) dp[x1][y1][x][y]=max(dp[x1][y1][x][y],dp[x1][y1][i][j-1]+dfs(xx1,yy1,xx2,yy2)+1);
            if(i==x1&&j==y1) dp[x1][y1][x][y]=max(dp[x1][y1][x][y],dp[x1][y1][i][j]+dfs(xx1,yy1,xx2,yy2)+1);
          }
        }
      }
    }
  }
  return dp[x1][y1][x2][y2];
}
int main() {
  int n,m;
  while(cin >> n >> m && n) {
    for(int i=0;i<n;i++)for(int j=0;j<m;j++)for(int k=0;k<n;k++)for(int l=0;l<m;l++)dp[i][j][k][l]=-INF;
    for(int i=0;i<26;i++)v[i].clear();
    memset(u,0,sizeof(u));
    u[0][0]=1;
    for(int i=0; i<n; i++) {
      cin >> s[i];
      for(int j=0; j<m; j++) if(isupper(s[i][j])) v[s[i][j]-'A'].push_back(P(i,j));
    }
    int ans=dfs(0,0,n-1,m-1);
    if(ans<0) ans=-1;
    cout << ans << endl;
  }
  return 0;
}


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

using namespace std;

int main() {
  string O, E;
  cin >> O >> E;
  for (int i = 0; i < E.size(); i++) {
    cout << O[i] << E[i];
  }
  if (O.size() - E.size() > 0) {
    cout << O[O.size() - 1];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
/*
	AOJ_0108: Operation of Frequency of Appearance
*/
#include	<iostream>
#include	<cstring>
#include	<queue>

using namespace std;

class Sequence {
private:
	int elements[12];	//数列の要素
	int length;			//数列の長さ
	const int _EMPTY;	//空欄を表す定数
public:
	/*コンストラクタ*/
	Sequence() : _EMPTY(-65536){
		for (int i = 0; i < 12; i++) {
			elements[i] = _EMPTY;
		}
	}
	/*メンバ関数*/
	void Insert(int ln, int *elm) {
		length = ln;
		for (int i = 0; i < ln; i++) {
			elements[i] = elm[i];
		}
	}
	int Operation(void) {
		int Order[12], Result[12], target_number, target_count;

		for (int i = 0; i < length; i++) {
			Order[i] = elements[i];
		}
		for (int i = 0; i < length; i++) {
			queue<int> listChange;
			target_count = 0;
			if (Order[i] == _EMPTY) { continue; }
			target_number = Order[i];
			for (int j = i; j < length; j++) {
				if (Order[j] == _EMPTY) { continue; }
				if (Order[j] == target_number) {
					Order[j] = _EMPTY;
					listChange.push(j);
					target_count++;
				}
			}
			while (!listChange.empty()) {
				Result[listChange.front()] = target_count;
				listChange.pop();
			}
		}
		if (memcmp(Result, elements, sizeof(int) * length) == 0) {
			return 1;
		} else {
			for (int i = 0; i < length; i++) {
				elements[i] = Result[i];
			}
			return -1;
		}
	}
	void ShowSequence() {
		for (int i = 0; i < length; i++) {
			if (i != 0) { cout << ' '; }
			cout << elements[i];
		}
		cout << endl;
	}
};

int main(void) {
	int length, s[12], t;
	
	while (1) {
		Sequence SEQ;
		t = 0;

		cin >> length;
		if (length == 0) { break; }

		for (int i = 0; i < length; i++) {
			cin >> s[i];
		}
		SEQ.Insert(length, s);
		while (SEQ.Operation() == -1) { t++; }
		cout << t << endl;
		SEQ.ShowSequence();
	}

	return 0;
}

Measured memory_bytes: 1208
n=int(input())
li=list(map(int, input().split()))
ans=0
m=0
ans=0
for i in range(n-1):
    if li[i]>=li[i+1]:
        m+=1
    else:
        ans=max(ans,m)
        m=0
ans=max(ans,m)
print(ans)

Measured memory_bytes: 85088