akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

ll ruijou(ll n, ll k){
    if(k==0) return 1;
    ll x=k/2;
    long long t=ruijou(n,x);
    t=(t*t)%mod;
    if(k%2==1) return (n*t)%mod;
    else return t%mod;
}

ll N;
vec y,d;
ll Solve(ll X){
    vec count(4,0);
    ll ret=0;
    ll x=X;
    rep(j,N) {
        count[x%4]+=d[j];
        if(x%4!=3) ret+=10;
        x/=4;
    }
    if(count[0]==0 || count[1]==0 || count[2]==0) return INF;
    
    rep(i,3) ret+=abs(count[i]-y[i]);
    //cout<<count[0]<<' '<<count[1]<<' '<<count[2]<<':'<<ret-30<<endl;
    return ret-30;

}


int main(){
    cin>>N;
    rep(i,3){
        ll x; cin>>x;
        y.pb(x);
    }
    
    rep(i,N) {
        ll x; cin>>x;
        d.pb(x);
    }
    ll MAXN=ruijou(4,N);
    //cout<<MAXN<<endl;
    ll ans=INF;
    rep(i,MAXN)ans=min(ans,Solve(i));
    cout<<ans<<endl;

}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  
  ll res = linf;
  for(int i = 0; i <= max(x, y); i++){
    ll nowcost = 2*c*i + max(0LL, x-i)*a + max(0LL, y-i)*b;
    res = min(res, nowcost);
  }
  
  
  cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;


int main(void){

	bool T[201], H[201];
	int tc, hc;
	int n, k;
	int turn;
	int fi;

	while (1){
		cin >> n;
		if (n == 0) break;
		tc = n, hc = n;
		for (int i = 1; i <= 2 * n; i++) T[i] = false, H[i] = false;
		for (int i = 0; i < n; i++){
			cin >> k;
			T[k] = true;
		}
		for (int i = 1; i <= 2 * n; i++){
			if (T[i] == false) H[i] = true;
		}

		turn = 1;
		fi = 0;
		while (tc != 0 && hc != 0){
			if (turn == 1){
				if (fi == 2*n) {
					fi = 0;
					turn = 2;
					continue;
				}
				for (int i = fi+1; i <= 2 * n; i++){
					if (T[i] == true){
						tc--;
						T[i] = false;
						fi = i;
						break;
					}
					if (i == 2 * n){
						fi = 0;
						break;
					}
				}
				turn = 2;
			}
			else{
				if (fi == 2*n) {
					fi = 0;
					turn = 1;
					continue;
				}
				for (int i = fi + 1; i <= 2 * n; i++){
					if (H[i] == true){
						hc--;
						H[i] = false;
						fi = i;
						break;
					}
					if (i == 2 * n){
						fi = 0;
						break;
					}
				}
				turn = 1;
			}
		}
		cout << hc << endl << tc << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N, K = map(int, input().split())
Ps = list(map(int, input().split()))
Ps.sort()
print(sum(Ps[:K]))



Measured memory_bytes: 10932
n, r0, g0 = map(int, input().split())
edges = [tuple(map(int, input().split())) for _ in range(n-1)]

connects = [[] for i in range(n+1)]
for e in edges:
    connects[e[0]].append(e[1])
    connects[e[1]].append(e[0])    

rL, gL = [-1]*(n+1), [-1]*(n+1)
rL[r0], gL[g0] = 0, 0

from collections import deque
rQ, gQ = deque([r0]), deque([g0])

for L, Q in [(rL, rQ), (gL, gQ)]:
    while Q:
        node = Q.popleft()
        for ni in connects[node]:
            if L[ni] == -1:
                L[ni] = L[node] + 1
                ### print((node, L[node]), (ni, L[ni]))
                Q.append(ni)

print(max(gL[i] for i in range(1, n+1) if rL[i] < gL[i]) - 1)

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

using namespace std;

typedef long long int ll;

const ll mod = 1e9 + 7;
const ll MAXN = 2e5 + 5;

int z_function(string s){
  int n = s.length();
  vector < int > z(n, 0);
  int l = 0, r = 0, ans = 0;
  for(int i = 1; i < n; i++){
    if(r >= i) z[i] = min(z[i - l], r - i + 1);
    while(i + z[i] < n && s[i + z[i]] == s[z[i]]) z[i]++;
    if(i + z[i] - 1 > r){
      l = i;
      r = i + z[i] - 1;
    }
    ans = max(ans, min(z[i], i));
  }
  return ans;
}

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

  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for(int i = 0; i < n; i++){
    ans = max(ans, z_function(s.substr(i, n - i)));
  }

  cout << ans << '\n';
}


Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let m: usize = sc.cin();
    let ps: Vec<_> = (0..n).map(|_| {
        let x: i64 = sc.cin();
        let y: i64 = sc.cin();
        let z: i64 = sc.cin();
        (x, y, z)
    }).collect();

    let mut ans = 0;

    for sx in 0..2 {
        for sy in 0..2 {
            for sz in 0..2 {
                let mut qs: Vec<i64> = ps.iter().map(|&(x, y, z)| {
                    let mut q = 0;
                    q += if sx == 0 { x } else { -x };
                    q += if sy == 0 { y } else { -y };
                    q += if sz == 0 { z } else { -z };
                    q
                }).collect();
                qs.sort(); qs.reverse();
                ans = max!(ans, qs[0..m].iter().sum());
            }
        }
    }
    put!(ans);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


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

using namespace std;

int main() {
	string s;
	cin >> s;
	int res = 0;
	for(int i = 0; i < 3; i++) {
		if(s[i] == '1') {
			res++;
		}
	}
	cout << res << endl;

	return 0;
}

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



int main(){
  int N,M,C;
  cin>>N>>M>>C;
  C = (-1)*C;
  int B[M];
  int A[M];
  for(int i=0;i<M;i++){
    cin>>B[i];
  }
  int s;
  int ans=0;
  for(int i=0;i<N;i++){
    s = 0;
    for(int j=0;j<M;j++){
      cin>>A[j];
      s += A[j]*B[j];
    }
    if(s > C){
      ans++;
    }
  }
  cout<<ans<<endl;
}

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

int main() {
  int K,S;
  cin >> K >> S;
  int count = 0;
  for(int i=0;i<=K;i++) {
    for(int j=0;j<=K;j++) {
      if(i+j<=S && S<=i+j+K) {
        count++;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
/*
 * (c) fushar (Ashar Fuadi)
*/

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

#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i <= b; i++)
#define RESET(c,v) memset(c, v, sizeof c)

typedef long long ll;

const int MAX = 305;
const int MOD = 1000000007;

int N, M, N1;
vector<pair<int, int>> cons[MAX];

int dp[2][3][MAX*MAX];

tuple<int, int, int> extract_pos(int i, int j, int k) {
    int hi = k % N1;
    int lo = k / N1;

    int pos0, pos1, pos2;
    if (j == 0) {
        pos0 = i, pos1 = lo, pos2 = hi;
    }
    if (j == 1) {
        pos0 = lo, pos1 = i, pos2 = hi;
    }
    if (j == 2) {
        pos0 = lo, pos1 = hi, pos2 = i;
    }
    return make_tuple(pos0, pos1, pos2);
}

bool verify(int i, int j, int k) {
    int pos0, pos1, pos2;
    tie(pos0, pos1, pos2) = extract_pos(i, j, k);

    for (pair<int, int> c : cons[i]) {
        int l = c.first;
        int x = c.second;

        int cnt = 0;
        if (pos0 >= l) cnt++;
        if (pos1 >= l) cnt++;
        if (pos2 >= l) cnt++;
        if (cnt != x) {
            return false;
        }
    }
    return true;
}

int main() {
    cin >> N >> M;
    REP(i, M) {
        int l, r, x;
        cin >> l >> r >> x;
        cons[r].push_back(make_pair(l, x));
    }
    REP(j, 3) {
        dp[1][j][0] = 1;
    }

    N1 = N+1;

    int res = 0;

    FOR(i, 1, N) {
        int ii = i&1;
        int ni = ii^1;

        REP(j, 3) REP(k, N1*N1) {
            dp[ni][j][k] = 0;
        }

        REP(j, 3) REP(k, N1*N1) {
            if (!verify(i, j, k)) {
                dp[ii][j][k] = 0;
            }

            if (!dp[ii][j][k]) {
                continue;
            }

            int pos0, pos1, pos2;
            tie(pos0, pos1, pos2) = extract_pos(i, j, k);

            if (i == N) {
                res = (res + dp[ii][j][k]) % MOD;
                continue;
            }

            (dp[ni][0][pos1*N1+pos2] += dp[ii][j][k]) %= MOD;
            (dp[ni][1][pos0*N1+pos2] += dp[ii][j][k]) %= MOD;
            (dp[ni][2][pos0*N1+pos1] += dp[ii][j][k]) %= MOD;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 2432
#include<iostream>
using namespace std;
int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (x - r<0 || y - r<0 || x + r>w || y + r>h)cout << "No\n";
	else cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using pll=pair<ll,ll>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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 main() {

	char a;
	cin >> a;
	if(a < 'a') cout << 'A' << endl;
	else cout << 'a' << endl;

  return 0;
}


Measured memory_bytes: 3632
// https://atcoder.jp/contests/abc138/tasks/abc138_b

import java.util.*;
import java.lang.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer x = Integer.parseInt(scanner.next());
        Integer[] arr = new Integer[x];

        for(int i = 0; i < x; i++) {
            arr[i] = Integer.parseInt(scanner.next());
        }

        Double total = 0.0;
        for(int i = 0; i < x; i++) {
            total += ((double)1 / arr[i]);
        }

        System.out.println((double)1 / total);
    }
}


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

using namespace std;

int main(){
	
	int a,b;
	
	cin >> a >> b;
	
	if (a*b > a + b && a*b > a -b ){
		cout << a*b;
	} else if (a+b > a*b && a+b > a-b){
		cout << a+b;
	} else {
		cout << a-b;
	}
	
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
path=[[] for i in range(n)]
for i in range(m):
  x,y=map(int,input().split())
  # どこからくるかとういう情報
  path[y-1].append(x-1)

memo = [-1]*n
def dfs(v):
  if memo[v] < 0:
    if len(path[v])==0:
      memo[v]=0
    else:
      memo[v]=max([dfs(p)+1 for p in path[v]])
  return memo[v]

res = 0
for i in range(n):
  tmp = dfs(i)
  if res < tmp:
    res = tmp
print(res)
  

Measured memory_bytes: 216112
#include<iostream>

using namespace std;
int to[1001][101];

int main(){

    while(1){
        int n, m, a;
        cin>> n>> m>> a;
        if(!(n||m||a)) break;

        int h[m], p[m], q[m];
        for(int i=0; i<m; i++) cin>> h[i]>> p[i]>> q[i];
        
        fill((int*)to, (int*)to+1001*101, 0);
        
        for(int i=0; i<m; i++){
            to[h[i]][p[i]]=q[i];
            to[h[i]][q[i]]=p[i];
        }

        for(int i=1000; i>=1; i--){
            if(to[i][a]!=0){
                a=to[i][a];
            }
        }

        cout<< a<< endl;

    }

    return 0;
}

Measured memory_bytes: 3404
function Main (input) {
  input = input.split("\n");
  var N = parseInt(input[0], 10);
  var S = input[1].split("");
  var ans = [S[0]];
  for (var i = 1; i < N; i++) {
    if (S[i] != ans[ans.length-1]) {
      ans.push(S[i]);
    }
  }
  console.log(ans.length);
}

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

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

int main() {
    int N; cin >> N;
    string S; cin >> S;
    if(N % 2 == 0 && (S.substr(0, N / 2) == S.substr(N / 2, N / 2))) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()

const int MAX = 1e6;

int N, M;
string S;
int last_step[MAX];

bool check(int n, int k) {
    while (k) {
        if (n+M >= N) return true;
        n = last_step[n+M];
        k--;
    }
    return false;
}

void solve() {
    REP (i, N+1) {
        if (S[i] == '0') last_step[i] = i;
        else last_step[i] = last_step[i-1];
    }

    // 到達可能か判定
    if (!check(0, N)) {
        cout << -1 << endl;
        return;
    }

    // 最小ステップを計算
    int ng = 0, ok = N;
    while (ok - ng > 1) {
        int mid = (ok + ng) / 2;
        if (check(0, mid)) ok = mid;
        else ng = mid;
    }

    int steps = ok;
    vi ans(steps);
    int pos = 0;
    REP (i, steps-1) {
        // 進むべき最小量を判定
        // 最大でもmin(N-pos, M)進めばたどり着ける
        ng = 0, ok = min(N-pos, M);
        while (ok - ng > 1) {
            int mid = (ok + ng) / 2;
            if (check(last_step[pos+mid], steps-1-i)) ok = mid;
            else ng = mid;
        }
        ans[i] = ok;
        pos += ok;
    }
    ans[steps-1] = N-pos;
    FORE (a, ans) cout << a << endl;
}

int main() {
    cin >> N >> M >> S;
    solve();
}

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



int main(){
double n;
cin >> n;
vector<double> x(n);
rep(i,n)
{cin >> x.at(i);}
vector<double> rx=x;
sort(rx.begin(),rx.end());
pair < double,double> medians;
medians.first=rx.at((rx.size() /2) -1);
medians.second=rx.at(rx.size()/2);
double median=(medians.first+medians.second)/2;
//cout<< medians.first<<":"<<medians.second<<":"<<median<<endl;
rep(i,n)
{int ans;
 if(x.at(i)>=median)
 {ans=medians.first;}
 else
 {
   ans=medians.second;
 }
 
 cout << ans << endl;
}
return 0;
}
//

Measured memory_bytes: 5376
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

using namespace std;

int N,W;

void func(){
	int value[20],maxHeight = 0,maxWidth = 0;

	for(int i = 0; i < 20; i++)value[i] = 0;

	int tmp;

	for(int loop = 0; loop < N;loop++){
		scanf("%d",&tmp);
		value[tmp/W]++;
		maxHeight = max(maxHeight,value[tmp/W]);
		maxWidth = max(maxWidth,tmp/W);
	}

	double ans = 0;

	for(int i = 0; i < maxWidth; i++){
		ans += (double)(1.0-((double)1/(double)maxWidth)*(double)i)*((double)value[i]/(double)maxHeight);
	}

	ans += 0.01;

	printf("%.10f\n",ans);

}


int main(){

   while(true){
	   scanf("%d %d",&N,&W);
	   if(N == 0 && W == 0)break;

	   func();
   }

    return 0;
}

Measured memory_bytes: 2708
h,w=map(int,input().split())
s=[]
for i in range(h):
    S=str(input())
    s.append(S)
ans=1
for i in range(1,h-1):
    for j in range(1,w-1):
        if s[i][j]=='#':
            if s[i-1][j]!='#' and s[i+1][j]!='#' and s[i][j+1]!='#' and s[i][j-1]!='#':
                ans=0
if ans==1:
    print("Yes")
else:
    print("No") 

Measured memory_bytes: 3064
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if V-W == 0:
  print('NO')  
elif V-W < 0:
  print('NO')
elif abs(B-A)/(V-W) <= T:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 9188
# 169A
# A * B を整数として出力せよ

# 1.　入力をプログラムで扱えるように受け取ること
a, b = map(int, input().split())
# print(a, b)

# 2.　受け取った入力値を使って、適切に処理（計算）すること
answer = a * b

# 3.　計算した結果を出力する
print(answer)

Measured memory_bytes: 9028
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

bool is_sorted(VI &v)
{
    rep(i, v.size() - 1)
    {
        if (v[i] > v[i + 1])
        {
            return false;
        }
    }
    return true;
}

int main()
{
    int n;
    cin >> n;
    VI v(n);
    rep(i, n) cin >> v[i];
    rep(i, n) rep(j, n)
    {
        swap(v[i], v[j]);
        if (is_sorted(v))
        {
            cout << "YES" << endl;
            return 0;
        }
        swap(v[i], v[j]);
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
// #include<assert.h>
#include<random>
using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD1 998244353 
#define MEM_SIZE 100010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int A,B,X;
  cin>>A>>B>>X;

  cout<<B/X - A/X + (A%X == 0)<<endl;;

  
  
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

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

  vector < vector<ll> > val(4);

  ll w0 = 0;
  for (int i = 0; i < N; i++){
    ll w, v; cin >> w >> v;
    if (i == 0){
      w0 = w;
    }
    val[w - w0].push_back(v);
  }
  
  vector < vector<ll> > sum(4);
  for (int i = 0; i < 4; i++){
    sum[i].push_back(0);

    if (val[i].size() > 0){
      sort(val[i].begin(), val[i].end(), greater<ll>());
    }

    ll S = 0;
    for (int j = 0; j < val[i].size(); j++){
      S += val[i][j];
      sum[i].push_back(S);
    }
  }

  ll ans = 0;
  for (ll i0 = 0; i0 <= val[0].size(); i0++){
    for (ll i1 = 0; i1 <= val[1].size(); i1++){
      for (ll i2 = 0; i2 <= val[2].size(); i2++){
        for (ll i3 = 0; i3 <= val[3].size(); i3++){
          ll weight = w0 * i0 + (w0 + 1) * i1 + (w0 + 2) * i2 + (w0 + 3) * i3;

          if (weight > W){
            break;
          }else{
            ll value = sum[0][i0] + sum[1][i1] + sum[2][i2] + sum[3][i3];
            if (ans < value){
              ans = value;
            } 
          }
        }
      }
    }
  }
  cout << ans << endl;
  


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Size 100005
#define Mod 1000000007LL
int main(){
    int a,b;
    cin>>a>>b;
    if((a==1 and b==2) || (a==2 and b==1)) cout<<"3"<<"\n";
    else if((a == 3 and b == 1) || (a == 1 and b == 3) ) cout<<"2"<<"\n";
    else if((a == 2 and b== 3) || (a == 3 and b== 2)) cout<<"1"<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>

using namespace std;

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int kk = 0,mm = 0;
  kk = max(a,c);
  mm = min(b,d);
  cout << max(mm - kk,0) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
ll N;
int main(){
	cin>>N;
	ll n;
	FOR(h,1,3501){
		FOR(w,1,3501){
			if(4*h*w-N*w-N*h>0 && N*w*h%(4*h*w-N*w-N*h)==0){
				n=N*w*h/(4*h*w-N*w-N*h);
				cout<<h<<" "<<n<<" "<<w<<endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
from itertools import permutations

N, C = map(int, input().split())
D = [list(map(int, input().split())) for i in range(C)]
G = [list(map(int, input().split())) for i in range(N)]

mod_0, mod_1, mod_2 = [], [], []
for i in range(N):
    for j in range(N):
        if (i + j) % 3 == 0:
            mod_0.append(G[i][j])
        if (i + j) % 3 == 1:
            mod_1.append(G[i][j])
        if (i + j) % 3 == 2:
            mod_2.append(G[i][j])

cost_0 = [sum([D[c - 1][color] for c in mod_0]) for color in range(C)]
cost_1 = [sum([D[c - 1][color] for c in mod_1]) for color in range(C)]
cost_2 = [sum([D[c - 1][color] for c in mod_2]) for color in range(C)]

ans = float('inf')
for p0, p1, p2 in permutations(range(C), 3):
    ans = min(ans, cost_0[p0] + cost_1[p1] + cost_2[p2])

print(ans)


Measured memory_bytes: 117052
#include <stdio.h>
int main(){

  int i,j,k,H,W;

  while (1){

    scanf("%d %d",&H,&W);

    if (H != 0 && W != 0){
  
      for (j = 0; j < H; j++){
  
	for (i = 0; i < W; i++){

	  printf("#");

	}

	printf("\n");

      }

      printf("\n");

    } else {

      break;

    }
    
  }

  return 0;
  
}

Measured memory_bytes: 572
// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;
 
#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

using T=ll;

class SST {
public:
    const T inf = 0;
    T m(T x, T y) { return max(x, y); }
    int d; T sum;
    SST* ch[2];
    SST(int D) : d(D) {
        sum = inf;
        ch[0] = nullptr;
        ch[1] = nullptr;
    }
    ~SST() {
        if (ch[0]) delete ch[0];
        if (ch[1]) delete ch[1];
    }
    void inc(const int& i, const T& v) {
        if (!d) { sum = m(sum, v); return; }
        bool cv = i & (1ll << (d - 1));
        if (!ch[cv]) ch[cv] = new SST(d - 1);
        ch[cv]->inc(i, v);
        sum = ch[cv]->sum; if(ch[1-cv]) sum = m(sum, ch[1-cv]->sum);
    }
    T prepsum(const int& i) {
        if (!d) return sum;
        T ans = inf;
        bool cv = i & (1ll << (d - 1));
        if (ch[cv]) ans = ch[cv]->prepsum(i);
        if (cv && ch[0]) ans = m(ans, ch[0]->sum);
        return ans;
    }
    T sufpsum(const int& i) {
        if (!d) return sum;
        T ans = inf;
        bool cv = i & (1ll << (d - 1));
        if (ch[cv]) ans = ch[cv]->sufpsum(i);
        if (!cv && ch[1]) ans = m(ans, ch[1]->sum);
        return ans;
    }
    T psum(const int& l, const int& r) {
        if (!d) return sum;
        bool cv1 = l & (1ll << (d - 1));
        bool cv2 = r & (1ll << (d - 1));
        if (cv1==cv2) {
            if(!ch[cv1]) return inf;
            return ch[cv1]->psum(l, r);
        }
        T ans = inf;
        if(ch[0]) ans = m(ans, ch[0]->sufpsum(l));
        if(ch[1]) ans = m(ans, ch[1]->prepsum(r));
        return ans;
    }
};

int h[200005];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    SST* s = new SST(20);
    int n; cin >> n;
    rep(i, n) cin >> h[i];
    rep(i, n) {
        int v; cin >> v;
        s->inc(h[i], s->psum(1, h[i]-1) + v);
    }
    cout << s->psum(1, n) << endl;
}



Measured memory_bytes: 19840
import numpy as np
N,K=map(int,input().split())
A=list(map(int,input().split()))

A=np.array(A)

A_pos=np.sort(A[A>0])
A_neg=np.sort(A[A<0])
A_neg2=-A_neg[::-1]
n_pos=len(A_pos)
n_neg=len(A_neg)
n_zero=N-n_pos-n_neg

def position_in_neg(x):
    y=n_pos-np.searchsorted(A_pos,x//A_neg,side='right')
    return y.sum()

def position_in_pos(x):
    z=np.searchsorted(A_pos,-(-x//A_pos),side='left')
    w=np.searchsorted(A_neg2,-(-x//A_neg2),side='left')
    tmp=len(A_pos[A_pos**2<x])+len(A_neg2[A_neg2**2<x])
    return (z.sum()+w.sum()-tmp)//2

def position(x):
    if x<0:
        return position_in_neg(x)
    elif x==0:
        return n_pos*n_neg
    else:
        return position_in_pos(x)+n_pos*n_neg+(n_pos+n_neg)*n_zero+n_zero*(n_zero-1)//2

l=-pow(10,18)
r=pow(10,18)
while(r-l>1):
    mid=(l+r)//2
    if position(mid)<K:
        l=mid
    else:
        r=mid
print(l)

Measured memory_bytes: 32304
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();
		int N = S.length();

		for(int i =0; i<N; i++){
			if(S.charAt(i)!=T.charAt(i)){
				System.out.println("No");
				return;
			}
		}

		System.out.println("Yes");
		return;
	}
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
int w,h,n;
short dx[]={0,0,0,1,-1};
short dy[]={0,1,-1,0,0};
string mp[20];

struct dat{
  short y1,x1;
  short y2,x2;
  short y3,x3;
};


short D[14][14][15][15][15][15];
queue<dat> Q;
void DD(dat &a,short b){D[a.y1-1][a.x1-1][a.y2-1][a.x2-1][a.y3-1][a.x3-1] = b;}
short DD(const dat &a){return D[a.y1-1][a.x1-1][a.y2-1][a.x2-1][a.y3-1][a.x3-1];}

bool check(const dat &a){
  if(mp[a.y1][a.x1]=='#') return 0;
  if(n>=2&&mp[a.y2][a.x2]=='#') return 0;
  if(n>=3&&mp[a.y3][a.x3]=='#') return 0;
  return DD(a)==-1;
}

void update(const dat &a){
  short cost = DD(a);

  for(int i=0;i<5;i++){
    short ny1 = a.y1+dy[i], nx1 = a.x1+dx[i];
    for(int j=0;j<5;j++){
      short ny2 = a.y2+dy[j], nx2 = a.x2+dx[j];
      if(n<=1) ny2 = 15,nx2 = 14;
      for(int k=0;k<5;k++){
	short ny3 = a.y3+dy[k], nx3 = a.x3+dx[k];
	if(n<=2) ny3 = 14,nx3 = 15;

	dat nt = (dat){ny1,nx1,ny2,nx2,ny3,nx3};
	if(!check(nt))continue;
	
	if((ny1==ny2&&nx1==nx2) ||(ny2==ny3&&nx2==nx3) ||(ny3==ny1&&nx3==nx1))continue;//same pos
	if(((a.y1==ny2&&a.x1==nx2) && (a.y2==ny1&&a.x2==nx1)) || // swap positoin
	   ((a.y2==ny3&&a.x2==nx3) && (a.y3==ny2&&a.x3==nx2)) ||
	   ((a.y3==ny1&&a.x3==nx1) && (a.y1==ny3&&a.x1==nx3)) )continue;
	
	Q.push(nt);
	DD(nt,cost+1);
      }
    }
  }
}

bool goal(const dat &s,const dat &t){
  char a = mp[s.y1][s.x1];
  char b = mp[s.y2][s.x2];
  char c = mp[s.y3][s.x3];
  char A = mp[t.y1][t.x1];
  char B = mp[t.y2][t.x2];
  char C = mp[t.y3][t.x3];
  return toupper(a)==A&&(n<=1||toupper(b)==B)&&(n<=2||toupper(c)==C);
}

int bfs(dat start){
  memset(D,-1,sizeof(D));
  while(!Q.empty())Q.pop();
  Q.push(start);
  DD(start,0);
  
  while(!Q.empty()){
    dat t = Q.front();Q.pop();
    if(goal(start,t)) return DD(t);
    update(t);
  }
  return 0;
}

int main(){
  while(1){
  cin>>w>>h>>n;
  if(!w&&!h&&!n)break;
  cin.ignore();
  for(int i=0;i<h;i++)getline(cin,mp[i]),mp[i]+='#';
  
  dat start = (dat){15,15,15,14,14,15};
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++){
      if(!islower(mp[i][j]))continue;
      if(start.y1==15) start.y1=i,start.x1=j;
      else if(start.y2==15) start.y2=i,start.x2=j;
      else start.y3=i,start.x3=j;
    }
  cout<<bfs(start)<<endl;
  }
  return 0;
}

Measured memory_bytes: 25368
n, m = map(int, input().split())
p = int(m / n)

if n > 100:
    for i in range(p, 0, -1):
        if m % i == 0:
            print(i)
            break
else:
    for i in range(n, m + 1):
        if m % i == 0:
            print(int(m / i))
            break


Measured memory_bytes: 2940
n, m = map(int , input().split())
l_max = 0
r_min = float('inf')
for i in range(m):
    l , r =map(int, input().split())
    l_max = max(l_max, l)
    r_min = min(r_min, r)
if l_max > r_min:
    print(0)
else:
    print(r_min - l_max + 1)

Measured memory_bytes: 3188
package main

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

var sc = bufio.NewScanner(os.Stdin)

func getInput() (int, int, error) {
	sc.Split(bufio.ScanWords)
	a := make([]int, 2)
	for i := range a {
		sc.Scan()
		n, err := strconv.Atoi(sc.Text())
		a[i] = n
		if err != nil {
			return 0, 0, err
		}
	}
	return a[0], a[1], nil
}

func main() {

	a, b, err := getInput()
	if err != nil {
		fmt.Printf("error: %s\n", err)
		return
	}

	if (a*b)&0x00000001 == 1 {
		fmt.Println("Odd")
		return
	}

	fmt.Println("Even")

}


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

bool is_LE_2(long long n, const vector<int> &a) {
    for (int i = 0; i < (int)a.size(); i++) {
        n = floor((double)n / a.at(i)) * a.at(i);
        if (n <= 2) return true;
    }
    return false;
}

bool is_GE_2(long long n, const vector<int> &a) {
    for (int i = 0; i < (int)a.size(); i++) {
        n = floor((double)n / a.at(i)) * a.at(i);
        if (n < 2) return false;
    }
    return true;
}

int main() {
    int k;
    cin >> k;
    vector<int> a(k);
    for (int i = 0; i < k; i++) {
        cin >> a.at(i);
    }
    long long r;
    {
        long long ng = k * 1000000000ll + 2;
        long long ok = -1;

        while (abs(ok - ng) > 1) {
            long long mid = (ok + ng) / 2;
            
            if (is_LE_2(mid, a)) ok = mid;
            else ng = mid;
        }
        r = ok;
    }
    
    long long l;
    {
        long long ng = -1;
        long long ok = k * 1000000000ll + 2;

        while (abs(ok - ng) > 1) {
            long long mid = (ok + ng) / 2;

            if (is_GE_2(mid, a)) ok = mid;
            else ng = mid;
        }
        l = ok;
    }

    if (r < l) cout << -1 << endl;
    else cout << l << " " << r << endl;
}

Measured memory_bytes: 640
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	std::string X, Y;
	std::cin >> X >> Y;
	if (X < Y)
		std::cout << "<\n";
	else if (X > Y)
		std::cout << ">\n";
	else
		std::cout << "=\n";
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
    
    int n;
    int b[30]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30};
    
    for(int i=0;i<28;i++){
        cin>>n;
        b[n-1]=0;
    }
    
    for(int k=0;k<30;k++){
        if(b[k]!=0){
            cout<<b[k]<<endl;
        }
    }
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005

int n,a[25][25];

ll mod=1e9+7,dp[22][2097152];

vector <int> s[22];

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cin >> a[i][j];
        }
    }
    for(int j=1;j<(1<<n);j++){
        int cnt=0;
        for(int t=0;t<n;t++){
            if(j&(1<<t)) cnt++;
        }
        s[cnt].pb(j);
    }
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j : s[i]){
            for(int t=0;t<n;t++){
                if((j&(1<<t)) && a[i][t+1]) dp[i][j]+=dp[i-1][j-(1<<t)],dp[i][j]%=mod;
            }
        }
    }
    cout << dp[n][(1<<n)-1];
}


Measured memory_bytes: 318908
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <queue>
#include <climits>
#include<cmath>
#include <sstream>
#include <iomanip>

const int64_t cc = pow( 10, 9 ) + 7;

int main()
{
    std::string a;
    int64_t b = 0;
    //int64_t a,b,c,d;
    std::cin>> a;
    char s = a[0];

    for( int i = 1; i < a.size(); i++ )
    {
        if( s == a[i] )
        {
            if( s ==  '1' )
            {
                s = '0';
            }
            else
            {
                s = '1';
            }

            b += 1;
        }
        else
        {
            s = a[i];
        }
    }

    std::cout<< b;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<char,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const int INF=1<<30;


int main(){
    int n;cin >> n;
    vector<LL> a(n);
    LL ans = 0;
    LL mini = LINF;
    int c = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans += abs(a[i]);
        mini = min(abs(a[i]),mini);
        if(a[i]<0) c++;
    }
    if(c%2) cout << ans - 2*mini << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

long f(long n, long x) { return n < 0 ? 0 : n / x + 1; }

int main() {
  int n;
  cin >> n;
  int t[n];
  int s = 0;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
    s += t[i];
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int p, x;
    cin >> p >> x;
    cout << s - t[p - 1] + x << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;

int main(){
    char a;
    cin >> a;
    map<char, char> m;
    m['A'] = 'T';
    m['C'] = 'G';
    m['G'] = 'C';
    m['T'] = 'A';

    cout << m[a] << endl;
    return 0;
}

Measured memory_bytes: 256
mod = 998244353
def main():
  n, k =  map(int, input().split())
  query= []
  for i in range(k):
    query.append(list(map(int, input().split())))
  dp = [0]*(n + 1)
  dp[1] = 1
  for i in range(2, n+1):
    dp[i] += dp[i-1]
    for lr in query:
      if i-lr[0] <= 0:
        continue
      else:
        dp[i] += dp[i-lr[0]]-dp[max(0, i-lr[1]-1)]
        dp[i] %= mod
  print((dp[n]-dp[n-1])%mod)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 16944
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[3];
int main()
{
    while(cin>>a[0]>>a[1]>>a[2]){
        sort(a,a+3);
        if(a[0]==5&&a[1]==5&a[2]==7){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}


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

using namespace std;

#define Max 310000

int main(){

  vector<int> p;
  bool is_p[Max];
  for(int i=0; i<Max; i++){
    is_p[i] = true;
  }
  is_p[0] = is_p[1] = false;
  for(int i=2; i<Max; i++){
    if(i%7 != 1 and i%7 != 6)
      is_p[i] = false;
  }

  for(int i=6; i<Max; i++){
    if(is_p[i] and (i%7 == 1 || i%7 == 6)){
      p.push_back(i);
      for(int j=2; i*j<Max; j++){
	is_p[i*j] = false;
      }
    }
  }

  while(1){
    int n; cin >> n;
    if(n==1) break;
    cout << n << ":";
    for(int i=0; i<p.size() and p[i] <= n; i++){
      if(n%p[i] == 0)
	cout << " " << p[i];
    }
    cout << endl;
  }

}

Measured memory_bytes: 1648
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
typedef vector<vector<pint> > Graph;


int main(){
    int n;
    cin >> n;
    if(1 <= n - (n/100)*100 && n - (n/100)*100 <= 12){
	if(1 <= n/100 && n/100 <= 12){
	    cout << "AMBIGUOUS" << endl;
	}
	else{
	    cout << "YYMM" << endl;
	}
    }
    else{
	if(1 <= n/100 && n/100 <= 12){
	    cout << "MMYY" << endl;
	}
	else{
	    cout << "NA" << endl;
	}
    }
}



Measured memory_bytes: 888
//*Here I go out to sea again
//*The sunshine fills my hair
//*And dreams hang in the air

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

#define ll long long
#define mp make_pair
#define pb push_back

int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c;
    int c5=0,c7=0;
    cin>>a;
    if(a==5){
      ++c5;
    }
    else if(a==7){
      ++c7;
    }
    cin>>b;
    if(b==5){
      ++c5;
    }
    else if(b==7){
      ++c7;
    }
    cin>>c;
    if(c==5){
      ++c5;
    }
    else if(c==7){
      ++c7;
    }
    if(c5==2 && c7==1){
      cout<<"YES"<<"\n";
    }
    else{
      cout<<"NO"<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3664
using System;
    class Program
    {
        static void Main(string[] args)
        {
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            // 計算
            int c = a + b;
            if (c > 23)
            {
                c -= 24;
            }
            //出力
            Console.WriteLine(c);
        }
    }

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007

using namespace std;

int main(void){
	ll n,k;

	cin>>n>>k;
	if(k%2==1){
		ll num=n/k;
		cout<<num*num*num<<endl;
	}
	else{
		ll num=n/k;
		ll num2=(n-k/2)/k+1;
		if(n<k/2)num2=0;
		cout<<num*num*num+num2*num2*num2<<endl;
	}

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  string S, T;
  cin >> S >> T;
  int slen = S.size();
  rep(i,slen) {
    if (S[i] != T[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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



int main(){
	long long a, b, c, k, n = 0, t = 2;
	cin >> a >> b >> c >> k;
	if(k % 2 == 1){
		cout << b - a<<endl;
	}else{
		cout << a - b << endl;
	}
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        String str = sc.nextLine();
        for(int i = 0; i < str.length(); i++){
            char c = str.charAt(i);
            if(c >= 'A' && c <= 'Z'){
                c += 'a' - 'A';
            }else if(c >= 'a' && c <= 'z'){
                c -= 'a' - 'A';
            }
            sb.append(c);
        }
        System.out.println(sb);
    }
}


Measured memory_bytes: 26164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ll n, k, val = 1, valdoub = 1, valk = 1;
    cin >> n >> k;
    
    for(int i = 0; i < n; ++i)
    {
        valdoub *= 2;
        valk += k;
        if(valdoub < valk)
        {
            val = valdoub;
            valk = valdoub;
        }
        else
        {
            val = valk;
            valdoub = valk;
        }
    }
    
    cout << val << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 1000000
const int mod = 998244353;

int n;
int A[N+1];
int B[N+1];
int M[N+1];
int S[N+1];

/*
\sum_{i<j} lcm(Ai,Aj)
\sum_{i<j} Ai Aj / gcd(Ai,Aj)
\sum_{d} 1/d \sum_{i<j: gcd(Ai, Aj) = d} Ai Aj

f(d) = \sum_{i,j: gcd(Ai, Aj) = d} Ai Aj
F(d) = \sum_{i,j: d | gcd(Ai, Aj)} Ai Aj
F(d) = \sum_{i,j: d | Ai, d | Aj)} Ai Aj
F(d) = (\sum_{i: d | Ai} Ai)^2
\sum_{d} 1/d \sum_{n: d|n} m(n/d) F(n)
*/

int modpow(int x, int n){
  int r=1;
  for(;n;n>>=1){
    if(n&1) r = (long long) r * x % mod;
    x = (long long) x * x % mod;
  }
  return r;
}

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

  M[1] = 1;
  for(i=2;i<=N;i++){
    if(!S[i]){
      M[i] = -1;
    }
    for(j=2*i;j<=N;j+=i) S[j] = 1;
    for(j=2;i*j<=N && j<i;j++){
      M[i*j] = M[i] * M[j];
    }
  }
  for(i=2;i*i<=N;i++){
    if(S[i]) continue;
    int ii = i*i;
    for(j=1;j*ii<=N;j++) M[j*ii] = 0;
  }

  for(i=1;i<=N;i++){
    for(j=i;j<=N;j+=i){
      B[i] = (B[i] + (long long) j * A[j]) % mod;
    }
  }

  for(i=1;i<=N;i++){
    B[i] = ((long long) B[i] * B[i]) % mod;
    for(j=i;j<=N;j+=i){
      B[i] = B[i] - (long long) j * j % mod * A[j] % mod;
      if(B[i] < 0) B[i] += mod;
    }
    B[i] = B[i]&1?(B[i]+mod)/2:B[i]/2;
  }

  r = 0;
  for(i=1;i<=N;i++){
    int z = 0;
    for(j=1;j*i<=N;j++){
      z = (z + (long long) B[i * j] * M[j]) % mod;
      if(z < mod) z += mod;
    }
    r = (r + (long long) modpow(i, mod-2) * z) % mod;
  }
  printf("%d\n", r);

  return 0;
}


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

using namespace std;

int main() {
    long long x, y;
    scanf("%lld %lld", &x, &y);
    int res = 0;
    for (long long i = x; i <= y; i <<= 1) {
        res++;
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion
#pragma region chminmax
template <typename T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

int main()
{
    int n, w;
    cin >> n >> w;
    vector<P> b(n);
    // v, w
    rep(i, n) cin >> b[i].first >> b[i].second;

    vector<vector<int>> dp(n + 1, vector<int>(w + 1));
    rep(i, n)
    {
        rep(j, w + 1)
        {
            if (j - b[i].second >= 0)
            {
                chmax(dp[i + 1][j], dp[i][j - b[i].second] + b[i].first);
            }
            chmax(dp[i + 1][j], dp[i][j]);
        }
    }
    cout << dp[n][w] << endl;

    return 0;
}


Measured memory_bytes: 6840
#include <bits/stdc++.h>
using namespace std;
#define int long long 
const int nmax = (int) 1e6 + 10;


int h[nmax];
int cost[nmax];

int absub(int a, int b) {
    return abs(a - b);
}

signed main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    
    //cost[n] = min((cost[n - 1] + abs(h[n] - h[n - 1])), cost[n - 2] + abs(h[n] - h[n - 2]))
    
    int n;
    cin >> n;
    for (int i = 1; i <= n; i ++) {
        cin >> h[i];
    }
    cost[1] = 0;
    cost[2] = absub(h[2], h[1]);

    for (int i = 3; i <= n ; i++) {
        cost[i] = cost[i - 1] + absub(h[i], h[i - 1]);
        cost[i] = min(cost[i], cost[i - 2] + absub(h[i], h[i - 2]));
    }
    

    
    cout << cost[n] << endl;




    return 0;
}

Measured memory_bytes: 5120