akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N,K;
    string S;

    cin >>S>>K;
    N=S.size();


    vector<string> sb;
    rep2(j,K){
        rep(i,N-j+1){
            sb.pb(S.substr(i,j));
        }
    }
    
    sort(all(sb));
    ll inx=0;
    ll cnt=0;
    string ans;
    map<string,bool>m;

    while(1){
        if(m[sb[inx]]==0){
            cnt++;
        }
        if(cnt==K){
            ans=sb[inx];
            break;
        }
        m[sb[inx]]=1;
        inx++;
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 4320
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
#include <tuple>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> pii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int res = 0;
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] == t[i]) ++res;
  }
  cout << res << '\n';
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 1e5 + 5, S = 1 << 7, S2 = (1 << 18) / S;
 
int n, q, v[(1 << 18) + 5], w[(1 << 18) + 5];
 
int dp[S][N];
pair<int, int> val[22];
int sw[S2 + 5], sv[S2 + 5];
 
int calc(int u, int l) {
  if (u == 0)
    return 0;
  int & ret = dp[u][l];
  if (ret != -1)
    return ret;
  ret = calc(u / 2, l);
  if (l >= w[u])
    ret = max(ret, v[u] + calc(u / 2, l-w[u]));
  return ret;
}
 
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d", v+i, w+i);
  }
  memset(dp, -1, sizeof dp);
  scanf("%d", &q);
  while (q--) {
    int u, l;
    scanf("%d %d", &u, &l);
    int ans = 0;
    if (u < S) {
      ans = calc(u, l);
    } else {
      int len = 0;
      while (u >= S) {
        val[len++] = {v[u], w[u]};
        u /= 2;
      }
      int nmask = 1 << len;
      ans = calc(u, l);
      for (int mask = 1; mask < nmask; ++mask) {
        int p = __builtin_ctz(mask), bef = mask ^ (1 << p);
        int ww = sw[bef] + val[p].second;
        int vv = sv[bef] + val[p].first;
        sw[mask] = ww;
        sv[mask] = vv;
        if (ww <= l)
          ans = max(ans, vv + calc(u, l - ww));
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 55908
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,k;
  string s;
  cin >> n >> s >> k;
  for(int i=0;i<n;i++){
    if(s[i]!=s[k-1])s[i]='*';
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

int N, A, B, ans=0;
scanf("%d %d %d", &N, &A, &B);

for( int i=1; i<=N; i++ ){

    int a, b, c, d, e;

    a = i/10000;
    int a_amari = i%10000;
    b = a_amari/1000;
    int b_amari = a_amari%1000;
    c = b_amari/100;
    int c_amari = b_amari%100;
    d = c_amari/10;
    int d_amari = c_amari%10;

    e = a + b + c + d + d_amari;

    if( A<=e && e<=B ){
        ans += i;
    }
}

printf("%d\n", ans);

return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n;
    cin >> n;
    ll a[n];
    ll f[100100] = {};
    ll ma = 0;
    rep(i,n){
        cin >> a[i];
        f[a[i]]++;
        ma = max(ma, a[i]);
    }
    ll ans = 0;
    if(a[0] != 0){
        cout << ans << endl;
        return 0;
    }
    srep(i,1,n){
        if(a[i] == 0){
            cout << ans << endl;
            return 0;
        }
    }
    if(n == 1){
        cout << '1' << endl;
        return 0;
    }
    rep(i,ma+1){
        if(f[i] == 0){
            cout << ans << endl;
            return 0;
        }
    }
    ans = 1;
    ll MOD = 998244353;
    rep(i,ma){
        rep(j,f[i+1]){
            ans *= f[i];
            ans %= MOD;
        }
    }

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


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

template <typename T>
struct edge
{
    int src, to;
    T cost;

    edge(int to, T cost) : src(-1), to(to), cost(cost) {}
    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

    edge &operator=(const int &x)
    {
        to = x;
        return *this;
    }

    operator int() const { return to; }
};

//Weighted edge set
template <typename T>
using Edges = vector<edge<T>>;

//Weighted graph
template <typename T>
using WeightedGraph = vector<Edges<T>>;

template <typename T>
T Prim(WeightedGraph<T> &g)
{
    T res = 0;
    vector<bool> used(g.size(), false);
    priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>>> que;
    que.emplace(0, 0);
    while (que.empty() != true)
    {
        auto p = que.top();
        que.pop();
        if (used[p.second] == true)
            continue;
        used[p.second] = true;
        res += p.first;
        for (auto &e : g[p.second])
        {
            que.emplace(e.cost, e.to);
        }
    }
    return res;
}

int N, a, b, c, d, p1, p2;

int main()
{
    cin >> N;
    vector<pair<pair<int, int>, int>> x, y;
    WeightedGraph<int> G(N);

    for (int i = 0; i < N; i++)
    {
        scanf("%d%d", &a, &b);
        a--, b--;
        x.emplace_back(make_pair(a, b), i);
        y.emplace_back(make_pair(b, a), i);
    }

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    for (int i = 0; i + 1 < N; i++)
    {
        a = x[i].first.first, b = x[i].first.second, c = x[i + 1].first.first, d = x[i + 1].first.second, p1 = x[i].second, p2 = x[i + 1].second;
        G[p1].emplace_back(p2, min(abs(a - c), abs(b - d)));
        G[p2].emplace_back(p1, min(abs(a - c), abs(b - d)));

        a = y[i].first.first, b = y[i].first.second, c = y[i + 1].first.first, d = y[i + 1].first.second, p1 = y[i].second, p2 = y[i + 1].second;
        G[p1].emplace_back(p2, min(abs(a - c), abs(b - d)));
        G[p2].emplace_back(p1, min(abs(a - c), abs(b - d)));
    }

    printf("%d\n", Prim(G));
}

Measured memory_bytes: 14508
import sys

N = int(input())
H = list(map(int,input().split()))

if len(H)==1:
    print("Yes")
    sys.exit()
else:

    Flag = [0 for i in range(len(H))]
    x = 0

while x < len(H)-1:

    diff = H[x+1] - H[x]
    if diff < 0:
        if Flag[x]==1:
            print("No")
            sys.exit()
        else:
            Flag[x]=1
            H[x] -= 1
            x-=1
            continue
    x += 1
print("Yes")


Measured memory_bytes: 14228
import sys

N = int(sys.stdin.readline())
P = {int(sys.stdin.readline()): i for i in range(N)}
Q = [P[i] for i in range(1, N + 1)]

ans = 0
prv_q = 0
now = 0
for i in range(N):
    if prv_q > Q[i]:
        now = 0
    now += 1
    prv_q = Q[i]
    ans = max(ans, now)
print(N - ans)


Measured memory_bytes: 79064
#include<iostream>
using namespace std;
int main()
{
    int n,q;
    cin>>n;
    int S[n];
    for(int i=0;i<n;i++){cin>>S[i];}
    cin>>q;
    int T[q];
    for(int i=0;i<q;i++){cin>>T[i];}
    int k=0;
    for(int j=0;j<q;j++)
        for(int i=0;i<n;i++)
            if(S[i]==T[j])
            {
                k++;
                break;
            }
    cout<<k<<endl;
    return 0;
}

Measured memory_bytes: 3112
N = int(input())
A = input().split(" ")
for i in range(len(A)):
  A[i] = int(A[i])
C = 1000000007
mod = 0

#1
sum_A = sum(A)

for i in range(N-1):
  sum_A = sum_A - A[i]
  mod = (mod + A[i]*sum_A) % C

print(mod)

Measured memory_bytes: 25184
#!/usr/bin/env python
N, X = map(int, input().split())
M = [int(input()) for i in range(N)]
m_sum = sum(M)
rest = X - m_sum
m_min = min(M)
ans = len(M)
while rest - m_min >= 0:
    rest = rest - m_min
    ans += 1
print(ans)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Convert;
using static System.Console;
using static System.Math;
class MainClass
{
	static void Main(string[] args)
	{
		Answer();
	}
	public static void Answer()
	{
      var s = ReadLine();
      var t = ReadLine();
      var ss = "";
      var tt = "";
      for(char c = 'a'; c <= 'z'; c++)
      {
        for(int i = 0; i < s.Length; i++)
        {
          if (s[i] == c) ss += c;
        }
      }
      for(char c = 'z'; 'a' <= c; c--)
      {
        for(int i = 0; i < t.Length;i++)
        {
          if (t[i] == c) tt += c;
        }
      }

      int min = s.Length < t.Length ? s.Length : t.Length;
      for(int i = 0; i < min; i++)
      {
        if (ss[i] < tt[i])
        {
          WriteLine("Yes");
          return;
        }
        else if (tt[i] < ss[i])
        {
          WriteLine("No");
          return;
        }
      }
      WriteLine(s.Length < t.Length ? "Yes" : "No");
	}
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
using graph = vector<vector<int>>;

int main() {
  int h, w, res=0;
  cin >> h >> w;
  int n = (h+1)*(w+1);
  vector<vector<char>> m(h+1, vector<char>(w+1, '#'));
  graph g(n);
  int a, b;
  for(int i=1;i<=h;++i) for(int j=1;j<=w;++j) {
    cin >> m[i][j];
    if(m[i][j]=='.'){
      a=i*w+j;
      if(m[i-1][j]=='.'){
        b=(i-1)*w+j;
        g[a].push_back(b);
        g[b].push_back(a);
      }
      if(m[i][j-1]=='.'){
        b=i*w+j-1;
        g[a].push_back(b);
        g[b].push_back(a);
      }
    }
  }
  auto dfs = [&](int start){
    int res=0;
    vector<int> dist(n,-1);
    queue<int> q;
    dist[start] = 0;
    q.push(start);
    while(!q.empty()) {
      int v=q.front();
      q.pop();
      for(int p:g[v]) {
        if(dist[p]!=-1) continue;
        dist[p]=dist[v]+1;
        res=dist[p]>res?dist[p]:res;
        q.push(p);
      }
    }
    return res;
  };
  for(int i=1;i<=h;++i) for(int j=1;j<=w;++j) {
    if(m[i][j]=='#') continue;
    res=max(res,dfs(i*w+j));
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define sz(v) (int) v.size()
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i , n; ++i)

using namespace std;

typedef pair <int, int> ii;
const int maxn = 1e5 + 10;

int n;
int sz[maxn], big[maxn];
long long depth[maxn];
vector <ii> adj[maxn];

void dfs(int u, int p) {
    sz[u] = 1; big[u] = 0;
    for (auto it : adj[u]) if (it.second != p) {
        depth[it.second] = depth[u] + it.first;
        dfs(it.second, u);
        sz[u] += sz[it.second];
        if (sz[big[u]] < sz[it.second]) big[u] = it.second;
    }
}

int findCentroid(int u) {
    dfs(u, u);
    int siz = sz[u] >> 1;
    while (sz[big[u]] > siz) u = big[u];
    return u;
}

int main() {
  //  freopen("input.in", "r", stdin);
 //   freopen("output.out", "w", stdout);

    scanf("%d", &n);
    for (int i = 0; i < n - 1; ++i) {
        int u, v, w; scanf("%d%d%d", &u, &v, &w);
        adj[u].push_back(ii(w, v));
        adj[v].push_back(ii(w, u));
    }

    int r = findCentroid(1);
    sz[r] = 0; depth[r] = 0;
    dfs(r, r);
    long long ans = 0, mn = 1e18;
    FOR(i, 1, n) ans += depth[i];
    for (auto it : adj[r]) {
        mn = min(mn, 1ll * it.first);
        if (sz[it.second] == (n + 1) >> 1) {
            mn = it.first;
            break;
        }
    }
    printf("%lld\n", 2 * ans - mn);

    return 0;
}


Measured memory_bytes: 13952
#include "bits/stdc++.h"
using namespace std;

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/09/23  Problem: 004_agc_c  / Link:   ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL H, W;

LL ans = 0LL;

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

	cin >> H >> W;
	VS s(H);
	VS a(H);
	VS b(H);
	FOR(i, 0, H) {
		cin >> s[i];
		//a[i] = b[i] = s[i];
	}
	FOR(i, 0, H) {
		a[i] = b[i] = string(W, '.');
		if (i % 2 == 0)a[i] = string(W, '#'),a[i][0]='.';
		else if (i % 2 == 1)b[i] = string(W, '#'),b[i][W-1]='.';
	}


	FOR(i, 1, H - 1) {
		a[i][W - 1] = '#';
		b[i][0] = '#';
	}
	a[0][0] = '#';
	if(H%2==0)b[H-1][W-1] = '#';
	b[H-1][0] = '#';

	FOR(i, 0, H) {
		FOR(j, 0, W) {
			if (s[i][j] == '#') {
				a[i][j] = '#';
				b[i][j] = '#';
			}
		}
	}
	FOR(i, 0, H) {
		cout << a[i] << endl;
	}
	cout << endl;
	FOR(i, 0, H) {
		cout << b[i] << endl;
	}

	
	//cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define MOD 1000000007
#define MOD2 1000000006
#define TEMPMOD1 998244353
#define TEMPMOD2 998244352
#define INF 1000000000000000007
#define NEGINF -1000000000000000007
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define plll pair<ll,pll>
#define vpll vector<pll>
using namespace std;
typedef long long int ll;

ll parent[100010];
ll rank1[100010];
ll vertice,edge;

ll currans;

ll find_parent(ll vert)
{
    if(parent[vert]==vert)
    {
        return  vert;
    }
    parent[vert]=find_parent(parent[vert]);
    return parent[vert];
}

void union_set(ll vert1,ll vert2)
{
    vert1=find_parent(vert1);
    vert2=find_parent(vert2);
    if(vert2==vert1)
    {
        return;
    }
    currans-=(rank1[vert1]*rank1[vert2]);
    if(rank1[vert1]>rank1[vert2])
    {
        parent[vert2]=vert1;
        rank1[vert1]+=rank1[vert2];
    }
    else
    {
        parent[vert1]=vert2;
        rank1[vert2]+=rank1[vert1];
    }
    return;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    cin>>vertice>>edge;
    pll edgeends[edge];
    for(ll i=1;i<=vertice;i++)
    {
        parent[i]=i;
        rank1[i]=1;
    }
    for(ll i=0;i<edge;i++)
    {
        cin>>edgeends[i].first>>edgeends[i].second;
    }
    currans=vertice*(vertice-1)/2;
    ll final[edge];
    reverse(edgeends,edgeends+edge);
    for(ll i=0;i<edge;i++)
    {
        final[i]=currans;
        union_set(edgeends[i].first,edgeends[i].second);
    }
    for(ll i=edge-1;i>=0;i--)
    {
        cout<<final[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 5248
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct P{
  int x,y;
  P(int x,int y):x(x),y(y){}
};
int n;
bool f[5555][5555];
vector<P> pill;

bool c(int a){
  return (0 <= a && a <= 5000);
}

int main(void)
{
  while(1){
    cin >> n;
    if(!n) break;
    memset(f, false, sizeof(f));
    pill.clear();
    for(int i = 0; i < n; i++){
      int x,y;
      cin >> x >> y;
      f[x][y] = true;
      pill.push_back(P(x,y));
    }

    int ret = 0;
    for(int i = 0; i < (int)pill.size(); i++){
      for(int j = 0; j < (int)pill.size(); j++){
	P p1 = pill[i];
	P p2 = pill[j];
	int dix = p1.x - p2.x;
	int diy = p1.y - p2.y;
	if( (c(p1.x - diy) && c(p1.y + dix) && c(p2.x - diy) && c(p2.y + dix) && 
	     f[p1.x - diy][p1.y + dix] && f[p2.x - diy][p2.y + dix]) ||
	    (c(p1.x + diy) && c(p1.y - dix) && c(p2.x + diy) && c(p2.y - dix) && 
	     f[p1.x + diy][p1.y - dix] && f[p2.x + diy][p2.y - dix]) ){
	  ret = max(ret, dix * dix + diy * diy);
	}
      }
    } 
    cout << ret << endl;
  }
}

Measured memory_bytes: 31396
class Solver
  attr_reader :a, :p, :r

  def initialize(a, p, r)
    @a = a
    @p = p
    @r = r
  end

  def exec
    x = a.pop
    i = p-1

    (p..r-1).each do |j|
      if a[j] <= x
        i += 1
        a[i], a[j] = a[j], a[i]
      end
    end

    a[i+1], a[r] = a[r], a[i+1]
    a[i+1] = "[#{x}]"
    puts_result
  end

  def puts_result
    puts a.join(' ')
  end
end

r = gets.to_i
a = gets.split(' ').map(&:to_i)

Solver.new(a, 0, r-1).exec


Measured memory_bytes: 13964
a,b,c,x,y = map(int,input().split())
# print(a,b,c,x,y)

#Cについての全列挙する
v1 = max(x*2,y*2)*c
v2 = a*x+b*y
v3=120000*100000
for i in range(max(x,y)+1):
    c_sum = c*2*(i)
    if x > i:
        c_sum += a*(x-i)
    if y > i:
        c_sum += b*(y-i)
    if c_sum < v3:
        v3 = c_sum
    # print(c_sum)

 # print(v1,v2,v3)
print(min(v1,v2,v3))


Measured memory_bytes: 3060
import math


def resolve():

    S = input()
    N = len(S)
    ans = 0

    for i in range(N):
        for j in range(i, N):
            if all('ACGT'.count(c) == 1 for c in S[i: j + 1]):
                ans = max(ans, j - i + 1)
    print(ans)



if __name__ == "__main__":
    resolve()


Measured memory_bytes: 8904
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll N, W, w, v, cw, nv, nw, base;
  cin >> N >> W;
  vector<pair<ll, ll>> wv(N);
  vector<ll> cache(10e+5 + 1, 10e+9 + 1);
  cache[0] = 0;
  for (ll i = 0; i < N; i++) {
    cin >> w >> v;
    wv[i] = make_pair(w, v);
  }
  sort(wv.rbegin(), wv.rend());

  for (auto &item : wv) {
    w = get<0>(item);
    v = get<1>(item);

    for (ll cv = cache.size(); cv >= 0; --cv) {
      base = max(cv - v, 0ll);
      cache[cv] = min(cache[cv], cache[base] + w);
    }
  }

  for (ll i = cache.size() - 1; i >= 0; i--) {
    if (cache[i] <= W) {
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 10696
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner kb = new Scanner(System.in);
		
		int n = kb.nextInt(), maxw = kb.nextInt();
		
		int[] w = new int[n];
		int[] v = new int[n];
		
		for(int i = 0 ; i < n; i++) {
			w[i] = kb.nextInt();
			v[i] = kb.nextInt();
		}
		System.out.println(dp(maxw, w, v));
	}
	static long dp(int maxw, int[] w, int[] v) {
		long[][] cache = new long[2][maxw+1];
		int pre = 0, cur = 1;
		
		for(int i = 1; i <= w.length; i++) {
			for(int x = 0; x <= maxw; x++) {
				if(w[i-1] > x) {
					cache[cur][x] = cache[pre][x];
				}else {
					cache[cur][x] = Math.max(cache[pre][x], cache[pre][x-w[i-1]]+v[i-1]);
				}
			}
			int temp = cur;
			cur = pre;
			pre = temp;
		}
		return cache[pre][maxw];
	}
}


Measured memory_bytes: 24148
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() 
{

    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    for(ll i=0;i<n;i++)
        cin>>a[i];
    vector<ll> dp(n,INT_MAX);
    dp[0]=0;dp[1]=abs(a[0]-a[1]);
    for(ll i=2;i<n;i++)
        for(int j=1;j<=k;j++)
            if(i-j>=0)
                dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
    cout<<dp[n-1];
}

Measured memory_bytes: 1792
s = input()

flg = 0

for i in range(len(s)):
    if i % 2 == 0 and (s[i] != "R" and s[i] != "U" and s[i] != "D"):
        flg = 1
    elif i % 2 == 1 and (s[i] != "L" and s[i] != "U" and s[i] != "D"):
        flg = 1
    else:
        continue

if flg == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long 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;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
#define M 1046527

long long INF = 1LL<<60;

int getchar(char x){
    if(x=='A')return 1;
    else if(x=='C')return 2;
    else if(x=='G')return 3;
    else if(x=='T')return 4;
    else return 0;
}

ll getkey(string x){
    ll res=0;
    ll c=1;
    rep(i,0,x.size()){
    res+=c*getchar(x[i]);
    c*=5;
    }
    return res;
}

int h1(ll key){
    return key%M;
}
int h2(ll key){
    return 1+key%(M-1);
}
string table[M];

//返り値：要素があったら1，無かったら0
int find(string s){
    ll key=getkey(s),i=0;
    while(true){
        ll hash=(h1(key)+i*h2(key))%M;
        if(table[hash]==s)return 1;
        else if(table[hash].length()==0)return 0;
        i++;
    }
    return 0;
}
//返り値:すでに登録されてたら1,新規登録で0
int insert(string s){
    ll key=getkey(s),i=0;
    while(true){
        ll hash=(h1(key)+i*h2(key))%M;
        if(table[hash].length()==0){
            table[hash]=s;
            return 0;
        }
        else if(table[hash]==s){
            return 1;
        }
        i++;
    }
    return 0;
}
int main( ){
    int n;
    cin>>n;
    rep(i,0,n){
        string cmd,key;
        cin>>cmd>>key;
        if(cmd=="insert"){
            if(find(key))continue;
            else insert(key);
        }
        else {
            if(find(key))cout<<"yes"<<endl;
            else cout<<"no"<<endl;
        }
    }
    return 0;
}





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

int main() {
	string s;
	char c;
	for(int i=0; i<4; i++){
		cin >> c;
		cout << c;
	}
	cout << ' ';
	for(int i=0; i<8; i++){
		cin >> c;
		cout << c;
	}
	cout << endl;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup cin.tie(0);ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int main()
{
    ciosup;
    string s;
    cin >> s;

    bool flag = false;
    REP(i, 3)
    {
        if (s[i] == s[i + 1])
            flag = true;
    }

    if (flag){
        cout << "Bad" << endl;
    }else{
        cout << "Good" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
const int N = (int)3e5;
const int INF = (int)2e9;
int a[N];
map<int, int> used;
int main() {
    ios_base::sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    reverse(a + 1, a + n + 1);
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (used[a[i]] > 0) {
            used[a[i]]--;
            ans++;
        }
        else {
            int j = 1;
            while (j <= a[i]) {
                j = j * 2;
            }
            used[j - a[i]]++;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

int main() {
  ll n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }
  // 1回の転倒数計算
  ll rev = 0;
  ll same = 0;
  ll ok = 0;
  rep(i,n){
    for(int j=i+1; j<n; j++){
      if (a[i]>a[j]) rev++;
      if (a[i]==a[j]) same++;
      if (a[i]<a[j]) ok++;
    }
  }
  ll ans = rev*k%MOD*(k+1)%MOD*500000004%MOD+ok*k%MOD*(k-1)%MOD*500000004%MOD;
  ans %= MOD;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
[N,X] = list(map(int,input().split(' ')))

def paty(n,x):
  #print('n:{}'.format(n))
  #print('x:{}'.format(x))
  if x == 0:
    return 0
  if n == 0:
    return x
  elif ((2**(n+2))-3 - 1) / 2 >= x:
    return paty(n-1,x-1)
  elif ((2**(n+2))-3 + 1) / 2 == x:
    return 2**n
  elif ((2**(n+2))-3) - 1 <= x:
    return 2**(n+1) - 1
  else:
    return 2**n + paty(n-1, x-((2**(n+1))-3) -2)
  
ans = paty(N,X)
print(ans)

Measured memory_bytes: 3064
from sys import stdin

N, M, C = map(int, stdin.readline().split())
B = list(map(int, stdin.readline().split()))
ans = 0
for i in range(N):
  A = list(map(int, stdin.readline().split()))
  temp = 0
  for j in range(M):
    temp += (A[j] * B[j])
  if temp + C > 0:
    ans += 1

print(ans)

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



int main(void){
int x;scanf("%d",&x);
int min=0;

for(int i=2;i<=x+1;i++){
    for(int j=1;i<=x+1;j++){
        if(pow(j,i)>=min&&pow(j,i)<=x){min=pow(j,i);}
        if(pow(j,i)>x){break;}
    }
}
printf("%d\n",min);


}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main () {
	int a , b , c , count;
	cin >> a >> b >> c ;
	for (int i=a;i<=b;i++) {
		if ( c%i==0 ) {
			count = count + 1;
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3108
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 200020
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
int n,m,k,a[N],b[N],ans,sum;
int main(){
	n=read(),m=read(),k=read();
	for(int i=1;i<=n;++i){
		a[i]=read();
	}
	for(int i=1;i<=m;++i){
		b[i]=read();
	} 
	int h=0,pos=0;
	while(h<n&&sum+a[h+1]<=k)++h,sum+=a[h];
	ans=h;
	for(int i=h;i>=0;--i){
		while(pos<m&&sum+b[pos+1]<=k)++pos,sum+=b[pos];
		ans=max(ans,pos+i);
		sum-=a[i];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5180
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

H,W = map(int,input().split())
S = [input().rstrip() for _ in range(H)]
ans = 0
for hi in range(H):
    for wi in range(W):
        flag = 0
        if S[hi][wi] =='.':
            flag = 1
            tmp = [hi,wi]
    
            cost = [[-1]*W for _ in range(H)]
            q = collections.deque([tmp])
            cost[tmp[0]][tmp[1]] = 0
            while q:
                now = q.popleft()
                if 0<= now[0]+1 < H:
                    if cost[now[0]+1][now[1]] == -1 and S[now[0]+1][now[1]] =='.':
                        cost[now[0]+1][now[1]] = cost[now[0]][now[1]] +1
                        q.append([now[0]+1,now[1]])

                if 0<= now[0]-1 < H:
                    if cost[now[0]-1][now[1]] == -1 and S[now[0]-1][now[1]] =='.':
                        cost[now[0]-1][now[1]] = cost[now[0]][now[1]] +1
                        q.append([now[0]-1,now[1]])

                if 0<=now[1]+1 < W:
                    if cost[now[0]][now[1]+1] == -1 and S[now[0]][now[1]+1] =='.':
                        cost[now[0]][now[1]+1] = cost[now[0]][now[1]] +1
                        q.append([now[0],now[1]+1])

                if 0<=now[1]-1 < W:
                    if cost[now[0]][now[1]-1] == -1 and S[now[0]][now[1]-1] =='.':
                        cost[now[0]][now[1]-1] = cost[now[0]][now[1]] +1
                        q.append([now[0],now[1]-1])

            ans = max(ans,cost[now[0]][now[1]])

            cost = [[-1]*W for _ in range(H)]
            q = collections.deque([tmp])
            cost[now[0]][now[1]] = 0
            while q:
                now = q.popleft()
                if 0<= now[0]+1 < H:
                    if cost[now[0]+1][now[1]] == -1 and S[now[0]+1][now[1]] =='.':
                        cost[now[0]+1][now[1]] = cost[now[0]][now[1]] +1
                        q.append([now[0]+1,now[1]])

                if 0<= now[0]-1 < H:
                    if cost[now[0]-1][now[1]] == -1 and S[now[0]-1][now[1]] =='.':
                        cost[now[0]-1][now[1]] = cost[now[0]][now[1]] +1
                        q.append([now[0]-1,now[1]])

                if 0<=now[1]+1 < W:
                    if cost[now[0]][now[1]+1] == -1 and S[now[0]][now[1]+1] =='.':
                        cost[now[0]][now[1]+1] = cost[now[0]][now[1]] +1
                        q.append([now[0],now[1]+1])

                if 0<=now[1]-1 < W:
                    if cost[now[0]][now[1]-1] == -1 and S[now[0]][now[1]-1] =='.':
                        cost[now[0]][now[1]-1] = cost[now[0]][now[1]] +1
                        q.append([now[0],now[1]-1])
            
    if flag == 1:
        ans = max(ans,cost[now[0]][now[1]])
        
print(ans)



Measured memory_bytes: 26912
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        if(N==1){
            System.out.println("Hello World");
        }else{
            int A=sc.nextInt();
            int B=sc.nextInt();
            System.out.println(A+B);
        }
    }
}


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

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

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
using V = vector<ll>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll hcnt[300005],wcnt[300005];

int main() {
  string S;
  ll K;
  cin>>S>>K;
  ll p = -1,c = 0;
  int l = S.size();
  rep(i,l) {
    if(S[i]!='1') {
      p = i;
      c = S[i] - '0';
      break;
    }
  }
  if(p+1>K||c==0) cout<<1<<endl;
  else cout<<c<<endl;
}

Measured memory_bytes: 3612
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

N,*A = map(int,read().split())

answer = 0
for _,it in itertools.groupby(A):
    x = len(list(it))
    answer += x//2

print(answer)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  
  long long num, x, sum, lowest=999999999999999999.9999;
  vector<long long> list;
  cin >> num;
  for (long long i=1; i<=num; i++) {
    cin >> x;
    list.push_back(x);}
  for (long long i=1; i<=100; i++) {
    sum=0;
    for (long long t=0; t<num; t++) {
      sum+=(list[t]-i)*(list[t]-i);}
    if (sum<lowest) {lowest=sum;}}
  cout << lowest;}

Measured memory_bytes: 3636
#include <stdio.h>

int main(void){

  int M1, M2, D1, D2;
  scanf("%d %d",&M1,&D1);
  scanf("%d %d",&M2,&D2);
  
  if(M1!=M2)  printf("1");
  
  else printf("0");
  
  return 0;
}


Measured memory_bytes: 1608
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007LL
#define INF 5000000000000000000
#define PI 3.1415926

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

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T> inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int a, b, c; cin >> a >> b >> c;
	cout << min(b/a, c) << endl;

	return 0;
}

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

#define Sort(ob,n) sort(ob,ob+n)
#define SorT(ob) sort(ob.begin(),ob.end())
#define rev(ob) reverse(ob.begin(),ob.end())
#define pb push_back
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define fi(start,End,I) for(int i=start; i<=End; i+=I)
#define PII pair<int,int>
#define fr first
#define se second


int main()
{
    fast;

    int n,L,a,ok=0,neg=0,pos=0,zero=0;
    cin >> n >> L;
    int ara[n+3];

    fi(0,n-1,1){
        //cin >> a;
        a = (i+1)+L-1;
        ara[i] = a;
        if(a == 0) zero=1;
        if(a>0) pos=1;
        if(a<0) neg=1;
    }

    Sort(ara,n);

    int sum=0,ig;
    if(pos && !zero && !neg){
        fi(0,n-1,1){
            if(i != 0){
                sum+=ara[i];
            }
        }
        cout << sum << "\n";
        return 0;
    }
    else if(!pos && !zero && neg){
        fi(0,n-1,1){
        if(i!=n-1){
            sum+=ara[i];
        }
        }
        cout << sum << "\n";
        return 0;
    }
    else if(zero){
        fi(0,n-1,1){
            sum+=ara[i];
        }
        cout << sum << "\n";
        return 0;
    }
    else if(!zero && pos && neg){
        fi(0,n-1,1){
            sum+=ara[i];
            if(ara[i-1]<0 && ara[i+1]>0) sum-=ara[i-1];
        }
        cout << sum << "\n";
        return 0;
    }















    return 0;
}


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

using namespace std;

inline int adj(int x) {
  return min(max(x, 0), 255);
}
#define SQ(x) ((x)*(x))
int dp[2][256];
int main() {
  int N, M, INF=1<<28;
  while(cin >> N >> M && (N|M)) {
    int C[M];
    for(int i=0; i<M; i++) cin >> C[i];
    fill(dp[0], dp[0]+512, INF);
    dp[0][128] = 0;
    for(int k=0; k<N; k++) {
      for(int i=0; i<256; i++) dp[(k+1)%2][i] = INF;
      int in; cin >> in;
      for(int i=0; i<256; i++) {
        if(dp[k%2][i]>=INF) continue;
        for(int j=0; j<M; j++) {
          dp[(k+1)%2][adj(i+C[j])] = min(dp[(k+1)%2][adj(i+C[j])], dp[k%2][i]+SQ(in-adj(i+C[j])));
        }
      }
    }
    cout << *min_element(dp[N%2], dp[(N%2)+1]) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1160
n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
x_interval = []
for i in range(m-1):
    x_interval.append(x[i+1] - x[i])
x_interval.sort()
if m >= n:
    print(sum(x_interval[0:m-n]))
else:
    print(0)



Measured memory_bytes: 13968
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 200010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int y, m, d;
    y = stoi(s.substr(0, 4));
    m = stoi(s.substr(5, 2));
    d = stoi(s.substr(8, 2));
    int date = y * 10000 + m * 100 + d;
    cout << (date <= 20190430 ? "Heisei" : "TBD") << endl;
    return 0;
}

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

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	if(a==b+c)
	cout << "Yes" << endl;
	else if(b==a+c)
		cout << "Yes" << endl;
		else if(c==a+b)
			cout << "Yes" << endl;
			else
			cout <<"No"  << endl;
			
				
	return 0;
}

Measured memory_bytes: 256
package main
import (
	"fmt"
	"bufio"
	"os"
)

func main() {
	var h, w int // 縦と横の長さ格納用
	fmt.Scan(&h, &w)
	var a = make([][]byte, h) // マス目格納用
	var d = make([][]int, h) // 黒マスからの距離格納用
	reader := bufio.NewReaderSize(os.Stdin, 1024) // 文字列読み込みリーダ
	for y := 0; y < h; y++ {
		l, _, _ := reader.ReadLine()
		a[y] = make([]byte, w)
		d[y] = make([]int, w)
		copy(a[y], l)
		for x := 0; x < w; x++ {
			if a[y][x] == '.' {
				d[y][x] = 1000000007
			}
		}
	}
	// 距離の更新　左上から右下へ行うので逆からも行う必要がある
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if i > 0 {
				d[i][j] = min(d[i][j], d[i-1][j] + 1)
			}
			if j > 0 {
				d[i][j] = min(d[i][j], d[i][j-1] + 1)
			}
		}
	}
	for i := h-1; i >= 0; i-- {
		for j := w-1; j >= 0; j-- {
			if i < h-1 {
				d[i][j] = min(d[i][j], d[i+1][j] + 1)
			}
			if j < w-1 {
				d[i][j] = min(d[i][j], d[i][j+1] + 1)
			}
		}
	}
	// 答えを捜索
	ans := 0
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			ans = max(d[i][j], ans)
		}
	}

	fmt.Println(ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 10112
main()
{
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if(a==b)
  {
    printf("%d\n",c);
  }
  else if(a==c)
  {
    printf("%d\n",b);
  }
  else
  {
	printf("%d\n",a);
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int a = sc.nextInt();
		int [] in = new int [a];
        String [] str = new String [a];
        int [] b = new int [a];
        for(int i=0;i<a;i++){str[i] = sc.next();
                             in[i] = sc.nextInt();
                            }	
        for(int i=0;i<a;i++){int ans = 0;
                             for(int j=0;j<a;j++){
          if((str[i]).compareTo(str[j])>0){ans++;}
          if(str[i].equals(str[j])&&in[i]<in[j]){ans++;}                                                            
                                                  }                   
                             b[ans]=i+1; 
                            }
	for(int i=0;i<a;i++){System.out.println(b[i]);}
  }
}

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

#define RIGHT '>'
#define LEFT '<'
#define TOP '^'
#define UNDER 'v'
#define LOOP 'l'
#define END '.'
#define MAX 101

void dfs(char mp[MAX][MAX],int i,int j){
    if(mp[i][j]==END){
        cout << j << ' ' << i << endl;
        return;
    }
    if(mp[i][j]==LOOP){
        cout << "LOOP" << endl;
        return;
    }
    
    if(mp[i][j]==RIGHT){
        mp[i][j] = LOOP;
        dfs(mp,i,j+1);
    }
    else if(mp[i][j]==LEFT){
        mp[i][j] = LOOP;
        dfs(mp,i,j-1);
    }
    else if(mp[i][j]==TOP){
        mp[i][j] = LOOP;
        dfs(mp,i-1,j);
    }
    else{
        mp[i][j] = LOOP;
        dfs(mp,i+1,j);
    }
}


int main(){
    char mp[MAX][MAX];
    int n,m;
    
    while(true){
        cin >> n >> m;
        if(!n&&!m) break;
        
        for(int i = 0 ; i < n ; i++)
            for(int j = 0 ; j < m ; j++)
                cin >> mp[i][j];
        
        dfs(mp,0,0);
    }
    
    return 0;
}

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

using namespace std;

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

const double PI=3.14159265358979323846;

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

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

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

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n, k;
    cin >> n >> k;

    vector< bool > cnt(n, false);
    rep (i, k)
    {
        int d;
        cin >> d;
        rep (j, d)
        {
            int a;
            cin >> a;
            cnt[a - 1] = true;
        }
    }

    int ans = 0;
    rep (i, n)
    {
        if (!cnt[i]) ++ans;
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 3660
#include <cstdio>
#include <iostream>
#include <queue>
using namespace std;

deque<int> x;

const int Q=300007;

int v[Q];

int main()
{
	//freopen("data.in","r",stdin);
	int dir=1;

	int n;
	cin>>n;

	int r;

	for(int i=1; i<=n; i++)
	{
		cin>>r;
		if(dir==1)
		{
			x.push_back(r);
			dir=2;
		}
		else
		{
			x.push_front(r);
			dir=1;
		}
	}	

		for(auto it:x)
		{
			v[++v[0]]=it;
		}

	if(dir==1)
	{
		for(int i=1; i<=n; i++)
		{
			cout<<v[i]<<" ";
		}
	}
	else
	{
		for(int i=n; i>0; i--)
		{
			cout<<v[i]<<" ";
		}
	}




}

Measured memory_bytes: 3840
N, Y = (int(i) for i in input().split())
flag = 0

for x in range(N+1):

	for y in range(N+1 - x):
			z = N - (x+y)
			if Y == 10000 * x + 5000 * y + 1000 * z:
				print(x ,y ,z)
				flag = 1
				break

	if flag == 1:
		break

if flag == 0:
	print(-1, -1, -1)

Measured memory_bytes: 3064
n, k, q = (int(x) for x in input().split())

dict = {}
for _ in range(q):
    s = int(input())
    if s in dict.keys():
        dict[s]+=1
    else :
        dict[s]=1
for i in range(1, n+1):
    if not(i in dict.keys()):
        dict[i]=0

for i in range(1, n+1):
    if not(i in dict.keys()):
        print('No')
    elif k-(q-dict[i]) <= 0:
        print('No')
    else :
        print('Yes')

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

int main()
{
    string s;
    cin >> s;

    int ans = 0;
    for (char c : s)
    {
        int i = c - '0';
        ans = (ans + i) % 9;
    }
    if (ans == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vi v(n);
	REP(i, n)cin >> v[i];
	vi cnt(100002, 0);
	REP(i, n) {
		cnt[v[i]]++;
		cnt[v[i] + 1]++;
		if (v[i] != 0)cnt[v[i] - 1]++;
	}
	int ans = -1;
	REP(i, cnt.size())ans = max(ans, cnt[i]);
	cout << ans << endl;
}


Measured memory_bytes: 1024