akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
//#define ll long long
#define mod 1000000007
#define NCONS 100001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
#define int long long
//#define double long double
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;

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

#define YYYY cout << "YES" << endl
#define NNNN cout << "NO" << endl
#define yyyy cout << "Yes" << endl
#define nnnn cout << "No" << endl


struct PAIR{int x; int y;};

int n, ret;
bool flag;
queue<int> edges[1001];
int direct_to[1001];
bool check[1001];

int32_t main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    cin >> n;
    
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n - 1; j++)
        {
            int a; cin >> a; edges[i].push(a);
        }
    }
    
    for(int i = 1; i <= n; i++)
    {
        auto nxt = edges[i].front(); edges[i].pop();
        direct_to[i] = nxt;
    }
    
    
    while(true)
    {
 //       set<int> st;
        vector<PAIR> vec;
        for(int i = 1; i <= n; i++)
        {
            auto cur = i;
            auto nxt = direct_to[cur];
            
            if(nxt == -1) continue;
            if(check[cur] || check[nxt]) continue;
//            if(st.find(cur) != st.end() || st.find(nxt) != st.end()) continue;
            
            if(cur == direct_to[nxt])
            {
                vec.push_back(PAIR{cur, nxt});
                check[cur] = true; check[nxt] = true;
 //               st.insert(cur); st.insert(nxt);
            }
        }
        
        if(vec.empty()) { break; }
        
        ret += 1;
        
        for(auto p : vec)
        {
            auto a = p.x, b = p.y;
            direct_to[a] = -1;
            direct_to[b] = -1;
            check[a] = check[b] = false;
            
            if(!edges[a].empty())
            {
                auto cur = edges[a].front(); edges[a].pop();
                direct_to[a] = cur;
            }
            
            if(!edges[b].empty())
            {
                auto cur = edges[b].front(); edges[b].pop();
                direct_to[b] = cur;
            }
        }
    }
    
    
    for(int i = 1; i <= n; i++)
        if(!edges[i].empty())
            flag = true;
    
    if(flag)
        cout << -1 << endl;
    else
        cout << ret << endl;
    return 0;
}


Measured memory_bytes: 8960
// ProblemURL : https://atcoder.jp/contests/abc080/tasks/abc080_c
// ---------------------------------------------
package main

import "fmt"

const inf = 1 << 60

func main() {
	var n int
	fmt.Scan(&n)
	const m = 10
	f := make([][]int, n)
	for i := 0; i < n; i++ {
		f[i] = make([]int, m)
		for j := 0; j < m; j++ {
			fmt.Scan(&f[i][j])
		}
	}
	p := make([][]int, n)
	for i := 0; i < n; i++ {
		p[i] = make([]int, 11)
		for j := 0; j < 11; j++ {
			fmt.Scan(&p[i][j])
		}
	}

	maxProfit := -inf
	for i := 1; i < 1<<uint(m); i++ {
		profit := 0
		for j := 0; j < n; j++ {
			ct := 0
			for h := 0; h < m; h++ {
				if (i>>uint(h))&1 == 1 && f[j][h] == 1 {
					ct++
				}
			}
			profit += p[j][ct]
		}
		if profit > maxProfit {
			maxProfit = profit
		}
	}
	fmt.Println(maxProfit)
}


Measured memory_bytes: 640
h,w = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
hw = [[] for i in range(h)]
ans = []
for i in range(n):
    for j in range(a[i]):
        ans.append(i+1)
for i in range(h):
    if i % 2 == 0:
        print(*ans[w*i:w*(i+1)])
    else:
        print(*ans[w*(i+1)-1:w*i-1:-1])

Measured memory_bytes: 42224
//Problem C
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1000007;
int n,q,k[N],t,id[N],tail[N];
char s[N];
ll tag,x[N],S[N];
int main(){
    scanf("%d%s%d",&n,s+1,&q);
    for(int i=1;i<=q;i++)scanf("%d",&k[i]);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=q;j++)while(tail[j]<t&&i-id[tail[j]+1]>=k[j])++tail[j];
        //printf("do %d %c",i,s[i]);for(int j=1;j<=q;j++)printf(" %d",tail[j]);printf("\n");
        if(s[i]=='D')x[t+1]=x[t]-tag,id[++t]=i;
        if(s[i]=='M')++tag;
        if(s[i]=='C')for(int j=1;j<=q;j++)S[j]+=tag*(t-tail[j])+x[t]-x[tail[j]];
        //for(int j=1;j<=t;j++)printf("(%d,%lld) ",id[j],x[j]);printf("%lld\n",tag);
    }
    for(int i=1;i<=q;i++)printf("%lld\n",S[i]);
    return 0;
}

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

int main () {
  int n,x;
  cin >>n>>x;
  vector<int>m(n);
  int calc =0;
  int cnt =0;
  int minm=1001;
  for (int i=0;i<n;i++){
    cin >>m[i];
  }
  for (int i=0;i<n;i++){
    calc +=m[i];
    if(minm>m[i]){
      minm =m[i];
    }
  }
  x =x-calc;
  cnt = x/minm;
  cout <<n+cnt<<endl;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
const int maxn = 3000 + 10;

ld p[maxn], dp[maxn][2 * maxn];

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> p[i];
	dp[0][3000] = 1;
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= 6000; j++){
			dp[i][j] = p[i] * dp[i - 1][j - 1] + (1 - p[i]) * dp[i - 1][j + 1];
		}
	}
	ld answer = 0;
	for (int j = 3001; j <= 6000; j++)
		answer += dp[n][j];
	cout << fixed << setprecision(9) << answer << endl;
}


Measured memory_bytes: 282880
# Stable Sort
N = int(input())
A = [(s, int(a)) for s, a in input().split()]
B = [a for a in A]

# Bubble
for i in range(N):
    for j in range(i+1, N)[::-1]:
        if A[j-1][1] > A[j][1]:
            A[j], A[j-1] = A[j-1], A[j]


# Selection
for i in range(N):
    argmin = i
    for j in range(i, N):
        if B[j][1] < B[argmin][1]:
            argmin = j
    B[i], B[argmin] = B[argmin], B[i]


print(*[s+str(a) for s, a in A])
print('Stable')
print(*[s+str(a) for s, a in B])
print('Stable' if A == B else 'Not stable')



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

namespace abc147_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int hug = 0;

            for(int i=0;i<S.Length/2;i++)
            {
                if(S[i]!=S[S.Length-i-1])
                {
                    hug += 1;
                }
            }
            Console.Write(hug);
            Console.Read();
        }
    }
}


Measured memory_bytes: 13140
def main():
    [N, M] = [int(num) for num in input().split(" ")]
    allset = set(range(M +  1))
    for _ in range(N):
        inp = [int(num) for num in input().split(" ")]
        inp.pop(0)
        allset =  allset.intersection(set(inp))
    print(len(allset))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
S = input()

if S[0] == "R":
    if S[1] =="R":
        if S[2]=="R":
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    if S[1] =="R":
        if S[2]=="R":
            print(2)
        else:
            print(1)
    else:
        if S[2]=="R":
            print(1)
        else:
            print(0)

Measured memory_bytes: 9052
#include<bits/stdc++.h>
using namespace std;
typedef long l;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define SONI ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
const int maxn=5e5+15;
const int maxm=5000+15;
const int mod=1e9+9;
const int inf=0x3f3f3f3f;
const int MOD=1000000007;

int main()
{
    SONI;
    int n;cin>>n;
    int table[n][3];
    int x;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>x;
            table[i][j]=x;
        }
    }
    
  
    int lookup[n][3];
    for(int i=0;i<3;i++)
        lookup[n-1][i]=table[n-1][i];
        
    for(int i=n-2;i>=0;i--)
    {
        for(int j=0;j<3;j++)
        {
            if(j==0)
            {
               lookup[i][j]=table[i][j]+max(lookup[i+1][j+1],lookup[i+1][j+2]); 
            }
            else if(j==1)
            {
                lookup[i][j]=table[i][j]+max(lookup[i+1][j-1],lookup[i+1][j+1]); 
            }
            else if(j==2)
            {
                lookup[i][j]=table[i][j]+max(lookup[i+1][j-1],lookup[i+1][j-2]);    
            }
        }
    }
    
   
    int ans = max(lookup[0][0],max(lookup[0][1],lookup[0][2]));
    cout<<ans;
    return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<climits>
using namespace std;
long int N,K,arr[100002],memo[100002],temp,l,i,j;
int dp(long int n,long int k)
{
	memo[1]=0;
	for(i=2;i<=k+1;i++)
	{
		memo[i]=abs(arr[i]-arr[1]);
	}
	for(j=k+2;j<=n;j++)
	{
		temp=INT_MAX;
		for(l=1;l<=k;l++)
		{
			if(temp>(memo[j-l]+abs(arr[j]-arr[j-l])))
				temp=(memo[j-l]+abs(arr[j]-arr[j-l]));
		}
		memo[j]=temp;
	}
	return memo[n];
}
int main()
{
	cin>>N>>K;
	for(i=1;i<=N;i++)
	{
		cin>>arr[i];
	}
	cout<<dp(N,K);

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	string s;
	cin >> s;
	if(s.length() == 3) reverse(all(s));
	cout << s << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

char a[4004],b[4004];

int solve(char *s,char *t,int lenS,int lenT){
  int i,j;
  int count = 0;
  int res = 0;

  for(i=j=0;i<lenS && j<lenT;i++,j++){
    if(s[i] == t[j]){
      count++;
    }
    else{
      if(res < count) res = count;
      count = 0;
    }
  }

  if(res < count) res = count;
  return res;
}

int main(void){
  int i,j;
  int lenA,lenB;
  int ans,tmp;

  while(scanf("%s%s",a,b) != EOF){
    lenA = strlen(a);
    lenB = strlen(b);
    ans = 0;

    //AÌæªÌi¶ðíÁ½¶ñÆ,Bðär
    for(i=0;i<lenA;i++){
      tmp = solve(&a[i],b,lenA-i,lenB);
      if(ans < tmp) ans = tmp;
    }

    //BÌæªÌi¶ðíÁ½¶ñÆ,Aðär
    for(i=0;i<lenB;i++){
      tmp = solve(&b[i],a,lenB-i,lenA);
      if(ans < tmp) ans = tmp;
    }

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

  return 0;
}

Measured memory_bytes: 772
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;

using namespace std;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };

vector<edge>tree[100010];
vector<P> connect[100005];
long long cost[100005];

int dist[305][305];
int dist2[305][305];

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

int main() {

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

	for (int i = 0; i < 305;++i) {
		for (int j = 0; j < 305;++j) {
			if(i == j) dist[i][j] = 0;
			else dist[i][j] = INF;
		}
	}

	for (int i = 0; i < M;++i) {
		int a, b, c;
		cin >> a >> b >> c;
		dist[--a][--b] = c;
		dist[b][a] = c;
	}

	for (int k = 0; k < N;++k) {
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
			}
		}
	}

	for (int i = 0; i < N;++i) {
		for (int j = 0; j < N;++j) {
			if(i == j) dist2[i][j] = 0;
			else if (dist[i][j] <= L) dist2[i][j] = 1;
			else dist2[i][j] = INF;
		}
	}

	for (int k = 0; k < N; ++k) {
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);
			}
		}
	}

	int Q;
	cin >> Q;

	for (int i = 0; i < Q;++i) {
		int s, t;
		cin >> s >> t;
		--s; --t;
		int ans = INF <= dist2[s][t] ? -1 : dist2[s][t] - 1;
		cout << ans << endl;
	}
}

Measured memory_bytes: 5888
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int((a).size())
#define int long long
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pb push_back
#define F first
#define S second
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define one(x) cout<<#x<<" : "<<x<<endl;
#define two(x,y) cout<<#x<<" : "<<x<<" , "<<#y<<" : "<<y<<endl;
#define three(x,y,z) cout<<#x<<" : "<<x<<" , "<<#y<<" : "<<y<<" , "<<#z<<" : "<<z<<endl;
#define PI acos(-1)
const int M = 1000000007;
const int N=3e5+5;


signed main()
{
    int n , i , j;
    cin >> n;
    vector< int > v(n);
    for(i=0 ; i<n; i++)
    {
        cin >> v[i];
    }
    map< int , int > mp  , cnt;
    for(auto x : v) mp[x]++;
    int ans = 0;
    for(auto x : mp)
    {
        ans+= (x.S *(x.S - 1))/2;
    }
    for(auto x : mp)
    {
        cnt[x.F] = ans - x.S + 1;
    }
    for(i=0 ;i<n ;i++)
    {
        cout<<cnt[v[i]]<<endl;
    }
}




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

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

int get_area(pii p1, pii p2) {
    int diff1 = p1.second - p1.first;
    int diff2 = p2.second - p2.first;
    if(diff1 <= 0 || diff2 <= 0) return 0;
    return diff2*diff1;
}

int main(void) {
    int width, height, qs;
    cin >> width >> height >> qs;
    pii range_x = make_pair(0, width);
    pii range_y = make_pair(0, height);
    for(int i = 0; i < qs; i++) {
        int x, y, a;
        cin >> x >> y >> a;
        switch(a) {
            case 1: // x < x_i
                range_x.first = max(range_x.first, x);
                break;
            case 2:
                range_x.second = min(range_x.second, x);
                break;
            case 3:
                range_y.first = max(range_y.first, y);
                break;
            case 4:
                range_y.second = min(range_y.second, y);
                break;
            default:
                break;
        }
        debug("x: %d, %d ", range_x.first, range_x.second);
        debug("y: %d, %d\n ", range_y.first, range_y.second);
    }
    cout << get_area(range_x, range_y) << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  int n,a,b;
  cin>>n>>a>>b;
  vector<long long> v(n);
  REP(i,n){
    cin>>v[i];
  }
  sort(ALL(v), greater<long long>());
  double max_v = 0.0;
  REP(i,a){
    max_v += (double)v[i];
  }
  max_v /= (double)a;
  cout<<fixed<<setprecision(7)<<max_v<<endl;
  
  //二項係数を作っておく
  long long dp[n+1][n+1];
  dp[0][0] = 1;
  REPP(i,n){
    REP(j,i+1){
      if(j==0 || j==i){
        dp[i][j] = 1;
      }else{
        dp[i][j] = dp[i-1][j] + dp[i-1][j-1];
      }
    }
  }
  
  //a番目の値と一致するv[i]の数
  int cnt = 0;
  REP(i,n){
    if(v[i]==v[a-1]){
      cnt++;
    }
  }
  //a番目の値と一致する 0<=i<=a-1 && v[i]の数
  int temp = 0;
  REP(i,a){
    if(v[i]==v[a-1]){
      temp++;
    }
  }
  long long ans = 0;
  int choose_num;
  if(v[0]==v[a-1]){
    for(int i = a;i<=b;i++){
      if(i>cnt)break;
      ans += dp[cnt][i];
    }
  }else{
    ans = dp[cnt][temp];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007

int main(){
    string s,t;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    string u;
    cin>>u;
    if(u==s){
        a--;
    }
    else if(u==t){
        b--;
    }
    cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
l = [1] * n
for i in range(k):
    d = ni()
    a = na()
    for i in range(d):
        l[a[i] - 1] = 0
print(sum(l))


Measured memory_bytes: 9124
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> v(n);
    vector<int> ans(n);
    rep(i,n) cin >> v[i];
    int sum = 0;
    rep(i,n) sum ^= v[i];
    rep(i,n) ans[i] = sum^v[i];
    rep(i,n) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 4752
n = int(input())
raw = list(map(int,input().split()))
nn = 1
scale = 1
while True:
  if n <= nn:
    raw += [0] * (nn-n)
    break
  else:
    nn *= 2
    scale += 1
#print(raw,scale)
n = len(raw)

def gcd(aa,bb):
  if aa == 0:
    return bb
  elif bb == 0:
    return aa
  else:
    big,sml = aa,bb
    while sml:
      big,sml = sml,big%sml
    return big
seg = [0] * n + raw
for i in range(1,n)[::-1]:
  seg[i] = gcd(seg[2*i],seg[2*i+1])
#print(seg)
db = [2**i for i in range(scale)]
rdb = list(reversed(db))
#print(db)
#print(rdb)
can = []
for j in range(n):
  now = [[0,j],[j+1,db[-1]]]
  #print(now)
  g = 0
  for i in range(scale):
    last = now
    now = []
    for lr in last:
      l,r = lr
      if l == r:
        continue
      L = (l-1) // rdb[i] + 1
      R =   r   // rdb[i]
      if L < R:
        for U in range(L,R):
          g = gcd(g,seg[db[i]+U])
        now.append([l,rdb[i]*L])
        now.append([rdb[i]*R,r])
      else:
        now.append(lr)
      #print(now)
  can.append(g)
print(max(can))
#print(seg)

Measured memory_bytes: 93568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int e[105][105];
int ans;
int main(void){
	int n,k; cin>>n>>k;
	if(k>(n-1)*(n-2)/2){
		cout<<-1<<endl;
		return 0;
	}
	for(int i=2;i<=n;i++){
		e[1][i]=1;
		ans++;
	}
	int a=(n-1)*(n-2)/2-k;
	int s=2,t=3;
	//cout<<a<<endl;
	for(int i=0;i<a;i++){
		e[s][t]=1;
		ans++;
		if(t<n){
			t++;
		}else{
			s++; t=s+1;
		}
	}
	cout<<ans<<endl;
	for(int i=0;i<105;i++){
		for(int j=0;j<105;j++){
			if(e[i][j]==1){
				cout<<i<<" "<<j<<endl;
			}
		}
	}
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, m;
  cin >> n >> m;
  vector<int> v(m + 1);
  rep(i, 0, n) {
    int k;
    cin >> k;
    rep(i, 0, k) {
      int a;
      cin >> a;
      v[a]++;
    }
  }

  int ans = 0;
  rep(i, 1, m + 1) if (v[i] == n) ans++;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string vec[4] = {"dream", "dreamer", "erase", "eraser"};
for (int i=0; i<4; i++){
    reverse(vec[i].begin(), vec[i].end());
}

int i=0; bool can=true;
while(i<s.size()){
    can=false;
    for(int j=0; j<4; j++){
        string v=vec[j];     //vに入れないとsubstr使えない。
        bool kosokuka=false;
        if(s.substr(i, v.size())==vec[j]){
            i+=v.size();
            can=true;
            kosokuka=true;
        }
        if(kosokuka) break;
    }
    if(!can) break;
}

if(can) cout << "YES" << endl;
else cout << "NO" << endl;

}

Measured memory_bytes: 512
package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var a, b string
	fmt.Scan(&a, &b)
	n, _ := strconv.ParseFloat(a+b, 64)
	sqrt := math.Sqrt(n)
	if math.Floor(sqrt) == sqrt {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 1772
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c, d, N, ans=0, L, X;
    vector<int> v(3);
    int tmp=0, tmp2;
    string S, S2, S3;
    bool flag=true;
    
    cin >> N;
    cin >> S;

    cout <<(N>=3200? S: "red") <<endl;

    // if(S[1]==S[2] &&(S[0]==S[1] | S[2]==S[3]))
    // 	cout << "Yes" <<endl;
    // else
    // 	cout << "No" <<endl;

    // string S;
    // cin >>S;
    // // cout << S + "pp"<<endl;
    // if(flag)
    // 	puts("Yes");
    // else
    // 	puts("No");
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
const int mod =1'000'000'007;

int main(){
    double l;
    cin >> l;
    double x = l / 3;
    double ans = pow(x,3);
    printf("%.10f\n", ans);
    return 0;
}


Measured memory_bytes: 4176
#include<iostream>

using namespace std;

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

	int t = 1;
	while (1) {

		c = c - b;
		if (c <= 0) {
			t = 1;
			break;
		}
		a = a - d;
		if (a <= 0) {
			t = 0;
			break;
		}
	}

	if (t) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        var A = cin.scanint;
        Array.Sort(A);
        if (A[0] == 1 && A[1] == 4 && A[2] == 7 && A[3] == 9)
        {
            WriteLine("YES");
        }
        else
        {
            WriteLine("NO");
        }
    }

}

class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
    public void join<T>(IEnumerable<T> values) { WriteLine(string.Join(" ", values)); }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
#define int long long int
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);

bool used[2005][2005] = {};
int cnt[2005] = {};
void solve(long long N, long long X, long long Y)
{
  X--, Y--;
  queue<pair<pair<int, int>, int>> que;
  que.push(make_pair(make_pair(X, Y), 1));
  rep(i, N - 1)
  {
    que.push(make_pair(make_pair(i, i + 1), 1));
  }
  while (!que.empty())
  {
    auto s = que.front();
    int x = s.first.first;
    int y = s.first.second;
    int d = s.second;
    que.pop();
    //cerr << x << " " << y << endl;
    if (x < 0 || y < 0 || x >= N || y >= N)
      continue;
    if (used[x][y] || used[y][x] || x == y)
      continue;
    used[x][y] = true;
    used[y][x] = true;
    cnt[d]++;
    if (x == X)
    {
      que.push(make_pair(make_pair(Y, y), d + 1));
    }
    if (y == Y)
    {
      que.push(make_pair(make_pair(x, X), d + 1));
    }
    que.push(make_pair(make_pair(x, y + 1), d + 1));
    que.push(make_pair(make_pair(x, y - 1), d + 1));
    que.push(make_pair(make_pair(x - 1, y), d + 1));
    que.push(make_pair(make_pair(x + 1, y), d + 1));
  }
  for (int i = 1; i <= N - 1; i++)
  {
    cout << cnt[i] << endl;
  }
}

signed main()
{
  long long N;
  scanf("%lld", &N);
  long long X;
  scanf("%lld", &X);
  long long Y;
  scanf("%lld", &Y);
  solve(N, X, Y);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}


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

int main() {
  
  int A,ans;
  for ( int i = 0; i < 3; i ++){
    A = 0;
    cin >> A;
    ans += A;
  }
  
  if ( ans <= 21 ){
    cout << "win";
  }else{
    cout << "bust";
  }
  
  cout << endl;
  
}

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

int main(){

    string s;
    cin>>s;
    ll sum=0;
    for(auto x: s){
        sum+=(x-'0');
    }
    if(sum%9)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;

}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    vector<ll> x(n), y(n);
    REP(i, n) cin >> x[i] >> y[i];

    const double PI = acos(-1);

    vector<ll> ord(n);
    iota(ALL(ord), 0);
    double ret = LLINF;
    do {
        // cout << ord << endl;
        ll mx = 0, my = 0;
        double dir = 0, arg = 0;
        for(auto i: ord) {
            double t = atan2(y[i]-my, x[i]-mx);
            arg += min(2*PI-abs(t-dir), abs(t-dir));
            // cout << "i=" << i << " t=" << t << " " << min(2*PI-abs(t-dir), abs(t-dir)) << endl;
            dir = t;
            mx = x[i], my = y[i];
        }
        double t = atan2(0-my, 0-mx);
        arg += min(2*PI-abs(t-dir), abs(t-dir));
        // cout << "i=" << n << " t=" << t << " " << min(2*PI-abs(t-dir), abs(t-dir)) << endl;
        // cout << arg << endl;
        chmin(ret, arg);
    } while(next_permutation(ALL(ord)));

    cout << fixed << setprecision(9) << ret * 180.0 / PI << endl;

    return 0;
}



Measured memory_bytes: 3516
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AthleteProgramming2
{
    class Program
    {
        static void Main()
        {
            bool isOk = true;
            int[] all = new int[26];
            for(int i = 0; i < all.Length; i++)
            {
                all[i] = 1;
            }

            char[] s = Console.ReadLine().ToArray();

            for(int i = 0; i < s.Length; i++)
            {
                int tmp = s[i] - 'a';
                all[tmp]--;
            }

            for(int i = 0; i < s.Length; i++)
            {
                if (all[i] <= -1)
                {
                    isOk = false;
                }
            }

            if (isOk == true)
            {
                Console.WriteLine("yes");
            }else
            {
                Console.WriteLine("no");
            }

        }
    }
}


Measured memory_bytes: 13268
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
const int P=1e9+7,i2=(P+1)>>1,N=4010,maxn=2e5+10;
int inv[N<<1],fac[N<<1],ifac[N<<1],a[maxn],b[maxn],dp[N][N],n,ans;
inline int C(int x,int y){return 1ll*fac[x+y]*ifac[x]%P*ifac[y]%P;}
int main(){
    scanf("%d",&n);
    inv[1]=1;
    rep(i,2,8000) inv[i]=1ll*(P-P/i)*inv[P%i]%P;
    fac[0]=ifac[0]=1;
    rep(i,1,8000) fac[i]=1ll*fac[i-1]*i%P,ifac[i]=1ll*ifac[i-1]*inv[i]%P;
    rep(i,1,n) scanf("%d%d",&a[i],&b[i]),ans=(ans-C(2*a[i],2*b[i])+P)%P,dp[2000-a[i]][2000-b[i]]++;
    rep(i,1,4000) dp[0][i]=(dp[0][i]+dp[0][i-1])%P,dp[i][0]=(dp[i][0]+dp[i-1][0])%P;
    rep(i,1,4000) rep(j,1,4000) dp[i][j]=(dp[i][j]+(dp[i-1][j]+dp[i][j-1])%P)%P;
    rep(i,1,n) ans=(ans+dp[2000+a[i]][2000+b[i]])%P;
    printf("%lld\n",1ll*ans*i2%P);
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n, m;
	ll a, b, c, d;
	cin >> n >> m;
	vector<pair<ll,ll>>stu, chk;
	rep(i, n) { cin >> a >> b; stu.push_back(make_pair(a, b)); }
	rep(i, m) { cin >> c >> d; chk.push_back(make_pair(c, d)); }
	ll mdist = INF;
	int cp = 0;
	ll sx, cx, sy, cy;
	rep(i, n) {
		mdist = INF;
		sx = stu[i].first;
		sy = stu[i].second;
		rep(j, m) {
			cx = chk[j].first;
			cy = chk[j].second;
			if (mdist > (abs(sx - cx) + abs(sy - cy))) {
				mdist = (abs(sx - cx) + abs(sy - cy));
				cp = j;
			}
		}
		cout << cp + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 3620
package main

import (
	"fmt"
)

func main() {
	var a, b, c, x int
	fmt.Scan(&a, &b, &c, &x)
	x = x / 50
	var tmp, ans int = 0, 0
	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				tmp = 10*i + 2*j + k
				if tmp != 0 {
					if x == tmp {
						ans++
					}
				}
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;
int INF = 1001001001;
template <typename T>
T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T>
T lcm(T a, T b) { T g = gcd(a, b); return a * b / g; }

void solve()
{
    int n; cin >> n;
    ll ans = 0;
    reps(i, n)reps(j, n)reps(k, n)
    {
        ans += gcd(i,gcd(j, k));
    }
    cout << ans << endl;
    return;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<vector<T>> m) {
    repall (v, m)
        init(v);
}

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4

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

    int h, w, k;
    cin >> h >> w >> k;
    k--;

    vec dp(w);
    dp[0] = 1;
    rep (i, h) {
        vec memo(w);
        rep (b, (1 << (w - 1))) {
            if ((b & (b << 1)) != 0 or (b & (b >> 1)) != 0) continue;
            rep (j, w) {
                if ((b >> j) & 1 and j != w - 1)
                    memo[j] += dp[j + 1];
                else if (((b >> (j - 1)) & 1) and j != 0)
                    memo[j] += dp[j - 1];
                else
                    memo[j] += dp[j];
                memo[j] %= MOD;
            }
        }
        dp = memo;
    }
    print(dp[k]);

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

void bubblesort(int *a,int n){

int i,j,k,temp;

for (i = 0; i < n; i++) {
    j=n-1;
    while (j!=i) {
        if (a[j]<a[j-1]) {
            temp=a[j];
            a[j]=a[j-1];
            a[j-1]=temp;
        }
        j--;
    }
    /*for (k = 0; k < n; k++) {
        if(k==n-1)printf("%d\n",a[k]);
        else printf("%d ",a[k]);
    }*/
}
}






int main() {

    int a[10],i;

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

    bubblesort(a,10);

    for (i = 0; i < 3; i++) {
        printf("%d\n",a[9-i] );
    }
    return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;
     
public class Main {
    	
    private final static Scanner sc = new Scanner(System.in);
    	
    public static void main(String[] arg) {
    	int N = sc.nextInt();
    	int b = sc.nextInt();
      	int sum = 2 * b;
      	int b2;
      	for(int i = 0; i < N-2; i++) {
        	b2 = sc.nextInt();
          	if(b2 < b) {
              sum = sum - b + b2;
            }
          	b = b2;
          	sum += b;
        }
      	System.out.println(sum);
          
   	}
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int64_t i=0;i<(int64_t)N;i++)
int main()
{
  int64_t N,X,Y,count=0;
  cin>>N>>X>>Y;
  vector<int64_t> G(N,0);
  rep(i,N)rep(j,N)
  {
    count=1<<30;
    if(i<j){count=min(abs(j-i),min(abs(X-i-1)+1+abs(j+1-Y),abs(Y-i-1)+1+abs(j+1-X)));G.at(count-1)++;}
  }
  rep(i,N-1)cout<<G.at(i)<<endl;
}

Measured memory_bytes: 256
N, L = map(int,input().split())

mingo = 1000

cnt = 0
sumringo = 0
while cnt < N:
    sumringo += L
    if abs(L) < mingo:
        eatringo = L
        mingo = abs(L)
    L += 1
    cnt += 1

print(sumringo - eatringo)

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

int main(){
  int A,B;
  cin >> A >> B;
  int answer = B/100 - A/100 + 1;
  if((A/10000) + ((A/1000)%10)*10 < A%100) answer--;
  if((B/10000) + ((B/1000)%10)*10 > B%100) answer--;
  cout << answer << endl;
}

    

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

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

    if(n < 1000) cout << "ABC" << endl;
    else cout << "ABD" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
	int t;
	cin>>t;
	int homes[100001];
	int hn=0;
	int roads[100001];
	int rn=0;
	for(int l = 0; l < t; l++){
		rn=hn=0;
		int n,k;
		cin>>n>>k;
		for(int i = 0; i < n; i++){
			int p;
			cin>>p;
			homes[hn]=(p);
			hn++;
		}
		if(hn<=k){
			cout<<0<<endl;
			continue;
		}
		int sumL=0;
		for(int i = 1; i < hn; i++){
			int length=homes[i]-homes[i-1];
			roads[rn]=(length);
			rn++;
			sumL+=length;
		}
		sort(roads,roads+rn,greater<int>());
		int rid=0;
		for(int i = 0; i < k-1; i++){
			rid+=roads[i];
		}
		cout<<sumL-rid<<endl;
	}

	return 0;
}

Measured memory_bytes: 1644
#include <stdio.h>
#include <string.h>

int main(){
  char s[4][4] = {"AC", "WA", "TLE", "RE"};
  int n;  scanf("%d", &n);
  int ans[4] = {0};
  for(int i=0; i<n; i++){
    char t[4];  scanf("%s", t);
    for(int j=0; j<4; j++)
      if(strcmp(t, s[j])==0)
	ans[j]++;
  }
  
  for(int i=0; i<4; i++)
    printf("%s x %d\n", s[i], ans[i]);


  return 0;
}
  


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

#define rep(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define SZ(x) ((int) (x).size())
typedef long long ll;

const int N = 5005;
int n,k;
int a[N];

int main(){
	//freopen("d.in","r",stdin);
	scanf("%d%d", &n, &k);
	rep(i,0,n) scanf("%d", &a[i]);
	sort(a, a+n, greater<int>());
	//rep(i,0,n) printf("%d%c", a[i], i==n-1?'\n':' ');
	int sum=0, need=0;
	rep(i,0,n) {
		sum = 0;
		rep(j,i,n) {
			sum += a[j];
			if(sum>=k) {
				need = max(need, j+1);
				sum -= a[j];
			}
		}
	}
	printf("%d\n", n-need);
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  int n = s.length();
  string ans = "Good";
  rep(i,n-1){
    if (s[i]==s[i+1]) ans = "Bad";
  }
  cout << ans << endl;
  
  return 0;
}


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

using namespace std;

using ll = long long;

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

    int d;
    cin >> d;
    if (d == 22) cout << "Christmas Eve Eve Eve\n";
    else if (d == 23) cout << "Christmas Eve Eve\n";
    else if (d == 24) cout << "Christmas Eve\n";
    else if (d == 25) cout << "Christmas\n";

    return 0;
}


Measured memory_bytes: 256
import sys
#fin = open("test.txt", "r")
fin = sys.stdin

n = int(fin.readline())
A = list(map(int, fin.readline().split()))
q = int(fin.readline())
m_list = list(map(int, fin.readline().split()))

for m in m_list:
	can_compose = False
	s = [[] for i in range(n)] #s[i][m]??§???A[i]?????§???????´???§m????????????????????????????????????
	for i in range(n):
		s[i] = [False for i in range(m + 1)]

	for j in range(m + 1):
		if j == A[0]:
			s[0][j] = True
		else:
			s[0][j] = False
		
	if s[0][m]:
		can_compose = True
		
	if not can_compose:
		for i in range(1, n):
			for j in range(m + 1):
				if j == A[i]:
					s[i][j] = True
				elif s[i - 1][j]:
					s[i][j] = True
				else:
					if j - A[i] >= 0:
						s[i][j] = s[i - 1][j - A[i]]
			
			if s[i][m]:
				can_compose = True
				break

	if can_compose:
		print("yes")
	else:
		print("no")

Measured memory_bytes: 8020
#include<bits/stdc++.h>
using namespace std;
long long n,a[100005],dp[100005],k;
int main(){
    cin >> n >> k;
    for(int i=1;i<=n;i++){ cin>>a[i]; }
	memset(dp,0x7f7f7f,sizeof(dp)); dp[1]=0;
    for(int i=2;i<=n;i++){ 
    	for(int j=1;j<=k && i-j > 0;j++){
    		dp[i]=min(dp[i],abs(a[i-j]-a[i]) + dp[i-j]);
		}
	}
    cout<<dp[n]<<'\n';
}   

Measured memory_bytes: 5140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n,m,tmp,x,sm=0;
  cin >> n;
  map<int,int> mp;
  rep(i,n){
    cin >> tmp;
    sm+=tmp;
    mp[i]=tmp;
  }
  cin >> m;
  rep(i,m){
    cin >> tmp >> x;
    cout << sm-mp[tmp-1]+x << endl;
  }
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

#include <cmath>


using namespace std;

int main() {
  int k, x;
  cin >> k >> x;

  for (int i = x - k + 1; i < k + x; i++) {
    cout << i << " ";
  }

  cout << endl;


  return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc073/tasks/abc073_c
# 偶数個を抜くだけ
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(read())


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


from collections import Counter
N = a_int()
A, = read_col(N)
ans = 0
for v in Counter(A).values():
    ans += v & 1
print(ans)


Measured memory_bytes: 106492
using namespace std;
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main(){
    
    int A, B, T;

    cin >> A >> B >> T;

    cout << int((T+0.5)/A)*B << endl;

    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=110;
int n,b[N],x[N],y[N],s[N];
int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; ++i)
		scanf("%d",&b[i]);
	for(int i=1; i<=n; ++i)x[i]=i,y[i]=1;
	for(int i=1; i<=n; ++i){
		int k=0;
		for(int j=1; j<=n; ++j)if(b[j]==x[j]&&y[j]==1)k=j;
		if(k==0){puts("-1"); return 0;}
		for(int j=k; j<=n; ++j)--x[j]; y[k]=0; s[++s[0]]=b[k];
	}
	for(int i=n; i>=1; --i)printf("%d\n",s[i]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, t;
	cin >> n >> t;
	vector<int> a;
	a.resize(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	set<int> s;
	s.emplace(a[0]);
	int mx = 0, cnt = 0;
	for(int i = 1; i < n; ++i) {
		if(a[i] - *s.begin() > mx) {
			mx = a[i] - *s.begin();
			cnt = 1;
		} else if(a[i] - *s.begin() == mx) {
			++cnt;
		}
		s.emplace(a[i]);
	}
	cout << cnt << '\n';
	return 0;
}

Measured memory_bytes: 5376