akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;
int main(){
    ll n,ans=0,tmp=0;
    cin>>n;
    vector<ll> a,b,c;
    rep(i,0,n){cin>>tmp;a.push_back(tmp);}
    rep(i,0,n){cin>>tmp;b.push_back(tmp);}
    rep(i,0,n){cin>>tmp;c.push_back(tmp);}
    sort(a.begin(),a.end());
    sort(c.begin(),c.end());
    rep(i,0,n){
        ll aa = lower_bound(a.begin(),a.end(),b[i])-a.begin();
        ll cc = upper_bound(c.begin(),c.end(),b[i])-c.end();
        ans-=aa*cc;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <vector>

template<int64_t p> 
struct Fp {
    Fp(int64_t n) : n(n%p) {}
    Fp operator+(const Fp &rhs)  {
        return Fp(n + rhs.n);
    }
    Fp operator*(const Fp &rhs)  {
        return Fp(n * rhs.n);
    }
    int64_t n;
};

constexpr int64_t P = 998244353;

struct Robot {
    int64_t x;
    int64_t d;
};


void indent(size_t dep) {
    for (size_t i = 0; i < dep; i++) {
        std::cerr<<' ';
    }
}

std::pair<size_t, Fp<P>> 
calc_combi(const std::vector<Robot> &robots, size_t begin, int64_t end_x) {
    static size_t dep = 0;
    dep++;
    //indent(dep);
    //std::cerr << begin << " at " << robots[begin].x << ' ' << end_x  << std::endl;
    if (begin >= robots.size()) {
        throw "out of index";
    }
    if (robots[begin].x >= end_x) {
        throw "out of x bound";
    }

    size_t head = begin;
    Fp<P> accum = 1;
    while (head < robots.size()) {
        const Robot &r = robots[head]; 
        if (r.x >= end_x) {
            break;
        }
        if (head + 1 >= robots.size()) {
            head = head + 1;
            accum = accum * 2;
            break;
        }
        const Robot &next = robots[head + 1];
        if (next.x >= r.x + r.d) {
            head = head + 1;
            accum = accum * 2;
        } else {
            auto p = calc_combi(robots, head + 1, r.x + r.d);
            head = p.first;
            accum = accum * (p.second + 1);
        }
    }
    //indent(dep);
    //std::cerr << begin << " at " << robots[begin].x << ' '  << end_x << 
    //    " -> " << head << ' ' << accum.n << std::endl;
    dep--;
    return {head, accum};
}

int main() 
{
    try {
        size_t n;
        scanf("%ld", &n);
        std::vector<Robot> robots;
        for (size_t i = 0; i < n; i++) {
            Robot r;
            scanf("%ld %ld", &r.x, &r.d);
            robots.push_back(r);
        }
        std::sort(robots.begin(), robots.end(), 
                [](const Robot &a, const Robot &b) { return a.x < b.x; });
        auto result = calc_combi(robots, 0, robots.back().x + 1);
        std::cout << result.second.n << std::endl;
    } catch(const char* e) {
        //std::cerr << e << std::endl;
    }
    return 0;
}


Measured memory_bytes: 13676
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string s;
    LL k;
    cin >> s >> k;
    LL ans = 0;
    int n = s.size();
    {
        bool b = true;
        REP(i,1,n) if (s[i] != s[i-1]) {
            b = false;
            break;
        }
        if (b) {
            cout << LL(1LL * n * k / 2) << endl;
            return;
        }
    }
    int cnt = 1;
    VP ps;
    REP(i,1,n) {
        if (s[i] == s[i-1]) ++cnt;
        else {
            //c[s[i-1]-'a'][cnt]++;
            ps.emplace_back(s[i-1]-'a', cnt);
            cnt = 1;
        }
    }
    //c[s[n-1]][cnt]++;
    REP(i,1,ps.size()) {
        ans += k * (ps[i].second / 2);
    }
    if (ps[0].first != s[n-1] - 'a') {
        ans += k * (ps[0].second / 2);
        ans += k * (cnt / 2);
    } else {
        ans += (ps[0].second / 2);
        ans += (cnt / 2);
        ans += (k - 1) * ((ps[0].second + cnt) / 2);
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var A, B, C, ans int
	fmt.Scan(&A, &B, &C)
	
	if A == B {
		ans = C
	} else if B == C {
		ans = A
	} else {
		ans = B
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
fun main(args: Array<String>) {
    val (x, y) = readLine()!!.split(" ").map { it.toInt() }
    var a = "-1 -1 -1"
    var noguchi = 0
    var ichiyo = 0
    var yukichi = 0
    for(i in 0..x){
        for(j in 0..x)
        if(i * 10000 + j * 5000 + ( x - i - j ) * 1000 == y && x - i - j >= 0){
            yukichi = i
            ichiyo = j
            noguchi = x - i - j
            a = "$yukichi $ichiyo $noguchi"
        }
    }
    println(a)
}

Measured memory_bytes: 38204
import java.util.Arrays;
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{ new Main().Solve(); }
	

	
	public void Solve()
	{
		Scanner sc=new Scanner(System.in);
		Player[] finalist =new Player[6];
		Player[] candidate=new Player[18];
		
		for(int i=0; i<3; i++)
		{
			Player[] p=new Player[8];
			for(int j=0; j<8; j++)
				p[j] = new Player(sc.nextInt(), sc.nextDouble());

			Arrays.sort(p);
			finalist[i*2  ]=p[0];
			finalist[i*2+1]=p[1];
			
			for(int j=0; j<6; j++)
				candidate[i*6+j]=p[j+2];
		}
		for(int i=0; i<6; i++)
			System.out.println(finalist[i]);

		Arrays.sort(candidate);
		for(int i=0; i<2; i++)
			System.out.println(candidate[i]);
	}

	class Player implements Comparable<Player>
	{
		private int    no;
		private double time;
		
		public Player(int no, double time)
		{ this.no=no; this.time=time; }
		
		public String toString()
		{ return String.format("%d %.2f", no, time); }
		
		public int compareTo(Player p)
		{
			if(this.time > p.time)return 1;
			if(this.time < p.time)return -1;
			return 0;
		}
	}
}

Measured memory_bytes: 20336
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		Scanner scan = new Scanner(System.in);
		int num[] = new int[6];
		int answer = 0;
		int decTime = 0;
		int frontAddress = 0;
		diceClass dice =new diceClass();
		for (int i=0;i<6;i++){
			num[i] = scan.nextInt();
			dice.pos[i] = num[i];
		}
		decTime = scan.nextInt();
		int upSide[] = new int[decTime];
		int frontSide[] = new int[decTime];
		for(int i=0;i<decTime;i++){
			upSide[i] = scan.nextInt();
			frontSide[i] = scan.nextInt();
			for(int j=0;j<6;j++){		//[J]?????£??¢?????°?????¨??????????????°?????£??¢????????°???J
				if(frontSide[i] == num[j]){
					frontAddress = j;
				}
			}
			for(int j=0;j<6;j++){
				if(upSide[i] == num[j]){		//[J]????????¢?????°?????¨??????????????°????????¢????????°???J?????£??¢????????¢????????°??????????????°????????????????????????????????????
					answer = dice.rightNumber(j,frontAddress);
					System.out.println(num[answer]);
				}
			}
		}
	}
}

class diceClass{	
	int pos[] = new int[6];
	int up0[] = {1,2,4,3};
	int up1[] = {0,3,5,2};
	int up2[] = {0,1,5,4};
	int up3[] = {0,4,5,1};
	int up4[] = {0,2,5,3};
	int up5[] = {1,3,4,2};
	public diceClass(){

	}

	public int rightNumber(int up,int fr){
		int[] temp = new int[4];
		int front = 0;
		if(up == 0){
			temp = (int[])up0.clone();
		}
		else if(up == 1){
			temp = (int[])up1.clone();
		}
		else if(up == 2){
			temp = (int[])up2.clone();
		}
		else if(up == 3){
			temp = (int[])up3.clone();
		}
		else if(up == 4){
			temp = (int[])up4.clone();
		}
		else if(up == 5){
			temp = (int[])up5.clone();
		}
		for(int i =0;i<4;i++){
			if(temp[i] == fr){
				front = i+1;
				if(front == 4){
					front = 0;
				}
				break;
			}
		}
		return temp[front];
	}
}

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

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

long long lcm(long long a, long long b){
    if (a == 0 || b == 0) return 0;
    else return a / gcd(a, b) * b;
}

int main(){

    int N;
    cin >> N;
    vector<long long> T(N);
    for(int i = 0; i < N; i++) cin >> T[i];

    long long ans = T.front();
    for(int i = 1; i < N; i++) ans = lcm(ans, T[i]);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	Scanner sc = new Scanner(System.in);

	void run() {
		sc.nextInt();
		int q = sc.nextInt();
		C c = new C();
		Queue<Pair> queue = new PriorityQueue<Pair>(1000 * 1000, c);
		Map<Integer, Pair> map = new HashMap<Integer, Pair>();
		for (int i = 0; i < q; i++) {
			int a = sc.nextInt();
			int v = sc.nextInt();
			if (!map.containsKey(a)) {
				Pair p = new Pair(a, v);
				map.put(a, p);
				queue.add(p);
			} else {
				Pair p = map.get(a);
				queue.remove(p);
				p.b += v;
				queue.add(p);
			}
			Pair pp = queue.peek();
			System.out.println(pp.a + " " + pp.b);
		}

	}

	public static void main(String[] args) {
		new Main().run();
	}
}

class C implements Comparator<Pair> {

	public int compare(Pair o1, Pair o2) {
		if (o1.b == o2.b) {
			return o1.a - o2.a;
		}
		return o2.b - o1.b;
	}

}

class Pair {
	public int a;
	public int b;

	Pair(int a, int b) {
		this.a = a;
		this.b = b;
	}
}

Measured memory_bytes: 109384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h1,m1,h2,m2,k,p,q;
  cin>>h1>>m1>>h2>>m2>>k;
  p=h1*60+m1;
  q=h2*60+m2;
  cout<<q-p-k<<endl;
}

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

using namespace std;

int main()
{
  int N;
  double px[200], py[200], pz[200];
  double vx[200], vy[200], vz[200];
  double r[200], vr[200];

  while(cin >> N, N) {
    for(int i = 0; i < N; i++) {
      cin >> px[i] >> py[i] >> pz[i] >> vx[i] >> vy[i] >> vz[i] >> r[i] >> vr[i];
    }
    vector< tuple< double, int, int > > que;
    for(int i = 0; i < N; i++) {
      for(int j = 0; j < i; j++) {
        double a = vx[i] * vx[i] + vx[j] * vx[j] + vy[i] * vy[i] + vy[j] * vy[j] + vz[i] * vz[i] + vz[j] * vz[j] - vr[i] * vr[i] - vr[j] * vr[j] - 2 * vx[i] * vx[j] - 2 * vy[i] * vy[j] - 2 * vz[i] * vz[j] - 2 * vr[i] * vr[j];
        double b = 2 * px[i] * vx[i] - 2 * vx[i] * px[j] - 2 * px[i] * vx[j] + 2 * px[j] * vx[j]
                   + 2 * py[i] * vy[i] - 2 * vy[i] * py[j] - 2 * py[i] * vy[j] + 2 * py[j] * vy[j]
                   + 2 * pz[i] * vz[i] - 2 * vz[i] * pz[j] - 2 * pz[i] * vz[j] + 2 * pz[j] * vz[j]
                   + 2 * r[i] * vr[i] + 2 * vr[i] * r[j] + 2 * r[i] * vr[j] + 2 * r[j] * vr[j];
        double c = px[i] * px[i] + px[j] * px[j] + py[i] * py[i] + py[j] * py[j] + pz[i] * pz[i] + pz[j] * pz[j] - r[i] * r[i] - r[j] * r[j] - 2 * px[i] * px[j] - 2 * py[i] * py[j] - 2 * pz[i] * pz[j] - 2 * r[i] * r[j];

        double d = b * b - 4 * a * c;
        if(d < 0) continue;
        double t1 = (-b + sqrt(d)) / (2 * a);
        double t2 = (-b - sqrt(d)) / (2 * a);
        if(t1 > 0) que.emplace_back(t1, i, j);
        if(t2 > 0) que.emplace_back(t2, i, j);
      }
      que.emplace_back(r[i] / vr[i], i, -1);
    }

    double kill[200] = {};
    sort(begin(que), end(que));
    for(auto &p : que) {
      double a;
      int b, c;
      tie(a, b, c) = p;

      if(kill[b] != 0) continue;
      if(~c && kill[c] != 0) continue;
      kill[b] = a;
      if(~c) kill[c] = a;
    }

    for(int i = 0; i < N; i++) {
      cout << fixed << setprecision(10) << kill[i] << endl;
    }
  }

}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

signed main()
{
  int N, A, B;
  cin >> N >> A >> B;
  vector<int> V(N);
  map<int, int> mp0;
  for (int i = 0; i < N; i++)
  {
    cin >> V.at(i);
    mp0[V.at(i)]++;
  }
  
  sort(V.begin(), V.end(), greater<int>());

  double ave = 0;
  map<int, int> mp1;
  for (int i = 0; i < A; i++)
  {
    ave += (double)V.at(i);
    mp1[V.at(i)]++;
  }
  ave /= (double)A;

  cout << fixed << setprecision(10) << ave << endl;

  int n = mp0.at(V.at(A - 1));
  int k = mp1.at(V.at(A - 1));
  
  cerr << n << " " << k << endl;
  cerr << mp1.size() << endl;

  vector<vector<int>> C(60, vector<int>(60, 1));
  C.at(0).at(0) = 1;
  for (int i = 1; i < 60; i++)
  {
    C.at(i).at(0) = 1;
    for (int j = 1; j < i; j++)
    {
      C.at(i).at(j) = C.at(i - 1).at(j - 1) + C.at(i - 1).at(j);
    }
  }

  int ans = 0;
  if (mp1.size() == 1)
  {
    for (int i = A; i <= min(n, B); i++)
    {
      ans += C.at(n).at(i);
    }
  }
  else
  {
    ans = C.at(n).at(k);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[55];
int main(){
	int n;
	cin>>n;
	vector<int> v;
	for(int i=0;i<n;i++){
		cin>>a[i];
		v.push_back(a[i]);
	}
	sort(v.begin(),v.end());
	int cnt=0;
	for(int i=0;i<v.size();i++){
		if(v[i]!=a[i])cnt++;
	}
	if(cnt<=2)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int R;
    cin >> R;
    if(R<1200) cout << "ABC" << endl;
    else if(R<2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
N=int(input())
l=[[0,0,0]]

for _ in range(N):
    l.append(list(map(int,input().split())))
   
for i in range(N):
    temp=[l[i+1][0]-l[i][0],l[i+1][1]-l[i][1],l[i+1][2]-l[i][2]]
    
    if temp[0]<temp[1]+temp[2] or temp[0]%2!=(temp[1]+temp[2])%2:
        print("No")
        exit()
    else:
        continue
    print(temp)

print("Yes")

Measured memory_bytes: 27300
#include <math.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int N;
    cin >> N;
    long long M[N],total=0,sum=0;
    for (int i = 0; i < N;i++){
        cin >> M[i];
        total += M[i];
        total = total % 1000000007;
    }
        for (int i = 0; i < N - 1; i++) {
            if (total >= M[i]) total -= M[i];
            else
                total = total + 1000000007 - M[i];
            sum+=(M[i] * total) % 1000000007;
            sum = sum % 1000000007;
             }
             cout << sum << endl;
             return 0;
}


Measured memory_bytes: 5200
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define MAX 12
#define MAX_ORDER 16777216

char dec[MAX_ORDER][MAX];

int getChar_ID(char c){
  if(c == 'A'){
    return 1;
  }else if(c == 'C'){
    return 2;
  }else if(c == 'G'){
    return 3;
  }else if(c == 'T'){
    return 4;
  }else return -1;
}

long analysis(char *str){
  int len = strlen(str);
  int i;
  int id=0;
  int k=1;
  //printf("in to analysis\n" );
  for(i=0; i<len; i++){
    id += k * getChar_ID(str[len-i-1]);
    k *= 4;
    //printf("len-i=%d\n",len-i );
    //printf("Now ID: %d\n", id);
  }
  return id;
}

void insert(int id, char *str){
  strcpy(dec[id],str);
}

void find(int id,char *str){
  if(0==strcmp(dec[id],str)){
    printf("yes\n" );
  }else printf("no\n" );
}

int main() {
  int n;
  char str[MAX];
  char com[7];
  int i;

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%s %s",com,str);
    if(com[0]=='i'){
      insert(analysis(str),str);
    }else if(com[0]=='f'){
      find(analysis(str),str);
    }else printf("Command is illegal\n");
  }
  return 0;
}



Measured memory_bytes: 18104
#include "bits/stdc++.h"
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
using ll = long long;
using namespace std;

/*
ll GCD(ll a, ll b) {
	return b ? GCD(b, a%b) : a;
}

sort(a, a + N, greater<int>())   // descend
sort(a, a+N)                    //  ascend


** nCk
void comb(vector<vector <long long int > > &v) {
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}


** main内でnCn~nC0 生成 **
vector<vector<long long int> > v(n + 1, vector<long long int>(n + 1, 0));
	comb(v);


*/


int main() {
	int n;
	int p[22];
	cin >> n;
	rep(i, 0, n) cin >> p[i];
	int ans = 0;
	rep(i, 1, n-1) {
		if ((p[i] > p[i - 1] && p[i] < p[i + 1]) || (p[i] > p[i + 1] && p[i] < p[i - 1])) ans++;
	}
	cout << ans++;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  if (s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[1000][100007];

ll RKnapsack(ll v[][2], ll i, ll w, ll n){
	if(i>=n) return 0;
	if(w<v[i][0]) return RKnapsack(v, i+1, w, n);
	if(dp[i][w]!=-1) return dp[i][w];
	dp[i][w] = max(v[i][1]+RKnapsack(v, i+1, w-v[i][0], n), RKnapsack(v, i+1, w, n));
	return dp[i][w];
}

int main(){
	ll n, w;
	cin>>n>>w;
	ll v[n][2];
	memset(dp, -1, sizeof(dp));
	for(int i=0;i<n;i++) cin>>v[i][0]>>v[i][1];
	cout<<RKnapsack(v, 0, w, n);
}


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

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

    int n;
    cin >> n;
    vector<ll> a(n + 2), s(n + 2);
    vector<vector<ll>> dp(n + 2, vector<ll>(n + 2));
    forx(i, 1, n + 1)
    {
        cin >> a[i];
        s[i] = s[i - 1] + a[i];
        dp[i][i] = a[i];
    }

    forx(i, 1, n)
    {
        forx(l, 1, n - i + 1)
        {
            int r = l + i;
            dp[l][r] = max(a[l] - dp[l + 1][r], a[r] - dp[l][r - 1]);
        }
    }
    cout << dp[1][n] << endl;

    return 0;
}

Measured memory_bytes: 70912
#include <iostream>
#include <set>
#include <math.h>
#include <list>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MAX_N 1005
#define MAX_M 100

int N;
int B[MAX_N];

int main()
{
    string S;
    cin >> S;
    int ans = 0;
    int tmp = 0;
    rep(i, S.length())
    {
        if (S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C')
            tmp++;
        else
        {
            ans = max(ans, tmp);
            tmp = 0;
        }
    }
    ans = max(ans, tmp);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
long long f(long long a,long long b) {
	return floor(a / b);
}
int main(){
	long long dp[30];
	dp[1] = 1; dp[2] = 2; dp[3] = 4;
	for (int i = 4; i <= 30; i++)
		dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
	int n;
	while (cin >> n){
		if (n == 0)return 0;
		cout << f(f(dp[n], 10), 365) + 1 << endl;
	}
}

Measured memory_bytes: 3012
data = [int(x) for x in input().split()]
data.extend([int(x) for x in input().split()])
data.extend([int(x) for x in input().split()])
H = int(input())

class Bingo:
  sheet = []
  def __init__(self, data):
    self.sheet = [{x: False} for x in data]
   
  def addNumber(self, num):
    for i in self.sheet:
      if num in i:
        i[num] = True
    
  def printBingoVal(self):
    print(self.sheet)

  def isBingo(self):
    hitList = [list(x.values())[0] for x in self.sheet]
    if hitList[0] and hitList[1] and hitList[2]:
      return 'Yes'
    if hitList[3] and hitList[4] and hitList[5]:
      return 'Yes'
    if hitList[6] and hitList[7] and hitList[8]:
      return 'Yes'
    if hitList[0] and hitList[3] and hitList[6]:
      return 'Yes'
    if hitList[1] and hitList[4] and hitList[7]:
      return 'Yes'
    if hitList[2] and hitList[5] and hitList[8]:
      return 'Yes'
    if hitList[0] and hitList[4] and hitList[8]:
      return 'Yes'
    if hitList[2] and hitList[4] and hitList[6]:
      return 'Yes'
    return 'No'
  
bingo = Bingo(data)
for i in range(H):
    j = int(input())
    bingo.addNumber(j)

print(bingo.isBingo())


Measured memory_bytes: 3188
#include <stdlib.h> 
#include <stdio.h>
#include <iostream>


using namespace std; 

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

   if ( n % 10 == 3) cout<<"bon";
   if ( n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) cout<<"pon";
   if ( n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 || n % 10 == 9) cout<<"hon";

    return 0;
}



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

ll INF = 1e+18;
int iINF = 1e9;
int MAXI = 1e8 + 1;
using vec = vector<int>;

void
rec(int i, int k, vec& arr, vec& dp)
{
  if(i == -1) return ;
  //if(dp[i] != iINF) return ;

  rec(i - 1, k, arr, dp);

  rep(j, 1, k){
    if(dp[i + j] > dp[i] + abs(arr[i] - arr[i + j])) dp[i + j] = dp[i] + abs(arr[i] - arr[i + j]);
  }

  return ;
}

int 
main()
{
  int N, K; cin >> N >> K;
  vector<int> arr(N);
  rep(i, 0, N) cin >> arr[i];
  vector<int> dp(N + K, iINF);
  dp[0] = 0;

  rec(N - 1, K + 1, arr, dp);
  cout << dp[N - 1] << endl;

}

Measured memory_bytes: 8780
a_v = input()
b_w = input()
t = input()
t_int = float(t)
a_v_list = a_v.split()
a = a_v_list[0]
a_int = float(a)
v = a_v_list[1]
v_int = float(v)
b_w_list = b_w.split()
b = b_w_list[0]
b_int = float(b)
w = b_w_list[1]
w_int = float(w)
d = abs(a_int-b_int)
if v_int > w_int:
  spd = v_int - w_int
  chacet = d / spd
  if chacet > t_int:
    print("NO")
  else:
    print("YES")
else:
  print("NO")

Measured memory_bytes: 9152
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main() {
  int N;
  scanf("%d",&N);
  
  int place[N];
  
  for(int i=0;i<N;i++){
    scanf("%d",&place[i]);
  }
  
  int dp[N];
  
  
  dp[0]=0;
  dp[1]=abs(place[1]-place[0]);
  
  for(int i=2;i<N;i++){
    int sakoda = dp[i-2] + abs( place[i] - place[i-2] );
    int ikemen = dp[i-1] + abs( place[i] - place[i-1] );
    if(sakoda < ikemen){
      dp[i] = sakoda;
    }else{
      dp[i] = ikemen;
    }
  }
  
  printf("%d",dp[N-1]);
}
    

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


void solve(long double L){
    double temp = (L/3);
    printf("%.6f", temp*temp*temp);
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long L;
    scanf("%lld",&L);
    solve(L);
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
  int X,Y,Z; cin >> X >> Y >> Z;
  int num=0,sum=0;
  sum += Z; 
  while(sum+Y+Z<=X){
    num++;
    sum += Y+Z;
  }
  cout << num << endl;
  return 0;
}
    

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: AtCoder *** Contest
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  string a, b, c;
  cin >> a >> b >> c;

  printf("A%cC\n", b[0]);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
pair<int, int>x[6];
vector<int>vec;
int main() {
	for (int i = 0; i < 6; i++) {
		int a, b; cin >> a >> b; if (a > b)swap(a, b);
		x[i] = make_pair(a, b);
		vec.push_back(a);
		vec.push_back(b);
	}
	sort(x, x + 6);
	for (int i = 0; i < vec.size(); i++) {
		for (int j = 0; j < vec.size(); j++) {
			for (int k = 0; k < vec.size(); k++) {
				if (x[0] != make_pair(vec[i], vec[j]))continue;
				if (x[1] != make_pair(vec[i], vec[j]))continue;
				if (x[2] != make_pair(vec[i], vec[k]))continue;
				if (x[3] != make_pair(vec[i], vec[k]))continue;
				if (x[4] != make_pair(vec[j], vec[k]))continue;
				if (x[5] != make_pair(vec[j], vec[k]))continue;
				cout << "yes" << endl;
				return 0;
			}
		}
	}
	cout << "no" << endl;
	return 0;
}

Measured memory_bytes: 3132
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;
using ll = long long;

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

    ll N;
    cin >> N;
    string NS = to_string(N);
    ll S = 0;
    for (ll i = 0; i < (ll)NS.size(); ++i) {
        S += NS.c_str()[i] - '0';
    }
    if (N % S == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	long long a, b, x;
	cin >> a >> b >> x;
	long long n = min(b - 1, x);
	cout << (a * n) / b - a * (n / b) << endl;
	return 0;
}

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

int a, b, c;

int main(){
	cin>>a>>b>>c;
	if(a == b && b != c){
		cout<<c<<endl;
	}
	else if(b == c && c != a){
		cout<<a<<endl;
	}
	else{
		cout<<b<<endl;
	}
}


Measured memory_bytes: 256
#pragma comment(linker, "/STACK:102400000,102400000")
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <ctime>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <iomanip>
#include <bitset>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define SZ(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define pi acos(-1)
#define mod 1000000007
#define inf 1000000007
#define ll long long
#define ull unsigned long long
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
#define N 200010
#define _DEBUG
template <class U,class T> void Max(U &x, T y){if(x<y)x=y;}
template <class U,class T> void Min(U &x, T y){if(x>y)x=y;}
template <class T> void add(int &a,T b){a=(a+b)%mod;}
inline int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}

int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%mod;
        a=1LL*a*a%mod;b>>=1;
    }
    return ans;
}
int pow(int a,int b,int c){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%c;
        a=1LL*a*a%c;b>>=1;
    }
    return ans;
}

int a[205],dp[N],ndp[N];
int main(){
    //srand(time(NULL)+clock());
    int T,ca=0,k,i,j,m=0,n,K;
    //double start=clock();
    scanf("%d%d",&n,&m);
    rep(i,0,n)scanf("%d",&a[i]);
    sort(a,a+n);
    reverse(a,a+n);
    dp[m]=1;
    rep(i,0,n){
        rep(j,1,m+1)ndp[j]=0;
        per(j,1,m+1)if(dp[j]){
            if(a[i]>j){
                add(ndp[j], 1LL*dp[j]*(n-i)%mod);
            }
            else{
                add(ndp[j%a[i]], dp[j]);
                if(n-i>1)add(ndp[j], 1LL*dp[j]*(n-i-1)%mod);
            }
        }
        swap(dp,ndp);
    }
    int ans=0;
    rep(i,1,m+1)add(ans, 1LL*i*dp[i]%mod);
    printf("%d\n",ans);

    //cerr<<(1.*clock()-start)/CLOCKS_PER_SEC<<"\n";
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Sep 13 18:35:58 JST 2020
 **/

struct UnionFind {
    int cnt;                  // 集合の数
    std::vector<int> number;  // 0以上のとき親のindex, 負のときは集合サイズ
    UnionFind(int n) : cnt(n), number(n, -1) {}
    int root(int x) { return number[x] < 0 ? x : number[x] = root(number[x]); }
    void unite(int x, int y) {
        x = root(x), y = root(y);
        if (x == y) return;
        if (number[y] < number[x]) std::swap(x, y);
        // yをxにマージ
        number[x] += number[y];
        number[y] = x;
        cnt--;
    }
    bool is_same(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -number[root(x)]; }
};

signed main() {
    Int n, Q;
    std::cin >> n >> Q;
    UnionFind uf(n);
    REP(q, Q) {
        Int t, u, v;
        std::cin >> t >> u >> v;
        if (t == 0) {
            uf.unite(u, v);
        } else {
            std::cout << uf.is_same(u, v) << "\n";
        }
    }
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, k;
  cin >> n >> k;
  k = min(n, k);
  VLL h(n);
  ll sum = 0;
  rep(i, n) {
    cin >> h[i];
    sum += h[i];
  }
  sort( all(h) , greater<>() );
  rep(i, k) sum -= h[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <cstdio>

using namespace std;
typedef long long llong;

#define MAX
const llong mod = 1000000000 + 7;

int toA(int n)
{
  return n * 8 / 100;
}
int toB(int n)
{
  return n / 10;
}

int main()
{
  int A, B;
  int ans = -1;
  scanf("%d%d", &A, &B);

  for (int i = 1; i <= 1000; i++)
  {
    if (A == toA(i) && B == toB(i))
    {
      ans = i;
      break;
    }
  }

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

  return 0;
}

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

int main() {
  string s;
  cin >> s;
  if (s[0]==s[1]&&s[1]==s[2] || s[1]==s[2]&&s[2]==s[3]){
    cout << "Yes" <<endl;
  }else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  int t;
  cin>>t;
  while(t--){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a<b||d<b){
	 cout<<"No"<<endl;
	 continue;
    }
    
    if(c>=b){
	 cout<<"Yes"<<endl;
	 continue;
    }

    ll g=__gcd(b,d);
    if(c<b-g+(a%g))cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
  return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char buf[2<<20],out[6];
sz;
cnt[1<<20];
main()
{
	read(0,buf,2<<20);
	int N=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(int i=0;i<N;i++)
	{
		int A=0;
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			A=A*10+k-'0';
		}
		cnt[A]++;
	}
	int ans=0;
	for(int i=1;i<=1000000;i++)
	{
		if(cnt[i])
		{
			ans+=cnt[i]<2;
			for(int j=i+i;j<=1000000;j+=i)cnt[j]=0;
		}
	}
	int osz=6;
	do{
		out[--osz]=ans%10+'0';
	}while(ans/=10);
	write(1,out+osz,6-osz);
}


Measured memory_bytes: 6488
import sys
from bisect import bisect_left

input = sys.stdin.readline


def solve(Q, S, T, X):
    ans = [0] * Q
    INF = 10 ** 11
    for q, x in enumerate(X):
        min_dist = INF
        i_s = bisect_left(S, x)
        i_t = bisect_left(T, x)
        for s in (S[i_s - 1], S[i_s]):
            for t in (T[i_t - 1], T[i_t]):
                dist_s2t = abs(x - s) + abs(s - t)
                dist_t2s = abs(x - t) + abs(t - s)
                min_dist = min(min_dist, dist_s2t, dist_t2s)
        ans[q] = min_dist
    return ans


def main():
    A, B, Q = map(int, input().split())
    S = [0] * (A + 2)
    T = [0] * (B + 2)
    X = [0] * Q
    for i in range(1, A + 1):
        S[i] = int(input())
    for i in range(1, B + 1):
        T[i] = int(input())
    for i in range(Q):
        X[i] = int(input())

    S[0] = T[0] = -10 ** 11
    S[-1] = T[-1] = 10 ** 11

    ans = solve(Q, S, T, X)
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 34496
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

const static double EPS = 1e-12;

class Restriction{
public:
  int first;
  int last;
  Restriction(int first,int last)
    : first(first),last(last) {}
  bool operator<(const Restriction& r) const{
    return last < r.last;
  }
  bool operator>(const Restriction& r) const{
    return last > r.last;
  }
};

int main(){
  int num_of_shops;
  int num_of_restrictions;

  while(~scanf("%d %d",&num_of_shops,&num_of_restrictions)){
    int cost = 0;
    vector<Restriction> restrictions;
    for(int restriction_i = 0; restriction_i < num_of_restrictions; restriction_i++){
      int to,from;
      scanf("%d %d",&to,&from);
      restrictions.push_back(Restriction(to,from));
    }

    sort(restrictions.begin(),restrictions.end(),greater<Restriction>() );

    int pos = 0;
    int last = 0;
    int first = 0;
    if(restrictions.size() > 0){
      last = restrictions[pos].last;
      first = restrictions[pos].first;
    }
    while(pos < restrictions.size()){
      if(first < restrictions[pos].last){
        first = min(first,restrictions[pos].first);
      }
      else{
        cost += 2 * (last - first);
        last = restrictions[pos].last;
        first = restrictions[pos].first;
      }
      pos++;
    }
    cost += 2 * (last - first);
    cost += num_of_shops + 1;
    printf("%d\n",cost);
  }
}

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

int n, e, g[704][704], c[704], a[704], b[704], k;

bool dfs(int i, bool t) {
    if (c[i] == !t) return false;
    if (c[i] == t) return true;
    c[i] = t;
    (t ? a : b)[k]++;
    bool ret = true;
    for (int j=1; j<=n; j++) if (g[i][j]) ret &= dfs(j, !t);
    return ret;
}

int main() {
    memset(c, -1, sizeof(c));
    cin >> n >> e;
    for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) if (i!=j) g[i][j] = 1;
    for (int i=0; i<e; i++) {
        int x, y;
        cin >> x >> y;
        g[x][y] = g[y][x] = 0;
    }

    for (int i=1; i<=n; i++) if (c[i] == -1) {
        if (!dfs(i, 0)) {
            cout << "-1";
            return 0;
        }
        k++;
    }

    for (int i=0; i<k; i++) if (a[i] > b[i]) swap(a[i], b[i]);

    int asum = 0;
    for (int i=0; i<k; i++) asum += a[i], b[i] -= a[i];


    vector<bool> v(n+1, false);
    v[asum] = true;
    for (int i=0; i<k; i++) for (int j=n; j>=0; j--) {
        if (j-b[i]>=0 and v[j-b[i]]) v[j] = true;
    }

    int ans = 1e9;
    for (int i=0; i<=n; i++) if (v[i]) ans = min(ans, i*(i-1)/2 + (n-i)*(n-i-1)/2);

    cout << ans << '\n';
}

Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = Long.parseLong(sc.next());
        long B = Long.parseLong(sc.next());

        System.out.println(LCM(A, B));
    }

    public static long GCD(long a, long b) {
        long c = a % b;
        if (c == 0) {
            return b;
        } else {
            return GCD(b, c);
        }
    }

    public static long LCM(long a, long b) {
        return (a * b) / GCD(a, b);
    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
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; }

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for(ll i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll N;
    cin >> N;
    vector<ll> div1, div2;
    div1 = divisor(N);
    div2 = divisor(N - 1);

    set<ll> st;

    for(auto d : div1){
        if(d == 1) continue;
        ll now = N;
        if((now - 1) % d == 0) st.insert(d);

        while(now % d == 0){
            now /= d;
            if((now - 1) % d == 0) st.insert(d);
        }
    }
    
    for(auto d : div2) if(d != 1) st.insert(d);

    ll ans = len(st);
    print(ans);

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
    
    
  int main(){
     lint n,q;
     string s;
     cin>>s;
   if(s=="hi")cout<<"Yes";
   else if(s=="hihi")cout<<"Yes";
   else if(s=="hihihi")cout<<"Yes";
    else if(s=="hihihihi")cout<<"Yes";
     else if(s=="hihihihihi")cout<<"Yes";
     else cout<<"No";
  }
     
  

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

int main(void){
  bool x=false,y=false;
  string s;
  cin >> s;
  for(int i=0;i<s.length();i++){
    if(s[i]=='C') x=true;
    if(x && s[i]=='F') y=true;
  }
  if(x&&y) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
/*我是萌新*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include <iomanip>
#include<map>
typedef long long ll;
const int mod = 1e9+7;
using namespace std;
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll n,m;
    while (cin >> n>>m)
    {
        ll *p1=new ll[n+5];
        ll *p=new ll[n+5];
        ll *pp=new ll[n+5];
        for(ll i=0;i<=n+2;i++){p[i]=1;pp[i]=0;}
        for(ll i=1;i<=n;i++)cin>>p1[i];
        for(ll i=0;i<m;i++)
        {
            ll x,y;
            cin>>x>>y;
            
            if(p1[x]>=p1[y]){p[y]=-mod;pp[x]++;}
             if(p1[x]<=p1[y]){p[x]=-mod;pp[y]++;}
             if(pp[x]>=2)pp[x]=-mod;
             if(pp[y]>=2)pp[y]=-mod;
        }
        ll ans=0;
        for(int i=1;i<=n;i++)
        {if(p[i]>=1)ans++;}
        cout<<ans<<'\n';
    }
}

Measured memory_bytes: 5496
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <numeric>
#include <set>
// #include <bits/stdc++.h>


using namespace std;
typedef long long li;
const li mod = 1e9 + 7;

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

    li n;
    cin >> n;

    li ans = 1;
    li lastpos = -1;
    li cur_choices = n;
    for (int i = 0; i < n; ++i) {
        ans *= cur_choices - (n - 1 - i);
        ans %= mod;

        li x;
        cin >> x;
        if (lastpos <= x - 2) {
            lastpos += 2;
        } else {
            cur_choices -= 1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
using namespace std;
pii a[100010];
int main()
{
	int i,j,k,n,m;
	ll x,y;
	scanf("%d",&n);
	x=0;
	for(i=0;i<n;i++)
	{
		scanf("%d%d",&a[i].fi,&a[i].se);
		x=max(x,1ll*abs(a[i].se)+abs(a[i].fi));
		if(i>0&&(((1ll*abs(a[i].se)+abs(a[i].fi))&1)!=((1ll*abs(a[i-1].se)+abs(a[i-1].fi))&1)))
		{
			printf("-1");
			return 0;
		}
	}
	for(i=0;i<=40;i++)
	{
		if((1ll<<(i))-1>=x)
		{
			break;
		}
	}
	m=i;
	printf("%d\n",x%2==1?i:i+1);
	for(i=0;i<m;i++)
	{
		printf("%d ",1<<i);
	}
	if(x%2==0)
	{
		printf("1");
	}
	printf("\n");
	string s;
	for(i=0;i<n;i++)
	{
		j=0;
		s="";
		if(x%2==0)
		{
			a[i].fi++;
		}
		for(j=0;j<m;j++)
		{
			if(abs(a[i].fi)>abs(a[i].se))
			{
				if(a[i].fi>0)
				{
					s+="R";
					a[i].fi-=(1<<(m-j-1));
				}
				else
				{
					s+="L";
					a[i].fi+=(1<<(m-j-1));
				}
			}
			else
			{
				if(a[i].se>0)
				{
					s+="U";
					a[i].se-=(1<<(m-j-1));
				}
				else
				{
					s+="D";
					a[i].se+=(1<<(m-j-1));
				}
			}
		}
		reverse(s.begin(),s.end());
		cout<<s<<"L "[x%2];
		printf("\n");
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,k;
int a[200007];
pair<long long,int> sum[200007];
int c[400007];
long long ans=0;
void add(int x)
{
	while (x<=400000)
	{
		c[x]+=1;
		x+=x&(-x);
	}
}
int query(int x)
{
	int ans=0;
	while (x>0)
	{
		ans+=c[x];
		x-=x&(-x);
	}
	return ans;
}
int main()
{
	n=read(),k=read();
	for (int i=1;i<=n;i++) a[i]=read()-k;
	memset(sum,0,sizeof(sum));
	for (int i=1;i<=n;i++) sum[i].first=sum[i-1].first+a[i],sum[i].second=i+1;
	sum[n+1].first=0,sum[n+1].second=1;
	sort(sum+1,sum+n+2);
	for (int i=1;i<=n+1;i++)
	{
		ans+=query(sum[i].second);
		add(sum[i].second);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cassert>
#define int long long
using namespace std;

int n;
int a[100000];

int solve1() {	//+,-,+,-
	int plus = 0;
	int ans = 0;
	
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {	//+
			if (plus < -a[i] + 1) {
				ans += -a[i] + 1 - plus;
				plus = -a[i] + 1;
			}
		}
		else {	//-
			if (plus > -a[i] - 1) {
				ans += plus - (-a[i] - 1);
				plus = -a[i] - 1;
			}
		}
	}
	return ans;
}

int solve2() {	//-,+,-,+
	int plus = 0;
	int ans = 0;
	
	for (int i = 0; i < n; i++) {
		if (i % 2 == 1) {	//+
			if (plus < -a[i] + 1) {
				ans += -a[i] + 1 - plus;
				plus = -a[i] + 1;
			}
		}
		else {	//-
			if (plus > -a[i] - 1) {
				ans += plus - (-a[i] - 1);
				plus = -a[i] - 1;
			}
		}
	}
	return ans;
}

signed main() {
	int i;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> a[i];
	for (i = 1; i < n; i++) a[i] += a[i - 1];
	cout << min(solve1(), solve2()) << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005


ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}


/////////////////////////////////////////////////////////////////
void yes(){
    cout<<"Possible"<<endl;
}
void no(){
    cout<<"Impossible"<<endl;
}


int main(){
    ll n,l;cin>>n>>l;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll point=-1;
    rep(i,1,n-1){
        if(a[i]+a[i-1]>=l)point=i;
    }
    if(point==-1){
        no();
    }else{
        yes();
        rep(i,1,point-1)cout<<i<<endl;
        for(int i=n-1;i>=point+1;i--)cout<<i<<endl;
        cout<<point<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1536
#include<iostream>
using namespace std;
#define ll long long 

int main(){
	int n;
	cin>>n;
	
	ll arr1[n+1];
	ll arr2[n];
	ll ans=0;
	
	for(int i=0; i<n+1; i++){
		cin>>arr1[i];
	}
	for(int i=0; i<n; i++){
		cin>>arr2[i];
	}
	for(int i=0; i<n; i++){
		ans = ans+min(arr1[i],arr2[i]);
		arr2[i]=arr2[i]-min(arr1[i],arr2[i]);
		if(arr2[i] != 0){
			ans = ans+min(arr1[i+1],arr2[i]);
			arr1[i+1] =arr1[i+1]- min(arr1[i+1],arr2[i]);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792