akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int tmp_c=0;
int H,W,N,i,j,mh[4]={0,0,1,-1},mw[4]={1,-1,0,0},flg[31][31];
char M[31][31],T[31][31],t;
int limW(int w){return 0<=w&&w<W;}
int limH(int h){return 0<=h&&h<H;}
int dfs(char(*M)[31],int h,int w,int d,char t)
{
	int r=0;
	if(limW(w)&&limH(h)&&M[h][w]==t)
		r=dfs(M,h+mh[d],w+mw[d],d,t)+1;
	return r;
}
void swap(char *a,char *b){char c=*a;*a=*b;*b=c;}
void drop(char(*M)[31])
{
	int h,w,lp[31];
	for(w=0;w<W;w++)
		lp[w]=H;
	for(h=H-1;h>=0;h--)
		for(w=0;w<W;w++)
		{
			if(M[h][w]!='.')
			{
				if(h<H-1&&M[h+1][w]=='.')
				{
					swap(&M[lp[w]-1][w],&M[h][w]);
					lp[w]--;
				}
				else 
					lp[w]=h;
			}
		}
}
void del(char(*M)[31],int h,int w,int d,int c)
{
	int i;
	for(i=0;i<c;h+=mh[d],w+=mw[d],i++)
		flg[h][w]=1;
}
int judge(char(*M)[31])
{
	int h,w,c[4],i,f=0;
	for(h=0;h<H;h++)
		for(w=0;w<W;w++)
		{
			if(M[h][w]!='.'&&flg[h][w]==0)
			{
				for(i=0;i<4;i++)
					c[i]=dfs(T,h+mh[i],w+mw[i],i,M[h][w]);
				if(c[0]+c[1]+1>=N)
				{
					flg[h][w]=1;
					del(T,h+mh[0],w+mw[0],0,c[0]);
					del(T,h+mh[1],w+mw[1],1,c[1]);
					f=1;
				}
				if(c[2]+c[3]+1>=N)
				{
					flg[h][w]=1;
					del(T,h+mh[2],w+mw[2],2,c[2]);
					del(T,h+mh[3],w+mw[3],3,c[3]);
					f=1;
				}
			}
		}
	for(h=0;h<H;h++)
		for(w=0;w<W;w++)
			if(flg[h][w])
				M[h][w]='.';
	return f;
}
int check(char(*M)[31])
{
	int h,w;
	for(h=0;h<H;h++)
		for(w=0;w<W;w++)
			if(M[h][w]!='.')
				return 0;
	return 1;
}
int main()
{
	
	scanf("%d%d%d\n",&H,&W,&N);
	for(i=0;i<H;i++)gets(M[i]);
	for(i=0;i<H;i++)
		for(j=0;j<W-1;j++)
		{
			memcpy(T,M,sizeof(T));
			
			if(T[i][j]!='.'||T[i][j+1]!='.')
			{
				swap(&T[i][j],&T[i][j+1]);
				do{
				memset(flg,0,sizeof(flg));
				drop(T);
				}while(judge(T));
				if(check(T))
				{
					puts("YES");
					return 0;
				}
			}
		}
	puts("NO");
	return 0;
}

Measured memory_bytes: 584
// MACRO FOR INPUT
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
use std::io::{Write, BufWriter}; //for output

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
////////////////////////////////////////////////////////

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
        n: usize,
        s: chars,
        t: chars,
    };
    for i in 0..n{
        puts!("{}{}", s[i],t[i]);
    }

}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Measured memory_bytes: 8444
/*
 It's better to sleep happy and tired rather than disappointed and frustrated
 There's only 1 thing that's impossible and that is defeating a man who doesn't give up
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mx2 102
#define mx3 1003
#define mx4 10004
#define mx5 100005
#define mx6 1000006
#define mod 1000000007
#define PI 3.14159265
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0 ; i<n ; i++)
#define Fo(i,k,n) for(int i=k ; i<n ; i++)
 
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pair<int,int>,int> piii;

const int inf=0x3f3f3f3f;
int n , ans , sum , a , b ,arr[mx5],dp[mx5];
string str;

int solve(int i)
{
	if(i==n-1)
	{
		return 0;
	}
	if(i>n-1)
	{
		return inf;
	}
	if(dp[i]!=-1)
	{
		return dp[i];
	}
	return dp[i]=min(solve(i+1)+abs(arr[i+1]-arr[i]),solve(i+2)+abs(arr[i]-arr[i+2]));
}

 
int main() {
	ios::sync_with_stdio(false);
	//int t;cin>>t;while(t--)
	{
		cin>>n;
		fo(i,n)
		{
			cin>>arr[i];
		}
		memset(dp,-1,sizeof(dp));
		cout<<solve(0);
	}
	return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=1000000007;
inline void add(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}


int pc[1<<15];

int N,M;
int G[15];
int rG[15];
int dp[1<<15];

signed main(){
    cin>>N>>M;
    rep(i,M){
        int x,y;
        cin>>x>>y;
        x--;y--;
        G[x]|=1<<y;
        rG[y]|=1<<x;
    }

    rep(i,1<<15)pc[i]=__builtin_popcount(i);

    dp[0]=1;
    rep(i,1<<N){
        int sup=(1<<N)-1-i;
        int sub=sup;
        do{
            int O=(1<<N)-1-i-sub;
            if(sub!=0&&(sub&3)!=3){
                int w=1;
                rep(j,N){
                    if(i>>j&1){
                        w=w*(1<<pc[G[j]&sub])%mod;
                    }
                    else if(O>>j&1){
                        w=w*((1<<pc[G[j]&sub])-1)%mod;
                    }
                }

                add(dp[i|sub],dp[i]*w%mod);
            }
            sub=(sub-1)&sup;
        }while(sub!=sup);
    }


    cout<<dp[(1<<N)-1]<<endl;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if (n == 3) {
        cout << "2 5 63" << '\n';
        return 0;
    }
    int a = 0, b = n;
    for (int i = 2; i <= 30000; i += 2) {
        a++;
        b--;
        if (a % 3 != 1 && b % 2 == 0 && 2 <= b && b <= 5000) {
            break;
        }
    }
    // vector<ll> ans;
    for (int i = 2; i <= 30000; i++) {
        if (a != 0 && i % 2 == 0) {
            cout << i << " ";
            // ans.emplace_back(i);
            a--;
        } else if (b != 0 && i % 3 == 0 && i % 2 != 0) {
            cout << i << " ";
            // ans.emplace_back(i);
            b--;
        }
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;

int main()

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

    ll n, a, b, tmp;

    cin >> n >> a >> b;

    if ((b-a)%2LL == 0) cout << (b-a)/2LL;
    else cout << min(n-b, a-1) + 1 + ((b-a-1)/2LL);

    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int A = scan.nextInt();

		System.out.println(N * N - A);

	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 27092
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	char a, b;

	cin >> a >> b;

	if (a > b) {
		cout << ">" << endl;
	}
	else if (a < b) {
		cout << "<" << endl;
	}
	else {
		cout << "=" << endl;
	}
}

Measured memory_bytes: 256
from itertools import combinations

n = int(input())
l = list(map(int, input().split()))

ans = 0
for a, b, c in combinations(l, 3):
    if a == b or b == c or c == a:
        continue
    if a + b > c and b + c > a and c + a > b:
        ans += 1
print(ans)


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

int main()
{
    int N;
    cin>>N;
    vector<char>ans;
    string S;
    cin>>S;
    if(N==1){
        cout<<1;
        exit(0);
    }
    for(int i=0;i<N-1;i++){
        if(S.at(i)!=S.at(i+1)){
            ans.push_back(S.at(i));
        }
        if(i==N-2){
            if(S.at(i)==S.at(i+1)){
                ans.push_back(S.at(i));
            }else{
                ans.push_back(S.at(i+1));
            }
        }
    }
    cout<<ans.size();
}

Measured memory_bytes: 640
import sys
input = sys.stdin.buffer.readline

def main():
    N,K = map(int,input().split())
    H = list(map(int,input().split()))
    H = [0]+H
    INF = 10**15
    
    dp = [INF]*(N+1)
    dp[0] = 0
    for i in range(N-K):
        use = [INF]*(N+1)
        for j in range(i,N+1):
            for k in range(j+1,N+1):
                use[k] = min(use[k],dp[j]+max(0,H[k]-H[j]))
        dp = use
    
    print(min(dp))

if __name__ == "__main__":
    main()


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

int main()
{
	int s;
	cin >> s;
	if (s < 0 || s > 86400) {
		cout << "invalid second minutes.\n";
	} else {
		int h = s / 3600;
		int h_mod = s % 3600;
		int m = h_mod / 60;
		int s = h_mod % 60;

		cout << h << ":" << m << ":" << s << "\n";
	}

	return 0;
}

Measured memory_bytes: 1164
program prob3
    implicit none
    integer(16)::n, a, b, ans
    read(*,*) n, a, b
    if(mod(b-a,2) == 0) then
        write(*,*) (b-a)/2
    else
        if(a-1 <= n-b) then
            ans = a - 1
            ans = ans + 1
            ans = ans + (b-a-1)/2
        else
            ans = n - b
            ans = ans + 1
            ans = ans + (b-a-1)/2
        end if
        write(*,*) ans
    end if
    stop
end program

Measured memory_bytes: 2784
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    int n;
    cin>>n;
    ll a[n];
    rep(i,n){
        cin>>a[i];
    }
    ll sum[n+1]={};
    for(int i=0;i<n;i++){
        sum[i+1]=sum[i]+a[i];
    }
    ll ans=0;
    sort(sum,sum+n+1);
    int ind=0;
    while(ind<n+1){
        ll tmp=sum[ind],c=0;
        while(sum[ind]==tmp){
            ind++;c++;
        }
        if(c==0) ind++;
        ans+=c*(c-1)/2;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  double a, b, c, d;
  int n;
  a = 0;
  cin >> n;
  int g[n];
  int h[n];
  double k[n * (n - 1) / 2];
  for(int i = 0; i < n; i++)
    cin >> g[i] >> h[i];
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      b = (g[i] - g[j]) * (g[i] - g[j]);
      c = (h[i] - h[j]) * (h[i] - h[j]);
      a = a + sqrt(b + c);
    }
  }
  d = 2.0000000 * a / n;
  cout << fixed << setprecision(7);
  cout << d << endl;
}

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

signed main() {
  int n, m;
  cin >> n >> m;
  vector<int> sw(n, 0);
  int p = 0, ans = 0;
  rep(i, m) {
    int x;
    cin >> x;
    rep(j, x) {
      int y;
      cin >> y;
      y--;
      sw[y] |= (1 << i);
    }
  }

  rep(i, m) {
    int x;
    cin >> x;
    p |= (x << i);
  }

  for (int bit = 0; bit < 1 << n; bit++) {
    int tmp = 0;
    for (int i = 0; i < n; i++) {
      if ((bit >> i) & 1) tmp ^= sw[i];
    }
    if (tmp == p) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input!{
        source = src,
        n: usize,
        p: [usize; n],
    }
 
    let mut min = p[0];
    let mut count = 0;
    for i in 0..n {
        if min >= p[i] {
            count += 1;
            min = p[i];
        }
    }
    
    return count.to_string();
}



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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  vector<int> V(2*N, 0);
  REP(i, 2*N){
    V[i] = i;
  }
  int M; cin >> M;
  vector<int> VV(2*N, 0);
  REP(i, M){
    int K; cin >> K;
    V.swap(VV);
    if(K == 0){
      // リシャッフルの処理
      REP(i, N){
        V[i*2] = VV[i];
        V[i*2+1] = VV[N+i];
      }
    }else{
      // カットの処理
      REP(i, 2*N){
        if(i < K){
          V[2*N-K+i] = VV[i];
        }else{
          V[i-K] = VV[i];
        }
      }
    }
  }
  REP(i, 2*N){
    cout << V[i]+1 << endl;
  }
}


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

int main() {
    int N, M;
    cin >> N >> M;
    if (N%2 == 1) {
        for (int i = 1; i <= M; i++) {
            cout << i << " " << N+1-i << "\n";
        }
    }else if (N%4 == 0) {
        for (int i = 1; i <= M/2+1; i++) {
            cout << i << " " << N+1-i << "\n";
        }
        for (int i = M/2+2; i <= M; i++) {
            cout << i << " " << N-i << "\n";
        }
    }else {
        for (int i = 1; i <= M/2; i++) {
            cout << i << " " << N+1-i << "\n";
        }
        for (int i = M/2+1; i <= M; i++) {
            cout << i << " " << N-i << "\n";
        }
    }
    return 0;
}


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

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

using namespace std;

const int mxN = 1000010;

int spf[mxN];

void sieve() {
  spf[1] = 1;
  for (int i = 2; i < mxN; i++) {
    spf[i] = i;
  }
  for (int i = 4; i < mxN; i += 2) {
    spf[i] = 2;
  }
  for (int i = 3; i * i < mxN; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j < mxN; j += i) {
        if (spf[j] == j) spf[j] = i;
      }
    }
  }
}

set<int> getFactorization(int n) {
  set<int> res;
  while (n != 1) {
    res.emplace(spf[n]);
    n = n / spf[n];
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  sieve();
  int n;
  cin >> n;
  vector<int> cnt(mxN, 0);
  rep(_, n) {
    int a;
    cin >> a;
    auto f = getFactorization(a);
    for (auto&& e : f) {
      cnt[e]++;
    }
  }
  bool pc = true, sc = true;
  rep(i, mxN) {
    if (cnt[i] > 1) pc = false;
    if (cnt[i] == n) sc = false;
  }
  if (pc) {
    cout << "pairwise coprime";
  } else if (sc) {
    cout << "setwise coprime";
  } else {
    cout << "not coprime";
  }
  return 0;
}

Measured memory_bytes: 11120
#include<bits/stdc++.h>
using namespace std;
int n,s,sum=0;
char a;
int main()
{
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	cin>>a;
    	if(a=='I') s++;
    	else if(a=='D') s--;
    	if(s>sum) sum=s;
    }
    cout<<sum;

   return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,m,d,e,g,i,j,k,f,t,x,y,p,q;
long long A,B,C,X,Y,Z;
long long MIN ,ans,sum=0,MAX,num;
long long a[200050],b[200050],s[20000];
char str[200050];


int main()
{
    scanf("%lld",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        b[a[i]]++;
    }
    for(i=1;i<=n;i++)
        sum+=b[i]*(b[i]-1)/2;
    for(i=1;i<=n;i++)
    {
        ans=sum;
        if(b[a[i]]>1)
        {
            ans=ans-b[a[i]]*(b[a[i]]-1)/2+(b[a[i]]-1)*(b[a[i]]-2)/2;
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

template<class T> struct Polynomial {
private:
    using CMP = complex<double>;
    void dft(vector<CMP>& f, int n, bool inverse){
        if(n==1) return;
        const double PI = acos(-1);
    
        vector<CMP> f0, f1;
        for(int i=0; i<n/2; i++){
            f0.push_back(f[2*i]);
            f1.push_back(f[2*i+1]);
        }
    
        dft(f0, n/2, inverse);
        dft(f1, n/2, inverse);
    
        CMP zeta, pow_zeta = 1.0;
        if(inverse){
            zeta = cos(2*PI/n) + sin(2*PI/n) * 1i;
        }else{
            zeta = cos(2*PI/n) - sin(2*PI/n) * 1i;
        }
        for(int i=0; i<n; i++){
            f[i] = f0[i%(n/2)] + pow_zeta * f1[i%(n/2)];
            pow_zeta *= zeta;
        }
    }
    
    vector<long long> convolution(vector<CMP> f, vector<CMP> g){
        int n = pow(2, ceil(log2(f.size() + g.size())));
        f.resize(n);
        g.resize(n);
        dft(f, n, false);
        dft(g, n, false);
    
        vector<CMP> h(n);
        for(int i=0; i<n; i++) h[i] = f[i] * g[i];
        dft(h, n, true);
    
        vector<long long> ret(n);
        for(int i=0; i<n; i++) ret[i] = round(h[i].real()/n);
        return ret;
    }

public:
    int n;
    vector<T> p;

    Polynomial() {}
    Polynomial(int n) : n(n) { p.assign(n+1, T{}); }
    Polynomial(int n, T val) : n(n) { p.assign(n+1, val); }
    Polynomial(vector<T> v) : n(v.size()-1), p(v) {}

    Polynomial operator-() {
        auto res = Polynomial(n);
        for(int i=0; i<=n; i++)  res.p[i] = -p[i];
        return res;
    }

    Polynomial operator+=(Polynomial x) {
        n = max(n, x.n);
        p.resize(n);
        for(int i=0; i<=n; i++)  p[i] += x[i];
        return *this;
    }

    Polynomial operator*=(Polynomial x) {
        n += x.n;
        vector<CMP> c1(p.begin(), p.end());
        vector<CMP> c2(x.p.begin(), x.p.end());
        p = convolution(c1, c2);
        p.resize(n+1);
        return *this;
    }

    Polynomial operator+(Polynomial x) { return Polynomial(p) += x; }
    Polynomial operator-(Polynomial x) { return Polynomial(p) += -x; }
    Polynomial operator*(Polynomial x) { return Polynomial(p) *= x; }

    T operator[](int i) { return (i < 0 || i > n) ? T{} : p[i]; }
};
using poly = Polynomial<lint>;

int main() {
    lint n, m;
    cin >> n >> m;

    poly a(1e5);
    for(int i=0; i<n; i++) {
        int tmp;
        cin >> tmp;
        a.p[tmp]++;
    }
    a *= a;

    lint ans = 0;
    for(lint i=2e5; i>=0; i--) {
        lint c = min(m, a.p[i]);
        m -= c;
        ans += c * i;
        if(m == 0)  break;
    }

    cout << ans << endl;
}

Measured memory_bytes: 25668
use proconio::input;

fn main() {
  input! {
    n: usize,
    ais: [usize;n]
  }
  let mut result: Vec<usize> = vec![];
  let mut dp: Vec<usize> = vec![0;n+1];
  let mut index = n - 1;
  loop {
    let dp_index = index + 1;
    let mut sum = 0;
    
    for i in 1.. {
      let val = dp_index * i;
      if val > n {
        break
      }
      sum += dp[val];
    }
    
    if sum % 2 != ais[index] {
      result.push(dp_index);
      dp[dp_index] = 1;
    }
    
    if index == 0 {
      break
    }
    index -= 1;
  }
  
  result.sort();
  println!("{}", result.len());
  if !result.is_empty() {
    println!("{}", result
                    .into_iter()
                    .map(|i| i.to_string())
                    .collect::<Vec<String>>()
                    .join(" ")
    );
  }
}

Measured memory_bytes: 12844
#include<iostream>
using namespace std;
int absDiff(int a,int b) {
	return a > b ? a - b : b - a;
}
int main() {
	int i,n;
	cin>>n;
	int a[n],dp[n]={0};
	for(i=0;i<n;i++)
		cin>>a[i];
	for(i=1;i<n;i++){
		if(i==1){
			dp[i] = absDiff(a[i],a[i-1]);
		}else{
			dp[i] = min(absDiff(a[i],a[i-1]) + dp[i-1],absDiff(a[i],a[i-2]) + dp[i-2]);
		}
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int bubbleSort(int* A, int N)
{
	bool flag = 1;
	int count = 0;

	while (flag)
	{
		flag = 0;
		for (int j = N - 1; j > 0; j--)
		{
			if (A[j] < A[j - 1]) {
				swap(A[j], A[j - 1]);
				count++;
				flag = 1;
			}
		}
	}

	return count;
}

int main() 
{
	int N;
	int A[100];

	cin >> N;

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

	int count = bubbleSort(A, N);

	for (int i = 0; i < N; i++)
	{
		if (i) cout << " ";
		cout << A[i];
	}

	cout << endl;
	cout << count << endl;

	return 0;
}


Measured memory_bytes: 3100
n=int(input())
s=list(input())
sharp=[0]*n
dot=[0]*n
if s[0]=="#":
    sharp[0]+=1
else:
    dot[0]+=1
for i in range(1,n):
    if s[i]=="#":
        sharp[i]=sharp[i-1]+1
        dot[i]=dot[i-1]
    else:
        sharp[i]=sharp[i-1]
        dot[i]=dot[i-1]+1
MIN=3*10**6
for i in range(n):
    if s[i]=="#":
        MIN=min(MIN,(sharp[i]-1)+(dot[-1]-dot[i]))
    else:
        MIN=min(MIN,sharp[i]+(dot[-1]-dot[i]))
print(MIN)

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

int main(void){
  string s;
  cin>>s;
  int temp=(s.size()-3)/2;
  bool result=true;
  for(int i=0;i<temp;i++){
    if(s[i]!=s[temp-i]){
      result=false;
      break;
    }
  }
  for(int i=temp+2;i<s.size();i++){
    if(s[i]!=s[s.size()-i-1]){
      result=false;
      break;
    }
  }
  if(result) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define tam 5120
#define offset 320000
#define se second
#define fi first
#define pitem item*
#define forr(i,p,n) for(ll i=p;i<n;i++)
using namespace std;
typedef long long ll;
const ll MOD=1000000009 ;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
typedef pair<string,int> ii;
typedef pair<int,int> II;
vector<int> on[tam];

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int N,K;
    cin>>N>>K;
    deque<int> cola1;
    int val;
    forr(i,0,N)
    {
        cin>>val;
        cola1.push_back(val);
    }
    int maxx=0,auxiz,auxder,tot,auxk;
    deque<int> cola2;

    forr(k1,0,K+1)
    {
        
        forr(iz,0,k1+1)
        {
            auxiz=iz;
            cola2=cola1;
            tot=0;
            priority_queue<int,vector<int>,greater<int> >cola;
            auxder=k1-iz;
            //<<auxiz<<" "<<auxder<<endl;
            while(auxiz--)
            {
                if (!cola2.empty())
                {
                    //<<cola2.front()<<" ";
                    tot+=cola2.front();
                    if (cola2.front()<0)
                        cola.push(cola2.front());
                    cola2.pop_front();
                }
            }
            //<<endl;
            while(auxder--)
            {
                if (!cola2.empty())
                {
                    tot+=cola2.back();
                    //<<cola2.back()<<" ";
                    if (cola2.back()<0)
                        cola.push(cola2.back());
                    cola2.pop_back();
                }
            }
            //<<endl;
            auxk=K-k1;
            ////<<auxk<<" "<<tot<<" ";
            while(auxk>0&& !cola.empty())
            {
                tot-=cola.top();
                cola.pop();
                auxk--;
            }
            ////<<tot<<endl;
            ////<<"fin\n";
            maxx=max(maxx,tot);
        }
    }
    cout<<maxx<<endl;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] v = new int[N];
        HashMap<Integer, Integer> emap = new HashMap<>();
        HashMap<Integer, Integer> omap = new HashMap<>();
        for (int i = 0; i < N; i++) {
            v[i] = scan.nextInt();
            HashMap<Integer, Integer> map = i % 2 == 1 ? omap : emap;
            if (!map.containsKey(v[i])) {
                map.put(v[i], 0);
            }
            int count = map.get(v[i]);
            map.put(v[i], count+1);
        }
        TreeMap<Integer, List<Integer>> etmap = convert(emap);
        TreeMap<Integer, List<Integer>> otmap = convert(omap);
        int[] etop2 = top2(etmap);
        int[] otop2 = top2(otmap);
        long answer = Long.MAX_VALUE;
        if (etop2[0] != otop2[0]) {
            int a = etop2[0] == -1 ? 0 : emap.get(etop2[0]);
            int b = otop2[0] == -1 ? 0 : omap.get(otop2[0]);
            long t= Math.abs(a-N/2) + Math.abs(b-N/2);
            answer = t;
        } else {
            int a1 = etop2[0] == -1 ? 0 : emap.get(etop2[0]);
            int b1 = otop2[0] == -1 ? 0 : omap.get(otop2[0]);
            int a2 = etop2[1] == -1 ? 0 : emap.get(etop2[1]);
            int b2 = otop2[1] == -1 ? 0 : omap.get(otop2[1]);
            long t1= Math.abs(a1-N/2) + Math.abs(b2-N/2);
            long t2= Math.abs(a2-N/2) + Math.abs(b1-N/2);
            answer = Math.min(t1, t2);
        }
        System.out.println(answer);
    }
    public int[] top2(TreeMap<Integer, List<Integer>> tm) {
        int[] top2 = new int[2];
        top2[0] = -1;
        top2[1] = -1;
        Map.Entry<Integer, List<Integer>> ef = null;
        while (top2[0] == -1 || top2[1] == -1) {
            ef = tm.pollFirstEntry();
            if (ef == null) {
                break;
            }
            for (int x : ef.getValue()) {
                if (top2[0] == -1) {
                    top2[0] = x;
                    continue;
                }
                if (top2[1] == -1) {
                    top2[1] = x;
                }
            }
        }
        return top2;
    }
    public TreeMap<Integer, List<Integer>> convert(HashMap<Integer, Integer> map) {
        TreeMap<Integer, List<Integer>> tmap = new TreeMap<>(Comparator.reverseOrder());
        for(int x : map.keySet()) {
            int c = map.get(x);
            if (!tmap.containsKey(c)) {
                tmap.put(c, new ArrayList<>());
            }
            tmap.get(c).add(x);
        }
        return tmap;
    }
}


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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,h,w; cin>>n>>h>>w; cout<<(n-h+1)*(n-w+1)<<"\n";
	return 0;
}

Measured memory_bytes: 256
//            ____             ____
//           /@@@@\           |@@@@|      ____
//          /@@@@@@\          |@@@@|     |@@@@|
//         /@@@@@@@@\         |@@@@|   __|@@@@|___    ____       ____      ___  _________     ____        ____    ____________      ___  _________     ____         ____
//        /@@@@/\@@@@\        |@@@@|   @@@@@@@@@@@   |@@@@|     |@@@@|    |@@@\/@@@@@@@@@\   (@@@@\      /@@@@)  /@@@@@@@@@@@@|    |@@@\/@@@@@@@@@\   (@@@@\       /@@@@)
//       /@@@@/  \@@@@\       |@@@@|     |@@@@|      |@@@@|     |@@@@|    |@@@@|    \@@@@@|   \@@@@\    /@@@@/  |@@/     |@@@@|    |@@@@|    \@@@@@|   \@@@@\     /@@@@/
//      /@@@@(____)@@@@\      |@@@@|     |@@@@|      |@@@@|     |@@@@|    |@@@@|     |@@@@|    \@@@@\  /@@@@/            |@@@@|    |@@@@|     |@@@@|    \@@@@\   /@@@@/
//     /@@@@@@@@@@@@@@@@\     |@@@@|     |@@@@|      |@@@@|     |@@@@|    |@@@@|     |@@@@|     \@@@@\/@@@@/    /@@@@@@@@@@@@@|    |@@@@|     |@@@@|     \@@@@\ /@@@@/
//    /@@@@@@@@@@@@@@@@@@\    |@@@@|     |@@@@|___   |@@@@|____/@@@@@|    |@@@@|     |@@@@|      \@@@@@@@@/    (@@@@(   )@@@@@|    |@@@@|     |@@@@|      \@@@@|@@@@/
//   /@@@@/          \@@@@\   |@@@@|     |@@@@@@@@    \@@@@@@@@@@@@@@|    |@@@@|     |@@@@|       \@@@@@@/      \@@@@\_/@@@@@@|    |@@@@|     |@@@@|       \@@@@@@@/
//  /@@@@/            \@@@@\  |@@@@|      \@@@@@@/      \@@@@@/  \@@@|    |@@@@|     |@@@@|        )@@@@/        \@@@@@@@/\@@@|    |@@@@|     |@@@@|        \@@@@@/
//                                                                                                (@@@@/

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

using namespace std;
// using namespace __gnu_pbds;

//-----------------------------------------------
#define all(x)  x.begin(), x.end()
#define sz(x)   (int)x.size()
#define sq(x)   (x) * (x)
#define fr      first
#define sc      second
//-----------------------------------------------
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pli = pair<ll, int>;

const int N = 1000 * 1000 + 5;
const ll mod = 1000000007;
const ll INF = 1000000000 * 1ll * 1000000000 + 500000;
const ld pi = acosl(-1.0);

ll a, b, c, d;

void input() {
    cin >> a >> b >> c >> d;
}

void solve(int testId) {
    ll ans = LLONG_MIN;
    ans = max(a * c, ans);
    ans = max(a * d, ans);
    ans = max(b * c, ans);
    ans = max(b * d, ans);
    cout << ans << endl;
}

int main() {
    // freopen("test", "r", stdin);
    int testcases = 1;
    // scanf("%d", &testcases);
    for(int testId = 1; testId <= testcases; testId++) {
        input();
        solve(testId);
    }
    return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <cmath>
using namespace std;

typedef long long ll;
const ll inf = 1e15;

int main() {
    ll a,b,c; cin >> a >> b >> c;
    ll z = (c - a - b) * (c - a -b);
    if (c - a - b > 0 && z > 4 * a * b) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,ans;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=4;i<=n;i++){
		for(int j=2;j<=i;j++){
			if(j<10&&i%j==0&&i/j>=2&&i/j<10&&j*10+(i/j)<=m){
				ans++;
				//printf("%d-%d\n",i,j*10+(i/j));
			}
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
import itertools
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))

D, G = inpl()
G //= 100
pc = [inpl() for _ in range(D)]
p = [x[0] for x in pc]
c = [x[1]//100 for x in pc]
total = [(i+1)*p[i]+c[i] for i in range(D)]

ans = sum(p)
for complete in itertools.product(range(2),repeat=D):
    n = 0
    g = G
    for i in range(D):
        if complete[i]:
            g -= total[i]
            n += p[i]
    for i in range(D-1,-1,-1):
        if complete[i]:
            continue
        else:
            if g <= 0:
                break
            elif g > (p[i]-1)*(i+1):
                g -= (p[i]-1)*(i+1)
                n += p[i]-1
            else:
                n += g//(i+1) + int(bool(g%(i+1)))
                g = 0
                break
    if g <= 0 and n < ans:
        ans = n
print(ans)

Measured memory_bytes: 41200
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve(
    board: &std::vec::Vec<std::vec::Vec<char>>,
    (r, c): (usize, usize),
    mem: &mut std::vec::Vec<std::vec::Vec<usize>>,
) -> usize {
    if (board.len() - 1, board[0].len() - 1) == (r, c) {
        return 0;
    }
    let mut l = vec![usize::max_value(); 2];
    for (dx, dy) in vec![(1, 0), (0, 1)] {
        if board.len() > r + dx && board[0].len() > c + dy {
            let add = if board[r][c] == '.' && board[r + dx][c + dy] == '#' {
                1
            } else {
                0
            };
            l.push(if mem[r + dx][c + dy] != usize::max_value() {
                add + mem[r + dx][c + dy]
            } else {
                add + solve(board, (r + dx, c + dy), mem)
            });
        }
    }
    // println!("{}, {}", a, b);
    mem[r][c] = l.into_iter().min().unwrap()
        + if (r, c) == (0, 0) && board[r][c] == '#' {
            1
        } else {
            0
        };
    mem[r][c]
}

fn main() {
    input! {
        h: usize,
        w: usize,
        board: [chars; h],
    }
    let mut mem: std::vec::Vec<std::vec::Vec<usize>> = vec![vec![usize::max_value(); w]; h];
    let res = solve(&board, (0, 0), &mut mem);
    // println!("{:?}, {}", board, res);
    println!("{}", res);
}

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main()
{
  int n, x, y;
  cin >> n >> x >> y;
  cout << min(x, y) << " " << max(0, x + y - n) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
   int i, j, mountains[10], temp;

   for(i=0; i<=9; i++){
      scanf(" %d", &mountains[i]);
   }

    for(i=0; i<=9; i++){
     for(j=i; j<=9; j++){
        if(mountains[i] < mountains[j]){
           temp = mountains[i];
           mountains[i] = mountains[j];
           mountains[j] = temp;
        }
     }
    }

   for(i=0; i<=2; i++){
      printf("%d\n", mountains[i]);
   }

   return 0;
}

Measured memory_bytes: 600
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int;
	fmt.Scan(&n)

	aList := []int{}
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		aList = append(aList, a)
	}

	sort.Sort(sort.Reverse(sort.IntSlice(aList)))

	alice := 0
	for i := 0; i < n; i += 2 {
		alice += aList[i]
	}

	bob := 0
	for i := 1; i < n; i += 2 {
		bob += aList[i]
	}

	fmt.Println(alice - bob)
}


Measured memory_bytes: 512
#!/usr/bin/env python3
#AGC30 A

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b,c = LI()
print(min(b+c,b + min(c,(a+b))+1))


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    string s;
    int k;
    cin >> s >> k;

    int s_len = s.length();
    for (int i = 0; i < min(s_len, k); i++) {
        if(int(s[i]) != 49) {
            cout << s[i] << endl;
            return 0;
        }
    }
    
    cout << 1 << endl;
}

Measured memory_bytes: 504
#include <iostream>

using namespace std;

int main() {
  long long x;
  cin >> x;
  if (x % 11 == 0)
    cout << x / 11 * 2 << endl;
  else if (x % 11 <= 6)
    cout << x / 11 * 2 + 1 << endl;
  else
    cout << x / 11 * 2 + 2 << endl;
}

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

int main(){

   
    
    
    vector<string> a;
    int num;
        for (int i = 0; isdigit(num = getchar()); i++)
        {
            
            /* code */
            a.push_back(to_string(num-48));
        }
        int l = a.size();
       
    cout<<a[0];
    for (int tmp = 0; tmp < (1 << 3 ); tmp++){
        int sum=atol((a[0]).c_str());
        vector<string> b=a;
        bitset<3> s(tmp);
        

        for (int i = 0; i < 3; i++)
        {
            if(s.test(i)){
                sum+=atol((b[i+1]).c_str());
            }else{
                sum-=atol((b[i+1]).c_str());
            }
        }
        if(sum==7){

            for (int i = 0; i < 3; i++)
        {
            if(s.test(i)){
                cout<<"+"<<b[i+1];
            }else{
                cout<<"-"<<b[i+1];
            }
        }
            cout<<"=7"<<endl;

            break;
        }
        
        


        
        
        
        
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	int W,a,b;
	cin>>W>>a>>b;
	if(abs(a-b)<=W)
		cout<<0<<endl;
	else
		cout<<abs(a-b)-W<<endl;
	return 0;
}

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

using namespace std;

void solve()
{
	int n;
	cin >> n;
	stack<int> S1;
	for(int i = 2 * n; i >= 1; --i)
	{
		S1.push(i);
	}
	int m;
	cin >> m;
	while(m--)
	{
		int k;
		cin >> k;
		stack<int> S2;
		stack<int> S3;
		if(k == 0)
		{
			for(int i = 0; i < n; ++i)
			{
				S2.push(S1.top());
				S1.pop();
			}
			for(int i = 0; i < n; ++i)
			{
				S3.push(S1.top());
				S1.pop();
			}
			for(int i = 0; i < n; ++i)
			{
				S1.push(S3.top());
				S3.pop();
				S1.push(S2.top());
				S2.pop();
			}
		}
		else
		{
			for(int i = 0; i < k; ++i)
			{
				S2.push(S1.top());
				S1.pop();
			}
			while(!S1.empty())
			{
				S3.push(S1.top());
				S1.pop();
			}
			for(int i = 0; i < k; ++i)
			{
				S1.push(S2.top());
				S2.pop();
			}
			while(!S3.empty())
			{
				S1.push(S3.top());
				S3.pop();
			}
		}
	}
	for(int i = 0; i < 2 * n; ++i)
	{
		cout << S1.top() << endl;
		S1.pop();
	}
}

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

Measured memory_bytes: 0
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 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; }
int dp[110000];
int main(){
    int N, M; cin >> N >> M;
    int a[110000];
    rep(i, M) {
        int a; cin >> a;
        dp[a] = -INF; 
        if (dp[i] != -INF) {
            dp[i] = 0;
        }
    }
    dp[0] = 1;
    rep(i, N) {
        if (dp[i + 1] != -INF&&dp[i]!=-INF) {
            dp[i + 1] += dp[i];
            dp[i + 1] %=mod;
        }
        if (dp[i + 2] != -INF&&dp[i]!=-INF) {
            dp[i + 2] +=dp[i];
            dp[i + 2] %= mod;
        }
    }
    cout << dp[N] << endl;
}



   

    
    



    
                

 













































































































































Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <math.h>

using namespace std;

int main (){
    string S;
    cin >> S;
    string ans = "No";

   if(S[0] == 'A'){
        if(S[1] == 'B' || S[2] == 'B') ans = "Yes";
   } else {
        if(S[1] == 'A' || S[2] == 'A') ans = "Yes";
   }
   
   cout << ans << endl;

}

Measured memory_bytes: 256
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve(input_string):
    a, b, c = makeMultiInteger(input_string[0])
    #print(a, b, c)
    if a >= c and b <= c:
        return "Yes"
    if b >= c and a <= c:
        return "Yes"
    return "No"


def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
const ll INF = 1LL<<60;
typedef pair<ll, ll> P;


int main() {
    cin>>S;
    N = S.size();
    bool yes = true;
    rep(i, N / 2) {
        if(S[i] != S[N - 1 - i]) yes = false;
        if(S[i] != S[(N / 2 - 1) - i]) yes = false;
        if(S[N - 1 - i] != S[(N / 2 + 1) + i]) yes = false;
    }
    cout<<(yes ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<stack>
#define ll long long
using namespace std;

#define Get_Abs(a) ((a) >= 0 ? (a) : -(a))
#define Get_Max(a, b) ((a) > (b) ? (a) : (b))
#define Get_Min(a, b) ((a) < (b) ? (a) : (b))
#define Get_Swap(a, b) ((a) ^= (b), (b) ^= (a), (a) ^= (b))
#define Get_Limit(a, b, c) ((a) = ((a) > (c)) ? (c) : (((a) < (b)) ? (b) : (a)))

int main()
{
	bool a;
	cin >> a;
	cout << !a;
	return 0;
}


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

int main() {
  string S;
  cin >> S;
  
  int zero = 0;
  int one = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == '0') {
      zero++;
    }
    else {
      one++;
    }
  }
  if (zero >= one) {
    cout << one * 2 << endl;
  }
  else {
    cout << zero * 2 << endl;
  }
}

Measured memory_bytes: 512
def insertSort(a,n):
    L=[str(ai) for ai in a]
    L=" ".join(L)
    print(L)
    for i in range(1,n):
        v = a[i]
        j = i-1
        while(j>=0 and a[j]>v):
            a[j+1] = a[j]
            j -= 1
        a[j+1] = v;
        L=[str(ai) for ai in a]
        L=" ".join(L)
        print(L)
        
n = int(input())
a = list(map(int,input().split()))
insertSort(a,n)


Measured memory_bytes: 5604