akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	int a,b;
	cin>>a>>b;
	if(a<=8&&b<=8)
		cout<<"Yay!"<<endl;
	else
		cout<<":("<<endl;
}

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

using namespace std;

#define EPS 1e-9
#define For(i,N) FOR(i,N)
#define Forr(i,a,b) FORR(i,a,b)
#define Fotr(i,a,b,c) FOTR(i,a,b,c)
#define FOR(i,N) FORR(i, 0, N)
#define FORR(i,a,b) FOTR(i, a, b, 1)
#define FOTR(i,a,b,c) for(int i=(a);i<(b);i+=(c))
#define FOREACH(i,x) for(__typeof__((x).begin())i=(x).begin();i!=(x).end();i++)
#define MEM(a,x) memset(a,x,sizeof(a))
#define BCHK(a,x) (((a)>>(x))&1)
#define BSET(a,x) ((a)|(1<<(x)))
#define BCLR(a,x) ((a)&(~(1<<(x))))
#define BTGL(a,x) ((a)^(1<<(x)))
#define FMT(...) (sprintf(CRTBUFF, __VA_ARGS__)?CRTBUFF:0)
#define read() freopen("input.txt","r",stdin)
#define write() freopen("output.txt","w",stdout)
#define cpp_io() {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define BUFFSIZE 30000
#define INF 1000000000
#define MAX 300010
#define MOD 1000000007
#define pb push_back
#define mkpr make_pair
#define pii pair<int, int>
#define PI acos(-1)
#define ll long long
#define fi first
#define si second
#define all(x) x.begin(), x.end()

char CRTBUFF[BUFFSIZE];
#define dbg(args...) {cerr<<"-->";debugger::call(#args,args);cerr<<"\n";}
struct debugger {
    static void call(const char* it) {}
    template<typename T, typename ... aT>
    static void call(const char* it, T a, aT... rest) {
        string b;
        for (; *it&&*it != ','; ++it) if (*it != ' ')b += *it;
        cerr << b << "=" << a << " ";
        call(++it, rest...);
    }
};
ll power(ll x,ll y)
{
    if( y == 0)
        return 1;
    else if (y%2 == 0)
        return power(x, y/2)*power(x, y/2);
    else
        return x*power(x, y/2)*power(x, y/2);

}
int main(){
    cpp_io();
    #ifdef LOCAL
        //read();
        //write();
    #endif
    int n,k;
    cin>>n>>k;
    int a[n+10];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    double sum = 0, mx = -1000000000,cnt=1;
    for(int i=0;i<n;i++){
        if(cnt>k){
            cnt--;
            int idx = i-k;
            for(int j=1;j<=a[idx];j++){
                double val = a[idx]*1.0;
                sum -= (double)(j/val);
            }
        }
        for(int j=1;j<=a[i];j++){
            double val = a[i]*1.0;
            sum += (double)(j/val);
        }
        mx = max(mx,sum);
        cnt++;
    }
    cout<<fixed<<setprecision(12)<<mx<<endl;






    return 0;

}


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  char prev='A';
  lint ans=0;
  REP(i,N){
    char c;
    cin>>c;
    if(c!=prev)ans++;
    prev=c;
  }
  cout<<ans<<endl;
  return 0;
}


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

int n;
const LL mod=1e9+7;
LL sum1,sum2;
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		LL t;
		scanf("%lld",&t);
		sum1=(sum1+t*t)%mod;
		sum2+=t;
	}
	sum2%=mod;
	printf("%lld\n",(sum2*sum2-sum1+mod)%mod*(mod+1>>1)%mod);
	return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<char> s(3);
  for (int i = 0; i < 3; i++) {
    cin >> s.at(i);
  }
  sort(s.begin(), s.end());
  if (s[0] == 'a' && s[1] == 'b' && s[2] == 'c') {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  string s;
  cin >> s;
  int n = s.length();
  int cs = 0, ct = 0;
  int ans = n;
  for(int i = 0; i < n; i++) {
    if(s[i] == 'S'){
      cs++;
    }else{
      if(cs > 0){
        cs--;
        ans -= 2;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
import math
def resolve():
    a, b, x = list(map(int, input().split()))
    if (a**2)*b/2 > x:
        print(90-math.degrees(math.atan(2*x/((b**2)*a))))
    else:
        if x == (a**2)*b:
            print(0)
        else:
            print(90-math.degrees(math.atan(a**3/(2*(a**2)*b-2*x))))
    

if '__main__' == __name__:
    resolve()


Measured memory_bytes: 62420
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int a[5];
	int ans=0;
	for(int i=0;i<5;i++)
	{
		cin>>a[i];
		if(a[i]==0){ans=i+1;}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 3596
// ※※※ 解答不能 ※※※
// 正答者の解答を勉強する.
// mqts氏.
// https://atcoder.jp/contests/abc122/submissions/4699194
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL MOD = 1e9 + 7;

// AGC, ACG, GAC, AXGC, AGXC
// => 2文字 の 組み合わせは, 4 × 4 = 16通りあるので, 列挙.
// AA GA CA TA AG GG CG TG AC GC CC TC AT GT CT TT
// 0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
LL dp[102][17];

int main() {

    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);

    // 2. dp更新.
    for(int i = 0; i < 102; i++) fill(dp[i], dp[i] + 16, 0);
    fill(dp[2], dp[2] + 17, 1);
    for(int i = 2; i < N; i++){
        const int j = i + 1;
        const LL A = (dp[i][0]  + dp[i][1]  + dp[i][2]  + dp[i][3]) % MOD;
        const LL G = (dp[i][4]  + dp[i][5]  + dp[i][6]  + dp[i][7]) % MOD;
        const LL C = (dp[i][8]  + dp[i][9]  + dp[i][10] + dp[i][11]) % MOD;
        const LL T = (dp[i][12] + dp[i][13] + dp[i][14] + dp[i][15]) % MOD;
        dp[j][3]  = T;
        dp[j][7]  = T;
        dp[j][11] = (T - dp[i - 1][4] + MOD) % MOD;
        dp[j][15] = T;
        dp[j][0]  = A;
        dp[j][4]  = A;
        dp[j][8]  = (dp[i][0] + dp[i][2] + dp[i][3]) % MOD;
        dp[j][12] = A;
        dp[j][1]  = G;
        dp[j][5]  = G;
        dp[j][9]  = (dp[i][5] + dp[i][6] + dp[i][7] - dp[i-1][4] - dp[i-1][12] + MOD) % MOD;
        dp[j][13] = G;
        dp[j][2]  = C;
        dp[j][6]  = (dp[i][9] + dp[i][10] + dp[i][11]) % MOD;
        dp[j][10] = C;
        dp[j][14] = C;
    }
    
    // 3. 出力 ～ 後処理.
    LL ans = 0;
    for(int i = 0; i < 16; i++) ans += dp[N][i], ans %= MOD;
    printf("%lld", ans);
    return 0;

}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace AtCoderBeginnerContest178
{
    class Program
    {
        static void Main(string[] args)
        {
            // 課題A - Not(2020/9/13)

            string input = Console.ReadLine();

            

            if (input.Equals("1")) Console.Write("0");
            else Console.Write("1");

        }
    }
}


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

#define all(v)  begin(v), end(v)
#define endl    '\n';
#define int     long long
#define pii     pair<int, int>
#define sz(x)   (int) x.size()

void test_case() {
    int n; cin >> n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    
    while (n--) {
        string s;
        cin >> s;
        
        if (s == "AC") ac++;
        if (s == "WA") wa++;
        if (s == "TLE") tle++;
        if (s == "RE") re++;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
}

int32_t main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(0);

    int t = 1;
    // cin >> t;

    while (t--) { 
        test_case();
    }
    return 0;
}


Measured memory_bytes: 3656
from collections import defaultdict

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

graph = defaultdict(set)
for i in range(M):
    a,b = map(int, input().split(' '))
    graph[a].add(b)
    graph[b].add(a)

ans = 1
vis_set = set()

for start in graph:
    if start in vis_set:
        continue
    count = 0
    stack = [start]
    vis_set.add(start)
    while len(stack) > 0:
        cur = stack.pop()
        count += 1
        for adj in graph[cur]:
            if adj not in vis_set:
                stack.append(adj)
                vis_set.add(adj)

    ans = max(ans, count)

print(ans)

Measured memory_bytes: 94840
N = int(input())
lst = list(map(int, input().split()))
ans = []
for i in range(N, 1, -1):
    for j in range(i, 0, -1):
        if(lst[j-1] == j):
            ans.insert(0, j)
            del lst[j-1]
            break

if(lst[0] == 1):
    ans.insert(0, 1)
if(len(ans) == N):
    for i in ans:
        print(i)
else:
    print("-1")


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

using namespace std;

#define pb push_back

typedef long long ll;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == ','){
            s[i] = ' ';
        }
    }
    cout << s;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int a, b; cin >> a >> b;
  cout << max(0, a - 2 * b) << endl;
}


Measured memory_bytes: 256
def inpl(): return [int(i) for i in input().split()]
def nextb(b,k):
    b <<= 1
    b += 1
    b <<= k-1
    return b

mod = 10**9+7
N, x, y, z = inpl()
xyz = 2**(x+y+z-1) + 2**(y+z-1) + 2**(z-1)
W = 2**(x+y+z-1)
dp = [[0]*W for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(W):
        for k in range(1,11):
            nj = nextb(j,k)
            if nj&xyz != xyz:
                dp[i+1][nj%W] = (dp[i+1][nj%W]+dp[i][j])%mod
print((10**N%mod-sum(dp[-1])%mod)%mod)

Measured memory_bytes: 63324
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define YN(y, n, b) (b? y : n)
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    i32 N, Q;
    cin >> N >> Q;
    Vec<Vec<i32>> t(N + 1);
    Vec<i32> C(N + 1, 0);
    for (i32 i = 0; i < N - 1; i++) {
        i32 a, b;
        cin >> a >> b;
        t[a].push_back(b);
        t[b].push_back(a);
    }
    for (i32 i = 0; i < Q; i++) {
        i32 p, x;
        cin >> p >> x;
        C[p] += x;
    }
    queue<i32> q;
    q.push(1);
    Vec<bool> visited(N + 1, false);
    visited[0] = visited[1] = true;
    while (!q.empty()) {
        i32 current = q.front();
        for (i32 i = 0; i < t[current].size(); i++) {
            if (visited[t[current][i]]) continue;
            C[t[current][i]] += C[current];
            q.push(t[current][i]);
            visited[t[current][i]] = true;
        }
        q.pop();
    }
    for (i32 i = 1; i <= N; i++) {
        cout << C[i];
        if (i != N) cout << " ";
    }
    cout << endl;

}


Measured memory_bytes: 16572
/**
 * THIS IS CFMASTER'S CODE !
 * HACK IT IF YOU CAN !
**/
#include <bits/stdc++.h>
 
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x, y;
  cin >> n >> x >> y;
  --x; --y;
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (j <= x || i >= y) {
        ++ans[j - i];
        continue;
      } 
      if (i <= x && j >= y) {
        ++ans[j - y + x - i + 1];
        continue;
      }
      if (i <= x) {
        ++ans[x - i + min(j - x, y - x - (j - x) + 1)];
        continue;
      }
      if (j >= y) {
        ++ans[j - y + min(y - i, y - x - (y - i) + 1)];
        continue;
      }
      ++ans[min(j - i, y - x - (j - i) + 1)];
    }
  }
  for (int i = 1; i < n; i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int N,L;
  ostringstream os;
  cin >> N >> L;
  vector<string>S(N);
  for(int i=0;i<N;++i){
    cin >> S.at(i);
  }
  sort(S.begin(),S.end());
  copy(S.begin(),S.end(),ostream_iterator<string>(os));
  cout << os.str() << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n,x;
    int sum=0;
    int l;
    int a=1;
    cin >> n >> x;
    FOR(i,0,n){
        cin >> l;
        sum+= l;
        if(sum <= x)
            a++;
        else{
            break;
        }
    }
    cout << a;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <climits>
using namespace std;

int main()
{
  vector<int> A(5);
  int k;

  for(int i=0; i<5; i++){
    cin >> A[i];
  }
  cin >> k;

  if(A[4] - A[0] > k){
    cout << ":(" << endl;
  }else{
    cout << "Yay!" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){

  int i,n;

  long int a,min = 1000000,max = -1000000,sum = 0;

  scanf("%d",&n);

  for(i = 1;i <= n;i++)

  {

    scanf("%ld",&a);

    if(a < min)

      min = a;

    if(a > max)

      max = a;

    sum += a;

  }

  printf("%ld %ld %ld\n",min,max,sum);

  return 0;

}
 

Measured memory_bytes: 600
#include "bits/stdc++.h"
#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 FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
int vx[4] = { 0,1,0,-1 };
int vy[4] = { 1,0,-1,0 };
ll n, m,timed;

signed main() {

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

	cin >> n >> m;
	timed = 100 * (n - m) + 1900 * m;

	cout << timed * pow(2, m) << endl;

	return 0;
}

Measured memory_bytes: 512
def kari():
    N = list(map(int, input().split()))
    A, B = map(int, input().split())

def main():
    N = int(input())
    S = list(input())
    K = int(input())

    aaa = S[K - 1]

    for i in range(N):
        if S[i] != aaa:
            S[i] = '*'
    print(''.join(S))



if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue - 10;
	const long INFL = long.MaxValue - 10;
	const double EPS = 1e-7;
	const double PI = 3.1415926536;

	List<int>[] G;
	int N;
	int[] num;
	int[,] range;
	int root = 0;

	void prog()
	{
		cin = new Scanner();
		int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		int a = cin.nextInt();
		int b = cin.nextInt();
		int c = cin.nextInt();
		if (a + b == c || a + c == b || b + c == a) Console.WriteLine("Yes");
		else Console.WriteLine("No");
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] nh = br.readLine().split(" ");
		int n = Integer.parseInt(nh[1]);
		int h = Integer.parseInt(nh[0]);
		nh = br.readLine().split(" ");
		int[] a = new int[n];
		int sum = 0;
		for(int i = 0 ; i < n ; i++) {
			sum += Integer.parseInt(nh[i]);
		}
		if(sum >= h) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}

}


Measured memory_bytes: 33588
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;

int main()
{
    int n,m;
	int a[10000],b[10000];
	for(;;){
	cin >> n >> m;
	if(n==0&&m==0)return 0;
	for(int i=0;i<m;i++)cin >> a[i] >> b[i];
	vector<int>aa;
	vector<int>bb;
	for(int i=0;i<m;i++){
		if(a[i]==1)aa.push_back(b[i]);
		if(b[i]==1)aa.push_back(a[i]);
	}
	sort(aa.begin(),aa.end());
	for(int i=0;i<m;i++){
		int x=0,y=0;
		bool f1=true,f2=true;
		//対象を見つける
		for(int j=0;j<aa.size();j++){
			if(aa[j]==a[i])x=b[i];
			if(aa[j]==b[i])y=a[i];
		}
		//aaに入っていないか調査
		for(int j=0;j<aa.size();j++){
			if(aa[j]==x)f1=false;
			if(aa[j]==y)f2=false;
		}
		//bbに入っていないか調査
		for(int j=0;j<bb.size();j++){
			if(bb[j]==x)f1=false;
			if(bb[j]==y)f2=false;
		}
		if(f1&&x!=0&&x!=1)bb.push_back(x);
		if(f2&&y!=0&&y!=1)bb.push_back(y);
	}
	cout << aa.size()+bb.size() << "\n";
	}
    return 0;
}

Measured memory_bytes: 1296
#include <cmath>
#include <iostream>
#include <map>
#include <vector>

using namespace std;


int main(){
    int N, a, count = 0;
    cin >> N;


    for(int i = 0;i<N;i++){
        cin >> a;
        while(a % 2 == 0){
            a /= 2;
            count += 1;
        }
    }

    cout << count << endl;
}

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

#define ll              long long int
#define ull             unsigned long long int
#define pii             pair < int, int>
#define pll             pair < ll, ll>
#define sc              scanf
#define scin(x)         sc("%d",&(x))
#define scln(x)         sc("%lld",&(x))
#define pf              printf
#define ms(a,b)         memset(a,b,sizeof(a))
#define pb(a)           push_back(a)
#define mp              make_pair
#define db              double
#define EPS             10E-10
#define ff              first
#define ss              second
#define sqr(x)          (x)*(x)
#define vi              vector< int >
#define vl              vector< ll >
#define vii             vector<vector< int > >
#define vll             vector<vector< ll > >
#define DBG             pf("HI\n")
#define MOD             1000000007
#define CIN             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define RUN_CASE(t,T)   for(__typeof(t) t=1;t<=T;t++)
#define CASE(t)         printf("Case %d: ",t)
#define CASEL(t)        printf("Case %d:\n",t)
#define intlimit        2147483648
#define longlimit       9223372036854775808
#define infinity        (1<<28)
#define gcd(a, b)       __gcd(a,b)
#define lcm(a, b)       ((a)*(b)/gcd(a,b))
#define mx              1234567899
#define PI              2*acos(0.0)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for(__typeof(i) i=a; i<=b; i++)
#define rev(i,a,b)      for(__typeof(i) i=a; i>=b; i--)

using namespace std;

struct data
{
    ll index,val;
    bool operator < (data A)
    {
        if(val!= A.val)
            return val<A.val;
        else
            return index<A.index;
    }
}arra[200005];

int main()
{
     ll n,a,b;
     scln(n);
     for(ll i=0;i<n;i++)
     {
         cin>>a>>b;
         arra[i].val = b;
         arra[i].index=a;
     }
     sort(arra,arra+n);
     //for(ll i=0;i<n;i++) cout<<arra[i].val<<' '<<arra[i].index<<endl;
     ll sum = 0;
     for(ll i=0;i<n;i++)
     {
         sum+=arra[i].index;
         if(sum>arra[i].val)
         {
             pf("No\n");
             return 0;
         }
     }

     cout<<"Yes\n";
}


Measured memory_bytes: 3328
#include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	double a,b,c[] = {0.2, 0.6, 1.1};
	int l[4]= {}, r[4] = {};
	while(cin >> a >> b) {
		bool fa = 1, fb = 1;
		rep(i,4) {
			if(c[i]>a && fa) {
				l[i]++;
				fa = 0;
			}
			if(c[i]>b && fb) {
				r[i]++;
				fb = 0;
			}
		}
		if(fa) l[3]++;
		if(fb) r[3]++;
	}
	rep(i,4) {
		cout << l[3-i] << " " << r[3-i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int a = sc.nextInt();
    int b = sc.nextInt();

    if (a >= 13) {
      System.out.println(b);
    } else if (a >= 6) {
      System.out.println(b / 2);
    } else {
      System.out.println(0);
    }

  }
}

Measured memory_bytes: 35680
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#define stop(x) {cout<<x<<endl;exit(0);}
#define all(x) x.begin(),x.end()
#define szz(s) int(s.size())
#define endl '\n'
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
typedef long long ll;
using namespace std;

void file() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    if (freopen("input.txt", "r", stdin));
    if (freopen("output.txt", "w", stdout));
#endif
}


ll n, w;
vector < pair < ll, int > > v;
ll mem[101][100001];

ll solve(int idx, int still) {
    if (idx == n)return 0;

    ll& ret = mem[idx][still];
    if (~ret)
        return ret;

    ret = solve(idx + 1, still);
    if (v[idx].first <= still)
        ret = max(ret, solve(idx + 1, still - v[idx].first) + v[idx].second);

    return ret;
}

int main() {//file();

    memset(mem, -1, sizeof mem);
    cin >> n >> w;
    v.resize(n);
    for (auto& e : v)
        cin >> e.first >> e.second;

    cout << solve(0, w) << endl;



}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
#define i64 long long
#define N (int)(1e5)
#define pii pair<int,int>
#define L first 
#define R second
#define all(x) x.begin(),x.end()
using namespace std;
bool isSqr(int n){
	double _sqrt = sqrt(1.0*n);
	return floor(_sqrt) == ceil(_sqrt);
}
int main(){
	string a,b;
	cin>>a>>b;
	int a_dot_b = atoi((a+b).c_str());
	printf("%s\n", isSqr(a_dot_b) ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


// import here

int main(){
    LL n;
    cin >> n;
    vector<string> title(n);
    vector<LL> t(n);
    for(LL i = 0; i < n; ++i){
        cin >> title[i] >> t[i];
    }
    string x;
    LL ans = 0;
    bool flag = false;
    cin >> x;
    for(LL i = 0; i < n; ++i){
        if(flag) ans += t[i];
        if(title[i] == x) flag = true;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 888
fun main(args: Array<String>) = abc164b()

@OptIn(ExperimentalStdlibApi::class)
fun abc164b() {
    var (a, b, c, d) = readLine()!!.split(' ').map { it.toInt() }

    while (true) {
        c -= b
        if (c <= 0) return println("Yes")
        a -= d
        if (a <= 0) return println("No")
    }
}


Measured memory_bytes: 36312
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

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

ll N;
vector<vector<ll>> g;
vector<ll> a;

vector<stack<ll>> list;
vector<ll> lis;

vector<ll> ans;

void dfs(ll u, ll v) {

	auto itr = lower_bound(lis.begin(), lis.end(), a[v]);
	ll x = distance(lis.begin(), itr);
	lis[x] = a[v];
	list[x].push(a[v]);

	auto itr2 = lower_bound(lis.begin(), lis.end(), INF);
	ans[v] = distance(lis.begin(), itr2);
	for (ll w : g[v]) {
		if (u == w) { continue; }	
		dfs(v, w);		
	}

	list[x].pop();
	if (list[x].empty()) { lis[x] = INF; }
	else { lis[x] = list[x].top(); }
}



int main() {
	cin >> N;
	g.resize(N + 1);
	lis.assign(N + 1, INF);
	list.resize(N + 1);

	a.assign(N + 1, 0);
	ans.assign(N + 1, 0);

	repn(i, N) cin >> a[i];

	repn(i, N - 1) {
		ll u, v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}

	dfs(0, 1);
	
	repn(i, N) { cout << ans[i] << endl; }
	
	
	
	system("PAUSE");
}


Measured memory_bytes: 165532
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const int N=202202;
ll f[N],sum[N];
int n,k;
int main(){
	scanf("%d%d",&n,&k);
	for (int i=1; i<=n; i++)
		scanf("%lld",&f[i]);
	while (k--){
		for (int i=1; i<=n; i++)
			sum[max(1ll,i-f[i])]++,sum[min(1ll*(n+1),i+f[i]+1)]--;
		ll mi=1e18;
		for (int i=1; i<=n; i++){
			sum[i]=sum[i]+sum[i-1];
			f[i]=sum[i];
			mi=min(mi,f[i]);
		}
		for (int i=0; i<=n+1; i++)	sum[i]=0;
		if (mi>=n)	break;
	}
	for (int i=1; i<=n; i++)
		printf("%lld ",f[i]);
    return 0;
}

Measured memory_bytes: 4828
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let n: usize = read();
    let mut a: Vec<usize> = read_vec();

    a.sort();
    let elems: Vec<(usize, usize)> = split_same_element(&a);

    let sum: usize = elems
      .iter()
      .fold(0, |acc, &x| acc + (x.1 - 1));

    //println!("{:?}", elems);
    //println!("{}", sum);

    if sum % 2 == 0 {
       println!("{}", elems.len());
    } else {
      println!("{}", elems.len() - 1);
    }
}


fn split_same_element<T: Eq + Copy>(v: &Vec<T>) -> Vec<(T, usize)> {
  let mut res: Vec<(T, usize)> = Vec::new();
  if v.len() == 0 {
    return res;
  }

  let mut now: T = v[0];
  let mut count: usize = 0;
  for &e in v {
    if e == now {
      count += 1;
    }
    else {
      res.push((now, count));
      count = 1;
      now = e;
    }
  }
  res.push((now, count));

  res
}

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

int main() {
    uint64_t a; cin >> a;
    string b; cin >> b;

    cout << (a * ((b[0] - '0') * 100 + (b[2] - '0') * 10 + (b[3] - '0') * 1) / 100) << endl;
}



Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int> (D));
    for (auto& v : X) {
        for (int& x : v) cin >> x;
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (i >= j) continue;
            int diff = 0;
            for (int k = 0; k < D; k++) {
                int t = abs(X[i][k] - X[j][k]);
                diff += t * t;
            }

            for (int k = 0; k < 128; k++) {
                if (diff == k * k) {
                    ans++;
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
S=input()
T=input()
d={}
for i in range(len(S)):
    if S[i] not in d:
        d[S[i]]=T[i]
    else:
        if d[S[i]]!=T[i]:
            print('No')
            exit()
d={}
for i in range(len(T)):
    if T[i] not in d:
        d[T[i]]=S[i]
    else:
        if d[T[i]]!=S[i]:
            print('No')
            exit()
print('Yes')

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//

vi di = {-1, 0, 1, 0};
vi dj = {0, -1, 0, 1};

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i, h) cin >> s[i];
  int ans = 0;
  rep(si, h) rep(sj, w) {
    if (s[si][sj] == '#') continue;
    vvi dist(h, vi(w, INF));
    queue<P> q;
    auto update = [&](int i, int j, int x) {
      if (dist[i][j] != INF) return;
      dist[i][j] = x;
      q.emplace(i, j);
    };
    update(si, sj, 0);
    while (!q.empty()){
      int i = q.front().first, j = q.front().second;
      q.pop();
      rep(dir, 4) {
        int ni = i + di[dir], nj = j + dj[dir];
        if (ni<0||nj<0||ni>=h||nj>=w) continue;
        if (s[ni][nj] == '#') continue;
        update(ni, nj, dist[i][j]+1);
      }
    }
    rep(i, h) rep(j, w) {
      if (dist[i][j] == INF) continue;
      ans = max(ans, dist[i][j]);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3644
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 10000000000000000
#define mod 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

signed main() {
	int n, ans = 0;
	string s;
	cin >> n >> s;
	for (int i = 1; i < n; i++) {
		bool a[27], b[27];
		rep(j, 26) {
			a[j] = false;
			b[j] = false;
		}
		rep(j, i) {
			a[s[j] - 'a'] = true;
		}
		for (int j = i; j < n; j++) {
			b[s[j] - 'a'] = true;
		}
		int cnt = 0;
		rep(j, 26) {
			if (a[j] && b[j]) {
				cnt++;
			}
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
N=int(input())
part=[list(map(int,input().split())) for _ in range(N)]

minlst=[0]*N
maxlst=[0]*N

for i in range(N):
    minlst[i]=part[i][0]
    maxlst[i]=part[i][1]
minlst.sort()
maxlst.sort()

if N%2==1:
    left=minlst[(N+1)//2-1]
    right=maxlst[(N+1)//2-1]
else:
    left=minlst[N//2-1]+minlst[N//2]
    right=maxlst[N//2-1]+maxlst[N//2]

print(right-left+1)

Measured memory_bytes: 108468
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

char alphabet[] = {
    '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'
};

int main(){
    int N;
    cin >> N;
    bool dp[N+2][10002];
    int s[N+2], sum[N+2];
    rep(i,N+2){
        rep(j,10002){
            dp[i][j]=false;
        }
    }
    sum[0]=0;
    Rep(i,N){
        cin >> s[i];
        sum[i] = sum[i-1] + s[i];
    }

    dp[0][0] = true;
    Rep(i,N){
        rep(j,sum[i]+1){
            // if (i>=1){
                if (j >= (s[i])){
                    dp[i][j] = (dp[i-1][j] || dp[i-1][j-s[i]]);
                }else{
                    dp[i][j] = dp[i-1][j];
                }
            // }
        }
    }

    int max = 0;
    rep(i,sum[N]+1){
        if (dp[N][i]==true && i%10!=0){
            max = i;
        }
    }
    cout << max << endl;

    return 0;
}


Measured memory_bytes: 1280
using System;
using System.Collections.Generic;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var devide = new[] { "dream", "dreamer", "erase", "eraser" };
            var S = Console.ReadLine();

            var bfs = new Queue<int>();
            var can = false;
            bfs.Enqueue(0);
            while (bfs.Any())
            {
                var t = bfs.Dequeue();

                if (t == S.Length)
                {
                    can = true;
                    break;
                }

                foreach (var d in devide)
                {
                    if (S.Substring(t, Math.Min(S.Length - t, d.Length)) == d)
                    {
                        bfs.Enqueue(t + d.Length);
                    }
                }
            }

            var output = can ? "YES" : "NO";
            Console.WriteLine(output);
        }

        static int NumberOfDigits(long x)
        {
            if (x < 10) return 1;

            var result = 0;
            while (x > 0)
            {
                result++;
                x /= 10;
            }

            return result;
        }

        static int SumOfDigits(int x)
        {
            var sum = 0;
            while (x > 0)
            {
                sum += x % 10;
                x /= 10;
            }

            return sum;
        }
    }
}


Measured memory_bytes: 15580
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

int N, K;
vector<long long> x;
vector<long long> y;

/*==================================================*/
/*==================================================*/

int main() {
    cin>>N>>K;
    REP(i,0,N){
        long long a, b;
        cin>>a>>b;
        x.push_back(a);
        y.push_back(b);
    }

    //座圧
    vector<long long> vx = x;
    sort(vx.begin(), vx.end());
    vx.erase( unique(vx.begin(), vx.end()), vx.end() );
    map<long long,int> zipx; //zip[k] : ものとの座標kの圧縮座標
    map<int,long long> unzipx; //unzip[l] : 圧縮座標lのもとの座標
    REP( i, 0, vx.size() ){
      zipx[ vx[i] ] = i;
      unzipx[i] = vx[i];
    }
    vector<long long> vy = y;
    sort(vy.begin(), vy.end());
    vy.erase( unique(vy.begin(), vy.end()), vy.end() );
    map<long long,int> zipy; //zip[k] : ものとの座標kの圧縮座標
    map<int,long long> unzipy; //unzip[l] : 圧縮座標lのもとの座標
    REP( i, 0, vy.size() ){
      zipy[ vy[i] ] = i;
      unzipy[i] = vy[i];
    }

    //test
    // cout<<"unzipy >>"<<endl;
    // REP(i,0,zipy.size()){
    //     cout<<i<<": "<<unzipy[i]<<", ";
    // }cout<<endl;
    // cout<<"unzipx >>"<<endl;
    // REP(i,0,zipx.size()){
    //     cout<<i<<": "<<unzipx[i]<<", ";
    // }cout<<endl;

    long long ans = 4000000000000000005;

    REP(ii,0,zipx.size()){
        REP(jj,0,zipy.size()){
            REP(i,ii,zipx.size()){
                REP(j,jj,zipy.size()){
                    int cnt = 0;
                    REP(k,0,N){
                        if(ii <= zipx[x[k]] && zipx[x[k]] <= i && jj <= zipy[y[k]] && zipy[y[k]] <= j){
                            cnt++;
                        }
                    }
                    if(cnt >= K){
                        long long lx, ly;
                        lx = max(1LL, (unzipx[i] - unzipx[ii]));
                        ly = max(1LL, (unzipy[j] - unzipy[jj]));
                        ans = min(ans, lx*ly);
                    }
                }
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
<?php
//$N = trim(fgets(STDIN));
list($A,$B,$k) =  explode(" ",trim(fgets(STDIN)));
//$A =  explode(" ",trim(fgets(STDIN)));

$resa = max($A-$k,0);
$k = $k - max($A-$resa,0);
$resb = max($B-$k,0);
printf("%d %d\n",$resa,$resb);


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

int main(){
  string s;
  cin >> s;
  int count;
  for(int i = s.length()-2; i >= 0; i-=2){
    if(s.substr(0,i/2)==s.substr(i/2,i/2)){
      count=i;break;
    }
  }
  cout << count <<endl;
}

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

N = int(input())
BAs = []
for i in range(N):
    A,B = inpl()
    BAs.append([B,A])

BAs.sort()

now = 0
for B,A in BAs:
    now += A
    if now <= B:
        continue
    else:
        print('No')
        break
else:
    print('Yes')


Measured memory_bytes: 37472
#include <bits/stdc++.h>
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

int main()
{
    int n;
    while(cin>>n,n)
    {
        char c[n];int s[26]={0};
        REP(i,n)cin>>c[i];
        REP(i,n)
        {
            s[c[i]-'A']++;
            int max1=0,max2=0;
            int mark=0;
            REP(j,26)
            {
                if(s[j]>max1){max2=max1;max1=s[j];mark=j;}
                else if(s[j]>max2)max2=s[j];
            }
            if(max1>max2+(n-(i+1)))
            {
                cout<<(char)('A'+mark)<<" "<<i+1<<endl;
                break;
            }
            if(i==n-1)cout<<"TIE"<<endl;
        }
    }
}



Measured memory_bytes: 3092
import java.util.Scanner

object Main extends App { 
  val sc = new Scanner(System.in)
  val H, W = sc.nextInt()
  val area = Array.ofDim[Int](H+1,W+1)
  for (i <- 1 to H; j <- 1 to W) area(i)(j) = 1-sc.nextInt()
  for (i <- 0 to H) area(i)(0) = 0
  for (j <- 0 to W) area(0)(j) = 0

  class Metrix(height:Int, width:Int, area:Array[Array[Int]]) {
    val maxLength = height min width
    def solver():Int = {
      var length = 0
      for (i <- 1 to height; j <- 1 to width) {
        if (area(i)(j) > 0) {
          area(i)(j) = Seq(area(i-1)(j-1),area(i-1)(j),area(i)(j-1)).min+1
          length = length max area(i)(j)
        }
      } 
      length*length
    }
  }

  val mt = new Metrix(H,W,area)
  println(mt.solver())

}


Measured memory_bytes: 464432
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int n, d;
    cin >> n >> d;
    int x[n][d];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> x[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int dis = 0;
            for (int k = 0; k < d; k++) {
                dis += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }

            int t = sqrt(dis);
            if (t * t == dis) {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
N, K = map(int,input().split())
S = list(input())
if S[K-1] == 'A':
  S[K-1] = 'a'
elif S[K-1] == 'B':
  S[K-1] = 'b'
elif S[K-1] == 'C':
  S[K-1] = 'c'
  
print("".join(S))

Measured memory_bytes: 3064