akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i = 0;i < n; i++)
#define REP(i,n) for(int i = 1;i <= n; i++)
// ----GCC ONLY---- //
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// ----        ---- //
#define ll long long
#define MOD 10000007
#define PB push_back

using namespace std;



int main(){

  int h,a;
  cin >> h >> a;
  int ans = 0;
  
  while(h > 0){
    
    h = h - a;
    ans++;
    
  }
  if(h%a == 1){
    cout << ans + 1 <<endl;
  }else{
    cout << ans << endl;
  }
}
    

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

int main(){
  int K,N;
  cin >> K >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  int L=0;
  for(int i=0;i<N-1;i++){
    if(L<(A.at(i+1)-A.at(i))){
      L=A.at(i+1)-A.at(i);
    }
  }
  if(L<A.at(0)+K-A.at(N-1)){
    L=A.at(0)+K-A.at(N-1);
  }
  cout << K-L<<endl;
}

Measured memory_bytes: 1024
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N,M,K = map(int,input().split())
MOD = 998244353
ans = 1
for i in range(K+1):
  m = M
  m *= cmb(N-1,i,mod)
  m *= pow(M-1,N-1-i,mod)
  ans += m
  ans %= mod
print(ans-1)

Measured memory_bytes: 213036
using System;

namespace atcoderA
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            int X = int.Parse(input[0]);
            int A = int.Parse(input[1]);
            int B = int.Parse(input[2]);
            string ans = "";
            if (B <= A)
            {
                ans = "delicious";
            }
            else if (A + X >= B)
            {
                ans = "safe";
            }
            else
            {
                ans = "dangerous";
            }
            Console.WriteLine(ans);
        }
    }
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;

vl v;

void dfs(int d, ll n) {
	v.push_back(n);

	if (d == 10) return;

	for (int i = -1; i <= 1; i++) {
		int a = (n % 10) + i;
		if (0 <= a && a <= 9) dfs(d + 1, n * 10 + a);
	}
}

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

	ll k;
	cin >> k;
	
	for (int i = 1; i <= 9; i++) {
		dfs(1, i);
	}

	sort(all(v));

	out(v[k - 1]);

	return 0;
}

Measured memory_bytes: 2420
def main():
    h, w, k = map(int, input().split())
    o = [[0]*w for _ in range(h)]
    s = [list(input()) for i in range(h)]
    n, mn = 0, 0
    for i in range(h):
        for j in range(w):
            if s[i][j]=="#":
                mn += 1
                n = mn
                o[i][j] = n
            else:
                o[i][j] = n
        n = 0
    for i in range(h):
        for j in range(w-2, -1, -1):
            if o[i][j]==0:
                o[i][j] = o[i][j+1]
    for j in range(w):
        for i in range(1, h):
            if o[i][j]==0:
                o[i][j] = o[i-1][j]
    for j in range(w):
        for i in range(h-2, -1, -1):
            if o[i][j]==0:
                o[i][j] = o[i+1][j]
    for i in range(h):
        print(*o[i])

if __name__ == "__main__":
    main()


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

int n, a[200];
void reverse ()
{
	for (int i=n-1; i>=0; i--)
	{
		cout << a[i];
		if (i>0) cout << " ";
		else cout << endl;
	}
	
}
int main ()
{
	cin >> n;
	for (int i=0; i<n; i++)
	{
		cin >> a[i];
	}
	reverse ();
	return 0;	
}

Measured memory_bytes: 3044
use std::io;
//use std::collections::HashMap;
//use std::collections::BinaryHeap;
//use std::collections::HashSet;
//use std::mem; // mem::swap(&mut x,&mut y);
use std::cmp; // cmp::max,cmp::min

// Rust memo: https://hackmd.io/i0lQY1OKTDW1t66TECOmiw?both

#[allow(dead_code)]
fn read_line() -> String{
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read_charvec() -> Vec<char>{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn read_ints() -> Vec<i64>{
    let s = read_line();
    let split:Vec<&str> = s.split(" ").collect();
    split.iter().map(|&x| x.to_string().parse().unwrap()).collect()
}

#[allow(dead_code)]
fn read_int() -> i64{
    read_ints()[0]
}

#[allow(dead_code)]
fn reverse(s: &String) -> String{
    s.chars().rev().collect::<String>()
}

#[allow(dead_code)]
fn read_lines(n:i64) -> Vec<String>{
    let mut xs = Vec::new();

    for _i in 0..n{
        xs.push(read_line());
    }

    xs
}

#[allow(dead_code)]
fn read_ints2(n:i64) -> Vec<i64>{
    read_lines(n).iter().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn arange(start:i64,end:i64,step:i64) -> Vec<i64>{
    let mut ret = Vec::new();
    let mut i = start;

    while i < end{
        ret.push(i);
        i += step;
    }

    ret
}

#[allow(dead_code)]
const DXS : [i64; 4] = [0,0,1,-1];
#[allow(dead_code)]
const DYS : [i64; 4]  = [1,-1,0,0];
#[allow(dead_code)]
const INF : i64 = 999999999;

////////////////////////////////////////////////

fn calc(xs:&Vec<Vec<i64>>,tp: i64, m : usize)->i64{
    let sign = vec![
        if (tp   ) & 1 == 1 {1}else{-1},
        if (tp>>1) & 1 == 1 {1}else{-1},
        if (tp>>2) & 1 == 1 {1}else{-1},
    ];

    let mut ys : Vec<i64> = xs.iter()
        .map(|x| x[0] * sign[0] + x[1] * sign[1] + x[2] * sign[2])
        .collect();
    ys.sort();
    ys.reverse();

    let mut ret = 0;
    for i in 0..m{
        ret += ys[i];
    }

    ret
}

fn main(){
    let input = read_ints();
    let (n,m) = (input[0],input[1]);

    let mut xs : Vec<Vec<i64>> = (0..n).into_iter()
        .map(|_| read_ints())
        .collect();

    let mut ans = 0;
    for i in 0..8{
        ans = cmp::max(ans,calc(&xs,i,m as usize));
    }
    println!("{}",ans);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
int a[1<<19];
int cmp(const int* a, const int* b) {
    return *b - *a;
}
int main(void) {
    int n;
    long long int sum = 0;
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
        scanf("%d%d%d", &a[3 * i], &a[3 * i + 1], &a[3 * i + 2]);
    qsort(a, 3 * n, sizeof(int), cmp);
    for(int i = 1; i < 2 * n; i += 2)
        sum += a[i];
    printf("%lld", sum);
}

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

#define FREE -1
#define NOT_FREE 1

void A();
void print();
void queen(int);

int X[8],Y[8],dpos[15],dneg[15];

bool Q[8][8];

int main(){
  A();

  for(int i=0;i<8;i++){
    for(int j=0;j<8;j++){
      Q[i][j]=false;
    }
  }

  int k;
  cin >> k;

  for(int i=0;i<k;i++){
    int r,c;
    cin >> r >> c;
    Q[r][c]=true;
  }
  queen(0);

  return 0;
}

void A(){
  for(int i=0;i<8;i++){
    X[i]=FREE;
    Y[i]=FREE;
  }
  for(int i=0;i<15;i++){
    dpos[i]=FREE;
    dneg[i]=FREE;
  }
}

void print(){
  for(int i=0;i<8;i++){
    for(int j=0;j<8;j++){
      if(Q[i][j]){
	if(X[i]!=j)return;
      }
    }
  }

  for(int i=0;i<8;i++){
    for(int j=0;j<8;j++){
      cout << ((X[i]==j) ? "Q" : ".");
    }
    cout << endl;
  }
}

void queen(int a){
  
  if(a == 8){
    print();
    return;
  }

  for(int i=0;i<8;i++){
    if(NOT_FREE == Y[i] || NOT_FREE == dpos[a+i] || NOT_FREE == dneg[a-i+7])continue;

    X[a]=i;
    Y[i]=dpos[a+i]=dneg[a-i+7]=NOT_FREE;

    queen(a+1);

    X[a]=Y[i]=dpos[a+i]=dneg[a-i+7]=FREE;
  }
}



Measured memory_bytes: 3128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;


int main(){
	int N;
	char s[101];
	scanf("%d", &N);
	for(int i=0;i<N;i++){
		scanf("%c", &s[i]);
	}
	bool exist = false;
	for(int i=0;i<N;i++){
		if(s[i]=='Y') exist = true;
	}

	if(exist){
		printf("Four\n");
	}else{
		printf("Three\n");
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,r;
    cin>>s;
    int moves=0;
    int i=1;
    int f=0;
    while(s.size()>2&&i<s.size())
    {
         f=0;
        if((i+1)<s.size())
        {
            if(s[i-1]!=s[i+1])
            {
                f=1;
                s.erase(i,1);
                moves++;
            }
    
        }
        if(!f)
            i++;
        else
            i=max(1,i-1);
 
    }
    if(moves%2)
        printf("First");
    else
        printf("Second");
    return 0;
}

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;


int main() {

   ll W, H, x, y;
   cin >> W >> H >> x >> y;

   double ans = W * H / 2.0;
   int count = 0;
   if(x * 2 == W && y * 2 == H)count++;

   printf("%.6f %d", ans, count);

//    cout << max(min1, min2) << " " << count << endl;


    // cout << n1 << n2 << n3 << n4;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <vector>
#include <algorithm>
#include <chrono>
using namespace std;

int main(int argc, const char * argv[]) {
    
    string S;
    cin >> S;
    char initial = S.at(0), tail = S.at(S.size() - 1);
    int l = (int)S.substr(1, S.size() - 2).size();
    
    cout << initial << l << tail << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main(){
	int N,ans=0;
	cin>>N;
	rep(i,N){
		int l,r;
		cin>>l>>r;
		ans+=(r-l+1);
	}
	cout<<ans<<endl;
	return 0;
}



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

int main() {
	
	int N;
	cin >> N;
	
	long long int ans = 0;
	long long int INF = 10000000000;
	long long int mini = INF;
	
	for(int i = 0; i < N; i++){
		long long int A, B;
		cin >> A >> B;
		ans += B;
		if(B < A){
			mini = min(mini, B);
		}
	}
	
	if(mini == INF){
		ans = 0;
		mini = 0;
	}
	cout << ans - mini << endl;
	
	return 0;
}


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

using namespace std;

int main(int argc, char const *argv[])
{
	string s;
	cin >> s;
	int ans = 1000;
	for (int i = 0; i < s.size()-2; ++i) {
		ans = min(ans, abs(753-stoi(s.substr(i,3))));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int solve(){
  int n, m[101], p;
  bool pl[101][101] = {};

  scanf("%d", &n);

  if(n == 0) return false;
  
  for(int i=0;i<n;i++){
    scanf("%d", m+i);
    for(int j=0;j<m[i];j++){
      scanf("%d", &p);
      pl[i][p-1] = true;
    }
  }

  int ans = -1;

  int k, l, ll[101] = {};
  scanf("%d", &k);
  for(int j=0;j<k;j++){
    scanf("%d", &l);
    ll[l-1] = true;
  }
  
  for(int i=0;i<n;i++){
    bool flag = true;
    for(int j=0;j<100;j++)
      flag &= !ll[j] || pl[i][j];
    if(flag){
      if(ans == -1) ans = i+1;
      else ans = -2;
    }
  }
  
  if(ans == -2) ans = -1;
  printf("%d\n",ans);
  
  return true;
}

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



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

struct NODE{
  int key;
  NODE *prev, *next;
};

NODE nil = {-1, &nil, &nil};

void insert(int x){
  NODE *newnode = new NODE;
  newnode->key = x;
  newnode->next = nil.next;
  nil.next->prev = newnode;
  nil.next = newnode;
  newnode->prev = &nil;
}

NODE* search(int k){
  NODE *i = nil.next;
  while(i->key != -1 && i->key != k){
    i = i->next;
  }
  if(i->key == -1) return 0;
  else return i;
}

void deleteN(int k){
  NODE *x = search(k);
  if(!x) return;
  x->prev->next = x->next;
  x->next->prev = x->prev;
  delete x;
}

void deleteF(){
  NODE *x = nil.next;
  nil.next = x->next;
  x->next->prev = &nil;
  delete x;
}

void deleteL(){
  NODE *x = nil.prev;
  nil.prev = x->prev;
  x->prev->next = &nil;
  delete x;
}

int main(){
  int n, a;
  string cmd;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> cmd;
    if(cmd == "insert"){
      cin >> a;
      insert(a);
    }
    else if(cmd == "delete"){
      cin >> a;
      deleteN(a);
    }
    else if(cmd == "deleteFirst"){
      deleteF();
    }
    else if(cmd == "deleteLast"){
      deleteL();
    }
  }
  for(NODE *i = nil.next; i->key != -1; i = i->next){
    cout << i->key << (i->next->key == -1 ? '\n' : ' ');
  }
  return 0;
}


Measured memory_bytes: 34324
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
string S;

void solve() {

	cin >> S;

	int ans = 0;
	int tmp = 0;

	for (int i = 0; i < S.length(); i++) {
		if (S[i] == 'A' || S[i] == 'T' || S[i] == 'C' || S[i] == 'G') {
			tmp++;
		}
		else {
			ans = max(ans, tmp);
			tmp = 0;
		}
	}
	ans = max(ans, tmp);

	cout << ans << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

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

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; i++)
        cin >> s[i];
    for (int i = 0; i < h; i++)
    {
        cout << s[i] << endl;
        cout << s[i] << endl;
    }
}


Measured memory_bytes: 3560
from sys import stdin
import statistics

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
lin = [i+1 for i in range(n)]
point = 0
ls = []
for i in range(n):
    ls.append(li[i]-lin[i])
ls.sort()
mi = 10**10

k = int(round(statistics.median(ls)))

for i in range(len(ls)):
    ls[i] = abs(ls[i]-k)

print(sum(ls))

Measured memory_bytes: 30512
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)[::-1]
ans=a[1]
tmp=0
for i in range(1,n):
    if a[0]-a[i]>a[0]-(a[0]-a[i]):
        m=a[0]-a[i]
    else:
        m=a[i]
    if tmp<abs(a[0]-m):
        tmp=abs(a[0]-m)
        ans=a[i]
print(a[0],ans)

Measured memory_bytes: 14052
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  a = max(a,c);
  b = min(b,d);
  if(b-a > 0) cout << b-a << endl;
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
import Data.List
import qualified Data.Set as S

main = interact $ show . sol . read

sol :: Int -> Int
sol = sum . map (f . length) . group . pf

f n = truncate $ sqrt (2*fromIntegral n+0.25)-0.5

pf 1 = []
pf n = factor n primes

factor n (p:ps) 
  | p*p > n      = [n]
  | n `mod` p==0 = p:factor (n `div` p) (p:ps)
  | otherwise    = factor n ps 

primes = 2:sieve [3,5..]
  where
  sieve (x:xs) = x:f xs (g x xs S.empty)
  f (x:xs) tbl
    | c == x    = f xs (h x tbl)
    | otherwise = x:f xs (g x xs tbl)
    where 
    c = fst $ S.findMin tbl
  h x tbl
    | n == x    = h x (S.insert (n',ns') tbl')
    | otherwise = tbl
    where
    Just ((n,n':ns'), tbl') = S.minView tbl
  g p xs = S.insert (p*p, map (*p) xs)

Measured memory_bytes: 47784
#include<bits/stdc++.h>                          
using namespace std;
int n,a[105];         
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++)
    	if(a[i]%2==0&&a[i]%3!=0&&a[i]%5!=0) {cout<<"DENIED";return 0;}
    cout<<"APPROVED";
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  for (int i = 0; i < a*2-1; i++) {
    cout << b - a + 1 + i << " ";
  }
}
  /*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
  //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


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

int main(void)
{
  string s, t;
  cin >> s >> t;
  string ans = "Yes";
  rep(i, s.size())
  {
    if (s[i] != t[i])
    {
      ans = "No";
      break;
    }
  }

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


Measured memory_bytes: 3628
s = raw_input()
d = []
cnt = 1
for i in range(len(s)-1):
    if s[i+1] == s[i]: cnt += 1
    else:
        d.append((s[i], cnt))
        cnt = 1
d.append((s[-1],cnt))
ans = 0
for i in range(len(d)-2):
    if d[i][0] == "J" and d[i+1][0] == "O" and d[i+2][0] == "I":
        if d[i+1][1] <= d[i][1] and d[i+1][1] <= d[i+2][1]:
            ans = max(ans, d[i+1][1])
print ans

Measured memory_bytes: 118380
#include<iostream>
using namespace std;
int main(){
    long long a,b,c,i;
    cin>>a>>b>>c;
    for(i=1;i<=1000;++i){
        if((a*i)%b==c){
            cout<<"YES"<<endl;
            goto endapp;
        }
    }
    cout<<"NO"<<endl;
endapp:
    return 0;    
}

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

int main()
{
    string o, e;
    cin >> o;
    cin >> e;

    queue<char> o_que, e_que;
    rep(i, 0, o.size()) o_que.push(o[i]);
    rep(i, 0, e.size()) e_que.push(e[i]);
    
    queue<char> ans;
    while (o_que.size() > 0 or e_que.size() > 0)
    {
        if (o_que.size() > 0)
        {
            ans.push(o_que.front());
            o_que.pop();
        }
        if (e_que.size() > 0)
        {
            ans.push(e_que.front());
            e_que.pop();
        }
    }

    while(ans.size() > 0)
    {
        cout << ans.front();
        ans.pop();
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>

using namespace std;

int main() {
    //freopen("output.txt", "w", stdout);
    int n, m; 
    cin >> n >> m;
    ll sum = 0;
    for (int i=0; i<m; i++) {
        int x; cin >> x;
        sum += x;
    }
    if (n<sum) cout << -1 << endl;
    else cout << n  - sum << endl;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int[] ar=new int[3];
        ar[0]=sc.nextInt();
        ar[1]=sc.nextInt();
        ar[2]=sc.nextInt();
        Arrays.sort(ar);
        int diff=0;
        diff=ar[1]-ar[0];
        diff+=ar[2]-ar[1];
        System.out.println(diff);
    }
}

Measured memory_bytes: 22612
#include<stdio.h>

int main(){
	int n,i;
	long tmp,a[100001]={0},ans=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%ld",&tmp);
		if(tmp>100000)ans++;
		else a[tmp]++;
	}
	for(i=0;i<=100000;i++){
		if(i>a[i])ans+=a[i];
		else ans+=a[i]-i;
	}
	printf("%ld\n",ans);
	return 0;
}

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

int main() {
  int n; cin >> n;
  string s; cin >> s;
  for(int i=0; i<s.size(); i++) {
    s[i] = (s[i] + n);
    if (s[i] > 'Z') s[i] -= 26;
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3") 
#pragma GCC optimization ("unroll-loops")
 
// #include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
// const ll RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
// gp_hash_table<int, int> table;
 
#define ll  long long
#define vii vector< ll >
#define pb push_back
#define pii pair<ll,ll>
#define ppi pair<pii,ll>
#define pip pair<ll,pii>
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define ins insert
#define ld long double
#define lp(l,r) for(i=l;i<=r;++i)
 
#define lpj(l,r) for(j=l;j<=r;++j)
#define lpr(l,r) for(i=r;i>=l;--i)
#define lprj(l,r) for(j=r;j>=l;--j)
 
#define swap(a,b){ auto _t=a;a=b,b=_t;}
#define flush() cout.flush()
#define popcount __builtin_popcount
#define die() return 0;
#define sz() size() 


 
 
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define MD          1000000007
#define M           100011
#define N           20
#define fftmod      998244353
#define EPS         (double)1e-10
 
long long  md=MD;
ll inf=1e18;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
 
 
inline ll exp(ll a,ll b){if(a==0&&b==0)return 1ll;if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=(r%md)*(a%md);r=(r+md)%md;}b/=2;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (ll)r;}
 
using cd=complex<double>;
const double PI=acos(-1);
 
inline ll rand(ll l,ll r){
    return l+rng()%(r-l+1);
}



int main(){

 
     
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
   // ifstream fin("input.txt");ofstream fout("outut.txt");
    ll t,i,j,m,n,s,z,k,p;string s1,s2;ll q;ll x,y;
    cin>>n;
    p=0;
    vii v;
    lp(1,n-1)cin>>x,v.pb(x);
    p=v.back()+v[0];
    k=v.back();
    v.pop_back();
    while(v.size()){
    	p+=min(v.back(),k);
    	k=v.back();v.pop_back();
    }
    cout<<p<<"\n";









}



Measured memory_bytes: 256
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <db,db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=200005;

int f[N+1],inf[N+1];

int C(int n,int r)
{
    if(r>n)
        return 0;
    int ans=(f[n]*inf[r])%hell;
    return (ans*inf[n-r])%hell;
}
int ways(int x1,int y1,int x2,int y2)
{
    return C(x2-x1+y2-y1,x2-x1);
}

void preprocess()
{
    f[0]=1;
    for(int i=1;i<=N;i++)
        f[i]=(f[i-1]*i)%hell;
    inf[N]=power(f[N],hell-2,hell);
    for(int i=N-1;i>=0;i--)
        inf[i]=(inf[i+1]*(i+1))%hell;
}

void solve()
{
   
    int n,m;
    cin>>n>>m;
    int a,b;
    cin>>a>>b;
    a=n-a+1;
    int pre=0;
    int ans=ways(1,1,n,m);
    for(int i=1;i<=b;i++)
    {
        int Z=ways(1,1,a,i);
        Z=(Z-pre+hell)%hell;
        ans=(ans-(Z*ways(a,i,n,m))%hell+hell)%hell;
        pre=(pre+Z)%hell;
    }
    cout<<ans<<endl;
}


int32_t main(){
    
    IOS;
    preprocess();
    int t;
    t=1;
    // cin>>t;
    while(t--)
    {
        
        solve();
    }
    return 0;
}




Measured memory_bytes: 6716
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	vector<int>V(13);
	V = { 2,3,4,5,6,7,8,9,10,11,12,13,1 };
	int A, B;
	cin >> A >> B;
	int a = 0;
	int b = 0;
	rep(i, 13) {
		if (V[i] == A) {
			a = i;
		}
	}
	rep(i, 13) {
		if (V[i] == B) {
			b = i;
		}
	}
	if (a < b) {
		cout << "Bob" << endl;
	}
	else if (a > b) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Draw" << endl;
	}
}


Measured memory_bytes: 256
_n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort
b = [a.pop / 2]
(m - 1).times do
  if !a.empty? && a[-1] >= b[-1]
    tmp = a.pop / 2
    b.unshift(tmp)
  else
    tmp = b.pop / 2
    b.unshift(tmp)
  end
end
p (a + b).inject(:+)

Measured memory_bytes: 10608
// #include C/C++ {
#include <bits/stdc++.h>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef _DEBUG

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 18
#define MAX_M 55
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
	//  WF("output.txt");
	DF("err.txt");

	int N, K;
	scanf("%d %d", &N, &K);
	if (K == 1) return puts("0"), 0;
	printf("%d\n", N - K);
	return 0;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

set<ll> prime_vector; // [0]2, [1]2, [2]3, [3]5, ... のように代入される
void PRIME_VECTOR(ll x) {
	if (x <= 1)return;

	for (ll i = 2; i * i <= x; i++) {
		if (x % i == 0) {
			PRIME_VECTOR(i);
			PRIME_VECTOR(ll(x / i));
			return;
		}
	}
	prime_vector.insert(x);
	return;
}

int main(void) {

	ll A, B; cin >> A >> B;
	
	PRIME_VECTOR(A);
	set<ll> a_map = prime_vector;
	prime_vector.clear();
	PRIME_VECTOR(B);
	set<ll> b_map = prime_vector;

	ll ans = 1;
	for (auto x : a_map) {
		if (find(b_map.begin(), b_map.end(), x) != b_map.end()) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3624
h,w = map(int,input().split())
array = []
for _ in range(h):
  array.append(list(map(str,input())))
for i in range(h):
  array[i].insert(0,".")
  array[i].append(".")
array.insert(0,["."]*(w+2))
array.append(["."]*(w+2))
for i in range(1,h+1):
  for j in range(1,w+1):
    if array[i][j]=="#" and array[i][j-1] ==  array[i][j+1] == array[i-1][j] == array[i+1][j] == ".":
      print("No")
      break
    if i==h and j==w:
      print("Yes")
      break
  else:
    continue
  break

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int n, m;
	cin >> n >> m;
	vector<ll> arr(n);
	ll sm = 0;
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
		sm += arr[i];
	}
	int ans = 0;
	for(auto el: arr)
		if(el * 4LL * m >= sm) ans++;
	cout << (ans >= m? "Yes": "No") << '\n';
}


Measured memory_bytes: 256
'use strict';

function main(stdin) {
  const input = stdin.split('\n');
  const a = Number(input[0]);
  const s = input[1];

  let ans = 'red';
  if (a >= 3200) ans = s;

  console.log(ans);  
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim());

Measured memory_bytes: 21064
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=1000000+10;
const int mod=1e9+7;

int n,dp[N];

int main() {
	n=read();
	if (n==1) { puts("1"); return 0; }
	dp[n]=n,dp[n-1]=1ll*n*n%mod;
	for (int i=n-2,s=0;i;--i) {
		dp[i]=(s+i+1+1ll*(n-1)*(n-1)+dp[i+1])%mod;
		s=(s+dp[i+2])%mod;
	}
	printf("%d\n",dp[1]);
	return 0;
}

Measured memory_bytes: 7504
import java.util.*;
public class Main {
  public static void main(String[] args) {
    ArrayList<Integer> ans = new ArrayList<Integer>();
    Scanner sc = new Scanner(System.in);
        while(true) {
            String line = sc.nextLine();
            String[] linesp = line.split(" ");
            int a = Integer.parseInt(linesp[0]);
            String op = linesp[1];
            int b = Integer.parseInt(linesp[2]);
            if (op.equals("+")) {
                ans.add(a + b);
            } else if (op.equals("-")) {
                ans.add(a - b);
            } else if (op.equals("*")) {
                ans.add(a * b);
            } else if (op.equals("/")) {
                ans.add(a / b);
            } else if (op.equals("?")) {
                break;
            }
        }
        for(int i = 0; i < ans.size(); i++) {
            System.out.println(ans.get(i));
        }
  }
}



Measured memory_bytes: 26092
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#include <bitset>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init)) 
const int PRIME = 1000000007;
const int INF = (int) 1e9;
const int INT_INF = 2147483647;
const long long int LL_INF = 9223372036854775807;
const double PI = acos(-1);
const double EPS = 0.00001;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> h(n);
	vector<int> dp(n);
	for (int i = 0; i < n; i++) cin >> h[i];
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < n; i++) {
		dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
	}
	cout << dp[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 1024
n=int(input())
s=input()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b
for i in range(n):
  for j in range(i+1,n):
    if 2*j-i<n:
      if s[i]!=s[j] and s[i]!=s[2*j-i] and s[j]!=s[2*j-i]:
        ans-=1
print(ans)

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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }  
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		String alt = "",_alt= "";
		/*for(int i = 0;i < n.length();i ++) {
			if(i % 2 == 0) {
				alt += "0"; _alt += "1";
			}else {
				alt += "1"; _alt += "0";
			}
		}*/
		char altc,_altc,nc;
		int altcnt = 0, _altcnt = 0;
		for(int i = 0;i < n.length();i ++) {
			if(i % 2 == 0) {
				altc = '0'; _altc = '1';
			}else {
				altc = '1'; _altc = '0';
			}
			nc = n.charAt(i);
			if(altc != nc) altcnt++;
			if(_altc != nc) _altcnt++;
		}
		if(altcnt < _altcnt) System.out.println(altcnt);
		else System.out.println(_altcnt);
	}
}

Measured memory_bytes: 26136
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++) 
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> vc( M * 2 );
    for( auto &x : vc )
    {
        cin >> x;
    }
    sort( ALL( vc ) );
    REP2( i, 1, N + 1 )
    {
        cout << count( ALL( vc ), i ) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=1000005;
typedef long long ll;
typedef double dbl;
typedef long double ld;
const ld EPS=1e-9;
const ld PI=3.141592653589793;
const ll MOD = 1e9+7;
const int SQRT = 300;
const int LG=21;
const int FOURIER = (1<<LG);
////////////////
ll a[maxn];
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    for(int  i=1; i<=n; ++i){
        cin>>a[i];
        a[i]=a[i]-i;
    }
    sort(a+1,a+1+n);
    int z=a[(n+1)/2];
    ll ans=0;
    for(int i=1; i<=n; ++i)
        ans+=abs(a[i]-z);
    cout<<ans;
}



Measured memory_bytes: 1792
s = input()
t = input()

def compare(a,b):
    r = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            r += 1
    return r

res = 10000
for i in range(len(s)-len(t)+1):
    res = min(compare(s[i:i+len(t)], t), res)

print(res)

Measured memory_bytes: 9120
#include<algorithm>
#include<cstdio>
using namespace std;
inline void in(int &s){
	s=0;char c=getchar();
	while(c<'0' || c>'9'){
		c=getchar();
	}
	while(c>='0' && c<='9'){
		s=(s<<1)+(s<<3)+c-'0';
		c=getchar();
	}
}
int n,k,x,s[200002],ans;
int cmp(int a,int b){
	return a>b;
}
int main(){
	in(n);in(k);
	for(int i=0;i<n;++i){
		in(x);++s[x];
	}
	sort(s,s+200002,cmp);
	for(int i=k;i<n;++i) ans+=s[i];
	printf("%d",ans);
	return 0;
}

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

using namespace std;
using ll = long long;

int tax_8(int n){
    int t = (n*8)/100;
    return t;
}
int tax_10(int n){
    int t = (n*10)/100;
    return t;
}

int main(){
    int a, b;
    cin >> a >> b;
    rep(i, 1250){
        if(tax_8(i) == a && tax_10(i) == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
public class Main {


  private static void solve() {
    int n = ni();
    long[] a = nal(n);
    
    int mod = 1000000000 + 7;
    
    long[] sum = new long[n + 1];
    long f = 1;
    for (int i = 1; i <= n; i ++) {
      sum[i] = (sum[i - 1] + invl(i, mod)) % mod;;
      f = (f * i) % mod;
    }

    long ret = 0;
    for (int i = 0; i < n; i ++) {
      ret += a[i] * (sum[i + 1] + sum[n - i] - 1) % mod * f % mod;
      ret %= mod;
    }
    System.out.println(ret);
  }

  public static long invl(long a, long mod)
  {
      long b = mod;
      long p = 1, q = 0;
      while(b > 0){
          long c = a / b;
          long d;
          d = a; a = b; b = d % b;
          d = p; p = q; q = d - c * q;
      }
      return p < 0 ? p + mod : p;
  }
  
  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 39388
a, b = map(int, input().split())
c = [list(input())for _ in range(a)]
d = [list(input())for _ in range(b)]
for i in range(a - b + 1):
    for j in range(a - b + 1):
        e = True
        for k in range(i, i + b):
            for l in range(j, j + b):
                if c[k][l] != d[k-i][l-j] and e:
                    e = not e
        if e:
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 3064
NT=input().split()
N=int(NT[0]);T=int(NT[1])
cs=[];ts=[]
for i in range(N):
    ct=input().split()
    cs.append(int(ct[0]))
    ts.append(int(ct[1]))
ts2=[];cs2=[]
for j in ts:
    if j<=T:
        ts2.append(j)
        cs2.append(cs[ts.index(j)])
if ts2==[]:
    print("TLE")
else:
    print(str(min(cs2)))


Measured memory_bytes: 38384