akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
#define rep(i, n) for(int i = 0; i < (n); i++)

struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint choose(int n , int a) {
  mint x = 1, y = 1;
  rep(i, a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

int main() {
  int n, a, b; cin >> n >> a >> b;
  mint ans = mint(2).pow(n);
  ans -= 1;
  ans -= choose(n, a);
  ans -= choose(n, b);
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char str[100000];
    int i,l,c=0,d=0;
    scanf("%s",str);
    l=strlen(str);
    for(i=2;i<l;i++)
    {
        if(str[i]=='C')
        {
            c++;
        }
        if(str[i]>='a'&&str[i]<='z')
        {
            d++;
        }
    }
    if(str[1]>='a'&&str[1]<='z')
    {
        d=d+1;
    }
    if(str[l-1]=='C')
    {
        c=c-1;
    }
    if(str[0]=='A'&&c==1&&d==l-2)
    {
        printf("AC\n");
    }
    else
    {
        printf("WA\n");
    }

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    rep(i,n){
        if(i%2 == 1) continue;
        string t = "", u = "";
        rep(j,i/2){
            t += s[j];
        }
        for(int j = i/2; j < i; j++){
            u += s[j];
        }
        if(t == u) chmax(ans, i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
let n = Int(readLine()!)!
var array: [Int] = []

for _ in 0..<5 {
  let item = Int(readLine()!)!
  array.append(item)
}

var min = array[0]
for i in 1..<5 {
  let item = array[i]
  if item < min {
    min = item
  }
}

let a = n / min
if n % min == 0 {
  print(a+4)
} else {
  print(a+1+4)
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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; }
//template end



int main(){
   int a[9]; rep(i,0,9)scanf("%d",&a[i]);
   int n; scanf("%d",&n); while(n--){int tmp; scanf("%d",&tmp); rep(i,0,9)if(a[i]==tmp)a[i]=0;}
   if(a[0]+a[1]+a[2]==0||a[3]+a[4]+a[5]==0||a[6]+a[7]+a[8]==0||a[0]+a[3]+a[6]==0||a[1]+a[4]+a[7]==0||a[2]+a[5]+a[8]==0||a[0]+a[4]+a[8]==0||a[2]+a[4]+a[6]==0)puts("Yes");
   else puts("No");
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define debug(X) cout << #X << " = " << X << endl

using namespace std;

const int MN = 20;

typedef pair<int, int> ii;

vector<ii> g[MN];

int bit(int mask, int b) { return (mask >> b) & 1; }

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	#ifdef UTP
	freopen("input.txt", "r", stdin);
	#endif
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int k; cin >> k;
		while (k--) {
			int j, c; cin >> j >> c; j--;
			g[i].push_back(ii(j, c));
		}
	}
	int ans = 0;
	for (int mask = 0; mask < (1 << n); mask++) {
		int ok = 1;
		for (int i = 0; i < n; i++) if (bit(mask, i))
			for (ii j : g[i]) ok &= (bit(mask, j.first) == j.second);
		if (ok) ans = max(ans, __builtin_popcount(mask));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){

	int n,a,x[10000];
	cin>>n;
	cin>>x[0];
	for(int k=1;k<=n;k++){
	   cin>>x[k]>>a;
	   x[k]=x[k-1]+x[k]-a;
	}
	for(int i=0;i<=n;i++){
		if(x[i]>x[0]){
		x[0]=x[i];
		}


	if(x[i]<0){
		x[0]=0;
	break;
	}
	
	}
      cout<<x[0]<<endl;
	return 0;
}


Measured memory_bytes: 3104
mod = 10**9+7
from collections import defaultdict
def sieve(N):
    prime = [0]*(N+1)
    isprime = [True]*(N+1)
    isprime[0]=isprime[1] = False
    num = 0
    for p in range(2,N+1):
        if isprime[p]:
            prime[num] = p
            num += 1
            for j in range(2*p,N+1,p):
                isprime[j] = False
    prime.sort()
    prime.reverse()
    for k in range(N-1):
        if prime[k+1] == 0:
            end = k
            break
    return prime[:end+1]

def main():
    N = int(input())
    if N == 1:
        print(1)
        exit()
    prime = sieve(N)
    prime.reverse()
    lis = defaultdict(int)
    for i in range(1,N+1):
        t = i
        for p in prime:
            if p > i:continue
            if t%p == 0:
                while t%p == 0:
                    t //= p
                    lis[p] += 1
    ans = 1
    for l in lis.values():
        ans *= (l+1)
        ans %= mod
    
    print(ans)

    

if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
from collections import Counter
import sys
N = int(input())
A = [int(_) for _ in input().split()]

key_val_lis = []
for key, value in Counter(A).items():
    if value >= 2:
        key_val_lis.append((key, value))

ans_lis = sorted(key_val_lis, key=lambda x: -x[0])

if len(ans_lis) <= 1 or ans_lis[0][1] is None:
        print(0)
        sys.exit()

area_1 = ans_lis[0][0] * ans_lis[1][0]
area_2 = 0
if ans_lis[0][1] >= 4:
    area_2 = ans_lis[0][0] ** 2
print(max(area_1, area_2))


Measured memory_bytes: 18600
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 

int main()
{
    int n;
    std::cin >> n;
    std::vector<long> rightUp(n), rightDown(n);
    
    for (int i = 0; i < n; i++)
    {
        long x, y;
        std::cin >> x >> y;
        rightUp[i] = (x + y);
        rightDown[i] = (x - y);
    }

    std::sort(rightUp.begin(), rightUp.end());
    std::sort(rightDown.begin(), rightDown.end());
    std::cout << 
        std::max(
            rightUp[n - 1] - rightUp[0], 
            rightDown[n - 1] - rightDown[0]
        ) << std::endl;
}


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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 1e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 998244353;
const int N = 1e6;

int n,a[maxn],s[maxn],ans,inv[maxn],pri[maxn],vis[maxn],mu[maxn],b[maxn],tot;

void gen() {
    inv[0]=inv[1]=1;
    for(int i=2;i<=N;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
    mu[1]=1;
    for(int i=2;i<=N;i++) {
        if(!vis[i]) pri[++tot]=i,mu[i]=-1;
        for(int j=1;j<=tot&&i*pri[j]<=N;j++) {
            vis[i*pri[j]]=1;
            if(i%pri[j]==0) break;
            mu[i*pri[j]]=-mu[i];
        }
    }
}

int main() {
    gen();read(n);int sum=0;
    for(int i=1;i<=n;i++) read(a[i]),b[a[i]]++,sum=(sum+a[i])%mod;
    for(int i=1;i<=N;i++)
        for(int j=i;j<=N;j+=i)
            s[i]=(s[i]+1ll*b[j]*j%mod)%mod;
    // for(int i=1;i<=6;i++) printf("%d %d\n",i,s[i]);
    for(int d=1;d<=N;d++) {
        if(!s[d]) continue;
        int res=0;
        for(int t=1;t<=N/d;t++) res=(res+1ll*mu[t]*s[d*t]*s[d*t]%mod)%mod;
        res=1ll*res*inv[d]%mod;
        // printf("%d %d\n",d,res);
        ans=(ans+res)%mod;
    }write((1ll*(ans-sum+mod)*inv[2]%mod+mod)%mod);
    return 0;
}


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

using namespace std;


int main()
{
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int ret = 0;
  for(int i = 0; i <= A; i++) {
    for(int j = 0; j <= B; j++) {
      for(int k = 0; k <= C; k++) {
        int sum = i * 500 + j * 100 + k * 50;
        if(X == sum) ++ret;
      }
    }
  }
  cout << ret << endl;
}

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

for i in range(N - K + 1):
    l = i
    r = i + K - 1

    Xl, Xr = X[l], X[r]
    if i == 0:
        ans = min(abs(Xl) + abs(Xr - Xl), abs(Xr) + abs(Xl - Xr))
    else:
        ans = min(abs(Xl) + abs(Xr - Xl), abs(Xr) + abs(Xl - Xr) , ans)


print(ans)


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

namespace AtCoder.Abc
{
    class QuestionD
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            //// 文字列の入力
            //string s = Console.ReadLine();

            //// 整数の入力
            //long n = long.Parse(Console.ReadLine());

            //// 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            //// 整数配列の入力
            //var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            long n = long.Parse(Console.ReadLine());
            double p = 1;

            double c = Math.Pow(10, 9) + 7;

			for (int i = 1; i <= n; i++) {
                p = (p * i) % c;

			}

            Console.WriteLine(p.ToString());

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27664
package main
 
import (
  "bufio"
  "os"
  "strconv"
  "fmt"
)
 
var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  var line, buffer []byte
  var isPrefix bool = true
  var err error
  for isPrefix {
    line, isPrefix, err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
  }
  return string(buffer)
}
func NextInt() int {
  var n int
  n, _ = strconv.Atoi(NextLine())
  return n
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

const p = 1000000007

func main() {
  N := NextInt()
  S := NextLine()
  L := len(S)
  DP := make([][]int, N + 1)
  for i := range DP {
    DP[i] = make([]int, N + 1)
  }
  DP[0][L] = 1
  for i := 0; i < N; i++ {
    DP[i + 1][0] = DP[i][0]
    for j := 0; j < N; j++ {
      DP[i + 1][j + 1] = 2 * DP[i][j] % p
    }
    for j := N; 0 < j; j-- {
      DP[i + 1][j - 1] = (DP[i + 1][j - 1] + DP[i][j]) % p
    }
  }
  Write(DP[N][0])
  Output()
}

Measured memory_bytes: 207872
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    Integer n = Integer.parseInt(sc.nextLine());
    List<Integer> b = Arrays.stream(sc.nextLine().split(" ")).map(Integer::parseInt)
        .collect(Collectors.toList());

    Integer[] left = new Integer[n + 1];
    left[0] = 0;
    for (int i = 0; i < n; i++) {
      left[i + 1] = gcd(b.get(i), left[i]);
    }

    Integer[] right = new Integer[n + 1];
    right[n] = 0;
    for (int i = n; i > 0; i--) {
      right[i - 1] = gcd(b.get(i - 1), right[i]);
    }

    int max = 0;
    for (int i = 0; i < n; i++) {
      max = Math.max(max, gcd(left[i], right[i + 1]));
    }

    System.out.println(max);
  }

  public static int gcd(int a, int b) {
    if (b == 0) {
      return a;
    }

    return gcd(b, a % b);
  }
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

void solve(){
	ll x, ans;
	cin >> x;
	ans = x / 11;
	x %= 11;
	ans *= 2;
	if (x > 0 && x <= 6){
		ans++;
	} else if (x > 6){
		ans += 2;
	}
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

int main() {
  int a, b;
  cin >> a >> b;
  int takahashi_count = 0;
  takahashi_count += a-1;

  if (a <= b) {
    takahashi_count ++;
  }
  cout << takahashi_count << endl;
}


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

#define BUF_SIZE 100

void swap(int *a, int *b) {
  if(*a < *b) return;
  int tmp = *a;
  *a = *b;
  *b = tmp;
}

int gcd(int a, int b) {
  while(a!=0) {
    int tmp = a;
    a = b % a;
    b = tmp;
  }
  return b;
}

int main(void) {
  FILE *fp = stdin;
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, fp)) return 0;
  int num;
  sscanf(line, "%d", &num);

  int i;
  if(!fgets(line, BUF_SIZE, fp)) return 0;
  char *tmp = strtok(line, " ");
  int res = strtol(tmp, NULL, 10);
  for(i = 1; i < num; i++) {
    char *tmp = strtok(NULL, " ");
    int n = strtol(tmp, NULL, 10);
    swap(&res, &n);
    int div = gcd(res, n);
    // calc least common multiple
    res = res / div * n;
  }
  printf("%d\n", res);
  return 0;
}


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

using ll = long long int;
using P = pair<int, int>;
using P3 = pair<int,P>;
using PP = pair<P, P>;
constexpr int INF = 1<<30;
constexpr ll MOD = ll(1e9)+7;
constexpr int di[] = {0,1,0,-1};
constexpr int dj[] = {1,0,-1,0};


bool solve(){
    ll N, M, K, A, B, C, T;
    cin >> N >> M >> K >> A >> B >> C >> T;
    vector<ll> s(M);
    for(int i=0;i<M;i++){
        cin >> s[i];
        s[i]--;
    }
    ll ans = 0;
    vector<ll> ls;
    for(ll i=0;i<M-1;i++){
        if(B*s[i] > T) break;
        ll r = T-B*s[i], j = s[i], cnt, k = 0;
        cnt = min(r/A+1, s[i+1]-j);
        ans += cnt;
        j += cnt;
        r -= C*cnt;
        while(j < s[i+1] && r >= 0 && k <= K-M){
            cnt = min(r/A+1, s[i+1]-j);
            ls.emplace_back(cnt);
            j += cnt;
            r -= C*cnt;
            k++;
        }
    }
    ans--;  // 駅1
    if(B*(N-1)<=T) ans++;  // 駅N
    sort(ls.rbegin(), ls.rend());
    for(int i=0;i<min(K-M,ll(ls.size()));i++){
        ans += ls[i];
    }
    cout << ans << endl;
    return true;
}

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



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

#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define FORN(i, m, n) for(int (i) = (m); (i) <= (n); (i)++)
#define FORR(i, m, n) for(int (i) = (m); (i) >= (n); (i)--)
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> Vec;

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n;
	cin >> n;
	string s;
	cin >> s;

	ll len = s.length();
	Vec s_num(len);
	rep(i, len){
		s_num[i] = (s[i]-'A'+n)%26;
	}
	rep(i, len){
		s[i] = (char)('A'+s_num[i]);
	}
	co(s);

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define mp make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF (1<<30)
#define LLINF (1LL<<60)
//#define MOD 998244353
#define MOD 1000000007
#define PI 3.14159265358979
using ll = long long;
using namespace std;

int main(){
    int n;
    cin >> n;
    rep(i,11){
        if(1000*i>=n){
            cout << 1000 * i - n << endl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 3588
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm> 
using namespace std;
 
# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
 
int main()
{
    int a,b,c,d,e,f;cin >> a >> b >> c >> d >> e >> f;

    vector<int> water;
    vector<int> sugar;
    
    for(int i=0;i*a*100<=f;i++){
        for(int j=0;i*a*100+j*b*100<=f;j++){
            water.push_back(i*a*100+j*b*100);
        }
    }

    for(int i=0;i*c<=f;i++){
        for(int j=0;i*c+j*d<=f;j++){
            sugar.push_back(i*c+j*d);
        }
    }

    int ans_sugar_water=0;
    int ans_sugar=0;
    double noudo=0;

    for(int i=0;i<water.size();i++){
        if(water[i]==0) continue;
        for(int j=0;j<sugar.size();j++){
            double k=(double)sugar[j]/(double)(water[i]/100);
            if(noudo<=k && k<=e && sugar[j]+water[i]<=f) {
                noudo=k;
                ans_sugar=sugar[j];
                ans_sugar_water=sugar[j]+water[i];
                if(noudo==e){
                    cout << ans_sugar_water <<  " " << ans_sugar << endl;
                    return 0;
                }
            }
        }
    }
    cout << ans_sugar_water <<  " " << ans_sugar << endl;
}

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

///******************************** C o n t a i n e r ********************************///

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

///*********************************** C o n s t ***********************************///

const int       N=1e6+123;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define MP make_pair
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ a%=MOD;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=MOD;--b;}a*=a;a%=MOD;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///


void _case()
{
    ll i,n,ans=0,j;

    cin>>n;

    cout<<(n==0) el;
}

main()
{
    fastio();
    _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3636
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int x = sc.nextInt();
		int t = sc.nextInt();
		
		int r = (n/x + (n%x > 0 ? 1 : 0))*t; 

		System.out.println(r);
	}
}


Measured memory_bytes: 35608
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int par[maxn];
int findp(int x){return par[x] < 0 ? x : par[x] = findp(par[x]);}
void unite(int x, int y)
{
    x = findp(x), y = findp(y);
    if (x != y){
        par[x] += par[y];
        par[y] = x;
    }
}
bool same(int x, int y){return findp(x) == findp(y);}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	memset(par, -1, sizeof(par));
	int n, m, u, v, w;
	cin >> n >> m;
	for (int i = 0; i < m; ++i){
        cin >> u >> v >> w;
        unite(u, v);
	}
	int ans = 0;
	for (int i = 1; i <= n; ++i){
        if (par[i] < 0) ++ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
N, K = map(int, input().split())
A = list(map(int, input().split()))
kind = len(set(A))
cnt = [0] * 202020
for a in A:
    cnt[a] += 1
cnt = sorted(filter(lambda x: x > 0, cnt))
ans = 0
for c in cnt:
    if kind <= K:
        break
    ans += c
    kind -= 1
print(ans)

Measured memory_bytes: 32176
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pb push_back
#define MAX 100005
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

bool Is_Prime(int n){
  if(n==1) return false;
  for(int i=2;i*i<n;i++){
    if(n%i==0){
      return false;
    }
  }
  return true;
}

signed main(){
    int n,x;
    while(cin>>n>>x,n){
      vector<int> v(n);
      rep(i,n)cin>>v[i];
      vector<int> dp(x+1);
      dp[0]=1;
      rep(j,n){
        loop(i,1,x+1){
          if(i-v[j]>=0&&dp[i-v[j]]==1){
            dp[i]=1;
          }
        }
      }
      for(int i=x;i>0;i--){
        if(dp[i]==1&&Is_Prime(i)){
          cout<<i<<endl;
          goto at;
        }
      }
      cout<<"NA"<<endl;
      at: ;
    }

  return 0;
}

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

#define int long long
#define fi first
#define se second
#define ponto pair<int,int>

int k, s = 0;

int32_t main()
{
	cin >> k;
	for(int a=1; a<=k; a++)
		for(int b=1; b<=k; b++)
			for(int c=1; c<=k; c++)
			{
				int x = __gcd(a,b);
				s += __gcd(x,c);
			}
	
	cout << s << '\n';
}

Measured memory_bytes: 3636
n=int(input())
a=[int(input()) for i in range(n)]
m1=a[0]
x1=0
m2=0
for i in range(1,n):
  if a[i]>m1:
    m2=m1
    x1=i
    m1=a[i]
  elif a[i]>m2:
    m2=a[i]

for i in range(n):
  if i==x1:
    print(m2)
  else:
    print(m1)

Measured memory_bytes: 12532
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
const ll MOD = 998244353;
void Main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    vector<vector<ll>> dp(c+2,vector<ll> (d+2,0));
    dp[a][b]=1;
    for(int h=a;h<c+1;h++){
        for(int w=b;w<d+1;w++){
            dp[h+1][w]=(dp[h+1][w]+dp[h][w]*w%MOD)%MOD;
            dp[h][w+1]=(dp[h][w+1]+dp[h][w]*h%MOD)%MOD;
            dp[h+1][w+1]=(dp[h+1][w+1]+MOD-dp[h][w]*h%MOD*w%MOD)%MOD;
        }
    }
    cout<<dp[c][d]<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 73692
package main

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

func main() {
	h := getInt()
	w := getInt()

	ans := ""
	for i := 0; i <= h+1; i++ {
		if i == 0 || i == h+1 {
			ans += fmt.Sprintln(strings.Repeat("#", w+2))
		} else {
			ans += fmt.Sprintln("#" + getString() + "#")
		}
	}

	fmt.Println(ans)
}

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// tmp := 200001
	// sc.Buffer(make([]byte, tmp), tmp)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ll N;
  cin >> N;
  string S;
  cin >> S;

  map<char, ll> m;
  rep(i, N) {
    m[S[i]]++;
  }

  map<char, ll> m2;
  ll ans = 0;
  rep(i, N) {
    m2[S[i]]++;

    m[S[i]]--;
    if (m[S[i]] == 0) {
      m.erase(S[i]);
    }

    ll count = 0;
    for (auto mm : m) {
      if (m2[mm.first] != 0) {
        count++;
      }
    }
    ans = max(ans, count);
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 256
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) { cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=a; i<(int)b; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int maxN = 1e6+2;


int main()
{
   int x;
   scn(x);

   prin(1 ^ x);

   return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>

using namespace std;

int main() {
    int n[101]={0};
    int max = 0;
    int x;
    while(scanf("%d",&x)!=EOF){
        n[x]++;
        if(max<n[x]){
            max=n[x];
        }
    }
    for(int i=0; i<101; i++){
        if(max==n[i]){
            cout<<i<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1208
#![allow(unused_imports)]
#![allow(dead_code)]
use proconio::input;
use proconio::fastout;
#[macro_use] extern crate text_io;
use proconio::marker::*;
use std::mem::*;
use std::collections::*;
use std::cmp::*;

#[fastout]
fn main() {
    input!{
        s:Chars,t:Chars,
    }
    let mut ans:i32=std::i32::MAX;
    for i in 0..s.len()-t.len()+1{
        let mut cnt:i32=0;
        for j in 0..t.len(){
            if s[i+j]!=t[j]{
                cnt+=1;
            }
        }
        if ans>cnt{
            ans=cnt;
        }
    }
    println!("{}",ans);
}

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

int main() {
	string s;
	cin >> s;
	int ans = 700;
	for (int i = 0; i < 3; i++) {
		if(s.at(i) == 'o') ans += 100;
	}

	cout << ans << endl;

	return 0;
}

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

long double D;

int main()
{
    cin >> N >> D;
    deque<int> x(N), y(N);
    ll cnt = 0;
    ll xx, yy;
    // long double d;
    rep(i, N)
    {
        cin >> xx >> yy;
        x[i] = abs(xx);
        y[i] = abs(yy);
    }
    rep(i, N)
    {
        // d = dist(x[i], y[i]);
        // cout << ">" << x[i] * x[i] << "," << ((D + y[i]) * (D - y[i])) << endl;
        if (x[i] != 0)
        {
            if (x[i] <= (double)((D + y[i]) * (D - y[i])) / x[i])
            {
                // cout << i << endl;
                cnt++;
            }
        }
        else
        {
            if (0 <= (double)((D + y[i]) * (D - y[i])))
            {
                // cout << i << endl;
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


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

#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define rep(i, n) FOR(i, 0, n)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;

const ll INF = 1e18;
const ll MOD = 1e9+7;
//const ll MOD 998244353;
const ll MAX_N = 305;

ll d[MAX_N][MAX_N] = {};
ll dd[MAX_N][MAX_N] = {};

int main(void){
	int n, m, l;
	scanf("%d%d%d", &n, &m, &l);

	rep(i, n) rep(j, n) d[i][j] = INF;
	rep(i, n) d[i][i] = 0;

	rep(i, m){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		a--; b--;
		d[a][b] = c;
		d[b][a] = c;
	}

	rep(k, n) rep(i, n) rep(j, n) d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
	rep(i, n) rep(j, n){
		if(d[i][j] <= l) dd[i][j] = 1;
		else dd[i][j] = INF;
	}
	rep(i, n) dd[i][i] = 0;
	rep(k, n) rep(i, n) rep(j, n) dd[i][j] = min(dd[i][j], dd[i][k]+dd[k][j]);

	int q;
	cin >> q;
	rep(i, q){
		int s, t;
		scanf("%d%d", &s, &t);
		s--; t--;
		if(dd[s][t] != INF) printf("%d\n", dd[s][t]-1);
		else printf("-1\n");
	}

	return 0;
}


Measured memory_bytes: 1920
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final long s = in.nextLong();
        long r = (long) Math.sqrt(s);
        if (r * r < s) {
            r += 1;
        }
        System.out.println("0 0 " + r + " 1 " + (r * r - s) + " " + r);
    }
}

Measured memory_bytes: 23764
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
vector<ll> a(110000,0);
ll n;
string s;
ll next_i(ll i){
  ll res;
  //sheep
  if(a[i]==0){
    if(s[i]=='o'){
      res = a[i-1];
    }else{
      res = !a[i-1];
    }
    //wolf
  }else{
    if(s[i]=='o'){
      res = !a[i-1];
    }else{
      res = a[i-1];
    }
  }
  return res;
}
bool check_i(ll i){
  bool res = true;
  if(a[i]==0){
    if(s[i]=='o'&&a[(i+1)%n]!=a[(i+n-1)%n]){
      res = false;
    }else if(s[i]=='x'&&a[(i+1)%n]==a[(i+n-1)%n]){
      res = false;
    }
  }else{
    if(s[i]=='o'&&a[(i+1)%n]==a[(i+n-1)%n]){
      res = false;
    }else if(s[i]=='x'&&a[(i+1)%n]!=a[(i+n-1)%n]){
      res = false;
    }
  }
  return res;
}
signed main(){
  init_io();
  cin >> n >> s;
  for(int x=0;x<2;x++){
    for(int y=0;y<2;y++){
      a[0] = x;
      a[1] = y;
      for(int i=1;i<n-1;i++){
        a[i+1] = next_i(i);
      }
      bool is_ans=true;
      is_ans &= check_i(0);
      is_ans &= check_i(n-1);
      if(is_ans){
        for(int i=0;i<n;i++){
          if(a[i]==0) cout <<"S";
          else cout <<"W";
        }
        cout << endl;
        return 0;
      }
    }
  }
  cout << "-1\n";
}


Measured memory_bytes: 1488
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e,ans=0,br=0;
  cin>>a>>b>>c>>d>>e;
  while(a<0&&br==0){
    ans+=c;
    a++;
    if(a==b){
      br++;
    }
  }
  if(br==0){
    if(a==0){
      ans+=d;
    }
    if(b>0){
      for(int i=a;i<b;i++){
	ans+=e;
	a++;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3028
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
using ll = long long;
using namespace std;

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    cout << (x- z) / (y + z) << endl;
}

Measured memory_bytes: 256
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string S = Console.ReadLine();
            Console.WriteLine(S[0] == S[1] || S[1] == S[2] || S[2] == S[3] ? "Bad" : "Good");
        }
    }
}

Measured memory_bytes: 11092
while True:
    a,op,b = input().split()
    if op == '?': break
    elif op =='+':
        print(int(a) + int(b))
    elif op =='-':
        print(int(a) - int(b))    
    elif op =='*':
        print(int(a) * int(b))    
    elif op =='/':
        print(int(a) // int(b))  


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

using namespace std;

int main() {
	int n;
	cin >> n;
	int o = 2;
	char c[] = "DLRU";
	stringstream ss;
	long e[44];
	for (int i = 0; i < n; i++) {
		long x, y;
		cin >> x >> y;
		if (o < 2 && o^abs(x + y) & 1) {
			cout << -1 << endl;
			return 0;
		}
		o = abs(x + y) & 1;
		long a = 0, b = o ? 1 - (1l << 40) : -(1l << 39);
		for (int j = 0; j < 39; j++)
			e[j] = 1l << 38 + o - j;
		e[39] = 1;
		for (int j = 0; j < 40; j++) {
			long d = e[j];
			int w = 0;
			if (y - x >= b - a + d * 2 && y + x >= b + a + d * 2)
				w = 3, b += d * 2;
			else if (y - x >= b - a && y + x >= b + a + d * 2)
				w = 2, a += d, b += d;
			else if (y - x >= b - a + d * 2 && y + x >= b + a)
				w = 1, a -= d, b += d;
			ss << c[w];
		}
		ss << '\n';
	}
	cout << 40 << '\n';
	for (int i = 0; i < 40; i++)
		cout << e[i] << ' ';
	cout << '\n' << ss.str() << flush;
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
int main()
{
  int i,j,n;
  int sum=0;
  scanf("%d",&n);
  int d[n];
  for(i=0;i<n;i++){
  scanf("%d",&d[i]);
  }
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      sum+=d[i]*d[j];
    }
  }
  printf("%d",sum);
  return 0;
}

Measured memory_bytes: 128
/*    三玖天下第一！！！  */
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long n,m,nums[1000000]={},cnt=0,ans=1,fac[200005];
inline long long qpow(long long a,long long p)
{
	long long re=1;
	while(p)
	{
		if(p&1) re=(re*a)%mod;
		p>>=1;
		a=(a*a)%mod;
	}
	return re;
}
inline void get_fac()
{
	fac[0]=1;
	for(int i=1;i<=200000;i++) fac[i]=(fac[i-1]*i)%mod;
}
inline void divide_number(long long x)
{
	long long temp=sqrt(x);
	for(long long i=2;i<=temp;i++) 
	{
		if(x%i==0) cnt++;
		while(x%i==0) x/=i,nums[cnt]++;
		if(i>x) break;
	}
	if(x!=1) nums[++cnt]++;
}
inline void in()
{
	scanf("%lld%lld",&n,&m);
}
inline void work()
{
	get_fac();
	divide_number(m);
	for(long long i=1;i<=cnt;i++) ans=(ans*(fac[n+nums[i]-1]*qpow(fac[n-1]*fac[nums[i]]%mod,mod-2)%mod))%mod;
}
inline void out()
{
	printf("%lld\n",ans);
}
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	in();
	work();
	out();
	return 0;
}


Measured memory_bytes: 1792
import java.util.*;

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();
        int cnt=0;
        if(a==5) cnt++;
        if(b==5) cnt++;
        if(c==5) cnt++;
        if(cnt==2 && a+b+c==17)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}


Measured memory_bytes: 20688
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N - 1; i >= 0; i--)
const ll INF = 1000000000;
const ll mod = 1000000007;
#define PI 3.1415926535
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
typedef pair<int, int> pair;
bool seen[505][505];

//dpTable
int dp[100050];

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    rep (i,N) cin >> A.at(i);
    sort(A.begin(),A.end(),greater<int>());
    ll ans = 0;
    if (N >= 1) ans = A.at(0);
    for (int i = 2; i < N; i++) {
        ans += A.at(i / 2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4792
# スタックの実装
# 後入れ先出し
a = input().split()
stack_list = []
index = -1
operand = ["+", "-", "*"]
for i in range(len(a)):
    if a[i] not in operand:
        stack_list.append(int(a[i]))
        index += 1
    else:
        if a[i] == "+":
            operated2 = stack_list.pop(index)
            index -= 1
            operated1 = stack_list.pop(index)
            index -= 1
            stack_list.append(operated1 + operated2)
            index += 1
        elif a[i] == "-":
            operated2 = stack_list.pop(index)
            index -= 1
            operated1 = stack_list.pop(index)
            index -= 1
            stack_list.append(operated1 - operated2)
            index += 1
        elif a[i] == "*":
            operated2 = stack_list.pop(index)
            index -= 1
            operated1 = stack_list.pop(index)
            index -= 1
            stack_list.append(operated1 * operated2)
            index += 1
print(stack_list[index])



Measured memory_bytes: 5608
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=100111;
const int inf=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


/*
vvl comb(int n, int r) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}
*/

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

	

int main(){
	int n,k,ans=0;
	string s;
	cin>>n>>k>>s;

	int one=0;
	rep(i,0,n-1){
		if(s[i]==s[i+1])ans++;
		else one++;
	}
	if(k<=one/2)cout<<ans+2*k;
	else cout<<s.size()-1;
	
}

Measured memory_bytes: 512
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    string s;
    cin>>s;
    if(s[3]==s[2] && s[4]==s[5]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>

using namespace std;

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

int main() {
  int N, v[3];
  cin >> N >> v[0] >> v[1] >> v[2];
  string s[N+1];
  rep(i,N) cin >> s[i];
  s[N] = "XX";
  
  int b = 1, r[N];
  rep(i,N) {
    int x = s[i][0] - 'A', y = s[i][1] - 'A';
    if(v[x] == 0 && v[y] == 0) b = 0;
    else if(v[x] == 0) { r[i] = x; v[x]++; v[y]--; }
    else if(v[y] == 0) { r[i] = y; v[y]++; v[x]--; }
    else if(v[x] == 1 && v[y] == 1) {
      int j = i+1;
      for(; s[i] == s[j]; j++);
      int nx = s[j][0] - 'A', ny = s[j][1] - 'A';
      if(x == nx || x == ny) { r[i] = x; v[x]++; v[y]--; }
      else { r[i] = y; v[y]++; v[x]--; }
    }
    else if(v[x] > 1) { r[i] = y; v[y]++; v[x]--; }
    else { r[i] = x; v[x]++; v[y]--; }
  }
  
  if(b) {
    cout << "Yes" << endl;
    rep(i,N) cout << (char)(r[i] + 'A') << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 5832
#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<vector<int>> E;
vector<int> color;
vector<pair<int,int>> A;
vector<map<int,int>> memo;
bool f(int p, int c, int& n1, int& n2) {
	color[p] = c;
	if (c == 1) ++ n1; else ++ n2;
	for (auto& x : E[p]) {
		if (color[x] == 0) {
			if (!f(x, 3-c, n1, n2)) return false;
		} else {
			if (color[x] == color[p]) return false;
		}
	}
	return true;
}
int g(int p, int n) {
	if (p == (int)A.size()) {
		int m = N-n;
		return n*(n-1)/2 + m*(m-1)/2;
	}
	if (memo[p].count(n)) return memo[p][n];
	return memo[p][n] = min(g(p+1, n + A[p].first), g(p+1, n + A[p].second));
}
int main() {
	cin >> N >> M;
	set<pair<int,int>> e;
	for (int i = 0; i < M; ++ i) {
		int x, y;
		cin >> x >> y;
		--x; --y;
		e.insert({min(x,y), max(x,y)});
	}
	E.resize(N);
	for (int i = 0; i < N; ++ i) for (int j = i+1; j < N; ++ j) if (!e.count({i,j})) {
		E[i].push_back(j);
		E[j].push_back(i);
	}
	color.resize(N);
	for (int i = 0; i < N; ++ i) if (color[i] == 0) {
		int n1 = 0, n2 = 0;
		if (!f(i, 1, n1, n2)) {
			cout << -1 << endl;
			return 0;
		}
		A.push_back({n1,n2});
	}
	memo.resize(A.size());
	cout << g(0, 0) << endl;
}


Measured memory_bytes: 23296
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;

int main() {
    string S;
    cin >> S;
    ll ans = 700;
    for (int i = 0; i < 3; i++) {
        if (S[i] == 'o') {
            ans += 100;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
def main():
    n=int(input())
    d={}
    for i in range(n):
        tmp = ''.join(sorted(input()))
        
        if tmp in d:
            d[tmp]+=1
        else:
            d[tmp]=1
    ans=0
    for i in d.values():
        ans+=i*(i-1)//2
    print(ans)

main()

Measured memory_bytes: 17848
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

string s;
int k;

void init() {

}

void input() {
	cin >> s >> k;
}

void solve() {
	vector<string> vs;
	REP(i, SZ(s)) FOR(j, 1, min(k+1, SZ(s)-i+1)) {
		string _s = s.substr(i, j);
		if (!cpresent(vs, _s)) {
			vs.PB(_s);
			sort(ALL(vs));
			if (SZ(vs) > k) vs.pop_back();
		}
	}
	cout << vs[k-1] << endl;
}

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


Measured memory_bytes: 256