akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  int ans = 0;
  rep2(i, 1, s.size()){
    if(s.at(i) != s.at(i-1)) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
package main

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

func main() {
	scan_init()
	n := scanInt()
	k := scanInt()
	sum := n%k
	onemoresum := -((n%k)-k) //n%k -kはminus確定
	if sum < onemoresum {
		fmt.Println(sum)
	} else {
		fmt.Println(onemoresum)
	}
}
var sc = bufio.NewScanner(os.Stdin)
func scan_init () {
	sc.Split(bufio.ScanWords)
}
func scanInt () int{
sc.Scan()
	i,_ := strconv.Atoi(sc.Text())
	return i
}
//func scan () string{
//  sc.Scan()
//	return sc.Text()
//}

Measured memory_bytes: 1772
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
using namespace std;
const LL prime=1000000007;
int n;
LL memo[310][310][310];
LL solve(int left,int already,int goals){
  if(left==0)
    if(goals==n) return 1;
    else return 0;
  else if(memo[left][already][goals]!=-1) return memo[left][already][goals];
  else{
    LL answer=0;
    if(n-already-goals) answer+=solve(left-1,already+1,goals)*(n-already-goals);
    answer+=solve(left-1,already,goals)*already;
    answer+=solve(left-1,0,already+goals)*goals;
    return memo[left][already][goals]=answer%prime;
  }
}
int main(void)
{
  int m;
  cin >> n >> m;
  REP(i,301) REP(j,301) REP(k,301) memo[i][j][k]=-1;
  cout << solve(m,0,1) << endl;
  return 0;
}

Measured memory_bytes: 220928
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Apr 19 21:50:25 JST 2020
 **/

signed main() {
    Int n, m;
    std::cin >> n >> m;
    REP(i, m) {
        Int x;
        std::cin >> x;
        n -= x;
    }
    std::cout << (n < 0 ? -1 : n) << std::endl;
}


Measured memory_bytes: 3652
S=list(input())
S=['_']+S
i=1
ans=0
while i<=len(S)-3:
    ans+=1
    if S[i-1]==S[i]:
        S[i+1]='_'
        i+=1
    i+=1

if len(S)==2:
    ans+=1
elif len(S)-i==1:
    ans+=1
elif S[i-1]!=S[i] and S[i]!=S[i+1]:
    ans+=2
else:
    ans+=1

print(ans)

Measured memory_bytes: 6308
#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
const int maxn = 305;
const int mod = 1e9+7;

int n,m;
bool fails[maxn][maxn][maxn];
int dp[maxn][maxn][maxn]; //RGB

int dpf(int R, int G, int B) {
	if (dp[R][G][B] != -1) return dp[R][G][B];
	int x = R, y = G, z = B;
	if (z > y) swap(z,y);
	if (y > x) swap(x,y);
	if (z > y) swap(z,y);
	
	if (fails[x][y][z]) return dp[R][G][B] = 0;
	if (x == n) return 1;
	
	dp[R][G][B] = dpf(x+1,G,B);
	
	dp[R][G][B] += dpf(R,x+1,B);
	dp[R][G][B] %= mod;
	
	dp[R][G][B] += dpf(R,G,x+1);
	dp[R][G][B] %= mod;
	
	return dp[R][G][B];
}

int main() {
	FAST
	cin >> n >> m;
	
	for (int xd =0;xd<m;xd++) {
		int a,b,x; cin >> a >> b >> x;
		for (int i =0;i<=n;i++) {
			for (int j=0;j<=i;j++) {
				int co = 1;
				if (i >= a) co++;
				if (j >= a) co++;
				
				if (co != x) fails[b][i][j] = 1;
			}
		}
	}
	memset(dp,-1,sizeof dp);
	cout << dpf(0,0,0);
	
}








Measured memory_bytes: 138496
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
 



int main()
{
    fastio
    ll i,j;
    
    char d;
    cin>>d;
    
    if(d<='z' && d>='a')
    cout<<"a";
    else
    cout<<"A";
}


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

int main(){
  int n,x;
  cin >>n >>x;
  
  int N = 2*(n-1)+1;
  rep(i,N) {
    cout << x-(n-1)+i << " ";
  }
  cout << endl;
  return 0;
}


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

#define int long long

#define pii pair<int,int> 
#define fs first
#define sc second

int N;
int a[200010];

main()
{
	ios::sync_with_stdio(false);
	
	cin>>N;
	for(int i=1;i<=N;i++)
	{
		cin>>a[i];
	}
	int ans=0;
	for(int i=1;i<=N;i++)
	{
		ans+=a[i]/2;
		if(a[i]%2 && a[i+1])
		{
			a[i+1]--;
			ans++;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(string, s);
    print((s.find("7") != string::npos) ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <limits>
#include <iomanip>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '

const int MAXN = 200;
//ll a[MAXN], ST[MAXN * 4], LZ[MAXN*4];

/*bool perfectSquare(ll x){
    ll s = sqrt(x);
    if(s *s == x) return true;
    else return false;
}*/
typedef long double ld;

int main() { 
    int n = 0, m = 0;
    cin >> n >> m;
    int sum = 0, number = 0;
    for(int i = 0; i < m; ++i){
        cin >> number;
        sum+=number;
    }
    if(sum > n){cout << -1 << endl;}
    else{cout << n - sum << endl;}
  
    return 0; 
} 


Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define fs second
typedef pair<int,int> P;
int n,m,k,i,j,kage[1001][1001],p,l;
int main(void)
{
	char cf[20]="123456789";
	char mp[1001][1001];
	int x[5]={1,0,-1,0},y[5]={0,1,0,-1};
	queue<P> qu;
	queue<int> q; 
	P pp;
	scanf("%d %d %d",&n,&m,&k);
	for(i=0;i<n;i++) scanf("%s",mp[i]);
	for(i=0;i<n;i++) for(j=0;j<m;j++) {
			kage[i][j]=0;
			if(mp[i][j]=='S') qu.push(P(i,j));
	}
	pp=qu.front();
	kage[pp.ff][pp.fs]=1;
	q.push(0);
	for(l=1;l<=k;l++){
		//printf("aa\n");
		while(qu.size()!=0){
			pp=qu.front();
			p=q.front();
			if(mp[pp.ff][pp.fs]==cf[l-1]) break;
			for(i=0;i<4;i++){
				if(pp.ff+y[i]<0||pp.ff+y[i]>=n||pp.fs+x[i]<0||pp.fs+x[i]>=m);
				else if(mp[pp.ff+y[i]][pp.fs+x[i]]!='X'&&kage[pp.ff+y[i]][pp.fs+x[i]]<l){
					qu.push(P(pp.ff+y[i],pp.fs+x[i]));
					q.push(p+1);
					kage[pp.ff+y[i]][pp.fs+x[i]]=l;
					//printf("p=%d %d %d\n",p,pp.ff+y[i],pp.fs+x[i]);
				}
			}
			qu.pop();
			q.pop();
		}
		while(qu.size()!=0&&q.size()!=0){
			qu.pop();
			q.pop();
		}
		//printf("A p=%d %d %d\n",p,pp.ff+y[i],pp.fs+x[i]);
		qu.push(P(pp.ff,pp.fs));
		q.push(p);
	}
	printf("%d\n",p);
	return 0;
}


Measured memory_bytes: 8124
#include <stdio.h>
#include <string.h>
#include <math.h>
#pragma warning(disable : 4996)

int main()
{
    long A, B, C, K;
    
    int i, j;
    int r;
    long max;

    scanf("%ld %ld %ld %ld", &A, &B, &C, &K);

    if (A + B >= K)
        if (A >= K)
            max = K;
        else
            max = A;
    else
        max = A - (K - A - B) * 1;

    printf("%ld", max);

    return 0;

}

Measured memory_bytes: 2112
#include<stdio.h>
#include<math.h>
int isPrime(int);
int count;
int main(void){
	int i,j,m,a;
	scanf("%d",&m);
	for(i=0;i<m;i++){
	scanf("%d",&a);
	isPrime(a);
	}	
	printf("%d\n",count);
	return 0;
}
int isPrime(int d){
	int i;
	if(d==2){count++;return 0;}
	if(d>2&&d%2==0)return 0;
	for(i=3;i<=sqrt(d);i+=2)
		if(d%i==0)return 0;
	count++;
	return 0;
}

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

void solve(int n) {
  string str;
  for (int i = 0; i < 10; i++)
    if ((n >> i) & 1)
      str += to_string(1 << i) + " ";

  if (!str.empty())
    str.pop_back();

  cout << str << endl;
}

int main() {
  int n;
  while (cin >> n)
    solve(n);

  return 0;
}


Measured memory_bytes: 3116
#include<iostream>
#include<algorithm>
using namespace std;
int dp[1<<16],n;
int L[100],t[100];
main()
{
	while(cin>>n,n)
	{
		for(int i=0;i<n;i++)
		{
			t[i]=0;
			int m;
			cin>>m>>L[i];
			for(;m--;)
			{
				int l,r;cin>>l>>r;
				l-=6;r-=6;
				for(int j=l;j<r;j++)
				{
					t[i]|=1<<j;
				}
			}
		}
		for(int i=0;i<1<<16;i++)dp[i]=0;
		for(int i=0;i<1<<16;i++)
		{
			for(int j=0;j<n;j++)
			{
				if(~i&t[j])continue;
				dp[i]=max(dp[i],L[j]+dp[i&~t[j]]);
			}
		}
		cout<<dp[(1<<16)-1]<<endl;
	}
}



Measured memory_bytes: 3340
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, M = MAP()

print("Yes" if N==M else "No")


Measured memory_bytes: 5832
#include<stdio.h>

int main(){
  int i,j,k=0;
  
  char S[100];
  
  scanf("%s",S);
  int max=0;
  for(i=0;i<strlen(S);i++){
    k=0;
    if(S[i]=='A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T'){
      while(S[i]=='A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T'){
        k++;
        i++;
      }
    }
    if(k>max)
      max = k;
  }
  
  printf("%d\n",max);
  return 0;
}
    

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>

int main(){
  int i,a,b,k;
  scanf("%d %d %d",&a,&b,&k);
  

  for(i=0;i<k;i++){
    if(a+i>b)
      break;
    printf("%d\n",a+i);
  }
  
  for(i=k-1;i>=0;i--){
    if(b-i>=a+k)
      printf("%d\n",b-i);
  }
  
  
    
  
}

Measured memory_bytes: 128
(defun solve (s)
  (let* ((lst (concatenate 'list s))
         (red-count (count-num lst #\0))
         (blue-count (count-num lst #\1)))
    (* (min red-count blue-count) 2)))

(defun count-num (lst num)
  (loop :for elem :in lst
        :when (equal elem num)
        :count t))

(defun main ()
  (let ((s (read-line)))
    (format t "~A~%" (solve s))))

(main)


Measured memory_bytes: 18788
#include<stdio.h>
int main()
{
    int a,x=0,y=0,b,z,i;
    scanf("%d %d",&a,&b);
    for(i=1;i<a;i++)
    {
        x=x+i;
    }
    if (b>1)
    {
     for(i=1;i<b;i++)
    {
        y=y+i;
    }
    }
    else if(b==1)
    {
        y=0;
    }
    z=x+y;

    printf("%d\n",z);
}

Measured memory_bytes: 128
N, Y = map(int,input().split())

count = 0
for i in range(0,N+1):
    for j in  range(0,N+1):
        tmp = Y - i * 10000 - j * 5000
        k = tmp // 1000
        if 0 <= k and tmp % 1000 == 0 and i + j + k == N:
            print(i,j,tmp//1000)
            exit()
        
print(-1,-1,-1)

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC017A
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, P;
            string[] vals = Console.ReadLine().Split(' ');
            N = int.Parse(vals[0]);
            P = int.Parse(vals[1]);

            int numOfEven = 0, numOfOdd = 0;

            vals = Console.ReadLine().Split(' ');
            int A;
            for(int i=0; i < N; i++)
            {
                A = int.Parse(vals[i]);
                if (A % 2 == 0)
                    numOfEven++;
                else
                    numOfOdd++;
            }

            long[,] p = pascalTriangle(N, N);
            long ret = 0;
            if (P == 0)
            {
                for(int i = 0; i <= numOfOdd; i+=2)
                {
                    ret += combination(numOfOdd, i, p);
                }
            }
            else
            {
                for (int i = 1; i <= numOfOdd; i += 2)
                {
                    ret += combination(numOfOdd, i, p);
                }
            }

            for (int i = 0; i < numOfEven; i++)
                ret *= 2;

            Console.WriteLine(ret);

        }

        static long[,] pascalTriangle(int w, int h)
        {
            long[,] arr = new long[h + 1, w + 1];
            arr[0, 0] = 1;

            for(int i=0; i <= h; i++)
            {
                for(int j=0; j <= w; j++)
                {
                    if( j > 0)
                    {
                        arr[i, j] += arr[i, j - 1];
                    }
                    if(i > 0)
                    {
                        arr[i, j] += arr[i - 1, j];
                    }
                }
            }
            return arr;
        }

        static long combination(int n, int r, long[,] arr)
        {
            if(r == 0 || r == n)
            {
                return 1;
            }
            if(r == 1)
            {
                return n;
            }

            return arr[n - r, r];

        }

    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <set>
#include <array>

using namespace std;

typedef long long ll;

int main()
{
    int n;
    cin >> n;
    array<ll, 26> count;
    fill(count.begin(), count.end(), 0);

    for (int i = 0; i < n; i++)
    {
        string name;
        cin >> name;
        count[name[0] - 'A']++;
    }

    ll ans = 0;
    const array<int, 5> idx = { 'M' - 'A', 'A'- 'A', 'R' - 'A', 'C' - 'A', 'H' - 'A' };
    for (int i = 0; i < 5; i++)
    {
        for (int j = i + 1; j < 5; j++)
        {
            for (int k = j + 1; k < 5; k++)
            {
                ans += count[idx[i]] * count[idx[j]] * count[idx[k]];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC079
{
    class D2
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int Y = input[0];
            int X = input[1];

            int C = 10;
            long[,] dist = new long[C, C];
            for (int y = 0; y < C; y++)
            {
                input = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int x = 0; x < C; x++)
                {
                    dist[x, y] = input[x];
                }
            }

            for (int k = 0; k < C; k++)
            {

                for (int i = 0; i < C; i++)
                {
                    for (int j = 0; j < C; j++)
                    {
                        dist[i, j] = Math.Min(dist[i, j], dist[i, k] + dist[k, j]);
                    }
                }
            }


            int[] count = new int[C];
            for (int y = 0; y < Y; y++)
            {
                input = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int x = 0; x < X; x++)
                {
                    if (-1 < input[x]) count[input[x]]++;
                }
            }

            //Console.WriteLine(string.Join(",", count));
            long res = 0;
            for (int i = 0; i < C; i++)
            {
                res += count[i] * dist[1, i];
                //Console.WriteLine(dist[1, i]);
            }
            Console.WriteLine(res);

        }
    }
}


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

using namespace std;

int main() {
	long long N, A, B, C, D, E;
	cin >> N >> A >> B >> C >> D >> E;
	cout << max({ (N - 1) / A, (N - 1) / B, (N - 1) / C, (N - 1) / D, (N - 1) / E }) + 5;
	return 0;
}

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

map<int, int> cnt;

signed main() {
	int n;
	
	cin >> n;
	
	vector<int> a(n + 1);
	
	int q;
	
	for (int i = 1; i <= n; ++i) cin >> a[i];
	
	cin >> q;
	
	int s = 0;
	
	for (int i = 1; i <= n; ++i) {
		s += a[i];
		cnt[a[i]]++;
	}
	
	for (int i = 1; i <= q; ++i) {
		int b, c;
		cin >> b >> c;
		int change = cnt[b];
		
		cnt[c] += cnt[b];
		
		cnt[b] = 0;
		
		s += (c - b) * change;
		
		cout << s << '\n';
	}
}

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int n; cin >> n;
    int h, w; cin >> h >> w;
    vector<int> a(n), b(n);
    REP(i, n) cin >> a[i] >> b[i];

    int cnt = 0;
    REP(i, n)
        if (a[i] >= h && b[i] >= w) cnt++;

    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define pii pair<int,int>
#define pb push_back
#define cases int tc;cin>>tc;while(tc--)
#define N 100003
#define M 1003
int mod=1e9+7;
//int mod=998244353;

signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int h1,w1,h2,w2;
    cin>>h1>>w1>>h2>>w2;
    h1-=h2;
    h1=(h1*(w1-w2));
    cout<<h1;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		int in[] = new int[s.nextInt()],res=0;
		Arrays.fill(in, -1);
		for(int i=0;i<in.length;i++) {
			in[i]=s.nextInt()-1;
		}
		for(int i=0;i<in.length;i++) {
			if(in[in[i]]==i) {
				res++;
				//System.out.println(i);
			}
		}
		System.out.println(res/2);
	}
}

Measured memory_bytes: 50328
import java.util.Scanner;

public class Main {

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

	private void execute() {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final char two = '2';
		int cnt = 0;
		
		assert(N>=1000 && N<10000);
		
		for (char c: Integer.toString(N).toCharArray()) {
			if(c==two) {
				cnt++;
			}
		}
		System.out.println(cnt);
		sc.close();
	}

}


Measured memory_bytes: 21460
#include<iostream>
using namespace std;
#define MAX 7500000
int main(){
  int m,n,tm;
  cin >> m >> n;
  while(n!=0){
    bool eratos[MAX];
    int i=m;
    fill(eratos,eratos+MAX,true);
    while(n!=0){
      if(eratos[i]==true){
        for(int j=i;j<MAX;j+=i){
          eratos[j]=false;
        }
        n--;
      }
      i++;
    }
    i=m;
    while(eratos[i]==false)i++;
    cout << i<<endl;
    cin >> m >> n;
  }
}



Measured memory_bytes: 10380
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main(){
    map<char,int> T;
    string S;
    bool can=true;
    cin>>S;
    for(int i=0;i<(int)S.size();i++){
        T[S[i]]++;
    }

    for(auto it=T.begin();it!=T.end();it++){
        if(it->second>=2){
            can=false;
        }
    }

    if(can){
        cout<<"yes"<<endl;
    }else{
        cout<<"no"<<endl;
    }

    return 0;
}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n,x,y;
    cin>>n>>x>>y;
    vector<int> E[2005];
    for(int i=0;i<n-1;++i){
        E[i].push_back(i+1);
        E[i+1].push_back(i);
    }
    x--;y--;
    E[x].push_back(y);
    E[y].push_back(x);
    vector<int> ret(2005);
    for(int i=0;i<n;++i){
        vector<int> dist(2005,inf);
        queue<int> q;
        q.push(i);
        dist[i] = 0;
        while(!q.empty()){
            int cur = q.front();q.pop();
            if(cur > i)ret[dist[cur]]++;
            for(auto v : E[cur])if(dist[v] == inf){
                dist[v] = dist[cur] + 1;
                q.push(v);
            }
        }
    }
    for(int i=1;i<n;++i)cout << ret[i] << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

int main(){
	long long n, p, q;
	cin >> n >> p >> q;

	vector<long long> c(n);
	long long sum = 0;
	rep(i,n){
		cin >> c[i];
		sum += c[i];
	}

	vector<long long> minus(n);
	rep(i,n){
		minus[i] = p * i + c[i];
	}
	sort(all(minus));

	long long ans = sum;
	long long m = 0;
	range(i,1,n + 1){
		m += minus[i - 1];
		//cout << i * p * q << ' ' << p * i * (i - 1) << ' ' << m << endl;
		ans = max(ans, sum + i * p * q + p * i * (i - 1) - m);
	}
	cout << ans << endl;
}

Measured memory_bytes: 10760
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
string to_str(ll A){
    stringstream ss;
    ss << A;
    return ss.str();
}
main(){
    int A,L;
    cin >> A >> L;
    while(L){
        int cnt = 0;
        int next = A;
        map<int,int> mp;
        do{
            mp[next] = cnt;
            string hi,lo;
            lo = hi = to_str(next);
            sort(lo.begin(), lo.end());
            sort(hi.rbegin(), hi.rend());
            if(hi.length() < L)hi += string(L - hi.length(),'0');
            //cout << hi << " " << lo << endl;
            next = stoi(hi) - stoi(lo);
            cnt++;
            //cout << next << endl;
        }while(mp.find(next) == mp.end());
        cout << mp[next] << " " << next << " " << cnt - mp[next] << endl;
        cin >> A >> L;
    }
}


Measured memory_bytes: 3172
from collections import deque
n,x,y = map(int,input().split())
G = [[] for _ in range(n+1)]
for i in range(1, n):
    G[i].append(i+1)
    G[i+1].append(i)
G[x].append(y)
G[y].append(x)

cost = [0]*(n+1)
for i in range(1, n+1):
    visited = [-1]*(n+1)
    que = deque([(i, 0)])
    while que:
        idx, cst = que.popleft()
        if visited[idx]!=-1:
            continue
        visited[idx] = cst
        for to in G[idx]:
            que.append((to, cst+1))
    for j in range(i, n+1):
        cost[visited[j]] += 1
for c in cost[1:-1]:
    print(c)

Measured memory_bytes: 49884
/**
https : //atcoder.jp/contests/abc177/tasks/abc177_c
**/

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

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

    const uint64_t base = 1000000007;
    uint64_t sum = 0;

    int64_t sum1d = 0;
    for (int i = 0; i < n; ++i)
    {
        sum1d += a[i] % base;
    }

    for (int i = 0; i < n - 1; ++i)
    {
        const auto ai = a[i];
        sum1d -= ai;
        if (sum1d < 0) sum1d += base;
        sum1d %= base;
        sum += sum1d * ai;
        sum %= base;
    }

    cout << sum << endl;
}


Measured memory_bytes: 4740
N=int(input())
s=[2,3,5]
ans=[]
for i in range(7,55555):
    for j in s:
       if i%j==0:
           break
       if j>i**(0.5):
           
           s.append(i)
           
           if i%5==1:
               ans.append(i)
           break
           
    if len(ans)==N:
        break
    
for i in range(N):
    print(ans[i],end=" ")

Measured memory_bytes: 3060
from math import log
mod = int(1e9) + 7
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()

def sign(v):
    if v == 0:
        return 0
    return 1 if v > 0 else -1

pref = [(0, 1)] * (n + 1)
suf = [(0, 1)] * (n + 1)

c = 1
sm = 0
sgn = 1
for j in range(n):
    c = c * a[j] % mod
    sgn *= sign(a[j])
    if a[j] != 0:
        sm += log(abs(a[j]))
    pref[j + 1] = (sgn * sm, c, sgn)

c = 1
sm = 0
sgn = 1
for j in range(n):
    c = c * a[n - j - 1] % mod
    sgn *= sign(a[n - j - 1])
    if a[n - j - 1] != 0:
        sm += log(abs(a[n - j - 1]))
    suf[j + 1] = (sgn * sm, c, sgn)

m = max(pref[k], suf[k])
for i in range(1, k):
    sgn = pref[i][2] * suf[k - i][2]
    pm = pref[i][1] * suf[k - i][1] % mod
    sm = abs(pref[i][0]) + abs(suf[k - i][0])
    m = max(m, (sgn * sm, pm, sgn))

    
print(m[1])


Measured memory_bytes: 71204
#include<iostream>
#include<algorithm>
#include<string>
//#include<Hatsune_Miku>
using namespace std;
 long long f[420001]={2};
int n,ans=0;
int main()
{
	std::ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		f[i]=f[i-1]*2+2;
	}
	cout<<f[n]<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Numerics;
using System.Text;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        Console.WriteLine(Parse(sc.Next()) % Parse(sc.Next()));
    }

    public BigInteger Parse(string s)
    {
        BigInteger result = 0;
        StringBuilder sb = new StringBuilder();
        int minus = s[0] == '-' ? 1 : 0;

        for (int i = minus; i < s.Length; i++)
        {
            sb.Append(s[i]);
            if ((i + 1) % 18 == minus)
            {
                result *= (long) 1e18;
                result += long.Parse(sb.ToString());
                sb = new StringBuilder();
            }
        }

        if (sb.Length > 0)
        {
            result *= (long) Math.Pow(10, sb.Length);
            result += long.Parse(sb.ToString());
        }

        return minus == 1 ? -result : result;
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}


Measured memory_bytes: 20176
#include<bits/stdc++.h>
#define mod 1000000007
#define MN 200000
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
char s[MN+5];
int g[MN+5],n,m,R,all=1;
void Dp1()//每个都有一个合法相连
{
    g[1]=1;int ans=1;
    for(int i=2;i<=n;++i) g[i]=(g[i-1]+g[i-2])%mod;
    for(int i=1;i<n;++i) ans=(ans+1LL*(g[i]-g[i-1]+mod)*(n-i+1))%mod;
    printf("%d",ans);
}
void Dp2()//长度为奇数且处于[1,R]
{
    int ans=0,first=1,R=n-1;
    for(int i=1,j;i<=m;i=j)
    {
        for(j=i;j<=m&&s[j]==s[1];++j);
        if(j>m) break;
        int len=j-i;
        if(len&1) R=min(R,len);
        else first?R=min(R,len+1):0;
        first=0;
        for(;j<=m&&s[j]!=s[1];++j);
    }
    g[1]=1;
    for(int i=3;i<=n;i+=2)
    {
        g[i]=(g[i-2]-g[max(0,i-R-3)]+mod)%mod;
        g[i]=(g[i]+g[i-2])%mod;
    }
    for(int i=max(1,n-R);i<=n;i+=2) ans=(ans+1LL*(n-i+1)*(g[i]-g[max(0,i-2)]+mod))%mod;
    printf("%d",ans);
}
int main()
{
    R=n=read();m=read();scanf("%s",s+1);
    for(int i=1;i<=m;++i) if(s[i]!=s[1]) all=0;
    if(all) Dp1();
    else (n&1)?puts("0"):(Dp2(),0);
    return 0;
}

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

int main()
{
    int q, h, s, d;
    int n;
    cin >> q >> h >> s >> d;
    cin >> n;
    h = min(2 * q, h);
    s = min(2 * h, s);
    if(2 * s <= d) cout << (ll) n * s << endl;
    else cout << (ll) (n / 2) * d + (n % 2) * s << endl;
    return 0;
}


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

int main(){
    char a,b,c,d;
    cin >> a >> b >> c >> d;
    if (a==b&&c!=d){
        if (c==d){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else if (a==c&&b!=d){
        if (b==d){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else if (a==d&&a!=b){
        if (b==c){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else if (b==c&&a!=b){
        if (a==d){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else if (b==d&&a!=b){
        if (a==c){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else if (c==d&&a!=c){
        if (a==b){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }
}

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

int main(){
  double N,X=1;
  bool b = 1;
  cin >> N;
  while(b){
    if(floor(X*1.08)==N){
      b = 0;
    }else if(X==N){
      break;
    }else{
      ++X;
    }
  }
  if(b){
    cout << ":(" << endl;
  }else{
    cout << X << endl;
  }
}


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


using namespace std;

const int MAXN = (int) 1e5;

pair <int, int> v[MAXN + 1];

vector <bool> bits;

int main() {
    //fstream cin("A.in");
    //ofstream cout("A.out");
    int i, j, n, k;
    ios::sync_with_stdio(false);
    cin >> n >> k;
    for(i = 1; i <= n; i++)
        cin >> v[i].first >> v[i].second;
    int aux = k;
    while(aux > 0) {
        bits.push_back(aux & 1);
        aux >>= 1;
    }
    ll ans = 0;
    for(i = 0; i <= bits.size(); i++) {
        ll sum = 0;
        for(int p = 1; p <= n; p++) {
            if(v[p].first <= k) {
                bool flag = 1;
                for(j = (int) bits.size() - 1; j >= (int) bits.size() - i; j--) {
                    if(bits[j] < ((v[p].first & (1 << j)) > 0))
                        flag = 0;
                }
                while(j >= 0 && bits[j] == 0) {
                    if(v[p].first & (1 << j))
                        flag = 0;
                    j--;
                }
                if((j >= 0 && (v[p].first & (1 << j)) == 0) || j == -1)
                    sum += v[p].second * flag;
            }
        }
        ans = max(ans, sum);
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		System.out.println(b - a == c - b ? "YES" : "NO");
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
using namespace std;
using P=pair<int,int>;
using G=vector<vector<int>>;
using ll=long long;

string subsum(int* A,int n,int m){
  bitset<2010> E(1);

  rep(i,0,n){
    E |= (E<<A[i]);
  }

  if(E.test(m)) return "yes";
  else return "no";
}

vector<bool> seen;
vector<int> d;
vector<int> f;



int main(int argc,char **argv){
  int n; cin>>n;
  ll a[n];
  rep(i,0,n) cin>>a[i];
  
  int cnt=0;
  while(1){
    rep(i,0,n){
      if(a[i]%2==0){
        a[i]/=2;
      }else{
        cout<<cnt<<endl;
        return 0;
      }
    }
    cnt++;
  }
  }

Measured memory_bytes: 256
N = int(input())
count = 0
T, X, Y = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    if abs(x-X)+abs(y-Y) <= t-T and t % 2 == (x+y) % 2:
        count += 1
    T, X, Y = t, x, y
print("Yes" if count == N else "No")

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

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v; stringstream ss(s); string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}
#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	int a, b; cin >> a >> b;
	if (a == 1) a = 14;
	if (b == 1) b = 14;
	if (a == b) puts("Draw");
	else if (a > b) puts("Alice");
	else puts("Bob");

	return 0;
}


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

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

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int a, b, c; cin >> a >> b >> c;
    int x=0, y=0;
    if(a == 5) x++;
    if(a == 7) y++;
    if(b == 5) x++;
    if(b == 7) y++;
    if(c == 5) x++;
    if(c == 7) y++;
    if(x == 2 && y == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7764
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>

#define N 600050
#define LL long long
const int mod=924844033,G1=5,G2=(3ll*mod+1)/G1;
using namespace std;
int n;
int he[N],ne[N<<2],to[N<<2],tot;
inline void addedge(int x,int y){
	to[++tot]=y;ne[tot]=he[x];he[x]=tot;
}
inline int qpow(int d,int z){
	int ret=1;
	for(;z;z>>=1,d=1ll*d*d%mod)
		if(z&1)ret=1ll*ret*d%mod;
	return ret;
}
int inc[N],inv[N];
inline int C(int n,int m){
	return 1ll*inc[n]*inv[m]*inv[n-m]%mod;
}
inline void init(int n){
	inc[0]=inv[0]=1;
	for(int i=1;i<=n;++i)inc[i]=1ll*inc[i-1]*i%mod;
	inv[n]=qpow(inc[n],mod-2);
	for(int i=n-1;i;--i)inv[i]=1ll*inv[i+1]*(i+1)%mod;
}
int sz[N],a[N],b[N];
inline void dfs(int g,int fa){
	sz[g]=1;
	for(int i=he[g];i;i=ne[i])
		if(to[i]!=fa)dfs(to[i],g),sz[g]+=sz[to[i]];
	if(fa)(a[sz[g]]+=inc[sz[g]])%=mod,(a[n-sz[g]]+=inc[n-sz[g]])%=mod;
}
inline void ntt(int *a,int n,int tag){
	static int r[N],cnt;cnt=-2;
	for(int i=n;i;i>>=1,++cnt);
	for(int i=0;i<n;++i){
		r[i]=(r[i>>1]>>1)|((i&1)<<cnt);
		if(r[i]>i)swap(a[i],a[r[i]]);
	}
	for(int i=1;i<n;i<<=1){
		int u=qpow(tag==1?G1:G2,mod/i/2),w=1;
		for(int j=0,I=i<<1;j<n;j+=I,w=1){
			for(int k=0;k<i;++k,w=1ll*w*u%mod){
				int t=1ll*w*a[j+k+i]%mod;
				a[j+k+i]=(a[j+k]+mod-t)%mod;
				a[j+k]=(a[j+k]+t)%mod;
			}
		}
	}
	if(tag==1)return;
	const LL iv=qpow(n,mod-2);
	for(int i=0;i<n;++i)a[i]=iv*a[i]%mod;
}

int main(){
	cin>>n;init(n+n);
	for(int i=1,x,y;i<n;++i)
		scanf("%d%d",&x,&y),addedge(x,y),addedge(y,x);
	dfs(1,0);
	for(int i=0;i<=n;++i)b[n-i]=inv[i];
	int len=1;while(len<=n)len<<=1;len<<=1;
	ntt(a,len,1);ntt(b,len,1);
	for(int i=0;i<len;++i)a[i]=1ll*a[i]*b[i]%mod;
	ntt(a,len,-1);
	for(int i=1;i<=n;++i)a[i]=a[i+n];
	for(int i=1;i<=n;++i){
		a[i]=1ll*inv[i]*(1ll*inc[n]*inv[n-i]%mod*n%mod+mod-a[i])%mod;
		printf("%d\n",(a[i])%mod);
	}
	return 0;
}

Measured memory_bytes: 22504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << x
#define print(x) cout << x << '\n'
#define debug(x) cerr << #x << ": " << x << '\n'
ll gcd(ll a, ll b){
    return b != 0 ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b){
    return a * b / gcd(a, b);
}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s, t;
vll dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> s >> n){
        rep(i, n){
            if(s[i] != '1'){
                print(s[i]);
                return 0;
            }
        }
        print(1);
    }
}



Measured memory_bytes: 256
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())),reverse=True)
B = sorted(list(map(int, input().split())),reverse=True)
C = sorted(list(map(int, input().split())),reverse=True)

ans = []
for x in range(X):
    if x+1 > K:
        break
    for y in range(Y):
        if (x+1) * (y+1) > K:
            break
        for z in range(Z):
            if (x+1) * (y+1) * (z+1) > K:
                break

            value = A[x] + B[y] + C[z]
            ans.append(value)

ans.sort(reverse=True)
for i in range(K):
    print(ans[i])


Measured memory_bytes: 8724
x, k, d = map(int, input().split())

x = abs(x)
if x // d > k:
    print(x - (d*k))
else:
    num = k - x // d
    if num % 2 == 0:
        print(x - (d * (x //d)))
    else:
        print(abs(x - (d * (x //d))-d))

Measured memory_bytes: 61804
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
char c[50][50];
int x[50][50];
bool used[50][50];
queue<P> q;
signed main(){
	int a,b,cnt=0;
	cin>>a>>b;
	f(i,a){
		f(j,b){
			cin>>c[i][j];
			if(c[i][j]=='.')cnt++;
		}
	}
	q.push(P(0,0));
	used[0][0]=true;
	while(q.size()){
		P p=q.front();
		q.pop();
		if(p.F&&!used[p.F-1][p.S]&&c[p.F-1][p.S]=='.'){
			x[p.F-1][p.S]=x[p.F][p.S]+1;
			used[p.F-1][p.S]=true;
			q.push(P(p.F-1,p.S));
		}
		if(p.F<a-1&&!used[p.F+1][p.S]&&c[p.F+1][p.S]=='.'){
			x[p.F+1][p.S]=x[p.F][p.S]+1;
			used[p.F+1][p.S]=true;
			q.push(P(p.F+1,p.S));
		}
		if(p.S&&!used[p.F][p.S-1]&&c[p.F][p.S-1]=='.'){
			x[p.F][p.S-1]=x[p.F][p.S]+1;
			used[p.F][p.S-1]=true;
			q.push(P(p.F,p.S-1));
		}
		if(p.S<b-1&&!used[p.F][p.S+1]&&c[p.F][p.S+1]=='.'){
			x[p.F][p.S+1]=x[p.F][p.S]+1;
			used[p.F][p.S+1]=true;
			q.push(P(p.F,p.S+1));
		}
	}
	if(x[a-1][b-1]==0)puts("-1");
	else cout<<cnt-x[a-1][b-1]-1<<endl;
	return 0;
}


Measured memory_bytes: 256