akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		int ans = 0;
		int be = Integer.MAX_VALUE;
		for(; n > 0; n--) {
			int ch = sc.nextInt();
			if(ch < be) {
				ans++;
				be = ch;
			}
			
		}
		pw.print(ans);
		pw.close();
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

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

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

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

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

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}

Measured memory_bytes: 43732
roll_dict = dict(E = (3, 1, 0, 5, 4, 2), W = (2, 1, 5, 0, 4, 3), S = (4, 0, 2, 3, 5, 1), N = (1, 5, 2, 3, 0, 4))
dice = list(map(int, input().split()))
directions = input()

for i in directions:
  new_dice = []
  for j in range(6):
    new_dice.append(dice[ roll_dict[i][j] ])
  dice = new_dice

print(dice[0])



Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    vector<string> a(n);
    rep(i, n) cin >> a[i];
    vector<string> b(m);
    rep(i, m) cin >> b[i];

    rep(oy, n-m+1) rep(ox, n-m+1) {
        bool found = true;
        rep(dy, m) rep(dx, m) {
            if (a[oy+dy][ox+dx] != b[dy][dx]) {
                found = false;
                break;
            }
        }
        if (found == true) {
            put("Yes");
            return 0;
        }
    }
    
    put ("No");
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>

int main(int argc, char *argv[]) {
  int n, k;
  std::cin >> n >> k;
  std::vector<int> a(n);
  --k;
  std::vector<long> sum(n - k);
  for (int i = 0; i < n; ++i) {
    std::cin >> a.at(i);
    if (i <= k)
      sum.at(0) += a.at(i);
    else {
      sum.at(i - k) = sum.at(i - k - 1) - a.at(i - k - 1) + a.at(i);
    }
  }

  for (int i = 0; i < (int)sum.size() - 1; ++i) {
    long a = sum.at(i);
    long b = sum.at(i + 1);
    if (a < b)
      std::cout << "Yes" << std::endl;
    else
      std::cout << "No" << std::endl;
  }
}


Measured memory_bytes: 5196
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void){
    // Here your code !
    for(int i=0;i<9;i++) {
        for(int j=0;j<9;j++) {
            printf("%dx%d=%d\n", i+1, j+1, (i+1)*(j+1));
        }
    }
}

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

int main() {
	string s;
	cin>>s;
	int temp;
	long long cnt=0,cntb=0;
	for(temp=s.size()-1;temp>=0;temp--) {
		if(s[temp]=='B') {
			int lenbs=s.size()-temp-cntb-1;
			cnt+=lenbs;
			cntb++;
		}
	}
	cout<<cnt<<"\n";
}

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

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  
  int cost = 0;
  REP(i, m) {
    int tmp;
    cin >> tmp;
    if (tmp < x)
      ++cost;
    else
      break;
  }
  
  cout << min(cost, m - cost) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::prelude::BufRead;
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufReader, BufWriter, Write};
#[allow(unused_imports)]
use std::mem::swap;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let mut arr = vec![];
    for _ in 0..5 {
        let a = read::<usize>();
        arr.push(a);
    }
    println!("{}", dfs(&arr, 0, 0));
}

fn dfs(arr: &[usize], used: usize, time: usize) -> usize {
    let mut minimum = std::usize::MAX;
    let new_time = if time % 10 == 0 { time } else { 10 * (time / 10 + 1) };
    for i in 0..5 {
        if used >> i & 1 == 1 {
            continue;
        }
        let t = dfs(arr, used | (1 << i), new_time + arr[i]);
        minimum = min(minimum, t);
    }
    if minimum == std::usize::MAX {
        return time;
    }
    minimum
}

#[allow(dead_code)]
fn read<T>() -> T
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    return buf.trim().parse().unwrap();
}

#[allow(dead_code)]
fn read_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::with_capacity(100);
    stdin().read_line(&mut buf).unwrap();
    return buf.split_whitespace().map(|s| s.parse().unwrap()).collect();
}

#[allow(dead_code)]
fn read_matrix<T>() -> Vec<Vec<T>>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    use std::io::prelude::*;
    let stdin = stdin();
    let mut reader = BufReader::with_capacity(100 * 1024, stdin);
    let mut line = String::with_capacity(100);
    let mut matrix: Vec<Vec<T>> = Vec::new();

    while reader.read_line(&mut line).unwrap() > 0 {
        matrix.push(
            line.trim()
                .split_whitespace()
                .map(|s| s.parse().unwrap())
                .collect(),
        );
        line.clear();
    }

    return matrix;
}

#[allow(dead_code)]
fn read_chars() -> Vec<char> {
    let stdin = stdin();
    let mut buf = String::new();
    let _bytes = stdin.read_line(&mut buf).unwrap();
    return buf.trim().chars().collect();
}


Measured memory_bytes: 4352
#pragma region

#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  int N, K, S;
  cin >> N >> K >> S;

  vector<int> ans(N);
  rep(i, K) ans[i] = S;
  rep(i, K, N) ans[i] = (S == 1000000000) ? 1 : (S + 1);

  rep(i, N) {
    if (i != 0) cout << " ";
    cout << ans[i];
  }
  cout << "\n";
}


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

int main(void) {
	char input_str[12 * 200000];
	int last_char_index;

	fgets(input_str, sizeof(input_str), stdin);
	last_char_index = strlen(input_str) - 2;
	if ( input_str[last_char_index] == 's' ) {
		input_str[last_char_index+1] = 'e';
		input_str[last_char_index+2] = 's';
		input_str[last_char_index+3] = '\n';
	}
	else {
		input_str[last_char_index+1] = 's';
		input_str[last_char_index+2] = '\n';
	}

	printf("%s\n", input_str);

	return 0;
}



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

int main(){
  int A, B, K;
  cin >> A >> B >> K;
  for(int i = 100; i > 0; i--){
    if( A % i == 0 && B % i == 0){
      K--;
    if(K == 0){
      cout << i << endl;
    }
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int cnt=0,m=0;
void insertionSort(vector<int> &A, int n, int g){
    int v,i,j;
    for(i=g;i<n;i++){
        v = A[i];
        j = i - g;
        while(j >= 0 && A[j] > v){
            A[j+g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j+g] = v;
    }
}

void shellSort(vector<int> &A, int n){
    cnt = 0;
    int i;
    m = 9;
    int G[] = {9841,3280,1093,364,121,40,13,4,1};
    for(i=0;i<9;i++){
        if(G[i]>n){
            m--;
            continue;
        }else{
            break;
        }
    }
    cout<<m<<'\n';
    for(;i<9;i++){
        cout<<G[i]<<((i<8)?' ':'\n');
    }
    for(i=9-m;i<9;i++){
        insertionSort(A, n, G[i]);
    }
}

int main(){
    int i,n;
    cin>>n;
    vector<int> v(n);
    for(i=0;i<n;i++)
        cin>>v[i];
    shellSort(v,n);
    cout<<cnt<<'\n';
    for(auto k:v){
        cout<<k<<'\n';
    }
    return 0;
}


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

int main() {
	int n;

	cin >> n  ;
	
	int sum = 0;

	for (int i = 0; i < n; i++)
	{
		int l,r;
		cin >> l >> r;
		sum += r - l + 1;
	}
	
		cout << sum << endl;
}

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

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    int N;
    cin >> N;
    int ans = (N*(N+1))/2;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

Measured memory_bytes: 3632
#include<iostream>

using namespace std;

int main()
{
	char c[3][3];
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> c[i][j];
		}
	}
	cout << c[0][0] << c[1][1] << c[2][2] << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()

match_dict = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

N,M = map(int, input().split())
A = list(map(int, input().split()))

#桁数のMAX
dp = [-1] * (N+1)
dp[0] = 0

for a in A:
    for i in range(match_dict[a], N+1):
        if dp[i - match_dict[a]] >= 0:
            dp[i] = max(dp[i], dp[i - match_dict[a]] + 1)

ans = ''
A.sort(reverse=True)

i = N
while i:
    for a in A:
        if i - match_dict[a] >= 0 and dp[i - match_dict[a]] == dp[i] - 1:
            ans += str(a)
            i -= match_dict[a]
            break

print(ans)

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

int main(){
  string s;
  cin >> s;
  int n = s.size();
  vector<char> x;
  for(int i = 0;i < n;i++){
    x.push_back(s.at(i));
  }
  vector<int> answer;
  bool renzoku = false;
  for(int i = 0;i < n-1;i++){
    if(x.at(i) == x.at(i+1)){
      renzoku = true;
      answer.push_back(i);
      answer.push_back(i+1);
    }
  }
  bool matagi = false;
  if(renzoku == false){
    for(int i = 0;i < n-2;i++){
      if(x.at(i) == x.at(i+2)){
        matagi = true;
        answer.push_back(i);
        answer.push_back(i+2);
      }
    }
  }
  if(renzoku == true || matagi == true){
    cout << answer.at(0) + 1 << ' ' << answer.at(1) + 1 << endl;
  }
  else{
    cout << -1 << ' ' << -1 << endl;
  }
}

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

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

    vector<long long> A(N);
    for (long long &a : A)
    {
        cin >> a;
    }

    priority_queue<pair<long long, size_t>> q;
    for (size_t i = 0; i < N; i++)
    {
        q.push(make_pair(A[i], i));
    }

    vector<vector<long long>> dp(N + 1, vector<long long>(N + 1, 0));
    for (size_t i = 0; !q.empty(); i++)
    {
        for (size_t j = 0; j <= i; j++)
        {
            dp[j + 1][i - j] = max(dp[j + 1][i - j], dp[j][i - j] + q.top().first * abs((long long)(q.top().second - j)));
            dp[j][i - j + 1] = max(dp[j][i - j + 1], dp[j][i - j] + q.top().first * abs((long long)(((N - 1) - (i - j)) - q.top().second)));
        }
        q.pop();
    }

    long long ans = 0;
    for (size_t i = 0; i <= N; i++)
    {
        ans = max(ans, dp[i][N - i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 34596
#include <bits/stdc++.h>
using namespace std;
 
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define W while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define Rof(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define mod 1000000007

  int main()
  {
    ll n,m;
    cin>>n>>m;
    ll a[m],i,count=0;
    for(i=0;i<m;i++)
    cin>>a[i];
    for(i=0;i<m;i++)
    count=count+a[i];
    if(count>n)
    cout<<-1;
    else
    cout<<n-count;
  }


Measured memory_bytes: 3652
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

ll rec[1600][1600];
struct Elem {
    ll pos, cost;
    Elem() {}
    Elem(ll a, ll b) : pos(a), cost(b) {}
    bool operator<(const Elem &e) const {
        return cost > e.cost;
    }
};
 
int main() {
    int N, R; cin >> N >> R;
    vector< vector< pair<int, int> > > G(N);
    for(int i=0; i<R; i++) {
        int u, v, d; cin >> u >> v >> d;
        u--; v--;
        G[u].emplace_back(v, d);
        G[v].emplace_back(u, d);
    }

    fill(rec[0], rec[N], INF);
    for(int s=0; s<N; s++) {
        priority_queue<Elem> que;
        que.emplace(s, 0);
        rec[s][s] = 0;
        while(que.size()) {
            Elem cur = que.top(); que.pop();
            if(cur.cost > rec[s][cur.pos]) continue;
            for(auto e : G[cur.pos]) {
                int u = cur.pos, v = e.first, c = e.second;
                if(rec[s][v] > cur.cost + c) {
                    rec[s][v] = cur.cost + c;
                    que.emplace(v, rec[s][v]);
                }
            }
        }
    }

    ll max_cost = -1;
    for(int i=0; i<N; i++) {
        for(int j=i+1; j<N; j++) {
            max_cost = max(max_cost, rec[i][j]);
        }
    }

    vector< pair<int, int> > pairs;
    for(int i=0; i<N; i++) {
        for(int j=i+1; j<N; j++) {
            if(rec[i][j] != max_cost) continue;
            pairs.emplace_back(i, j);
        }
    }

    // fprintf(stderr, "pairs size = %zu\n", pairs.size());
    vector<int> used(N);
    for(int i=0; i<N; i++) {
        for(auto st : pairs) {
            int s, t; tie(s, t) = st;
            if(rec[s][i] + rec[i][t] == max_cost) {
                used[i] = true;
                break;
            }
        }
    }

    vector<int> ans;
    for(int i=0; i<N; i++) if(!used[i]) ans.emplace_back(i);
    cout << ans.size() << endl;
    for(auto e : ans) cout << e+1 << endl;
    return 0;
}



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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;

int main() {
    string s;
    cin >> s;
    rep(i, 3) {
        if (s[i] == '1')
            cout << 9;
        else if (s[i] == '9')
            cout << 1;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  A--;
  B--;
  C--;
  D--;
  string S;
  cin >> S;
  bool ok = true;
  for (int i = A + 1; i < B - 1; i++){
    if (S[i] == '#' && S[i + 1] == '#'){
      ok = false;
    }
  }
  for (int i = C + 1; i < D - 1; i++){
    if (S[i] == '#' && S[i + 1] == '#'){
      ok = false;
    }
  }
  if (!ok){
    cout << "No" << endl;
  } else {
    if (C < D){
      cout << "Yes" << endl;
    } else {
      ok = false;
      for (int i = B; i <= D; i++){
        if (S[i - 1] == '.' && S[i] == '.' && S[i + 1] == '.'){
          ok = true;
        }
      }
      if (ok){
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
}

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

int main(){
    string s;
    cin>>s;
    int ans=0,j=0;
    rep(i,3){
        if(s[i]=='R'){
            j++;
        }
        else j=0;
        ans=max(ans,j);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3592
n = int(input())
arr = []
for i in range(n):
    arr += [list(input())]

MARCH = [0] * 5    
    
for j in range(n):
    if arr[j][0] == 'M':
        MARCH[0] += 1
    elif arr[j][0] == 'A':
        MARCH[1] += 1
    elif arr[j][0] == 'R':
        MARCH[2] += 1
    elif arr[j][0] == 'C':
        MARCH[3] += 1
    elif arr[j][0] == 'H':
        MARCH[4] += 1

def C(a,b):
    aa = 1
    bb = 1
    for k in range(a-b+1, a+1):
        aa *= k
    for l in range(1, b+1):
        bb *= l
    return int(aa/bb)
        
ans = C(sum(MARCH), 3)

for m in range(5):
    if MARCH[m] == 2:
        ans -= C(sum(MARCH)-MARCH[m],1)
    elif MARCH[m] >= 3:
        ans -= C(MARCH[m],2) * C(sum(MARCH)-MARCH[m],1)
        ans -= C(MARCH[m],3)

print(ans)
    

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

int main(){
  int N;
  cin>>N;
 vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  int a=0;
  int b=0;
  for(int i=0;i<N;i++){
    if(i%2==0){
      a+=A.at(i);
    }else{
      b+=A.at(i);
    }
  }
  cout<<a-b<<endl;
}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

//A Book Shop With a Frequent Greetings
public class Main{


	class E implements Comparable<E>{
		int id, t;
		public E(int id, int t) {
			this.id = id;
			this.t = t;
		}
		public int compareTo(E o) {
			return t-o.t;
		}
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		int L = 10000, INF = 1<<29;
		while(T--!=0){
			int n = sc.nextInt(), X = sc.nextInt(), Y = sc.nextInt();
			int sx = sc.nextInt(), sy = sc.nextInt();
			int[][] p = new int[n][2];
			for(int i=0;i<n;i++)for(int j=0;j<2;j++)p[i][j]=sc.nextInt();
			boolean[][] e = new boolean[n][n];
			for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)if(Math.hypot(p[i][0]-p[j][0], p[i][1]-p[j][1])<=50)e[i][j]=e[j][i]=true;
			int[] last = new int[n];
			Arrays.fill(last, -150);
			int res = 0;
			PriorityQueue<E> q = new PriorityQueue<E>();
			for(int i=0;i<n;i++)if(Math.hypot(p[i][0]-sx, p[i][1]-sy)<=10)q.add(new E(i, 0));
			while(!q.isEmpty()){
				E ev = q.poll();
				if(L<ev.t){
					res = INF; break;
				}
				if(ev.t-Y>last[ev.id]){
					last[ev.id] = ev.t+X;
					res = Math.max(res, last[ev.id]);
					for(int i=0;i<n;i++)if(e[ev.id][i])q.add(new E(i, ev.t+X));
				}
			}
			System.out.println(res==INF?"You're always welcome!":res);
		}
	}

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

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

ans = [0 for _ in range(N - 1)]

for i in range(1, N):
    for j in range(i + 1, N + 1):
        cand = []
        cand.append(j - i)
        cand.append(abs(i - X) + 1 + abs(j - Y))
        ans[min(cand) - 1] += 1
        
[print(a) for a in ans]

Measured memory_bytes: 3444
#include <iostream>

using namespace std;

int main()
{
	int m, f, r;
	int g;
	
	while (1)
	{
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1)
			break;
		
		g = 'F'; // A +5 = F
		if (m == -1 || f == -1)
			g = 'F';
		else if ((m+f) >= 80)
			g = 'A';
		else if ((m+f) >= 65)
			g = 'B';
		else if ((m+f) >= 50)
			g = 'C';
		else if ((m+f) >= 30)
		{
			g = 'D';
			if (r >= 50)
				g = 'C';
		}
		else if ((m+f) < 30)
			g = 'F';
		
		cout << (char)g << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define REV(i, a) for (int i = (a); i > 0; --i)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) cerr << #x << " = " << (x) << endl;
#define INF (3e15)

using namespace std;

int N, M;
int fac[100005];
int mod = 1000000007;

signed main() {
    cin >> N >> M;
    if (abs(N - M) > 1) {
        cout << 0 << endl;
        return 0;
    }

    fac[0] = fac[1] = 1;
    FOR(i, 2, max(N, M) + 2) { fac[i] = (fac[i - 1] * i) % mod; }

    int ans = (fac[N] * fac[M]) % mod;
    if (N == M) ans *= 2;
    cout << ans % mod << endl;

    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

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

        int ans = 0;
        if (a >= 13) {
            ans = b;
        } else if (a >= 6) {
            ans = b / 2;
        }

        System.out.println(ans);
    }

}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const double EPS = 1e-10;

int main() {
    string S;
    cin >> S;
    if (S == "RRR") { cout << 3 << endl; }
    if (S == "RRS") { cout << 2 << endl; }
    if (S == "RSR") { cout << 1 << endl; }
    if (S == "RSS") { cout << 1 << endl; }
    if (S == "SRR") { cout << 2 << endl; }
    if (S == "SRS") { cout << 1 << endl; }
    if (S == "SSR") { cout << 1 << endl; }
    if (S == "SSS") { cout << 0 << endl; }

    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=1e5+1;
int main()
{
    FASTINOUT;
    int x;
    cin>>x;
    if (x<=999)
        cout<<"ABC\n";
    else
        cout<<"ABD\n";
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [0] + list(map(int, input().split())) + [0]

d = [x - y for y, x in zip(A[:-1], A[1:])]
dist = sum(abs(i) for i in d)

for i in range(N):
    ans = dist - abs(d[i]) - abs(d[i + 1])
    ans += abs(A[i] - A[i + 2])
    print(ans)

Measured memory_bytes: 20628
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out<<x<<" ";
    }
    out<<"\n";
    return out;
}
template<typename T>
ostream& operator*(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out+x;
    }
    return out;
}
template<typename T>
istream& operator>>(istream& in, vector<T> &vec){
    for(auto &x : vec){
        in>>x;
    }
    return in;
}
void solve(){
    int n;
    cin>>n;
    vector<pair<int,int>> points(n);
    for(auto &[x,y] : points){
        cin>>x>>y;
    }
    sort(points.begin(), points.end());
    int mn1 = 1e9, mn2 = 1e9;   //x+y, x-y
    int ans = 0;
    for(auto &[x,y] : points){
        mn1 = min(mn1, x+y);
        mn2 = min(mn2, x-y);
        ans = max(ans, x+y - mn1);
        ans = max(ans, x-y - mn2);
    }
    cout<<ans<<"\n";
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}

Measured memory_bytes: 4704
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N=INT()

dp=[0]*50
dp[0]=dp[1]=1
for i in range(2, 50):
    dp[i]=dp[i-1]+dp[i-2]

print(dp[N])



Measured memory_bytes: 5608
x = int(input())
m = 11
if x < 7:
  ans = 1
elif x <= 11:
  ans = 2
elif x%m == 0:
  ans = x*2//m
elif 0 < x%m <= 6:
  ans = (x//m)*2+1
elif 7 <= x%m:
  ans = (x//m)*2+2
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long
int main (){
    int n, a, b;
    cin >> n >> a >> b;
    int count = 0;
    int k;
    for (int i = 1; i <= n; i++){
        k = 0;
        k += (i%10)+(i/10%10)+(i/100%10)+(i/1000%10)+(i/10000);
        if (k >= a && k <= b) count+=i;
    }
    cout << count << endl;
    return 0;
}


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

int S[100];
int top = 0;

void push(int x);

int pop(void);

int main(){
  int x,sub;
  char s[100];

  while( scanf("%s",s) != EOF ){

    if ( s[0] == '+' ){

      push(pop() + pop());


    } else if ( s[0] == '-' ){

      sub = pop();
      push(pop() - sub);

    } else if ( s[0] == '*' ){

      push(pop() * pop());

    } else {
      x = atoi(s);
      push(x);
    }
  }

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

  return 0;
}

void push(int x){

  top++;
  S[top] = x;

}

int pop(void){

  top--;
  return S[top+1];
}

Measured memory_bytes: 548
#include <iostream>

using namespace std;

int main(){
  int n,a,b;
  cin >> n >> a >> b;

  int sum = 0;
  int ans = 0;
  int x;
  for(int i = 1; i <= n; i++){
    sum = 0;

    x = i;
    while(x > 0){
      sum = sum + x%10;
      x /= 10;
    }

    if(sum >= a && sum <= b) ans = ans + i;

  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define inRange(x,a,b) (a <= x && x < b)

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

struct board{
    int y, x;
    vector<vector<char>> v;
    board(int i, int j) : y(i), x(j) {
        v.resize(i, vector<char>(j));
    }
};

int main(){
    int x, y;
    while(cin >> x >> y, x+y){
        char mat[y][x];
        board ini(y, x);
        for(int i = 0; i < y; i++){
            for(int j = 0; j < x; j++){
                cin >> mat[i][j];
                ini.v[i][j] = mat[i][j];
            }
        }

        queue<pair<int, board>> q;
        q.push({0, ini});

        int ans = -1;
        while(ans == -1 && !q.empty()){
            auto p = q.front(); q.pop();
            int cnt = 0;
            char c = p.second.v[0][0];
            for(int i = 0; i < y; i++){
                for(int j = 0; j < x; j++){
                    if(c == p.second.v[i][j])   cnt++;
                }
            }
            if(cnt == x*y){
                ans = p.first;
                break;
            }

            for(int i = 0; i < 3; i++){
                char from = p.second.v[0][0], to = "RGB"[i];
                if(from == to)    continue;
                board next = p.second;
                queue<pair<int,int>> pq;
                pq.push({0,0});
                while(!pq.empty()){
                    pair<int,int> now = pq.front(); pq.pop();
                    if(next.v[now.first][now.second] == to) continue;
                    next.v[now.first][now.second] = to;
                    for(int k = 0; k < 4; k++){
                        int ni = now.first + dx[k], nj = now.second + dy[k];
                        if(inRange(ni, 0, y) && inRange(nj, 0, x) && next.v[ni][nj] == from){
                            pq.push({ni,nj});
                        }
                    } 
                }

                cnt = 0;
                c = to;
                for(int i = 0; i < y; i++) for(int j = 0; j < x; j++)   cnt += (next.v[i][j] == c);
                if(cnt == x*y){
                    ans = p.first+1;
                    break;
                }
                q.push({p.first+1, next});
            }
        }

        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 76920
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let mut s = scan.chars();
    s.insert(4, ' ');
    println!("{}", s.into_iter().collect::<String>());
}

// region template
#[allow(dead_code)]
fn iu(i: isize) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> isize { i as isize }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        let mut ret = vec![];
        for _ in 0..n { ret.push(self.read::<T>()) }
        ret
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 4352
#include <iostream>
 
using namespace std;
 
int main(void) {
 
  int n,l;
  int k[100002];
  int i;
  cin>>n>>l;
  int p,c;
  int max=0,imax=0;
  cin>>c;
  for(i=1;i<=n-1;i++){
    p=c;
    cin>>c;
    k[i]=p+c;
    if(max<p+c){
      max=p+c;
      imax=i;
    }
  }
 
  if (max<l) cout<<"Impossible";
  else{
    cout<<"Possible\n";
    for(i=1;i<imax;i++)cout<<i<<"\n";
    for(i=n-1;i>imax;i--)cout<<i<<"\n";
    cout<<imax<<"\n";
  }
  
  return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    int n,c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,mi=0,ma=0;
    cin>>n;
    int a;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a<400) c1++;
        else if(a<800) c2++;
        else if(a<1200) c3++;
        else if(a<1600) c4++;
        else if(a<2000) c5++;
        else if(a<2400) c6++;
        else if(a<2800) c7++;
        else if(a<3200) c8++;
        else c9++;
    }
    if(c1!=0)c1=1;
    if(c2!=0)c2=1;
    if(c3!=0)c3=1;
    if(c4!=0)c4=1;
    if(c5!=0)c5=1;
    if(c6!=0)c6=1;
    if(c7!=0)c7=1;
    if(c8!=0)c8=1;
    
    mi=c1+c2+c3+c4+c5+c6+c7+c8;
    ma=mi+c9;
    if(mi==0) mi=1;
    cout<<mi<<" "<<ma<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define abs(p) ((p)>=(0)?(p):(-(p)))
int main(void){
    char S[3];
    scanf("%s", S);
    if(S[0]==S[1] || S[1]==S[2] || S[0]==S[2]){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    // 変数一覧
    int s;
    int w;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        s = sc.nextInt();
        w = sc.nextInt();
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        if (s<=w) System.out.println("unsafe");
        else System.out.println("safe");
    }
}

Measured memory_bytes: 35776
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

vector<int> x, y;

int main()
{
    int n, m;
    cin>>n>>m;
    REP(i,m) {
        int tx;
        cin>>tx;
        x.push_back(tx);
    }
    SORT(x);
    REP(i,m-1) {
        y.push_back(x[i+1] - x[i]);
    }
    SORT(y);
    ll ans = 0ll;
    REP(i,m-n) {
        ans += y[i];
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
#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 fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int N, A[101];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];
    
    int ans = 0;
    rep(i, 1, N - 1) if (A[i - 1] == A[i] and A[i] == A[i + 1]) {
        ans++;
        A[i] = -1;
    }

    rep(i, 1, N) if (A[i - 1] == A[i]) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>

#define LP(i,n) for(int i=0;i<n;i++)
#define Mset(x,v) memset(x,v,sizeof(x))
#define INF INT_MAX

using namespace std;
using LL=long long;

int main(){
    int n,m,maxn=0,a,sum;
    cin>>n>>m;
    LP(i,n){
        sum=0;
        LP(j,m){
            cin>>a;
            sum+=a;
        }
        maxn=max(maxn,sum);
    }
    cout<<maxn<<endl;
    return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
    x=0;char c=getchar();bool f=0;
    while(!isdigit(c)) f|=c=='-',c=getchar();
    while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
    if(f) x=-x;return  x;
}
template<class t> inline void write(t x){
    if(x<0){putchar('-'),write(-x);}
    else{if(x>9)write(x/10);putchar('0'+x%10);}
}

#define int long long

const int N=55,M=25;
int en,f[N],d[N],h[N],s[M],n,m,ans;

struct edge{
	int n,v;
}e[N<<1];

void add(int x,int y){
	e[++en]=(edge){h[x],y};
	h[x]=en;
}

void dfs(int x){
	d[x]=d[f[x]]+1;
	for(int i=h[x];i;i=e[i].n){
		int y=e[i].v;
		if(y==f[x]) continue;
		f[y]=x;
		dfs(y);
	}
}

signed main(){
	read(n);
	for(int i=1,x,y;i<n;i++){
		read(x);read(y);
		add(x,y);add(y,x);
	}
	dfs(1);
	read(m);
	for(int i=0,x,y;i<m;i++){
		read(x);read(y);
		if(d[x]<d[y]) swap(x,y);
		while(d[x]^d[y]) s[i]|=1ll<<x-1,x=f[x];
		while(x^y) s[i]|=(1ll<<x-1)|(1ll<<y-1),x=f[x],y=f[y];
	}
	int lim=1<<m;
	for(int i=1;i<lim;i++){
		int cnt=0,now=0,tot=0;
		for(int j=0;j<m;j++) if(i>>j&1) cnt++,now|=s[j];
		for(int j=0;j<n;j++) if(now>>j&1) tot++;
		tot=1ll<<(n-1-tot);
		if(cnt&1) ans+=tot;
		else ans-=tot;
	}
	write((1ll<<n-1)-ans);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H==0 && W==0) {
                break;
            }
            for(int i=0;i<H;i++) {
                if(i==0 || i==H-1){
                    for(int j=0;j<W;j++) {
                        System.out.print('#');
                    }
                }
                else{
                    for(int k=0;k<W;k++){
                        if(k==0 || k==W-1){
                            System.out.print("#");
                        }
                        else{
                            System.out.print(".");
                        }
                    }
                }
                System.out.println();
            }
            System.out.println();
        }
        sc.close();
    }
}


Measured memory_bytes: 33136
package main

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

func main() {
	scan_input := bufio.NewScanner( os.Stdin )
	scan_input.Scan()
	input := strings.Split( scan_input.Text(), " " )
	
	aux_5 := 0
	aux_7 := 0
	for i:=0; i<len( input ); i++ {
		num, _ := strconv.Atoi( input[ i ] )
		if num == 5 {
			aux_5++
		}
		if num == 7 {
			aux_7++
		}
	}

	if aux_5 == 2 && aux_7 == 1 {
		fmt.Println( "YES" )
	} else {
		fmt.Println( "NO" )
	}
}

Measured memory_bytes: 1772
import java.util.Scanner;
import java.util.Queue;
import java.util.PriorityQueue;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    Queue<Integer> items = new PriorityQueue<Integer>(Collections.reverseOrder());
    for (int i = 0; i < N; i++)
      items.add(sc.nextInt());
    for (int i = 0; i < M; i++)
      items.add(items.poll() / 2);
    long sum = 0;
    for (int i = 0; i < N; i++)
      sum += items.poll();
    System.out.println(sum);
  }
}

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

int main() {
  int N;
  cin >> N;
  
  for (int i = 0; i < N; i++){
  	string s;
    cin >> s;
    
    if(s != "Y"){
      	if(i == N-1){
        	cout << "Three" << endl;
          	break;
        }
      	continue;
    }
    
    cout << "Four" << endl;
    break;
  }
}


Measured memory_bytes: 256
//アルメリアさんの解説ブログを読んだ

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;

ll mod;
ll dp[310][310]; // dp[i][j]:整数を1~iまで入れ終わって、長さjの通り数
ll sub[310][310]; // 1~i個から重複を許してj個とる組み合わせの積の総和 
ll Pow[310][310]; // iのj乗にmodをとったもの
int main(){
    int n,k; cin >> n >> k >> mod;
    n++;
    for(int i=1;i<=301;i++){
        Pow[i][0]=1;
        for(int j=1;j<=301;j++){
            Pow[i][j]=Pow[i][j-1]*i%mod;
        }
    }
    sub[0][0]=1;
    for(int i=1;i<=301;i++){
        for(int j=0;j<=301;j++){
            for(int k=0;k+j<=301;k++){
                (sub[i][j+k]+=sub[i-1][j]*Pow[i][k])%=mod;
            }
        }
    }
    dp[0][1]=1;
    for(int i=1;i<=300;i++){
        for(int j=0;j<=301;j++){
            for(int k=0;j+k<=301;k++){
                (dp[i][j+k]+=dp[i-1][j]*sub[j][k])%=mod; //なるほどなぁ
            }
        }
    }
    cout << dp[k][n] << endl;
}

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

int main(void) {
    double r;
    double ans;
    (void)scanf("%lf",&r);
    ans=2*r*M_PI;
    printf("%.20lf\n",ans);
    return 0;
}

Measured memory_bytes: 1752
#include<bits/stdc++.h>
#define ll long long
#define xll __int128
#define fo(i,n) for(int i=0;i<n;i++)
#define rfo(i,n) for(int i=n-1;i>=0;i--)
#define Fo(i,q,n) for(int i=q;i<n;i++)
#define rFo(i,q,n) for(int i=n-1;i>=q;i--)
#define fO(i,n,k) for(int i=0;i<n;i+=k)
#define FO(i,q,n,k) for(int i=q;i<n;i+=k)
#define zero(a,n) memset(a,0,sizeof(a[0])*n)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define Endl "\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
using namespace std;
const int MOD=1000000007;
void print(){cout <<endl;}
template <typename T, typename... Types> 
void print(T var1, Types... var2){cout << var1 << " " ;print(var2...) ;}
//ceil of a/b
template <typename T>
T fceil(T a,T b){return (T)(a+b-1)/b;}
template <typename T>
void printvec(vector<T> v){ for(int i=0;i<(int)v.size();i++){ cout<<v[i]<<" ";} cout<<endl;}
template <typename T>
void printarr(T a[],int n){ for(int i=0;i<n;i++){ cout<<a[i]<<" ";} cout<<endl;}
//const int N=2e5;
//int arr[N+1];

 
int main(){
	string s;
	cin>>s;
	int n=s.size();
	if(s[n-1]=='s'){
		s+="es";	
	}
	else{
		s+="s";	
	}
	cout<<s<<endl;
	return 0;
}






/*NOTE: Take MOD after sorting and not before sorting!*/


Measured memory_bytes: 3596
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000

using namespace std;
typedef long long ll;

int main(){
	bool m[31]={};
	for(int i=0;i<28;i++){
		int a;
		cin>>a;
		m[a]=true;
	}
	for(int i=1;i<=30;i++){
		if(m[i]==false){
			cout<<i<<endl;
		}
	}
	return 0;
}

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

using namespace std;
int a[105];
int main(){
	int n;
	cin>>n;
	int ans=0;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if(a[i]!=a[j]&&a[j]!=a[k]&&a[i]+a[j]>a[k])ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 3596
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string n;
    cin >> n;
    for(int i=0; i<n.size(); i++){
        if(n.at(i)=='7'){
            printf("Yes");
            return 0;
        }
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw				"\n"


int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0;
	cin>>n>>k;
	cout<<min(n%k,k-(n%k));

}


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

int main()
{

	long long N;
	cin >> N;

	vector<long long> list;
	list.reserve(N);

	long long nus = 0, alai =0;


	for (long long i = 0; i < N; i++)
	{
		long long in;
		cin >> in;
		list.push_back(in);

		alai += in;

	}

	nus = list[0];
	alai -= list[0];
	long long ans = abs(nus - alai);

	for (long long i = 1; i < N-1; i++)
	{
		nus += list[i];
		alai -= list[i];
		long long tmp = abs(nus - alai);
		if (ans > tmp)
			ans = tmp;
		
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int log[10001][1261];
int state[1001];

int main(){
    int n,m,r,q;

    while(cin >> n >> m){
        if((n|m) == 0) break;
        memset(log, -1, sizeof(log));
        memset(state, -1, sizeof(state));
        cin >> r;
        
        int t, _n, _m, s, ts, te, mq, tmp;
        for(int i=0;i<r;i++){
            cin >> t >> _n >> _m >> s;
            if(s){//login
                state[_n] = t;
            }else{//logout
                for(int j=state[_n];j<=t;j++){
                    log[_m][j] = t;
                }
            }
        }

        cin >> q;
        int ret;
        for(int i=0;i<q;i++){
            ret = 0;
            cin >> ts >> te >> mq;
            tmp = ts;
            while(tmp < te){
                if(log[mq][tmp] != -1 && tmp != log[mq][tmp]){
                    ret += min(te, log[mq][tmp]) - tmp;
                    tmp = min(te, log[mq][tmp]);
                }else{
                    tmp++;
                }
            }
            cout << ret << endl;
        }
    }
}

Measured memory_bytes: 48000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    ll n; cin >> n;
    vector<char> c(n); rep(i, n) cin >> c[i];
    ll r_sum = 0;
    rep(i, n) if(c[i] == 'R') r_sum++;
    ll ans = 0;
    rep(i, r_sum) if(c[i] == 'W') ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3620