akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int N;
int stones[100000];
int costs[100000];

int main(){
    scanf("%d", &N);
    for (int i = 0; i < 2; i++){
        if (i == 0){
            scanf("%d", &stones[i]);
            costs[i] = 0;
        } else if (i = 1){
            scanf("%d", &stones[i]);
            costs[i] = abs(stones[1]-stones[0]);
        }
    }
    for (int i = 2; i < N; i++){
        scanf("%d", &stones[i]);
        int one = max(stones[i], stones[i-1])-min(stones[i], stones[i-1])+costs[i-1];
        int two = max(stones[i], stones[i-2])-min(stones[i], stones[i-2])+costs[i-2];
        costs[i] =min(one, two);
    }
    printf("%d", costs[N-1]);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;
ll MAX = 1000000000000000000;
using namespace std;

int main(){
    int n, flag;
    ll ans, an;
    ans = 1;
    flag = 1;

    cin >> n;
    REP(int,i,0,n){
        cin >> an;
        if(an==0){
          	cout << 0 << endl;
          	return 0;
        }else if(an>MAX/ans || ans*an>MAX){
            flag = 0;
        }
        if(flag) ans = ans*an;
    }
  	if(flag) cout << ans << endl;
  	else cout << -1 << endl;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(int i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

signed main(){
	IO_STREAM;
	int K,X;
	cin>>K>>X;
	if(K*500>=X){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3612
import sys
input = sys.stdin.buffer.readline
import copy
from collections import deque

def main():
    N,K = map(int,input().split())
    edge = [[] for _ in range(N)]
    for _ in range(N-1):
        a,b = map(int,input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
        
    go = [False for _ in range(N)]
    go[0] = True
    for num in edge[0]:
        go[num] = True
    MOD = 10**9+7
    fac = [0 for _ in range(K+1)]
    fac[0],fac[1] = 1,1
    inv = copy.deepcopy(fac)
    invfac = copy.deepcopy(fac)
    
    for i in range(2,K+1):
        fac[i] = (fac[i-1]*i)%MOD
        inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD
        invfac[i] = (invfac[i-1]*inv[i])%MOD
        
    def per(x,y):
        num = ((fac[x]*invfac[x-y])%MOD)
        return num

    if K-1 < len(edge[0]):
        print(0)
        exit()
    ans = K*(per(K-1,len(edge[0])))

    q = deque(edge[0])
    while q:
        now = q.popleft()
        use = 0
        for fol in edge[now]:
            if not go[fol]:
                use += 1
                go[fol] = True
                q.append(fol)
        if use > K-2:
            print(0)
            exit()
        num = per(K-2,use)
        ans *= num
        ans %= MOD
        
    print(ans%MOD)

if __name__ == "__main__":
    main()

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

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  int FUJI = 0;
  int COUNT = 0;
  for (int i = 0; i < N; i++){
    cin >> H.at(i);
    if (FUJI <= H.at(i)){
    FUJI = H.at(i);
      COUNT++;
    }
    }
   cout << COUNT << endl;   
}

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

int main(){
    using namespace std;
    size_t N;
    cin >> N;
    vector<unsigned long> A(N), B(N);
    copy_n(istream_iterator<unsigned long>(cin), N, A.begin());
    copy_n(A.begin(), N, B.begin());
    nth_element(B.begin(), B.begin() + N / 2, B.end());
    auto s = *max_element(B.begin(), B.begin() + N / 2), t = B[N / 2];
    transform(A.begin(), A.end(), ostream_iterator<unsigned long>(cout, "\n"), [&s, t](auto a){return a < t ? t : s;});
}

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

int main(){
    unsigned long N, A, B;
    scanf("%lu%lu%lu", &N, &A, &B);

    auto P = 1UL << N - 1;
    auto T = A ^ P ^ B;
    auto k = __builtin_popcountl(T);

    if(k & 1){
        puts("NO");
    }else{
        puts("YES");
        auto n = P * 2 - 1;
        vector<unsigned long> ans(n);
        for(unsigned long i = 0; i < n; ++i)ans[i] ^= (ans[i] = i ^ i + 1) >> 1;

        vector<unsigned long> t;
        for(unsigned long i = 1; i <= T; i *= 2)if(T & i)t.push_back(i);

        auto s = t.size();
        for(unsigned long i = 0, j = 0; i < s; i += 2){
            auto a = t[i], b = t[i + 1];
            for(; j < n; ++j){
                if(ans[j] > b)break;
                if(ans[j] == a)ans[j] = b;
                else if(ans[j] == b)ans[j] = a;
            }
        }

        printf("%lu ", A);
        for(const auto& i : ans)printf("%lu ", A ^= i);
        puts("");
    }

    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
int main(){
 int A,B,K;
 int max;
 int ans;
 int count=0;
  cin >> A >> B >> K;
  if(A>B){
    max=A;
  }
  else{
    max=B;
  }
  for(max=max;max>0;max--){
    if(A%max==0&&B%max==0){
      count++;
      ans=max;
    }
    if(count==K){
      break;
    }
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Pl = pair<ll, ll>;
using Tl = tuple<ll, ll, ll>;

const ll INF = 1e15;
const ld eps = 1e-6;
ll dx[] = {-1,-1,0};
ll dy[] = {0,-1,-1};
int main(){
  string s, t;
  cin >> s >> t;
  vector<vector<ll> > dp(s.size()+1, vector<ll>(t.size()+1));
  vector<vector<ll> > prev(s.size()+1, vector<ll>(t.size()+1));
  for(int i=0;i<(int)s.size();i++)
    for(int j=0;j<(int)t.size();j++){
      if(s[i] == t[j]){
	dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1);
	prev[i+1][j+1] = 1;
      }
      if(dp[i+1][j+1] <= dp[i][j+1]){
	dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j+1]);	
	prev[i+1][j+1] = 2;
      }
      if(dp[i+1][j+1] <= dp[i+1][j]){
	dp[i+1][j+1] = max(dp[i+1][j], dp[i+1][j+1]);
	prev[i+1][j+1] = 0;
      }
    }
  ll nx = t.size();
  ll ny = s.size();
  string ans = "";
  while(nx > 0 && ny > 0){
    if(prev[ny][nx] == 1)
      ans.push_back(s[ny-1]);
    ll dir = prev[ny][nx];
    nx += dx[dir];
    ny += dy[dir];
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 141184
#include <stdio.h>
#include <algorithm>

const int max_n = 1e5;
const int max_k = 1000;
int a[3 * max_k][3 * max_k];
int s[2][max_k][max_k];

void print(int n, int m) {
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            printf("%d ", a[i][j]);
        }
        printf("\n");
    }
    printf("--------------------\n");
}

int main() {
    int N, K;
    scanf("%d %d", &N, &K);
    for (int i = 0; i < 3 * K; i++) {
        for (int j = 0; j < 3 * K; j++) {
            a[i][j] = 0;
        }
    }
    for (int i = 0; i < K; ++i) {
        for (int j = 0; j < K; ++j) {
            s[0][i][j] = 0;
            s[1][i][j] = 0;
        }
    }
    for (int i = 0; i < N; ++i) {
        int x, y;
        char c;
        scanf("%d %d %c", &x, &y, &c);
        if (c == 'W') {
            y += K;
        }
        x %= 2 * K;
        y %= 2 * K;
        a[x][y] += 1;
        a[x + K][y + K] += 1;
        a[x + K][y] -= 1;
        a[x][y + K] -= 1;
    }
    //print(3 * K, 3 * K);

    for (int i = 0; i < 3 * K; ++i) {
        for (int j = 1; j < 3 * K; ++j) {
            a[i][j] += a[i][j - 1];
        }
    }
    //print(3 * K, 3 * K);

    for (int i = 1; i < 3 * K; ++i) {
        for (int j = 0; j < 3 * K; ++j) {
            a[i][j] += a[i - 1][j];
        }
    }
    //print(3 * K, 3 * K);

    for(int i = 0; i < 3 * K; ++i) {
        for(int j = 0; j < 3 * K; ++j) {
            int p = (i / K + j / K) % 2;
            s[p][i % K][j % K] += a[i][j];
        }
    }

    int ans = 0;
    for(int p = 0; p < 2; ++p) {
        for (int i = 0; i < 2 * K; ++i) {
            for (int j = 0; j < 2 * K; ++j) {
                ans = std::max(ans, s[p][i][j]);
            }
        }
    }

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

    return 0;
}

Measured memory_bytes: 43136
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    int n; cin >> n;
    vector<ll> A(n), B(n);
    rep(i, n) cin >> A[i];
    rep(i, n) cin >> B[i];

    ll mana = 0, cost = 0;
    rep(i, n){
        ll a = A[i], b = B[i];
        if(a < b) mana += (b-a)/2;
        else if(a > b) cost += a-b;
    }

    if(mana >= cost) cout << "Yes" << ln;
    else cout << "No" << ln;
    
}

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

int main(){
  int n,m;
  cin >> n;
  string s;
  map<string, int> ans;
  rep(i,n){
    cin >> s;
    ans[s]++;
  }
  cin >> m;
  rep(i,m){
    cin >> s;
    ans[s]--;
  }
  int maxs = 0;
  for(auto [moji, suji]: ans){
    if(suji > maxs)maxs = suji;
  }
  cout << maxs << endl;
  return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long t,n,i,j;
  cin>>n;
  long long a[n],b[n]={0};
  for(i=0;i<n;i++)
    cin>>a[i];
  b[0]=0;
  b[1]=abs(a[0]-a[1]);
  for(i=2;i<n;i++)
  {
    b[i]=min(b[i-1]+abs(a[i]-a[i-1]),b[i-2]+abs(a[i]-a[i-2]));
             }
             cout<<b[n-1];
  return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);
    
    int n; int a[100];
    cin >> n;
    FOR(i,0,n)
        cin >> a[i];
    int large = 0;
    int small = 999999999;
    FOR(i,0,n) {
        if (a[i] > large)
            large = a[i];
        if (a[i] < small)
            small = a[i];
    }
    cout << large - small << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,ans =0;
  
  cin >> N;
  vector<int> V(N),C(N),A(N);
  for (int i = 0; i < N; i++)
  {
    cin >>V.at(i);
  }
  for (int i = 0; i < N; i++)
  {
    cin >>C.at(i);
  }
  for (int i = 0; i < N; i++)
  {
    
    A.at(i) = V.at(i) - C.at(i);
    if(A.at(i) >= 0){
      ans += A.at(i);
    }
  }
  

 cout << ans << endl;
 
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>
#include <unordered_map>

using namespace std;
typedef long long  ll;

int main()
{
	ll n;
	cin >> n;
	vector<string> s(n);
	for (ll i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	string ans;
	for (char i = 'a'; i < 'z' + 1; i++)
	{
		ll num = 50;
		for (ll j = 0; j < n; j++)
		{
			ll cnt = 0;
			for (ll k = 0; k < s[j].length(); k++)
			{
				if (s[j][k] == i) cnt++;
			}
			num = min(cnt, num);
		}
		for (ll j = 0; j < num; j++)
		{
			ans += i;
		}
	}
	sort(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import Foundation
import CoreFoundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    func reversed() -> Array {
        return self.reverse()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
//func gcd(x: Int, _ y: Int) -> Int {
//    return y>0 ? gcd(y, x%y) : x
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}

/*************** テストスペース ***************/

//arr.sort{$0.0==$1.0 ? $0.1<$1.1 : $0.0<$1.0}  // 2つの条件に優先順位をつけてソート

/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (N, A, B) = (input[0], input[1], input[2])
print(min(A * N, B))


Measured memory_bytes: 7908
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define ll long long
#define FOR(i, n, m) for(int i=n; i<m; ++i)

int main(){
  int N;
  cin >> N;
  int flag = 0;
  
  FOR(i, 0, 25){
    FOR(j, 0, 15){
      if(4*i+7*j==N){
        flag = 1;
        break;
      }
    }
  }
  if(flag==1) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  
}

Measured memory_bytes: 256
n= gets.to_i
ary = gets.split.map(&:to_i)
if n==2
  ans = Array.new(n, ary[0])
  puts ans.inject(&:+)
  exit
else
  ans = Array.new(n,0)
end
ans[-1] = ary[-1]
ary.each_with_index do |k, i|
  if i==0
    ans[0] = ary[0]
    next
  end
  if ary[i-1]<=ary[i]
    ans[i] = ary[i-1]
  else
    ans[i] = ary[i]
  end
end
puts ans.inject(&:+)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
long long t,n;
int II()
{
int n;
scanf("%d",&n);
return n;
}
int main(){
cin>>n>>t;
int v[n];
for(int i=0;i<n;i++){
	cin>>v[i];
}
long long ans=t;

for(int i=1;i<n;i++){
	if(v[i]>=v[i-1]+t)
	ans+=t;
	else
	ans+=t-(v[i-1]+t-v[i]);
}
cout<<ans<<endl;



return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node
{
  int p, l, r;
};

Node T[MAX];
int n, D[MAX];

void print(int u)
{
  int i, c;
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "depth = " << D[u] << ", ";

  if (T[u].p == NIL)
    cout << "root, ";
  else if (T[u].l == NIL)
    cout << "leaf, ";
  else
    cout << "internal node, ";

  cout << "[";
  for (i = 0, c = T[u].l; c != NIL; i++, c = T[c].r)
  {
    if (i)
      cout << ", ";
    cout << c;
  }
  cout << "]" << endl;
}

void rec(int u, int p)
{
  D[u] = p;
  if (T[u].r != NIL)
    rec(T[u].r, p);
  if (T[u].l != NIL)
    rec(T[u].l, p + 1);
}

int main()
{
  int i, j, d, v, c, l, r;
  cin >> n;
  for (i = 0; i < n; i++)
    T[i].p = T[i].l = T[i].r = NIL;

  for (i = 0; i < n; i++)
  {
    cin >> v >> d;
    for (j = 0; j < d; j++)
    {
      cin >> c;
      if (j == 0)
        T[v].l = c;
      else
        T[l].r = c;
      l = c;
      T[c].p = v;
    }
  }
  for (i = 0; i < n; i++)
  {
    if (T[i].p == NIL)
      r = i;
  }
  rec(r, 0);
  for (i = 0; i < n; i++)
    print(i);
  return 0;
}


Measured memory_bytes: 7768
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }



int main()
{
	ll x; cin >> x;

	if (x <= 6)
	{
		cout << 1 << endl;
		return 0;
	}

	else if (x <= 11)
	{
		cout << 2 << endl;
		return 0;
	}

	ll ans =  x / 11 * 2;
	x %= 11;

	if (x)
		++ans;
	if (x > 6)
		++ans;

	cout << ans << endl;
}


Measured memory_bytes: 256
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars
    }
    let len = s.len();
    for right in (1..(len - 1)).rev() {
        if right % 2 == 0 { continue; }
        let mid = (right + 1) / 2;
        if s[0..mid] == s[mid..(right + 1)] {
            println!("{}", right + 1);
            std::process::exit(0);
        }
    }
    println!("{}", 1);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define INF 100000000
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)


int main(){
    int n, d, i = 0;
    cin >> n >> d;
    if (n % (2 * d + 1) + i){
        i += 1;
    }
    cout << n / (2 * d + 1) + i << '\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
ll  a[500000];
ll sum=0;
int main()
{
    ll n;
    cin>>n;
    for(ll i=0;i<n;i++)
    {
        ll k;
        cin>>k;
        sum+=k;
        a[k]++;
    }
    ll q;
    cin>>q;
    for(ll i=0;i<q;i++)
    {
        ll b,c;
        cin>>b>>c;
        ll x=a[b];
        sum=sum-x*b+x*c;
        a[b]=0;
        a[c]=a[c]+x;
        cout<<sum<<endl;
    }
    return 0;
}



Measured memory_bytes: 3940
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <unordered_set>
#include <unordered_map>
#include <cassert>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define mod 1000000007
#define mod1 1000000009
#define mod2 1000000021
#define INF 500001
#define MAX 1000000001
using namespace std;

/* 🐣🐥 */
ll dp[100001], b, ans;
int main() {
	int n, w, a;
	memset(dp, -1, sizeof(dp));
	scanf("%d %d", &n, &w);
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d %lld", &a, &b); // 무게, 가치
		for (int j = w; j >=a; j--) {
			if (dp[j - a] != -1) {
				dp[j] = max(dp[j], dp[j - a] + b);
			}
		}
	}
	for (int i = w; i >= 0; i--) if (dp[i] != -1) ans = max(ans, dp[i]);
	printf("%lld", ans);

	return 0;
}

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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define int long long int
#define maxn 100
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

typedef std::pair<int, int> P;

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

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

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0) {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x) //bit計算
{
    if (x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void) {
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++) {
        if (!prime[i]) {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i) {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) //素数判定
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
}

vector<int> divisor(int n) //約数列挙
{
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i - 1);
            if (i * i != n) {
                ret.push_back((n / i) - 1);
            }
        }
    }
    sort(ret.begin(), ret.end());
    return (ret);
}

signed main() {
    int H, A;
    cin >> H >> A;
    if (H % A > 0) {
        cout << H / A + 1 << endl;
    } else {
        cout << H / A << endl;
    }
}


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

#define inf 0x3f3f3f3f
#define INF 1000111000111000111LL
#define mod 1000000007
#define endl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define all(cc) (cc).begin(),(cc).end()
using lli = long long int ;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vb = vector<bool> ;
using vvi = vector<vector<int>> ;
using vlli = vector<long long int> ;
using vpii = vector<pair<int, int>> ;

int main()
  {
    ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
    int a, b, c, d ;
    cin>> a >> b >> c >> d ;
    cout<< max(0, min(b, d)-max(c, a)) ;
  }


Measured memory_bytes: 256
package main

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

func main() {
	var N int
	fmt.Scanln(&N)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	h := make([]int, N)
	for i := range h {
		sc.Scan()
		h[i], _ = strconv.Atoi(sc.Text())
	}

	var cnt, ans int
	for i := 1; i < N; i++ {
		if h[i-1] >= h[i] {
			cnt++
		} else {
			cnt = 0
		}
		ans = max(ans, cnt)
	}
	fmt.Println(ans)
}

func max(a, b int) int {
	return int(math.Max(float64(a), float64(b)))
}


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

int main(){
  int n,x,ans=0,s;cin>>n>>x;
  vector<int> m(n,0);
  REP(i,n) cin>>m.at(i);
  sort(m.begin(),m.end());
  s=accumulate(m.begin(),m.end(),0);
  cout<<(x-s)/m.at(0)+n;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            ArrayList<node> a[] = new ArrayList[n];
            for (int i = 0; i < n; i++) {
                int x = in.nextInt();
                a[i] = new ArrayList<>();
                for (int j = 0; j < x; j++) {
                    a[i].add(new node(in.nextInt() - 1, in.nextInt()));
                }
            }
            int max = 0;
            HashSet<Integer> hs = new HashSet<>();
            for (int i = 0; i < (1 << n); i++) {
                hs.clear();
                for (int j = 0; j < n; j++) {
                    if ((i & (1 << j)) > 0) hs.add(j);
                }
                int ans = 1;

                for (int x : hs) {
                    for (node temp : a[x]) {
                        if (temp.b == 0) {
                            if (hs.contains(temp.a))
                                ans = 0;
                        } else {
                            if (!hs.contains(temp.a)) ans = 0;
                        }
                    }
                }
                if (ans == 1) max = Math.max(max, hs.size());
            }
            out.println(max);
        }

        class node {
            int a;
            int b;

            node(int a, int b) {
                this.a = a;
                this.b = b;
            }

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

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

    }
}



Measured memory_bytes: 42196
ls_s = [_ for _ in input()]

cnt = 0
cmax = 0

for i in range(len(ls_s)):
    if (ls_s[i] == 'A') or (ls_s[i] == 'C') or (ls_s[i] =='G') or (ls_s[i] =='T'):
        cnt += 1
    elif cnt >= cmax:
        cmax = cnt
        cnt = 0
    else:
        cnt = 0
print(max(cmax, cnt))

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

int main() {
	int n, height_min, cnt = 0;
	int* pT;

	cin >> n >> height_min;

	pT = new int[n];

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

	for (int j = 0; j < n; j++) {
		if (pT[j] >= height_min) {
			cnt++;
		}
	}

	cout << cnt << "\n";

	delete[] pT;

	return 0;
}

Measured memory_bytes: 640
N = int(input())
A_list = list(map(int,input().split()))
B_list = list(map(int,input().split()))

result = 0
for i in range(0,N):
    if A_list[i] < B_list[i]:
        result += A_list[i]
        if A_list[i+1] < B_list[i] - A_list[i]:
            result += A_list[i+1]
            A_list[i+1] = 0
        else:
            result += B_list[i] - A_list[i]
            A_list[i+1] = A_list[i+1] - (B_list[i] - A_list[i])
    else:
        result += B_list[i]
        #print(B_list[i])

'''
B_odd = B_list[N-1] - A_list[N-1]
if A_list[N] > B_odd:
    result += B_odd
    print(B_odd)
else:
    result += A_list[N]
    print(A_list[N])
'''
print(result)

Measured memory_bytes: 18476
// https://atcoder.jp/contests/abc115/tasks/abc115_b

#[allow(unused)]
use std::cmp::{max, min};
#[allow(unused)]
use std::collections::{HashSet, VecDeque};
use std::io;
use std::io::{BufRead, Read, Write};
use std::str::FromStr;

#[allow(unused, non_snake_case)]
pub fn solve<R: BufRead, W: Write>(mut io: Io<R, W>) {
    let N: usize = io.next();
    let ps: Vec<usize> = io.nexts(N);

    let max_price = ps.iter().max().unwrap();
    let sum: usize = ps.iter().sum();
    let res = sum - max_price / 2;

    io.println(res);
}

#[allow(dead_code)]
fn main() {
    let stdin = io::stdin();
    let stdin_lock = stdin.lock();
    let stdout = io::stdout();
    let stdout_lock = stdout.lock();

    let io = Io {
        reader: stdin_lock,
        writer: stdout_lock,
    };

    solve(io);
}

/* IO helpers */

pub struct Io<R, W>
where
    R: BufRead,
    W: Write,
{
    pub reader: R,
    pub writer: W,
}

#[allow(dead_code)]
impl<R, W> Io<R, W>
where
    R: BufRead,
    W: Write,
{
    fn println<T: std::fmt::Display>(&mut self, value: T) {
        writeln!(&mut self.writer, "{}", value).expect("Unable to write");
    }

    fn print<T: std::fmt::Display>(&mut self, value: T) {
        write!(&mut self.writer, "{}", value).expect("Unable to write");
    }

    fn debug<T: std::fmt::Debug>(&mut self, value: T) {
        writeln!(&mut self.writer, "{:?}", value).expect("Unable to write");
    }

    fn next<T: FromStr>(&mut self) -> T {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok().expect("Unable to parse")
    }

    fn nexts<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next::<T>()).collect::<Vec<T>>()
    }
}

/* Structure helpers */

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}


Measured memory_bytes: 4352
#                         author:  kagemeka 
#                         created: 2019-11-08 12:38:16(JST)
## internal modules
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## external modules
# import scipy.special   # if use comb function on AtCoder, 
# import scipy.misc      # select scipy.misc.comb (old version) 

def main():
    n, *a = (int(x) for x in sys.stdin.read().split())

    total_count = 0
    atmost = math.floor(math.log(10 ** 9, 2))
    for i in range(n):
        current = a[i]
        count = 0
        for _ in range(atmost + 1):
            if current % 2 == 0:
                current //= 2
                count += 1
            else:
                break
        total_count += count
    
    print(total_count)

if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 4212
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
 
ll n;
vector<char> v;
 
vector<string> ans;
void fun()
{
    if(v.size() == n)
    {
        string temp="";
        for(int i=0 ; i<n ; i++)
            temp+=v[i];
 
      //  cout << "K:" << temp << endl;
        ans.push_back(temp);
        return;
    }
    else
    {
        //bool vis[26]={0};
       // for(int j=0  ; j<v.size() ; j++)
         //   vis[v[j]-'a'] = 1;
 
        bool vis[26]={0};
        for(int i=0 ; i<v.size() ; i++)
        {
            
                if(vis[v[i]-'a'])
                    continue;
            
                vis[v[i]-'a']=1;
                char p = v[i];
                v.push_back(p);
                fun();
                v.pop_back();
 
                p++;
               // cout <<v.size() <<" " <<  v[i] << " " << p << endl; 
                v.push_back(p);
                fun();
                v.pop_back();
            
        }
    }
}
 
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n;
    v.push_back('a');
    fun();
 
    sort(ans.begin(),ans.end());
 
    vector<string> a2;
 
    for(int i=0 ; i<ans.size() ; i++)
    {
        if(i==0)
            a2.push_back(ans[i]);
        else
        {
            if(a2[a2.size()-1] != ans[i])
                a2.push_back(ans[i]);
        }
    }
    for(int i=0 ; i<a2.size() ; i++)
        cout << a2[i] << "\n";
 
    return 0;
}

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

int main()
{
  int h,w;
  scanf("%d%d",&h,&w);
  static char M[1000][1001];
  for(int i=0;i<h;i++){
    scanf("%s",M[i]);
  }
  static int K[1000][1001]={0};
  int dx[8]={1,1,1,0,0,-1,-1,-1},dy[8]={-1,0,1,-1,1,-1,0,1};
  queue<pair<int,int> > Q[2];
  bool b=0;
  for(int i=1;i<h-1;i++){
    for(int j=1;j<w-1;j++){
      for(int v=0;v<8;v++){
	int x=i+dx[v],y=j+dy[v];
	if(M[x][y]=='.'){
	  K[i][j]++;
	}
      }
      if(M[i][j]!='.'&&K[i][j]>=M[i][j]-'0'){
	Q[b].push(make_pair(i,j));
      }
    }
  }
  int t=0;
  while(!Q[b].empty()){
    while(!Q[b].empty()){
      pair<int,int> p=Q[b].front();
      Q[b].pop();
      int i=p.first,j=p.second;
      for(int v=0;v<8;v++){
	int x=i+dx[v],y=j+dy[v];
	K[x][y]++;
	if(M[x][y]!='.'&&K[x][y]==M[x][y]-'0'){
	  Q[!b].push(make_pair(x,y));
	}
      }
    }
    t++;
    b=!b;
  }
  printf("%d\n",t);
  return 0;
}


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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
				// cout << x << " " << y << endl; 
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if(rx > ry) par[rx] = root(ry); //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
				else par[ry] = root(rx);
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void)
{
	int n, m;
	cin >> n >> m;
	vector<int> list;
	rep(i, n) list.push_back(i);
	UnionFind tree(n);
	rep(i, m){
		int a, b, c;
		cin >> a >> b >> c;
		tree.unite(a - 1, b - 1);
	}
	ll ans = 0, y[100001] = {};
	rep(i, n){
		int x = i;
		// while(tree.par[x] != x) x = tree.par[x];
		x = tree.root(x);
		// cout << x << " ";
		y[x] = 1;
	}
	rep(i, 100001) ans += y[i];
	cout << ans << endl;
	return 0;
}	

Measured memory_bytes: 1912
N, M = map(int, input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]

def check(i, j):
    for ii in range(M):
        for jj in range(M):
            if A[i + ii][j + jj] != B[ii][jj]:
                return False
    return True

for i in range(N - M + 1):
    for j in range(N - M + 1):
        if check(i, j):
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 3064
#include<stdio.h>
int a[109];
int main()
{
    int n;
    scanf("%d",&n);
    int sum=0,ans=0,temp=0;
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    int minn=10000;
    for(int i=0; i<n; i++)
    {
        sum-=a[i];
        temp+=a[i];
        ans=sum-temp;
        if(ans<0)
        {
            ans=-ans;
        }
        if(ans<minn)
        {
            minn=ans;
        }
    }
    printf("%d\n",minn);

}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d,A=-100,B=100;
    cin>>a>>b>>c>>d;
    int e[a],f[b];
    for(int i=0;i<a;i++) cin>>e[i];
    for(int i=0;i<b;i++) cin>>f[i];
    for(int i=0;i<a;i++){
        if(e[i]>=A) A=e[i];
    }
    for(int i=0;i<b;i++){
        if(f[i]<=B) B=f[i];
    }
    for(int i=A-1;i<=B+1;i++){
        if(c<i&&i<=d&&A<i&&B>=i) {
                cout<<"No War"<<endl;
                return 0;
        }

    }
    cout<<"War"<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>

using namespace std;
using ll = long long int;

void calc_div(ll n, vector<ll> &div)
{
  for(ll i = 1; i * i <= n; i++)
  {
    if(n % i == 0)
    {
      div.push_back(i);
      div.push_back(n / i);
    }
  }
}

int main()
{
  ll n;
  cin >> n;
  /*for(int i = 1; i <= n; i++)
  {
    cout << i << " " << n / i << " " << n % i << endl;
  }*/
  cout << endl;
  vector<ll> div;
  calc_div(n, div);
  sort(div.begin(), div.end());
  ll total = 0;
  for(int i = 1; i < div.size(); i++)
  {
    ll y = n / div[i];
    ll x = (n - y) / y;
    if((n - y) % y != 0) continue;
    if(x <= div[i - 1]) continue;
    if(x > 1){
      if(n / x == n % x)
      {
        total += x;
      }
    }
  }
  cout << total << endl;
}


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

int main(void){
    // Your code here!
    string S;
    cin >> S;
    
    int T[4];
    for(int i=0;i<4;++i){
      T[i] = S[i] - '0';
      //cout << T[i] << " . ";
    }
    //cout << endl;
    
    for(int i=0;i<(1<<3);i++){
      int cur = T[0];
      for(int j=0;j<3;j++){
        if(i & (1<<j)){
          /// +
          cur += T[j+1];
        } else {
          /// -
          cur -= T[j+1];
        }
        //cout << cur << endl;
      }
      //cout << std::bitset<3>(i) << " / " << cur << endl;
      if( cur == 7){
        //cout << std::bitset<3>(i) << endl;
        
        string formula = std::to_string(T[0]);
        for(int k=0;k<3;k++){
          if(i & (1<<k)){
            formula += "+" + std::to_string(T[k+1]);
          } else {
            formula += "-" + std::to_string(T[k+1]);
          }
        }
        
        cout << formula << "=7" << endl;
        return 0;
      }
    }
}

Measured memory_bytes: 256
import java.util.*;
import java.awt.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[]$) {
        Scanner sc = new Scanner(in);
        int[] a=new int[3];
        for (int i = 0; i <3 ; i++) {
            a[i]=sc.nextInt();
        }
        Arrays.sort(a);
        if(a[0]==5&&a[1]==5&&a[2]==7){
            out.println("YES");
        }else{
            out.println("NO");
        }
    }
    static long power(long x,int n){
        long mod=1000000007;
        long ans=1;
        while (n>0) {
            if((n&1)==1){
                ans=(ans*x)%mod;
            }
            x=(x*x)%mod;
            n>>=1;
        }
        return ans;
    }
    //最大公約数
    static int gcd (int a,int b) {
        int temp;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return b;
    }
    //※最小公倍数はa*b/gcd(a,b)である
    static class UF{
        static int size=51;
        static int[] par=new int[size];
        //初期化
        static void init(){
            for (int i = 1; i <size ; i++) {
                par[i]=i;
            }
        }
        //根をたどる
        static int root(int x){
            if(par[x]==x){
                return x;
            }else{
                return par[x]=root(par[x]);
            }
        }
        //同じ根をもつか(同じ集合に属するか)判定
        static boolean same(int x,int y){
            return root(x)==root(y);
        }
        //合体
        static void unite(int x,int y){
            x=root(x);
            y=root(y);
            if(x==y)return;
            par[x]=y;
        }
    }
}

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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

class CombinationCalculator {
    using ull = unsigned long long;
public:
    /**
     *  組み合わせの数を求めるクラス
     *  @n_max: $ {}_n C_r $ における $ {}_n $ の最大値
     *  @mod:   組み合わせの数に対して取るMODの値
     */
    explicit CombinationCalculator(const ull& n_max,
                                   const ull& mod = (int)1e9 + 7):
        m_((mod != 0) ? mod : std::numeric_limits<uint>::max()),
        fact_(n_max + 1, 0),
        inv_fact_(n_max + 1, 0),
        inv_(n_max + 1, 0) {
        std::fill(fact_.begin(), fact_.begin() + 2, 1);
        std::fill(inv_fact_.begin(), inv_fact_.begin() + 2, 1);
        std::fill(inv_.begin(), inv_.begin() + 2, 1);
        for(ull i = 2; i <= n_max; i++) {
            fact_[i]     = (fact_[i - 1] * i) % m_;
            inv_[i]      = m_ - inv_[m_ % i] * (m_ / i) % m_;
            inv_fact_[i] = inv_fact_[i - 1] * inv_[i] % m_;
        }
    }

    /**
     *  $ {}_n C_r $ を求める
     *  @n:      $ {}_n $ の値
     *  @k:      $ {}_r $ の値
     *  @Return: $ {}_n C_r $
     */
    ull run(const ull& n,
            const ull& r) {
        if(n < r) {
            return 0;
        }
        else {
            return fact_[n] * (inv_fact_[r] * inv_fact_[n - r] % m_) % m_;
        }
    }

private:
    ull m_;
    std::vector<ull> fact_;
    std::vector<ull> inv_fact_;
    std::vector<ull> inv_;
};

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

    int X, Y;
    std::cin >> X >> Y;
    if((X + Y) % 3 != 0) {
        std::cout << 0 << std::endl;
    }
    else {
        int n = (2 * Y - X) / 3;
        int m = (2 * X - Y) / 3;
        if(n < 0 || m < 0) {
            std::cout << 0 << std::endl;
        }
        else {
            CombinationCalculator c(n + m, MOD);
            std::cout << c.run(n + m, n) << std::endl;
        }
    }

    return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    cout << fixed << setprecision(10);
    int A,B;
    cin>>A>>B;
    cout<<max(max(A+B,A-B),A*B);
    return 0;
}

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

 int main() {
   string S;
   string res = "Good";
     cin >> S;

   for (int i = 1; i < 4; i++) {
     if (S[i] == S[i-1]) {
       res ="Bad";
     }
   }

   cout << res << '\n';
 }


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int p,q,r;
    int ans;
    scanf("%d%d%d",&p,&q,&r);
    if (p > q && p > r){
        ans = q + r; 
    } else if (r > q){
        ans = p + q;
    } else {
        ans = p + r;
    }
    printf("%d",ans);
}

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

const int N = 50;

struct Mat {
	vector< vector<int> > ways;
	Mat(int n, bool isI) {
		ways.resize(n, vector<int>(n,0));
		if(isI)
			for( int i = 0 ; i < n ; i++ )
				ways[i][i] = 1;
	}
};

LL m;
int n,tot;
Mat* dp[60];

Mat* mult(Mat* a, Mat* b) {
	Mat* res = new Mat(n,false);
	for( int i = 0 ; i < n ; i++ )
		for( int j = 0 ; j < n ; j++ )
			for( int k = 0 ; k < n ; k++ ) {
				int v1 = a->ways[i][k];
				int v2 = b->ways[k][j];
				int add = ( (LL) v1 * v2 ) % mod;
				int curr = res->ways[i][j];
				res->ways[i][j] = ( curr + add ) % mod;
			}
	return res;
}

int main() {
	scanf("%d%lld",&n,&m);
	dp[0] = new Mat(n,false);
	for( int i = 0 ; i < n ; i++ )
		for( int j = 0 ; j < n ; j++ )
			scanf("%d",&dp[0]->ways[i][j]);
	for( int i = 1 ; (1LL<<i) <= m ; i++ )
		dp[i] = mult(dp[i-1], dp[i-1]);
	Mat* ans = new Mat(n,true);
	for( int i = 0 ; (1LL<<i) <= m ; i++ )
		if( m & (1LL<<i) )
			ans = mult(ans, dp[i]);
	for( int i = 0 ; i < n ; i++ )
		for( int j = 0 ; j < n ; j++ )
			tot = ( tot + ans->ways[i][j] ) % mod;
	printf("%d\n",tot);
	return 0;
}


Measured memory_bytes: 1664