akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000;

typedef long long ll;
typedef unsigned long long ull;

int main(void) {
  int a, b; cin >> a >> b;
  cout << 6 - a - b << endl;
  return 0;
}

Measured memory_bytes: 256
#n , m , l = map(int , input().split())

# list_n = list(map(int , inpuut().split()))<Paste>

#n = input()
# list = [input() for i in range(N)

#list = [[i for i in range(N)] for _ in range(M)]


N, M, C = map(int, input().split())
list_B = list(map(int, input().split()))
ans = 0
for Ni in range(N):
    list_A = list(map(int, input().split()))
    temp = 0
    for Mi in range(M):
        temp += list_A[Mi]*list_B[Mi]
    temp = temp + C
    if temp > 0:
        ans += 1
print(ans)


Measured memory_bytes: 9192
#include <stdio.h>

int main(void)
{
  int res, h, m, s;
  scanf("%d", &res);
  
  h = res / 3600;
  m = (res - h * 3600) / 60;
  s = res - (h * 3600 + m * 60);
  printf("%d:%d:%d\n", h, m, s);

  return 0;
}

Measured memory_bytes: 592
N=int(input())
W=list(map(int,input().split(' ')))
T=0
S1=0
S2=0
list=[]
for j in range(N-1):
    for i in range(N):
        if i<=T :
            S1=S1+W[i]
        else :
            S2=S2+W[i]
    T+=1
    list.append(abs(S1-S2))
    S1=0
    S2=0
print(min(list))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define For(a,b,c) for(int a=(b),a##_end_=(c); a<=a##_end_; ++a)
#define erep(i,G,x) for(int i=(G).Head[x]; i; i=(G).Nxt[i])
const int N = 1e5+5,M = 2e5 + 5;
struct Link_list {
	int Tot,Head[N],Nxt[M<<1],to[M<<1],cost[M<<1];
	inline void clear(void) {
		memset(Head,0,sizeof Head),Tot=0;
	}
	inline void AddEdge(int a,int b,int c) {
		to[++Tot]=b,cost[Tot]=c,Nxt[Tot]=Head[a],Head[a]=Tot;
	}
} G,E;

int n,m,p,vis1[N],vis2[N],vis[N],Q[N];

int d[N],v[N],c[N];

bool SPFA() {
	queue<int> q;
	memset(d,126,sizeof d);
	memset(c, 0, sizeof(c));
	q.push(1),v[1]=1,d[1]=0,c[1]=1;
	while(q.size()) {
		int x = q.front();
		q.pop();
		v[x] = 0;
		for(int i = G.Head[x]; i; i = G.Nxt[i]) {
			int y = G.to[i];
			if(!vis[y])continue;
			if(d[y] > d[x] + G.cost[i]) {
				d[y] = d[x] + G.cost[i];
				if(!v[y]) {
					if(++c[y] >= n) return 1;
					q.push(y),v[y] = 1;
				}
			}
		}
	}
	return 0;
}
int main() {
	cin>>n>>m>>p;
	For(i,1,m) {
		int x,y,z;
		cin>>x>>y>>z;
		G.AddEdge(x,y,p-z);
		E.AddEdge(y,x,p-z);
	}
	int L=0,R=0;
	Q[++R]=n,vis1[n]=1;
	while(L<R) {
		int x=Q[++L];
		erep(i,E,x) {
			int y=E.to[i];
			if(vis1[y])continue;
			vis1[y]=1,Q[++R]=y;
		}
	}
	L=0,R=0;
	Q[++R]=1,vis2[1]=1;
	while(L<R) {
		int x=Q[++L];
		erep(i,G,x) {
			int y=G.to[i];
			if(vis2[y])continue;
			vis2[y]=1,Q[++R]=y;
		}
	}
	For(i,1,n)if(vis1[i]&&vis2[i])vis[i]=1;
	if(!vis[1]||SPFA()) {
		puts("-1");
		return 0;
	}
	if(-d[n]<0)d[n]=0;
	printf("%lld",-d[n]);
}


Measured memory_bytes: 11392
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String input = scanner.nextLine();
        
        int N = Integer.parseInt(input);
        int count = 0;
        for (int i = 1; i <= N; i++) {
            if (i < 10) {
                count++;
                continue;
            }
            String x = String.valueOf(i);
            if(x.length() % 2 != 0) {
                count++;
            }
        }
        
        System.out.println(count);

    }
}

Measured memory_bytes: 30292
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,a,b;
	scanf("%lld%lld%lld",&n,&a,&b);
	ll c=a+b;
	ll k=n/c;
	ll ans=0;
	if(n%c>=a)
	{
		ans+=a;
	}
	else
	{
		ans+=(n%c);
	}
	ans+=(k*a);
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
  ll N, M;
  cin >> N >> M;
  int A[N];
  map<ll, ll> mod;
  ll sum = 0, ans = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    sum = (sum + A[i]) % M;
    ans += mod[sum];
    mod[sum]++;
  }
  ans += mod[0];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4608
import sys
c = [list(map(int, input().split())) for _ in range(3)]

# a1 = 0と仮定
b = []
a = [0]
for i in range(3):
    b.append(c[0][i])

for i in range(3):
    if i == 0:
        continue
    else:
        a.append(c[i][i] - b[i])

for i in range(3):
    for j in range(3):
        if c[i][j] != a[i] + b[j]:
            print("No")
            sys.exit()
print("Yes")



Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

int main(void){
  int i, len;
  char s[1002];

  scanf("%s", s);
  len = strlen(s); //strlenツづ債閉カツ篠堋療アツづ個陳キツつウツづーツ偲ヲツ督セツつキツづゥツ甘鳴青?string.h)

  //ツ静ヲツ督ェツ閉カツ篠堋つゥツづァツ渉?氾板づ可陛渉環キツつオツづ?つ「ツつュ
  for(i = 0; i < len; i++){
    s[i] -= 3; //3ツ閉カツ篠堋閉ェツ暗クツつュ

    if(s[i] < 'A'){ //ツづ?つオツ、'A'ツ暗按湘」ツづ可偲サツづ慊づ?づ?つ「ツづ按つ「ツづ按づァツづ篠、+26ツつオツづ?Z'ツつゥツづァツづ慊づュツづィツつアツづ?
      s[i] += 26;
    }
  }

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

  return 0;
}

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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("b.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	ll a, b;
	cin >> a >> b;
	cout << a * b / __gcd(a, b);

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static void tp_swap(_T& right, _T& left) {
	//	usage:  tp_swap<type name>(a, b);
	_T tmp = right;
	right = left;
	left = tmp;
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}

static void ABC083C_MultipleGift();

#if 1
int main()
{
	ABC083C_MultipleGift();
	fflush(stdout);
	return 0;
}
#endif

static void ABC083C_MultipleGift() {
	LLONG X, Y;
	get2int<LLONG>(X, Y);

	LLONG len = 0;
	LLONG val = X;
	while (val <= Y) {
		len++;
		val *= 2;
	}

	printf("%lld\n", len);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	int N,limit;
  cin >> limit >> N;
  int sum = 0;
  froop1(0,N){
    int a;
    cin >> a;
    sum += a;
  }
  if(limit < sum){
	cout << -1 << endl;
  }else{
    cout << limit - sum << endl;
  }
return 0;
}

Measured memory_bytes: 3472
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long[] n = in.nextLongArray(2);
            if (n[0] == 1 && n[1] == 1) {
                out.println(1);
                return;
            }

            Arrays.sort(n);
            if (n[0] == 1) {
                out.println(Math.max(n[1] - 2, 0));
                return;
            }

            out.println(Math.max(n[0] - 2, 0) * Math.max(n[1] - 2, 0));
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

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

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

    }
}



Measured memory_bytes: 23252
#include <cstdio>
#include <set>
#include <tuple>
#include <algorithm>

typedef std::tuple<int,int> P;

const int INF = 1001001001;

int pixels[301][301];
int sumH[301][301], sumV[301][301];
P _array[301];

int main(){
    int N;
    scanf("%d", &N);

    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            scanf("%d", &pixels[i][j]);
        }
    }

    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            sumH[i][j] += sumH[i][j-1] + pixels[i][j];
            // printf("%d ", sumH[i][j]);
        }
        // puts("");
    }

    // puts(std::string(40, '-').c_str());

    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            sumV[i][j] += sumV[i-1][j] + pixels[i][j];
            // printf("%d ", sumV[i][j]);
        }
        // puts("");
    }

    int res = -INF;
    for(int i=1;i<=N;i++){
        for(int j=i+1;j<=N;j++){
            // std::set<P> set;
            for(int k=1;k<=N;k++){
                _array[k] = std::make_tuple(-(sumH[i][k-1]+sumH[j][k-1]+sumV[j][k]-sumV[i-1][k]), -k);
            }

            std::sort(_array+1, _array+1+N);
            
            for(int k=1,p=1;k<=N;k++){
                int x, idx;
                std::tie(x, idx) = _array[p];
                idx = -idx;

                for(;k<=idx;k++){
                    res = std::max(res, k!=idx ? -x-sumH[i][k]-sumH[j][k]+sumV[j][k]-sumV[i-1][k] : -x-sumH[i][k-1]-sumH[j][k-1]);
                    // printf("(;%d, %d, %d) %d, %d, %d, %d\n", i, j, k, x, idx, -x-sumH[i][k]-sumH[j][k]+sumV[j][k]-sumV[i-1][k], -x-sumH[i][k-1]-sumH[j][k-1]);                                 
                }
                
                while(p <= N){
                    int idx2;
                    std::tie(std::ignore, idx2) = _array[p];
                    idx2 = -idx2;

                    if(idx2 <= idx){++p;}
                    else{break;}
                }
            }
        }

        // std::set<P> set;
        for(int j=1;j<=N;j++){
            _array[j] = std::make_tuple(-sumH[i][j], -j);
        }

        std::sort(_array+1, _array+1+N);
        
        for(int j=1,p=1;j<=N;j++){
            int x, idx;
            std::tie(x, idx) = _array[p];
            idx = -idx;

            for(;j<=idx;j++){
                res = std::max(res, -x-sumH[i][j-1]);
            }

            while(p <= N){
                int idx2;
                std::tie(std::ignore, idx2) = _array[p];
                idx2 = -idx2;
                
                if(idx2 <= idx){++p;}
                else{break;}
            }            
        }
    }

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

Measured memory_bytes: 2080
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const int vx[]={1,0,-1,0}, vy[]={0,1,0,-1};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

ll a[100010], b[100010];

int main(){
	int n; cin >> n;
	REP(i,0,n) cin >> a[i] >> b[i];
	
	ll pos = 0;
	RREP(i, n - 1, 0){
		if(!(a[i] % b[i])) continue;
		a[i] += pos;
		pos += (b[i] - (a[i] % b[i])) % b[i];
	}
	
	cout << pos << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main() {
	char a;
	bool hantei;
	while (cin >> a) {
		int graph[10][10] = {0};
		hantei = false;
		graph[1][1] = a - '0';
		for (int j = 2; j < 9; j++) {
			cin >> a;
			graph[1][j] = a - '0';
		}
		for (int i = 2; i < 9; i++) {
			for (int j = 1; j < 9; j++) {
				cin >> a;
				graph[i][j] = a - '0';
			}
		}
		for (int i = 1; i < 9; i++) {
			for (int j = 1; j < 9; j++) {
				if (graph[i][j] == 1) {
					if (graph[i][j+1] == 1) {
						if (graph[i+1][j+1] == 1) {
							if (graph[i+1][j] == 1) {
								cout << 'A' << endl;
							} else {
								cout << 'E' << endl;
							}
						} else {
							if (graph[i+1][j] == 1) {
								cout << 'G' << endl;
							} else {
								cout << 'C' << endl;
							}
						}
					} else {
						if (graph[i+2][j] == 1) {
							cout << 'B' << endl;
						} else {
							if (graph[i+1][j+1] == 1) {
								cout << 'F' << endl;
							} else {
								cout << 'D' << endl;
							}
						}
					}
					hantei = true;
					break;
				}
			}
			if (hantei == true) {
				break;
			}
		}
	}
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    long long l[87];
    l[0] = 2;
    l[1] = 1;
    for(int i = 2; i < 87; i++){
        l[i] = l[i-1] + l[i-2];
    }
    cout << l[n] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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 P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

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

int n;
cin >> n;
string s,t;
cin >> s >> t;
rep(i,n){
    cout << s[i] << t[i];
}

//////////////////////////////////////////////////////
return 0;}

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

#define endl '\n'
#define all(x) (x).begin(),(x).end()

namespace atcoder {
	using intv = vector<int>;
	using charv = vector<char>;
	using boolv = vector<bool>;
	using floatv = vector<float>;
	using doublev = vector<double>;
	using stringv = vector<string>;

	template<typename T>
	void sort(vector<T>& v){
		sort(all(v));
	}
	template<typename T>
	void sortInv(vector<T>& v){
		sort(all(v), greater<T>());
	}

	template<typename T>
	T sum(const vector<T>& v){
		T ret = 0;
		for(const auto& e : v) ret += e;
		return ret;
	}

	template<typename T>
	inline vector<T>& operator+=(vector<T>& v, const T e){
		v.push_back(e);
		return v;
	}

	template<typename T>
	void in(vector<T>& v){
		for(auto& e : v) cin >> e;
	}

	template<typename T>
	istream& operator>>(istream &stream, vector<T>& v){
		for(auto& e : v) stream >> e;
		return stream;
	}

	template<typename T>
	void out(const vector<T>& v){
		for(const auto& e : v) cout << e << ' ';
		cout << endl;
	}

	template<typename T>
	void outln(const vector<T>& v){
		for(const auto& e : v) cout << e << endl;
	}

	void inline init(){
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}

using namespace atcoder;

int main(){
	init();

	int N;cin>>N;
	string S;cin>>S;
	ll r=0,g=0,b=0;
	for(char c : S){
		if(c=='R')r++;
		if(c=='G')g++;
		if(c=='B')b++;
	}
	ll ans=r*g*b;

	for(int i=0;i<N;i++){
		for(int j=1;i+j*2<N;j++){
			if(S[i]!=S[i+j]&&S[i+j]!=S[i+2*j]&&S[i+2*j]!=S[i]) ans--;
		}
	}
	cout <<ans<<endl;
	
}

Measured memory_bytes: 3652
use std::io::Read;
use std::cmp::max;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let m: usize = iterator.next().unwrap().parse().unwrap();
    let k: usize = iterator.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n).map(|_| iterator.next().unwrap().parse().unwrap()).collect();
    let b: Vec<usize> = (0..m).map(|_| iterator.next().unwrap().parse().unwrap()).collect();

    let mut ans: usize = 0;

    let mut count: usize = 0;
    let mut t: usize = k;
    let mut i: usize = 0;
    while i < n {
        if t >= a[i] {
            t -= a[i];
            count += 1;
            i += 1;
        } else {
            break;
        }
    }
    let mut j: usize = 0;
    while j < m {
        if t >= b[j] {
            t -= b[j];
            count += 1;
            j += 1;
        } else {
            break;
        }
    }
    ans = max(ans, count);

    while i > 0 {
        t += a[i - 1];
        count -= 1;
        i -= 1;
        while j < m {
            if t >= b[j] {
                t -= b[j];
                count += 1;
                j += 1;
            } else {
                break;
            }
        }
        ans = max(ans, count);
    }

    return ans.to_string();
}


Measured memory_bytes: 9400
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<list>
using namespace std;

static const int MAX = 100000;

vector<int>G[MAX];
list<int>Out;
bool V[MAX] = {false};
int N;
int indeg[MAX] = {0};

void bfs(int s){
    queue<int> q;
    q.push(s);
    V[s] = true;
    
    while(!q.empty()){
        int u = q.front();
        q.pop();
        Out.push_back(u);
        
        for(int i = 0;i < G[u].size();++i){
            int v = G[u][i];
            indeg[v]--;
            
            if(indeg[v] == 0 && !V[v]){
                V[v] = true;
                q.push(v);
            }
        }
    }
}

void tsort(){
    for(int u = 0;u < N;++u){
        for(int i = 0;i < G[u].size();++i){
            int v = G[u][i];
            indeg[v]++;
        }
    }
    
    for(int u = 0;u < N;++u){
        if(indeg[u] == 0 && !V[u]){
            bfs(u);
        }
    }
    
    for(list<int>::iterator it = Out.begin();it != Out.end();++it){
        cout << *it << endl;
    }
}

int main(){
    int s,t,m;
    cin >> N >> m;
    
    for(int i = 0;i < m;++i){
        cin >> s >> t;
        G[s].push_back(t);
    }
    tsort();
}



Measured memory_bytes: 6272
#include<bits/stdc++.h>
#pragma warning(disable:4996)
#ifdef _MSC_VER
#  define __builtin_popcount __builtin_popcountll
#  define __builtin_popcountll __popcnt
#endif
#define int long long
using namespace std;
using ll = long long;
using ld = long double;
const long double PI = acos(-1.0);
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
inline void my_io() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << fixed << setprecision(10);
}

signed main() {
	int n;
	cin >> n;
	vector<int>v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	int nakamae = (n - 2) / 2;
	int nakaato = nakamae + 1;
	int ans = 0;
	
	if (v[nakamae] == v[nakaato]) {
		cout << 0 << endl;
		
	}
	
	else {
		cout << v[nakaato] - v[nakamae] << endl;
	}
}


Measured memory_bytes: 1024
#!/usr/bin/python
import sys

t = raw_input()
for i in range(int(t)):
    x = [int(s) for s in raw_input().split()]
    x.sort()
    if x[0] ** 2 + x[1] ** 2 == x[2] ** 2:
        print "YES"
    else:
        print "NO"

Measured memory_bytes: 4236
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>
#include <set>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int n, q; cin >> n >> q;
  vi ans(q, -1);
  viii events;
  rep(i, n) {
    int s, t, x; cin >> s >> t >> x;
    events.pb(mp(s-x, mp(1, x)));
    events.pb(mp(t-x, mp(-1, x)));
  }
  sort(all(events));
  vi d(q);
  rep(i, q) {
    cin >> d[i];
  }

  set<int> closed;
  int di = 0;
  for (auto e : events) {
    int t = e.ff, io = e.ss.ff, x = e.ss.ss;
    while (di<q && d[di]<t) {
      if (!closed.empty()) {
        ans[di] = *closed.begin();
      }
      di++;
    }
    if (io == 1) {
      closed.insert(x);
    } else {
      closed.erase(x);
    }
  }
  rep(i, q) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 23784
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, PY):
    PY = [(p, y, i) for i, (p, y) in enumerate(PY)]
    PY.sort(key=lambda x: x[1])

    id = []
    pc = Counter()
    for p, y, i in PY:
        pc[p] += 1
        id.append(("%06d%06d" % (p, pc[p]), i))

    id.sort(key=lambda x: x[1])
    for s, _ in id:
        print(s)


def main():
    N, M = read_int_n()
    PY = [read_int_n() for _ in range(M)]
    slv(N, M, PY)


if __name__ == '__main__':
    main()


Measured memory_bytes: 63308
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

fn main() {
    input! {
        n: usize,
        s: [Chars; n]
    }

    let mut ans = 0usize;
    'outer: for d in 0..n {
        for y in 0..n {
            for x in 0..n {
                if s[y][(d+x) % n] != s[x][(y+d) % n] {
                    continue 'outer;
                }
            }
        }
        ans += n;
    }
    println!("{}", ans);
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    string S;
    cin >> S;

    --A, --B, --C, --D;

    bool ok = true;

    for (ll i = A; i + 1 <= C; i++) {
        if (S[i] == '#' && S[i + 1] == '#') {
            ok = false;
        }
    }
    for (ll i = B; i + 1 < D; i++) {
        if (S[i] == '#' && S[i + 1] == '#') {
            ok = false;
        }
    }

    if (C > D) {
        bool ok2 = false;
        for (ll i = B; i <= D; i++) {
            if (S[i - 1] == '.' && S[i] == '.' && S[i + 1] == '.') {
                ok2 = true;
            }
        }
        ok &= ok2;
    }

    cout << (ok ? "Yes\n" : "No\n");
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3724
#include <iostream>

using namespace std;

int n,k;
int a[105];
int f[100005];

void inp()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
}

void proc()
{
    f[0] = 0;
    for (int i = 1; i <= k; i++)
    {
        for (int j = 1; j <= n; j++)
        if (i - a[j] >= 0)
        {
            f[i] = max(f[i],1 - f[i-a[j]]);
        }
    }
    if (f[k] == 0) cout << "Second";
    else cout << "First";
}


int main()
{
    inp();
    proc();
    return 0;
}


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

int main(){
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	for(int i=0; i<(ty - sy); i++){
		cout << 'U';
	}
	for(int i=0; i<(tx - sx); i++){
		cout << 'R';
	}
	for(int i=0; i<(ty - sy); i++){
		cout << 'D';
	}
	for(int i=0; i<(tx - sx); i++){
		cout << 'L';
	}
	cout << 'L';
	for(int i=0; i<(ty - sy) + 1; i++){
		cout << 'U';
	}
	for(int i=0; i<(tx - sx) + 1; i++){
		cout << 'R';
	}
	cout << 'D';
	cout << 'R';
	for(int i=0; i<(ty - sy) + 1; i++){
		cout << 'D';
	}
	for(int i=0; i<(tx - sx) + 1; i++){
		cout << 'L';
	}
	cout << 'U';
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<cstring>
#include<climits>
#include<sstream>
#include<deque>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;

#define MAX 100010
int N,T,A[MAX],maxi[MAX];

int main() {
  cin >> N >> T;
  rep(i,N) cin >> A[i];
  maxi[N-1] = A[N-1];
  for(int i=N-2;i>=0;--i) {
    maxi[i] = max(A[i],maxi[i+1]);
  }
  map<int,int> mp;
  int a = 0;
  rep(i,N) {
    a = max(a,maxi[i]-A[i]);
    ++mp[maxi[i]-A[i]];
  }
  cout << mp[a] << endl;
  return 0;
}


Measured memory_bytes: 5760
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<math.h>
using namespace std;

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

	int cnt = 0;
	while (N > 0)
	{
		N -= D * 2 + 1;
		cnt++;
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
while True:
	[H, W] = list(map(int, input().split()))

	if H == 0 and W == 0:
		break

	for i in range(H):
		for j in range(W):
			if i > 0 and i < H - 1 and j > 0 and j < W - 1:
				print(".", end = "")
			else:
				print("#", end = "")
		print("")
	print("")

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

int main() {
	string S; cin >> S;
	if(S[1] == 'R')
		cout << 1 + (S[0] == 'R') + (S[2] == 'R');
	else
		cout << (S[0] == 'R' || S[2] == 'R');
}


Measured memory_bytes: 3544
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


L = LI2()
N = len(L)
mod = 10**9+7

ans = 0
a = 1

for i in range(N):
    if L[i] == 1:
        ans += pow(3,N-i-1,mod)*a
        ans %= mod
        a *= 2
        a %= mod

print((ans+a) % mod)


Measured memory_bytes: 77124
import java.util.Scanner

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val (s, t) = Pair(scn.next(), scn.next())
	var (a, b) = Pair(scn.nextInt(), scn.nextInt())
	val u = scn.next()

	when(u){
		s -> a--
		t -> b--
	}
	print("$a $b")
}

Measured memory_bytes: 31260
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long 
#define int long long 
#define vll vector<long long>
#define pii pair<long long ,long long > 
#define vvi vector< vector<long long > > 
#define vpii vector<pair<int,int>> 
#define pll  pair<long long ,long long > 
#define pb  push_back
#define ff  first 
#define sec second  
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend()) 
#define m_p make_pair
#define all(x) (x.begin(),x.end()) 
#define sz(v) ((int)(v.size()))
#define endl '\n'
typedef vector< long long > vi ;
const int MOD=1e9 +7 ;
int size=10000000; 
 
int32_t main(){
  fast; /*
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif */
	
  int T=1; //cin>>T; 
  while(T--){

  	int h,w; cin>>h>>w; 
  	vector< vector< char > > grid(h,vector< char > (w,0)); 
  	
  	for(int i=0;i<h;i++){
  		for(int j=0;j<w;j++){
  			cin>>grid[i][j]; 
  		}
  	}

  	vector< vi > dp(h,vi(w,0)); 
  	vector< vector< bool > > vis(h,vector< bool >(w,false)); 
  	vis[0][0]=true; 
  	dp[0][0]=1; 

  	for(int i=0;i<h;i++){
  		for(int j=0;j<w;j++){
  			if(vis[i][j] && grid[i][j]!='#'){
  				if(i+1<h){ // down 
  					dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD; 
  					vis[i+1][j]=true; 
  				}
  				if(j+1<w){
  					dp[i][j+1]=(dp[i][j+1]+dp[i][j])%MOD; 
  					vis[i][j+1]=true; 
  				}
  			}
  		}
  	}

  	//debug(dp); 
  	cout<<dp[h-1][w-1]<<endl; 

  

  }
    


  return 0; 
} 


Measured memory_bytes: 9344
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
long long n,ans;
int main(){
	cin>>n;
	ans=n+1;
	for (long long i=1; i<=sqrt(n); i++) {
		if (n % i==0) ans=min(ans,i-1+(n/i)-1); 
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>

using namespace std;

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define mll map<ll,ll>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define srta(a) sort(all(a))
#define srtd(a) sort(all(a),greater<型>())
#define rvs(s) reverse(all(s))
#define psb push_back
#define ppb pop_back
#define isu isupper
#define isl islower

const int I_INF = 1001001001;
const ll LL_INF = 1001001001001001001;
const ld EPS = 0.001;



int main() {
    ll a;
    cin >> a;

    ll s = a+(a*a)+(a*a*a);

    cout << s << endl;
}


Measured memory_bytes: 3632
using System;

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split();
        long N = long.Parse(input[0]);
        long[] a = new long[N];
        long[] b = new long[N];
        long M = long.Parse(input[1]);
        long[] c = new long[M];
        long[] d = new long[M];

        for(long i = 0; i < N; i++)
        {
            input = Console.ReadLine().Split();
            a[i] = long.Parse(input[0]);
            b[i] = long.Parse(input[1]);
        }

        for (long i = 0; i < M; i++)
        {
            input = Console.ReadLine().Split();
            c[i] = long.Parse(input[0]);
            d[i] = long.Parse(input[1]);
        }

        for(long i = 0; i < N; i++)
        {
            long MinTemp = 10000000000;
            long ansIndex = 0;
            for(long j = 0; j < M; j++)
            {
                long temp = Math.Abs(a[i] - c[j]) + Math.Abs(b[i] - d[j]);
                if (MinTemp>temp)
                {
                    MinTemp = temp;
                    ansIndex = j;
                }
            }
            Console.WriteLine(ansIndex+1);
        }
    }
}

Measured memory_bytes: 13140
N, M = [int(i) for i in input().split()]
gate_idx = [[int(i) for i in input().split()] for M in range(M)]
import numpy as np
l_max = np.max(gate_idx, axis=0)
r_min = np.min(gate_idx, axis=0)
ans = r_min[1] - l_max[0] + 1
if ans < 0: ans = 0
print(ans)

Measured memory_bytes: 32028
use std::io::*;
fn main() {
    let mut abt = String::new();
    stdin().read_line(&mut abt).unwrap();
    let abt = abt.trim().split_whitespace().collect::<Vec<&str>>();
    let a: i32 = abt[0].parse().unwrap();
    let b: i32 = abt[1].parse().unwrap();
    let t: i32 = abt[2].parse().unwrap();
    println!("{}", t / a * b)
}


Measured memory_bytes: 4352
<?php
# 文字列の入力
$a = fgets(STDIN);
$b = fgets(STDIN);
$c = fgets(STDIN);

$ans1 = substr($a , 0 ,1 );
$ans2 = substr($b , 1 ,1 );
$ans3 = substr($c , 2 ,1 );


echo $ans1;
echo $ans2;
echo $ans3;

?>


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

int gcd(int a,int b){return b?gcd(b,a%b):a;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}

template<typename T>
void ppp(T n){cout << n << endl;}

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


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef map<int, int> mint;
typedef vector<int> vint;
typedef vector<string> vstr;



vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

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

    int n, m;
    ll ans=0;
    cin >> n >> m;

    vint a(n);
    rep(i, n)
        cin >> a[i];

    mint mp;
    vint sum(n+1);
    sum[0] = 0;
    rep(i, n){
        sum[i+1] = (sum[i] + a[i])%m;
    }
    rep(i, sum.size()){
        ans += mp[sum[i]];
        mp[sum[i]]++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    array<int, (1<<16)> dp{};
    while(cin >> n, n){
        fill(dp.begin(),dp.end(), 0);
        vector<pair<int, int>> u(n);
        for (int i = 0; i < n; ++i) {
            int a;
            cin >> a >> u[i].second;
            int s = 0;
            for (int j = 0; j < a; ++j) {
                int p, q;
                cin >> p >> q;
                for (int k = p; k < q; ++k) {
                    s |= (1<<(k-6));
                }
            }
            u[i].first = s;
        }
        for (int i = 0; i < (1<<16); ++i) {
            for (int j = 0; j < n; ++j) {
                if((i & u[j].first) == u[j].first){
                    dp[i] = max(dp[i], dp[i^u[j].first]+u[j].second);
                }
            }
        }
        cout << *max_element(dp.begin(),dp.end()) << "\n";
    }
    return 0;
}


Measured memory_bytes: 3300
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

typedef long long ll;
typedef vector<int> vi;

const ll INF = 1000000000000000;

int N,K; vi P; vector<ll> C;
void input()
{
    cin >> N >> K;
    P.resize(N); C.resize(N);
    for (int i = 0; i < N; ++i){ 
        cin >> P[i];
        P[i]--;
    }
    for (int i = 0; i < N; ++i) cin >> C[i];
}

void solve()
{
    vector<bool> is_checked(N,false);
    ll ma = -INF;
    for (int i = 0; i < N; ++i){
        if (is_checked[i]) continue;

        is_checked[i] = true;
        int next = P[i];
        vi loop; 
        loop.emplace_back(i);
        ll loop_sum = C[i];
        while (next != i){
            loop.emplace_back(next);
            loop_sum += C[next];
            is_checked[next] = true;
            next = P[next];
        }

        // cout << "group: ";
        // for (int j = 0; j < loop.size(); ++j) cout << loop[j]+1 << " ";
        // cout << "loop_sum: " << loop_sum << endl;

        for (int j = 0; j < loop.size(); ++j){
            ll sum; int move;
            if (loop_sum <= 0){
                sum = 0; 
                move = K;
            } else {
                sum = ((K / loop.size()) - 1) * loop_sum; 
                move = K % loop.size() + loop.size();
            }

            // cout << "sum: " << sum << " move: " << move << endl;

            ll ma_i = -INF; 
            next = P[loop[j]];
            while (next != loop[j] && move > 0){
                sum += C[next];
                --move;
                if (ma_i < sum){
                    ma_i = sum;
                }
                next = P[next];
            }
            if (next == loop[j] && move > 0){
                sum += C[next];
                --move;
                if (ma_i < sum){
                    ma_i = sum;
                }
                next = P[next];
            }
            while (next != loop[j] && move > 0){
                sum += C[next];
                --move;
                if (ma_i < sum){
                    ma_i = sum;
                }
                next = P[next];
            }

            // cout << loop[j]+1 << " " << ma_i << endl;
            
            ma = max (ma, ma_i);
        }
        // cout << endl;
    }

    cout << ma << endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3748
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;



int main(){
  ios_base::sync_with_stdio(false);

  int n,k;
  int x;
  int ans = 0;

  cin >> n >> k;
  for(int i=0;i<n;i++){
    cin >> x;

    ans += min(x, abs(k-x)) * 2;

  }

  cout << ans << endl;

  return 0;
}


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

double solve() {
    ll N, M, D;
    cin >> N >> M >> D;
    ll c;
    if ( D > 0 ) {
        ll w = max(N-2*D, 0LL);
        c = (N-w) + w*2;
    } else {
        c = N;
    }
    double ans = c * (M-1) / (double)(N*N);
    return ans;
}

int main() {
    cout.setf(ios::fixed);
    cout.precision(16);
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;

int H,W;

string COUNT(int i,int j, vector<vector<char>> S){
    if (S[i][j] == '#') return "#"; 
    int ans = 0;
    vector<int> v{-1,0,1};
    for(int h : v){
        for(int w : v){
            if(i+h < 0 || j+w < 0 || i+h >= H || j+w >=W) continue;
            if (S[i+h][j+w] == '#') ans++;
        }
    }
    return to_string(ans);
}

int main() {
    cin >> H >> W;
    vector<vector<char>> S(H,vector<char> (W));
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++) cin >> S[i][j];
    }

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cout << COUNT(i,j,S);
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i, n) for(int i = 1; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	int h, n; cin >> h >> n;
	int cnt = 0;
	REP(i, n) {
		int a;
		cin >> a;
		cnt += a;
		if (cnt >= h) {
			cout << "Yes" << endl;
			break;
		}
	}
	if (cnt < h) {
		cout << "No" << endl;
	}
}

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

int main() 
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    
    int ans = 0;
    for (int i = 0; i < S.length(); i++) {
        string str1 = S.substr(0,i);
        string str2 = S.substr(i, S.length());
        
        set<char>st;
        for (int i = 0; i < str2.length(); i++) {
            for (int j = 0; j < str1.length(); j++) {
                if (str2[i] == str1[j]) {
                    st.insert(str2[i]);
                }
            }
        }
        int A = (int)st.size();
        ans = max(ans, A);
    }
    cout << ans << endl;
}

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

template <class T, class U>
inline bool chmax(T& t, const U& f) { return t < f ? t = f, true : false; }

inline bool isvowel(char c) {
    for (char x : "aeiou") if (c == x) return true;
    return false;
}

int main() {
    for (int n; cin >> n, n;) {
        vector<string> code(n, "");
        int m = 1;
        rep(i, n) {
            string s; cin >> s;
            code[i] += s[0];
            rep(j, s.size() - 1u) if (isvowel(s[j])) code[i] += s[j + 1];
            chmax(m, code[i].size());
        }
        bool ok = true;
        for (int k = 1; k <= m; ++k) {
            ok = true;
            set<string> s;
            for (auto& e : code) {
                if (!s.insert(e.substr(0, k)).second) {
                    ok = false;
                    break;
                }
            }
            if (!ok) continue;
            cout << k << endl;
            break;
        }
        if (!ok) cout << -1 << endl;
    }
}

Measured memory_bytes: 3144
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef pair<pair<int, int>, int> PP;
typedef long long ll;
typedef priority_queue<int> pq;
int s1c[27];
int s2c[27];
int main(void) {
    string s1, s2;
    cin >> s1 >> s2;
    for(int i = 0; i < s1.size(); i++){
        s1c[s1[i]-'a']++;
        s2c[s2[i]-'a']++;
    }
    sort(s1c, s1c+27, greater<int>());
    sort(s2c, s2c+27, greater<int>());
    int i;
    for(i = 0; i < 27; i++){
        if(s1c[i] != s2c[i])break;
    }
    if(i!=27){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
#define taskname "test1"
#define int long long
using namespace std;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);   cout.tie(nullptr);
    if (ifstream("test.inp"))
    {
        freopen("test.inp", "r", stdin);
        #ifdef CHECKING
            freopen(taskname".out", "w", stdout);
        #else
            freopen("test.out", "w", stdout);
        #endif //CHECKING
    }
    else if (ifstream(taskname".inp"))
    {
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }

    int n;  cin >> n;
    cout << ((n / 111) + (n % 111 != 0)) * 111;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
//#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	while(cin>>n>>m,n){
		vip in(m);
		rep(i,m)cin>>in[i].first>>in[i].second.first>>in[i].second.second;
		sort(all(in));
		vi out(n+1);
		out[1]=1;
		rep(i,m)out[in[i].second.second]|=out[in[i].second.first];
		int co=0;
		rep(i,n+1)co+=out[i];
		cout<<co<<endl;
	}
}

Measured memory_bytes: 3716