akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
// LL Sum(int now, list<int> rem) {
//   for (auto &e : rem) {
//     auto oldrem = rem;

//     Sum(now + 1, rem[i])
//   }
// }
double Dist(VEC<int> &seq, VEC<pair<int, int>> &P) {
  double sum = 0;
  int curx = P[seq[0]].first;
  int cury = P[seq[0]].second;
  REP(i, 1, seq.size()) {
    int nx = P[seq[i]].first;
    int ny = P[seq[i]].second;
    sum += sqrt(pow(nx - curx, 2) + pow(ny - cury, 2));
  }
  return sum;
}

int main() {
  int N;
  cin>>N;
  VEC<pair<int, int>> P(N);
  REP(i, 0, N) { cin >> P[i].first >> P[i].second; }
  VEC<int> seq(N);
  double sum = 0;
  int k=0;
  REP(i, 0, N) { seq[i] = i; }
  do {
    sum+=Dist(seq, P);
    k++;
  } while (next_permutation(ALL(seq)));
  printf("%.10lf\n", sum/k);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <limits.h>
#include <numeric>
using namespace std;

int main() {
	int n;
	bool ans = true;
	string w[105];
	cin >> n;
	for (int i = 1; i<= n; i++) cin >> w[i];
	
	for (int i = 1; i<= n; i++) {
	    for (int j = i + 1; j <= n; j++)
	    if (w[i] == w[j]) ans = false;
	}
	
	for (int i = 1; i< n; i++) {
      	int nagasa = w[i].size();
	    if (w[i][nagasa - 1] != w[i + 1][0]) ans = false;
	}
	
	if (ans) cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var x, y int
	for {
		fmt.Scan(&x, &y)
		if x == 0 && y == 0 {
			break
		}
		if x < y {
			fmt.Println(x, y)
		} else {
			fmt.Println(y, x)
		}
	}
}



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

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

const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const ll Inf = 1LL << 62;

int main() {
#ifdef Mr_Emrul
        freopen("inputf.in", "r", stdin);
#endif /// Mr_Emrul

        long double n;
        cin >> n;
        n *= 2.0;
        n *= acos(-1);
        cout << setprecision(10) << n << fixed;
        return 0;
}

Measured memory_bytes: 3796
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string{
	sc.Scan()
	return sc.Text()
}

func main() {
	// PRE
	n, _ := strconv.Atoi(nextLine())
	a := nextLine()

	fields := strings.Fields(a)
	nums := make([]int, n)

	for i, field := range fields {
		nums[i], _ = strconv.Atoi(field)
	}

	min := math.MaxInt32
	for _, value := range nums {
		count := 0
		for value%2 == 0{
			if count >= min {
				break
			}

			value /= 2
			count++
		}

		if count < min {
			min = count
		}
	}

	fmt.Println(min)
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <queue>
#define maxn 200005

using namespace std;

struct node{
	int to, next;
}e[maxn << 1];
int head[maxn], tot = 0;
void addedge(int u, int v){e[++tot].to = v, e[tot].next = head[u]; head[u] = tot;}

int n, m, Index[maxn][2];
char str[maxn];

bool vis[maxn];

int topo(){
	/*
	queue <int> q; while (!q.empty()) q.pop();
	
	for (int i = 1; i <= n; i++)
		if (!Index[i][0] || !Index[i][1]) q.push(i);
	
	while (!q.empty()){
		int cur = q.front(); q.pop();
		vis[cur] = true;
		
		for (int i = head[cur]; i; i = e[i].next){
			Index[e[i].to][str[cur] - 'A']--;
			if (!vis[e[i].to] && (!Index[e[i].to][0] || !Index[e[i].to][1])){
				q.push(e[i].to);
			}
		}
	}	
	*/
	queue <int> q; while (!q.empty()) q.pop();
	for(int i=1;i<=n;i++) if(Index[i][0]==0||Index[i][1]==0) q.push(i),vis[i]=1;
	int cnt=(int)q.size();
	while(!q.empty()){
		int u=q.front();
		q.pop();
		for(int i=head[u];i;i=e[i].next){
			int v=e[i].to;
			if(--Index[v][str[u]-'A']==0&&vis[v]==0){
				q.push(v);
				cnt++;
				vis[v]=1;
			}
		}
	}
	return cnt;
}

int main(){
	scanf("%d%d%s", &n, &m, str + 1);
	
	while (m--){
		int u, v; scanf("%d%d", &u, &v);
		addedge(u, v);
		addedge(v, u);
		Index[v][str[u] - 'A']++;
		Index[u][str[v] - 'A']++;
	}
	
	puts(topo() == n ? "No" : "Yes");
	return 0;
}

Measured memory_bytes: 6272
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 998244353;
const int IMAX = 100000;
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

ll dp[3001];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N, S;
	cin >> N >> S;

	int A[3000];
	rep(i, N) cin >> A[i];

	ll k2 = modpow(2, mod - 2);
	dp[0] = modpow(2, N);
	rep(i, N) {
		for (int j = S; j >= A[i]; j--) {
			dp[j] = (dp[j] + dp[j - A[i]] * k2) % mod;
		}
	}

	co(dp[S] % mod);

	Would you please return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

ll n,k;
vector<vector<int>> g;
vector<bool> v;
ll ans;

long long perm(int n, int r) {
    ll ret = 1;
    for (int i = 0; i < r; ++i) {
        ret *= n;
        ret %= MOD;
        --n;
    }
    return ret;
}

void dfs(int x, int vl) {
    if (v[x]) return;
    v[x] = true;
    // printf("x = %d, g[x] = %d\n", x+1,(int)g[x].size());
    if (vl == 0) {
        ans *= perm(k-1, g[x].size());
        ans %= MOD;
        for (auto &&e: g[x]) {
            dfs(e,1);
        }
    }
    else {
        if (g[x].size() == 1) return;
        ans *= perm(k-2, g[x].size()-1);
        ans %= MOD;
        for (auto &&e: g[x]) {
            dfs(e,1);
        }
    }
    return ;
}

int main(int argc, char const *argv[]) {
    cin >> n >> k;
    g.resize(n); v.resize(n, false);
    REP(i,n-1) {
        int a,b;
        cin >> a >> b;
        --a,--b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    ans = k;
    dfs(0,0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8064
#[allow(dead_code)]
fn main() {
    let mut nn = i::i();
    let mut nn2= (((nn as f64).sqrt().ceil()) as i64);
    //let mut i10 = i::i();
    //
    let mut pmin = 9999999999999999;
    let mut flagfirst = true;
    for x1 in 1..(nn2+1) {
        if (nn % x1== 0){
            let mut x2 = nn /x1;
            let mut pnum = (x1-1)+(x2-1);
            if (pnum<pmin||flagfirst){
                pmin=pnum;
            }
            flagfirst=false;
        }
    }
    println!("{}",pmin);
}


#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }
    pub fn strv(n: usize) -> Vec<String> {
        (0..n).map(|_| str()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 2632
#include<fstream>
#include<string>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cmath>
 
using namespace std;
 
int main(){
 int A;
 int B;
 cin >> A >> B;
 int C = A+B;
 if(C==4)C=2;
 if(C==5)C=1;
 cout << C << endl;
  return 0;
}

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

#define INF 100000000
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define de cout << "debug" << endl;

int main() {
  int R,G,B,N;
  cin >> R >> G >> B >> N;
  int cnt = 0;
  REP(i,N/R+1){
    REP(j,N/G+1){
      if(i*R+j*G > N) break;
      if((N-(i*R+j*G)) % B == 0){
        cnt++;
      }

    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
import math
a, b, H, M=map(int,input().strip().split())
H %= 12

short = M*6
long = (H*60+M)/2.0
dif = abs(short-long)
kakudo = min(dif,360-dif)

c = a*a + b*b - 2*a*b*(math.cos(math.radians(kakudo)))
d = math.sqrt(c)
print(d)


Measured memory_bytes: 9504
def solve(n, k, c, s):
    ls = set()
    lp = -c - 1
    lc = 0
    for i, w in enumerate(s):
        if w == 'o' and i > lp + c:
            ls.add(i)
            lp = i
            lc += 1

    if lc > k:
        return []

    rp = n + c
    ans = []
    for i in range(n - 1, -1, -1):
        w = s[i]
        if w == 'o' and i < rp - c:
            if i in ls:
                ans.append(i + 1)
            rp = i

    ans.reverse()
    return ans


n, k, c = map(int, input().split())
s = input()
ans = solve(n, k, c, s)
print('\n'.join(map(str, ans)))


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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin >> N;
	pair<pair<string, int>,int>A[110];
	vector < pair<string, int>>tmp;
	for (int i = 0; i < N; i++)
	{
		string S;
		int B;
		cin >> S >> B;
		A[i] = make_pair(make_pair(S, -B),i);
	}
	sort(A, A + N);
	for (int i = 0; i < N; i++)
	{
		cout << A[i].second+1 << endl;
	}
	return 0;
}

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

        #define ll long long
        #define pb push_back
        #define printV(v) for(int i=0;i<(int)v.size();i++){cout << v[i]<< " ";} cout << endl
        #define printRev(v) for(int i=(int)v.size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
        #define sortV(v) sort(v.begin(),v.end())
        #define revV(v) reverse(v.begin(),v.end())
    

        ll a,b,c,d,e,f,g,n,m,k,t,x,h,w,p,q,y;
        string str = "";
        ll mod = 1e9 + 7;
        const int N = 3009;
       
    

        void solve(){
            cin >> n >> m >> k;
            ll time = n/k;
            if(n%k) time++;
            if(time <= m) cout << "Yes\n";
            else cout << "No\n";
        }  


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

            
           


            int cases = 1;
            //cin >> cases;

            while(cases--) solve();
            return 0;

        }


Measured memory_bytes: 3636
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)

//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

void solve()
{
    IN(n);
    rep(i, n)
    {
        IN(a);
        if (a % 2 == 0)
        {
            if (a % 3 != 0 && a % 5 != 0)
            {
                cout << "DENIED" << endl;
                return;
            }
        }
    }
    cout << "APPROVED" << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(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 repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	string s;
	int ans=0;
	cin >>n>>s;
	int l=0, r=n-1;
	while(l <r){
		for (; l < n and s[l] != 'W';l++){}
		for (; r >= 0 and s[r] != 'R';r--){}
		//clog << l << " " << r << endl;
		if( l< r and r!=-1 and l!=n){
			s[l] = 'R';
			s[r] = 'W';
			ans++;
		} 

		}
	cout<<ans<<endl;
}
/*
RRRR...W or R...RWW....WWW
*/

Measured memory_bytes: 3716
use proconio::input;

fn main() {
    input!{
        s: String,
    }

    let sa = s.as_bytes().to_vec();
    let mut rcont = 1;
    let mut rcont_max = 0;
    let mut rprev = false;

    for i in sa.iter() {
        if *i == b'R' {
            if rcont_max == 0 {
                rcont_max = 1;
            }
            if rprev {
                rcont += 1;
                if rcont > rcont_max {
                    rcont_max = rcont;
                }
            }
            rprev = true;
        } else {
            rprev = false;
            rcont = 1;
        }
    }

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


Measured memory_bytes: 2144
struct Read {
    v: Vec<String>,
    i: usize,
}
impl Read {
    pub fn new() -> Self {
        Read{
            v: Vec::new(),
            i: 0,
        }
    }
    fn read_until<T: std::str::FromStr>(&mut self) -> T {
        if self.i == self.v.len() {
            self.read_line();
        }
        let elem = &self.v[self.i];
        self.i += 1;
        elem.parse().unwrap_or_else(|_| panic!())
    }
    pub fn read_i32(&mut self) -> i32 {
        if self.i == self.v.len() {
            self.read_line();
        }
        let elem = self.v[self.i].parse().unwrap();
        self.i += 1;
        elem
    }
    pub fn read_string(&mut self) -> String {
        if self.i == self.v.len() {
            
            self.read_line();
        }
        let elem = &self.v[self.i];
        self.i += 1;
        elem.to_owned()
    }
    pub fn read_line(&mut self) {
        self.i = 0; self.v = Vec::new();
        use std::io::BufRead;use std::io;
        let mut buf = String::new();
        let stdin = io::stdin();
        let mut stdin = stdin.lock();
        stdin.read_line(&mut buf).unwrap();
        let buf = buf.trim().to_owned();
        let mut ws = buf.split_whitespace();
        loop {
            let x = ws.next();
            if x.is_none() {
                break;
            }
            let x = x.unwrap().to_owned();
            self.v.push(x);
        }
    }
}
fn main() {
    let mut read = Read::new();
    let mut n:usize = read.read_until();
    let mut s:Vec<String> = Vec::new();
    for _i in 0..n {
        s.push(read.read_string());
    }
    s.sort();
    let mut ans = 1;
    for i in 0..n-1 {
        if s[i] != s[i+1] {
            ans+=1;
        }
    }
    println!("{}",ans);
}

Measured memory_bytes: 14904
#include <iostream>
#include <vector>

using namespace std;

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

    vector<vector<int>> count(10, vector<int>(10));
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        count[s[0] - '0'][s[s.size() - 1] - '0']++;
    }

    long long ret = 0;
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        ret += count[s[s.size() - 1] - '0'][s[0] - '0'];
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;
bool sr(int a, int b)
{
	return a > b;
}
bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}
int digits(ll n)
{
	int count = 0;
	while (n > 0)
	{
		n /= 10;
		count++;
	}
	return count;
}
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}
bool ssign(int a,int b){
	if(a>0&&b>0){
		return true;
	}else if(a<0&&b<0){
		return true;
	}else{
		return false;
	}
}
bool larger(int a,int b){
	if(a<b){
		return true;
	}else{
		return false;
	}
}
int main()
{
	int x,y;
	cin>>x>>y;
	int ans=0;
	int ay=abs(y);
	int ax=abs(x);
	ans+=abs(abs(y)-abs(x));
	//+<+ larger x
	//+>+ ch ch x
	//(-)<+ ch 
	//(-)>+ ch
	//+>(-) 
	//+<(-)
	//(-)>(-) largerx
	//(-)<(-) x
	//0<+ x
	//0>- x
	//-<0 x
	//+>0 ch x
	if(x==0){
		if(y<0){
			ans++;
		}
	}else if(y==0){
		if(x>0)ans++;
	}else{
		if(ssign(x,y)){
			if(larger(abs(x),abs(y))){
				if(x<0){
					ans+=2;
				}
			}else if(x>0){
				ans+=2;
			}
		}else{
			ans++;
			
		}
	}
	
cout<<ans<<endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string>
#include <iostream>
using namespace std;

class Dice {

private:
	int TOP = 0;
	int FRONT = 1;
	int RIGHT = 2;
	int LEFT = 3;
	int BACK = 4;
	int BOTTOM = 5;
	int pips[6];
	void swap(int tp, int fr, int bt, int ri, int lf, int bk);

public:
	Dice();
	bool equals(Dice d);
	void rotate(char op);
	void spin();
	void setTopAndFront(int top, int front);
	int getPip(int i);
};

Dice::Dice() {
	for (int i = 0; i < 6; i++) cin >> pips[i];
}

bool Dice::equals(Dice d) {
	for (int i = 0; i < 6; i++) {
		if (pips[i] != d.pips[i]) {
			return false;
		}
	}
	return true;
}

void Dice::rotate(char op) {
	switch (op) {
	case 'N': swap(FRONT, BOTTOM, RIGHT, LEFT, TOP, BACK); break;
	case 'S': swap(BACK, TOP, RIGHT, LEFT, BOTTOM, FRONT); break;
	case 'E': swap(LEFT, FRONT, TOP, BOTTOM, BACK, RIGHT); break;
	case 'W': swap(RIGHT, FRONT, BOTTOM, TOP, BACK, LEFT); break;
	}
}

void Dice::spin() {
	swap(TOP, LEFT, FRONT, BACK, RIGHT, BOTTOM);
}

void Dice::swap(int tp, int fr, int ri, int lf, int bk, int bt) {
	int wk[6] = { pips[tp], pips[fr], pips[ri], pips[lf], pips[bk], pips[bt] };
	for (int i = 0; i < 6; i++) pips[i] = wk[i];
}

void Dice::setTopAndFront(int top, int front) {
	if (pips[LEFT] == top) rotate('E');
	if (pips[RIGHT] == top) rotate('W');
	while (pips[TOP] != top) rotate('N');
	while (pips[FRONT] != front) spin();
}

int Dice::getPip(int i) {
	return pips[i];
}

int main()
{
	bool f = false;
	Dice d1 = Dice();
	Dice d2 = Dice();
	d2.setTopAndFront(d1.getPip(0), d1.getPip(1));

	if (d1.equals(d2)) {
		f = true;
	}

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			if (d1.equals(d2)) {
				f = true;
			}
			d2.rotate('N');
		}
		d1.rotate('N');
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			if (d1.equals(d2)) {
				f = true;
			}
			d2.rotate('E');
		}
		d1.rotate('E');
	}

	if (f) cout << "Yes" << "\n";
	else cout << "No" << "\n";
}


Measured memory_bytes: 3088
#include<string>
#include<vector>
#include<cctype>
#include<cmath>
#include<iostream>
using namespace std;

int main(){
    string s1, s2, s3;
    int num1, num2;
    cin >> s1 >> s2;
    cin >> num1 >> num2;
    cin >> s3;
    if(s3==s1)
        num1--;
    else
        num2--;
    cout << num1 << " " << num2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(20)

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 998244353;

// typedef long long ll;
#define int long long
#define double long double

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

struct UnionFind {
  vector<int> par;

  UnionFind(int size) : par(size, -1){}
  void init(int n){ par.assign(n, -1); }

  int find(int x){
    if(par[x] < 0) return x;
    else return par[x] = find(par[x]);
  }
  bool same(int x, int y){
    return find(x)==find(y);
  }
  bool unite(int x, int y){
    x = find(x); y = find(y);
    if(x == y) return 0;
    if(par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return 1;
  }
  int size(int x){
    return -par[find(x)];
  }
};

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

  int N, M, K, L; cin >> N >> M;
  vector<INTV> lang(M);
  UnionFind uf(N);
  REP(i, N){
    cin >> K;
    REP(j, K){
      cin >> L; --L;
      lang[L].eb(i);
    }
  }
  REP(i, M){
    if(lang[i].empty()) continue;
    REP(j, lang[i].size()-1){
      cerr << "debug: " << i << ' ' << j << endl;
      uf.unite(lang[i][j], lang[i][j+1]);
    }
  }
  cout << (uf.size(1)==N ? "YES" : "NO") << endl;
}


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

#define true 1;
#define false 0;

int main(void){
  int n,cnt;
  char is_prime[1000000];
  
  while(1){

    cnt = 0;

  cin >> n;
  if( n == 0 ) break;

  for( int i = 0 ; i <= 2*n ; i++ ){
    is_prime[i] = true;
  }

  is_prime[0] = is_prime[1] = false; 

  for( int i = 2 ; i*i <= 2*n ; i++ )
    if( is_prime[i] )
      for( int j = i*2 ; j <= 2*n ; j += i )
	is_prime[j] = false;

  is_prime[n] = false;

  for( int i = n ; i <= 2*n ; i++ ){
    if( is_prime[i] ) cnt++;
}

  cout << cnt << endl;

  }

  return 0;
}

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

using namespace std;

int main() {
    int N;
    cin>>N;
    int ans=0;
    for(int i=1;i<N+1;i++){
        string s=to_string(i);
        if(s.size()%2==1){
            ans++;
        }
    }
    cout<<ans<<endl;
}

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

int main(){
	int d;
	cin >> d;
	string s;
	if(d == 25) s = "Christmas";
	if(d == 24) s = "Christmas Eve";
	if(d == 23) s = "Christmas Eve Eve";
	if(d == 22) s = "Christmas Eve Eve Eve";
	cout << s << endl;
}

Measured memory_bytes: 256
//ProblemE

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

//ProblemE

#define MAXN 1010

class Solve {
private:
	auto get_max(const vector<long long>& a, int start) {
		pair<long long, vector<int>> rst{};

		int imax = start;
		for (size_t i = start; i < a.size(); i += 2) {
			if (a[i] > 0) {
				rst.first += a[i];
				rst.second.push_back(i);
			}
			if (a[i] > a[imax]) imax = i;
		}

		if (rst.second.empty()) {
			rst.first = a[imax];
			rst.second.push_back(imax);
		}

		return rst;
	}

	void solve() {
		int n;
		cin >> n;
		vector<long long> a = { 0 };
		a.reserve(n + 1);

		for (int i = 1; i <= n; i++) {
			long long tmp;
			cin >> tmp;
			a.push_back(tmp);
		}

		auto rst1 = get_max(a, 1);
		auto rst2 = get_max(a, 2);

		const auto& rst = rst1.first > rst2.first ? rst1 : rst2;
		const auto& use = rst.second;

		list<int> ops;
		for (int i = n; i > use.back(); i--) {
			ops.push_back(i);
		}
		for (int i = 1; i < use.front(); i++) {
			ops.push_back(1);
		}

		if (use.size() >= 2) {
			for (int i = 0; i < (int)use.size() - 1; i++) {
				int delta = use[i + 1] - use[i] - 1;
				for (int j = 0; j < delta / 2; j++) {
					ops.push_back(3);
				}
				ops.push_back(2);
			}
		}

		cout << rst.first << endl;
		cout << ops.size() << endl;
		for (auto op : ops) {
			cout << op << endl;
		}
	}

public:
	Solve() { solve(); }
};

int main(int argc, char* argv[]) {
	unique_ptr<Solve> solve = make_unique<Solve>();
	return 0;
}


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

#define ll long long
#define NIL 0
#define INF 2e9
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vl vector<ll>
#define vvl vector<vector<ll>> 
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define pb push_back
#define F first
#define S second
#define pp pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define rpk(i,k,n) for(int i=k;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++) 
#define RPK(i,k,n) for(int i=k;i<=n;i++) 
#define ritr(i,gr) for(auto i=gr.begin();i!=gr.end();i++)

const int M = 1e9+7;

int V, E, i, j, k, u, v, x, y, p, q, r, t, n,w,m;
vi *g;
vb sn;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    double p[n];
    rep(i,n) cin>>p[i];
    long double dp[n+1][n+1];
    cout<<std::fixed<<setprecision(10);
    rep(i,n+1) dp[0][i] = 0,dp[1][i]=0;
    
    dp[1][0]=1-p[0];
    dp[1][1] = p[0];

    
    RPK(i,2,n) {
        dp[i][0] = dp[i-1][0]*(1-p[i-1]);
        REP(j,n) {
            dp[i][j] = (1-p[i-1])*dp[i-1][j]+p[i-1]*dp[i-1][j-1]; 
        }
    }
    long double res= 0;
    RPK(i, (n+1)/2, n) {res+=dp[n][i];}
    cout<<res<<endl;
}
    

Measured memory_bytes: 144312
#include<bits/stdc++.h>
using namespace std;
typedef long long INT;
int f(int a, int b, int c){
	int d;
	while(a*b){
		d = a;
		a = b;
		b = d % a;
	}
	while(a*c){
		d = a;
		a = c;
		c = d % a;
	}
	return a;
}
int main(){
	int n,i,j,t, s =0;
	cin >> n;
 	for(i=1;i<=n;i++)
		for(j=1;j<=n;j++)
			for(t=1;t<=n;t++)
				s += f(i, j, t); 
	cout << s;
}


Measured memory_bytes: 3632
#include <iostream>

int main() {

	int A, B, C;

	std::cin >> A >> B >> C;

	if(A+B-C >= 0){
		std::cout << "Yes"
			<< std::endl;
	}
	else{
		std::cout << "No"
		<< std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100
int selectionSort(int [],int);

int main(){
  int n,a[N],i,cnt=0;
  
  scanf("%d",&n);

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

  cnt=selectionSort(a,n);

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

  return 0;
}

int selectionSort(int x[],int y){
  int i,j,tmp,count=0,minj;

  for(i=0;i<y-1;i++){
    minj=i;
    for(j=i;j<y;j++){
      if(x[j]<x[minj]){
	minj=j;
      }
    }
    tmp=x[i];
    x[i]=x[minj];
    x[minj]=tmp;
    if(i!=minj)
      count++;
  }
  return count;
}



Measured memory_bytes: 2140
*a,=map(int,open(0).read().split());print('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,1,2},{0,3,6},{0,4,8},{1,4,7},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2])

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
vector <int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(),a.end());
  cout << a[0] + a[1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

typedef long long ll;

int main(){
  ll n,k;
  std::cin>>n>>k;
  if(k==0){
    std::cout<<n*n<<std::endl;
    return 0;
  }//*/
  ll ans=0;
  for(ll b=k+1;b<=n;++b){
    ll cycle=b-k;
    ans+=cycle*(n/b);
    if(n%b>=k)ans+=n%b-k+1;
  }//*/
 /*for(int a=k;a<=n;++a){
    ans+=n-a;
    //if(a-2*k>0)ans+=a-2*k;
    
 }//*/
  std::cout<<ans<<std::endl;
  return 0;
}


Measured memory_bytes: 256
//lib
function readInt(str){
    return parseInt(str, 10);
}
function gcd(a:number, b:number){
    if(a==0)return b;
    return gcd(b%a, a);
}
function range(begin:number, end:number):number[]{
    if(begin > end) return range(end, begin).reverse();
    const ans=[];
    for(let i=begin; i<=end; i++){
        ans.push(i);
    }
    return ans;
}
class SimpleBigInt{
    value:number[];
    constructor(num:number){
        this.value=new Array(10).fill(0); //0~9
        if(num>=1){
            this.value[num]=1;
        }
    }
    clone(){
        const newValue = this.value.slice(0);
        const ans = new SimpleBigInt(0);
        ans.value = newValue;
        return ans;
    }
    length(){
        return this.value.reduce((x,y)=>x+y, 0);
    }
    isGreater(other:SimpleBigInt):boolean{
        if(this.length() > other.length())return true;
        else if(this.length() < other.length()) return false;
        for (const index of range(9, 1)) {
            if(this.value[index] > other.value[index])return true;
            else if(this.value[index] < other.value[index]) return false;
        }
        return false;
    }
    add(digit:number):SimpleBigInt{
        const ans = this.clone();
        ans.value[digit]++;
        return ans;
    }
    toString(){
        let ans="";
        for (const index of range(9, 1)) {
            ans+=String(index).repeat(this.value[index]);
        }
        return ans;
    }
}
//const
const match=[,2,5,5,4,5,6,3,7,6];
//main
function Main(raw) {
    //raw="20 4\n3 7 8 4"
    const input = raw.split("\n");
    const [N, M] = input[0].split(" ").map(readInt);
    const A:number[] = input[1].split(" ").map(readInt);
    const dp:(SimpleBigInt|null)[]=new Array(N+1).fill(null);
    dp[0]=new SimpleBigInt(0);
    for(let i=0;i<=N;i++){
        const cur=dp[i];
        if(cur===null)continue;
        A.forEach(digit => {
            const honsuu = match[digit];
            if(dp[honsuu+i]===null)
                dp[honsuu+i] = cur.add(digit);
            else if(honsuu+i<=N){
                if(cur.add(digit).isGreater(dp[honsuu+i])){
                    dp[honsuu+i] = cur.add(digit);
                }
            }
        });
    }
    //出力
    console.log("%s", dp[N].toString());
}
  
//DO NOT EDIT
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  

Measured memory_bytes: 18052
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

const int MAX_N=55;
int A[MAX_N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    REP(i, n) cin >> A[i];

    int ans=0;
    REP(i, k+1) {
        REP(j, k-i+1) {
            if(i+j>n) continue;
            vector<int> v;
            int res=0;
            REP(t, i) res+=A[t], v.PB(A[t]);
            REP(t, j) res+=A[n-t-1], v.PB(A[n-t-1]);
            sort(ALL(v));
            int d = k-i-j;
            REP(t, d) {
                if(t>=v.size()) break;
                if(v[t]>0) break;
                res-=v[t];
            }
            chmax(ans, res);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define NO return printf("No\n"),0;
using namespace std;
string s,c;
int n;
map<string,int> m;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s;
		if(m[s]==1)
			NO
		int len=s.length()-1;
		if(i==1)
			c=s[len];
		else if(s[0]!=c[0])
			NO
		m[s]=1;
		c[0]=s[len];
	}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    ll s, w; cin >> s >> w;

    if(w >= s){
        cout << "unsafe" << endl;
    }
    else{
        cout << "safe" << endl;
    }

    return 0;
}

Measured memory_bytes: 3644
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(sc.nextInt(), i + 1);
        }
        for (int i = 1; i <= n; i++) {
            if (i != 1) {
                System.out.print(" ");
            }
            System.out.print(map.get(i));
        }
        sc.close();
    }
}

Measured memory_bytes: 75440
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

const ll mod = static_cast<ll>(1e9) + 7;

int main()
{
    ll N, X, Y;
    cin >> N >> X >> Y;

    --X;
    --Y;

    REP (k, 1, N)
    {
        ll res = 0;

        rep (i, N)
        {
            if (N <= i + k) { continue; }

            if (i <= X && i + k <= X) { ++res; continue; }

            const ll d = k - abs(X - i) - 1;
            if (d < 0) { ++res; continue; }

            const ll a = Y - d;
            const ll b = Y + d;
            const ll c = i + k;

            if (c < a) { ++res; }
            if (b < N) { ++res; }
            if (c <= a && a < b) { ++res; }
        }

        cout << res << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>		 // cout, endl, cin
#include <string>		 // string, to_string, stoi
#include <vector>		 // vector
#include <algorithm>	 // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>		 // pair, make_pair
#include <tuple>		 // tuple, make_tuple
#include <cstdint>		 // int64_t, int*_t
#include <cstdio>		 // printf
#include <map>			 // map
#include <queue>		 // queue, priority_queue
#include <set>			 // set
#include <stack>		 // stack
#include <deque>		 // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>		 // bitset
#include <cctype>		 // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	int index = 0;
	int cnt = 0;
	int ans = 0;
	while(index < n){
		if(s[index] == 'A' || s[index] == 'T' || s[index] == 'G' || s[index] == 'C'){
			cnt += 1;
		}
		else{
			ans = max(ans, cnt);
			cnt = 0;
		}
		index++;
	}
	ans = max(ans, cnt);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>                                             
#include <cmath>                                                
#include <queue>                                                
using namespace std;                                            
                                                                
int main() {                                                    
  int N;                                                        
  cin >> N;                                                     
  priority_queue<int> data;                                     
  while (N--) {                                                 
    int a, b, c;                                                
    cin >> a >> b >> c;                                         
    data.push(a);                                               
    data.push(b);                                               
    data.push(c);                                               
    a = data.top();                                             
    data.pop();                                                 
    b = data.top();                                             
    data.pop();                                                 
    c = data.top();                                             
    data.pop();                                                 
    if (pow(a,2)==pow(b,2)+pow(c,2)) {                          
      cout << "YES" << endl;                                    
    } else {                                                    
      cout << "NO" << endl;                                     
    }                                                           
  }                                                             
  return 0;                                                     
}                                                               
                  

Measured memory_bytes: 2964
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n;i++){
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  long long dif=(1e10+1);
  for (int i=0; i <= n-k; i++){
    if (dif > v[i+k-1]-v[i]) dif=v[i+k-1]-v[i];
  }
  cout << dif << endl;
  return 0;
}
    


Measured memory_bytes: 640
open Scanf
open Printf

let flip f x y = f y x

let rec range a b = if a >= b then [] else a :: range (a+1) b

let read_int () = scanf " %d" (fun x -> x)
let rec read_ints n = if n = 0 then [] else let i = read_int () in i :: read_ints (n-1)

let rec for_iter a b f = if a >= b then [] else let x = f a in x :: for_iter (a+1) b f
let rec for_iter_ a b f = if a >= b then () else (f a; for_iter_ (a+1) b f)

let group xs =
  let rec f v xs = match xs with
  | [] -> []
  | (x::xs) -> if x = v then v :: f (-1) xs else f x xs in
  f (-1) xs

let () =
  let n = read_int () in
  let xs = read_ints n |> List.sort (flip (-)) |> group in
  printf "%d\n" @@ match xs with
  | (x::y::_) -> x * y
  | _ -> 0


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

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    if(A==B && A !=C) cout << "Yes" << endl;
    else if(B==C && C!=A) cout << "Yes" << endl;
    else if(C==A && A!=B) cout << "Yes" << endl;
    else cout << "No" << endl; 
    return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_H = (int)(8e1 + 5);
const int MAX_W = (int)(8e1 + 5);
const int MAX_DIFF = (int)(8e1 + 5);
const int BASE = MAX_H * MAX_W * MAX_DIFF;
const int SIZE = 2 * BASE;

int h, w;
int a[MAX_H][MAX_W];
int b[MAX_H][MAX_W];

bitset<SIZE> dp[MAX_H][MAX_W];

int main(void) {
  // Here your code !
  scanf("%d %d", &h, &w);

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      scanf("%d", &(a[i][j]));
    }
  }

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      scanf("%d", &(b[i][j]));
    }
  }

  int init = abs(a[0][0] - b[0][0]);

  dp[0][0].set(BASE + init);
  dp[0][0].set(BASE - init);

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      int diff = abs(a[i][j] - b[i][j]);

      if (i - 1 >= 0) {
        dp[i][j] |= (dp[i - 1][j] << diff);
        dp[i][j] |= (dp[i - 1][j] >> diff);
      }

      if (j - 1 >= 0) {
        dp[i][j] |= (dp[i][j - 1] << diff);
        dp[i][j] |= (dp[i][j - 1] >> diff);
      }
    }
  }

  int ans = SIZE;

  for (int i = 0; i < SIZE; ++i) {
    if (dp[h - 1][w - 1].test(i)) {
      ans = min(ans, abs(i - BASE));
    }
  }

  printf("%d\n", ans);

  return 0;
}


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

int     main() {
	string s, t;
	cin >>s >>t;
	int ss=s.size();
	int tt=t.size();
	vector<vector<int>> Step(26, vector<int> (ss+1, -1));
	for (int i=1; i<=ss; i++) {
		int c=s.at(i-1)-'a';
		if (-1==Step.at(c).at(1)) 
			for (int j=0; j<=ss; j++)
				Step.at(c).at(j)=i;
		else 
			for (int j=i-1; j>=Step.at(c).at(j); j--)
				Step.at(c).at(j)=i;
	}
	long Loop=0;
	int cc=t.at(0)-'a';
	int Pos=0;
	for (int i=0; i<tt; i++) {
		int cc=t.at(i)-'a';
		int Pos2=Step.at(cc).at(Pos);
		if (-1==Pos2) {
			cout <<-1 <<endl;
			return 0;
		}
		if (Pos2<=Pos)
			Loop++;
		Pos=Pos2;
	}
	cout <<Loop*ss+Pos <<endl;
	return 0;
};


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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;
using ulong = unsigned long;

void hawawa()
{
  int n;
  cin >> n;
  //part_aとpart_bは後々の処理の簡略化のためにn+1個の要素
  //part_a[0]とpart_b[0]は0とする
  Vec<int> a(n), b(n), part_a(n + 1), part_b(n + 1);
  for (auto&& i : a) {
    cin >> i;
  }
  partial_sum(begin(a), end(a), begin(part_a) + 1);
  for (auto&& i : b) {
    cin >> i;
  }
  partial_sum(begin(b), end(b), begin(part_b) + 1);
  
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, part_a[i + 1] + part_b[n] - part_b[i]);
  }
  cout << ans << "\n";
}

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


Measured memory_bytes: 256
def createTable(a):
    n = len(a)
    table = set()
    for i in range(1 << n):
        array = []
        for j in range(n):
            if (i & 1 << j) > 0:
                array.append(a[j])
        table.add(sum(array))
    return table


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

q = int(input())
m = list(map(int, input().split()))

table = createTable(a)

for i in range(q):
    if m[i] in table:
        print("yes")
    else:
        print("no")



Measured memory_bytes: 5656
#include <iostream>
#include <fstream>
#include <cstring>
#include <climits>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

#define ll long long
#define mod 1000000007

int h, w;
char a[1001][1001];
ll dp[1001][1001];

ll solve(int i, int j) {

	if (i == h or j == w)
		return 0;

	if (i == h - 1 and j == w - 1)
		return 1;

	if (a[i][j] == '#')
		return 0;

	if (dp[i][j] != -1)
		return dp[i][j];

	dp[i][j] = (solve(i + 1, j) + solve(i, j + 1)) % mod;
	return dp[i][j];
}

int main() {

	cin >> h >> w;

	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			cin >> a[i][j];
		}
	}

	memset(dp, -1, sizeof(dp));
	cout << solve(0, 0);

	return 0;
}

Measured memory_bytes: 9088
tako = int(input())
tako_oisisa =  [int(i) for i in input().split()]
answer = 0
for i in range(tako):
  for s in range(tako):
    if i == s:
        continue
    else:
        answer += tako_oisisa[i]*tako_oisisa[s]
print(int(answer/2))

Measured memory_bytes: 2940