akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long A,B,C,D;
  cin>>A>>B>>C>>D;
  long long X=B-(B/C+B/D-B/lcm(C,D));
  long long Y=A-1-((A-1)/C+(A-1)/D-(A-1)/lcm(C,D));
  cout<<X-Y<<endl;
}

Measured memory_bytes: 3488
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

int main()
{
	int a,b,x;
	while(~scanf("%d %d %d",&a,&b,&x))
	{
		if(a + b >= x && a <= x) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd 
/****************************/
using namespace std;
string s,t,now;
ll ans;
int main()
{
	ans=1e9;
	cin>>s>>t;
	int n=t.size();
	now=s.substr(0,n);
	ll cnt=0;
	rep(i,n)
	{
		if(now[i]!=t[i])
		{
			cnt++;
		}
	}
	ans=min(ans,cnt);
	rep3(i,n,s.size())
	{
		now=now.substr(1);
		now+=s[i];
		cnt=0;
		rep(j,n)
		{
			if(t[j]!=now[j])
			{
				cnt++;
			}
		}
		ans=min(ans,cnt);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <bitset>
#include <vector>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using pii = pair<int, int>;
using pll = pair<LL, LL>;
const int MAX_NR = 1e6;
bitset<MAX_NR + 1> is_given, exists_more_than_1;


bool get_divs(const int &nr)
{
    if (exists_more_than_1[nr] || (is_given[1] && nr != 1))
    {
        return 1;
    }
    for (int i = 2; i * i <= nr; ++i)
    {
        if (nr % i == 0 && (is_given[i] || is_given[nr / i]))
        {
            return 1;
        }
    }
    return 0;
}


int main()
{
    cin.sync_with_stdio(0);

    int N;
    cin >> N;

    vector<int> nrs;
    for (int i = 0; i < N; ++i)
    {
        int nr;
        cin >> nr;

        nrs.emplace_back(nr);
        if (is_given[nr])
        {
            exists_more_than_1[nr] = true;
        }
        is_given[nr] = 1;
    }

    int res = N;
    for (int i = 0; i < N; ++i)
    {
        res -= get_divs(nrs[i]);
    }

    cout << res;
}

Measured memory_bytes: 4504
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
while(true){
   var NTLB=arr.shift().split(" ").map(Number);
   if(NTLB.join(" ")=="0 0 0 0")break;
   var N=NTLB[0];
   var T=NTLB[1];
   var arrL=[];
   for(var i=0;i<NTLB[2];i++)arrL.push(arr.shift()-0);
   var arrB=[];
   for(var i=0;i<NTLB[3];i++)arrB.push(arr.shift()-0);
   var dp=[];
   for(var i=0;i<=T;i++){
      dp[i]=[];
      for(var j=0;j<=N;j++){
         dp[i][j]=0;
      }
   }
   dp[0][0]=1;
   for(var i=1;i<=T;i++){
      for(var j=0;j<N;j++){
         for(var k=1;k<=6;k++){
            var I=i;
            var jk=j+k;
            if(jk>N)jk=N-(jk-N);
            var flagL=arrL.some(function(v){
               if(v==jk)return true;
            });
            if(flagL && I!=T)I=I+1;
            var flagB=arrB.some(function(v){
               if(v==jk)return true;
            });
            if(flagB)jk=0;
            dp[I][jk]+=dp[i-1][j]/6;
         }
      }
   }
   var ans=0;
   for(var i=1;i<=T;i++)ans+=dp[i][N];
   console.log(ans.toFixed(6));
}

Measured memory_bytes: 25600
#include <cstdio>

using namespace std;
int main (){
    int a;
    bool flag=false;
    scanf("%d",&a);
    for (int i = 1; i < 10; i++){
        if(a%i==0 && a/i <10) flag=true;
    }
    if(flag) printf("Yes");
    else printf("No");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;  cin >> n;
    
    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    
    sort(v.begin(),v.end(),greater<int>());
    
    stack<double> quarity;
    for(int i=0;i<n;i++){
        quarity.push(v[i]);
    }
    
    for(int i=0;i<n-1;i++){
        double x,y;
        x = quarity.top();    quarity.pop();
        y = quarity.top();    quarity.pop();
        quarity.push((x+y)/2);
    }
    
    cout << quarity.top() << endl;
    quarity.pop();
    
    return 0;
}


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

int main(){
  int n,q;
  int *S,*T,B[100];
  int count=0,i,j,u;
  int flag=0;
  
  scanf("%d",&n);
  S=(int *)malloc(n*sizeof(int));
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  scanf("%d",&q);
  T=(int *)malloc(q*sizeof(int));
  for(i=0;i<q;i++) scanf("%d",&T[i]);
  
  for(i=0;i<n;i++){
    flag=0;
    for(j=0;j<q;j++){     
      if(S[i]==T[j]){
	for(u=0;u<count;u++){
	  if(B[u]==T[j]) flag=1;
	}
	if(flag==1) break;
	B[count++]=T[j];
	break;
      }
    }
  }
  printf("%d\n",count);

  free(S);
  free(T);
  
  return 0;
}





Measured memory_bytes: 2048
#include <iostream>
#include "stdio.h"
using namespace std;

void func(int x, int y, int z)
{
  if(x > y)
  {
    int v = y;
    y = x;
    x = v;
  }
  if(y > z)
  {
    int v = y;
    y = z;
    z = v;
  }
  if(x > y)
  {
    int v = y;
    y = x;
    x = v;
  }
  std::cout << x << " "<< y <<" " << z <<'\n';
}

int main()
{
	int x,y,z;
  scanf("%d%d%d",&x,&y,&z );
  func(x,y,z);
  return 0;
}


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

#define MAX 1000
#define VMAX 10000

int n, A[MAX], s;
int B[VMAX], T[VMAX + 1];

int solve()
{
	int ans = 0;
	bool V[MAX];
	for (int i = 0; i < n; i++)
	{
		V[i] = false;
		B[i] = A[i];
	}

	sort(B, B + n);

	for (int i = 0; i < n; i++)
	{
		T[B[i]] = i;
	}

	for (int i = 0; i < n; i++)
	{
		if (V[i])
			continue;
		int an = 0;//记录圈内元素个数
		int m = VMAX;//记录圈内最小元素
		int S = 0;//记录圈内所有元素之和
		int cur = i;//记录当前下标位置
		while (1)
		{
			V[cur] = true;
			int v = A[cur];
			an++;
			m = min(m, v);
			S += v;
			cur = T[v];
			if (V[cur])
				break;
		}
		ans += min(S + (an - 2) * m, S + m + (an + 1) * s);
	}
	return ans;
}

int main()
{
	cin >> n;
	s = VMAX;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
		s = min(s, A[i]);
	}

	int ans = solve();
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3176
u="U"
d="D"
l="L"
r="R"

sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy
ans=""
ans+=r*dx
ans+=u*dy
ans+=l*dx
ans+=d*dy

ans+=d

ans+=r*dx+r
ans+=u*dy+u

ans+=l
ans+=u

ans+=l*dx+l
ans+=d*dy+d

ans+=r


print(ans)


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

int main(){
  
  string S;
  string tmp;
  int len,ptr;
  int yn=0;

  cin >> S;

  len = S.length();
  ptr = len-1;


  while(true){
    //dream?
    if(ptr >= 5 && S[ptr-5]=='e' && S[ptr-4]=='r' && S[ptr-3]=='a' && S[ptr-2]=='s' && S[ptr-1]=='e' && S[ptr]=='r'){
      ptr-=6;
      if(ptr==-1){
        yn=1;
        break;
      }
    }else if(ptr >= 4 && S[ptr-4]=='e' && S[ptr-3]=='r' && S[ptr-2]=='a' && S[ptr-1]=='s' && S[ptr]=='e'){
      ptr-=5;
      if(ptr==-1){
        yn=1;
        break;
      }
    }else if(ptr >= 6 && S[ptr-6]=='d' && S[ptr-5]=='r' && S[ptr-4]=='e' && S[ptr-3]=='a' && S[ptr-2]=='m' && S[ptr-1]=='e' && S[ptr]=='r'){
      ptr-=7;
      if(ptr==-1){
        yn=1;
        break;
      }
    }else if(ptr >= 4 && S[ptr-4]=='d' && S[ptr-3]=='r' && S[ptr-2]=='e' && S[ptr-1]=='a' && S[ptr]=='m'){
      ptr-=5;
      if(ptr==-1){
        yn=1;
        break;
      }
    }else{
      break;
    }
  }
  //end of while

  if(yn==1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}



Measured memory_bytes: 512
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var n int
	var a string
  	buf := make([]byte, 1000000)
  	sc.Buffer(buf, 1000000000)
  
	if sc.Scan() {
		n, _ = strconv.Atoi(sc.Text())
	}

	if sc.Scan() {
		a = sc.Text()
	}

	ans := make([]int, n)
	for _, v := range strings.Split(a, " ") {
		intV, _ := strconv.Atoi(v)
		ans[intV-1]++
	}

	for _, v := range ans {
		fmt.Println(v)
	}
}


Measured memory_bytes: 10944
#include <cstdio>
#include <algorithm>
#include <cstring>

#define loop(n) for(ll i=0;i<n;i++)

using namespace std;

typedef long long int ll;

int main() {
    ll n,x[200000],y[200000];
    scanf("%ld",&n);
    loop(n) scanf("%ld",&x[i]);
    memcpy(y,x,sizeof(ll[200000]));
    sort(y,y+n);
    ll a[2] = {y[n/2-1],y[n/2]};
    loop(n) if(x[i] <= a[0]) printf("%ld\n",a[1]); else printf("%ld\n",a[0]);
}

Measured memory_bytes: 5248
#include <iostream>

using namespace std;

const int MAX_N = (1 << 18) - 1;
const int MAX_L = 100000;
const int MAX_DP_N = (1 << 10) - 1;

int n;
int val[MAX_N], wgt[MAX_N];
int dpn;
int dp[MAX_DP_N][MAX_L + 1];

void compute_dp()
{
  /* initialize */
  dpn = min(n, MAX_DP_N);
  for (int i = 0; i <= MAX_L; i++) {
    dp[0][i] = i >= wgt[0] ? val[0] : 0;
  }

  /* compute the dp table */
  for (int u = 1; u < dpn; u++) {
    int parent = (u - 1) / 2;
    for (int i = 0; i <= MAX_L; i++) {
      dp[u][i] = i >= wgt[u]
                 ? max(dp[parent][i], dp[parent][i - wgt[u]] + val[u])
                 :     dp[parent][i];
    }
  }
}

int solve(int u, int l)
{
  if (u < dpn) {
    return dp[u][l];
  }

  int parent = (u - 1) / 2;
  int s = solve(parent, l);
  if (l >= wgt[u]) {
    s = max(s, val[u] + solve(parent, l - wgt[u]));
  }
  return s;
}

int main()
{
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> val[i] >> wgt[i];
  }

  compute_dp();

  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int u, l;
    cin >> u >> l;
    cout << solve(u - 1, l) << endl;
  }

  return 0;
}


Measured memory_bytes: 404816
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _168B
{
    class Program
    {
        static void Main(string[] args)
        {
            int K = int.Parse(Console.ReadLine() ?? string.Empty);
            string S = Console.ReadLine();
            if (S.Length > K)
            {
                Console.WriteLine(S.Substring(0,K) + "...");
            }
            else
            {
                Console.WriteLine(S);
            }

        }
    }
}


Measured memory_bytes: 27328
var
  n,i,x,max:longint;
  s:string;
begin
  readln(n);
  read(s);
  x:=0;
  max:=0;
  for i:=1 to n do
  begin
    if s[i]='I' then inc(x);
    if s[i]='D' then dec(x);
    if x>max then max:=x;
  end;
  writeln(max);
end.

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

int main() {
  int answer=1;
  int x=0;
  int N,X;
    cin>>N>>X;
  vector<int> L(N);
  for(int i=0;i<N;i++){
    cin >>L.at(i);
  }
  for(int i=0;i<N;i++){
    x+=L.at(i);
      if(x>X){
        break;
      }
    else  {
      answer++;
    }
  }
  cout<<answer<<endl;
}
    
    
    
    
    
    


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

using namespace std;

int main() {

	string str[3];
	cin >> str[0] >> str[1] >> str[2];

	int now = 0;

	while (true) {

		if (str[now].length() == 0) {

			printf("%c", now + 'A');
			break;

		}

		char top = str[now][0];

		str[now].erase(str[now].begin());

		now = top - 'a';

	}

	return 0;

}

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

typedef long long ll;

using namespace std;

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

queue<ll> runrun;

int main(){
	string s;
	cin >> s; 
	if(s == "AAA" || s == "BBB") cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
from itertools import permutations
from math import sqrt

n = int(input())
xyl = []
for _ in range(n):
    x,y = map(int, input().split())
    xyl.append((x,y))

ll = list(range(0,n))
perml = list(permutations(ll, n))

val = 0
for perm in perml:
    prev_x = 0
    prev_y = 0
    for i,p in enumerate(perm):
        x,y = xyl[p]
        if i == 0:
            prev_x = x
            prev_y = y
        else:
            val += sqrt( (prev_x-x)**2 + (prev_y-y)**2 )
            prev_x = x
            prev_y = y
    
ans = val/len(perml)
print(ans)

Measured memory_bytes: 80228
# -*- coding: utf-8 -*-
def solve(): 
    S =  input()
    res = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS'][2*(0 < int(S[:2]) < 13) + (0 < int(S[2:]) < 13)]
    return str(res)

if __name__ == '__main__':
    print(solve())




Measured memory_bytes: 2940
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int a, b, k; cin >> a >> b >> k;

	set<int> s;

	for (int i = a; i <a+k; i++) {
		if (i > b)break;

		s.insert(i);
	}

	for (int i = b; i > b - k; i--) {
		if (i < a)break;

		s.insert(i);
	}

	for (auto i : s) {
		cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
clock_t __my_start_clock = clock();
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

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

  int n;
  while (scanf("%d", &n) == 1) {
    vector<vector<int>> g(n);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        char c;
        scanf(" %c", &c);
        if (c == '1') {
          g[i].push_back(j);
        }
      }
    }
    int ans = -1;
    for (int s = 0; s < n; s++) {
      vector<int> d(n, -1);
      d[s] = 1;
      queue<int> q;
      q.push(s);
      bool fail = false;
      while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int v : g[u]) {
          if (d[v] == d[u]) fail = true;
          if (d[v] == -1) {
            d[v] = d[u] + 1;
            q.push(v);
          }
        }
      }
      if (!fail) {
        ans = max(ans, *max_element(d.begin(), d.end()));
      }
    }
    printf("%d\n", ans);
  }

  return 0;
}


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

struct UnionFind
{
    vector<int> par; //par[i]:= iの親の番号
    vector<int> siz; //siz[i]:= iの属する連結成分の大きさ
    UnionFind(int N) {
        par.resize(N);
        for(int i = 0; i < N; ++i) {
            par[i] = i;
        }
        siz.resize(N,1);
    }

    int root(int x){ // xが属する木の根を再帰で得る：root(x) = {xの木の根}
    if(par[x] == x) return x;
    else return par[x] = root(par[x]);
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        return root(x) == root(y);
    }

    bool unite (int x, int y) { // xとyの木を併合
        x = root(x); y = root(y);
        if (x == y) return false;
 
        if (siz[x] < siz[y]) swap(x, y); // merge technique 小を大にくっつける
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    int size(int x) { // xの属する木の大きさを得る
        return siz[root(x)];
    }
};

int main()
{
int N,M;
cin >> N >> M;

UnionFind uf(N);
rep(i,M) {
    int x,y,z;
    cin >> x >> y >> z;
    --x;--y;
    uf.unite(x,y);
}

set<int> st;
rep(i,N) {
    st.insert(uf.root(i));
}

int ans = st.size();
cout << ans << endl;

return 0;
}

Measured memory_bytes: 5760
import java.io.*;
public class Main{
	public static void main(String [] args) throws NumberFormatException, IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=Integer.parseInt(br.readLine());
		System.out.println(t/3600+":"+t%3600/60+":"+t%3600%60);
	}}

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

using namespace std;

const int MAXN = 1e5 + 5;
int n;
int mem[MAXN][4];
int a[MAXN],b[MAXN],c[MAXN];
int solve(int i,int prev)
{

if(i == n) return 0;

int &ret = mem[i][prev];
if(ret != -1) return ret;

int c1 = -1e9 , c2 = -1e9 , c3 = -1e9;

if(prev != 1) c1 = solve(i + 1 , 1) + a[i];
if(prev != 2) c2 = solve(i + 1 , 2) + b[i];
if(prev != 3) c3 = solve(i + 1 , 3) + c[i];

ret = max(c1,max(c2,c3));

return ret;



}

int main()
{
  cin >> n;
  for(int i = 0 ; i < n ; i++) cin >> a[i] >> b[i] >> c[i];
  memset(mem,-1,sizeof(mem));
  cout << solve(0,0);

}

Measured memory_bytes: 7680
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String str2 = sc.nextLine();
        int size = str.length();
        int size2 = str2.length();
        int flag =1;

        while(true){
            if(str.equals(str2)){
                break;
            }else{
                size2 = size2-1;
                String str3 = str.substring(0,1);
                str = str.substring(1,size);
                str = str.concat(str3);
                if(size2==0){
                    flag=0;
                    break;
                }
            }
        }
        if(flag==1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    }
}

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

int main() {
  double a, b, h, m;
  double angle, ans;
  cin >> a >> b >> h >> m;
  // 360.0 * (60*h+m)/720.0
  // 360.0 * m/60.0
  angle = abs(360.0*((60.0*h+m))/720.0-360.0*m/60.0);
  if(angle > 180) angle=abs(angle-360.0);
  //cout << angle << endl;
  if(angle == 180) ans = a + b;
  else {
    ans = sqrt(a*a+b*b-2*a*b*cos(angle*M_PI/180.0));
  }
  cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
    cin>>n;
    string a;
    int ansac=0,answa=0,anstle=0,ansre=0;
    while(n>0)
    {
        cin>>a;
        if(a=="AC")
            ansac++;
        if(a=="WA")
            answa++;
        if(a=="TLE")
            anstle++;
        if(a=="RE")
            ansre++;
        n--;
    }
    cout<<"AC"<<" "<<"x"<<" "<<ansac<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<answa<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<anstle<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<ansre<<endl;
    return 0;
}


Measured memory_bytes: 3640
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n)cin >> a[i];
    int ans = 0;
    for(int i = 1; i < n - 1; i++){
        if((a[i-1] - a[i]) * (a[i] - a[i+1]) >=0)ans++;
    }
    cout << ans << endl;
}

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

const ll INF = 1e18;

int N;
ll dp[101][100001];

int main(){
    int W;
    cin >> N >> W;
    vector<int> w(N);
    vector<ll> v(N);
    for (int i=0; i<N; i++) cin >> w[i] >> v[i];
    for (int sumW=0; sumW<=W; sumW++) {
        for (int i=0; i<N; i++) {
            dp[i+1][sumW] = max(dp[i+1][sumW], dp[i][sumW]);
            if (w[i] <= sumW) dp[i+1][sumW] = max(dp[i+1][sumW], dp[i][sumW-w[i]] + v[i]);
        }
    }
    cout << dp[N][W] << endl;
}

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

using namespace std;

#define ll 				long long
#define fr(i,x,n) 		for(int i=x; i<n; ++i)
#define frr(i,n) 		for(int i=n; i>=0; --i)
#define all(x) 			x.begin(), x.end()
#define sortall(x) 		sort(all(x))
#define null 			NULL
#define mod             1000000007
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<int>     vi;
typedef vector<ll>      vl;

void solve()
{
    int n;
    cin>>n;
    vi A(n);fr(i, 0, n) cin>>A[i];
    vl suffix(n);
    suffix[n-1]=A[n-1];
    frr(i, n-2) suffix[i]=(A[i]+suffix[i+1])%mod;
    ll result=0;
    fr(i, 0, n-1)
    {
        result+=(A[i]*suffix[i+1])%mod;
        result=result%mod;
    }
    cout<<result;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 5508
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  if (n & 1) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  ll x = 10;
  while (x <= n) {
    ans += (n / x);
    x *= 5;
  }
  // x = 50;
  // while (x <= n) {
  //   ans += ((n / x) + 1) / 2;
  //   x *= 5;
  // }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define vll vector<long long>
#define ll long long
#define pii pair<int,int>
const int mod=1e9+7;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("inputf.txt","r",stdin);
    freopen("outputf.txt","w",stdout);
#endif
    int n;
    cin>>n;
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    for(int i=n-2;i>=0;i--){
        a[i]+=max(b[i+1],c[i+1]);
        b[i]+=max(a[i+1],c[i+1]);
        c[i]+=max(a[i+1],b[i+1]);
    }
    cout<<max(a[0],max(b[0],c[0]));
    return 0;
}

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

int main( ) {
  int R;
  cin >> R;
  string s = "";
  if(R >= 1200 && R < 2800){
    s = "ARC";
  }else if(R < 1200){
    s = "ABC";
  }else{
    s = "AGC";
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n,c;
	cin>>n>>c;
	vector<vector<int>> d(c,vector<int>(c));
	vector<vector<int>> g(n,vector<int>(n));
	vector<vector<int>> dp(3,vector<int>(c,0));
	rep(i,c)rep(j,c){
		cin>>d[i][j];
	}
	rep(i,n)rep(j,n){
		cin>>g[i][j];
		g[i][j]--;
	}
	rep(r,3)rep(to,c)rep(i,n)rep(j,n){
		if((i+j)%3!=r) continue;
		dp[r][to]+=d[g[i][j]][to];
	}
	int ans=INF;
	rep(i,c)rep(j,c)rep(k,c){
		if(i==j || j==k || k==i) continue;
		chmin(ans,dp[0][i]+dp[1][j]+dp[2][k]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
    int main() {
    	int N;
    	cin >> N;
    	int answer = 0;

    	for (int C = 1; C <= N; C += 2) {
    		int yaku = 0;
    		for (int X = 1; X <= C; X++) {
    			if (C % X == 0) {
    				yaku++;
    			}
    		}
    		if (yaku == 8) {
    			answer++;
    		}
    	}
    	cout << answer << endl;
    	return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

void solve() {
	int n;
	cin >> n;
	
	vector<queue<int>> q(n);
	vvi a(n, vi(n));
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n - 1; j++) {
			int x;
			cin >> x;
			x--;
			
			q[i].push(x);
		}
	
	int ans = 0, ok = 1;
	while(ok) {
		vi vis(n, 0);
		ok = 0;
		for(int i = 0; i < n; i++) {
			if(q[i].empty()) continue;
			if(vis[i] || vis[q[i].front()]) continue;
			
			if(q[q[i].front()].front() == i) {
//				cout << ans + 1 << " " << q[i].front() << " " << q[q[i].front()].front() << endl;
				ok = 1;
				vis[q[i].front()] = 1;
				vis[q[q[i].front()].front()] = 1;
				q[q[i].front()].pop();
				q[i].pop();
			} 
		}
		
		ans += ok;
	}
	
	for(int i = 0; i < n; i++) {
		if(!q[i].empty()) {
			cout << -1 << endl;
			return;
		}
	}
	
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Measured memory_bytes: 11708
#include <stdio.h>
#include <stdlib.h>
int comparetor (const void * a, const void * b)
{
    return ( *(int*)a - *(int*)b );
}
int binsearch1(int *arr, int low, int high, int search)    //just greater than or equal to
{
    int mid, pos = -1;
    while(low<=high)
    {
        mid = (low+high)/2;
        if(arr[mid]>search)
        {
            pos = mid;
            high = mid-1;
        }
        else
            low = mid+1;
    }
    return pos;
}
int binsearch2(int *arr, int low, int high, int search)    //just less than or equal to
{
    int mid, pos = -1;
    while(low<=high)
    {
        mid = (low+high)/2;
        if(arr[mid]<search)
        {
            pos = mid;
            low = mid+1;
        }
        else
            high = mid-1;
    }
    return pos;
}
int main()
{
    int n;  scanf("%d", &n);
    int *arr = malloc(sizeof(int)*n);
    for(int i=0; i<n; i++)
        scanf("%d", &arr[i]);
    qsort(arr, n, sizeof(int), comparetor);
    long long count = 0;
    for(int i=0; i<n-1; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            int l = binsearch1(arr, j+1, n-1, arr[j]-arr[i]);
            int r = binsearch2(arr, j+1, n-1, arr[j]+arr[i]);
            if(l==-1 || r==-1)
                continue;
            else
                count += r-l+1;
        }
    }
    printf("%lld\n", count);
    free(arr);
    return 0;
}

Measured memory_bytes: 128
#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 <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front
#define debug(a) cout<<(a)<<endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void solve(){
    int a,b;
    cin>>a>>b;
    a--;
    b--;
    vector<bool>ans(3,true);
    rep(i,3){
        if(a==i or b==i){
            ans[i]=false;
        }
    }
    rep(i,3){
        if(ans[i])cout<<i+1<<endl;
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: i32 = input();
    let k: i32 = input();

    let mut ans: f64 = 0.0;

    for n in 1..n + 1 {
        let mut now = n;
        let mut temp = 1.0;
        while now < k {
            now *= 2;
            temp *= 0.5;
        }
        ans += temp;
    }

    println!("{}", ans / n as f64);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,k;
  cin >> a >> b >> k;
  int g = __gcd(a,b);
  int j = 2;
  int ans = g;
  for(int i=0;i<k-1;++i){
    for(;g%j!=0;++j){}
    ans = g/j;
    ++j;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
H, W, K = map(int, input().split())
S = [list(input()) for _ in range(H)]

res = float('inf')
for i in range(2**(H-1)):
    c = bin(i).count('1')
    cnt = c
    sum_l = [0] * (c+1)
    j = 0
    flag = True
    while j < W:
        tmp = sum_l.copy()
        pos = 0
        for k in range(H):
            if S[k][j] == '1':
                tmp[pos] += 1
            if (i >> k) & 1:
                pos += 1
        if max(tmp) <= K:
            sum_l = tmp.copy()
            j += 1
            flag = False
        else:
            if flag:
                cnt = float('inf')
                break
            cnt += 1
            flag = True
            sum_l = [0] * (c+1)

    res = min(res, cnt)

print(res)

Measured memory_bytes: 74988
#include <bits/stdc++.h>
using namespace std;
 
// vector<int> vec(3); = vector<int> vec={0,0,0}
// vec.at()
// sort(num.begin(),num.end(), greater<int>());
// reverse(num.begin(),num.end());
 
// 切り上げ　a/b+1
//  1からNの総和　N*(N+1)/2
 
int main() {
  int a,b;
  cin >> a >> b;

  cout << (a + b) %24 << endl;
}

Measured memory_bytes: 256
import math

N = int(input())

yakusu_pair =[]

for i in range(1,int(math.sqrt(N)+1)):
    if N%i==0:
        yakusu_pair.append([i, int(N/i)])

min_f=12
for pair in yakusu_pair:
    f=int(math.log10(max(pair[0],pair[1])))+1
    if min_f>f:min_f=f

print(min_f)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
#ifdef __LOCAL
#include <dump.hpp>
#define dump(...) DUMPOUT << "  " << string(#__VA_ARGS__) << ": " << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl << "    ", dump_func(__VA_ARGS__)
#else
#define dump(...)
#endif
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct IOInit { IOInit() { cin.tie(nullptr); ios::sync_with_stdio(false); dump("READY"); /*cout << unitbuf;*/} } IO_INIT;
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;



signed main(void) {
  ll n, x, m; cin >> n >> x >> m;
  map<int,int> mp;
  Vi a;
  int count = 0;
  ll sum = 0;
  while(mp.count(x) == 0) {
    a.push_back(x);
    sum += x;
    mp[x] = count;
    ++count;
    x = (ll) x * x % m;
  }
  // dump(mp);
  // dump(a,count,sum,x);
  if (n <= count) {
    ll ans = 0;
    rep(i,n) ans += a[i];
    plexit(ans)
  }
  ll c = 0;
  int s = count - mp[x];
  for (int i = mp[x]; i < count; ++i) c += a[i];
  ll ans = sum;
  n -= count;
  ans += n/s*c;
  // dump(sum,ans,n,s,c);
  n %= s;
  int si = mp[x];
  rep(i,n) ans += a[si+i];
  pl(ans)
  return 0;
}


Measured memory_bytes: 6148
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

char albt[26] = {'a','b','c','d','e','f','g','h','i','j','k','l',
                 'm','n','o','p','q','r','s','t','u','v','w','x',
                 'y','z'};

//vector<ll> g[202020];
//fill(score, score+202020, 0);
//vector<ll> v;

int main(){
  ll n;
  cin >> n;
  
  vector< pair<ll, ll> > vc;
  ll count = 1;
  for (int i=0;i<n;i++){
    ll tmp;
    cin >> tmp;
    vc.push_back(pair<ll, ll>(tmp, count));
    count += 1;
  }

  sort(vc.begin(), vc.end());
  
  for (int i=0;i<n;i++) cout << vc[i].second << " ";
  cout << endl;
  //cout << count << endl;
}

Measured memory_bytes: 2544
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
ll int MOD=998244353;
#define INF 2*1e9
#define N 310000
 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

main(){
    int n;
    cin>>n;
    ll int sum=0,m=INF;
    rep(i,n){
        ll int a,b;
        cin>>a>>b;
        sum+=a;
        if(a>b){
            m=min(m,b);
        }
    }
    if(m==INF) cout<<0;
    else cout<<sum-m;
}


Measured memory_bytes: 384
#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>;
 
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
	constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
 
const int MOD = 1000000007;
using mint = Fp<MOD>;
 
mint multip2(int n) {
    if (n == 0) return 1;
    mint x = multip2(n/2);
    x *= x;
    if (n % 2 == 1) x *= 2;
    return x;
}
 
mint combi(int n, int x) {
        mint numerator = 1, denominator = 1;
        rep(i,x) {
                numerator *= n-i;
                denominator *= i+1;
        }
        return numerator / denominator;
}
int main() {
    int n, a, b;
    cin >> n >> a >> b;
 
    mint ans = multip2(n);
    ans -= 1;
    ans -= combi(n,a);
    ans -= combi(n,b);
 
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<int> x(N+1);
    x[0]=0;
    int max=0;
    for(int i=0;i<N;i++){
        if(S[i]=='I'){
            x[i+1]=x[i] + 1;
        }
        else if(S[i]=='D'){
            x[i+1]=x[i] - 1;
        }
        if(x[i+1]>max){
            max = x[i+1];
        }
    }
    cout << max << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
        out << '(' << p.first << ',' << p.second << ')';
            return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
        in >> p.first >> p.second;
            return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
        for (T &x : v)
                    in >> x;
            return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
        for (const vector<T> &x : v)
                    out << x << '\n';
            return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
        for (const T &x : v)
                    out << x << ' ';
            return out;
}
 
template <class T>
ostream& operator << (ostream& out,const set<T> &s)
{
        for (const T &x : s)
                out << x << ' ';
            return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.00000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl "\n"
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main()
{
    fast();
    ll n;
    cin>>n;
    vi a(n);
    cin>>a;
    
    sort(all(a));
    ll ans=0;
    for(ll i=0;i<n;i++)
    {
        for(ll j=i+1;j<n;j++)
        {
            for(ll k=j+1;k<n;k++)
            {
                if(a[i]!=a[j] && a[j]!=a[k] && a[i]+a[j]>a[k])
                {
                    ans++;
                }
            }
        }
    }
    cout<<ans<<nl;
}


Measured memory_bytes: 3524
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

int main(){
	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    pair<int, int> ans;
    double dense = -10;
    REP(i, INF) {
        if(100 * A * i > F) {
            break;
        }
        REP(j, INF) {
            if(100 * A * i + 100 * B * j > F) {
                break;
            }
            REP(k, INF) {
                if(100 * A * i + 100 * B * j + C * k > F) {
                    break;
                }
                REP(l, INF) {
                    if(100 * A * i + 100 * B * j + C * k + D * l > F) {
                        break;
                    }
                    if((A * i + B * j) * E >= C * k + D * l) {
                        if(((A * i + B * j) * 100 + (C * k + D * l)) == 0) {
                            continue;
                        }
                        double tmp = 100.0 * (C * k + D * l) /
                                     ((A * i + B * j) * 100 + (C * k + D * l));
                        if(tmp > dense) {
                            dense = tmp;
                            ans.first = (A * i + B * j) * 100 + (C * k + D * l);
                            ans.second = (C * k + D * l);
                        }
                    }
                }
            }
        }
    }
    cout << ans.first << " " << ans.second << endl;
}

Measured memory_bytes: 256