akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize "Ofast,omit-frame-pointer,inline"
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
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 int  INF = (1 << 30) - 1;
const ll INFL = 1LL << 60;
const ll mod = 998244353;



int main() {

	ll n;
	cin >> n;
	n--;
	string s = "";

	while (n >= 0) {
		s += ('a' + (n % 26));
		n /= 26;
		n--;
	}
	reverse(ALL(s));
	cout << s << endl;

}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define maxn 1000010
#define ull unsigned long long
#define  ll long long
#define db double

int main() {
   int n,m;
cin>>n>>m;
if(n==m)cout<<"Yes"<<endl;
else  cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
ll n, m, l;
const int N = 305;
vector<vector<pair<int, ll>>> vec(N);
ll ans[N][N], fuel[N][N];
ll cost[N];
void solve() {
    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                fuel[i][j] = min(fuel[i][j], fuel[i][k] + fuel[k][j]);
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (i == j || fuel[i][j] > l) continue;
            ans[i][j] = min(ans[i][j], 1LL);
        }
    }
    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                ans[i][j] = min(ans[i][j], ans[i][k] + ans[k][j]);
            }
        }
    }
}
int main() {
    /*ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);*/
    cin >> n >> m >> l;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            fuel[i][j] = ans[i][j] = 1e16;
    for (int i = 0; i < m; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        if (w > l) continue;
        fuel[u][v] = w;
        fuel[v][u] = w;
    }
    solve();
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            if (ans[i][j] == 1e16)
                ans[i][j] = -1;
            else
                ans[i][j]--;
    int q;
    cin >> q;
    while (q--) {
        int u, v;
        cin >> u >> v;
        cout << ans[u][v] << '\n';
    }
    return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> drink(n);
    for (int i = 0; i < n; i++)
        cin >> drink[i].first >> drink[i].second;
    sort(drink.begin(), drink.end());
    int num = m;
    long long ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (num > drink[i].second)
        {
            num -= drink[i].second;
            ans += (long long)drink[i].first * drink[i].second;
        }
        else
        {
            ans += (long long)drink[i].first * num;
            break;
        }
        
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int[][] F = new int[N][10];
    int[][] P = new int[N][11];

    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 10; j++) {
        F[i][j] = sc.nextInt();
      }
    }

    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 11; j++) {
        P[i][j] = sc.nextInt();
      }
    }

    sc.close();
    
    int max = Integer.MIN_VALUE;

    // 0000000000 ~ 1111111111パターン生成
    for(int mask = 1 ; mask < (1 << 10) ; mask++) {

			int score = 0;
      
      for(int i = 0 ; i < N ; i++) {
      
        int cnt = 0;
      
        for(int j = 0 ; j < 10 ; j++) {
      
          if(((mask >> j)&1) == 1 && F[i][j] == 1) {
            cnt++;
          }
      
        }
      
        score += P[i][cnt];
      
      }
      
      max = Math.max(max, score);
    
    }
    
    System.out.println(max);

  }

}

Measured memory_bytes: 26264
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  string s;
  cin >> s;
  cout << s.substr(0, 3) << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    long long D,N;
    cin >> D >> N;

    long long a = 1;

    for ( int i = 0; i < D; i++ ) {
        a *= 100;
    }

    if ( N == 100 ) {
        cout << a * 101 << endl;
    }
    else {
        cout << a * N << endl;
    }
    


    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int n,i,j,max[200001],a[200001],m;
int main(void)
{
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	for(i=n-1;i>0;i--) max[i]=0;
	for(i=n-1;i>0;i--){
		if(max[i]<a[i]) max[i]=a[i];
		max[i-1]=max[i];
	}
	m=-1000000000;
	for(i=0;i<n-1;i++){
		if(m<max[i+1]-a[i]) m=max[i+1]-a[i];
	}
	//for(i=0;i<n;i++) printf("AA%d\n",max[i]);
	printf("%d\n",m);
	return 0;
}


Measured memory_bytes: 4236
#[derive(Clone, Debug)]
struct Point {
    x: i32,
    y: i32,
    t: String
}

fn main() {
    let n = read();
    let mut vec = Vec::new();

    for _ in 0..n {
        let v = read_line();
        vec.push( Point{x: v[0], y: v[1], t: "red".to_string()} )
    }
    for _ in 0..n {
        let v = read_line();
        vec.push( Point{x: v[0], y: v[1], t: "blue".to_string()} )
    }

    // Rule
    // red.x < blue.x
    // and
    // red.y < blue.y
    vec.sort_by(|a, b| a.x.cmp(&b.x));

    let mut cnt = 0;
    loop {
        for i in 0..vec.len() as usize {
            // let mut red;
            if vec[i].t == "blue" {
                let mut max_red_y = -1;
                let mut max_red_idx : usize = std::usize::MAX;
                for j in 0..i {
                    if vec[j].t == "red" {
                        if vec[i].x > vec[j].x && vec[i].y > vec[j].y {
                            if max_red_y < vec[j].y {
                                max_red_y = vec[j].y;
                                max_red_idx = j;
                            }
                        }
                    }
                }
                if max_red_idx == std::usize::MAX {
                    // 条件を満たす赤点はなかった。青だけ消す
                    vec.remove(i);
                    break;
                } else {
                    vec.remove(max_red_idx);
                    vec.remove(i - 1);
                    cnt += 1;
                    break;
                }
            }
        }
        let mut exist_blue = false;
        for i in 0..vec.len() {
            if vec[i].t == "blue" {
                exist_blue = true;
                break;
            }
        }
        if !exist_blue {
            break;
        }
    }

    println!("{}", cnt);
}

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

fn read_line() -> Vec<i32> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let v = s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();
    return v
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    int n;cin >> n;
    if(n%10==3)cout << "bon" <<endl;
    else if(n%10==0 or n%10==1 or n%10==6 or n%10==8) cout << "pon" <<endl;
    else cout << "hon" <<endl;
    return 0;
}

Measured memory_bytes: 3564
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

int dp[100010][2];
string L;
int calc(int x, int smaller) {
    if (x == L.length()) return dp[x][smaller] = 1;
    else if (dp[x][smaller] > 0) return dp[x][smaller];
    if(!smaller) {
        if (L[x] == '0')
            return dp[x][smaller] = (calc(x + 1, 0)) % mod;
        else
            return dp[x][smaller] = (calc(x + 1, 0) * 2 + calc(x + 1, 1)) % mod;
    } else {
        return dp[x][smaller] = (calc(x + 1, 1) * 3) % mod;
    }  
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> L;
    cout << (calc(0, 0)) % mod << endl;

    return 0;
}


Measured memory_bytes: 5200
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(" ").map(String::toInt)
    val s = readLine()!!
    var count = 0
    for (i in 0 until n) {
        when (s[i]) {
            'L' -> {
                if (i != 0 && s[i-1] == 'L') count += 1
            }
            'R' -> {
                if (i != n-1 && s[i+1] == 'R') count += 1
            }
        }
    }
    for (i in 1..k) {
        count += 2
        if (count >= n - 1) {
            println(n -1)
            return
        }
    }
    println(count)
}

Measured memory_bytes: 38492
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;int a=0,b=0;
	cin>>s;
	for(int i=0;i<=s.size()-1;i++)
	{
		if(s[i]=='C') a++;
		if(s[i]=='F'&&a) b++;
	}
	if(a&&b)
	{
		cout<<"Yes";return 0;
	}
	cout<<"No";
}

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

#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back

const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll GetDigit(ll num) {return log10(num)+1;}

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

    if(sum % 10 != 0){
        cout << sum << endl;
    }else{
        for(int i = 0; i < n; i++){
            if(a[i] % 10 != 0){
                cout << sum - a[i] << endl;
                return 0;
            }
        }
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math
import sys
import os
from operator import mul
import numpy as np

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")


N = I()
S = list(_S())
ans = N

Sn = np.array(S)
S_cum = np.zeros(N+1,dtype='int')
S_cum[1:] = np.cumsum(Sn=='W')

Snr=np.flip(Sn, 0)
S_cumr = np.zeros(N+1,dtype='int')
S_cumr[1:] = np.cumsum(Snr=='E')

# print(S_cum)
# print(S_cumr)

for i in range(N):
    attention = S_cum[i] + S_cumr[N-(i+1)]
    # print(attention)
    ans = min(ans, attention)

print(ans)

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

long long modpow(long long a, long long n, long long mod) {
    if (n == 0) return 1;
    if (n == 1) return a % mod;
    
    if (n % 2 == 0) {
        long long half = modpow(a, n / 2, mod) % mod;
        return (half % mod) * (half % mod) % mod;
    }
    else return (modpow(a, 1, mod) % mod * modpow(a, n - 1, mod) % mod) % mod;
}

int main() {
    long long MOD = 998244353;
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++) {
        cin >> d.at(i);
    }
    if (d.at(0) != 0) {
        cout << 0 << endl;
        return 0;
    }

    sort(d.begin(), d.end());

    vector<pair<int, int>> v;
    int cnt = 1;
    for (int i = 1; i < n; i++) {
        if (d.at(i - 1) == d.at(i)) cnt++;
        else {
            v.push_back(make_pair(d.at(i - 1), cnt));
            cnt = 1;
        }
    }
    v.push_back(make_pair(d.at(n - 1), cnt));

    long long ans = 1;
    if (v.at(0).second != 1) {
        cout << 0 << endl;
        return 0;
    }
    for (int i = 1; i < (int)v.size(); i++) {
        if (v.at(i - 1).first + 1 < v.at(i).first) {
            cout << 0 << endl;
            return 0;
        }

        ans *= modpow(v.at(i - 1).second, v.at(i).second, MOD);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1784
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

Q = int(input())
QUERY = [list(map(int, input().split())) for _ in range(Q)]

CNT = defaultdict(int)

for a in A:
    CNT[a] += 1

TOTAL = sum(A)

ANS = []
for b, c in QUERY:
    TOTAL += (c - b) * CNT[b]
    CNT[c] += CNT[b]
    CNT[b] = 0
    ANS.append(TOTAL)

print("\n".join(map(str, ANS)))



Measured memory_bytes: 50448
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let x = scan!(i64);

    let mut n = ((x + 10) / 11) * 2;
    if (n / 2) * 11 - x >= 5 {
        n -= 1
    }
    println!("{}", n)
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <numeric>
#include <cmath>
#include <algorithm>
#include <string>
#define myfor(i,N) for(i=0;i<N;i++)
#define myforFL(i,f,l) for(i=f;i<l;i++)
using namespace std;
long solver1(int N, string S){
	long ans=0;
	string first,second,third;
	for (int i=0;i<N;i++){
		first = S[i];
		for(int j=i+1;j<N;j++){
			second = S[j];
			for(int k= j+1; k<N;k++){
				third = S[k];
				if(first != second && second != third && first != third && j-i != k-j){
					ans += 1;
				}
			}
		}
	}
	return ans;
}

long solver2(int N, string S){
	int R[4000],G[4000],B[4000],RNUM=0,GNUM=0,BNUM=0;
	long ans=0;
	for(int i=0;i<N;i++){
		if(S[i] == 'R'){
			R[RNUM] = i;
			RNUM++;
		}else if(S[i] == 'G'){
			G[GNUM] = i;
			GNUM++;
		}else{
			B[BNUM] = i;
			BNUM++;
		}
	}

	ans = RNUM*GNUM*BNUM;
	int a,b,c;
	long sub=0;
	for (int i=0;i<RNUM;i++){
		for(int j=0;j<GNUM;j++){
			for(int k=0; k<BNUM;k++){
				a = abs(R[i] - G[j]);
				b = abs(G[j] - B[k]);
				c = abs(R[i] - B[k]);
				if(a == b || b == c || c == a)sub++;
			}
		}
	}
	ans -= sub;
	return ans;
}

int main(void){
	long N,RNUM=0,GNUM=0,BNUM=0;
	string S;

	cin >> N;
	cin >> S;

	long ans=0;
	for(int i=0;i<N;i++){
		if(S[i] == 'R'){
			RNUM++;
		}else if(S[i] == 'G'){
			GNUM++;
		}else if(S[i] == 'B'){
			BNUM++;
		}
	}

	ans = RNUM*GNUM*BNUM;
	int i,j,k;
	myfor(i,N-2){
		myforFL(k,i+2,N){
			if((i+k)%2==0){
				j = (i+k)/2;
				if(S[i] != S[j] && S[j] != S[k] && S[k] != S[i])ans--;
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3568
#include <stdio.h>

int main(void)
{
	int proper=700;
	char top[100];
	int i=0;
	scanf("%s", top);
	
	
	
	while(i<3){
		
		if(top[i]=='o'){
			proper=proper+100;
		}
		
		i++;
	}
	
	printf("%d\n",proper);
	
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main (String args[]) {
		Scanner scan = new Scanner(System.in);
		int H = Integer.parseInt(scan.next());
		int N = Integer.parseInt(scan.next());
		int num = 0;
		for(int i = 0; i < N;i++) {
			num = num + Integer.parseInt(scan.next());
		}
		if(num < H) {
			System.out.println("No");
		} else { 
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 46024
//O7Oo7oO7O

#include <bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

using ll = long long int;

int main()
{
	IOS
	
    int k;
    cin>>k;
    int sum=0;
    for(int i=1;i<=k;i++)
    {
    	for(int j=1;j<=k;j++)
    	{
    		for(int m=1;m<=k;m++)
    		{
    			sum+=__gcd(i,__gcd(j,m));
    		}
    	}
    }
    cout<<sum<<"\n";
    
    


    return 0;
}



Measured memory_bytes: 3648
sx,sy,tx,ty=map(int,input().split())
ans=[[] for _ in range(4)]

x=sx
y=sy

while y!=ty or x!=tx:
    if y<ty:
        y+=1
        ans[0].append("U")
        ans[1].append("D")
    elif x<tx:
        x+=1
        ans[0].append("R")
        ans[1].append("L")
       
x=sx-1
y=sy
ans[2].append("L")
ans[3].append("R")

while 1:
    if y<ty+1:
        y+=1
        ans[2].append("U")
        ans[3].append("D")
    elif x<tx:
        x+=1
        ans[2].append("R")
        ans[3].append("L")
    else:
        ans[2].append("D")
        ans[3].append("U")
        break

li=[]

for i in range(4):
    for j in ans[i]:
        li.append(j)

print(''.join(li))

#print(*ans[0],*ans[1],*ans[2],*ans[3],sep="")

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define MAX 2005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<ll,ll>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);
#define INT_SIZE 32
using namespace std;

ll gcd(ll n1,ll n2){
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%MOD;
		base=(base*base)%MOD;
		exponent/=2;
	}
	return ans;
}
int arr[MAX],n;
int ans[MAX][MAX];
int msis[MAX][MAX],msis2[MAX][MAX];
int pre[MAX];
int len[MAX][MAX];
void maxSumIS(int x)
{
    int i, j, max = 0;

    for ( i = x; i < n; i++ )
        msis[x][i] = arr[i];
    for ( i = x+1; i < n; i++ )
        for ( j = x; j < i; j++ )
            if ( arr[i] > arr[j] && msis[x][i] < msis[x][j] + arr[i])
                msis[x][i] = msis[x][j] + arr[i];

    for ( i = x; i < n; i++ )
    {
    	ans[x][i]=ans[x][i-1];
        if ( ans[x][i] < msis[x][i] )
            ans[x][i] = msis[x][i];
    }
}
int val[1000000];
int main()
{
	int n,ans=0;
	cin>>n;
	for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        val[x]++;
    }
    for(int i=0;i<=100000;i++)
    {

        if(val[i]>1)
        {
            ans+=val[i];
            ans--;
        }
    }
    if(ans&1)
        ans++;
    cout<<n-ans<<endl;
}


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

#define all(x) x.begin(),x.end()
#define fi first
#define sd second
#define lson (nd<<1)
#define rson (nd+nd+1)
#define PB push_back
#define mid (l+r>>1)
#define MP make_pair
#define SZ(x) (int)x.size()

using namespace std;

typedef long long LL;

typedef vector<int> VI;

typedef pair<int,int> PII;

inline int read(){
    int res=0, f=1;char ch=getchar();
    while(ch<'0'|ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){res=res*10+ch-'0';ch=getchar();}
    return res*f;
}

const int MAXN = 200'005;

const int MOD = 1000000007;

void addmod(int& a, int b){a+=b;if(a>=MOD)a-=MOD;}
int mulmod(int a, int b){return 1ll*a*b%MOD;}

template<typename T>
void chmin(T a, T b){if(a>b)a=b;}

template<typename T>
void chmax(T a, T b){if(b>a)a=b;}

int cnt[5005];

int main(){
    int n=read();
    LL ans=0;

    for(int i=1;i<=n;++i){
        for(int j=1;j<=n;++j){
            int t=__gcd(i,j);
            ++cnt[t];
        }
    }

    for(int i=1;i<=n;++i){
        for(int j=1;j<=5000;++j){
            if(cnt[j]){
                ans+=1ll*cnt[j]*__gcd(j,i);
            }
        }
    }

    cout<<ans;

    return 0;
}

Measured memory_bytes: 3620
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

from math import sqrt

N = INT()
tmp = N
fact = {}
is_prime = True

for n in range(2, int(sqrt(N)) + 1):
    if tmp == 1:
        break
    
    e = 0
    while 1:
        if tmp % n != 0:
            break
        tmp //= n
        e += 1
    
    if e == 0:
        continue

    fact[n] = e

if tmp != 1:
    fact[tmp] = 1

if fact == {}:
    fact[N] = 1

ans = 0

for p in fact.keys():
    e = 1
    z = p
    
    if N == 1:
        break
    
    while 1:
        if N % z != 0:
            break
        N //= z
        e += 1
        z = pow(p, e)
        ans += 1
        
print(ans)

Measured memory_bytes: 63724
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    if(m > n){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    for(int i = n-1; i-m+1 >= 0; --i){
        bool match = true;
        for(int j = 0; j < m; ++j){
            if(s[i-j] == '?') continue;
            if(s[i-j] != t[m-1-j]) match = false;
        }
        if(match){
            for(int j = 0; j < m; ++j){
                s[i-j] = t[m-1-j];
            }
            rep(i,n){
                if(s[i] == '?') s[i] = 'a';
            }
            cout << s << endl;
            return 0;
        }
    }
    cout << "UNRESTORABLE" << endl;
    return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>

int linearSearch(int S[],int n,int key){
  int i = 0;
  S[n] = key;
  while(S[i] != key) i++;
  return i != n;
}

int main(){
  int i,n,S[10000+1],q,key,sum=0;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(linearSearch(S,n,key)) sum++;
  }
  printf("%d\n",sum);

  return 0;
}

Measured memory_bytes: 636
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // Initialize
        	var lst = new List<string>(new[] {"dream", "dreamer", "erase", "eraser"});
          	var S = cin.ReadLine;
            // Process
          	var find = true ;
        	while(find)
            {
              find = false ;
              foreach(var text in lst)
              {
                  if(S.EndsWith(text))
                  {
                    S = S.Remove(S.Length - text.Length);
                    find = true ;
                  }
              }
              if(S==string.Empty)break;
            }
            // Output
        	WriteLine(S==string.Empty?"YES":"NO");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 49016
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/27 15:29:53 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	string	s;
	cin >> s;
	int	cnt;
	cnt = 0;
	for (int i = 1; i < s.size(); i++)
	{
		if (s.at(i) != s.at(i - 1))
			cnt++;
	}
	cout << cnt << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

using namespace std;

int main() {
    

    
    int n, k;
    cin >> n >> k;
    
    long double ret = 0.0;
    for (int i = 1; i <= n; ++i)
    {
        int f = 0;
        if (k % i)
        {
            f = 1;
        }
        int tmp = k / i;
        
        long double p = 1.0;
        int count = 0;
        while (tmp > 0)
        {
            count++;
            if (f == 0 && tmp == 1)
            {
                break;
            }
            if (tmp % 2)
            {
                f = 1;
            }
            p /= 2.0;
            tmp /= 2;
        }
        ret += p;
    }
    
    long double div = n;
    
    cout << fixed << setprecision(12) << ret / div << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int [][]x = new int[3][3];
			
			x[0][0] = scan.nextInt();
			x[0][1] = scan.nextInt();
			x[0][2] = scan.nextInt();
			x[1][0] = scan.nextInt();
			x[1][1] = scan.nextInt();
			x[1][2] = scan.nextInt();
			x[2][0] = scan.nextInt();
			x[2][1] = scan.nextInt();
			x[2][2] = scan.nextInt();
			
			int[]a = new int[3];
			int[]b = new int[3];
			
			int ok = 1;
			
			
			for(int i = 0;i<=100;i++) {
				a[0] = i;
				b[0] = x[0][0]-a[0];
				
				a[1] = x[1][0]-b[0];
				a[2] = x[2][0]-b[0];
				b[1] = x[0][1]-a[0];
				b[2] = x[0][2]-a[0];
				if(0<=a[1]&&a[1]<=100&&0<=a[2]&&a[2]<=100&&0<=b[1]&&b[1]<=100&&0<=b[2]&&b[2]<=100) {
					if(a[1]+b[1]==x[1][1]&&a[1]+b[2]==x[1][2]&&a[2]+b[1]==x[2][1]&&a[2]+b[2]==x[2][2]){
						System.out.println("Yes");
						System.exit(0);
					}
				}
			}
			
			
			System.out.println("No");
			
			
			
			
			
			
			
			
			
		}
		
		
	}
		

}


Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }



string lev[11] = {"light fly", "fly", "bantam", "feather", "light", "light welter", "welter",
		 			"light middle", "middle", "light heavy", "heavy"};
D w[11] = {48, 51, 54, 57, 60, 64, 69, 75, 81, 91};


int main() {
	D in;
	while (cin>>in) {
		if (w[0] >= in) cout << lev[0] << endl;
		else if (w[9] < in) cout << lev[10] << endl;
		else { 
			for_(i, 1, 10) {
				if (w[i-1]<in && in<=w[i]) {
					cout << lev[i] << endl;
					break;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1228
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl

//ここから編集する
struct edge{int from;int to;};



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

    vector<vector<edge> > v(N);
    vector<bool> used(N,false);
    rep(i,0,M){
        int A,B;
        cin >> A >> B;
        A--;B--;
        edge e{A,B};
        v[A].push_back(e);
        swap(e.from,e.to);
        v[B].push_back(e);
    }

    vector<int> path;
    if(!DEBUG){
        for (int i = 0; i < v.size(); i++) {
            if (v[i].size() > 0) {
                path.push_back(i);
                path.push_back(v[i][0].to);
                used[i] = true;
                used[v[i][0].to] = true;
                break;
            }
        }
    }else{
        path.push_back(11);
        used[11] = true;
        path.push_back(3);
        used[3] = true;
    }

    while(true){
        bool contFlag = false;
        for(int i = 0; i < v[path[path.size()-1]].size(); i++){
            int kouho = v[path[path.size()-1]][i].to;
            if(!used[kouho]){
                path.push_back(kouho);
                used[kouho] = true;
                contFlag = true;
            }
        }
        if(!contFlag){
            break;
        }
    }
    reverse(all(path));
    while(true){
        bool contFlag = false;
        for(int i = 0; i < v[path[path.size()-1]].size(); i++){
            int kouho = v[path[path.size()-1]][i].to;
            if(!used[kouho]){
                path.push_back(kouho);
                used[kouho] = true;
                contFlag = true;
            }
        }
        if(!contFlag){
            break;
        }
    }
    cout << path.size() << endl;
    rep(i,0,path.size()){
        cout << path[i]+1;
        if(i != path.size()-1) cout << " ";
        else cout << endl;
    }

    return 0;
}


Measured memory_bytes: 6648
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define ll long long
#define Size(v) (int)v.size()

using namespace std;
// using namespace __gnu_pbds;


void solve() {
	ll x;
	cin >> x;
	ll lcm = x * 360 / __gcd(x, 360LL);

	cout << lcm / x;
}

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

	int t = 1;
	while (t--) 
		solve();
	return 0;
}

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

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

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

    vector<vector<long long int>> dp(n+1, vector<long long int>(2));
    dp[0][0] = 1;
    for(int i=0; i<n; i++){
        dp[i+1][0] = dp[i][0]; 
        dp[i+1][1] = dp[i][1];

        if(a[i] % 2 == 0){ dp[i+1][0] += dp[i][0]; dp[i+1][1] += dp[i][1]; }
        if(a[i] % 2 == 1){ dp[i+1][0] += dp[i][1]; dp[i+1][1] += dp[i][0]; }
    }
    cout << dp[n][p] << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=100005;

int N,K;
int x[MAXN];

int main()
{
    scanf("%d%d",&N,&K);
    for(int i=1;i<=N;i++)
        scanf("%d",&x[i]);
    int ans=0x7FFFFFFF;
    for(int i=1;i<=N-K+1;i++)
    {
        if(x[i]<=0&&x[i+K-1]<=0)
            ans=min(ans,-x[i]);
        if(x[i]<=0&&x[i+K-1]>=0)
            ans=min(ans,min(-x[i]*2+x[i+K-1],-x[i]+x[i+K-1]*2));
        if(x[i]>=0&&x[i+K-1]>=0)
            ans=min(ans,x[i+K-1]);
    }
    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0549
AC
"""
import sys
from sys import stdin
from itertools import accumulate
input = stdin.readline
import array

def main(args):
    # list
    n, m = map(int, input().split())
    distances = [int(input()) for _ in range(n-1)]
    inns = list(accumulate(distances))
    moves = [int(input()) for _ in range(m)]

    inns.insert(0, 0)
    pos = 0
    total_distance = 0
    for m in moves:
        new_pos = pos + m
        total_distance += abs(inns[new_pos] - inns[pos])
        pos = new_pos

    print(total_distance % 100000)



def main2(args):
    # array
    n, m = map(int, input().split())

    pos = 0
    inns = array.array('L', [0])
    for _ in range(n-1):
        pos += int(input())
        inns.append(pos)
    moves = [int(input()) for _ in range(m)]

    pos = 0
    total_distance = 0
    for m in moves:
        new_pos = pos + m
        total_distance += abs(inns[new_pos] - inns[pos])
        pos = new_pos

    print(total_distance % 100000)



def main3(args):
    # dict
    n, m = map(int, input().split())

    pos = 0
    inns = {0: 0}
    for i in range(n-1):
        pos += int(input())
        inns[i+1] = pos
    moves = [int(input()) for _ in range(m)]

    pos = 0
    total_distance = 0
    for m in moves:
        new_pos = pos + m
        total_distance += abs(inns[new_pos] - inns[pos])
        pos = new_pos

    print(total_distance % 100000)



if __name__ == '__main__':
    main2(sys.argv[1:])

Measured memory_bytes: 12492
def btc_to_jpy(btc):
    return btc * 380000


N = int(input())
sum = 0
for i in range(N):
    q, c = input().split()
    if c == 'JPY':
        q = int(q)
        sum += q
    else:
        q = float(q)
        sum += btc_to_jpy(q)
print(sum)


Measured memory_bytes: 2940
import itertools
N,M,Q=map(int,input().split())
ali=list(itertools.combinations_with_replacement(range(1,M+1),N))
mat=[list(map(int,input().split())) for i in range(Q)]
ali=list(sorted(ali))
anlist=[0]*len(ali)
l=0
for i in ali:
  for j in mat:
    a=j[1]-1
    b=j[0]-1
    if i[a]-i[b]==j[2]:
      anlist[l]+=j[3]
  l+=1
print(max(anlist))
      
    

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

int main(void) {
#ifdef DEBUG
	freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int R;
  cin >> R;
  if (R < 1200) {
    cout << "ABC" << endl;
  } else if (R < 2800) {
    cout << "ARC" << endl;
  } else {
    cout << "AGC" << endl;
  }
  return 0;
}


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

int main(){
  string s;
  cin >> s;
  
  int count = 0;
  int n = s.length();
  if(n % 2 == 0){
    for(int i=0; i<n/2; ++i){
      if(s[n/2+i] != s[n/2-i-1]) ++ count;
    }
  }
  else{
    for(int i=1; i<n/2+1; ++i){
      if(s[n/2+i] != s[n/2-i]) ++ count;
    }
  }
  
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
array = [0]
array2 = list(map(int, input().split()))
array.extend(array2)
array.append(0)
gokei = 0
for i in range(N+1):
    gokei += abs(array[i+1] - array[i])
for i in range(N):
    print(gokei+abs(array[i]-array[i+2])-(abs(array[i]-array[i+1])+abs(array[i+1]-array[i+2])))

Measured memory_bytes: 14048
#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<string>> S(H, vector<string>(W));
  string answer;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> S.at(i).at(j);
      if (S.at(i).at(j) == "snuke") {
        answer = 'A' + j;
        answer += to_string(1+i);
      }
    }
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

#define lpsbd(i, s, b, d) for(size_t i = (s); i < (b); i+=(d))
#define lpsb(i, s, b) for(size_t i = (s); i < (b); i++)
#define lpn(i, n) for(size_t i = 0; i < (n); i++)
#define fa(i, x) for(auto &i: x)
#define vcd(t, n, d) vector<t>(n, d)
#define vc(t, n) vector<t>(n)

using namespace std;
using ull = long long;

const ull MOD = 1000000007;

pair<ull, ull> find_neighbor(vector<ull> *a, ull v)
{
    auto r = upper_bound(a->begin(), a->end(), v);
    auto l = r - 1;
    if (r == a->end()) return make_pair(*l, 9223372036854775807);
    if (r == a->begin()) return make_pair(*r, 9223372036854775807);
    return make_pair(*l, *r);
}

int main(void)
{
    int A, B, Q;
    cin >> A >> B >> Q;
    auto s = vc(ull, A);
    auto t = vc(ull, B);
    fa(i, s) cin >> i;
    fa(i, t) cin >> i;
    ull x;
    pair<ull, ull> nx, nl, nr;
    ull ds, dt;
    while(Q--)
    {
        cin >> x;
        nx = find_neighbor(&s, x);
        nl = find_neighbor(&t, nx.first);
        nr = find_neighbor(&t, nx.second);
        ds = min(abs(nx.first-x) + min(abs(nl.first-nx.first), abs(nl.second-nx.first)), abs(nx.second-x) + min(abs(nr.first-nx.second), abs(nr.second-nx.second)));
        //cerr << nx.first << " " << nx.second << endl << nl.first << " " << nl.second  << endl << nr.first << " " << nr.second << endl;
        nx = find_neighbor(&t, x);
        nl = find_neighbor(&s, nx.first);
        nr = find_neighbor(&s, nx.second);
        dt = min(abs(nx.first-x) + min(abs(nl.first-nx.first), abs(nl.second-nx.first)), abs(nx.second-x) + min(abs(nr.first-nx.second), abs(nr.second-nx.second)));
        //cerr << nx.first << " " << nx.second << endl << nl.first << " " << nl.second  << endl << nr.first << " " << nr.second << endl << endl;
        cout << min(ds, dt) << endl;
    }
    return 0;
}

Measured memory_bytes: 2944
#include <cstdio>
#include <cstring>
using namespace std;
char buf[105];
int main()
{
    scanf("%s",buf);
    bool flag=false;
    for (int i=0;i<strlen(buf);++i)
    {
        if (buf[i]=='C')flag=true;
        if (flag==true&&buf[i]=='F')
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define reset(x, y) memset(x, y, sizeof(x))
#define uni(x) (x).erase(unique(all(x)), (x).end());
#define BUG(x) cerr << #x << " = " << (x) << endl
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define _1 first
#define _2 second

const int maxn = 212345;

int a[maxn], n;
ll pref[2][maxn], suf[2][maxn];

int main() {
    scanf("%d", &n);
    FOR(i, 1, n) scanf("%d", a + i);
    ll acc = 0;
    FOR(i, 1, n) {
        acc += a[i];
        pref[1][i] = min(pref[1][i - 1], pref[0][i - 1]) + (a[i] & 1 ^ 1);
        if (pref[1][i] > acc) pref[1][i] = acc;
        pref[0][i] = pref[0][i - 1] + (a[i] & 1);
        if (!a[i]) pref[0][i] += 2;
        if (pref[0][i] > acc) pref[0][i] = acc;
    }
    acc = 0;
    ROF(i, n - 1, 0) {
        acc += a[i + 1];
        suf[1][i] = min(suf[1][i + 1], suf[0][i + 1]) + (a[i + 1] & 1 ^ 1);
        if (suf[1][i] > acc) suf[1][i] = acc;
        suf[0][i] = suf[0][i + 1] + (a[i + 1] & 1);
        if (!a[i + 1]) suf[0][i] += 2;
        if (suf[0][i] > acc) suf[0][i] = acc;
    }
    ll ans = 1e18;
    REP(i, n + 1) {
        ans = min(ans, pref[1][i] + suf[0][i]);
        ans = min(ans, pref[0][i] + suf[1][i]);
        ans = min(ans, suf[0][i] + pref[0][i]);
    }
    printf("%lld", ans);
}

Measured memory_bytes: 7424
#include<stdio.h>

int main()
{
	int max, num, i;
	long long count= 0, sum= 0;

	scanf("%d", &max);

	for(i= 0; i< max; i++)
	{
		scanf("%d", &num);
		if(num)
			sum+= num;
		else
		{
			count+= sum/ 2;
			sum= 0;
		}
	}

	if(num)
		count+= sum/ 2;

	printf("%lld\n", count);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
string str[100] = { "KIHBR","AKIHBR","KIHABR","KIHBAR","KIHBRA","AKIHABR",
"AKIHBAR","AKIHBRA","KIHABAR","KIHABRA","KIHBARA",
"AKIHABAR","AKIHABRA","AKIHBARA","KIHABARA","AKIHABARA" }, s;
int main()
{
    cin >> s;
    for (int i = 0; i < 16; i++)
        if (s == str[i])
            return cout << "YES\n", 0;
    cout << "NO\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  char b;
  cin >> b;
  switch (b)
  {
    case 'A':
      cout << 'T' << endl;
      break;
    case 'C':
      cout << 'G' << endl;
      break;
    case 'G':
      cout << 'C' << endl;
      break;
    case 'T':
      cout << 'A' << endl;
      break;
    default:
      break;
  }
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<int, int> i_i;
const int INF = INT_MAX / 2;
const int MOD = 1e9 + 7;

int main() {
	string s; cin >> s;
	vector<int> a(3);
	for (char c: s) a[c - 'a']++;
	int mi = min(a[0], min(a[1], a[2]));
	int ma = max(a[0], max(a[1], a[2]));
	cout << (ma - mi <= 1 ? "YES" : "NO") << endl;
}


Measured memory_bytes: 512