akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

//Nayeem Shahriar Joy,Applied Physics And Electronic Engineering,University of Rajshahi.

int main(void)

{
    long int a;
    int N,X;
    cin>>N;
    X=N;
    int count=0;
    while(N--)
    {
        cin>>a;
        if(a%2==0&&a!=2)
        {
            count++;
        }
        else
        {
            for(int i=3;i<=sqrt(a);i=i+2)
            {
                if(a%i==0)
                {
                    count++;
                    break;
                }
            }
        }
    }
    cout<<X-count<<endl;
    return 0;
}

Measured memory_bytes: 3100
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

  public static void main(String[] args) {
    FastScanner sc = new FastScanner();

    int N = sc.nextInt();
    int M = sc.nextInt();
    int C = sc.nextInt();

    int[] B = new int[M];

    for (int i = 0; i < M; i++) {
      B[i] = sc.nextInt();
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
      int A = 0;

      for (int j = 0; j < M; j++) {
        A += sc.nextInt() * B[j];
      }
      if (A + C > 0)
        ans++;

    }

    System.out.println(ans);

  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte()) {
      return buffer[ptr++];
    } else {
      return -1;
    }
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  private void skipUnprintable() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      ptr++;
    }
  }

  public boolean hasNext() {
    skipUnprintable();
    return hasNextByte();
  }

  public String next() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public int nextInt() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    int n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public long nextLong() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }
}

Measured memory_bytes: 21332
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    string s,t;
    cin>>s>>t;
    int n=s.size(),m=t.size(),i,j,k;
    string ans="";
    if (n<m)
        cout<<"UNRESTORABLE\n";
    else
    {
        for (i=0;i<n-m+1;i++)
        {
            int f=0;
            string temp="";
            for (k=0;k<i;k++)
            {
                if (s[k]=='?')
                    temp+='a';
                else
                    temp+=s[k];
            }
            for (j=0;j<m;j++)
            {
                if (s[i+j]=='?')
                {
                    temp+=t[j];
                    continue;
                }
                else if (s[i+j]==t[j])
                {
                    temp+=t[j];
                    continue;
                }
                else
                {   
                    f=1;
                    break;
                }
            }
            if (!f)
            {
                for (k=i+m;k<n;k++)
                {
                    if (s[k]=='?')
                        temp+='a';
                    else
                        temp+=s[k];
                }
                if (ans=="" || ans>temp);
                    ans=temp;
            }
        }
        if (ans=="")
            cout<<"UNRESTORABLE\n";
        else
            cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
def solve():
    lis = list(map(int, input().split()))

    # print(lis)

    def unique_list(seq):
        _set = set()
        set_add = _set.add
        return [x for x in seq if x not in _set and not set_add(x)]

    return len(unique_list(lis))


if __name__ == '__main__':
    res = solve()
    print(res)


Measured memory_bytes: 38256
#include <stdio.h>
int a[110];
int minn(int x,int y){if (x<y)return x; return y;}
int main()
{
    int ans=0;int n;scanf("%d",&n);
    for (int i=1;i<n;i++) scanf("%d",&a[i]);
    a[0]=a[1];a[n]=a[n-1];
    for (int i=1;i<=n;i++)
        ans+=minn( a[i],a[i-1] );
    printf("%d\n",ans);


}



Measured memory_bytes: 128
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] -= i + 1;
    }
    sort(a.begin(), a.end());
    int ans = -1;

    for (int i = 0; i < n; i++) {
        if (i != n-1 && a[i] == a[i + 1])
            continue;
        if (i >= n / 2) {
            ans = a[i];
            break;
        }
    }
    long long ret = 0;
    for (int i = 0; i < n; i++) {
        ret += abs(a[i] - ans);
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
int x,n,o=0,k,p;
cin>>x>>n;
int z=x+1,l=x-1;
int y[n];
if (n==0)
    cout<<x;
else{
for(int i=0;i<n;i++)
cin>>y[i];
sort(y,y+n);
for(int i=0;i<n;i++){
if(x!=y[i])
o++;
else{
k=p=i;
break;}
}
int u;
if(n-k>=k)
    u=k;
else
    u=n-k;
if (o==n)
cout<<x;
else
for(int i=0;i<n;i++){
k--;
p++;
if(y[k]!=l){
cout<<l;
i++;
break;
}
else if(y[p]!=z){
cout<<z;
i++;
break;}
else{
z++;
l--;
}
}
}
return 0;
}


Measured memory_bytes: 3540
/*
      author : nishi5451
      created: 12.08.2020 14:49:20
*/

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


int main(){
    int h,w,n;
    cin >> h >> w >> n;
    int ans;
    ans = n/max(h,w);
    if(n%max(h,w) != 0) ans++;
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int n,a,x,c=0,j=0;
    cin>>n;
    int arr[n],ar[n];
    map <int ,int > mp;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        arr[i] = a;
        mp[a]++;

        if(mp[a]>1)
        {
            int b=0;
        }
        else{
            ar[j]=a;
            j++;
        }
    }
    x=j;
    for(int j=0;j<x;j++)
    {
        if(mp[ar[j]] >= ar[j])
            c = c+ (mp[ar[j]]-ar[j]);
        else
            c = c + mp[ar[j]];
    }
    cout<<c<<endl;

    return 0;
}

Measured memory_bytes: 5504
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define all(v) (v).begin(),v.end()
#define fi first
#define se second
const ll inf=(1e18);
const ll mod=1000000007;
double dp[4000][4000];
int main(){
int n;
cin>>n;
vector<double> a(n);
for(int i=0;i<n;i++)cin>>a[i];
dp[0][0]=1;
int i=0;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
    if(dp[j][i]==0.0)continue;
   dp[j+1][i+1]+=(dp[j][i]*a[i]);
   dp[j][i+1]+=dp[j][i]*(1.0-a[i]);
}
}
int win=n/2+1;
double ans=0;
for(int i=n;i>=win;i--)ans+=dp[i][n];
printf("%.12f\n",ans);
}




Measured memory_bytes: 92800
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <unordered_map>
#include <queue>
#include <array>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
const int mod = 998244353;

int main() {
  //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  vi sum(n + 1);
  for (int i = 0; i < n; ++i) {
    sum[i + 1] = sum[i] + s[i] - '0';
  }
  vi d(2 * n + 1);
  d[0] = 1;
  for (int t = 0; t < 2 * n; ++t) {
    int i = min(t, n - 1);
    vi nd(d.size());
    for (int j = 0; j < d.size(); ++j) {
      if (j < sum[i + 1]) {
        nd[j + 1] = (nd[j + 1] + d[j]) % mod;
      }
      if (t - j < 2 * (i + 1) - sum[i + 1]) {
        nd[j] = (nd[j] + d[j]) % mod;
      }
    }
    d.swap(nd);
//    cerr << t << endl;
//    for (int i = 0; i < d.size(); ++i) if (d[i]) cerr << i << ' ' << d[i] << endl;
  }
  ll res = 0;
  for (int x : d) res += x;
  cout << res % mod << endl;
  return 0;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

    vector<int> A(N);
    rep(i,N){
        cin >> A[i];
        A[i]--;
    }

    vector<int> B(N);
    rep(i,N){
        cin >> B[i];
    }

    vector<int> C(N-1);
    rep(i,N-1){
        cin >> C[i];
    }

    int ans = 0;

    rep(i,N){
        ans += B[A[i]];

        if ( i > 0 && A[i] == (A[i-1] + 1 ))
            ans += C[A[i-1]];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    static Scanner scanner;

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

        int S=gi();
        int mb=Math.floorDiv(S, 3);
        dp = new long [S+1][mb+1];

        for(int i=3; i<S+1; i++) {
        	dp[i][1]=1;
        }
        for (int i=4; i<S+1; i++) {
        	for (int j=2; j<mb+1; j++) {
            	dp[i][j]+=(dp[i-3][j-1] + dp[i-1][j]) % 1000000007;
            }
        }

        long ans = 0;
        for(int i=0; i<mb+1; i++) {
        	ans+=dp[S][i];
        }
        System.out.println(ans%1000000007);
    }

    // 文字列として入力を取得
    public static String gs() {
         return scanner.next();
    }

    // intとして入力を取得
    public static int gi() {
         return Integer.parseInt(scanner.next());
    }

    // longとして入力を取得
    public static long gl() {
         return Long.parseLong(scanner.next());
    }

    // doubleとして入力を取得
    public static double gd() {
         return Double.parseDouble(scanner.next());
    }
}

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

int main(){
    long N;
    cin >> N;
    vector<long> v;
    for(long i = 1, a; i <= N; ++i){
        cin >> a;
        if(i < a)return 0 & puts("-1");
        v.insert(v.begin() + a - 1, a);
    }
    for(const auto& i : v)cout << i << endl;
}

Measured memory_bytes: 256
using System;

namespace AOJ.Volume2
{
    public class RailwayTicket
    {
        public static int Main()
        {
            while (true)
            {
                var input = Console.ReadLine();
                if (string.IsNullOrEmpty(input)) { break; }

                var split = input.Split(' ');
                bool j = split[0] == "1" ? true : false;
                bool t = split[1] == "1" ? true : false;
                bool jt = split[2] == "1" ? true : false;

                if (j && t && !jt) { Console.WriteLine("Open"); }
                else if (!j && !t && jt) { Console.WriteLine("Open"); }
                else { Console.WriteLine("Close"); }
            }
            return 0;
        }
    }
}

Measured memory_bytes: 8792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const double inf=1e8;
vector<map<vi,int> >dp;
vi tmp;
string tms;
int r,n,m,c,MOD=100000007;
//map<vi,int>q;
vi q;
vi f(int a){
	vi out(m);
	rep(i,m){
		out[m-i-1]=a%3;
		a/=3;
	}
	return out;
}
int ff(vi a){
	int t=0;
	rep(i,m){
		t*=3;
		t+=a[i];
	}
	return t;
}
void dfs(int a){
	if(a==m){
		if(r)return;
		(q[ff(tmp)]+=c)%=MOD;	
		return;
	}
	if(tms[a]=='.'){
		if(r&&tmp[a])return;
		dfs(a+1);
		return;
	}
	int w=r;
	if(tms[a]-'0'<w)return;
	tms[a]-=w;
	rep(i,min(3,tms[a]-'0'+1))if(tms[a]-'0'-i<3){
		tmp[a]=i;
		r=tms[a]-'0'-i;
		dfs(a+1);
		tmp[a]=0;
	}
	
	tms[a]+=w;
}
int main(){
	cin>>n>>m;
	vs in(n);
	rep(i,n)cin>>in[i];
//	map<vi,int>dp;
	int N=pow(3,m);
	vi dp(N);
	dp[0]=1;
	rep(i,n){
		q=vi(N);
		rep(z,N)if(dp[z]){
	//		for(map<vi,int>::iterator it=dp.begin();it!=dp.end();it++){
			tmp=f(z);
			tms=in[i];
			bool h=true;
			rep(j,m)if(tms[j]!='.'){
				if(tmp[j]>tms[j]-'0')h=false;
				else{
					tms[j]-=tmp[j];
					tmp[j]=0;
				}
			}
			if(!h)continue;
			r=0;
			c=dp[z];
			dfs(0);
		}
		dp=q;
	}
	cout<<dp[0]<<endl;
}

Measured memory_bytes: 3824
N, P = map(int, input().split())
S = list(map(int, list(input())))

l = len(S)
if P == 2:
    ans = 0
    for i in range(l):
        if S[i]%2 == 0:
            ans += i+1
elif P == 5:
    ans = 0
    for i in range(l):
        if S[i]%5 == 0:
            ans += i+1
else:
    data = [0]*P
    temp = 0
    ans = 0
    for i in range(l-1, -1, -1):
        temp += S[i]*pow(10, l-i-1, P)
        temp %= P
        ans += data[temp]
        data[temp] += 1
    ans += data[0]

print(ans)

Measured memory_bytes: 61552
n = int(input())
a = list()
xy = list()
for i in range(n):
  A = int(input())
  XY = [tuple(map(int,input().split())) for i in range(A)]
  a.append(A)
  xy.append(XY)
is_paradox = False
ans = 0
for i in range(2 ** n):
  honest = []
  for j in range(n):
    if i >> j & 1:
      honest.append(1)
    else:
      honest.append(0)
  for k,v in enumerate(a):
    if honest[k] == 0:
      continue
    for x,y in xy[k]:
      x -= 1
      if y == 1 and honest[x] != 1:
        is_paradox = True
        break
      elif y == 0 and honest[x] == 1:
        is_paradox = True
        break
  if is_paradox:
    is_paradox = False
    continue
  if is_paradox == False:
    ans = max(ans,sum(honest))
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
using namespace std;

#define MAX 200005
#define INFTY 1000000000

int main() {
	int A, B, N;
	cin >> N;
	int ans = INFTY;
	for(int A = 1; A < N; A++){
		int cnt = 0;
		B = N - A;
		int tmp = A;
		while(tmp > 0){
			cnt += (tmp % 10);
			tmp /= 10;
		}
		tmp = B;
		while(tmp > 0){
			cnt += (tmp % 10);
			tmp /= 10;
		}
		ans = min(cnt, ans);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void) {
	int a, b;
	cin >> a >> b;
	int r = 0;
	for (int i = a; i <= b; i++) {
		if(i%10==(i/10000)%10 && (i/10)%10==(i/1000)%10)
		{
			r++;
		}
	}
	cout << r;
	return 0;
}

Measured memory_bytes: 256
import bisect
A, B, Q = list(map(int, input().split()))
INF = 10**18
s = [-INF]+[int(input()) for i in range(A)]+[INF]
t = [-INF]+[int(input()) for i in range(B)]+[INF]
X = [int(input()) for i in range(Q)]


for x in X:
    s_min = bisect.bisect_left(s, x)
    t_min = bisect.bisect_left(t, x)

    cost = INF
    for S in [s[s_min-1], s[s_min]]:
        for T in [t[t_min-1], t[t_min]]:
            cost = min(cost, abs(T-S)+abs(T-x), abs(T-S)+abs(S-x))

    print(cost)


Measured memory_bytes: 16512
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun solve() {
    val N = rd.readInt()
    val A = rd.readLongArray()

    val op = Array(N){'N'}

    for (i in 1 until N) {
        if (A[i-1] < A[i]) {
            op[i] = 'S'
            op[i-1] = 'B'
        }
    }
    op[N-1] = 'S'

    var money = 1000L
    var stock = 0L
    for (i in 0 until N) {
        when(op[i]) {
            'B' -> {
                if (money >= A[i]) {
                    stock += money / A[i]
                    money %= A[i]
                }
            }
            'S' -> {
                if (stock > 0) {
                    money += A[i] * stock
                    stock = 0
                }
            }
        }
    }

    println(money)
}


//val rd = debug.Reader("etc", "m-solutions2020", "d", "sample-1")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!!
    } catch (e: Exception) { throw e }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
val EPS = 1e-9; fun DBLEQ(a: Double, b: Double): Boolean {return abs(a - b) < EPS}
data class IntPair(val first: Int, val second: Int)
data class LongPair(val first: Long, val second: Long)
data class To(val idx: Int, val cost: Long)
fun <T>edge(V: Int): Array<ArrayList<T>> { return Array(V){ArrayList<T>()} }
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
}


Measured memory_bytes: 36832
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 1000005
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PA;
typedef priority_queue<ll> PQ;
typedef pair<double, double> doup;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef map<ll, ll> Map;

int main(void) {
    ll n;
    cin >> n;
    for(ll i=111; i<=999; i+=111) {
        if(n<=i) {
            prin(i);
            return 0;
        }
    }
    
}



Measured memory_bytes: 256
(let* ((a (read))
       (a-val (/ a 0.08))
       (a-val-limit (/ (+ a 1) 0.08))
       (b (read))
       (b-val (/ b 0.10))
       (b-val-limit (/ (+ b 1) 0.10))
       (ans -1))
  (loop for val from (ceiling (max a-val b-val)) below (min a-val-limit b-val-limit)
        do (progn
             (setf ans val)
             (loop-finish)))
  (format t "~a~%" ans))


Measured memory_bytes: 16352
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
ll n;
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cin>>n;
	cout<<(n*(n+1))/2;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

int main() {
  int n, m;
  cin >> n >> m;
  V<int> a(m), b(m);
  rep(i, m) {
    int ai, bi;
    cin >> ai >> bi;
    a[i] = --ai;
    b[i] = --bi;
  }
  V<V<int>> to(n);
  rep(i, m) {
    to[a[i]].push_back(b[i]);
    to[b[i]].push_back(a[i]);
  }

  int ans = 0;
  rep(i, m) {
    V<int> c(n);
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
      auto f = q.front();
      q.pop();
      c[f] = 1;
      for (auto t : to[f]) {
        if (c[t] != 0) continue;  // 訪問済み
        if ((f == a[i] && t == b[i]) || (t == a[i] && f == b[i])) continue;
        q.push(t);
      }
    }
    bool ok = true;
    rep(i, n) if (c[i] == 0) ok = false;
    if (!ok) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3644
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <stack>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

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

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

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

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

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(int arr[], int n) {
    int result = arr[0];
    for (int i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
int main() {
    ll ans=0LL;
    string S; cin >> S;
    int N=S.size();

    int a_num=0;

    for(int i=0; i<N-1; i++){
        if(S[i]=='A'){
            a_num++;
        }else if(S[i]=='B' && S[i+1]=='C'){
            ans+=a_num;
            i++;
        }else{
            a_num=0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 832
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      if(s.charAt(0) != 'A') {
        System.out.println("WA");
        return;
      }

      String subS = s.substring(Math.min(2, s.length()-1), Math.max(2, s.length()-1));
      int cnt = 0;
      int idx = -1;
      for(int i = 0; i < subS.length(); i++) {
        if(subS.charAt(i) == 'C') {
          cnt++;
          idx = i + 2;
        }
      }
      if(cnt != 1) {
        System.out.println("WA");
        return;
      }
      for(int i = 1; i < s.length(); i++) {
        if(i == idx) continue;
        if(!Character.isLowerCase(s.charAt(i))){
          System.out.println("WA");
          return;
        }
      }

      System.out.println("AC");
  }
}

Measured memory_bytes: 22996
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 998244353
#define inf (1LL<<31)
#define int long long
typedef long long ll;
#define ld long double
#define N 301 

int32_t main()
{
    IOS;
  
    int n,h,w;
    cin >> n >> h >> w;
    cout<< (n-h+1)*(n-w+1);
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;

int dp[11000];

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<max(a*b,c*d)<<endl;
}


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

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

void solve() {
  int n;
  cin >> n;
  long long ans = 1;
  vector<long long> a(n);
  for(int i = 0; i < n; ++i) {
    cin >> a[i];
    if(a[i] == 0) drop(0);
  }
  for(int i = 0; i < n; ++i) {
    if(a[i] <= 1000000000000000000/ans) ans *= a[i];
    else drop(-1);
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) solve();

  return 0;
}


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

using namespace std;

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

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define rep(i, n) for(int i = 0; i < n; i++)
#define repa(i, b, e) for(int i = (b)-((b)>(e)); i != (e)-((b)>(e)); i += 1-2*((b)>(e)))

#define dbg(x) cerr << #x << " = " << x << endl;
#define dbgall(x) cerr << #x << " = "; for(auto i_ : x) cerr << i_ << " "; cerr << endl;
#define debug(args...) { string s_(#args); replace(all(s_), ',', ' '); stringstream ss_(s_); istream_iterator<string> it_(ss_); cerr_(it_, args); }
void cerr_(istream_iterator<string> it) { (void) it; }
template<class T, class... Args> void cerr_(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; cerr_(++it, args...); }

template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, const set<T> &s) { os << '{'; string sep; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S> ostream& operator<<(ostream &os, const map<T, S> &m) { os << '{'; string sep; for (const auto &x : m) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }

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

int n;
vector<pii> v;
ll memo[2001][2001];

ll solve(int i, int l, int r) {
    if(i == n || l > r) return 0;
    ll &ans = memo[l][r];
    if(ans != -1) return ans;
    ll x = v[i].fi;
    ll p = v[i].se;
    ans = 0;
    ans = max(ans, x * abs(p - l) + solve(i + 1, l + 1, r));
    ans = max(ans, x * abs(p - r) + solve(i + 1, l, r - 1));
    return ans;
}

void run_test() {
	cin >> n;
    v.resize(n);
    rep(i, n) cin >> v[i].fi, v[i].se = i;
    sort(rall(v));
    ini(memo, -1);
    cout << solve(0, 0, n - 1) << endl;
}

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

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//int t_ = 1, t__; cin >> t__; while(t_ <= t__) { cout << "Case #" << t_++ << ": "; run_test(); }
	// int t_; cin >> t_; while(t_--) run_test();
	run_test();
	return 0;	
}


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

int main() {
  int N;
  cin >> N ;
  int A = N/1000;
  int B = N/100%10;
  int C = N/10%10;
  int D = N%10;
  
  if (A == B && B == C){
    cout << "Yes" << endl;
  }
  
  else if (B == C && C == D){
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, l;
    cin >> n >> l;

    int sum = (l - 1)*n + (n*(n+1))/2;

    if(l <= 0 && 0 <= l+n-1) cout << sum << endl;
    else if(0 < l) cout << sum - l << endl;
    else cout << sum - (l + n - 1) << endl;
}

Measured memory_bytes: 3592
N, M = map(int, input().split())
L = 0
R = 10**5

for i in range(M):
    tmp = list(map(int, input().split()))
    if L<tmp[0]:
        L = tmp[0]
    if R>tmp[1]:
        R = tmp[1]

ans = [x for x in range(L, R+1)]

print(len(ans))

Measured memory_bytes: 7088
#include <stdio.h>
int digit(int num){
    int dig = 0;
    while(num != 0){
        num /= 10;
        dig++;
    }
    return dig;
}
int main(void) {
	int n,ans=0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		if(digit(i)%2==1)
			ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <cassert>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long int, null_type, less_equal<long long int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; //less_equal
#define ll long long
#define ull unsigned long long int
#define INF 1LL << 62
#define mod 998244353
#define pb push_back
#define mp make_pair
#define xx first
#define yy second
#define zz second.second
#define vi vector<int>
#define vll vector<ll>
#define seta(a,x) memset (a, x, sizeof (a))
#define pp pair<int, int>
#define ppl pair<ll, ll>
#define sz(s) (int)((s).size())
#define all(v) (v).begin(), (v).end()
#define loop(i,s,n) for(int i=s ; i<n ; i++)
#define loopl(i,s,n) for(ll i=s ; i<n ; i++)
#define loopr(i,e,s) for(ll i=e; i>=s ; i--)
#define speedUp ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

int main() {
	//ab_gupta	
	speedUp;
	int n; cin>>n;
	vi h(n);
	loop(i,0,n) cin>>h[i];
	vi dp(n);
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	loop(i,2,n)	dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
	cout<<dp[n-1];
}
        


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

int main() {
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    
    for (int  i = 0; i < a; i++) {
        if (!('0' <= s[i] && s[i] <= '9')) {
            cout << "No" << endl;
            return 0;
        }
    }
    if (s[a] != '-') {
        cout << "No" << endl;
        return 0;
    }
    for (int i = a + 1; i <= a + b; i++) {
        if (!('0' <= s[i] && s[i] <= '9')) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

using namespace std;

#define ll long long
const int mxN=2e5;
int a[mxN];

int main(){
//#ifndef ONLINE_JUGDE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif

	ios::sync_with_stdio(0);
    cin.tie(0);
    
    ll n;
    cin>>n;
    for(int i=0;i<n;i++)
    	cin>>a[i];
	int mx=a[0];
	ll ans=0;
	for(int i=0;i<n;i++){
		mx=max(a[i],mx);
		ans+=mx-a[i];
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 4376
H,W=gets.split.map(&:to_i)

FIELD=[]
H.times do
  FIELD << gets.chomp
end

def check(x,y,color)
  ret = [0,0]
  queue = [[x,y,color]]

  until queue.empty?
    x,y,color = queue.pop
    next if x < 0 || W <= x
    next if y < 0 || H <= y
    if color == FIELD[y][x]
      FIELD[y][x] = 'x'
      if color == '#'
        ret[0] += 1
        rev_color = '.'
      else
        ret[1] += 1
        rev_color = '#'
      end
      queue << [x-1,y,rev_color]
      queue << [x+1,y,rev_color]
      queue << [x,y-1,rev_color]
      queue << [x,y+1,rev_color]
    end
  end
  
  ret
end

ret = []
H.times do |y|
  W.times do |x|
    ret << check(x,y,'.')
  end
end

ret_n = 0
ret.each do |a,b|
  ret_n += a*b
end
p ret_n

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

#define F first
#define S second
#define pb push_back
#define SZ(x) (int)(x.size())

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;

const ll maxn=1e5+10, mod=1e9+7, inf=1e18;

ll dp[maxn],h[maxn];

int main(){

	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	ll n,k; cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>h[i];

	memset(dp,69,sizeof(dp));
	dp[1]=0;
	for(int i=2;i<=n;i++)
		for(int j=i;j>=max(i-k,1ll);j--)
			dp[i]=min(dp[i],dp[j]+abs(h[j]-h[i]));
	cout<<dp[n]<<endl;


	return 0;

}




















Measured memory_bytes: 1792
def warshall(d, n):
    e = copy.deepcopy(d)
    for k in range(n):
        for i in range(n):
            for j in range(n):
                # print(d[i][k], d[k][j], d[i][j])
                if i == k or k == j:
                    continue
                if d[i][k] + d[k][j] < d[i][j]:
                    return []
                if d[i][k] + d[k][j] == d[i][j]:
                    # print(d[i][k], d[k][j], d[i][j], i,j,k)
                    e[i][j] = 0
                    e[j][i] = 0
    return e
    
import copy
n = int(input())
edges = []

graph = [list(map(int, input().split())) for i in range(n)]
e = warshall(graph, n)
if e == []:
    print(-1)
    exit()
# print(e)
edge_list = [[] for _ in range(n)]
ans = 0
for i in range(n):
    for j in range(n):
        if e[i][j] > 0:
            edge_list[i].append((e[i][j], j))
        if j > i and e[i][j]:
            ans += e[i][j]

print(ans)


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

#define ld			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 x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD         1000000007
#define sd(t) 		scanf("%d",&(t))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define hii 		cout << "hii" << endl
#define okay 		cout << "okay" << endl
#define hey 		cout << "hey" << endl

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

clock_t time_p=clock();
void starboy1299()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

const int N = 3e3+5;
int dp[N][N][2];
int arr[105];
int n;
int f(int i, int j, int par){
	if(i > j) return 0;

	if(dp[i][j][par]!=-1) return dp[i][j][par];

	if(par==0){
		int op1 = arr[i] + f(i+1, j, 1-par);
		int op2 = arr[j] + f(i, j-1, 1-par);
		return dp[i][j][par] = max(op1, op2);
	}
	else{
		int op1 = f(i+1, j, 1-par) - arr[i];
		int op2 = f(i, j-1, 1-par) - arr[j];
		return dp[i][j][par] = min(op1, op2);
	}

}

void solve()
{

	cin >> n;
	memset(dp, -1, sizeof(dp));

	rep(i, 1, n+1) cin >> arr[i];

	cout << f(1, n, 0) << endl;
		
}			 	

int32_t main(){
	fast();
    int t = 1;
    // cin>> t;
    while(t--){
    	solve();
    }
	starboy1299();
}




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

int main(){
    int k;
    string s;
    cin >> k >> s;
    if( s.size() > k) {
        for(int i=0; i<k; i++) {
            cout << s[i];
        }
        cout << "...";
        cout << endl;
        return 0;
    }
    else {
        for(int i=0; i<s.size() ; ++i) {
            cout << s[i];
        }
        cout << endl;
        return 0;
    }
}

Measured memory_bytes: 3608
N = gets.to_i
A = gets.split.map &:to_i
UV = (N-1).times.map{ gets.split.map{_1.to_i - 1} }

$Connects = Array.new(N){[]}
UV.each do |u,v|
    $Connects[u] << v
    $Connects[v] << u
end


$ans = [1]
$INF = 10**20
$dp = [$INF] * (N+1)
$dp[0] = A[0]
def Search(node, prev)
    $Connects[node].each do |n|
        next if n==prev
        a = A[n]
        idx = $dp.bsearch_index{ _1 >= a}
        tmp = $dp[idx]
        $dp[idx] = a
        $ans[n] = $dp.bsearch_index{_1 >= $INF}
        Search(n,node)
        $dp[idx] = tmp
    end
end

Search(0,-1)

puts $ans

Measured memory_bytes: 258308
from collections import deque
S = list(input())
N = int(input())
rev = False
se = False
S = deque(S)
for x in range(N):
    Q = list(input().split())
    if Q[0] == "1":
        if rev:
            rev = False
        elif se:
            rev = True
    else:
        se =True
        if Q[1] == "1":
            if rev:
                S.append(Q[2])
            else:
                S.appendleft(Q[2])
        else:
            if rev:
                S.appendleft(Q[2])
            else:
                S.append(Q[2])

S = list(S)
if rev:
    S = reversed(S)
    
ans = "".join(S)
print(ans)

Measured memory_bytes: 10212
/* ***********************************************************************************************************
									Created By - TANISHQ GUPTA (tanishq_code_c)								
**************************************************************************************************************/

#include <bits/stdc++.h>



using namespace std;
#define int             long long
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define endl             "\n"
int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}


void stringsplitter(string s, string delim,string arr[]){
	char *ptr = strtok((char *)s.c_str(), (char *)delim.c_str());
	int i=0;
	while(ptr!=NULL){
		arr[i]=((string)ptr);
		ptr = strtok(NULL,(char *)delim.c_str());
		i++;
	}
}

int string_to_int(string s){
	int ans = 0;
	int p=1;
	for(int i=s.size()-1;i>=0;i--){
		ans += (s[i]-'0')*p;
		 p *= 10;
	}
	return ans;
}

void t_c_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/

	int a,b; cin >> a >> b;
	if(b%2){
		cout << "No" << endl;
		return;
	}
	for(int i=0;i<=a;i++){
		if((a-i)*4+2*i==b){
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}


int32_t main()
{
	t_c_c();
	return 0;
}


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

using namespace std;

typedef long long ll;

int main(){
	ll n; cin >> n;
	vector<ll> a(n);
	ll totLen = 0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		totLen += a[i];
	}

	ll currLen = 0;
	// ll target = totLen/2;
	ll logIdx = 0;
	for(int i=0;i<n;i++){
		currLen += a[i];
		if(2ll*currLen == totLen){
			cout << 0 << endl;
			return 0;
		}else if(2ll*currLen > totLen){
			logIdx = i;
			break;
		}
	}

	ll beforeLen = currLen - a[logIdx];
	ll afterLen = currLen;
	ll mov = 0;
	ll ans = min(totLen - 2ll*beforeLen, 2ll*afterLen-totLen);
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 1792
score = []

# 提出用の入力
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    score.append((m, f, r))

# # 動作確認用の入力
# with open('input_itp1_7_a_1.txt', mode='r', encoding='utf8') as input:
#     while True:
#         m, f, r = map(int, next(input).split())
#         if m == -1 and f == -1 and r == -1:
#             break
#         score.append((m, f, r))
# print(score)

for i in range(len(score)):
    sum = score[i][0] + score[i][1]
    if score[i][0] == -1 or score[i][1] == -1 or sum < 30:
        print('F')
    elif sum >= 80:
        print('A')
    elif sum >= 65 and sum < 80:
        print('B')
    elif sum >= 50 and sum < 65:
        print('C')
    elif sum >= 30 and sum < 50:
        if score[i][2] >= 50:
            print('C')
        else:
            print('D')



Measured memory_bytes: 5600
function Main(inputs) {
  var lines = inputs.split('\n')

  var H = +(lines[0].split(' ')[0])
  var N = +(lines[0].split(' ')[1])

  var max_attack = lines[1].split(' ').map(v=>+v).reduce((s,v)=>s+v)

  console.log(H <= max_attack ? 'Yes' : 'No')
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 16716
const main = function(input){
  var nums = input.split("\n")[1].split(" ").map(i=>parseInt(i));
  var len = nums.length;
  var ans = nums.reduce((s,i)=>s+(i-1))-1;
  console.log(ans);
  
 
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it, len;
	fastio() {it=len=0;}
	inline char get()
	{
		if (it<len) return s[it++]; it=0;
		len=fread(s, 1, 100000, stdin);
		if (len==0) return EOF; else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while (c==' '||c=='\n') c=get();
		if (it>0) it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0; bool ng=0; char c; c=_buff.get();
	while (c!='-'&&(c<'0'||c>'9')) c=_buff.get();
	if (c=='-') ng=1, c=_buff.get();
	while (c>='0'&&c<='9') r=r*10+c-'0', c=_buff.get();
	return ng?-r:r;
}
template <class T> inline void putnum(T x)
{
	if (x<0) putchar('-'), x=-x;
	register short a[20]={}, sz=0;
	while (x) a[sz++]=x%10, x/=10;
	if(sz==0) putchar('0');
	for (int i=sz-1; i>=0; i--) putchar('0'+a[i]);
}
inline char getreal() {char c=_buff.get(); while (c<=32) c=_buff.get(); return c;}
ll qpow(ll x, ll k) {return k==0? 1: 1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
ll A, B, C;
int main()
{
	cin>>A>>B>>C;
	cout<<min(A+B+1,C)+B<<endl;
	return 0;
}


Measured memory_bytes: 256
from collections import deque
n , m = map(int,input().split())
route = [[] for i in range(n)]

for _ in range(m):
    a , b = map(lambda x:int(x)-1,input().split())
    route[a].append(b)
    route[b].append(a)
    
visit = [False for i in range(n)]
ans = 0
for i in range(n):
    if visit[i]:
        continue
    cou = 1
    visit[i] = True
    d = deque()
    d.append(i)
    while d:
        now = d.popleft()
        for j in route[now]:
            if not visit[j]:
                visit[j] = True
                cou += 1
                d.append(j)
    ans = max(cou,ans)
print(ans)

Measured memory_bytes: 123036
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
        int min;
        int count = 0;
        int result = 0;
        if(a < b) min = a;
        else min = b;
        for(int i=min; i>=1; i--){
         	if(a % i == 0 && b % i == 0){
             	count++;
                if(count == c){
                  result = i;
                  break;
                }
            }
        }
		System.out.println(result);
	}
}


Measured memory_bytes: 22996
s = int(input())
ss = set()
ss.add(s)
k = 1
while True:
    if s%2 == 0:
        s = s/2
    else:
        s = 3*s + 1
    s = int(s)
    if s in ss:
#         print(s,s)
        break
    ss.add(s)
#     print(s)
    k+=1
#     print(s)
print(k+1)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int people = sc.nextInt();
        int defaultPoint = sc.nextInt();
        int answers = sc.nextInt();
        int[] answerers = new int[answers];
        for(int i=0; i<answers; i++){
            answerers[i] = sc.nextInt()-1;
        }
        solve(people,defaultPoint,answerers);
    }

    public static void solve(int people, int defPoint, int[] answerers){
        int[] correctAns = new int[people];
        for(int i: answerers){
            correctAns[i]++;
        }
        for(int i: correctAns){
            System.out.println(i > answerers.length - defPoint ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 63788