akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<queue>
#include<cstring>
using namespace std;
int n,k;
int dist[100010];
bool vis[100010];
int ans[100010];
vector<pair<int,int> >v[100010];
void dij(int st)
{
	for(int i=1;i<=n;i++)dist[i]=1e9;
	priority_queue<pair<int,int> , vector<pair<int,int> > ,greater<pair<int,int> > >q;
	q.push(make_pair(0,0));
	memset(vis,false,sizeof(vis));
	int s=n+1;
	while(s--)
	{
		while(!q.empty() && (vis[q.top().second] || dist[q.top().second]!=q.top().first))q.pop();
		int x=q.top().second;
		q.pop();
		vis[x]=true;
		for(int i=0;i<v[x].size();i++)
		{
			int y=v[x][i].first,w=v[x][i].second;
			if(vis[y])continue;
			if(dist[x]+w<dist[y])
			{
				dist[y]=dist[x]+w;
				q.push(make_pair(dist[y],y));
			}
		}
	}
} 
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].push_back(make_pair(y,1));
		v[y].push_back(make_pair(x,1));
	}
	for(int i=1;i<=n;i++)ans[i]=-1;
	scanf("%d",&k);
	for(int i=1;i<=k;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[0].push_back(make_pair(x,y));
		ans[x]=y;
	}
	dij(0);
	for(int i=1;i<=n;i++)
	{
		if(ans[i]!=-1 && ans[i]!=dist[i])
		{
			printf("No");
			return 0;
		}
		ans[i]=dist[i];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<v[i].size();j++)
		{
			if(ans[i]-ans[v[i][j].first]!=1 && ans[i]-ans[v[i][j].first]!=-1)
			{
				printf("No");
				return 0;
			}
		}
	}
	puts("Yes");
	for(int i=1;i<=n;i++)
	{
		printf("%d\n",ans[i]);
	}
	return 0;
} 

Measured memory_bytes: 9512
#include <stdio.h>

int main(){
  char X, Y;
  scanf("%c %c", &X, &Y);
  if(X < Y){
    printf("<\n");
  }
  if(X == Y){
    printf("=\n");
  }
  if(X > Y){
    printf(">\n");
  }
  return 0;
}


Measured memory_bytes: 128
/**
  @file c.cpp
  @title C - Green Bin
  @url https://atcoder.jp/contests/abc137/tasks/abc137_c
**/

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)

int main() {
  int N;
  cin >> N;
  vector<string> s(N, "");
  REP(i, N) {
    cin >> s[i];
    sort(ALL(s[i]));
  }

  sort(ALL(s));

  map<string, LL> m;
  for (int i = 0; i < N; i++) {
    m[s[i]]++;
  }

  LL ans = 0;
  for (auto e : m) {
    ans += e.second * (e.second - 1) / 2;
  }

  cout << ans << endl;
  return 0;
}


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

vector<int> v;

void dfs(int n, int acc) {
  if (n == 0) {
    v.push_back(acc);
    return;
  }
  dfs(n-1, acc * 10 + 3);
  dfs(n-1, acc * 10 + 5);
  dfs(n-1, acc * 10 + 7);
}

int main() {
  int N; cin >> N;
  for (int i = 3; i < 10; i++) dfs(i, 0);
  sort(v.begin(), v.end());
  int cnt = 0;
  for (int i = 0; i < v.size(); i++) {
    vector<bool> use(10);
    if (v.at(i) > N) break;
    int n = v.at(i);
    while (n > 0) {
      use.at(n%10) = true;
      n /= 10;
    }
    if (use.at(3) == true && use.at(5) == true && use.at(7) == true) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
  long x;
  cin >> x;
  long cnt = 0;
  long s = 100;
  while(1){
    s =(long)(s * 1.01);
    cnt++;
    if(s >= x){
      cout << cnt << endl;
      return 0;
    }
  }
}

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

const int MAXN = 1e5;
vector<bool> vis(MAXN + 1, false);
vector<int> adj[MAXN + 1];

int dfs(int x) {
        vis[x] = true;
        for(int i = 0; i < adj[x].size(); i++)
                if(!vis[adj[x][i]])
                        dfs(adj[x][i]);
}

int main(void)
{
	ios_base::sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++) {
                int x, y, z;
                cin >> x >> y >> z;
                adj[x].push_back(y);
                adj[y].push_back(x);
	}
	int ans = 0;
	for(int i = 1; i <= n; i++) {
                if(!vis[i]) {
                        ans++;
                        dfs(i);
                }
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 8832
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		while(true){

			//数字の数と、組み合わせで作る数字の入力
			int howManyNumber = scan.nextInt();
			int createNumber = scan.nextInt();
			//組み合わせたものの和
			int combination = 0;
			//成立した組み合わせの数
			int count = 0;

			//ともに０の時に終了
			if(howManyNumber == 0 && createNumber == 0){
				break;
			}

			for(int num1 = 1 ;num1 <= howManyNumber ;num1++){
				for(int num2 = 2 ;num2 <= howManyNumber ;num2++){
					for(int num3 = 3 ;num3 <= howManyNumber ;num3++){
						//数字の相対的な大きさ決めを重複をはじく
						if(num1 < num2 && num2 < num3){
							combination = num1 + num2 + num3;
							if(createNumber == combination){
								count++;
							}
						}
					}
				}
			}
			System.out.println(count);
		}
		scan.close();
	}
}



Measured memory_bytes: 26524
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    int n,i;
    cin>>n>>s>>t;

    for(i=0;i<n;i++)
    {
        cout<<s[i]<<t[i];
    }
    cout<<endl;
    return 0;
}


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

int main() {
	for(;;) {
		int n;
		cin >> n;
		if(!n) break;
		string s;
		cin >> s;
		string ans;
		for(int i = 0; i < n; i++) {
			stringstream ss;
			int len = s.length();
			queue<char> que;
			for(int j = 0; j < len; j++) {
				que.push(s[j]);
			}
			while(!que.empty()) {
				char top = que.front();
				que.pop();
				int cnt = 1;
				while(!que.empty() && que.front() == top) {
					cnt++;
					que.pop();
				}
				ss << cnt << top;
			}
			ans = s = ss.str();
		}
		cout << ans << endl;
	}

	return 0;
}

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

using namespace std;
typedef long long ll;
const int N = 5050;

int n, k;
ll p[N], pp[N][35], val[N][35], Max[N][35], c[N];
ll ans = -0x7fffffff;

int main() 
{
    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; ++i) scanf("%lld", &p[i]);
    for(int i = 1; i <= n; ++i) scanf("%lld", &c[i]);

    for(int i = 1; i <= n; ++i) Max[i][0] = val[i][0] = c[p[i]], pp[i][0] = p[i];

    // for(int i = 1; i <= n; ++i) cout << Max[i][0] << ' ' << val[i][0] << ' ' << pp[i][0] << endl;

    for(int j = 1; j < 32; ++j)
    {
        for(int i = 1; i <= n; ++i)
        {
            pp[i][j] = pp[pp[i][j - 1]][j - 1];
            val[i][j] = val[i][j - 1] + val[pp[i][j - 1]][j - 1];
            Max[i][j] = max(Max[i][j - 1], val[i][j - 1] + Max[pp[i][j - 1]][j - 1]);
            // printf("%-12lld ", Max[i][j]);
        }
        // puts("");
    }

    for(int i = 1; i <= n; ++i)
    {
        ll K = k, P = i, V = 0, A = -0x7fffffff;
        for(int j = 0; j < 31; ++j)
            if(K & (1 << j))
            {
                A = max(A, V + Max[P][j]);
                V += val[P][j];
                P = pp[P][j];
            }

        ans = max(ans, A);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 7924
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string a, b;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> a >> b;
	if (a.size() > b.size()) cout << "GREATER" << endl;
	else if (a.size() < b.size()) cout << "LESS" << endl;
	else {
		if (a > b) cout << "GREATER" << endl;
		else if (a < b) cout << "LESS" << endl;
		else cout << "EQUAL" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59

int main(){
  ll n,m;
  ll i,j;
  cin>>n>>m;
  vector<ll> ok(101010,1);
  for(i=0;i<m;i++){
    ll x;
    cin>>x;
    ok[x]=0;
  }
  vector<ll> a(101010);
  a[0]=1;
  for(i=1;i<101010;i++){
    if(ok[i]==0) a[i]=0;
    else {
      if(i==1) a[i]=1;
      else a[i]=a[i-1]+a[i-2]; 
    }
    a[i]%=Mod;
  }
  cout<<a[n]<<endl;

  return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);;

    public static void main(String[] args) {
        String S = sc.next();
        if (S.charAt(2) == S.charAt(3) && S.charAt(4) == S.charAt(5)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N;
    long T;
    cin >> N >> T;
    vector<long> t(N);
    rep(i,N){
        cin >> t.at(i);
    }
    long ans=0;
    rep(i,N-1){
        if(t.at(i+1)-t.at(i)>=T){
            ans+=T;
        }else{
            ans+=t.at(i+1)-t.at(i);
        }
    }
    ans +=T;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int S;
int ans;
void dfs(long long x , int mask)
{
	if (x > S) return;
	if (mask == 7) ans++;
	dfs(x * 10 + 3 , mask | 1);
	dfs(x * 10 + 5 , mask | 2);
	dfs(x * 10 + 7 , mask | 4);
}
int main()
{
	ans = 0;
	cin >> S;
	dfs(0 , 0);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			String S = scan.next();
			char[]s = new char[S.length()];
			s = S.toCharArray();
			
			int []goukei = new int[S.length()];
			int []R = new int[S.length()];
			int []L = new int[S.length()];
			
			int Rcount = 0;
			for(int i = S.length()-1;i>=0;i--) {
				if(s[i]=='L') {
					Rcount = 0;
					R[i] = Rcount;
				}else if(s[i] =='R') {
					Rcount++;
					R[i] = Rcount;
				}	
			}
			
			for(int i = 0;i<S.length();i++) {
				if(R[i]!=0) {
					if(R[i]%2==0) {//偶数
						goukei[i+R[i]]++;
					}else{//奇数
						goukei[i+R[i]-1]++;
					}
				}
			}
			
			
			int Lcount = 0;
			for(int i = 0;i<S.length();i++) {
				if(s[i]=='R') {
					Lcount = 0;
					L[i] = Lcount;
				}else if(s[i] =='L') {
					Lcount++;
					L[i] = Lcount;
				}	
			}
			
			for(int i = 0;i<S.length();i++) {
				if(L[i]!=0) {
					if(L[i]%2==0) {//偶数
						goukei[i-L[i]]++;
					}else{//奇数
						goukei[i-L[i]+1]++;
					}
				}
			}
			
			for(int i = 0;i<S.length();i++) {
				System.out.print(goukei[i]);
				System.out.print(" ");
			}
			
			
			
		}
	}
}


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

int main() {
  int n, m, Q;
  cin>>n>>m>>Q;

  int a[n+1][n+1];
  int acc[n+1][n+1];
  for (int i=0; i<=n; i++) {
    for (int j=0; j<=n; j++) {
      a[i][j] = 0;
      acc[i][j] = 0;
    }
  }
  for (int i=0; i<m; i++) {
    int l, r;
    cin>>l>>r;
    ++a[l][r];
  }
  for (int i=1; i<=n; i++) {
    for (int j=1; j<=n; j++) {
      acc[i][j] = acc[i][j-1] + a[i][j];
    }
  }
  for (int i=0; i<Q; i++) {
    int p, q;
    cin>>p>>q;
    int cnt = 0;
    for (int j=p; j<=q; j++) {
      cnt += acc[j][q];
    }
    cout<<cnt<<endl;
  }
}

Measured memory_bytes: 2944
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

using namespace std;
typedef long long int64;

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  
  string s;
  cin>>s;
  
  vector<string> vec{"SAT","FRI","THU","WED","TUE","MON","SUN"};
  
  for(int i=0;i<7;i++){
    if(s==vec[i]){
      cout<<i+1<<endl;
      return 0;
    }
  }



  return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
min_card,max_card = 0,n
for i in range(m):
    l,r = map(int,input().split())
    min_card = max(min_card,l)
    max_card = min(max_card,r)
#print(min_card,max_card)
if min_card<=max_card:
    print(max_card-min_card+1)
else:
    print(0)

Measured memory_bytes: 9140
N = gets.to_i

as = []
N.times{
	as << gets.to_i
}

count = 0
prev = 0
i = N - 1
while i >= 0
	cur = as[i]
	if cur > i
		puts "-1"
		exit
	end
	
	if cur < prev
		puts "-1"
		exit
	elsif cur > prev
		count += cur
	end
	prev = cur - 1
	
	i -= 1
end

puts count



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


int main() {
  int N; cin >> N;
  vector<char> S(N);
  for(int i=0; i<N; i++) cin >> S[i];

  if(find(S.begin(), S.end(), 'Y') != S.end()) cout << "Four" << endl;
  else cout << "Three" << endl;


  return 0;
}


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

int main(){
	int l[10],va,vb,v,tl;
	double a,tv;
	char ch;
	while(1){
		tl = 0;
		for(int i = 0;i < 10;++i){
			cin >> l[i];
			if(cin.eof()) break;
			cin >> ch;
			tl += l[i];
		}
		if(cin.eof()) break;
		cin >> va >> ch >> vb;
		v = va + vb;
		a = (double)tl / (double)v;
		tv = (double)va;
		tv *= a;
		for(int i = 0;i < 10;++i){
			tv -= (double)l[i];
			if(tv <= 0.0) {
				cout << i + 1 << endl;
				break;
			}
		}

	}
	return 0;
}

Measured memory_bytes: 0
import java.util.*;

class LongCommSubs {
	int lcs(char[] X, char[] Y, int m, int n) {
		int[][] table = new int[m + 1][n + 1];
		for (int i = 0; i <= m; i++) {
			for (int j = 0; j <= n; j++) {
				if (i == 0 || j == 0) {
					table[i][j] = 0;
				} else if (X[i - 1] == Y[j - 1]) {
					table[i][j] = table[i - 1][j - 1] + 1;
				} else {
					table[i][j] = max(table[i - 1][j], table[i][j - 1]);
				}
			}
		}
		return table[m][n];
	}

	/* Utility function to get max of 2 integers */
	int max(int x, int y) {
		if (x > y) {
			return x;
		} else {
			return y;
		}
	}
}

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		LongCommSubs lcs = new LongCommSubs();
		int q = in.nextInt();
		in.nextLine();
		char[] X, Y;
		for (int i = 0; i < q; i++) {
			X = in.nextLine().trim().toCharArray();
			Y = in.nextLine().trim().toCharArray();
			System.out.println(lcs.lcs(X, Y, X.length, Y.length));
		}
		in.close();
	}
}



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

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  rd(string, s);
  wt(count(all(s), '+') - count(all(s), '-'));
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    int ans = 0;
    vector<pair<string, int>> p(N);
    for (int i = 0; i < N; i++){
        string s;
        int x;
        cin >> s >> x;
        p[i] = make_pair(s, x);
    }

    string z;
    cin >> z;

    bool flag = false;
    for(int i = 0; i < N; i++) {
        if(p[i].first != z && !flag){
            continue;
        } else if(p[i].first == z && !flag){
            flag = true;
        } else {
            ans += p[i].second;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=998244353;
int n,m,mm;
int cnt;
int c[35];
int yz[35];
int ans=0;
void dfs(int d,int sum){
	if(d==cnt){
		if(sum>=n)
			ans=max(mm/sum,ans);
		return ;
	}
	for(int i=0;i<=c[d];i++){	
		dfs(d+1,sum);
		sum=sum*yz[d];
	}
}
int main()
{
	cin>>n>>m;
	mm =m;
	int p=sqrt(m);
	for(int i=2;i<=p;i++){
		if(m%i==0){
			while(m%i==0){
				yz[cnt]=i;
				c[cnt]++;
				m/=i;
			}	
			cnt++;
		}
	}
	if(m!=1){
		yz[cnt]=m;
		c[cnt]++;
		cnt++;
	}
	dfs(0,1);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;

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




Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    int a[3];
    for(int i=0;i<2;i++){
        cin>>a[i];
    }
    sort(a,a+3);
    cout<<a[0]*a[1]/2<<endl;

    return 0;
}

Measured memory_bytes: 3616
import java.util.*;

public class Main{
	static Scanner s=new Scanner(System.in);

	public static void main(String[] args){
		int a[]= {s.nextInt(),s.nextInt(),s.nextInt()};
		Arrays.sort(a);
		System.out.println(a[2]*10+a[1]+a[0]);
	}
}

Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(void){
    string s,t;
    cin>>s>>t;
    int l= s.size();
    for (int i = 0;i<l;i++){
        if (s==t.substr(i,l)+t.substr(0,i)){
            cout<<"Yes";
            exit(0);
        }
    }
    cout<<"No";
    exit(0);
    
}


Measured memory_bytes: 3604
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reg(i,a,b) for(int i=(a);i<=(b);i++)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second


bool belfo(int n,int s,vector<mp>* vs,int* dist,int* gone){
	memset(gone,-1,sizeof(int)*n);
	gone[s]=1;
	dist[s]=0;
	
	rep(k,n+1){
		if(k==n)return false;
		bool ch=false;
		rep(no,n){
			if(gone[no]==-1)continue;
			int nc=dist[no];
			rep(i,vs[no].size()){
				int to=vs[no][i].fir,
					co=vs[no][i].sec;
				if(gone[to]==-1 || dist[to]>nc+co){
					dist[to]=nc+co;
					gone[to]=1;
					ch=true;
				}
			}
		}
		if(!ch)break;
	}
	return true;
}



	
	
	
int n,m;

vector<mp> vs[100005];


int dist[100005];
int gone[100005];




int main(void){
	int n,m,s;
	scanf("%d%d%d",&n,&m,&s);
	rep(i,m){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		vs[a].push_back(mp(b,c));
		//vs[b].push_back(mp(a,c));
	}
	if(belfo(n,s,vs,dist,gone)){
		rep(i,n){
			if(gone[i]!=-1)printf("%d\n",dist[i]);
			else printf("INF\n");
		}
	}
	else printf("NEGATIVE CYCLE\n");
	return 0;
	
}

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

int main() {
int n;
cin >> n;
vector<int> a(n); 
for(int i=0; i<n; i++){
cin >> a.at(i);
}sort(a.begin(),a.end());
  cout << a.at(n/2)-a.at(n/2-1) << endl;
}


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


int main()
{
int n;
scanf("%d",&n);
int a[n];
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
int max,min;
max=min=a[0];
for(int i=1;i<n;i++)
{
if(a[i]>max)
max=a[i];
if(a[i]<min)
min=a[i];
}
printf("%d",(max-min));
}


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

int main()
{
    int a,b,x,y,z;
    cin>>a>>b;
    x=a+b;
    y=a-b;
    z=a*b;
    if(x>=y&&x>=z)
     cout<<x;
    else if(y>=x&&y>=z)
     cout<<y;
    else cout<<z;
   
return 0;
}

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

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

int n, m;
int data[100];

void shuffle(int x, int y){
  int dst[100];
  for(int i=x-1;i<x-1+y;++i){
    dst[i-x+1]=data[i];
  }
  for(int i=x-2;i>=0;--i){
    data[i+y]=data[i];
  }
  for(int i=0;i<y;i++){
    data[i]=dst[i];
  }
}

void init(){
  rep(i,n)
    data[i]=n-i;
}

int main() {
  while(true){
    scanf("%d%d",&n,&m);
    if (!n&&!m)break;
    init();
    rep(_,m) {
      int x, y;
      scanf("%d%d",&x,&y);
      shuffle(x,y);
    }
    printf("%d\n",data[0]);
  }
  return 0;
}

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

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

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

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

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

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

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

void solve() {
    LL l,r;
    cin >> l >> r;
    if (r - l + 1 >= 2019) cout << 0 << endl;
    else {
        LL ans = 2019;
        REP(i,l,r+1) REP(j,i+1,r+1) {
            ans = min(ans, (1LL * i * j) % 2019);
        }
        cout << ans << endl;
    }
}

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

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

const int MAX_N = 1e5 + 6;

int a[MAX_N];

int main () {
	int n;
	while (scanf("%d",&n) != EOF) {
		int cnt=0;
		for (int i=1;n>=i;i++) {
			scanf("%d",&a[i]);
			if (a[i]&1) cnt++;
		}
		if (n==1) puts("YES");
		else if (cnt&1) puts("NO");
		else puts("YES");
	}
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define mp make_pair
using namespace std;
int n;
int main(){
    cin >> n;
    int ans = 0;
    for(int i=1 ; i<=n ; ++i){
        int cnt=0,x=i;
        while(x > 0){
            cnt++;
            x/=10;
        }
        if(cnt&1)ans++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, b;
    cin >> a >> b;
    //*/

    /*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    //*/
    
    /*
    if( a * b % 2 == 0 ){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    //*/
    
    cout << a + b / 2 << endl;

    return 0; 
}


Measured memory_bytes: 3624
#include<iostream>

using namespace std;

int main() {
  /* code */
  long long N, all, t3_n, t5_n, t15_n, sum3, sum5, sum15, ans;
  cin >> N;

  all = N *(N+1) / 2;
  t3_n = N / 3;
  t5_n = N / 5;
  t15_n = N /15;

  sum3 = (t3_n * (3 + t3_n * 3)) / 2;
  sum5 = (t5_n * (5 + t5_n * 5)) / 2;
  sum15 = (t15_n * (15 + t15_n * 15)) / 2;

  ans = all - (sum3 + sum5 - sum15);

  cout << ans;
  return 0;
}


Measured memory_bytes: 3644
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for _ in range(M)]

dic=dict({})
for i in range(N):
    if A[i] not in dic.keys():
        dic[A[i]]=1
    else:
        dic[A[i]]+=1

for i in range(M):
    if BC[i][1] not in dic.keys():
        dic[BC[i][1]]=BC[i][0]
    else:
        dic[BC[i][1]]+=BC[i][0]

dic = sorted(dic.items(), reverse=True)
cnt=0
ans=0
for i in range(len(dic)):
    if cnt>=N:
        break
    else:
        if cnt+dic[i][1]<=N:
            cnt+=dic[i][1]
            ans+=dic[i][0]*dic[i][1]
        else:
            ans+=dic[i][0]*(N-cnt)
            break
print(ans)

Measured memory_bytes: 58688
#include<algorithm>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b, bool equal = false){
    if(a < b || equal && a == b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b, bool equal = false){
    if(b < a || equal && a == b){
        a = b;
        return true;
    }
    return false;
}

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

    int n;
    cin >> n;

    vector<int> x(n), y(n), h(n);
    int k = -1;
    for(int i = 0 ; i < n ; ++i){
        cin >> x[i] >> y[i] >> h[i];
        if(h[i] > 0){
            k = i;
        }
    }

    assert(0 <= k && k < n);

    int ans1 = -1;
    int ans2 = -1;
    int ans3 = -1;

    for(int cx = 0 ; cx <= 100 ; ++cx){
        for(int cy = 0 ; cy <= 100 ; ++cy){
            int H = h[k] + abs(x[k] - cx) + abs(y[k] - cy);
            bool flag = true;
            for(int i = 0 ; i < n ; ++i){
                if(max(H - abs(x[i] - cx) - abs(y[i] - cy), 0) != h[i]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                ans1 = cx;
                ans2 = cy;
                ans3 = H;
                break;
            }
        }
        if(ans1 >= 0){
            break;
        }
    }

    assert(0 <= ans1 && ans1 <= 100 && 0 <= ans2 && ans2 <= 100 && ans3 >= 1);

    cout << ans1 << " " << ans2 << " " << ans3 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>

using namespace std;

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

const ll p = 998244353;

int main()
{
  ll N, S;
  cin >> N >> S;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> A[i];
  }

  vector<ll> dp(S + 1, 0), dp_prev(S + 1);
  ll ans = 0;

  if (A[0] <= S)
    dp[A[0]] = 1;
  for (ll i = 0; i < N; i++)
  {
    ans += dp[S] * (N - i);
    ans %= p;
    if (i == N - 1)
      break;
    dp_prev = dp;
    dp_prev[S] = 0;
    dp.assign(S + 1, 0);
    if (A[i + 1] <= S)
    {
      dp[A[i + 1]] = i + 2;
      for (ll j = 0; j < A[i + 1]; j++)
      {
        dp[j] += dp_prev[j];
      }
      for (ll j = A[i + 1]; j <= S; j++)
      {
        dp[j] += dp_prev[j] + dp_prev[j - A[i + 1]];
      }
    }
    else
    {
      for (ll j = 0; j <= S; j++)
      {
        dp[j] += dp_prev[j];
      }
    }
    for (ll j = 0; j <= S; j++)
    {
      dp[j] %= p;
    }
  }

  cout << ans << endl;
}


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

using namespace std;

int main()
{


   // string s;

    int a[4]={0},n,i;

    cin>>n;

    while(n--)
    {
        
        string s;
        
           cin>>s;

    if(s=="AC")
        a[0]++;

    else if(s=="WA")

        a[1]++;

    else if(s=="TLE")

        a[2]++;

    else

        a[3]++;
    }




    string c[4]={"AC","WA","TLE","RE"};

    for(i=0;i<4;i++)
    {
        cout<<c[i]<<" x "<<a[i]<<endl;
    }


}


Measured memory_bytes: 3576
import sys
sys.setrecursionlimit(1000000)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
K = I()
S = S()

if len(S) <= K:
    print(S)
    sys.exit()
else:
    li = "".join([S[0:K],"..."])
    print(li)


Measured memory_bytes: 61716
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
	static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
		string s = Console.ReadLine();


		
		int max = 0;
		for (int i = 1; i < n; i++)
		{
			var ldic = new Dictionary<char, bool>();
			for (int k = 0; k < 26; k++)
			{
				ldic[Convert.ToChar(97 + k)] = false;
			}
			var rdic = new Dictionary<char, bool>(ldic);

			for (int j = 0; j < i; j++)
			{
				ldic[s[j]] = true;
			}
			for (int j = i; j < n; j++)
			{
				rdic[s[j]] = true;
			}
			
			int count = System.Linq.Enumerable
							.Range(97, 26)
							.Count(e => ldic[Convert.ToChar(e)] == true && rdic[Convert.ToChar(e)] == true);

			if (count > max)
			{
				max = count;
			}
		}
		Console.WriteLine(max);
	}
}


Measured memory_bytes: 13396
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		int k = scanner.nextInt();
		int ans = 1;
		
		for (int i = 0; i < n; i++) {
			if (ans*2<ans+k) {
				ans = ans*2;
			}else {
				ans = ans+k;
			}
		}
		System.out.println(ans);
		
		scanner.close();
	}

}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll n, m;
    cin >> n >> m;
    if (m == 1) {
        cout << 1 << " " << n << endl;
        return 0;
    }
    if (n % 2 == 0) {
        ll small = 1, big = n;
        if (n % 4 == 0) {
            rep(i, m) {
                if (big - small == n / 2 - 1) {
                    big--;
                }
                cout << small << " " << big << endl;
                small++;
                big--;
            }
        } else {
            rep(i, m) {
                if (big - small == n / 2) {
                    big--;
                }
                cout << small << " " << big << endl;
                small++;
                big--;
            }
        }
    } else {
        ll small = 1, big = n;
        rep(i, m) {
            cout << small << " " << big << endl;
            small++;
            big--;
        }
    }
    return 0;
}



Measured memory_bytes: 3644
w,h,n = map(int,input().split())
p = [0,w,0,h]
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        p[0] = max(x,p[0])
    if a == 2:
        p[1] = min(x,p[1])
    if a == 3:
        p[2] = max(y,p[2])
    if a == 4:
        p[3] = min(y,p[3])
print(max(0,p[1]-p[0])*max(0,p[3]-p[2]))


Measured memory_bytes: 3064
/*************************************************\
                 MD.Faysal Hasan
                Comilla Univesity
\*************************************************/

#include<bits/stdc++.h>
using namespace std;

#define         ikarus_101     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define         scl(x)         scanf("%lld",&x)
#define         scll(x,y)      scanf("%lld%lld",&x,&y)
#define         sclll(x,y,z)   scanf("%lld%lld%lld",&x,&y,&z)
#define         scc(x)         scanf("%c",&x)
#define         scs(x)         scanf("%s",&x)
#define         pfl(x)         printf("%lld\n",x)
#define         pfll(x,y)      printf("%lld %lld\n",x,y)
#define         pyes           puts("YES")
#define         pno            puts("No")
#define         nel            printf("\n")
#define         spc            ' '
#define         nn             '\n'

#define         vcl            vector<ll>
#define         mpl            map<ll,ll>
#define         vpl            vector<pair<ll,ll>>
#define         pb             push_back
#define         mkp(x,y)       make_pair(x,y)
#define         F              first
#define         S              second
#define         vin(a)         for(auto &it : a) cin>>it
#define         vout(a)        for(auto it : a) cout<<it<<spc;cout<<nn
#define         yes            cout<<"YES"<<"\n"
#define         no             cout<<"NO"<<"\n"
#define         all(a)         a.begin(),a.end()
#define         sajo(str)      sort(str.begin(),str.end())
#define         rev(str)       reverse(str.begin(),str.end())
#define         usajo(str)     sort(str.rbegin(),str.rend())

#define         rep(i,n)       for ( i=0 ; i<n ; ++i )
#define         rep1(i,n)      for ( i=1 ; i<=n ; ++i )

#define         pi             2*acos(0.0)
#define         gcd(a,b)       __gcd(a,b)
#define         lcm(a,b)       (a/gcd(a,b))*b
#define         mem(a,b)       memset(a,b,sizeof (a))
#define         dec(x)         cout<<fixed<<setprecision(x)
#define         min3(a,b,c)    min(a,min(b,c))
#define         max3(a,b,c)    max(a,max(b,c))
#define         LIM            100005

typedef     unsigned long long      ull;
typedef     long long               ll;
typedef     long double             ld;

const   ll  N   =   2e5+7;
const   ll  M   =   1e9+7;
const   ll  lmx =   92233720368547758;

int main() {ikarus_101

      ll n,m,a,b,c,d,x,y,i,j,k;

      ll aa[10];
      n=5;
      rep1(i,n)
      {
          scl(aa[i]);
          if(aa[i] == 0) pfl(i);
      }
      return 0;
}



Measured memory_bytes: 3780
n, x = map(int, input().split())
x = list(map(lambda y: abs(x - int(y)), input().split()))


from functools import reduce
from fractions import gcd
def greatest_common_divisor(iter):
    '''
    最大公約数を返す
    '''
    return reduce(gcd, iter)


print(greatest_common_divisor(x))


Measured memory_bytes: 14240
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>


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

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll nmax=2*100000+1;


int main(){
    ll n,ans,a;
    cin>>n;
    map<ll,ll> mp;
    for(ll i=0;i<n;i++){
        cin>>a;
        mp[a]++;
    }
    ans=0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if((itr->second)%2==1)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6528
/******************************************************************************
 
рассвет. 
 
*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (lli i = a; i < (n); ++i)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
 
const lli MOD=1e9+7;
const lli MAXN=1e6+1;
const ld PI=acos(-1);
 
int main(){
    rapgame
    string s;
    cin >> s;
    int n=s.size();
    vi a(2019,0);
    vi osts(2e5+1,1);
    fra(i,1,2e5+1){
        osts[i]=(osts[i-1]*10)%2019;
    }    
    a[0]++;
    int cur=0;lli ans=0;
    for(int i=n-1;i>-1;--i){
        int dig=s[i]-'0';
        cur+=dig*osts[n-1-i];
        cur%=2019;
        a[cur]++;
    }
    fr(i,2019){
        ans+=1ll*a[i]*(a[i]-1)/2;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 4304
#include <cstdio>
#include <iostream>
#include <stack>
#include <string>
using namespace std;

bool isNumber(char c){
    if( c >= '0' && c <= '9' ) return true;
    return false;
}

int main(){
    string s;
    while( getline(cin,s) ){
        int minusFlag = 1;
        double n = 0.0;
        stack<double> st;
        s += " "; //üÍª1ÂÌ½ßÉóXy[XðöÉÇÁ

        for(int i=0 ; i < s.size() ; i++ ){
            char c = s[i];
            if( c == '-' && isNumber(s[i+1]) ){ //Ìð\·'-'¾Á½Æ«
                minusFlag = -1;
            }else if( isNumber(c) ){ //¾Á½Æ«
                n *= 10.0;
                n += c - '0';
            }else  if( c == ' ' && isNumber(s[i-1]) ){ //ó¾Á½Æ«
                n = n * minusFlag;
                st.push( n );
                n = 0.0;
                minusFlag = 1;
            }else if( c == '+' || c == '-' || c == '*' || c == '/' ){ //Zq¾Á½Æ«
                double a = st.top();
                st.pop();
                double b = st.top();
                st.pop();
                if( c == '+' ) st.push( b + a );
                if( c == '-' ) st.push( b - a );
                if( c == '*' ) st.push( b * a );
                if( c == '/' ) st.push( b / a );
            }
        }
        printf("%.8f\n", st.top() );
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>

#define INF 100000000

using namespace std;

int main()
{
    int a, b, c, cnt = 1;
    cin >> a >> b;
    if (a != b)
        cnt++;
    cin >> c;
    if (a != c && b != c)
        cnt++;
    cout << cnt << endl;

    return 0;
}


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

struct Edge{
    int to;
    int w;
};
using Edges=vector<Edge>;
using Graph=vector<Edges>;

int main(){
    int n;
    cin>>n;
    vector<int> p(n);
    for(int i=0;i<n;i++) cin>>p[i];

    Graph g(n);
    for(int i=0;i<n;i++){
        if(p[i]==0){
            for(int j=1;j<=6 && i+j<n;j++){
                g[i].push_back(Edge{i+j,1});
            }
        }
        else{
            g[i].push_back(Edge{min(max(0,i+p[i]),n-1),0});
        }
    }    
    
    const int INF=1e6;
    vector<int> d(n,INF);
    vector<int> used(n,false);
    d[0]=0;
    deque<int> deq;
    deq.push_back(0);
    while(!deq.empty()){
        int v=deq.front();
        deq.pop_front();
        if(used[v]) continue;
        for(int i=0;i<g[v].size();i++){
            int to=g[v][i].to,w=g[v][i].w;
            if(used[to] || d[to]<=d[v]+w) continue;
            d[to]=d[v]+w;
            if(w==0){
                deq.push_front(to);
            }
            else{
                deq.push_back(to);
            }
        }
    }
    cout<<d[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 10984
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <array>
#include <algorithm>
#include <set>

using namespace std;

#define int long long

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

    string in;

    cin >> in;

    in[3] = '8';

    cout << in;

}

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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353
#define Graph vector<vector<int>>

int main() {
    int D, N; cin >> D >> N;
    vector<int> ans;
    for (int i = 1; i < 10000000; i++) {
        if (i % (int)pow(100, D) == 0 && i % (int)pow(100, D + 1) != 0) ans.push_back(i);
    }
    cout << ans.at(N - 1) << endl;
}

Measured memory_bytes: 67552
n = int(input())

l = list(map(int,input().split()))

w = 0

n_list = [i for i in range(1,n+1)]

for i in range(n):
    if l[i] != n_list[i]:
        w += 1

if w <= 2:
    print('YES')

else:
    print('NO')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  string t;
  cin>>t;
  for(int i=0;i<t.size();i++){
    if(t.at(i)=='?'){
      t.at(i)='D';
    }
  }
  cout<<t<<endl;
  return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
#define INF 1000000000
#define PI 3.14159265359

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

    int K,A,B;
    cin >> K>>A >> B;
    int cnt = 0;


    for(int i=0;i<1500;i++){
        if ((K*i >= A)&(K*i <= B)){
            cout << "OK" << endl;
            cnt += 1;
            break;
        }
    }
        if (cnt <1){
            cout << "NG" << endl;
    

    }
}

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

int main() {
  int N, X, T, ans;
  cin >> N >> X >> T;
  
  if(N % X == 0){
    ans = (N / X ) * T;
  }else{
    ans = (N / X + 1 ) * T;
  }
  cout << ans << endl;
}

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

int main() {
  string N;
  cin >> N;
  
  int x = N[N.size() - 1];
  if(x == '2' || x == '4' || x == '5' || x == '7' || x == '9') {
    cout << "hon" << endl;
  } else if(x == '0' || x == '1' || x == '6' || x == '8') {
    cout << "pon" << endl;
  } else {
    cout << "bon" << endl;
  }
}  


Measured memory_bytes: 3624
N = int(input())

p_all = 10 ** N
p_no0 = 9 ** N
p_no9 = 9 ** N
p_no09 = 8 ** N

ans = (p_all - p_no0 - p_no9 + p_no09) % (10 ** 9 + 7)

print(ans)

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

using namespace std;

typedef long long ll;

int main()
{
  ll N, A, B;
  cin >> N >> A >> B;
  if (A < B && N >= 2) cout << (B - A) * (N - 2) + 1 << endl;
  else if (A == B) cout << 1 << endl;
  else cout << 0 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mod 1000000000
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define pi 3.14159
ll power(ll a,int n){
  if(n==0)
    return 1;
  if((n%2)==0)
    return power(a*a,n/2);
  else
    return a*power(a*a,n/2);    
}
vector<bool> mark;
void seive(ll N){
    mark.resize(N+1);
  for(ll i=2;i*i<=N;i++){
    if(!mark[i]){
       for(ll j=i*i;j<=N;j+=i){
         mark[j]=1;
       }
      }
  }
}
int main(){
FASTIO
int n,k;
cin>>n>>k;
vector<bool> v(n);
for(int i=0;i<k;i++){
  int d;
  cin>>d;
  vector<int> v1(d);
  for(int j=0;j<d;j++)
     cin>>v1[j];
  for(int j=0;j<d;j++){
    v[v1[j]-1]=true;
  }
}
int ans=0;
for(int i=0;i<n;i++){
  if(!v[i]){
    ans++;
  }
}
cout<<ans;
return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define Reverse(v) reverse(all(v))
#define Rsort(v) sort(all(v),greater)
#define pub(v) push_back(v)
#define pob(v) pop_back(v)
typedef long long ll;
typedef vector<ll> vel;
typedef vector<vector<ll>> vel2d;
typedef string str;
typedef pair<ll,ll> pal;
typedef vector<str> ves;
typedef vector<char> vech;


int main() {
	str T;cin>>T;
    ll m=T.size();
    ll ans=0;
    rep0(i,m){
        if(T[i]=='?'){
            if(i==0){T[i]='D';}
            if(T[i-1]=='P'){T[i]='D';}
            else {T[i]='D';}
        }
    }

    //cout<<ans<<endl;
    cout<<T<<endl;
}



Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  cin >> n;
  int sw = 0;
  vector< int > w(n);
  for (int i=0; i<n; ++i) {
    cin >> w[i];
    sw += w[i];
  }
  int swi = 0;
  int ans = sw;
  for (int i=0; i<n; ++i) {
    swi += w[i];
    ans = min(ans, abs(swi-abs(sw-swi)));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256