akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define SUM(x)              accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

class BJudgeStatusSummary {
public:
  static void solve(istream &cin, ostream &cout) {
    int N;
    cin >> N;
    int ac = 0, wa = 0, tle = 0, re = 0;
    rep(i, N) {
      string temp;
      cin >> temp;
      if (temp == "AC") {
        ac++;
      } else if (temp == "WA") {
        wa++;
      } else if (temp == "TLE") {
        tle++;
      } else if (temp == "RE") {
        re++;
      }
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  BJudgeStatusSummary solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3656
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        ArrayList<Integer> operand=new ArrayList<Integer>();
        String command=scan.nextLine();
        String[] com1=command.split(" ",0);
        int osize, comsize=1;
        
        for(int i=0; command.indexOf(" ",i)!=-1; i=command.indexOf(" ",i)+1){
            comsize++;
        }
        //System.out.println(comsize+":"+Arrays.toString(com1));
        
        for(int i=0; i<comsize; i++){
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        }
        System.out.println(operand.get(0));
    }
}


Measured memory_bytes: 26168
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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 <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    string ans = "";
    rep(i, n) {
        if (s[i] == "AB") {
            if (a == 1 && b == 1 && c == 0 && i + 1 < n) {
                if (s[i + 1] == "AC")
                    a++, b--, ans += 'A';
                else
                    a--, b++, ans += 'B';
            } else if (a < b)
                a++, b--, ans += 'A';
            else
                a--, b++, ans += 'B';
        }
        if (s[i] == "AC") {
            if (a == 1 && b == 0 && c == 1 && i + 1 < n) {
                if (s[i + 1] == "AB")
                    a++, c--, ans += 'A';
                else
                    a--, c++, ans += 'C';
            } else if (a < c)
                a++, c--, ans += 'A';
            else
                a--, c++, ans += 'C';
        }
        if (s[i] == "BC") {
            if (a == 0 && b == 1 && c == 1 && i + 1 < n) {
                if (s[i + 1] == "AB")
                    b++, c--, ans += 'B';
                else
                    b--, c++, ans += 'C';
            } else if (c < b)
                c++, b--, ans += 'C';
            else
                c--, b++, ans += 'B';
        }
        if (min({a, b, c}) < 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    rep(i, n) cout << ans[i] << endl;
}


Measured memory_bytes: 6684
/// D: Grid Components <https://beta.atcoder.jp/contests/arc093/tasks/arc093_b>
/// TLE: 2 sec
/// MLE: 256 MB

fn main() {
    let (a, b) = {
        let t = reads::<usize>();
        (t[0], t[1])
    };

    let mut bd: Vec<Vec<char>> = vec![vec!['.'; 100]; 100];

    for y in 0..bd.len() {
        for x in 0..bd[y].len() {
            bd[y][x] = if y < bd.len() / 2 { '.' } else { '#' };
        }
    }

    for i in 0..a - 1 {
        let x = i % 49;
        let y = i / 49;
        bd[51 + y * 2][1 + x * 2] = '.';
    }

    for i in 0..b - 1 {
        let x = i % 49;
        let y = i / 49;
        bd[1 + y * 2][1 + x * 2] = '#';
    }

    println!("{} {}", bd.len(), bd[0].len());
    for row in bd.iter() {
        for c in row.iter() {
            print!("{}", c);
        }
        println!();
    }
}

//----- Libraries -----

fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_owned()
}

fn reads<T>() -> Vec<T>
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    read_line()
        .split_whitespace()
        .map(|w| w.parse().unwrap())
        .collect()
}

//----- Tests -----

#[cfg(test)]
mod test {
    use std::io::Write;
    use std::process::{Command, Stdio};

    fn do_test(sample_input: &str, sample_output: &str) {
        let mut child = Command::new("cargo")
            .args(&["run", "--bin", "arc093_b", "-q"])
            .stdin(Stdio::piped())
            .stdout(Stdio::piped())
            .spawn()
            .unwrap();

        write!(child.stdin.as_mut().unwrap(), "{}", sample_input.trim()).unwrap();
        let output = child.wait_with_output().unwrap();

        assert_eq!(
            sample_output.trim(),
            String::from_utf8(output.stdout).unwrap().trim()
        );
    }

    #[test]
    fn sample1() {
        let input = r#"
            2 3
        "#;
        let output = r#"
            3 3
##.
..#
#.#
        "#;
        do_test(input, output);
    }
    #[test]
    fn sample2() {
        let input = r#"
            7 8
        "#;
        let output = r#"
            3 5
#.#.#
.#.#.
#.#.#
        "#;
        do_test(input, output);
    }
    #[test]
    fn sample3() {
        let input = r#"
            1 1
        "#;
        let output = r#"
            4 2
..
#.
##
##
        "#;
        do_test(input, output);
    }
    #[test]
    fn sample4() {
        let input = r#"
            3 14
        "#;
        let output = r#"
            8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
#.........#..####.
        "#;
        do_test(input, output);
    }
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  int a[2][n];
  rep(i, 2) rep(j, n) cin >> a[i][j];
  int sum[2][n+1];
  rep(i, 2) {
    sum[i][0] = 0;
    rep(j, n) sum[i][j+1] = sum[i][j]+a[i][j];
  }
  int ans = 0;
  rep(i, n) {
    int tmp = sum[0][i+1]+sum[1][n]-sum[1][i];
    chmax(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

ll N;
map<ll, ll> mpl;
map<ll, ll> mpr;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for (ll i = 0; i < N; i++) {
    ll tmp;
    cin >> tmp;
    mpl[i + tmp]++;
    mpr[i - tmp]++;
  }

  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    ans += (mpl[i] * mpr[i]);
  }

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


Measured memory_bytes: 45964
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


ll a[16][16];

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    int i,j;
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            scanf("%lld", &a[i][j]);
        }
    }

    vector<ll> dp(1<<n);
    int k;
    for(k=0; k<(1<<n); k++) {
        vector<int> z;
        for(i=0; i<n; i++) {
            if(k & (1<<i)) z.push_back(i); 
        }
        int siz=(int)z.size();

        dp[k]=0;
        for(i=0; i<siz; i++) {
            for(j=i+1; j<siz; j++) {
                dp[k] += a[z[i]][z[j]];
            }
        }

        ll max=0;
        for(i=0; i<(1<<siz); i++) {
            int tmp0=0;
            for(j=0; j<siz; j++) {
                if(i & (1<<j)) tmp0 |= (1<<z[j]);
            }
            ll val = dp[tmp0]+dp[k-tmp0];
            max = MAX(max, val);
        }
        dp[k] = max;
    }
    printf("%lld\n", dp[(1<<n)-1]);

    return 0;
}


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

#define fill(a,val) memset(a, (val), sizeof a)
#define pb push_back
#define lli long long int
#define scantype int
#define endl "\n"
#define unique(x) x.erase(unique(x.begin(),x.end()), x.end())
#define sort_f(x)  sort(x.begin(),x.end());
#define sort_r(x)  sort(x.rbegin(),x.rend());

lli MOD  = 1000000007;
lli inf = 1e15;

void scan(scantype &x);
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli string_to_number(string s){lli x=0; stringstream convert(s); convert>>x; return x;}
lli add(lli a,lli b){lli x = (a+b)%MOD; return x; }
lli mul(lli a,lli b){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b){lli x = (a-b+MOD)%MOD; return x; }
lli divi(lli a,lli b){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}

#define N 200003

long  divisors(long x) {
    long limit = x;
    long numberOfDivisors = 0;

    if (x == 1) return 1;

    for (long i = 1; i < limit; ++i) {
        if (x % i == 0) {
            limit = x / i;
            if (limit != i) {
                numberOfDivisors++;
            }
            numberOfDivisors++;
        }
        if(numberOfDivisors>=4)
        {
            break;
        }
    }

    return numberOfDivisors;
}
 bool isPrime(long n)
{
   
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (long i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
 
    return true;
}
#define max_a 100001
bool visit[max_a]={false};
vector<long> a[max_a];
long sum=0;
long cost[max_a];
void dfs(long node)
{
    visit[node]=true;
    
    for(int i=0;i<(int)a[node].size();i++)
    {
        if(visit[a[node][i]]==false)
        {
            sum+=cost[a[node][i]];
            dfs(a[node][i]);
            
        }
    }
    
}
void SieveOfEratosthenes(int n)
{
   
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
 
    for (int p=2; p*p<=n; p++)
    {
        
        if (prime[p] == true)
        {
           
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }
 
   
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    lli n;
    cin>>n;
    lli arr[n];
    lli countm=1;
    for(int i=0;i<n;i++)
    {
      cin>>arr[i];
      if(arr[i]%2==0)
      {
        countm*=2L;
      }
    }
    lli ans=pow(3,n);
    ans-=countm;
    cout<<ans;
    
    return 0;
}



Measured memory_bytes: 2560
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const R = Number(input[0][0]);

  return R < 1200 ? "ABC" : R < 2800 ? "ARC" : "AGC";
};

console.log(main(read()));


Measured memory_bytes: 29652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 100005;
const ll INF = 0x3f3f3f3f3f3f3f3f;
typedef pair<int, int> pii;

int n, t;
/*********************GoodLuck***********************/
int main () {
    IOS();

    cin >> n >> t;
    int sum = 0;
    int mx = 0;
    REP (i, n) {
        int d;
        cin >> d;
        mx = max(mx, d);

        if (t < sum) {
            cout << 1 << endl;
        } else {
            int rem = (t - sum) % mx;
            if (rem >= d) {
                cout << (t - sum) / mx + 2 << endl;
            } else {
                cout << (t - sum) / mx + 1 << endl;
            }
        }

        if (sum < t) {
            sum += d;
        }
    }

    return 0;
}



Measured memory_bytes: 3232
#include <stdio.h>

void printOneLine(int A[], int N)
{
	int i;
	
	for(i = 0; i < N; i++){
		if(i != 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N)
{
	int i, j, v;
	
	printOneLine(A, N);
	for(i = 1; i <= N-1; i++){
		v = A[i];
		j = i - 1;
		while(j >= 0 && A[j] > v){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		printOneLine(A, N);
	}
}

int main(void)
{
	int N, A[100];
	int i, v;
	
	scanf("%d", &N);
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	
	insertionSort(A, N);
	
	return(0);
}



Measured memory_bytes: 2020
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,m,d = list(map(int, input().split()))
ans = 0
if d==0:
    v = n
else:
    v = 2*(n-d)
ans = (m-1)*v/pow(n,2)
print(ans)

Measured memory_bytes: 61648
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
inf = 10 ** 9

def dfs(cur, a, b, c):
  if cur == N:
    if min(a, b, c) > 0:
      return abs(a - A) + abs(b - B) + abs(c - C) - 30 
    else:
      return inf
  else:  
    ret0 = dfs(cur + 1, a, b, c) 
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#include<stack>
#include<climits>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<(n);i++)
#define end(ans) cout<<(ans)<<endl
#define INF INT_MAX;
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 LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){
    
    int H,W,h,w;
    cin>>H>>W>>h>>w;
    
    cout<<(H-h)*(W-w)<<endl;
    
    
    
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()

int main(){
  ll N;
  cin >> N;
  cout << (N*(N-1))/2 << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin>>N>>K;
    vector<ll> a(N),sum(N+1),p_sum(N+1);

    REP(i,N){
        cin>>a[i];
        sum[i+1] += a[i] + sum[i];
        p_sum[i+1] += p_sum[i] + (a[i]>=0 ? a[i] : 0);
    }
    ll ans = -1e18;
    for(int i=0;i+K<=N;i++){
        int left = i, right = i+K;
        ll tmp = (p_sum[left] - p_sum[0]) + max(0LL, sum[right] - sum[left]) + p_sum[N] - p_sum[right];
        chmax(ans,tmp);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2560
import java.util.Scanner;

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

        long[] array = new long[x];
        long sum = 0;
        for(int i = 0; i < x; i++){
            array[i] = scan.nextInt();
            sum = sum + array[i];
        }




        for(int a = x; a > 0; a--){
            for(int i = 0; i < (a-1); i++){
                if(array[i] > array[i+1]){
                    long t;
                    t = array[i];
                    array[i] = array[i+1];
                    array[i+1] = t;
                }
            }
        }

        System.out.println(array[0] + " " + array[x-1] + " " + sum);


    }
}




Measured memory_bytes: 42820
#include <iostream>
#include <string>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;

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

  if (a < b && b < c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3100
// Modulo Summation

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

int n;

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

    int res = 0;

    for (int i = 0; i < n; i++) {
        res += a[i] - 1;
    }

    cout << res << endl;


    return 0;
}


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

int main(){
    string s ;
    getline(cin,s) ;
    for(int i=0;i<s.size();i++){
        if('a'<=s.at(i)&&s.at(i)<='z') s.at(i) += 'A'-'a' ;
        else if('A'<=s.at(i)&&s.at(i)<='Z') s.at(i) += 'a'-'A' ;
    }
    cout << s << endl ;
}


Measured memory_bytes: 3216
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; ++i) cin >> p.at(i);
    int mn = 1010101, ans = 0;
    for(int i = 0; i < n; ++i){
        mn = min(mn, p.at(i));
        if(mn == p.at(i)) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4048
#include<stdio.h>

void di2bi(unsigned long x, int* b){
	int i;
	
	for(i=32-1; i>=0; i--){
		b[i] = (x>>i)&1;
	}
}



int main(){
	int i;
	unsigned long x;
	int b[32]={0};
	int calc_b[32] = {0};
	
	scanf("%ld", &x);
	
	di2bi(x, b);
	
	for(i=32-1; i>=0; i--)	printf("%d", b[i]);
	printf("\n");
	
	for(i=32-1; i>=0; i--){
		calc_b[i] = b[i]^1;
		printf("%d", calc_b[i]);
	}
	printf("\n");
	/*左シフト*/
	for(i=32-1; i>0; i--){
		calc_b[i] = b[i-1];
	}
	calc_b[i] = 0;
	for(i=32-1; i>=0; i--)	printf("%d", calc_b[i]);
	printf("\n");
	/*右シフト*/
	calc_b[31] = 0;
	for(i=32-1; i>0; i--){
		calc_b[i-1] = b[i];
	}
	for(i=32-1; i>=0; i--)	printf("%d", calc_b[i]);
	printf("\n");
	
	
	return 0;
}


Measured memory_bytes: 2128
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int mod = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
struct edge { int to, cost; };

signed main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << max((ll)0, b - (n - a)) << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 5e3 + 5, M = 3e5 + 5;


ull base = 29;
inline void pushBack(ull& h, ull base, char c){
	h = ((h*base) + c);
}

int n;
string s;

ull mp[N][N];

bool valid(int len){
    for(int i = 0 ; i < n ; ++i)
        for(int j = i + len ; j < n ; ++j)
            if(mp[i][len] == mp[j][len])
                return true;
    return false;
}

int bs(){
    int l = 0, r = n - 1, mid, ans = 0;
    while(l <= r){
        mid = (l + r) / 2;
        if(valid(mid)){
            ans = mid;
            l = mid + 1;
        }
        else r = mid - 1;
    }
    return ans;
}

int main(){
    IO;
    cin >> n;
    cin >> s;
    for(int i = 0 ; i < n ; ++i){
        ull h = 0;
        for(int j = i ; j < n ; ++j){
            pushBack(h, base, s[j]);
            mp[i][j - i + 1] = h;
        }
    }
    printf("%d\n", bs());
}

Measured memory_bytes: 195072
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val r = readInt()  

    val a = 3 * r * r
    println(a)
    pw.flush()
}

/****** Decrared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    val rtn = v.map { it.toList() }.toList()
    return rtn 
}

fun gcd(a: Long, b: Long): Long = 
if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
if(b==0L) a else gcd(b, a % b)

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 31740
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i=(int)s;i<(int)n;i++)
int main() {
  int n; cin>>n;
  vector<int> p(n,0);
  rep(i,0,n) cin>>p[i];
  int leftMin=p[0],cnt=1;
  rep(i,1,n){
    if(leftMin>=p[i]) cnt++;
    leftMin=min(leftMin,p[i]);
  }
  cout<<cnt;
}

Measured memory_bytes: 3980
N=int(input())
A=sorted(list(map(int,input().split())),reverse=True)
def sameA(List):
  for i in range(len(List)):
    try:
      if List[i]==List[i+1]:
        ans=List[i]
        anslist=A[i+2:]
        return ans,anslist
    except IndexError:
      return False,False
a1,list1=sameA(A)
if not a1==False:
  a2,list2=sameA(list1)
  if not a2==False:
    print(a1*a2)
  else:
    print(0)
else:
  print(0)

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

using namespace std;

const int MAXN = 1E5;
const int MOD = 1E9 + 7;
int fac[MAXN + 2];
int facInv[MAXN + 2];
int pos[MAXN + 2];

int modInv(int x)
{
    int k = MOD - 2;
    int ans = 1;
    while (k > 0)
    {
        if (k & 1)
        {
            ans = (int) (((long long) ans * x) % MOD);
        }
        x = (int) (((long long) x * x) % MOD);
        k >>= 1;
    }
    return ans;
}

int choose(int a, int b)
{
    if (b > a)
        return 0;
    int ans = (int) (((long long) fac[a] * facInv[b]) % MOD);
    ans = (int) (((long long) ans * facInv[a - b]) % MOD);
    return ans;
}

int main()
{
    fac[0] = 1;
    facInv[0] = 1;
    for (int i = 1; i <= MAXN + 1; i++)
    {
        fac[i] = (int) (((long long) i * fac[i - 1]) % MOD);
        facInv[i] = modInv(fac[i]);
    }
    int n;
    cin >> n;
    int out = 0;
    fill(pos + 1, pos + n + 1, -1);
    for (int i = 0; i < n + 1; i++)
    {
        int x;
        cin >> x;
        if (pos[x] == -1)
            pos[x] = i;
        else
            out = pos[x] + (n - i);
    }
    for (int i = 1; i <= n + 1; i++)
    {
        int ans = (choose(n + 1, i) - choose(out, i - 1) + MOD) % MOD;
        cout << ans << endl;
    }
    return 0;
}


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

int A(int x) 
{ 

    while (x > 0) 
    { 
        if (x % 10 == 7) return 1;
            
  
        x = x / 10; 
    } 
  
 
    return 0;
} 

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

	
	int x = A(n);
	if(x == 1) cout<< "Yes";
	else cout<<"No";

}

Measured memory_bytes: 3596
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	int x, b, p;
	int max=0;

	cin >> x;

	for(b=1; b <= sqrt(x); b++)
	{
		for(p=2; pow(b,p) <= x; p++)
		{
			if(max < pow(b,p)) max = pow(b, p);
			if(b == 1) break;
		}

	}
	cout << max << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
strr = input()
arr = list(map(int, strr.split()))

count = 0
for i in range(1, n-1):
	if min(arr[i-1], arr[i+1]) < arr[i] < max(arr[i-1], arr[i+1]):
		count += 1
print(count) 

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

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

void solve() {
    int N;
    cin >> N;
    // 空席を挟む場合
    //  r-lが偶数なら r,lは異性になる
    // r-l が奇数なら、r,lは同棲になる。
    int left = 0;
    string ls;

    int right = N-1;
    string rs;

    string v = "Vacant";
    string m = "Male";
    string f = "Female";

    cout << left << endl;
    cin >> ls;

    if(ls == v) {
        return;
    }

    cout << right << endl;
    cin >> rs;

    if(rs == v) {
        return;
    }

    while(true) {
        int mid = (left+right)/2;
        cout << mid << endl;
        string ms;
        cin >> ms;
        if(ms == v) {
            return;
        }
        // left and mid check
        bool lm = ls == ms;
        int oe = ((mid-left)%2);
        if((oe == 0 && !lm) || (oe  == 1 && lm)) {
            right = mid;
            rs = ms;
            continue;
        }

        // right and mid check
        bool rm = rs == ms;
        oe = ((right-mid)%2);
        if((oe == 0 && !rm) || (oe  == 1 && rm)) {
            left = mid;
            ls = ms;
            continue;
        }
    }
}

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

Measured memory_bytes: 3856
#include<bits/stdc++.h>
using namespace std;
string st,st1,ans,sum;
int main()
{
	cin>>st;
	st1=st;
	reverse(st.begin(),st.end());
	
	for (int i=0;i<st.size();i++) {
		if(st[i]=='b') {
			st[i]='d'; continue;
		}
		if(st[i]=='d') {
			st[i]='b'; continue;
		}
		if(st[i]=='p') {
			st[i]='q'; continue;
		}
		if(st[i]=='q') {
			st[i]='p'; continue;
		}
    }
	if(st1==st) cout<<"Yes";
	else cout<<"No";
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int a[3],t,N;
int main(void){
    for(N=10;scanf("%d",&t),N--;){
        if(a[0]<t){
            a[2]=a[1];
            a[1]=a[0];
            a[0]=t;
        }else if(a[1]<t){
            a[2]=a[1];
            a[1]=t;
        }else if(a[2]<t){
            a[2]=t;
        }
    }
    printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
}

Measured memory_bytes: 1800
h,w = map(int,input().split())
a = [input() for _ in range(h)]
for i in range(h-1,-1,-1):
    if set(a[i])=={'.'}: a.remove(a[i])
for i in range(w-1,-1,-1):
    ok = True
    for j in range(len(a)):
        if a[j][i]=='#': ok=False
    if ok:
        for j in range(len(a)):
            a[j] = a[j][:i]+a[j][i+1:]
[print(i) for i in a]

Measured memory_bytes: 38768
import java.util.*;

class Main{
	public static void main(String args[]){
      Scanner scan = new Scanner(System.in);
      int N = scan.nextInt();
      
      String previous = scan.next();
      String next;
      Set<String> used_words = new HashSet<String>();
      used_words.add(previous);
      
      while(N>1){
        next = scan.next();
        if(!((previous.charAt(previous.length()-1)==next.charAt(0))&&used_words.add(next))){
          System.out.println("No");
          scan.close();
          return;
        }
        previous = next;
        N--;
      }//while
      scan.close();
      System.out.println("Yes");
      
    }
}

Measured memory_bytes: 21844
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;
ll const MAX_N = 510000;
ll const MOD = 1000000007;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);

    rep(i, N) cin >> A[i];

    ll ans = pow(3, N);
    ll res = 1;
    rep(i, N) {
        if (A[i] % 2 == 0) {
            res *= 2;
        } else {
            res *= 1;
        }
    }

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



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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int m = ri();
	int a[n];
	for (int i = 0; i < n; i++) a[i] = ri();
	std::priority_queue<int> que;
	for (int i = 0; i < n; i++) que.push(a[i]);
	for (int i = 0; i < m; i++) {
		int top = que.top();
		que.pop();
		que.push(top / 2);
	}
	int64_t res = 0;
	while (que.size()) res += que.top(), que.pop();
	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 1276
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
  long N = sc.nextLong();
  Set<Long> s = new HashSet<Long>();
  for(long i = 0;i < N;i++){
    long temp = sc.nextLong();
    if(s.contains(temp))s.remove(temp);
    else s.add(temp);
  }
  System.out.println(s.size());
}}

Measured memory_bytes: 63272
import java.io.PrintWriter
import java.util.*

fun main(args: Array<String>) = IO().exec {
    val n = long()
    var cnt = 0
    for (i in 1..n) {
        if (i.toString().length % 2 == 1) cnt++
    }
    println(cnt)
}

class IO {
    val printable = 33..126
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    val out = PrintWriter(System.out)
    fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = System.`in`.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }
    fun readByte(): Byte {
        return if (hasNextByte()) buffer[ptr++] else return -1
    }
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }
    fun string(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }
    fun long(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }
    fun int(): Int {
        val nl = long()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }
    fun double(): Double {
        return string().toDouble()
    }
    fun print(obj: Any) = out.print(obj)
    fun print(i: Int) = out.print(i)
    fun print(l: Long) = out.print(l)
    fun println(obj: Any) = out.println(obj)
    fun println(i: Int) = out.println(i)
    fun println(l: Long) = out.println(l)
    inline fun exec(block: IO.() -> Unit) {
        block()
        out.flush()
    }
}

Measured memory_bytes: 36000
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}

int a[55],b[55],tmp[55][55],g[55][55],ses=0;

 main()

{
    fast
    int n;
    cin>>n;
    f(i,1,n)
    {
        cin>>a[i];
        g[i][a[i]]=1;
    }
    f(i,1,n)cin>>b[i];
    rf(i,50,1)
    {
        memcpy(tmp,g,sizeof tmp);
        int flag=1;
        f(j,1,n)
        {
            rf(k,i-1,1)
            {
                f(val,0,50)
                {
                    tmp[j][val%k]|=tmp[j][val];
                }
            }
            flag=flag&tmp[j][b[j]];
        }
        if(!flag)
        {
            ses+=(1LL<<i);
            f(j,1,n)
            {
                f(k,0,50)
                {
                    g[j][k%i]|=g[j][k];
                }
            }
        }
    }
    f(i,1,n)
    {
        if(!g[i][b[i]])
        {
            cout<<"-1"<<endl;
            return 0;
        }
    }
    cout<<ses<<endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

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

		int a[] = new int [N];
		int b[] = new int [N];
		int h[] = new int [N];

		for(int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			h[i] = sc.nextInt();
		}

		int H = 0;
		int Cx = 0;
		int Cy = 0;

		boolean flag = false;

		for(int cx = 0; cx <= 100; cx++) {
			for(int cy = 0; cy <= 100; cy++) {
				flag = false;
				int index = 0;
				for(int i = 0; i < N; i++){
					if(h[i] != 0){
						index = i;
					}
				}
				H = h[index] + Math.abs(a[index]-cx) + Math.abs(b[index]-cy);
				for(int i = 0; i < N; i++) {
					if(h[i] != Math.max(H - Math.abs(a[i]-cx) - Math.abs(b[i]-cy), 0)) {
						flag = true;
						break;
					}
				}
				if(flag == false) {
					Cy = cy;
					break;
				}
			}
			if(flag == false) {
				Cx = cx;
				break;
			}
		}
		System.out.println(Cx +" "+ Cy +" "+ H);
		sc.close();
	}

}

Measured memory_bytes: 22356
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctype.h>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    toupper(s1[0]);
    toupper(s2[0]);
    toupper(s3[0]);
    string ans = "";
    putchar(toupper(s1[0]));
    putchar(toupper(s2[0]));
    putchar(toupper(s3[0]));
    cout << endl;
    return 0;
}

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

vector<vector<int>> edges;

int dfs(int ver, vector<int> & cur, vector<int> &v) {
	v[ver] = cur.size();
	cur.push_back(ver);
	if (v[edges[ver][0]] != -1) return v[edges[ver][0]];
	else return dfs(edges[ver][0], cur, v);
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int n, k;
	cin >> n >> k;
	edges.resize(n + 1);
	for (int i = 0, x; i < n; i++) {
		cin >> x;
		edges[i + 1].push_back(x);
	}
	vector<int> foo(n);
	for (int i = 0; i < n; i++) cin >> foo[i];
	for (int i = 1; i <= n; i++) edges[i].push_back(foo[edges[i][0] - 1]);
	
	vector<int> cur, v(n + 1);
	long long ans = -1e18;
	for (int i = 1; i <= n; i++) {
		fill(v.begin(), v.end(), -1);
		int a = k;
		int z = dfs(i, cur, v);
		long long y{};
		if (a <= cur.size()) {
			for (int i = 0; i < a; i++) y += edges[cur[i]][1], ans = max(ans, y);
		} else {
			for (int i = 0; i < z; i++) y += edges[cur[i]][1], ans = max(ans, y);
			a -= z;
			long long w{};
			for (int i = z; i < cur.size(); i++) w += edges[cur[i]][1], ans = max(ans, y + w);
			y += w*(a/(cur.size() - z));
			ans = max(ans, y);
			a %= (cur.size() - z);
			if (a) for (int i = z; i < z + a; i++) y += edges[cur[i]][1], ans = max(ans, y);
			else {
				y -= w;
				for (int i = z; i < cur.size(); i++) y += edges[cur[i]][1], ans = max(ans, y);
			}
		}
		cur.clear();
	}
	cout << ans;
}

Measured memory_bytes: 4232
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <utility>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K; cin >> N >> K;
  multiset<int> A;
  for (int i = 0; i < N; i++) {
    int t; cin >> t;
    A.insert(t);
  }
  set<pair<int,int>> C;
  while (A.size() > 0) {
    C.insert(make_pair(A.count(*A.begin()), *A.begin()));
    A.erase(*A.begin());
  }
  int c = 0;
  while (C.size() > K) {
    c += (*C.begin()).first;
    C.erase(*C.begin());
  }
  cout << c << endl;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        string s;
        cin >> s;
        vll dp(len(s)+1);
        ll gcnt = 0;
        ll pcnt = 0;
        rep(i, 1, len(s)+1) {
                if (s[i-1] == 'g') {
                        if (pcnt+1 <= gcnt) {
                                dp[i] = dp[i-1] + 1;
                                ++pcnt;
                        } else {
                                dp[i] = dp[i-1];
                                ++gcnt;
                        }
                } else {
                        if (pcnt+1 <= gcnt) {
                                dp[i] = dp[i-1];
                                ++pcnt;
                        } else {
                                dp[i] = dp[i-1] - 1;
                                ++gcnt;
                        }
                }
        } 
        cout << dp.back() << endl;
}

Measured memory_bytes: 1280