akhauriyash/Code-Regression huggingface dataset:
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T& v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

const int INF = 20000000;

void dfs(int v, int p, vector<int> &dist, vector<int> G[]) {
  if (dist[v] != INF) return;
  if (p != -1) dist[v] = dist[p] + 1;
  else dist[v] = 0;
  for (auto&u: G[v]) {
    if (dist[u] != INF) continue;
    dfs(u, v, dist, G);
  }
}

void solve(int n, int s, int t, vector<int> &fromS, vector<int> fromT, vector<int> G[]) {
  vector<bool> done(n, false);
  priority_queue<pair<int, int> > Qs, Qt;
  Qs.push({ fromT[s], s });
  Qt.push({ fromS[t], t });
  while (Qs.size() and Qt.size()) {
    auto qs = Qs.top(); Qs.pop();
    while (done[qs.second] and Qs.size()) {
      qs = Qs.top(); Qs.pop();
    }
    if (done[qs.second]) {
      print("Snuke");
      return;
    }
    done[qs.second] = true;
    
    auto qt = Qt.top(); Qt.pop();
    while (done[qt.second] and Qt.size()) {
      qt = Qt.top(); Qt.pop();
    }
    if (done[qt.second]) {
      print("Fennec");
      return;
    }
    done[qt.second] = true;
    
    // print("Fennec", " ");
    // print(qs.second+1);
    // print("Snuke", " ");
    // print(qt.second+1);
    {
      for (auto &&u: G[qs.second]) {
        if (done[u]) continue;
        Qs.push({ -fromT[u], u }); // Tに近い方から取る.
      }
    }
    {
      for (auto &&u: G[qt.second]) {
        if (done[u]) continue;
        Qt.push({ -fromS[u], u }); // Sに近い方から取る.
      }
    }
  }
  
  if (Qs.size()) print("Fennec");
  else print("Snuke");
}


/*
 Fennec、Snukeそれぞれにより近い点を数える.
 Fennecの方が真に大きければFennecの勝ち.
 等しい場合は、Fennec->Snukeという順番だとFennecが先に塗れなくなるのでSnukeの勝ち.
*/
void solve2(int n, int s, int t, vector<int> &fromS, vector<int> &fromT, vector<int> G[]) {
  int fennec = 0;
  loop(i,0,n) {
    // TよりもSに近いところはFennecが取れる.
    fennec += fromS[i] <= fromT[i];
  }
  int snuke = n-fennec;
  if (fennec > snuke) print("Fennec");
  else print("Snuke");
}

int main() {
  int n;in(n);
  vector<int> G[n];
  loop(i,0,n-1) {
    int a, b; in(a),in(b);
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  int s = 0, t = n-1;
  vector<int> fromS(n, INF), fromT(n, INF);
  dfs(s, -1, fromS, G);
  dfs(t, -1, fromT, G);
  
  solve(n, s, t, fromS, fromT, G);
  return 0;
}


Measured memory_bytes: 14620
#include<cstdio>
using namespace std;
int cnt[200100];
int b[200100];
int a[200100];
int main(){
//	freopen("C.in","r",stdin);
	int ans=0;
	int n,m;
	scanf("%d%d",&n,&m);
	int x,y;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		cnt[a[i]]++;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=cnt[i];j++)
			if(i-j+1>=1)
				b[i-j+1]++;
	for(int i=1;i<=n;i++)
		if(b[i]) ans++;
	while(m--){
		scanf("%d%d",&x,&y);
		if(a[x]-cnt[a[x]]+1>0){
			b[a[x]-cnt[a[x]]+1]--;
			if(b[a[x]-cnt[a[x]]+1]==0) ans--;
		}
		cnt[a[x]]--;
		a[x]=y;
		cnt[a[x]]++;
		if(a[x]-cnt[a[x]]+1>0){
			if(b[a[x]-cnt[a[x]]+1]==0) ans++;
			b[a[x]-cnt[a[x]]+1]++;
		}
		printf("%d\n",n-ans);
	}
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	string s;
	cin>>s;
	int n=s.size();
	bool ok=true;
	REP(i, n){
		if(i&1){
			if(s[i]=='R'){
				ok=false;
				break;
			}
		}
		else{
			if(s[i]=='L'){
				ok=false;
				break;
			}
		}
	}
	cout<<(ok ? "Yes" : "No")<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

int frq[123];
int main(){
	Lancer();
	ll n, t, sum=0;
	cin >> n;
	t = n;
	while (t)
	{
		sum += (t % 10);
		t /= 10;
	}
	if (n%sum == 0)
		cout << "Yes";
	else
		cout << "No";
	cout << endl;
	return 0;
}


Measured memory_bytes: 3696
import java.util.NoSuchElementException;
import java.util.Scanner;

public class  Main {
    private static int N = 1000;
    private static int S = 100;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int ap = 0, bp = 0;
            int n = Integer.parseInt(sc.nextLine());
            while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            }
            System.out.println(ap + " " + bp);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }
}



Measured memory_bytes: 31284
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d,e;
  for(int n=0;n<4;n++){
    cin >>a>>b;
    if(a==1) cout <<b*6000<<'\n';
    if(a==2) cout <<b*4000<<'\n';
    if(a==3) cout <<b*3000<<'\n';
    if(a==4) cout <<b*2000<<'\n';
  }
  return (0);
}



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

int main(){
    char c;
    cin >> c;
    vector<char> v{'a', 'e', 'i', 'o', 'u'};
    if (find(v.begin(), v.end(), c) != v.end()) {
        cout << "vowel" << "\n";
    }
    else {
        cout << "consonant" << "\n";
    }
}

Measured memory_bytes: 256
//=template===================================================================//
// include
#include <vector>
#include <list>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <map>

// namespace
using namespace std;

// define
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(i,n) FOR(i,0,n)
#define MIN_V(v) *min_element(v.begin(), v.end())
#define MAX_V(v) *max_element(v.begin(), v.end())

// typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef long long LL;
typedef unsigned long long ULL;
typedef struct {
  LL cost;
  bool done;
} node_t;

// conversion
inline int
toInt(string s)
{
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline int countChar(string s, char c) {int cnt,i; cnt=0; REP (i,s.size()) {if (s[i]==c) cnt++;} return cnt;}
template<class T> inline string toString(T x) {ostringstream sout; sout<<x; return sout.str();}
//============================================================================//

//=function prototype=========================================================//

//============================================================================//

//=variables==================================================================//

//============================================================================//
int main(void)
{
  // Scan begin.
  int x, y;
  cin >> x >> y;
  // Scan done.

  // Code begin.
  int i;
  for (i=0; i<=x; i++) {
    int total = i * 2 + (x - i) * 4;
    if (total == y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  // Code done.

  return 0;
}

Measured memory_bytes: 3100
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

int main() {
  string str;

  cin >> str;

  string ans = "AC";
  bool cflag = false;
  for (size_t i = 0; i < str.length(); i++) {
    if (i == 0) {
      if (str[i] != 'A') {
        ans = "WA";
        break;
      }
    } else if (i >= 2 && i <= str.length() - 2) {
      if (str[i] == 'C') {
        if (cflag) {
          ans = "WA";
          break;
        } else
          cflag = true;
      } else {
        if ((str[i] - 'a') < 0) {
          ans = "WA";
          break;
        }
      }

    } else {
      if ((str[i] - 'a') < 0) {
        ans = "WA";
        break;
      }
    }
  }
  if (!cflag && ans == "AC") ans = "WA";
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
constexpr bool isDebugMode = false;
int testcase = 1;
#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
    #include <atcoder/all>
    using namespace atcoder;
#endif
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007; //998244353;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
const string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void enu(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void enu2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long recgcd(T1 a, T2 b){return a % b ? recgcd(b, a % b) : b;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

void solve();

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // cin >> testcase;
    while(testcase--) solve();
    return 0;
}

void solve(){
    ll N; cin >> N;
    vector<ll> d1(N), d2(N);
    rep(i, N) cin >> d1[i] >> d2[i];
    rep(i, N - 2){
        if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]){
            pt("Yes");
            return ;
        }
    }
    pt("No");
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <utility>
#include <set>
#include <numeric>
#include <queue>
#include <sstream>
#include <map>
using namespace std;
using LLI = long long int;

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


int main(int argc, char *argv[])
{
    LLI L, R;
    cin >> L >> R;

    int s = 99999;
    LLI upperL = min(L+2018, R-1);
    for (LLI l=L; l<=upperL;l++) {
        for (LLI r=l+1; r<=min(l+2019, R); r++) {
            s = min(s, int((l * r) % 2019));
        }
    }

    cout << s << endl;
   
    return 0;
}

Measured memory_bytes: 384
import sys
n, k = map(int, input().split())
s = input()
sList = [] #連続する1の数、0の数、1の数...と格納するリスト
switch = int(s[0])
num = 1
if int(s[0]) == 0:
  sList.append(0)
if n > 1:
  for i in range(1, n):
    if int(s[i]) == switch:
      num += 1
    else:
      sList.append(num)
      num = 1
      switch = int(s[i])
sList.append(num)
if len(sList) // 2 < k: #全部ひっくり返せる
  print(n)
  sys.exit()
elif len(sList) % 2 == 0: #最後が0の数で終わっている場合、1の数で終わらせる
  sList.append(0)
  
s = sum(sList[0:2*k+1])
sMax = s

for i in range(1, (len(sList)-2*k) // 2 + 1): #リストの2k+1個の部分和のうち、最大のものが答え
  s += - sList[2*i-2] - sList[2*i-1] + sList[2*i+2*k] + sList[2*i+2*k-1]
  if sMax < s:
    sMax = s
    
print(sMax)

Measured memory_bytes: 44508
K = int(input())
ans = 0

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

memo1 = []
memo2 = []
memo3 = []

for i in range(1, K+1):
    memo1.append((i,i,i))

for i in range(1, K):
    for j in range(i+1, K+1):
        memo2.append((i,i,j))
        memo2.append((j,j,i))

for i in range(1, K-1):
    for j in range(i+1, K):
        for k in range(j+1, K+1):
            memo3.append((i,j,k))

for item in memo1:
    ans += gcd(item[2], gcd(item[0], item[1]))
for item in memo2:
    ans += 3 * (gcd(item[2], gcd(item[0], item[1])))
for item in memo3:
    ans += 6 * (gcd(item[2], gcd(item[0], item[1])))

print(ans)

Measured memory_bytes: 105492
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    vector<int>W(N);
    vector<int>sum(N);
    int ans = 0;
    rep(i, N) {
        cin >> W[i];
        ans += W[i];
        sum[i] = ans;
    }
    int answer = abs(ans - sum[0]*2);
    REP(i, N)answer = min(answer, abs(ans - sum[i]*2));
    cout << answer << endl;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  
  for (int i = 0; i < W + 2; i++) {
    if (i < W + 1) {
      cout << '#';
    }
    else if (i == W + 1) {
      cout << '#' << endl;
    }  
  }
  
  for (int i = 0; i < H; i++) {
    string str;
    cin >> str;
    cout << '#' + str + '#' << endl;
  }
  for (int i = 0; i < W + 2; i++) {
    if (i < W + 1) {
      cout << '#';
    }
    else if (i == W + 1) {
      cout << '#' << endl;
    }  
  }  
  

}

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

int main() {
  int m, n;

  cin >> m >> n;
  int t[m][n];

  for(int i = 0; i < m; i++) {
    for(int j = 0; j < n; j++) {
      cin >>t[i][j];
    }
  }

  int ans = 0;
  for(int i = 0; i < m; i++) {
    int cnt = 0;
    for(int j = 0; j < n; j++) {
      if(t[i][j] == 1) cnt++;
    }
    if(ans < cnt) ans = cnt;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1164
#include <stdio.h>
static int m, f, r;
int main(void) {
    char    c;
    int     s;  // sum
    while (1) {
        scanf("%d%d%d", &m, &f, &r);
        if (m == -1 && f == -1 && r == -1) break;
        if (m == -1 || f == -1)
            c = 'F';
        else {
            s = m + f;
            if (s >= 80)
                c = 'A';
            else if (s >= 65)
                c = 'B';
            else if (s >= 50)
                c = 'C';
            else if (s >= 30) {
                if (r >= 50)
                    c = 'C';
                else
                    c = 'D';
            } else
                c = 'F';
        }
        printf("%c\n", c);
    }
    return 0;
}

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

 using namespace std;
 int main() {
   int X, A, B;
   cin >> X >> A >> B;
   if (B <= A) cout << "delicious" << endl;
   else if (B <= A + X) cout << "safe" << endl;
   else cout << "dangerous" << endl;
 }


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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 100010, mod = 1e9 + 7;

int n, x, a[N], bk[N];
LL l, r;

bool check(LL c)
{
    for(int i = 0; i <= n; i++) a[i] = bk[i];

    for(int i = 0; i < n; i++)
    {
        int d = a[i] + a[i + 1] - x;
        if(d > 0)
        {
            if(d <= a[i + 1]) a[i + 1] -= d;
            else
            {
                a[i] -= d - a[i + 1];
                a[i + 1] = 0;
            }

            c -= d;
            if(c < 0) return false;
        }
    }

    return true;
}

int main()
{
    scanf("%d%d", &n, &x);
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &bk[i]);
        r += bk[i];
    }

    while(l < r)
    {
        LL mid = l + r >> 1;
        if(check(mid)) r = mid;
        else l = mid + 1;
    }

    printf("%lld\n", l);
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX 1000000
vector<bool> prime(MAX+1,true);
void init(){
	prime[0] = prime[1] = false;
	for(int i=2;i*i<=MAX;i++){
		if(prime[i])for(int j=i*i;j<=MAX;j+=i)prime[j] = false;
	}
}

bool dp[MAX+1] = {0};
int main(){
	init();
	int n,x;
	while(cin >> n >> x, n){
		rep(i,MAX+1)dp[i] = false;		
		dp[0] = true;
		rep(i,n){
			int t;
			cin >> t;
			for(int j=t;j<=MAX;j++){
				dp[j] = dp[j] | dp[j-t];
			}
		}
		while(x){
			if(prime[x] & dp[x]){
				cout << x << endl;
				goto successful;
			}
			x--;
		}
		cout << "NA" << endl;
		successful:;
	}
}

Measured memory_bytes: 2004
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
    int N; cin >> N;
    int A; cin >> A;
    string ans;
    if (A == 0) {
        ans = N % 500 == 0 ? "Yes" : "No";
    } else {
        ans = N % 500 <= A ? "Yes" : "No";
    }
    cout << ans << endl;
    return;
}

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



Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()

int main() {
	ll n,k;
	cin >> n>>k;
	ll ans = 0;
	for (ll i = k; i <= n + 1; i++) {
		//cout << i<<" "<<(n + 1 - i) * i << endl;
		ans += 1+n * i - (i - 1) * i / 2 - (i - 1) * i / 2;
		ans=ans % (1000000000 + 7);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3160
#include <iostream>
using namespace std;
int main() {
	int N;
	int d[110] = {};
	bool d_exist[110] = {false};
	int count = 0;
	cin >> N;
	for (int i = 0; i < N; ++i) cin >> d[i];
	for (int i = 0; i <= 100; ++i) d_exist[d[i]] = true;
	for (int i = 1; i <= 100; ++i) {
		if (d_exist[i] == true) count += 1;
	}
	cout << count << endl;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 234;
vector<int> g[N];
int bio[N];

void solve() {
  int n; scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      char c; scanf(" %c", &c);
      if (c == '1') {
	g[i].push_back(j);
      }
    }
  }
  int ans = -1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) bio[j] = 0;
    int cur = 0;
    queue<pair<int, int>> q;
    q.emplace(i, 1);
    bio[i] = 1;
    while (!q.empty()) {
      const auto &p = q.front();
      cur = p.second;
      for (int v: g[p.first]) {
	if (bio[v]) {
	  if (bio[v] != p.second-1 && bio[v] != p.second+1) goto bad;
	  continue;
	}
	q.emplace(v, p.second+1);
	bio[v] = p.second+1;
      }
      q.pop();
    }
    ans = max(ans, cur);
  bad:;
  }
  printf("%d", ans);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3988
import std.stdio, std.string, std.array, std.conv;

void main () {
    int[] tmp = readln.chomp.split.to!(int[]);
    int n = tmp[0], m = tmp[1];
    int[][] a = new int[][](n, m);
    foreach (i; 0 .. n) {
        int[] row = readln.chomp.split.to!(int[]);
        foreach (j; 0 .. m) {
            a[i][j] = row[j];
        }
    }
    int[] b = new int[m];
    foreach (j; 0 .. m) {
        b[j] = readln.chomp.to!int;
    }
    int[] c = new int[n];
    foreach (i; 0 .. n) {
        foreach (j; 0 .. m) {
            c[i] += a[i][j] * b[j];
        }
    }
    foreach (x; c) x.writeln;
}


Measured memory_bytes: 2912
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let S: String = read();
    let mut vec: Vec<_> = S.chars().collect();
    let mut now_string = "".to_string();
    while !vec.is_empty() {
        let c = vec.pop().unwrap();
        now_string = now_string + &c.to_string();
        match now_string.as_str() {
            "maerd" | "remaerd" | "esare" | "resare" => {
                now_string = "".to_string();
            }
            _ => {
                if now_string.len() >= 7 {
                    println!("NO");
                    return;
                }
            }
        }
    }
    if !now_string.is_empty() {
        println!("NO");
    } else {
        println!("YES");
    }
}


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

int main(void){
    int n;
    string c;
    cin>>n;
    cin>>c;

    int i=0;
    int j=0;
    int count=0;

    for(i=0;i<n;i++){
        if(c[i]=='R')j++;
    }
    for(i=0;i<j;i++){
        if(c[i]=='W')count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3688
X, Y, A, B, C = map(int, input().split())
p = [int(a) for a in input().split()]
q = [int(a) for a in input().split()]
r = [int(a) for a in input().split()]
s = []

p.sort(reverse=True)
q.sort(reverse=True)

p = p[:X]
q = q[:Y]
s = p + q + r
s.sort(reverse=True)

s = s[:(X + Y)]
        
print(sum(s))

Measured memory_bytes: 23340
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n =  Integer.parseInt(sc.next());
		int ans[] = new int[n];

		for (int i = 0 ; i < n ; i++) {
			int	tmp = Integer.parseInt(sc.next());
			ans[tmp-1] = i + 1 ;
		}


		for(int i : ans) {
			System.out.println(i);
		}
	}

}

Measured memory_bytes: 48060
//wawando's template

#include <iostream>
#include <string>
#include <fstream>
#include <functional>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <set>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>  //clock_t , clock() , CLOCKS_PER_SEC
#include <cstring>
#include <cctype>
#include <climits> // LLONG_MAX , LLONG_MIN , INT_MAX , INT_MIN

//MACROS
#define pb              push_back
#define mp              make_pair
#define INF             1000000000     //1 billion safer for floyd warshall, avoid overflow

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

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

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

int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(0);
  ll a,b,c,d;
  cin >>a >>b >>c >>d;
  ll ri = (b/c) + (b/d) - (b/lcm(c,d));
  ll le = 0;
  if(a > 0) {
    a--;
    le = (a/c) + (a/d) - (a/lcm(c,d));
  }
  a++;
  ll ans = (b-a+1) - (ri-le);
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;
import std.numeric;

void main(){
    foreach(string line; lines(stdin))
        writeln(patternN(line.parse!int));
}

int patternN(int N = 1)(int n){
    static if(N == 4){
        if(n >= 0 && n < 10)
            return 1;
        else
            return 0;
    }else{
        if(n < 0)
            return 0;
        int sum;
        foreach(i; 0..10)
            sum += patternN!(N+1)(n - i);
        return sum;
    }
}

Measured memory_bytes: 976
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(void){
  int N;
  ll K;
  ll ans=0;
  cin >> N >> K;
  ll P[100010]={0};
  int a,b;
  for(int i=0;i<N;i++){
    cin >> a >> b;
    P[a]+=b;
  }
  for(int i=1;i<100010;i++){
    ans+=P[i];
    if(K<=ans){
      cout << i;
        return 0;
    }
  }
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define int long long
#define endl "\n"

int32_t main()
{
    IOS;
    
    int n,k;
    cin>>n>>k;
    int ans=0;
    int a[n+6];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+1+n);
    reverse(a+1,a+1+n);
    for(int i=k+1;i<=n;i++)
        ans+=a[i];
    cout<<ans;    
    return 0;
}

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

int main(){
  int N;
  cin>>N;
  int ans[27]={1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88,99,111,222,333,444,555,666,777,888,999};
  for (int i=0;i<27;i++){
    if(N<=ans[i]){
      cout<<ans[i]<<endl;
      return 0;
    }
  }
     
  return 0;
}

  
  

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String s = sc.next();
        if (a >= 3200) {
            System.out.println(s);
        } else {
            System.out.println("red");
        }
        sc.close();
    }
}

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

#define ll long long
#define ull unsigned long long
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<char>> a(h, vector<char> (w));
    rep(i, h) rep(j, w){
        cin >> a[i][j];
    }
    rep(i, h+2){
        rep(j, w+2){
            if(i == 0 || i == h+1){
                cout << '#';
            }
            else{
                if(j==0 || j==w+1) cout << '#';
                if(!(j==0 || j==w+1))cout << a[i-1][j-1];
            }
        }
        cout << '\n';
    }
    return 0;
}

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

const ll mod = 1000000007;
const double eps = 1e-8;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    string S;
    cin >> S;
    if (S == "ABC") {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }
    return 0;
}

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

int main() {

string s;
cin>>s;
if(s.size()%2!=0){cout<<"No"<<endl; return 0;}
//cout<<t.substr(0,s.size())<<endl;
string ans = "";

for (size_t i = 0; i < s.size(); i+=2)
{
 if(s.substr(i,2)!="hi"){cout<<"No"<<endl; return 0;}
}
cout<<"Yes"<<endl;



}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

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

#define pi acos(-1.0)

#define ps(x,y) fixed<<setprecision(y)<<x
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;



int main()
{
    //c_p_c();
    FastIO;
int n;
   cin>>n;
   double r = 2*pi*n;
   cout<<ps(r,16)<<endl;

}



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

//for loop
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//abbreviati
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

//constant
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

/***Snippet**************************************
ifelse, isprime, torad, todeg, lcm, bfs
************************************************/

//adjacency list
vector<int> to[100005];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;cin >> n;
    vector<ll> a(n);
    rep(i,0,n) cin >> a[i];
    ll cub=0;
    ll money=1000;

    rep(i,0,n-1){
        cub=0;
        if(a[i]<a[i+1]){
            cub=money/a[i];
        }
        money+=cub*(a[i+1]-a[i]);

    }

    cout << money ENDL;
    
    return 0;
}

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

int main(){
  int n, k;
  cin >> n >> k;
  string ans="";
  while(n){
    ans += n % k + '0';
    n /= k;
  }
  cout << ans.size() << endl;
  return 0;
}


Measured memory_bytes: 3572
#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; 
typedef short int si;
typedef long long int ll;
typedef long int li;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<li,li> pli;
typedef pair<ll,ll> pll;
#define Max 1000001
#define inf INT_MAX
#define linf LONG_MAX 
#define llinf LONG_LONG_MAX
#define rep(i,a,b) for(i=a;i<=b;i++)
#define rrep(i,a,b) for(i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define mkp make_pair
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define endl '\n'
const ll N=11;
ll mod=1e9+7;
signed main()
{
    fast;
    ll pro=1,temp,n,m,k,t,i,j,l,r,mid,x,y,z,rem,carry=0,ind,ans=0,mx=-llinf,mn=llinf,cnt=0,curr=0,prev,sum=0,flag=0,i1=-1,i2=-1;
    cin>>n;
    cout<<3*n*n;
    return 0;
} 
 

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;
 
/* constant */
 
/* typedef */
 
typedef stack<int> si;
 
/* global variables */
 
/* subroutines */
 
/* main */
 
int main() {
  si st;
 
  for (;;) {
    string s;
    cin >> s;
    if (cin.eof()) break;
 
    if (s[0] == '+') {
      int b = st.top(); st.pop();
      int a = st.top(); st.pop();
      st.push(a + b);
    }
    else if (s[0] == '-') {
      int b = st.top(); st.pop();
      int a = st.top(); st.pop();
      st.push(a - b);
    }
    else if (s[0] == '*') {
      int b = st.top(); st.pop();
      int a = st.top(); st.pop();
      st.push(a * b);
    }
    else
      st.push(atoi(s.c_str()));
  }
 
  printf("%d\n", st.top());
  return 0;
}



Measured memory_bytes: 3272
def surrounded_by_pound(grid, i, j):
  return '#' in (grid[i-1][j], grid[i+1][j], grid[i][j-1], grid[i][j+1])


def paintable(grid):
  for i in range(1, H+1):
    for j in range(1, W+1):
      if grid[i][j] == '#' and not surrounded_by_pound(grid, i, j):
        return False
  return True



H, W = map(int, input().split())

grid = []
grid.append('.' * (W+2))
for _ in range(H):
  grid.append('.' + input() + '.')
grid.append('.' * (W+2))

print('Yes') if paintable(grid) else print('No')


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

signed main(){
  int n,m;
  cin>>n>>m;
  if(n>=m){
    cout<<0<<endl;
    return 0;
  }
  int s=0;
  int a[m],b[m-1];
  r(i,m)cin>>a[i];
  sort(a,a+m);
  r(i,m-1)s+=a[i+1]-a[i],b[i]=a[i+1]-a[i];
  sort(b,b+m-1);
  r(i,n-1)s-=b[m-2-i];
  cout<<s<<endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
	int sum;
	int n;
	int i;
	
	while (1){
		scanf("%d", &sum);
		if (!sum){
			break;
		}
		
		for (i = 1; i < 10; i++){
			scanf("%d", &n);
			sum -= n;
		}
		
		printf("%d\n", sum);
	}
	
	return (0);
}

Measured memory_bytes: 600
# -*- coding:utf-8 -*-
import math


def koch(n, p1, p2):
    if n == 0:
        return

    sx = (2 * p1[0] + 1 * p2[0]) / 3
    sy = (2 * p1[1] + 1 * p2[1]) / 3
    s = (sx, sy)

    tx = (1 * p1[0] + 2 * p2[0]) / 3
    ty = (1 * p1[1] + 2 * p2[1]) / 3
    t = (tx, ty)

    rad60 = math.radians(60)
    ux = (tx - sx) * math.cos(rad60) - (ty - sy) * math.sin(rad60) + sx
    uy = (tx - sx) * math.sin(rad60) + (ty - sy) * math.cos(rad60) + sy
    u = (ux, uy)

    koch(n - 1, p1, s)
    print(s[0], s[1])

    koch(n - 1, s, u)
    print(u[0], u[1])

    koch(n - 1, u, t)
    print(t[0], t[1])

    koch(n - 1, t, p2)


if __name__ == "__main__":
    n = int(input())
    p1 = (0.0, 0.0)
    p2 = (100.0, 0.0)
    print(p1[0], p1[1])
    koch(n, p1, p2)
    print(p2[0], p2[1])

Measured memory_bytes: 8052
#include <iostream>

using namespace std;

int main()
{
    char c[3][3];
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    for (int i = 0; i < 3; i++){
        cout << c[i][i];
    }
    cout << "\n";
}

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

#define MAXN 802
#define INF 0x3f3f3f3f

using namespace std;

struct mystruct {
    int x, y, doors, steps;
};

deque < mystruct > Q[MAXN*2];

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

char s[MAXN][MAXN];

int n, m, k, d[MAXN][MAXN];

bool isEdge(mystruct node) {
    if(node.x == 1 || node.x == n || node.y == 1 || node.y == m)
        return 1;
    return 0;
}

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

    int i, j;
    mystruct start, node;

    scanf("%d%d%d\n", &n, &m, &k);

    for(i=1; i<=n; ++i)
        scanf("%s\n", s[i]+1);

    for(i=1; i<=n; ++i)
        for(j=1; j<=m; ++j)
            if(s[i][j] == 'S')
                start.x = i, start.y = j;

    if(isEdge(start)) {
        printf("0");
        return 0;
    }

    start.doors = 0;
    start.steps = 0;

    Q[1].push_back(start);

    for(i=1; i<=n; ++i)
        for(j=1; j<=m; ++j)
            d[i][j] = INF;

    int limit = n + m;
    for(i=1; i<=limit; ++i)
        while(!Q[i].empty()) {

            node = Q[i].front();
            Q[i].pop_front();

            if(d[node.x][node.y] <= i)
                continue;

            d[node.x][node.y] = i;

            if(isEdge(node)) {
                printf("%d", i);
                return 0;
            }

            mystruct nxt;
            for(int j=0; j<4; ++j) {
                nxt.x = node.x + dx[j];
                nxt.y = node.y + dy[j];

                if(s[nxt.x][nxt.y] == '.') {
                    if(node.steps == k) {
                        nxt.doors = 0;
                        nxt.steps = 1;
                        Q[i+1].push_back(nxt);
                    }
                    else {
                        nxt.doors = node.doors;
                        nxt.steps = node.steps + 1;
                        Q[i].push_back(nxt);
                    }
                }
                else {
                    if(node.doors < k) {
                        if(node.steps == k || i == 1) {
                            nxt.doors = 0;
                            nxt.steps = 1;
                            Q[i+1].push_back(nxt);
                        }
                        else {
                            nxt.doors = node.doors + 1;
                            nxt.steps = node.steps + 1;
                            Q[i].push_back(nxt);
                        }
                    }
                    else {
                        nxt.doors = 1;
                        nxt.steps = 1;
                        Q[i+1].push_back(nxt);
                    }
                }
            }
        }

    return 0;
}


Measured memory_bytes: 5632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.awt.Point;

public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        int[] x;

        // write your code
        void solve(InputReader in, PrintWriter out) {
            x = new int[5];
            for (int i = 0; i < 5; i++) {
                x[i] = in.nextInt();
            }

            int ans = 0;
            for (int i = 0; i < 5; i++) {
                if (x[i] == 0) {
                    ans = i + 1;
                }
            }
            out.println(ans);
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 33016
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
#define pi 3.14159265358979

int main()
{
	int  a,b;
	cin >> a >>b;
	for(int i=1;i<=1260;i++){
		int t1 = (double) i*0.08;
		int t2 = (double) i*0.1;
		if(t1 ==a && t2 ==b) {
			cout << i <<endl;
			return 0;
		}
	}
	cout << "-1" <<endl;
	

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
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;
}
const int MOD = 1000000007;

int main() {
    int a[3][3];
    rep(i, 0, 3) {
        rep(j, 0, 3) { cin >> a[i][j]; }
    }
    int N;
    cin>>N;
    rep(i, 0, N) {
        int b;
        cin >> b;
        rep(i, 0, 3) {
            rep(j, 0, 3) {
                if(a[i][j] == b) {
                    a[i][j] = -1;
                }
            }
        }
    }
    int res = false;
    rep(i, 0, 3) {
        if(a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1) {
            res = true;
        }
    }
    rep(i, 0, 3) {
        if(a[0][i] == -1 && a[1][i] == -1 && a[2][i] == -1) {
            res = true;
        }
    }
    if(a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1) {
        res = true;
    }
    if(a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1) {
        res = true;
    }
    if(res) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

#define double      	long double
#define int         	long long
#define pb          	push_back
#define pii         	pair<int,int>
#define vi          	vector<int>
#define vii         	vector<pii>
#define mi          	map<int,int>
#define mii         	map<pii,int>
#define all(a)      	(a).begin(),(a).end()
#define sz(x)       	(int)x.size()
#define endl        	"\n"
#define repp(i,a,b) 	for(int i=a;i<b;i++)
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define brep(i,a,b)     for(int i=a;i>=b;i--)
#define deb1(x)      	cout << #x << "=" << x << endl
#define deb2(x, y)  	cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x, y, z)  	cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define trace(v) 		for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
#define tracearr(a,l,r) for(int iii=l;iii<=r;iii++)cout << a[iii] << " ";cout << endl;
#define PI          	3.1415926535897932384626
#define F 				first
#define S 				second
#define clr(x,y) 		memset(x, y, sizeof(x))
#define IOS         	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// *s.find_by_order(1) - gives the 2nd samllest element in set
// s.order_of_key(x)   - gives the number of elements in the set which are strictly smaller than x


const int N=1e5 + 5;
const int MOD=1e9 + 7;

int32_t main()
{
	IOS;
	int T=1;
	//cin >> T;
	// int numOfSetBits = __builtin_popcountll(n);
	std::cout << std::fixed << std::setprecision(12);
	while(T--)
	{
		char c;
		cin >> c;
		int x = c;
		if(x>=97)
			cout << "a";
		else
			cout << "A";
	}
}



Measured memory_bytes: 3608
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define rn return
#define fi first
#define se second
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;


int main(){
    int A,P; cin >> A >> P;
    cout << (A*3+P)/2;
    rn 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
D = set(list(map(str, input().split())))


def ok(s):
    for c in s:
        if c in D:
            return False
    return True


i = N
while True:
    s = str(i)
    if ok(s):
        print(s)
        exit()
    i += 1

Measured memory_bytes: 3064