akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            Monster takahashi = new Monster(Int32.Parse(str[0]), Int32.Parse(str[1]));
            Monster aoki = new Monster(Int32.Parse(str[2]), Int32.Parse(str[3]));
            while (true)
            {
                aoki.Stamina -= takahashi.Attack;
                if(aoki.Stamina <= 0) { break; }
                takahashi.Stamina -= aoki.Attack;
                if(takahashi.Stamina <= 0) { break; }
            }

            if(aoki.Stamina <= 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }

    public class Monster
    {
        public int Stamina { get; set; }
        public int Attack { get; set; }

        public Monster(int Stamina, int Attack)
        {
            this.Stamina = Stamina;
            this.Attack = Attack;
        }
    }
}


Measured memory_bytes: 27468
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
typedef long long ll;
using namespace std;

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

const long long INF = 1LL << 60;

int a[21][21];
int main() {
	int n,m,c;
	cin >> n >> m >> c;
	int res =0;
	vector<int> B(m);
	for (int i = 0;i < m;i++) {
		cin >> B[i];
	}
	for (int i = 0;i < n;i++) {
		int aut = 0;
		for (int j = 0;j < m;j++) {
			cin >> a[i][j];
			aut += a[i][j] * B[j];
		}
		aut += c;
		if (aut > 0) {
			res++;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Optional;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			// すべての小文字を含む集合
			Set<Character> set = new HashSet<>();
			for (char a = 'a'; a <= 'z'; a++) {
				set.add(a);
			}
			set.removeAll(scanner.next().chars().distinct().collect(ArrayList<Character>::new,
					(a, b) -> a.add((char) b), ArrayList<Character>::addAll));
			Optional<Character> first = set.stream().sorted().findFirst();
			System.out.println(first.isPresent() ? first.get() : "None");
		}
	}
}


Measured memory_bytes: 40004
use proconio::input;

fn main() {
    input! {
        n: i32,
    }

    match n % 10 {
        2 | 4 | 5 | 7 | 9 => println!("hon"),
        0 | 1 | 6 | 8 => println!("pon"),
        3 => println!("bon"),
        _ => println!("un"),
    }
}

Measured memory_bytes: 2136
import math
N, M = input().split()
N = int(N)
M = int(M)

if abs(N - M) > 1:
    print(0)
elif N == M:
    res = math.factorial(N) * math.factorial(M) * 2
    print(res % int(1e9 + 7))
else:
    res = math.factorial(N) * math.factorial(M)
    print(res % int(1e9 + 7))



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

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

Measured memory_bytes: 256
s = input().strip()
ss = s.split()
d = int(ss[0])
n = int(ss[1])
i = 1
while 1:
	x = i
	c = 0
	while x % 100 == 0:
		x //= 100
		c += 1
	if c == d:
		n -= 1
		if n == 0:
			print(i)
			break
	i += 1


Measured memory_bytes: 40556
#include<stdio.h>
int main(){
  int s,x,i;
  while(scanf("%d",&x)!=EOF){
    s=0;
    for(i=x;i<=600;i+=x){
      s+=x*(600-i)*(600-i);
    }
    printf("%d\n",s);
  }
  return(0);
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <limits.h>
#include <math.h>
#include <string>
#include <vector>
#include <map>
using namespace std;

int main(void){
    long long n, a[100010], b[100010];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    
    long long x[100010];
    for (int i = 0; i < n; i++) {
        x[i] = a[i] - b[i];
    }
    
    sort(x, x + n);
    
    if (x[0] >= 0) {
        cout << 0 << endl;
        return 0;
    }
        
    
    long long xsum = 0, t, ans = 0;
    for (int i = 0; i < n; i++) {
        if (x[i] >= 0) {
            t = i - 1;  break;
        }
        xsum += x[i];
        ans++;
    }
    
    for (int i = n - 1; i > t; i--) {
        xsum += x[i];
        ans++;
        if (xsum >= 0) {
            cout << ans << endl;
            return 0;
        }
    }
    
    cout << -1 << endl;
}


Measured memory_bytes: 2560
#include<stdio.h>

void bubblesort(int[],int);

int main(){
  int A[1000];
  int i,N,count=0;

  scanf("%d",&N);
  if(N <= 0 && N >= 100)return 0;

  for( i = 0 ;i < N ; i++ ){
    scanf("%d",&A[i]);
  }
  bubblesort(A,N);

  
  return 0;
}

void bubblesort(int A[],int N){
  int i,flag=1,j,ex,count=0;
  
  for(i=0;flag;i++){
      flag=0;
      for( j = N-1 ; j >= i+1 ; j-- ){
	if( A[j] < A[j-1] ){
	  ex = A[j];
	  A[j] =  A[j-1];
	  A[j-1] = ex;
	  flag = 1;
	  count++;
	}
      }
    }
    for( i = 0 ; i < N ; i++ ){
      if( i > 0 )printf(" ");
      printf("%d",A[i]);
    }

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



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

using namespace std;

const int N = 200000 + 7;

typedef pair<int, int> ii;


int main() {
  int h, w, n;
  scanf("%d %d %d", &h, &w, &n);
  int sr, sc;
  scanf("%d %d", &sr, &sc);
  char t[N];
  char a[N];
  int r[] = {0, 0};
  int l[] = {0, 0};
  int u[] = {0, 0};
  int d[] = {0, 0};
  getchar();
  for(int i = 0; i < n; ++i) {
    scanf("%c", &t[i]);
    if(t[i] == 'R') ++r[0];
    if(t[i] == 'L') ++l[0];
    if(t[i] == 'U') ++u[0];
    if(t[i] == 'D') ++d[0];
  }
  getchar();
  for(int i = 0; i < n; ++i) {
    scanf("%c", &a[i]);
    if(a[i] == 'R') ++r[1];
    if(a[i] == 'L') ++l[1];
    if(a[i] == 'U') ++u[1];
    if(a[i] == 'D') ++d[1];
  }
  /*
  for(int i = 0; i < n; ++i) cout << t[i]; cout<<endl;
  for(int i = 0; i < n; ++i) cout << a[i]; cout<<endl;
  */
  if(sr - u[0] < 1) {
    int check = sr;
    for(int i = 0; i < n; ++i) {
      if(t[i] == 'U') --check;
      if(check < 1) {
        puts("NO");
        return 0;
      }
      if(check >= 1 && check < h && a[i] == 'D') ++check;
    }
  }
  if(sr + d[0] > h) {
    int check = sr;
    for(int i = 0; i < n; ++i) {
      if(t[i] == 'D') ++check;
      if(check > h) {
        puts("NO");
        return 0;
      }
      if(check > 1 && check <= h && a[i] == 'U') --check;
    }
  }
  if(sc - l[0] < 1) {
    int check = sc;
    for(int i = 0; i < n; ++i) {
      if(t[i] == 'L') --check;
      if(check < 1) {
        puts("NO");
        return 0;
      }
      if(check >= 1 && check < w && a[i] == 'R') ++check;
    }
  }
  if(sc + r[0] > w) {
    int check = sc;
    for(int i = 0; i < n; ++i) {
      if(t[i] == 'R') ++check;
      if(check > w) {
        puts("NO");
        return 0;
      }
      if(check > 1 && check <= w && a[i] == 'L') --check;
    }
  }
  puts("YES");
  /*
  string st = t;
  string sa = a;
  int ans = solve(sr, sc, st, sa, pos, 0);
  */
  return 0;
}


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

macro_rules! min {
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    ($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) => { 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 mut ps = vec![false; n];
    let mut cs = vec![1; n];
    ps[0] = true;

    for _ in 0..m {
        let x: usize = sc.cin::<usize>() - 1;
        let y: usize = sc.cin::<usize>() - 1;
        if ps[x] {
            if cs[x] == 1 {
                ps[x] = false;
                ps[y] = true;
            } else {
                ps[y] = true;
            }
        }
        cs[x] -= 1;
        cs[y] += 1;
    }
    put!(ps.iter().filter(|&b| *b).count());

}

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()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
using namespace std;
int a, b, c, d, e, f;
int wt (int ia, int ib) {
	return ia * a * 100 + ib * b * 100;
}

int sg (int ic, int id) {
	return ic * c + id * d;
}
int main() {
	cin >> a >> b >> c >> d >> e >> f;
	int bw = -1, bs = -1;
	for (int ia = 0; wt(ia, 0) <= f; ia++) {
		for (int ib = 0; wt(ia, ib) <= f; ib++){
			for (int ic = 0; wt(ia, ib) + sg(ic, 0) <= f; ic++) {
				for (int id = 0; wt(ia, ib) + sg(ic, id) <= f; id++) {
					if (1ll * sg(ic, id) > e * 1ll * (wt(ia, ib) / 100)) continue;
					int cw = wt(ia, ib), cs = sg(ic, id);
					bool yes = cs * 1ll * (bw + bs) > bs * 1ll * (cw + cs);
					if (bw <= 0 || yes) {
						bw = cw, bs = cs;
					}
				}
			}
		}
	}
	cout << (bw + bs) << " " << bs << "\n";
}


Measured memory_bytes: 256
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		int k=sc.nextInt();
		long ans=0;
		if(a<=k){
			ans=a;
			k-=a;
		}else{
			ans=k;
			k=0;
		}
		if(b<=k){
			k-=b;
		}else{
			k=0;
		}
		if(c<=k){
			ans-=c;
		}else{
			ans-=k;
		}
		System.out.println(ans);
	}
}


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

int n;
int a[10];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a, a + n);
  
  int sum = 0;
  for (int i = 0; i < n - 1; ++i) sum += a[i];
  cout << (sum > a[n - 1] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#include <iomanip>
#define ll long long
#define intm INT_MAX
#define llm LLONG_MAX

using namespace std;
typedef pair<int,int> P;
const int MOD = 998244353;
const ll mod = 1e9 + 7;
const int mxN = 1e6 + 9;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
    char s;
    cin >> s;
    int low = s-'a';
    int high = s-'A';
    if( 0 <= low && low <= 25 ) cout << 'a';
    else if( 0 <= high && high <= 25 ) cout << 'A';


}


Measured memory_bytes: 3584
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

vi divisors(int n) {
  vi v;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      v.pb(i);
      if (n != 1 && i * i != n) v.pb(n / i);
    }
  }
  sort(all(v));
  return v;
}

void solve() {
  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  vvi x;
  transform(all(a), back_inserter(x), [](int x) {
    return divisors(x);
  });
  vi ds = accumulate(x.begin() + 1, x.end(), x.front(), [](vi a, vi x) {
    vi w;
    set_intersection(all(a), all(x), back_inserter(w));
    return w;
  });
  for (auto x : ds) cout << x << endl;
}

Measured memory_bytes: 3152
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
const int inf = 1000000000; //10^9
const ll MOD = 1e9 + 7;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a == (2 * b - c)) {
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
    return 0;
}

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

using namespace std; 

int main(){
  
  long long int k;
  cin>>k;

  long long int seven=7;
  
  if(k==1) cout<<1<<endl;
  else if(k<seven){
    long long int remay=seven%k;
    long long int y[1000011];
    memset(y, 0, sizeof(y));
    long long int ans=1;
    y[remay]++;
    bool judgey=true;
    while(remay!=0){
      remay=(remay*10+7)%k;
      if(y[remay]>=1){
        cout<<-1<<endl;
        judgey=false;
        break;
      }else{
        y[remay]++;
        ans++;
      }
    }

    if(judgey) cout<<ans<<endl;
  

  } else if(k==seven) cout<<1<<endl;
  else if(k>seven){
    
    long long int cnt=1;
    while(seven<k){
      seven=seven*10+7;
      cnt++;
    }
    
    if(seven%k==0) cout<<cnt<<endl;
    else {
      long long int rema=seven%k;
      long long int x[1000011];
      memset(x, 0, sizeof(x));
      x[rema]++;
      bool judge=true;
      while(rema!=0){
        rema=(rema*10+7)%k;
        if(x[rema]>=1){
          cout<<-1<<endl;
          judge=false;
          break;
        }else{
          x[rema]++;
          cnt++;
        }
      }
      
      if(judge) cout<<cnt<<endl;
    }
    

  }

}


Measured memory_bytes: 11392
#include <bits/stdc++.h>
#define sz              size()
#define pb              push_back
#define Fr              first
#define Sc              second
#define Log2(x)         (31^__builtin_clz(x))
#define endl            "\n"
#define int             ll
using namespace std;
typedef long long ll;
int n;
int m;
int A[2002];
int sum;
vector<double> v;
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> m;
    for(int i = 0 ; i < n ; i++) {
        cin >> A[i];
        sum += A[i];
    }
    sum += 4 * m - 1;
    sum /= 4 * m;
    int cnt = 0;
    sort(A, A + n, greater<int>());
    for(int i = 0 ; i < m ; i++)
        if(A[i] < sum) return cout << "No\n", 0;
    cout << "Yes\n";

}


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

typedef long long ll;
typedef int64_t i6;
typedef std::vector<std::vector<int64_t> > Graph;

#define rep(i, n) for (int64_t i = 0; i < n; ++i)
#define rep2(i, n) for (int64_t i = 1; i <= n; ++i)
#define repb(i, l, n) for (int64_t i = l; i < n; ++i)
#define repb2(i, l, n) for (int64_t i = l; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))
#define Push_back(p, a, b) (p).push_back( make_pair( (a), (b) ) )

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;  }
template<typename V,typename T> bool find_num(V v, T num) { if ( find(ALL(v), num) == v.end() ) { return false; } return true; }

int main() {
    double n, m, k;
    cin >> n >> m >> k;
    int64_t ans = 0;
    if (n/k <= m) ans = 1;
    cout << ( ans ? "Yes" : "No" ) << endl;
    return 0;
}


Measured memory_bytes: 3628
//FA専用
#include <bits/stdc++.h>
using namespace std;
#define int long long
const long long LINF=1e18;
int a,b,c,d,e,f,n,m,ans;
string s,t,u;
template<typename T>
void chmax(T &a,T b){
  if(a<b)a=b;
}
template<typename T>
void chmin(T &a,T b){
  if(a>b)a=b;
}
template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
template<typename T,typename U>
void fin(T a,U b){
  cout<<a<<" "<<b<<endl;
  exit(0);
}
template<typename T,typename U,typename S>
void fin(T a,U b,S c){
  cout<<a<<" "<<b<<" "<<c<<endl;
  exit(0);
}

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

signed main(){
  cin>>a;
  for(int i=a;;i++){
    if(prime(i))fin(i);
  }
}

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

using namespace std;

#define ll long long

const int N=1e6+5,MOD=1000000007;

int n,idx[N],a[N],q,m,u,tc,k,l,x,y;

ll ans;

char s[N];

vector<string> v;


map<string,int>freq;

int main(){ 
    std::ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin >> n;
    v.resize(n);
    for(int i=0;i<n;i++)
        cin>>v[i],sort(v[i].begin(),v[i].end());

    for(int i=0;i<n;i++){
        ans+=freq[v[i]];
        freq[v[i]]++;
    }
    cout << ans;
}

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

class Program
{
    static void Main(string[] args)
    {
        //int[] lines = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        
        double r = double.Parse(Console.ReadLine());
        
        Console.WriteLine("{0} {1}", string.Format("{0:f6}", r * r * Math.PI), string.Format("{0:f6}", 2 * Math.PI * r));
    }
}

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

int main(int argc, char *argv[])
{
	int i, j;
    int N, K;
	int left, right;

	int result;
	int temp_result;

	cin >> N >> K;

	int x[N];

	for (i = 0; i < N; i++) {
		cin >> x[i];
	}

	for (i = 0; i < N - K + 1; i++) {
		temp_result = 0;
		left = x[i];
		right = x[i + K - 1];
		if (abs(left) >= abs(right)) {
			temp_result += abs(right);
		} else {
			temp_result += abs(left);
		}
   		for (j = K; j > 1; j--) {
   			temp_result += x[i + j - 1] - x[i + j - 2];
   		}
   		if (i == 0) {
	   		result = temp_result;
	   	} else if (temp_result < result) {
	   		result = temp_result;
	   	}	
	}

	cout << result << "\n";

	
	return 0;
}

Measured memory_bytes: 640
N, K = map(int, input().split())
H = list(map(int, input().split()))

dp_table = []

for i in range(N):
    if i == 0:
        dp_table.append(0)
    else:
        min_num = float("inf")
        for j in range(min(K, i)):
            X = dp_table[i - j - 1] + abs(H[i] - H[i - j - 1])
            if X < min_num:
                min_num = X
        dp_table.append(min_num)

print(dp_table[-1])



Measured memory_bytes: 57696
#include <bits/stdc++.h>
#include<set>
#define ll long long 
#include <string>
#define pb push_back
#define mp make_pair
# define pi 3.14159265358979323846
#define mod 1000000007
using namespace std;
int main()
{ 
    string s;
    cin>>s;
    
    ll int sum=0;
    for(ll int i=0;i<s.size();i++)
    {
    	ll int d=s[i]-'0';
    	sum+=d;
    	
	}
	if (sum%9==0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
    
   
   
}
   



	
		
	
	
	
	



Measured memory_bytes: 3696
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  ll n;
  cin >> n;
  // ll n, m;
  // cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  mii m;
  int x;
  fi(0, n) {
    cin >> x;
    m[x]++;
  }
  int even = 0;
  for(auto y: m) {
    if(y.second % 2) {
      ans++;
    }
    else {
      even++;
    }
  }
  ans += (even % 2 ? even - 1 : even);
  cout << ans << endl;
  return 0;
}



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

int n;

int main(){
    cin >> n;
    vector<int> a(n,0);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    //for(int i = 0; i < n; i++) cout << a[i] << endl;
    int c,d = 0;
    bool sw = false;
    int h,w = 0;
    for(int j = 1; j < n; j++){
        if(a[j - 1] == a[j]){
            if(!sw)c++;
            if(sw)d++;
        }else{
            if(c >= 3){
                w = a[j - 1];
                h = a[j - 1];
                c = 0;
                break;
            }else if(c >= 1){
                w = a[j - 1];
                c = 0;
                sw = true;
            }
            if(d >= 1){
                h = a[j - 1];
                d = 0;
                break;
            }
        }
    }

    if(c >= 3){
        w = a[n - 1];
        h = a[n - 1];
    }

    if(d >= 1){
        h = a[n - 1];
    }
    cout << (long long int)w*h << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <algorithm>
#include <cassert>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>

#define rep(i, l, r) for (ll i = (l); i <= (r); i++)
#define irep(i, r, l) for (ll i = (r); i >= (l); i--)
#define vec(t) vector<int>

using namespace std;
using ll = long long;
using veci = vec(int);
using vecll = vec(ll);

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

    int A, B;


    cin >> A >> B;
    if (A==B) cout << A + B << endl;
    if (A>B) cout << A + A-1 << endl;
    if (B>A) cout << B + B-1 << endl;

}

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

using namespace std;

int main() {
  int N, C;
  cin >> N >> C;

  int time[100010];
  memset(time, 0, sizeof(time));
  vector<vector<pair<int, int>>> vec(C, vector<pair<int, int>>());
  for (int i = 0; i < N; i++) {
    int s, t, c;
    cin >> s >> t >> c;
    c--;
    vec[c].push_back({s, t});
  }

  for (int i = 0; i < C; i++) {
    sort(vec[i].begin(), vec[i].end());
    for (int j = 1; j < vec[i].size(); j++) {
      if (vec[i][j].first == vec[i][j-1].second) {
        vec[i][j].first++;
      }
    }
    for (int j = 0; j < vec[i].size(); j++) {
      time[vec[i][j].first -1]++;
      time[vec[i][j].second]--;
    }
  }

  int maxv = 0;
  for(int i = 1; i < 100000; i++) {
    time[i] += time[i -1];
    maxv = max(maxv, time[i]);
  }

  cout << maxv << endl;
  return 0;
}

Measured memory_bytes: 1920
import java.util.*;

class Main {
  public static void main(String[] args) {
         Scanner scanner = new Scanner(System.in);
         int X = scanner.nextInt();
         int happiness = 0;
         happiness = (X/500)*1000;
         X = X%500;
         happiness += (X/5)*5;
         System.out.println(happiness);
         scanner.close();
  }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e;
  string s,ss,sss;
  cin>>a>>b;
  cin>>s;
  for(int i=0;i<a;i++)
    if(i==b-1)
      cout<<(char)('a'+s[i]-'A');
    else cout<<s[i];
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
s = input()
oi = "01"*(len(s)//2)
io = "10"*(len(s)//2)
if len(s)%2 == 1:
    oi += "0"
    io += "1"

oans = 0
ians = 0
for i in range(len(s)):
    if s[i] != oi[i]:
        oans += 1
    if s[i] != io[i]:
        ians += 1
print(min(oans, ians))


Measured memory_bytes: 73296
local mfl = math.floor
local n = io.read("*n")
local t = {}
for i = 1, 81 do
  t[i] = 0
end
for i = 1, n do
  local ri = i
  local btm = i % 10
  if btm ~= 0 then
    local top = btm
    if i < 10 then
    end
    while 10 <= i do
      i = mfl(i / 10)
    end
    local top = i
    local idx = (top - 1) * 9 + btm
    t[idx] = t[idx] + 1
  end
end
local ret = 0
for i = 1, 9 do
  local idx = (i - 1) * 9 + i
  -- ret = ret + t[idx] * t[idx]
  for j = 1, 9 do
    local idx1, idx2 = (i - 1) * 9 + j, (j - 1) * 9 + i
    ret = ret + t[idx1] * t[idx2]
  end
end
print(ret)


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

int n;
ll ans[555][555];

deque<int>pri;
bool np[1001000];

ll lcm(ll x,ll y){
    if (!x||!y) return x+y;
    return x/__gcd(x,y)*y;
}

void prepri(int n){
    for (int i=2;i<=n;++i){
        if (np[i]) continue;
        if (i!=2) pri.push_back(i);
        for (int j=i+i;j<=n;j+=i)
            np[j]=1;
    }
}

map<int,ll>ad, su;

int main(){
    prepri(8000);
    cin>>n;
    for (int i=0;i<=n+1;++i)
        for (int j=0;j<=n+1;++j)
            if ((i+j)%2==0){
                if (!ad[i+j]){
                    if ((i+j)/2&1){
                        ad[i+j]=pri.front();
                        pri.pop_front();
                    }else{
                        ad[i+j]=pri.back();
                        pri.pop_back();
                    }
                }
                if (!su[i-j]){
                    if ((i-j)/2&1){
                        su[i-j]=pri.front();
                        pri.pop_front();
                    }else{
                        su[i-j]=pri.back();
                        pri.pop_back();
                    }
                }
                ans[i][j]=ad[i+j]*su[i-j];
            }
    int dx[4]={0,0,1,-1};
    int dy[4]={1,-1,0,0};
    for (int i=1;i<=n;++i)
        for (int j=1;j<=n;++j)
            if ((i+j)%2==1){
                ll l=1;
                for (int d=0;d<4;++d)
                    l=lcm(l,ans[i+dx[d]][j+dy[d]]);
                ans[i][j]=l+1;
            }
    for (int i=1;i<=n;++i){
        for (int j=1;j<=n;++j){
            printf("%lld ",ans[i][j]);
        }
        puts("");
    }
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
#define _GLIBCXX_DEBUG
const int INF=1e15;

signed main(){
    int N,M;
    cin>>N>>M;
    string S;cin>>S;
  	bool ok=true;
  	stack<int> s;
    for(int i=0;i<=N-1;){;
      	ok=false;
       	for(int j=0;j<=M-1;j++){
          if(N-i-(M-j)>=0&&S[N-i-(M-j)]=='0'){
                i+=M-j;
            	s.push(M-j);
            	ok=true;
            	break;
            }
        }
      	if(ok==false){
        	break;
        }
    }
    if(ok){
        while(s.empty()==0){
          cout<<s.top()<<" ";
          s.pop();
        }
    }
    else cout<<-1<<endl;
}


Measured memory_bytes: 1212
#include <stdio.h>

int main(){

  int n,o,m,g,h,gj,j,go,iti;
  while(1){
    scanf("%d",&n);
  if(n==0)break;
  o=1000-n;
  g=o/500;
  h=(o-g*500)/100;
  gj=(o-g*500-h*100)/50;
  j=(o-g*500-h*100-gj*50)/10;
  go=(o-g*500-h*100-gj*50-j*10)/5;
  iti=(o-g*500-h*100-gj*50-j*10-go*5)/1;
  m=g+h+gj+j+go+iti;
  printf("%d\n",m);
    }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (1e9)

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

  if(n == 1){
    cout << "Hello World" << endl;
    return 0;
  }

  int a, b;
  cin >> a >> b;
  cout << a + b << endl;
  return 0;
}

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

ll h;
ll a[3000000];

void max_heapify(ll i){
    ll l = 2*i, r = 2*i + 1, largest;

    if(l <= h && a[l] > a[i]) largest = l;
    else largest = i;
    if(r <= h && a[r] > a[largest]) largest = r;

    if(largest != i){
        swap(a[i], a[largest]);
        max_heapify(largest);
    }

    return;
}

void insert(ll k){
    h++;
    a[h] = k;
    ll i = h;
    while(i > 1 && a[i/2] < a[i]){
        swap(a[i], a[i/2]);
        i /= 2;
    }
    return;
}

void extract(){
    cout << a[1] << endl;
    a[1] = a[h--];
    max_heapify(1);
    return;
}

int main(){
    h = 0;
    memset(a, -1, 3000000*sizeof(ll));

    string com;
    while(com != "end"){
        cin >> com;
        if(com[0] == 'i'){
            ll k; cin >> k;
            insert(k);
        } else if(com == "extract") extract();
    }

    return 0;
}


Measured memory_bytes: 26668
#include <bits/stdc++.h> 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
#define asn ans
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;

int main() {
	int a[5] = {}; int k;
	REP(i, 5) {
		CI a[i];
	}
	CI k;

	REP(i, 4) {
		if (abs(a[0] - a[i + 1]) > k) {
			CO ":(" EN; return 0;
		}
	}

	CO "Yay!" EN;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define clr(x) memset(x, 0, sizeof(x))
#define all(a) a.begin(),a.end()
#define forn(i, a,b) for(int i = int(a); i < int(b); ++i)
#define forn_r(i, b, a) for(int i = int(b); i > int(a); i--)
#define trav(a,x) for (auto& a : x)
#define printArray(array, length) for(int i = 0; i < length; i++) cout<< array[i] << (i == length - 1 ? '\n' : ' '); 
#define print(x) cout << x << '\n'
#define print2(x, y) cout << x << ' ' << y << '\n'
#define debug(x) cout << #x << "=" << x << endl
#define debug2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
template <typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template <typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
 
using namespace std;
typedef long long ll; 
const int INF = 0x3f3f3f3f;
const ll LNF  = 0x3f3f3f3f3f3f;
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline ll  gcd(ll  a, ll  b) { return b ? gcd(b, a % b) : a; }
inline int lcm(int a, int b) { return a * b / gcd(a, b); }
 
bool possi(ll mid, vector<ll> a ,ll k){
	for(auto x:a){
		k-=(x+mid-1)/mid -1;
	}
	return k>=0;
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t =1;
    //cin>>t;
    while(t--){
    	ll n, k; cin>>n>>k;
    	vector<ll> a(n);forn(i,0,n) cin>>a[i];
    	
    	ll mini =1, maxi =1e9+1;
    	ll mid;
    	while(mini!=maxi){
    		mid = (mini+maxi)/2;
    		if(possi(mid,a,k)){
    			maxi=mid;
    		}
    		else{
    			mini=mid+1;
    		}
    		
    	}
    	print(maxi);
       	 
    }
    return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    li n, d;
    cin >> n >> d;
    li wari = 2 * d + 1;
    cout << (n + wari - 1) / wari << endl;



    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main {
	public static void main(String[] args) throws Exception {
		MScanner sc = new MScanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		char[]in=sc.nextLine().toCharArray();
		int i=0;int j=in.length-1;
		int ans=0;
		while(i<in.length/2) {
			if(in[i]!=in[j]) {
				ans++;
			}
			i++;j--;
		}
		pw.println(ans);
		pw.flush();
	}
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;

		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int[] takearr(int n) throws IOException {
			int[] in = new int[n];
			for (int i = 0; i < n; i++)
				in[i] = nextInt();
			return in;
		}

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

		public Integer[] takearrobj(int n) throws IOException {
			Integer[] in = new Integer[n];
			for (int i = 0; i < n; i++)
				in[i] = nextInt();
			return in;
		}

		public Long[] takearrlobj(int n) throws IOException {
			Long[] in = new Long[n];
			for (int i = 0; i < n; i++)
				in[i] = nextLong();
			return in;
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 22740
import java.util.Scanner;
class Main{
	   public static void main(String[] args){
	  Scanner scan =  new Scanner(System.in);
	   int a = scan.nextInt();
	   int b = scan.nextInt();
	  int c = a+b;
	  if(c>=24){
		  c = c-24;
	System.out.println(c);
	   }else {
		   System.out.println(c);
	   }
	  
	   }
	}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main() {
    ll N;
    cin>>N;
    VL B(N-1);
    rep(i,0,N-1)cin>>B[i];
    
    VL A(N,-1);
    A[0]=B[0];
    ll sum=A[0];
    rep(i,1,N-1){
        A[i]=min(B[i],B[i-1]);
        sum+=A[i];
    }
    A[N-1]=B[N-2];
    sum+=A[N-1];
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
       int a,b,d,r;
       double f;
       scanf("%d %d",&a,&b);
       d = a / b;
       r = a % b;
       f = (double)a / b;
       printf("%d %d %.5f\n",d,r,f);
       return 0;
}


Measured memory_bytes: 2040
#include<iostream>
using namespace std;
int main()
{
  int n,i;
  cin >> n;
  for(i=1;i<10;i++)
    if(n%i==0&&n/i<10){
      cout << "Yes" << endl;
      return 0;
    }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
N, T = map(int, input().split())
c = []
t = []
for i in range(N):
    a, b = map(int, input().split())
    c.append(a)
    t.append(b)

ans = 10**9

for i in range(N):
    if t[i] <= T:
        ans = min(ans, c[i])

if ans == 10**9:
    print("TLE")
else:
    print(ans)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
  public static int M;
  public static int N;
    public static void main(String[] args) throws java.io.IOException{
    	
        Scanner scan = new Scanner(System.in);
        while(true){
        double mm = scan.nextInt();
        double dd = scan.nextInt();
        if(mm==0 && dd ==0)break;
        int J=20;
        int K=4;
        if(mm==1 || mm==2){mm+=12;K--;}
        switch ((K+K/4+J/4+5*J+(int)dd+(int)((mm+1)*26/10))%7){
        
        case 1:System.out.println("Sunday");break;
        case 2:System.out.println("Monday");break;
        case 3:System.out.println("Tuesday");break;
        case 4:System.out.println("Wednesday");break;
        case 5:System.out.println("Thursday");break;
        case 6:System.out.println("Friday");break;
        case 0:System.out.println("Saturday");break;
        
        }
        
        }
    }
}

Measured memory_bytes: 12000
#include <iostream>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <stdlib.h>
#include <deque>
using namespace std;
 
int main () {
  string s;
  cin >> s;
  deque <char> ss;
  for (int i = 0; i < (int)s.length();i++){
    ss.push_back(s[i]);
  }
  int q;
  cin >> q;
  int x = 1;
  for (int i = 0; i < q; i++){
    int t;
    cin >> t;
    if (t == 1){
      x = x * (-1);
    } else{
      int f;
      cin >> f;
      char c;
      cin >> c;
      if (x == 1){
        if (f==1){
          ss.push_front(c);
        }else{
          ss.push_back(c);
        }
      }else{
        if (f==1){
          ss.push_back(c);
        }else{
          ss.push_front(c);
        }
      }
    }
  }
  while (!ss.empty()){
    if (x == (-1)){
      cout << ss.back();
      ss.pop_back();
    } else {
      cout << ss.front();
      ss.pop_front();
    }
  }
  return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,x,sum,b[100005];
pair<ll,ll> a[100005];
void out(){
	for(int i=0;i<n;i++)
		sum+=b[i];
	cout << sum;
	exit(0);
}
int main(){
	cin >> n >> m;
	for(int i=0;i<n;i++)
		cin >> b[i];
	sort(b,b+n);
	for(int i=0;i<m;i++)
		cin >> a[i].second >> a[i].first;
	sort(a,a+m,greater<pair<ll,ll> >());
	for(int i=0;i<m;i++){
		for(int j=0;j<a[i].second;j++){
			if(x>=n or b[x]>=a[i].first)out();
			b[x++]=a[i].first;
		}
	}
	out();
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#define MOD 1000000007
#define MAXE9 1000000000

int i, j, k, l;

int main(){
  int ans = 0;
  int N;
  int h[101];
  bool zero;
  
  scanf("%d", &N);
  for(i=0;i<N;i++){
    scanf("%d", &h[i]);
  }
  while(21947234){
    zero = 0;
  for(i=0;i<N;i++){
    if(h[i] > 0){
      h[i]--;
      zero = 1;
    }else if(zero == 1){
      break;
    }
  }
    if(zero == 0){
     break;
    }else{
      ans++;
    }
  }
  printf("%d", ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int a[100],b[100],c[100],d[100];
int A[100];
int ans=0;
int n,m,q;
void dfs(int x,int pre){
	if(x==n+1){
		int sum=0;
		for(int i=1;i<=q;i++){
			if(A[b[i]]-A[a[i]]==c[i]) sum+=d[i];
		}
		ans=max(ans,sum);
		return ;
	}
	for(int i=pre;i<=m;i++){
		A[x]=i;
		dfs(x+1,i);
	}
	return ;
}
int main(){
	
	cin>>n>>m>>q;
	for(int i=1;i<=q;i++) cin>>a[i]>>b[i]>>c[i]>>d[i];
	dfs(1,1);
	cout<<ans<<endl;
	return 0;
}

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

int main(void){
    int h,w,m;
    cin >> h >> w >> m;
    int x[m],y[m];
    
    map<P,int> mp;
    vector<int> a(h+1,0),b(w+1,0);
    for(int i = 0;i < m;i++){
        cin >> x[i] >> y[i];
        a[x[i]-1]++;b[y[i]-1]++;
        mp[P(x[i]-1,y[i]-1)]++;
    }
    
    ll ans = 0,num = 0,num2 = 0;
    int memoh = 0,memow = 0;
    for(int i = 0;i < h;i++){
        if(num < a[i]){
            num = a[i];
            memoh = i;
        }
    }
    
    for(int i = 0;i < w;i++){
        ans = max(ans,num + b[i] - mp[P(memoh,i)]);
    }
    
    for(int i = 0;i < w;i++){
        if(num2 < b[i]){
            num2 = b[i];
            memow = i;
        }
    }
    
    for(int i = 0;i < h;i++){
        ans = max(ans,num2 + a[i] - mp[P(i,memow)]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 64228
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

ll N,M,K,H,W;

long long modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
    // a/b =equiv=  (a%MOD) * modinv(b, MOD) % MOD;
}

int main(){
    ll a, n;
    cin >> n;
    REP(i,n){
        cin >> a;
        if(a %2 == 0){
            if(a %3 == 0 or a %5 == 0){
            }
            else{
                cout << "DENIED";
                return 0;
            }
        }
    }
    cout << "APPROVED";
    return 0;
}

Measured memory_bytes: 256
N = int(input())
a = []
a.append(list(int(i) for i in input().split()))
a.append(list(int(i) for i in input().split()))
sum = list(0 for i in range(N))
for i in range(N):
    j = 0
    while j <= i:
        sum[i] += a[0][j]
        if j != i:
            j += 1
        else:
            break
    while j <= N-1:
        sum[i] += a[1][j]
        j += 1
max_sum = max(sum)
print(max_sum)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>
#include <iomanip>

using namespace std;

const int maxn = 302;

int n;
double f[maxn][maxn][maxn];

double dfs(int i, int j, int k) {
    if (f[i][j][k] > -0.5)
        return f[i][j][k];

    double cur = 1.0, tot = i + j + k;

    if (i > 0)
        cur += dfs(i-1, j, k) * (double)i / n;
    if (j > 0)
        cur += dfs(i+1, j-1, k) * (double)j / n;
    if (k > 0)
        cur += dfs(i, j+1, k-1) * (double)k / n;    

    cur *= (double)n / tot;
    f[i][j][k] = cur;

    return cur;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    cin >> n;
    int a = 0, b = 0, c = 0;

    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if (x == 1)
            ++a;
        else if (x == 2)
            ++b;
        else
            ++c;
    }

    for (int i = 0; i <= n; ++i)
        for (int j = 0; j <= n; ++j)
            for (int k = 0; k <= n; ++k)
                f[i][j][k] = -1.0;

    f[0][0][0] = 0.0;
    cout << setprecision(10) << dfs(a, b, c) << endl;
	return 0;
}

Measured memory_bytes: 215296
#include <stdio.h>
#include <string.h>
int main(void){
    char W[11],T[1001];
    int i,t=0;
    for(i=0,scanf("%s",W);W[i];W[i]=tolower(W[i]),i++);
    for(;scanf("%s",T),strcmp(T,"END_OF_TEXT");){
        for(i=0;T[i];T[i]=tolower(T[i]),i++);
        if(strcmp(W,T)==0)t++;
    }
    printf("%d\n",t);
}

Measured memory_bytes: 1860
#include <iostream>
#include <cmath>
using namespace std;
int main(){
	
	int a,b,x;
	cin>>x>>a>>b;
	if(abs(x-a)>abs(x-b))cout<<"B"<<endl;
	if(abs(x-a)<abs(x-b))cout<<"A"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

template <int n> struct erat{
    bool v[n];
    int p[n];
    constexpr erat():v(),p(){
        for(int i=2;i<n;++i) v[i]=true;
        v[0]=v[1]=false;
        for(int i=2;i*i<n;++i) if(v[i]) for(int j=i*i;j<n;j+=i) v[j]=false;
        int j=0;
        for(int i=2;i<n;++i) if(v[i]) p[j++]=i;
    }
    bool operator[](int i)const{return v[i];}
};
constexpr erat<200000> e;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int x;
    in>>x;
    int j=0;
    while(e.p[j]<x) ++j;
    cout<<e.p[j]<<endl;
}

Measured memory_bytes: 256