akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double

set<int> s;

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int a[3][3];
    for(int i=0;i<3;i++) {
        for(int j=0;j<3;j++) {
            cin >> a[i][j];
        }
    }
    int n;
    cin >> n;
    bool ok[3][3];
    for(int i=0;i<3;i++) for(int j=0;j<3;j++) ok[i][j] = false;
    for(int i=0;i<n;i++) {
        int x;
        cin >> x;
        for(int j=0;j<3;j++) {
            for(int k=0;k<3;k++) {
                if(a[j][k] == x) {
                    ok[j][k] = true;
                }
            }
        }
    }
    string ans = "No";
    for(int i=0;i<3;i++) {
        if(ok[i][0]  && ok[i][1] && ok[i][2]) ans = "Yes";
    }
    for(int i=0;i<3;i++) {
        if(ok[0][i] && ok[1][i] && ok[2][i]) ans = "Yes";
    }
    if(ok[0][0] && ok[1][1] && ok[2][2]) ans = "Yes";
    if(ok[2][0] && ok[1][1] & ok[0][2]) ans = "Yes";
    cout << ans << endl;
}


Measured memory_bytes: 256
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut h = HashSet::new();
    for i in 0..n{
        let a:i64 = read();
        h.insert(a);
    }
    println!("{}",h.len());
}

Measured memory_bytes: 2160
#include<stdio.h>
int main(){
	int S,h,m,s;
	
	scanf("%d",&S);
	
	h=S/3600;
	m=(S%3600)/60;
	s=S-h*3600-m*60;
	
	printf("%d:%d:%d\n",h,m,s);
	
	return 0;
}



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

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

  vector<int> a;
  int ans = 0;
  rep(i, n)
  {
    int tmp;
    cin >> tmp;

    if (a.size() + 1 != tmp)
    {
      ans++;
      continue;
    }

    a.push_back(tmp);
  }

  if (a.empty())
  {
    cout << -1 << endl;
  }
  else
  {
    cout << ans << endl;
  }
}


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

#define int long long 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define N 3005
double dp[N][N];
vector<double> arr(N);
int n;

void solve(){

    int head=(n+1)/2;
    
    for(int x=1;x<=head;x++)  dp[0][x]=0;
    for(int i=0;i<=n;i++) dp[i][0]=1;

    for(int i=1;i<=n;i++){
        for(int x=1;x<=head;x++){
            if(i<x) dp[i][x]=0;
            else{
                dp[i][x]=arr[i]*dp[i-1][x-1]+(1-arr[i])*dp[i-1][x];
            }        
        }
    }
    cout<<fixed<<setprecision(10)<<dp[n][head];




    
    
}
int32_t main(){
    cin>>n;
    memset(dp,-1,sizeof(dp));
    for(int i=1;i<=n;i++) cin>>arr[i];
    solve();

}

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

uint64_t gcd(uint64_t x, uint64_t y)
{    
    if (x < y) {
        uint64_t tmp = x;
        x = y;
        y = tmp;
    }
    
    /* ユークリッドの互除法 */
    uint64_t r = x % y;
    while(r != 0){
      x = y;
      y = r;
      r = x % y;
    }
        
    
    return y;
}

uint64_t gcd3(uint64_t a, uint64_t b, uint64_t c)
{
    uint64_t t = gcd(a, b);
    uint64_t ret = gcd(t, c);
    
    return ret;
}

int main(int argc, const char * argv[]) {
    uint64_t K;
    cin >> K;
    
    uint64_t sum = 0;
    for (uint64_t a = 1; a <= K; a++) {
        for (uint64_t b = 1; b <= K; b++) {
            for (uint64_t c = 1; c <= K; c++) {
                sum += gcd3(a, b, c);
            }
        }
    }
    
    std::cout << sum;
    
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int ji,n,last;
long long sum1,sum2,a[N],fir,sec;
bool ok1=true,ok2=true,f=true;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	reverse(a,a+n);
	for(int i=0;i<n;i++)
	{
		if(last!=a[i])
		{
			last=a[i];
			ji=1;
			continue;
		}
		ji++;
		if(ji>=4&&f)
		{
			sum1=a[i]*a[i];
			f=false;
		}
		if(ji>=2)
		{
			if(ok1)
			{
				ok1=false;
				fir=a[i];
			}
			else
			if(ok2&&a[i]!=fir)
			{
				ok2=false;
				sec=a[i];
			}
		}
	}
	if(!ok1&&!ok2)sum2=fir*sec;
	cout<<max(sum1,sum2);
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF

#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 srep(i,s,t) for(int i = s; i < t;  ++i)

#define maxs(x,y) (x=std::max(x,y))
#define mins(x,y) (x=std::min(x,y))

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  rep(i, N) cin >> v[i];
  std::sort(v.begin(), v.end());
  double answer {static_cast<double>(v[0])};
  srep(i,1,N) answer = (answer + v[i])/2;
  std::cout << std::fixed << answer << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define X first
#define Y second
#define pb push_back
#define mp make_pair

const int maxn = 1e5 + 100 , maxc = 115, mod = 1e9 + 7, inf = 1e9+10;

int n, c, baz[maxn][30];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> c;
	for (int i = 0; i < n; i++)
	{
		int s, t, C;
		cin >> s >> t >> C;
		baz[s][--C] ++;
		baz[t+1][C] --;
	}
	for (int i = 0; i < c; i++)
		for (int j = 1; j < maxn; j++)
			baz[j][i] = baz[j-1][i] + baz[j][i];
	
	int ans = 0;
	for (int i = 0; i < maxn; i++)
	{
		int res = 0;
		for (int j = 0; j < c; j++)
			if (baz[i][j])
				res++;
		ans = max (ans, res);
	}
	cout << ans << endl;
	



	return 0;
}

Measured memory_bytes: 12032
package main

import (
	"fmt"
	"log"
	"strconv"
	"strings"
)

/*
1.N,A,Bを入力
2.N以下の数字の各桁を分離する
3.分離した数値の和を考える
4.A以上,以下の範囲内であれば、候補として配列に格納する。
5.最後に配列の中の数値の和を取る
*/

func main() {
	var N int
	var A, B, ansSum int
	//入力を受け付ける
	fmt.Scan(&N)
	fmt.Scan(&A)
	fmt.Scan(&B)

	for i := 1; i <= N; i++ {
		//各桁の合計
		var digitSum int

		//入力値を桁ごとに分割
		number := strconv.Itoa(i)
		digitNumbers := strings.Split(number, "")

		for _, val := range digitNumbers {
			digit, err := strconv.Atoi(val)
			if err != nil {
				log.Println(err)
			}

			digitSum += digit
		}

		if A <= digitSum && digitSum <= B {
			ansSum += i
		}
	}

	fmt.Println(ansSum)
}


Measured memory_bytes: 2496
#define _CRT_SECURE_NO_WARNINGS

#include	<iostream>
#include	<string>
#include	<queue>

using namespace std;

#if 0
void maxHeapify(int i)
{
	int		l = i * 2;
	int		r = i * 2 + 1;
	int		largest = i;

	if (l <= H)
	{
		if (A[largest] < A[l])
		{
			largest = l;
		}
	}

	if (r <= H)
	{
		if (A[largest] < A[r])
		{
			largest = r;
		}
	}

	if (largest != i)
	{
		int		temp(A[i]);
		A[i] = A[largest];
		A[largest] = temp;

		maxHeapify(largest);
	}
}
#endif

int main()
{
	priority_queue<int>		PQ;
	string		com;
	int			key;

	for (;;)
	{
		cin >> com;

		if (com ==  "insert")
		{
			cin >> key;
			PQ.push(key);
		}
		else if (com ==  "extract")
		{
			cout << PQ.top() << "\n";
			PQ.pop();
		}
		else if (com == "end")
		{
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 6984
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int D;
  cin >> D;
  if (D == 25){
  cout << "Christmas";
  }else if (D == 24){
  cout << "Christmas Eve";
  }else if (D == 23){
  cout << "Christmas Eve Eve";
  }else if (D == 22){
  cout << "Christmas Eve Eve Eve";
  }
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int A,B,K;
	int cnt;
	int ans;
	
	scanf("%d %d %d",&A,&B,&K);
	
	cnt=0;
	for(int i=100;i>0;i--){
		if(A%i==0 && B%i==0)	cnt++;
		
		if(cnt==K){
			ans=i;
			break;
		}
	}
	
	printf("%d",ans);
	
	return 0;
}

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

using namespace std;
typedef long long ll;

int main()
{
  ll a, b, c;
  cin >> a >> b >> c;
  
  ll count = 0;
  while(c>0)
  {
    count++;
    c--;
    if (b > 0)
    {
      count++;
      b--;
    }
    else if (a > 0)
    {
      //count++;
      a--;
    }
    else
    {
      break;
    }
  }
  
  while(b > 0)
  {
    count++;
    b--;
  }
    
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int m,f,b;
	scanf("%d %d %d",&m,&f,&b);
	if(m>=b){
		printf("%d\n",0);
	}
	else if(m+f<b){
		printf("NA\n");
	}
	else if(m+f>=b){
		printf("%d\n",b-m);
	}
	return 0;
}
		


Measured memory_bytes: 2756
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n; cin >> n;
    vector<int> b;
    int tmp;
    REP(i, n) {
        cin >> tmp;
        b.push_back(tmp);
    }

    int idx = -1;
    bool changed = false;
    vector<int> res;

    while (true) {
        changed = false;
        vector<int> new_b;
        FORD(i, b.size()-1, 0) {
            if (b[i] == i+1) {
                res.push_back(i+1);
                changed = true;

                REP(j, b.size()) {
                    if (j != i) {
                        new_b.push_back(b[j]);
                    }
                }
                break;
            }
        }
        if (changed) {
            if (new_b.size() > 0) {
                b = new_b;
            } else {
                b = new_b;
                break;
            }
        } else {
            break;
        }
    }
    if (b.size() == 0) {
        FORD(i, res.size()-1, 0) {
            cout << res[i] << endl;
        }
    } else {
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;

import static java.lang.StrictMath.sqrt;

/**
 * Wrong Answer
 */
class Main {
	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);

		while(in.hasNext()) {
			int d = in.nextInt();

			int ans = 0;
			for(int i = d; i < 600; i+=d) {
				ans += d * f(i);
			}
			System.out.println(ans);
		}
	}

	public static double f(int x) {
		return x*x;
	}
}

Measured memory_bytes: 25680
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll n;cin>>n;
    string s1,s2;
    cin>>s1>>s2;
    ll dp[n];
    ll next=0;
    if(n==1){
        cout<<3<<endl;
        return 0;
    }else{
        if(s1[0]==s2[0]){
            dp[0]=3;
            next=1;
        }else{
            dp[1]=6;
            next=2;
        }
        while(next<n){
            if(s1[next]==s2[next]){
                if(s1[next-1]==s2[next-1]){
                    dp[next]=(dp[next-1]*2)%a7;
                }else{
                    dp[next]=dp[next-1];
                }
                next++;
            }else{
                if(s1[next-1]==s2[next-1]){
                    dp[next+1]=(dp[next-1]*2)%a7;
                }else{
                    dp[next+1]=(dp[next-1]*3)%a7;
                }
                
                next++;
                next++;
                
            }
            
            
        }
    }
    cout<<(dp[n-1])%a7<<endl;
    return 0;
}







Measured memory_bytes: 256
#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;
    vector<int> a(n);
    int g = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        g = __gcd(a[i], g);
    }
    if (g != 1) {
        cout << "not ";
    } else {
        vector<int> b(1000001, 1);
        b[0] = b[1] = 0;
        for (int i = 2; i <= 1000000; i++) {
            for (int j = 2 * i; j <= 1000000; j += i) {
                b[j] = 0;
            }
        }
        vector<int> p;
        for (int i = 0; i < 1000000; i++) {
            if (b[i]) {
                p.emplace_back(i);
            }
        }
        vector<int> c(1000001);
        bool ok = true;
        for (int i = 0; i < n; i++) {
            if (b[a[i]]) {
                c[a[i]]++;
                if (c[a[i]] >= 2) {
                    ok = false;
                }
            } else {
                for (int j : p) {
                    if (j * j > a[i]) {
                        c[a[i]]++;
                        if (b[a[i]] && c[a[i]] >= 2) {
                            ok = false;
                        }
                        break;
                    }
                    if (a[i] % j == 0) {
                        if (c[j]) {
                            ok = false;
                            break;
                        }
                        c[j] = 1;
                    }
                    while (a[i] % j == 0) {
                        a[i] /= j;
                    }
                }
            }
            if (!ok) {
                break;
            }
        }
        if (ok) {
            cout << "pairwise ";
        } else {
            cout << "setwise ";
        }
    }
    cout << "coprime" << '\n';
    return 0;
}

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

#include <atcoder/all>

using namespace std;
using namespace atcoder;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
// #define int ll
 
#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>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#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 rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
// vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// const ll MOD = 1000000007;
const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    int n, m;
    cin >> n >> m;
    vl a(n), b(m);
    rep (i, n) cin >> a[i];
    rep (i, m) cin >> b[i];
    vl c = convolution(a, b);
    rep (i, c.size()) cout << c[i] << " ";
    cout << endl;
}

Measured memory_bytes: 27228
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define F first
#define S second
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()
//library begin
int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int log(int a){
    int b=a;
    int cnt=0;
    while(b%2==0){
        b/=2;
        cnt++;
    }
    return cnt;
}
int mypow(int a,int b){
    if(b==0)return 1;
    if(b==1)return a;
    int t=mypow(a,b/2);
    if(b%2==0)return t*t;
    return t*t*a;
}
//library end
int n;
string s,t;
int a[400000];
set<int>st;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>a[i];
        st.insert(a[i]);
    }
    int l=st.size();
    if(n==l)puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 11136
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    int ans = s.size(), cnt = 0;
    for (int i = 0; i < s.size(); i++){
        if (s[i] == 'S')
            cnt ++;
        if (s[i] == 'T' && cnt > 0){
            ans -= 2;
            cnt --;
        }
    }
    cout << ans << endl;
}


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

int cnt[5], v[100005];

int main(){

    ll n; cin >> n;
    vector<ll> v(n);
    for(ll i = 0; i < n; i++){
        int x; cin >> x;
        cnt[x%4]++;
    }

    if(cnt[2] > 0){
        int aux = cnt[1] + cnt[3];
        if(cnt[0] >= aux) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    else{
        int aux = cnt[1] + cnt[3];
        if(cnt[0] >= aux-1) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    
	return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3

S = input()
r_count = 0
l_count = 0
Ret = [1 for _ in range(len(S))]
b = -1
i = 0
while i < len(S):
    if i < len(S)-1 and S[i:i+2] == 'RL':
        if r_count % 2 == 0:
            Ret[i] += r_count//2
            Ret[i+1] += r_count//2
        else:
            Ret[i] += r_count//2
            Ret[i+1] += r_count//2 + 1

        if b != -1:
            if l_count % 2 == 0:
                Ret[b] += l_count//2
                Ret[b+1] += l_count//2
            else:
                Ret[b] += l_count//2 + 1
                Ret[b+1] += l_count//2
        b = i
        r_count = 0
        l_count = 0
        i += 1
    elif S[i] == 'R':
        Ret[i] = 0
        r_count += 1
    elif S[i] == 'L':
        Ret[i] = 0
        l_count += 1

    i += 1

if l_count % 2 == 0:
    Ret[b] += l_count//2
    Ret[b+1] += l_count//2
else:
    Ret[b] += l_count//2 + 1
    Ret[b+1] += l_count//2

print(*Ret)


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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

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

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// ここに処理を記述

    int N, M;
    cin >> N >> M;

    vector<int> p;
    vector<string> S;
    int a;
    string b;
    for(int i=0; i<M; i++){
        cin >> a >> b;
        p.emplace_back(a);
        S.emplace_back(b);
    }

    vector<bool> flg(N+1,false);
    vector<int> ans(N+1,0);

    int AC = 0;
    int pena = 0;

    REP(i,M){
        if(S[i] == "AC"){
            flg[p[i]] = true;
        }
        else{
            if(!flg[p[i]]){
                ans[p[i]]++;
            }
        }
    }

    FOR(i,1,N+1){
        if(flg[i]){
            AC++;
            pena += ans[i];
        } 
        
    }

    cout << AC << " " << pena << "\n";

return 0;
}

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

int main()
{
    int i,j,cnt,p=0,m=0,l;
    char ch[100005];
    cin>>ch;
    for(i=0;ch[i];i++){
        if(ch[i]=='0') p++;
        else m++;
    }
    cout<< min(p,m)*2<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, k;
	string s;
	cin>>n>>k>>s;
	int i = 0;
	int j = 0;
	int ans = 0;
	while(j < n){
		while(j < n && s[j] == '1')j++;
		ans = max(ans, j - i);
		while(j < n && s[j] == '0')j++;
		k--;
		if(k < 0){
			while(i < n && s[i] == '1')i++;
			while(i < n && s[i] == '0')i++;			
		}
		ans = max(ans, j - i);
	}
	cout<<ans<<endl;
	return 0;
}


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

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

using namespace std;

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

  int ma=0,mi=1e9;
  rep(i,n){
    int t;cin>>t;
    mi=min(mi, t);
    ma=max(ma, t);
  }

  cout<<ma-mi;

  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

ll oddsolve(ll a){
    return (a + 1) / 2 % 2;
}

ll solve(ll a){
    if(a % 2 == 1) return oddsolve(a);
    else return oddsolve(a+1)^(a+1);
}

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

    ll A, B;
    cin >> A >> B;
    cout << ( solve(B) ^ solve(A-1) ) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define int long long

using namespace std;

const int N = 1e5 + 5;



signed main()
{/*
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);*/
    int x;
    cin >> x;
    if (x >= 30)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 3592
#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 u(x, a, b) for(ll x = a; x < b; x++)
#define d(x, a, b) for(ll x = a; x > b; x--)

typedef long long ll;
typedef long double ld;

#define MAXI 100010
#define MOD 1000000007

int main(){
	ll n, k;
	cin >> n >> k;
	
	
	ll h[n];
	ll tot = 0;
	
	u(one, 0, n){cin >> h[one]; tot+=h[one];}
	sort(h, h+n);
	
	d(one, n-1, max((ll)-1, n-k-1)){tot-=h[one];}
	
	cout << tot;
}


Measured memory_bytes: 5112
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.function.IntConsumer;
import java.util.function.LongSupplier;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static final long[] fal_rnd(long[] ar,LongSupplier sp){
		int l=-1,r=ar.length;
		while(l+1!=r)
			ar[Math.random()<0.5?++l:--r]=sp.getAsLong();
		return ar;
	}
	static final void REP(int t,IntConsumer i){
		for(int v=0;v<t;v++)
			i.accept(v);
	}
	static final void REPR(int t,IntConsumer i){
		for(int v=t-1;v>=0;v--)
			i.accept(v);
	}
	static final IntStream REPS(int v){
		return IntStream.range(0,v);
	};
	public static void main(String[] __){
		int n=s.nextInt(),W=s.nextInt();
		HashMap<Integer,Integer> dp=new HashMap<>(65535);
		dp.put(0,0);
		for(int i=0;i<n;i++) {
			HashMap<Integer,Integer> ndp=new HashMap<>(dp);
			int w=s.nextInt(),v=s.nextInt();
			for(Entry<Integer,Integer> e:dp.entrySet()) {
				if(e.getKey()+w<=W)
					ndp.merge(e.getKey()+w,e.getValue()+v,Math::max);
			}
			dp=ndp;
		}
		System.out.println(dp.values().parallelStream().max(Comparator.naturalOrder()).orElse(0));
	}
}


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

using namespace std;


void solve(){
    long long n; cin>>n;
    vector<long long> v;
    while(n--){
        v.push_back(n%26);
        n/=26;
    }
    reverse(v.begin(), v.end());
    string ans;
    for(auto& i: v) ans+= 'a' + i%26;
    cout<<ans;
}


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

    // int T; cin>>T; while(T--)
        solve();
}

Measured memory_bytes: 3668
#include <stdio.h>

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

  int L,R;
  int sum[N+1][N+1];
  for(int i = 0;i <= N;i++){
    for(int j = 0;j <= N;j++){
      sum[i][j] = 0;
    }
  }
  for(int i = 0;i < M;i++){
    scanf("%d%d",&L,&R);
    sum[L][R]++;
  }
  for(int i = 1;i <= N;i++){
    for(int j = 1;j <= N;j++){
      sum[i][j] += sum[i][j-1];
    }
  }
  int p,q;
  for(int i = 0;i < Q;i++){
    scanf("%d%d",&p,&q);
    int ans = 0;
    for(int i = p;i <= q;i++){
      ans += sum[i][q]-sum[i][p-1];
    }
    printf("%d\n",ans);
  }

  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <limits>

int main(){
  while(true){
    int n;
    std::cin >> n;
    if (n == 0) return EXIT_SUCCESS;
    std::vector<int> a(n);
    for (int i=0; i<n; i++){
      std::cin >> a[i];
    }
    int min = std::numeric_limits<int>::max();
    for (int i=0; i<(1<<n); i++){
      int d = 0;
      for (int j=0; j<n; j++){
        d += (((i>>j)&0x1)==0 ? a[j] : -a[j]);
      }
      if(d<0) d = -d;
      if(d<min) min = d;
    }
    std::cout << min << std::endl;
  }
}


Measured memory_bytes: 3028
inf = 0x10101010
def solve(A,strt,goal):
	cost = [inf]*m
	visited = [False]*m
	cost[strt] = 0
	while 1:
		min = inf
		next = -1
		visited[strt] = True
		for i in range(m):
			if visited[i]: continue
			if A[strt][i]:
				d = cost[strt] + A[strt][i]
				if d < cost[i]:
					cost[i] = d
			if min > cost[i]:
				min = cost[i]
				next = i
		strt = next
		if next == -1: break
	return cost[goal]
    
while 1:
	n,m = map(int,raw_input().split())
	if n == 0: break
	T = [[0]*m for i in range(m)]
	C = [[0]*m for i in range(m)]
	for i in range(n):
		a,b,c,t = map(int,raw_input().split())
		T[a-1][b-1] = T[b-1][a-1] = t
		C[a-1][b-1] = C[b-1][a-1] = c
	for i in range(input()):
		a,b,q = map(int,raw_input().split())
		if q == 0:
			print solve(C,a-1,b-1)
		else:
			print solve(T,a-1,b-1)

Measured memory_bytes: 4536
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  string s; cin >> s;
  cout << s.substr(0, 3) << endl;

  return 0;
}


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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  int ans = 3;
  if (a == b)
    ans--;
  if (b == c)
    ans--;
  if (c == a)
    ans--;
  if (ans == 0)
    ans = 1;
  cout << ans << endl;
  return 0;
}

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

int main(){
	int a,b,c,buf;
	cin >> a >> b >> c;
	if(a>b){
		buf=a;
		a=b;
		b=buf;
	}
	if(b>c){
		buf=b;
		b=c;
		c=buf;
	}
	if(a>b){
		buf=a;
		a=b;
		b=buf;
	}
	cout << a << " "<< b << " " << c << endl;
	
	return 0;
}



Measured memory_bytes: 3108
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
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; }
const long long INF = 1LL << 60;

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int ans = 0;
    int count = 1;

    rep(i,n){
        if(a[i] == count){
            count++;
        }
        else ans++;
    }


    if(count == 1) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>

int max(int a, int b){
	return a > b ? a : b;
}

int cmp1(const void *a, const void *b){
	return (*(int*)a) - (*(int*)b);
}

int cmp2(const void *a, const void *b){
	return -(*(*((int**)a) + 1)) + *(*((int**)b) + 1);
}

int main(void){
	int n, m;
	long sum = 0;
	scanf("%d %d", &n, &m);
	int *card = malloc(sizeof(int) * n);
	for(int i = 0; i < n; i++)scanf("%d", card + i);
	int **swap = malloc(sizeof(int*) * m);
	for(int i = 0; i < m; i++){
		swap[i] = malloc(sizeof(int) * 2);
		scanf("%d %d", swap[i], swap[i] + 1);
	}
	qsort(card, n, sizeof(int), cmp1);
	qsort(swap, m, sizeof(int*), cmp2);
	int p = 0;
	for(int i = 0; i < n; i++){
		sum += max(card[i], swap[p][1]);
		if(swap[p][0])swap[p][0]--;
		if(swap[p][0] == 0 && p < m - 1)p++;
		if(swap[p][0] == 0 && p == m - 1)swap[p][1] = 0;
	}
	//for(int i = 0; i < n; i++)printf("%d\n", card[i]);
	//for(int i = 0; i < m; i++)printf("%d %d\n", swap[i][0], swap[i][1]);
	printf("%ld\n", sum);
	return 0;
}


Measured memory_bytes: 5304
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int H;
  cin >> H;
  if(400<=H && 600>H)
  	cout << '8' << endl;
  else if(600<=H && 800>H)
  	cout << '7' << endl;
else if(800<=H && 1000>H)
  	cout << '6' << endl;
else if(1000<=H && 1200>H)
  	cout << '5' << endl;
else if(1200<=H && 1400>H)
  	cout << '4' << endl;
else if(1400<=H && 1600>H)
  	cout << '3' << endl;
else if(1600<=H && 1800>H)
  	cout << '2' << endl;
  else if(1800<=H && 2000>H)
  	cout << '1' << endl;
  
}

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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  map<int,int> odd, even;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (i & 1) odd[ a[i] ]++;
    else even[ a[i] ]++;
  }
  vector< pair<int,int> > ans(4, make_pair(0, 0));
  for (auto i : even) {
    if (i.second > ans[0].second) {
      swap(ans[0], ans[1]);
      ans[0] = i;
    }
    else if (i.second > ans[1].second) {
      ans[1] = i;
    }
  }
  for (auto i : odd) {
    if (i.second > ans[2].second) {
      swap(ans[2], ans[3]);
      ans[2] = i;
    }
    else if (i.second > ans[3].second) {
      ans[3] = i;
    }
  }
  if (ans[0].first != ans[2].first) {
    printf("%d\n", n - ans[0].second - ans[2].second);
  }
  else {
    int res = max(ans[0].second + ans[3].second, ans[1].second + ans[2].second);
    printf("%d\n", n - res);
  }
  return 0;
}

Measured memory_bytes: 5376
#coding:utf-8
#R[i][j]:i行j列目に光を置いた時右に伸びる光の長さ
H,W = list(map(int,input().split()))
S = [0] * (H+2)
wall = ''
for _ in range(W+2):
    wall += '#'
S[0] = wall
S[H+1] = wall
for h in range(H):
    S[h+1] = '#' + input() + '#'
#print(S)
# R = [[0] * (W+2) for _ in range(H+2)]
# L = [[0] * (W+2) for _ in range(H+2)]
# U = [[0] * (W+2) for _ in range(H+2)]
# D = [[0] * (W+2) for _ in range(H+2)]
dp = [[0] * (W+2) for _ in range(H+2)]
start = 0
maxdp = 0
for h in range(1,H+1):
    flag = False
    for w in range(W+2):
        if S[h][w] == '#' :
            if flag == False :
                start = w
            else:
                for i in range(start+1,w):
                    dp[h][i] += w - i - 1
                    dp[h][i] += i - start - 1
                    if dp[h][i] > maxdp:
                        maxdp = dp[h][i]
                    flag = False
                start = w
        else:
            flag = True
for w in range(1,W+1):
    for h in range(H+2):
        if S[h][w] == '#':
            if flag == False:
                start = h
            else:
                for i in range(start+1,h):
                    dp[i][w] += h - i - 1
                    dp[i][w] += i - start -1
                    if dp[i][w] > maxdp:
                        maxdp = dp[i][w]
                    flag = False
                start = h
        else:
            flag = True
print(maxdp+1)


Measured memory_bytes: 98136
#include<stdio.h>
#include<stdlib.h>

int main(void){

  float p=0.0, q=0.0;
  int r=0, x=0, y=0, z=0, count=0;
  int i, j;

  while(1){
    scanf("%d %d", &r, &x);

    if(r==0 && x==0) break;

    p = (float)x/3;
    for(i=1;i<p;i++){
      y = x - i;
      q = (float)y/2;
      for(j=1;j<q;j++){
        z = y - j;
        if(z < r+1 && j > i){
        //  printf("%d %d %d\n", i, j, z);
        count++;
        }
      }
    }
    printf("%d\n", count);
    count = 0;
  }

  return 0;

}



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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)

int N;
vector<int> p;

int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  cin >> N;
  for (int i = 0; i < N; i++) {
    int a; cin >> a;
    auto it = lower_bound(p.begin(), p.end(), a-1,
			  [](int x, int y) { return x > y; });
    if (it == p.end())  p.push_back(a);
    else                *it = a;
  }
  cout << p.size() << endl;

  return 0;
}



Measured memory_bytes: 892
# -*- coding: utf-8 -*-
###スペース区切りの数値2つの代償を比較する。
### 
str_in = raw_input()
nums = map(int, str_in.split())

if nums[0] < nums[1]:
	str_out = 'a < b'
elif nums[0] == nums[1]:
	str_out='a == b'
else:
	str_out='a > b'

print(str_out)



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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

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

namespace patch
{
    template < typename T > std::string to_string( const T& n )
    {
        std::ostringstream stm ;
        stm << n ;
        return stm.str() ;
    }
}

int main(){
    int n, m; cin>>n>>m;
    vector<vector<P>> g(n+10);
    for(int i=0; i<m; i++){
        int p, y; cin>>p>>y;
        p--;
        g[p].emplace_back(P(y, i));
    }

    for(int i=0; i<n; i++){
        sort(g[i].begin(), g[i].end());
    }

    int cnt=0;
    vector<string> ans(m);
    for(int i=0; i<n; i++){
        for(int j=0; j<g[i].size(); j++){
            int y, id;
            tie(y, id)=g[i][j];
            int hdigit=0, tdigit=0, head=i+1, tail=j+1;
            while(head>0){
                head/=10;
                hdigit++;
            }
            while(tail>0){
                tail/=10;
                tdigit++;
            }
            for(int k=1; k<=6-hdigit; k++) ans[id]+="0";
            ans[id]+=patch::to_string(i+1);
            for(int k=1; k<=6-tdigit; k++) ans[id]+="0";
            ans[id]+=patch::to_string(j+1);
        }
    }

    for(int i=0; i<m; i++){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 12416
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

ll mod = 1e9 + 7;
ll dp[5050][5050];

ll modpow(ll a, ll n) {
	ll res = 1;
	a %= mod;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

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

	int N;
	string S;
	cin >> N >> S;

	dp[0][0] = 1;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			dp[i][j] = dp[i - 1][j + 1];
			if(j > 0)dp[i][j] += 2LL * dp[i-1][j-1];
			else dp[i][j] += dp[i - 1][j];
			dp[i][j] %= mod;
		}
	}
	ll k = modpow(2,S.size());
	puts((dp[N][S.size()] * modpow(k,mod-2))%mod);


	return 0;
}

Measured memory_bytes: 198912
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  	cin>>n;
  	int b[n];
  	for(int i=1;i<=n-1;i++){
    	cin>>b[i];	
    }
  vector<int>v;
      v.push_back(b[1]);
  	for(int i=1;i<=n-2;i++){
    	int m = min(b[i],b[i+1]);
      	v.push_back(m);
    }
  	v.push_back(b[n-1]);
    
 	long long int s=0;
  	for(int i=0;i<v.size();i++){
  	s+=v[i]; 
    }
  	cout<< s <<endl;
  return 0;
}


Measured memory_bytes: 256
def sieve_eratosthenes(n):
    primes = [0, 1] * (n // 2 + 1)
    if n % 2 == 0:
        primes.pop()
    primes[1] = 0
    primes[2] = 1
    for p in range(3, n + 1, 2):
        if primes[p]:
            for q in range(p * p, n + 1, 2 * p):
                primes[q] = 0
    return primes

NB = int(input())
B = list(map(int,input().split()))
A = []
for i in range(NB):
    if B[i]!=1:
        A.append(B[i])
N = len(A)

if N==0:
    print("pairwise coprime")
else:
    P = sieve_eratosthenes(10**6)
    Ps = []
    for i in range(10**6):
        if P[i]==1:
            Ps.append(i)
    PN = len(Ps)

    if N>PN+10:
        if NB-N>0:
            print("setwise coprime")
        else:
            print("not coprime")
    else:
        flag = 0
        pf={}
        for i in range(N):
            pf1 = {}
            m=A[i]
            for i in range(2,int(m**0.5)+1):
                while m%i==0:
                    pf1[i]=pf1.get(i,0)+1
                    m//=i
            if m>1:pf1[m]=1
            for i in pf1.keys():
                pf[i]=pf.get(i,0)+1
                if pf[i]>1:
                    flag = 1
        if flag==0:
            print("pairwise coprime")
        else:
            import fractions
            ans = A[0]
            for i in range(1, N):
                ans = fractions.gcd(ans, A[i])
            if ans==1 or N!=NB:
                print("setwise coprime")
            else:
                print("not coprime")

Measured memory_bytes: 208848
import java.util.*;
public class Main {
	private static Scanner sc;

	public static void main(String[] args){
		sc = new Scanner(System.in);
		// get a integer
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		
		for (int i = 0; i < k; i++) {
			if (i % 2 == 0) {
				if(a % 2 > 0) {
					--a;
					b = b + (a/2);
					a = a - (a/2);
				} else {
					b = b + (a/2);
					a = a - (a/2);
				}
			} else if(i % 2 > 0) {
				if(b % 2 > 0) {
					--b;
					a = a + (b/2);
					b = b - (b/2);
				} else {
					a = a + (b/2);
					b = b - (b/2);
				}
			}
		}
		
		System.out.printf("%d %d", a,b);
		
	}
}

Measured memory_bytes: 22996
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n, m, a[105], sum = 0;
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	cin >> m;
	while (m--)
	{
		int p, x;
		cin >> p >> x;
		cout << sum - a[p] + x << endl;
	}
	return 0;
}

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

using namespace std;
int mod(int a, int b)
{
	if(a - b > 0)
		return a - b;
	return b - a;
}

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

	int arr[n];
	for(int i = 0; i < n; i++)
		cin >> arr[i];
	int dp[n + 1] = {};
	dp[1] = mod(arr[1], arr[0]);

	for(int i = 2; i <= n; i++)
	{	
		int a = mod(arr[i], arr[i - 2]);
		int b = mod(arr[i], arr[i - 1]);
		dp[i] += min(a + dp[i - 2], b + dp[i - 1]);
	}
	cout << dp[n - 1];

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
string s;
map<string, int> p;
p.insert(make_pair("SUN",7));
p.insert(make_pair("MON",6));
p.insert(make_pair("TUE",5));
p.insert(make_pair("WED",4));
p.insert(make_pair("THU",3));
p.insert(make_pair("FRI",2));
p.insert(make_pair("SAT",1));
cin>>s;
cout<<p[s]<<endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int w[300001];
int e[300001];//i未満のeの人数
int main()
{
	int n;
	string s;
	int ans=0;
	
	cin>>n;
	cin>>s;
	w[0]=0;
	e[0]=0;
	for(int i=1;i<n+1;i++)
	{
		if(s[i-1]=='W')
		{
			w[i]=w[i-1]+1;
			e[i]=e[i-1];
		}else{
			w[i]=w[i-1];
			e[i]=e[i-1]+1;
		}
	}

	for(int i=0;i<n;i++)
	{
		int temp=e[i]+(w[n]-w[i+1])+1; //これは向きを変えなくてもいい人の人数
		if(ans<temp)
		{
			//cerr<<i<<" "<<temp<<endl;
			ans=temp;
		}
	}
	ans=n-ans;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

const ll INF = 1LL << 50;
ll N, M, E[100][100];
bool used[100];
vector<ll> vec;

ll dfs(ll t) {
  ll ans = 0;

  REP(v, t, N) {
    bool ok = true;
    for(ll u : vec) ok = ok && E[u][v] > 0;
    if(ok) {
      vec.push_back(v);

      ll x = 0;
      for(ll i : vec) {
        ll m = INF;
        for(ll j : vec) if(i != j) m = min(m, E[i][j]);
        x += m != INF ? m : 0;
      }
      ans = max(ans, x);

      ans = max(ans, dfs(v + 1));
      vec.resize(vec.size() - 1);
    }
  }

  return ans;
}

int main(void) {
  cin >> N >> M;
  REP(i, 0, N) REP(j, 0, N) E[i][j] = 0;
  REP(i, 0, M) {
    ll u, v, f; cin >> u >> v >> f; u--; v--;
    E[u][v] = f;
    E[v][u] = f;
  }

  REP(i, 0, N) used[i] = false;
  cout << dfs(0) << endl;
}


Measured memory_bytes: 3240
from itertools import accumulate

N, X = map(int, input().split())
A = [int(x) for x in input().split()]

B = [0] + [x for x in accumulate(A)]

if B[N] <= X:
    ans = N + 1
else:
    ans = 0
    for i in range(N):
        if B[i] > X:
            break
        ans += 1
print(ans)


Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vp = vector<Pii>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

  int n;
  cin >> n;
  vi a(n);
  int s2 = 0;
  rep(i, n) {
    cin >> a[i];
    s2 += a[i];
  }
  int s1 = 0;
  int mi = inf;
  rep(i, n) {
    s1 += a[i];
    s2 -= a[i];
    chmin(mi, abs(s1 - s2));
  }
  cout << mi << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);
	string x;
	cin >> x;
	if (x.size()%2 == 1) {
		cout << "No\n";
		return 0;
	}
	rep(i,0,x.size()) {
		char e = (i%2) ? 'i' : 'h';
		if (x[i] != e) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	
}

Measured memory_bytes: 256
b = input()

if b == ('A'):
    print('T')
elif b == ('C'):
    print('G')
elif b == ('G'):
    print('C')
elif b == ('T'):
    print('A')
else:
    print('入力に誤りがあります。A,C,G,Tのいずれかを入力してください。')


Measured memory_bytes: 9100