akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template <class S>S sum(vector<S>& a) {return accumulate(all(a), S());}
template <class S>S max(vector<S>& a) {return *max_element(all(a));}
template <class S>S min(vector<S>& a) {return *min_element(all(a));}
ll max(int a, ll b) { return max((ll)a, b); } ll max(ll a, int b) { return max(a, (ll)b); }
ll min(int a, ll b) { return min((ll)a, b); } ll min(ll a, int b) { return min(a, (ll)b); }

void eprint() { cerr << endl; }
template <class First, class... Rest>
void eprint(First& f, Rest&... r) {
  cerr << f << ' ';
  eprint(r...);
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  size_t output_num = v.size();
  bool is_emitted = false;
#ifdef OUTPUT_VECTOR_MAX
  if (OUTPUT_VECTOR_MAX < output_num) {
    output_num = OUTPUT_VECTOR_MAX;
    is_emitted = true;
  }
#endif
  os << "[";
  for (size_t i = 0; i < output_num - 1; i++) os << v[i] << ", ";
  os << v[output_num - 1];
  if (is_emitted) os << ", ...";
  return os << "]";
}

void Main();
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

void Main() {
  string s; cin >> s;
  auto sa = suffix_array(s);
  ll ans = (s.size() * (s.size()+1)) / 2;
  for(auto a: lcp_array(s, sa)){
    ans -= a;
  }
  cout << ans << endl;
}


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

int main(){
  int n,num,ap,bp;
  string str;
  while(1){
    ap =bp =0;
    getline(cin,str);
    if(str[0] == '0') return 0;
    for(int i = 1;i < str.length(); i++){
      if(str[i] == 'A')
	ap++;
      else 
	bp++;
    }
    if(ap > bp)
      ap++;
    else 
      bp++;
    cout << ap << " " << bp <<endl;
  }
  return 0;
}

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

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

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

	// 素数である
	return true;
}

int main() {
	int n;
	int count = 0;
	cin >> n;

	for (int i = n - 1; i > 0; i--) {
		if (i % 2 != 0) {
			if (IsPrime(i) == false) {
				int j = (int)sqrt(i);
				if (pow(j, 2) == i) count--;
				if (j % 2 == 0) j -= 1;
				for (j ; j > 0; j -= 2) {
					if (i % j == 0) {
						count += 2;
					}
				}
			}
			else {
				count += 2;
			}
		}
		else {
			int j = (int)sqrt(i);
			if (pow(j, 2) == i) count--;
			for (j; j > 0; j -= 1) {
				if (i % j == 0) {
					count += 2;
				}
			}
		}
		
	}

	cout << count;
	
	return 0;
}

Measured memory_bytes: 3668
#!/usr/bin/env python3

n, a, b, c, d = list(map(int, input().split()))
s = list(str(input()))

start = a-1
end = c-1
sharp_count = 0
for i in range(start+1, (end-1)+1):
    if s[i] == "#" and s[i] == s[i+1]:
        print("No")
        exit()

start = b-1
end = d-1
sharp_count = 0
for i in range(start+1, (end-1)+1):
    if s[i] == "#" and s[i] == s[i+1]:
        print("No")
        exit()

if d < c:
    start = b-1
    end = d-1

    flag = 0
    for i in range(start, end+1):
        if s[i-1] == "." and (s[i-1] == s[i]) and (s[i] == s[i+1]):
            flag = 1
    if flag == 0:
        print("No")
        exit()

# if c == d:
#     print("No")
#     exit()
# elif c < b:
#     start = a-1
#     end = c-1

#     sharp_count = 0
#     for i in range(start+1, (end-1)+1):
#         if s[i] == "#" and s[i] == s[i+1]:
#             print("No")
#             exit()

#     start = b-1
#     end = d-1

#     sharp_count = 0
#     for i in range(start+1, (end-1)+1):
#         if s[i] == "#" and s[i] == s[i+1]:
#             print("No")
#             exit()
# elif c < d:
#     start = a-1
#     end = d-1

#     sharp_count = 0
#     for i in range(start+1, (end-1)+1):
#         if s[i] == "#" and s[i] == s[i+1]:
#             print("No")
#             exit()
# elif d < c:
#     start = a-1
#     end = c-1

#     sharp_count = 0
#     for i in range(start+1, (end-1)+1):
#         if s[i] == "#" and s[i] == s[i+1]:
#             print("No")
#             exit()

#     start = b-1
#     end = d-1
#     dot_count = 0
#     count = 0
#     for i in range(start-1, (end+1)+1):
#         if s[i] == ".":
#             count += 1
#         else:
#             dot_count = max(dot_count, count)
#             count = 0
#     if dot_count <= 2:
#         print("No")
#         exit()
print("Yes")


Measured memory_bytes: 4856
import std.stdio, std.format, std.algorithm, std.string;

struct MyRange {
  int start;
  int end;
  this( int start, int end ) {
	this.start = start;
	this.end = end;
  }

  int opCmp( MyRange r1 ) {
	return start - r1.start;
  }

  string toString() {
	return format( "%d %d", start, end );
  }
}

void main()
{
  int N, W, H;
  string input = readln;
  formattedRead( input, "%d %d %d\n", &N, &W, &H );
  MyRange[] xs = new MyRange[]( N );
  MyRange[] ys = new MyRange[]( N );
  
  foreach ( i; 0 .. N ) {
	int x, y, w;
	input = readln;
	formattedRead( input, "%d %d %d\n", &x, &y, &w );
	xs[ i ] = MyRange( max( 0, x - w ), min( W, x + w ) );
	ys[ i ] = MyRange( max( 0, y - w ), min( H, y + w ) );
  }
  if ( check( xs, W ) || check( ys, H ) ) {
	writeln( "Yes" );
  } else {
	writeln( "No" );
  }
}

bool check( MyRange[] ary, int ulim ) {
  
  sort( ary );
  if ( ary[ 0 ].start > 0 ) {
	return false;
  } else {
	int end = 0;
	foreach ( r; ary ) {
	  if ( end < r.start ) {
		return false;
	  } else {
		end = max( end, r.end );
	  }
	}
	return ulim == end;
  }
}

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

//関数名：pow
//概要：modつき指数関数
//第一引数a：指数の底
//第二引数b：指数
//第三引数mod：法となる値
//戻り値：a^b(m mod)
ll pow(long long a, long long b, ll mod){
    if(a == 0) return 0LL;
    if(a == 1) return 1LL;
    if(b == 0) return 1LL;
    if(b % 2 == 0){
        ll d = pow(a,b/2,mod);
        return (d*d)%mod;
    }else return a%mod*pow(a,b-1,mod)%mod;
}

int main(){
    int n; cin >> n;
    int d;
    vector<ll> dcnt(n,0LL); // dcnt[i]:1からの距離がiであるような頂点の数
    rep(i,n){
        cin >> d;
        if(i != 0 && d == 0){
            cout << 0 << endl;
            return 0;
        }
        dcnt[d]++;
    }
    int dcnt_size;
    for(int i = n-1; i >= 0; --i){
        if(dcnt[i] != 0){
            dcnt_size = i+1;
            break;
        }
    }
    // 例外処理
    if(dcnt[0] != 1){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1LL;
    for(int i = 1; i < dcnt_size; ++i){
        ans *= pow(dcnt[i-1], dcnt[i], MOD);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
l,r=map(int,input().split( ))

y=2019

if l//y != r//y:
    print(0)
else:
    a=l%y
    b=r%y
    m=y
    for i in range(a,b):
        for j in range(i+1,b+1):
            m=min(m,i*j%2019)
    print(m)

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

int main() {
  int N,b;
  vector<int>A(9);
  vector<bool>C(9,false);
  vector<bool>B(101,false);
  for(int i=0;i<9;i++){
    cin >> A.at(i);
    B.at(A.at(i))=true;
  }
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> b;
    if(B.at(b)==true){
      for(int j=0;j<9;j++){
        if(A.at(j)==b){
          C.at(j)=true;
        }
      }
    }
  }
  if((C.at(0)&&C.at(1)&&C.at(2))||
    (C.at(3)&&C.at(4)&&C.at(5))||
    (C.at(6)&&C.at(7)&&C.at(8))||
    (C.at(0)&&C.at(3)&&C.at(6))||
    (C.at(1)&&C.at(4)&&C.at(7))||
    (C.at(2)&&C.at(5)&&C.at(8))||
    (C.at(0)&&C.at(4)&&C.at(8))||
    (C.at(2)&&C.at(4)&&C.at(6))){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	ll ans = 0;
	for (int i = 2; i < n; i++) {
		if (s.substr(i - 2, 3) == "ABC")ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;

int n = 16;

struct obstacles {
  bool above;
  bool left;
  int value;
};



int main() {

  int input;
  cin >> input;

  for (int j = 0; j < input; j++) {
    //cout << "input no. " << j + 1 << endl;
    obstacles grid[n][n];

    for (int rowi = 0; rowi < n; rowi++) {
      for (int coli = 0; coli < n; coli ++) {
	if (coli == 0) {
	  grid[rowi][coli].above = true;
	} else {
	  grid[rowi][coli].above = false;
	}
	if (rowi == 0) {
	  grid[rowi][coli].left =  true;
	} else {
	  grid[rowi][coli].left = false;
	}
	grid[rowi][coli].value = 0;
      }
    }

    int goalx, goaly;

    cin >> goalx >> goaly;
    int n_matatabi;
    
    cin >> n_matatabi;
    
     for (int m = 0; m < n_matatabi; m++) {
      int x1, y1, x2, y2;
      cin >> x1 >> y1 >> x2 >> y2;
      if (x1 == x2) { // vertical link |
	if (y1 > y2) {
	  grid[x1][y1].above = true;
	} else {
	  grid[x1][y2].above = true;
	} 
      }
      if (y1 == y2) { //horizontal link -
	if (x1 > x2) {
	  grid[x1][y1].left = true;
	} else {
	  grid[x2][y1].left = true;
	}
      }
      }

  
    
    for (int x = 0; x < n; ++x) {
      for (int y = 0; y < n; ++y) {
	if (x == 0 && y == 0) {
	  grid[0][0].value = 1;
	  continue;
	}
	int above = 0, left = 0;
	if (grid[x][y].above == false) {
	  above = grid[x][y-1].value;
	}
	if (grid[x][y].left == false) {
	  left = grid[x - 1][y].value;
	}
	grid[x][y].value = above + left;
      }
    }

    //check
    /* for (int rowtest = 0; rowtest < n; ++rowtest) {
      for (int coltest = 0; coltest < n; ++coltest) {
	cout << grid[rowtest][coltest].value << " ";
      }
      cout << endl;
    }
    */
    


    
    if (grid[goalx][goaly].value == 0) {
      cout << "Miserable Hokusai!" << endl;
    } else {
      cout << grid[goalx][goaly].value << endl;
    }
  }
}
  
 


  
  
  
 

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;


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

	double a,b,x;cin>>a>>b>>x;

	double s = x/a;

	double rad;
	if(s >= a*b/2){
		double h = (a*b-s)*2/a;
		rad = atan2(h,a);
	}else {
		double w = 2*s/b;
		rad = atan2(b,w);
	}
	double pi = acos(-1);
	double deg = rad/(2*pi)*360;

	printf("%.10f",deg);
}




Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int x=scanner.nextInt();
		String ans="No";

		if(x>=30) {
			ans="Yes";
		}

		System.out.println(ans);

		scanner.close();

	}

}


Measured memory_bytes: 35636
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)












 
int main(){
    ll n;
    cin >> n;
    vector<ll> ans(n);
    REP(i, n){
        ll a;
        cin >> a;
        ans[a - 1] = i + 1;
    }
    REP(i, n){
        cout << ans[i] << " \n"[i == n - 1];
    }
}

Measured memory_bytes: 1536
# ABC 052: B – Increment Decrement
n = int(input())
s = input()

x = 0
max_value = 0

for c in s:
    if c == 'I':
        x += 1
        max_value = max(max_value, x)
    elif c == 'D':
        x -= 1
    
print(max_value)

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

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

int main(void) {
    string s;
    cin>>s;
    map<char,int> m;
    for(int i = 0;i < s.size();i++) {
        m[s[i]]++;
    }

    if(m.size() == 2) {
        map<char,int>::iterator it = m.begin();
        if(it->second == 2) {
            cout<<"Yes"<<endl;
        } else {
            cout<<"No"<<endl;
        }
    } else {
        cout<<"No"<<endl;
    }

    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<vector>

using namespace std;
vector<int> G[100];

int dfs(int n, int mask, int now) {
  int res = 0;
  if(mask == (1<<n)-1) return 1;
  
  for(auto v : G[now]) {
    if(~mask & (1<<v)) res += dfs(n, mask | (1<<v), v);
  }
  return res;
}

int main(void) {
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=0; i<m; i++) {
    int a,b;
    scanf("%d%d",&a,&b);
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  printf("%d\n",dfs(n, 1, 0));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define x first
#define y second
#define max3(a, b, c) max(a, max(b, c))

using namespace std;

typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
const int maxn = 6e5+10;
const int MOD = 1e9+7;
int dx[4] = {-1, 1, 0, 0}, dy[4] = {0, 0, 1, -1}, d[40][40], n, m, res;
char a[40][40];
bool vis[40][40];
void bfs(int Sx, int Sy)
{
    for (int i = 1 ; i <= n ; i++)
    for (int j = 1 ; j <= m ; j++)
    vis[i][j] = d[i][j] = 0;
    deque<ii> Q;
    Q.push_back(ii(Sx, Sy));
    vis[Sx][Sy] = 1;
    while (Q.size())
    {
        ii u = Q.front();
        Q.pop_front();
        res = max(res, d[u.x][u.y]);
        for (int i = 0 ; i < 4 ; i++)
        {
            ii v = ii(u.x+dx[i], u.y + dy[i]);
            if (v.x > 0 && v.y > 0 && v.x <= n && v.y <= m && !vis[v.x][v.y] && a[v.x][v.y] == '.')
                Q.push_back(v), vis[v.x][v.y] = 1, d[v.x][v.y] = d[u.x][u.y]+1;
        }
    }
}
int main()
{
    cin >> n >> m;
    for (int i = 1 ; i <= n ; i++)
    for (int j = 1 ; j <= m ; j++)
    cin >> a[i][j];
    for (int i = 1 ; i <= n ; i++)
    for (int j = 1 ; j <= m ; j++)
    if (a[i][j] == '.')
    bfs(i, j);
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	vector<pair<double,int> > times(24);
	rep(i,24)
		cin>>times[i].second>>times[i].first;
	sort(times.begin()+0,times.begin()+8);
	sort(times.begin()+8,times.begin()+16);
	sort(times.begin()+16,times.begin()+24);
	typeof(times) times2;
	rep(i,3) rep(j,6)
		times2.push_back(times[i*8+j+2]);
	sort(allof(times2));
	
	rep(i,3) rep(j,2)
		printf("%d %.2f\n",times[i*8+j].second,times[i*8+j].first);
	rep(i,2)
		printf("%d %.2f\n",times2[i].second,times2[i].first);
	
	return 0;
}

Measured memory_bytes: 0
n = int(input())
a = list(map(int, input().split()))
a.sort()
ls = [1] * (10 ** 6 + 1)
cnt = [0] * (10 ** 6 + 1)
for i in range(n):
    cnt[a[i]] += 1
    if cnt[a[i]] == 1:
        if ls[a[i]] == 1:
            for j in range(a[i] * 2, 10 ** 6 + 1, a[i]):
                ls[j] = 0
ans = 0
for i in range(n):
    if ls[a[i]] == 1 and cnt[a[i]] == 1:
        ans += 1
print(ans)


Measured memory_bytes: 111844
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll K, ll A, ll B) {
  ll i = 1;
  bool result = false;

  for (int i = 1;; i++) {
    ll v = K * i;
    if (v > B) {
      result = false;
      break;
    }
    if (v >= A && v <= B) {
      result = true;
      break;
    }
  }

  if (result) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }
}

int main() {
  ll K;
  scanf("%lld", &K);
  ll A;
  scanf("%lld", &A);
  ll B;
  scanf("%lld", &B);
  solve(K, A, B);
  return 0;
}


Measured memory_bytes: 3760
#include<iostream>

using namespace std;

static const int MAX = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;


int n, M[MAX][MAX];;

void dijkstra() {
  int minv;
  int d[MAX], color [MAX];

  for (int i = 0; i < n; i++) {
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  color[0] = GRAY;

  while (1) {
    minv = INFTY;
    int u = -1;
    for (int i = 0; i < n; i++) {
      if (minv > d[i] && color[i] != BLACK) {
        u = i;
        minv = d[i];
      }
    }
    if (u == -1) {
      break;
    }
    color[u] = BLACK;
    for (int v = 0; v < n; v++) {
      if (color[v] != BLACK && M[u][v] != INFTY) {
        if (d[v] > d[u] + M[u][v]) {
          d[v] = d[u] + M[u][v];
          color[v] = GRAY;
        }
      }
    }
  }

  for (int i = 0; i < n; i++) {
    cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
  }
}

int main() {
  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      M[i][j] = INFTY;
    }
  }

  int k, c, u, v;
  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      cin >> v >> c;
      M[u][v] = c;
    }
  }

  dijkstra();

  return 0;
}


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

int main(){

int W, H, N;
cin >> W >> H >> N;
int X = 0, Y = 0, max_X = W, max_Y = H;

	for(int i = 0; i < N; i++){
	int x, y, a;
	cin >> x >> y >> a;
	if(a == 1 && x > X){
	X = x;	
	}else if(a == 2 && x < max_X){
	max_X = x;	
	}else if(a == 3 && y > Y){
	Y = y;	
	}else if(a == 4 && y < max_Y){
	max_Y = y;
	}
	}
	
int ans;
if(max_X <= X || max_Y <= Y){
ans = 0;	
}else{
ans = (max_X - X)*(max_Y - Y);	
}

cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    long long min=9223372036854775807;
    int sum=0;
    vector<int>x(n);
    for(int i=0;i<n;i++)cin>>x.at(i);
    sort(x.begin(),x.end());
    for(int i=0;i<=100;i++){
        sum=0;
        for(int j=0;j<n;j++){
            sum+=pow((x.at(j)-i),2);
        }
        if(sum<min)min=sum;
    }
    cout<<min<<endl;
}

Measured memory_bytes: 256
n = int(input())
#a,b = map(int,input().split())
a_L = list(map(int,input().split()))

for i in a_L:
    if i % 2 == 0:
        if i%3 == 0 or i%5 == 0:
            continue
        else:
            print("DENIED")
            exit()

print("APPROVED")

Measured memory_bytes: 38384
#include<stdio.h>
int main()
{
    int N;
    scanf("%d",&N);
    N = N%10;
    if (N == 2 || N==4 || N==5 || N==7 || N==9)
    {
        printf("hon\n");
    }
    if (N == 0 || N==1 || N==6 || N==8)
    {
        printf("pon\n");
    }
    if (N == 3)
    {
        printf("bon\n");
    }
    return 0;
    
}

Measured memory_bytes: 1620
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	m := iScan()
	if n == 1 && m == 1 {
		fmt.Println(1)
	} else if n == 1 {
		fmt.Println(m - 2)
	} else if m == 1 {
		fmt.Println(n - 2)
	} else {
		fmt.Println((n - 2) * (m - 2))
	}
}


Measured memory_bytes: 1772
#include<bits/stdc++.h>
using namespace std;
int main(){
	string st;
	cin >> st;
	int ans = 0, now = 0;
	for (int i = 0; i < st.size(); i++)
	if (st[i] == 'R') now++;
	else {
		ans = max(ans, now);
		now = 0;
	}
	cout << max(ans, now) << endl;
  return 0;
}

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

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))
#define min3(x, y, z) min(x, min(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif

using namespace std;
int main() {
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  if (k <= a) {
    cout << k;
  } else if (k <= a + b) {
    cout << a;
  } else {
    cout << a - (k - a - b);
  }
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
rep(i,N) {
  cin >> list[i];
}
//配列(スタックとしても使える)
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
//ソート クイックだからO(NlogN)
sort(all(list));
sort(all(list), greater<int>());

//配列の最小最大(Nは要素数)
*min_element(all(c))
*max_element(all(c))

//a[0]からa[N]を逆順にする(計算量はO(N))
reverse(all(a));
//listの末尾に要素を追加
list.push_back(10);
//listの末尾から要素を削除
list.pop_back();
//空ですか？
list.empty()



//キュー(待ち行列)
//定義
queue<int> a;
//追加
a.push(x);
//取る
a.pop();
//チェック
a.front()
//サイズ
a.size()
//空ですか
a.empty()



//優先度付きキュー※全部計算量がO(NlogN)あるので注意
// int 型の要素を持ち、最も小さい値を取り出す形の priority_queue を定義
priority_queue<int, vector<int>, greater<int>> Q1;
// double 型の要素を持ち、最も大きい値を取り出す形の priority_queueを定義
priority_queue<double, vector<double>, less<double>> Q2;
//追加
a.push(x);
//取る
a.pop();
//一番小さいの教えて下さい
a.top()
//サイズ
a.size()
//空ですか
a.empty()



//配列の内容表示
dout << "====listの内容====\n";
for (int edp = 0; edp < N; edp++) dout << list[edp] << endl;
dout << "====ここまで====\n";



//部分文字列
//添字3から5文字
s.substr(3,5)
//添字3から全部
s.substr(3)

//入れ替え
swap(a,b);


*/


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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

char buf[100003];

vector<int> cnt;
int N, Q;

void pre(){
    vi a(N,0);
    rep(i,N){
        if (buf[i]!='A') continue;
        if (i+1<N && buf[i+1]=='C') a[i]=1;
    }
    cnt.assign(N+1, 0);
    rep(i,N) cnt[i+1] = cnt[i]+a[i];
}

int query(int l, int r){
    int c = cnt[r+1] - cnt[l];
    if (buf[r]=='A' && (r+1 < N && buf[r+1]=='C')) --c;
    return c;
}

int main() {
    scanf("%d%d", &N,&Q); fgets(buf, 3, stdin);
    fgets(buf, 100003, stdin);
    pre();
    rep(i,Q){
        int l,r;
        scanf("%d%d", &l, &r);
        --l; --r;
        printf("%d\n", query(l,r));
    }
    return 0;
}


Measured memory_bytes: 1272
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
int chosen[100] = {0} ;
int n ;
vector<int> permutation;
void search() {
if (permutation.size() == n) {
// process permutation
    for (int i = 0; i < n; i++) 
        {
            cout << permutation[i] << " ";
        }
        cout << endl ;
} else {
for (int i = 0; i < n; i++) {
if (chosen[i]) continue;
chosen[i] = true;
permutation.push_back(i);
search();
chosen[i] = false;
permutation.pop_back();
}
}
}
int main()
{
    long long a , b , x , p = 0 , q = 0 , i , j , flag = 0 ;
    cin >> x ;
    for(i = 0 ; i < 128 ; i++)
    {
        if(flag == 1)
        {
            break ;
        }
        for(j = -127 ; j < 128 ; j++)
        {
            long long y ;
            // j = -2 ;
            a = i*i*i*i*i ;
            b = j*j*j*j*j ;
            y = a - b ;
            y = x - y ;
            if( y == 0 )
            {
                p = i ;
                q = j ;
                flag = 1 ;
                break ;
            }
        }
    }
    cout << p << " " << q << endl ;
}

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

int main(){
    int x;
    int h;
    double result;

    while(cin >> x >> h, x != 0 && x != 0){
        result = x*x + 2*x*sqrt((x/2.0)*(x/2.0)+h*h);
        printf("%.6lf\n", result);
    }
    return 0;
}

Measured memory_bytes: 0
# import bisect
# from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, t = list(map(int,ipti().split()))

    print((t//a) * b)

if __name__ == '__main__':
    main()

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

map<int, char> ans;

const int N = 1100;

int n, a, b, q;

int x[N], y[N], h[N];
char c[N][10];

int get(int pos) {
	while (1) {
		int now = upper_bound(y, y + b + 1, pos) - y - 1;
		if (now == 0 || h[now] == 0) return pos;
		int per = y[now] - h[now];
		pos -= ((pos - y[now]) / per + 1) * per;
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin >> n >> a >> b >> q;
	for (int i = 1; i <= a; i++) cin >> x[i] >> c[i];
	y[0] = 1, y[b + 1] = n + 1;
	for (int i = 1; i <= b; i++) cin >> y[i] >> h[i];
	for (int i = 1; i <= a; i++) {
		ans[get(x[i])] = c[i][0];
	}
	for (int i = 1; i <= q; i++) {
		int z; cin >> z; 
//		cerr << z << endl;
		z = get(z);
//		cerr << z << endl;
		if (!ans.count(z)) cout << "?";
		else cout << ans[z];
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 3248
package main

import (
       "bufio"
       "fmt"
       "os"
       "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
     sc.Scan()
     i, e := strconv.Atoi(sc.Text())
     if e != nil {
     	panic(e)
     }
     return i
}

func main() {
     sc.Split(bufio.ScanWords)
     x := nextInt()
     y := nextInt()
     z := nextInt()

     fmt.Print(z)
     fmt.Print(" ")
     fmt.Print(x)
     fmt.Print(" ")
     fmt.Println(y)
}     

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int n,m;
    cin>>n>>m;
    vector<int>a(n);
    double sum=0;
    REP(i,n) {
        cin>>a[i];
        sum+=a[i];
    }
    sort(ALL(a));
    reverse(ALL(a));
    double x = (double)(sum/(4*m));
    //cerr<<x<<endl;
    if(a[m-1] >=x){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys
from sys import stdin
input = stdin.readline
sys.setrecursionlimit(20000000)
 
 
def main():
  N = int(input())
  G = [[] for _ in range(N+1)]
  for i in range(N-1):
    u, v, w = map(int, input().split())
    G[u].append((v, w))
    G[v].append((u, w))
 
  color = [-1]*(N+1)
  color[1] = 0
  # S = [1]
  # while len(S):
  #   now = S[-1]
  #   for next_, w in G[now]:
  #     if color[next_] != -1:
  #       continue
  #     S.append(next_)
  #     color[next_] = (w % 2) ^ color[now]
  #     break
  #   else:
  #     S.pop()
 
  def dfs(now):
    for next_, w in G[now]:
      if color[next_] == -1:
        color[next_] = (w % 2) ^ color[now]
        dfs(next_)
  dfs(1)
 
  for i in range(1, N+1):
    print(color[i])
 
 
if(__name__ == '__main__'):
  main()

Measured memory_bytes: 96548
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;
int a[5][1000005],b[2][1000005][100],c[20];
int main()
{
	int n,y,m,d,s,i,p,j,i1,i2,k1,k2,t,l,k;
	i2=0;
	do
	{
		
		cin >> n >> l;
		b[0][n][i2]++;
		k=n;
		p=0;
		i1=0;
		while(p==0)
		{
			while(k!=0)
			{
				c[k%10]++;
				k=k/10;
			}
			k1=0;
			k2=0;
			t=0;
			for(i=9; i>0; i--)
				for(j=1; j<=c[i]; j++)
				{
					k1=k1*10+i;
					t++;
				}
			for(i=t+1; i<=l; i++)
				k1*=10;
			for(i=1; i<=9; i++)
				for(j=1; j<=c[i]; j++)
				{
					k2=k2*10+i;
					t++;
				}
			k=k1-k2;
			i1++;
			if(b[0][k][i2]==1)
			{
				a[0][i2]=b[1][k][i2];
				a[1][i2]=k;
				a[2][i2]=i1-b[1][k][i2];
				p=1;
			}
			else 
			{
				b[0][k][i2]=1;
				b[1][k][i2]=i1;
			}
			for(i=0; i<10; i++)
				c[i]=0;
		}
		i2++;
	}while(n!=0 || l!=0);
	for(i=0; i<i2-1; i++)
	cout << a[0][i] <<" " << a[1][i] << " " << a[2][i]<<endl;
}



Measured memory_bytes: 4044
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), M = sc.nextInt();
		long[][] cake = new long[N][3];
		for(int i = 0; i < N; i++) {
			for(int j = 0; j < 3; j++){
				cake[i][j] = sc.nextLong();
			}
		}
		long ans = 0;
		for(int i = 0; i < 8; i++) {
			long[] sort = new long[N];
			for(int j = 0; j < N; j++) {
				sort[j] += (((i >> 0) & 1) == 1) ? -cake[j][0] : cake[j][0];
				sort[j] += (((i >> 1) & 1) == 1) ? -cake[j][1] : cake[j][1];
				sort[j] += (((i >> 2) & 1) == 1) ? -cake[j][2] : cake[j][2];
			}
			Arrays.sort(sort);
			long tmp = 0;
			for(int j = N - 1; j >= N - M; j--) tmp += sort[j];
			ans = Math.max(tmp, ans);
		}
		System.out.println(ans);
	}
}

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

using ll = long long;
#define REP(i, n) for(int (i)=0; (i)< (n); ++i)
#define REPR(i, n) for(int (i)=(n); (i)>=0; --i)
#define FOR(i, n, m) for(int (i)=(n); (i)<(m); ++i)

int main(){
  int M;
  cin >> M;
  ll n = 0, s= 0;
  REP(i, M){
    ll d, c;
    cin >> d >> c;
    n+=c, s+= d*c;
  }
  ll ans = (9*n+s)/9;
  ll x = (9*n+s)%9;
  while(x < 10){
    x+=9;
    ans--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    h, w, n = map(int, input().split())
    dic = {}
    for _ in range(n):
        a, b = map(int, input().split())
        for i in range(max(2, a-1), min(h, a+2)):
            for j in range(max(2, b-1), min(w, b+2)):
                if (i, j) in dic:
                    dic[(i, j)] += 1
                else:
                    dic[(i, j)] = 1
    ans = [0]*10
    cnt = 0
    for v in dic.values():
        ans[v] += 1
        cnt += 1
    ans[0] = (h-2)*(w-2) - cnt
    for i in range(10):
        print(ans[i])

if __name__ == "__main__":
    main()

Measured memory_bytes: 151732
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t=1;
	// cin>>t;
	while(t--)
	{
		int d,s,t;
		cin>>d>>t>>s;
		double val=d/(float)s;
		if(val<=t)
			cout<<"Yes";
		else cout<<"No";
	}
}

Measured memory_bytes: 3636
#include<bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vb = vector<bool>;
const int INF = 1e9;
const int MOD = 1e9+7;

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N, M; cin >> N >> M;
    priority_queue<int> q;
    REP(i, N)
    {
        int A; cin >> A;
        q.push(A);
    }
    REP(i, M)
    {
        int m = q.top(); q.pop();
        q.push(m/2);
    }
    ll ans = 0;
    while(!q.empty())
    {
        ans += q.top(); q.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 892
#include<cstdio>
#include<functional>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	char s[10];
	scanf("%s",s);
	if(strcmp(s,"Sunny")==0)	printf("Cloudy\n");
	else if(strcmp(s,"Cloudy")==0)	printf("Rainy\n");
	else printf("Sunny\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;
int main(void){
    // Your code here!
   string N;
   cin >> N;
   if (N[0] == N[1] && N[1] == N[2])
   cout << "Yes" << endl;
   else if (N[1] == N[2] && N[2] == N[3])
   cout << "Yes" << endl;
   else
   cout << "No" << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int x;
    cin >> x;
    int ans = x / 500 * 1000;
    x %= 500;
    int ans2 = x / 5 * 5;
    cout << ans + ans2 << endl;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

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

int main(){
	ll A,B,C,D;
	cin>>A>>B>>C>>D;
	ll l=C*D/gcd(C,D);
	ll ans=B-(B/C+B/D-B/l);
	ans-=(A-1) -((A-1)/C+(A-1)/D-(A-1)/l);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
program main;
var
    i, n, x : longint;
    A : array[1..200000] of longint;
begin
    readln(n);
    for i := 1 to n do 
        A[i] := 0;
    for i := 1 to n do begin
        read(x);
        A[x] := A[x] + 1;
    end;
    for i := 1 to n do 
        writeln(A[i]);
end.

Measured memory_bytes: 1396
#include<iostream>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	cout<<a[0];
	for(int i=0;i<a.size()+b.size()-1;i++)
	{
		if(i%2)
		{
			cout<<a[i/2+1];
		}
		else
		{
			cout<<b[i/2];
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  int a, b;
  cin >> a >> b;

  int ans = a + b;
  if (ans >= 10) cout << "error" << endl;
  else cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
   int n=0,i;
   char s[5];

   scanf("%s",s);
   for(i=0;i<4;i++){
      if(s[i]=='+') n++;
      else if(s[i]=='-') n--;
      }
   printf("%d\n",n);

   return 0;
}


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

#define int long long
#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define endl "\n"
#define ends " "
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << ": " << x << endl;
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl;
#define debugV(v) cerr << #v << ": [ "; for(int __ = 0; __ < v.size(); __++) cerr << v[__] << ((__ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugVP(v) cerr << #v << ": [ "; for(int ___ = 0; ___ < v.size(); ___++) cerr << '{' << v[___].first << ", " << v[___].second << '}' << ((___ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugA(a, n) cerr << #a << ": [ "; for(int ____ = 0; ____ < n; ____++) cerr << a[____] << ((____ != n - 1) ? ", " : ends); cerr << ']' << endl
#define print(args...) fprintf (st                                  derr, args)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef map<pii, int> mpii;
typedef set<int> sti;
const int INF = 1e9, MOD = INF + 7;
int gcd(int a, int b) { return (b ? gcd(b, a % b) : a); }
int power(int a, int b) { return (!b ? 1 : power(a, b / 2) * power(a, b / 2) * (b % 2 ? a : 1)); }
int mod(int a) { return (a % MOD + MOD) % MOD; }

/////////////////////////////////////////////////////////////////////

const int N = 1e5 + 20, P = 104729;

int n;
map<int, int> mp;
int ans = 1;

void add(int x) {
    mp[x]++;
    if (mp[x] == n) ans *= x, mp[x] = 0;
}

void primeFactors(int p) {
    while (p % 2 == 0) { 
        add(2);
        p = p / 2; 
    } 
    for (int i = 3; i <= sqrt(p); i += 2) { 
        while (p % i == 0) { 
            add(i);
            p = p / i; 
        } 
    } 
    if (p > 2) add(p); 
} 

int32_t main(){

    sync;

    int p; cin >> n >> p;
    primeFactors(p);
    cout << ans << endl;

    return 0;
}
 

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>
#include<math.h>
using namespace std;

int main() {
	string s1,s2,s3;
	cin >> s1 >> s2 >> s3;
	cout << s1.at(0) << s2.at(1) << s3.at(2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b;
    cin>>a>>b;
    if(a<b)
    {
        while(b--)
        {
            cout<<a;
        }
        cout<<"\n";
    }
    else
    {
        while(a--)
        {
            cout<<b;
        }
        cout<<"\n";
    }
    
}

Measured memory_bytes: 256
N, M = [int(x) for x in input().split()]
links = [tuple(map(int, input().split())) for _ in range(M)]
S, T = [int(x) for x in input().split()]

d = {}
for x, y in links:
    if x in d:
        d[x][0].add(y)
    else:
        d[x] = [{y}, False]

def next_node(start):
    history = set()
    for s in start:
        if s in d:
            history |= d[s][0]
    return history

history = {S}
s = 1
while True:
    for _ in range(3):
        history = next_node(history)
    if T in history:
        print(s)
        break
    for h in tuple(history):
        if h not in d or d[h][1]:
            history.remove(h)
        else:
            d[h][1] = True
    if len(history) == 0:
        print(-1)
        break
    s += 1


Measured memory_bytes: 54284
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#pragma GCC optimize ("-O2")
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define one (1ll)
#define endl "\n"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define p_q priority_queue 
#define min_p_q priority_queue <int,vt <int>,greater <int>>
using namespace std;
using namespace __gnu_pbds; 
template <typename T> 
void DEBUG_ARR(vt<T> a){
	f(i,0,a.size())cout<<a[i]<<" ";
	cout<<"\n";
}
lli tmod(lli x){return (x%mod+mod)%mod;}
 
int main() { 
    fastio;
    lli n,a,b;
    cin>>n>>a>>b;
    lli ans;
    if((b-a)%2==0){
        ans=((b-a)/2);
    }
    else{
        ans=min(a+(b-a-1)/2,n-b+1+(b-a-1)/2);
    }
    cout<<ans<<"\n";
    
    return 0; 	
} 

Measured memory_bytes: 256
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    n = int(input())
    dd = list(map(int, input().split()))
    ans = 0
    for x,y in combinations(dd,2):
        ans += x*y
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5620
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254

macro_rules! eprint {
    ($($t:tt)*) => {{
        use ::std::io::Write;
        let _ = write!(::std::io::stderr(), $($t)*);
    }};
}
macro_rules! eprintln {
    () => { eprintln!(""); };
    ($($t:tt)*) => {{
        use ::std::io::Write;
        let _ = writeln!(::std::io::stderr(), $($t)*);
    }};
}
macro_rules! dbg {
    ($v:expr) => {{
        let val = $v;
        eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
        val
    }}
}

macro_rules! mat {
    ($($e:expr),*) => { Vec::from(vec![$($e),*]) };
    ($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
    ($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
    ($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
    ($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
        $a$([$i])*.$f($($t),*)
    };
    ($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
        let t = $e;
        ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
    } };
}

pub fn readln() -> String {
    let mut line = String::new();
    ::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
    line
}

macro_rules! read {
    ($($t:tt),*; $n:expr) => {{
        let stdin = ::std::io::stdin();
        let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
            let line = line.unwrap();
            let mut it = line.split_whitespace();
            _read!(it; $($t),*)
        }).collect::<Vec<_>>();
        ret
    }};
    ($($t:tt),*) => {{
        let line = readln();
        let mut it = line.split_whitespace();
        _read!(it; $($t),*)
    }};
}

macro_rules! _read {
    ($it:ident; [char]) => {
        _read!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; [u8]) => {
        Vec::from(_read!($it; String).into_bytes())
    };
    ($it:ident; usize1) => {
        $it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_read!($it; $t)),*)
    };
}


pub fn main() {
    let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: usize = 998244353;
const INF: i64 = std::i64::MAX/3;

fn solve() {
    let a = read!(i64);
    println!("{}",a+a*a+a*a*a);
}

fn run() {
    solve();
}

Measured memory_bytes: 2232
import scala.io.StdIn

object Main extends App {

  val Array(k, s) = StdIn.readLine().split(" ").map(_.toInt)

  var count = 0
  for (x <- 0 to k; y <- 0 to k)
    yield count += (if (0 <= s - (x + y) && s - (x + y) <= k) 1 else 0)

  println(count)

}


Measured memory_bytes: 104372