akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

int main(){
    ll a,b,c,d,e,x,y,n,m,h,k,ans=0,sum=0;
    string s,t;
    cin >>n>>a>>b>>c>>d>>e;
    cout << max({ (n - 1) / a, (n - 1) / b, (n - 1) / c, (n - 1) / d, (n - 1) / e }) + 5 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  string s;
  cin>>s;
  int i;
  for(i=0;i<s.size();i++)
  {
    int x;
    x=(int)(s.at(i))+n;
    if(x>90)
    {
      x=x-26;
    }
    cout<<(char)x;
  }
}

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

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    int N, M;
    cin >> N >> M;

    int sum = 0;
    rep(i,0,M) {
        int A; cin >> A;
        sum += A;
    }

    cout << max(N - sum, -1) << endl;

    return 0;
}


Measured memory_bytes: 3660
w = input()

op = ["+", "-"]
for op1 in op:
    for op2 in op:
        for op3 in op:
            if eval(w[0] + op1 + w[1] + op2 + w[2] + op3 + w[3]) == 7:
                print(w[0] + op1 + w[1] + op2 + w[2] + op3 + w[3] + "=7")
                exit()


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;

int main() {
	cout << fixed << setprecision(15);
	int n;
	while (cin >> n, n != 0) {
		double sum = 0;
		vector<double> s(n, 0);
		for (int i = 0; i < n; i++) {
			cin >> s[i];
			sum += s[i];
		}
		double m = sum / n;
		double b = 0,sum2=0;
		for (int i = 0; i < n; i++) {
			sum2 += pow((s[i] - m), 2);
		}
		double ans = sqrt(sum2/n);
		cout << ans << endl;
	}
}



Measured memory_bytes: 3244
N=int(input())
START = 96
ALP = 26
ans = []
while True:
  if N <= ALP:
    ans.append(chr(START + N)) 
    break
  p = N % ALP
  if p == 0:
    ans.append(chr(START + ALP))
  else:
    ans.append(chr(START + p))
  if p == 0:
    N -= 1
  N = N // ALP
print(''.join(ans[::-1]))

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    string  s, t, u;
    int a, b, red, blue;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(s == u)
    {
         red = a - 1;
         cout << red << " " << b << endl;
    }
    else if(t == u)
    {
        blue = b - 1;
        cout << a << " " << blue << endl;
    }

    return 0;
}


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

int main(void) {
  string S ;
  cin >> S;
  
  
  for ( char c = 'a';c <= 'z' ; c++){
    bool found = false;
    for (int i=0; i < S.size();i++){
      if(S[i]==c){
        found= true;
  }
}

    if (! found){
      cout << c << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	int a, b;
	cin >> a >> b;
	cout <<a-b+1 << endl;
}

Measured memory_bytes: 256
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  int n;
  scanf("%d\n",&n);
  printf("%d\n",(n+1)/2);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
const int mod = (int) 1e9 + 7;
const int maxn = (int) 2e5 + 5;
const double eps = 1e-9;

int n, a[maxn];
ll s[maxn], cnt, b[maxn];

ll solve(int f) {
    rep(i, 0, n + 1) b[i] = s[i];
    ll add = 0, res = 0;
    rep(i, 1, n + 1) {
        b[i] += add;
        if(f * b[i] <= 0) {
            add += f - b[i];
            res += abs(f - b[i]);
        }
        f = -f;
    }
    return res;
}

int main() {
    //freopen("test.txt", "r", stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    rep(i, 1, n + 1) cin >> a[i], s[i] = s[i - 1] + a[i];
    cout << min(solve(1), solve(-1)) << endl;
}



Measured memory_bytes: 2176
#include <iostream>
#include <stdio.h>
#include <math.h> 
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>

using namespace std;
string s;
string t;

int main() {

	cin >> s;
	cin >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

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

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef tuple<ll,ll,ll,ll> tp;
typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	ll n,m;
	cin>>n>>m;
	vp in(n);
	rep(i,n)cin>>in[i].first>>in[i].second;
	sort(all(in));
	int t=0;
	while(m>0){
		if(in[t].second<m)m-=in[t].second;
		else{
			cout<<in[t].first<<endl;
			break;
		}
		t++;
	}
}











Measured memory_bytes: 1792
import 'dart:io';
 
void main(List<String> args){
  List<int> N = stdin.readLineSync().split(' ').map((i) => int.parse(i)).toList();
  int takahashi = N[2]~/N[1];
  int aoki = N[0]~/N[3];
  if(N[2]%N[1]!=0) takahashi = takahashi + 1;
  if(N[0]%N[3]!=0) aoki = aoki + 1;
  if(takahashi > aoki) print("No");
  else print("Yes");
}

Measured memory_bytes: 13112
//be naame khodaa
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
#define F first
#define S second
#define pb push_back
#define sz(x) ((int)(x).size())

inline int in(){ int x, y; y = scanf("%d", &x); return x; }

const int N = 18;

vector <int> make(int n, int diff){
	vector <int> res;
	if (n == 1){
		res.pb(0);
		res.pb(1);
		return res;
	}
	if (n == diff){
		vector <int> v = make(n-2, diff-2);
		for (int i = 0; i < v.size(); i++){
			if (i%2 == 0){
				res.pb(v[i]);
				res.pb(v[i] + (1 << (n-2)));
				res.pb(v[i] + (1 << (n-2)) + (1 << (n-1)));
				res.pb(v[i] + (1 << (n-1)));
			}
			else{
				res.pb(v[i] + (1 << (n-1)));
				res.pb(v[i] + (1 << (n-2)) + (1 << (n-1)));
				res.pb(v[i] + (1 << (n-2)));
				res.pb(v[i]);
			}
		}
		swap(res[res.size()-1], res[res.size()-3]);
	}
	else{
		vector <int> v = make(n-1, diff);
		for (int i = 0; i < v.size(); i++){
			if (i%2 == 0){
				res.pb(v[i]);
				res.pb(v[i] + (1 << (n-1)));
			}
			else{
				res.pb(v[i] + (1 << (n-1)));
				res.pb(v[i]);
			}
		}
		return res;
	}
}

int p[N];
bool mark[N];
int arr[N];

int main(){
	int n = in(), a = in(), b = in();
	int diff = 0;
	int ip = 0;
	for (int i = 0; i < n; i++){
		if (((a >> i)&1) != ((b >> i)&1)){
			p[ip++] = i;
			mark[i] = true;
			diff++;
		}
	}
	int j = 0;
	for (int i = ip; i < n; i++){
		while (mark[j])
			j++;
		p[i] = j;
		mark[j] = true;
	}
	if (diff%2 == 0)
		return (cout << "NO\n"), 0;
	vector <int> v = make(n, diff);
	cout << "YES\n";
	for (int i = 0; i < (1 << n); i++){
		int cur = 0;
		for (int j = 0; j < n; j++)
			cur += (1 << p[j])*((v[i] >> j)&1);
		cur ^= a;
		cout << cur << ' ';
	}
	cout << endl;
	return 0;
}


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

using namespace std;

const int N = 205;
const long long oo = 1e18;

int n, m, r, sp[N];
long long dis[N][N];
long long dp[10][1 << 10];

long long recur(int at, int mask){
	if(__builtin_popcount(mask) == r) return 0;
	if(dp[at][mask] != -1) return dp[at][mask];
	long long ans = oo;
	for(int i = 0; i < r; ++i){
		if(mask & (1 << i)) continue;
		ans = min(ans, dis[sp[at]][sp[i]] + recur(i, mask | (1 << i)));
	}
	return dp[at][mask] = ans;
}

int main(){
	scanf("%d %d %d", &n, &m, &r);
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= n; ++j){
			if(i == j) dis[i][j] = 0;
			else dis[i][j] = oo;
		}
	}
	int a, b;
	long long c;
	for(int i = 0; i < r; ++i) scanf("%d", &sp[i]);
	for(int i = 1; i <= m; ++i){
		scanf("%d %d %lld", &a, &b, &c);
		dis[a][b] = min(dis[a][b], c);
		dis[b][a] = min(dis[b][a], c);
	}
	for(int k = 1; k <= n; ++k){
		for(int i = 1; i <= n; ++i){
			for(int j = 1; j <= n; ++j){
				dis[i][j] = min(dis[i][k] + dis[k][j], dis[i][j]);
			}
		}
	}
	memset(dp, -1, sizeof(dp));
	long long ans = oo;
	for(int i = 0; i < r; ++i){
		ans = min(ans, recur(i, 1 << i));
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

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

    vector<vector<long>> dp(2, vector<long>(l + k + 1, 0));
    constexpr long W = 0;
    constexpr long B = 1;
    dp[W][0] = 1;
    for (int i = 0; i <= l; ++i) {
        dp[B][i + 1] += dp[W][i];
        dp[B][i + k] += dp[W][i];
        dp[W][i + 1] += dp[B][i];
    }

    long sum_ = 0;
    for (int i = 0; i <= l; ++i) {
        sum_ += dp[B][i];
    }

    cout << sum_ << endl;
}

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

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

int main() {
    string S;
    cin >> S;

    int64_t ans = 0L;
    for (int tmp = 0; tmp < (1 << S.size() - 1); tmp++) {
        bitset< 9 > op(tmp);
        int idx = 0;
        int len = 1;
        for (int i = 0; i < S.size() - 1; i++) {
            if (op.test(i)) {
                ans += stol(S.substr(idx, len));
                idx += len;
                len = 1;
            } else {
                ++len;
            }
        }
        ans += stol(S.substr(idx, len));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m,l,i,j,k;
  long long int  a[101][101],b[101][101],c[100][100]={0};
  scanf("%d %d %d",&n,&m,&l);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%lld",&a[i][j]);
    }
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      scanf("%lld",&b[i][j]);
    }
  }
  for(i=0;i<n;i++){
    for(k=0;k<l;k++){
      for(j=0;j<m;j++){
	c[i][k]+=a[i][j]*b[j][k];
	
      }
    }
  }
  for(i=0;i<n;i++){
    for(k=0;k+1<l;k++){
      printf("%lld ",c[i][k]);
    }
    
    printf("%lld\n",c[i][k]);
  }
  
  return 0; 
}




Measured memory_bytes: 2096
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		int board[][] = new int[10][10];
		while((str = br.readLine()) != null) {
			String[] nstr = str.split(",");
			int n[] = new int[]{Integer.parseInt(nstr[0]), Integer.parseInt(nstr[1]), Integer.parseInt(nstr[2])};
			
			if(n[2] == 2) {
				for(int i = -1; i <= 1; i++) {
					if(n[0] + i < 0) continue;
					for(int j = -1; j <= 1; j++) {
						if(n[1] + j < 0) continue;
						board[n[0] + i][n[1] + j]++;
					}
				}
			} else {
				for(int i = 0; i < 10; i++) {
					for(int j = 0; j < 10; j++) {
						if(n[2] == 1) {
							if(Math.abs(n[0] - i) + Math.abs(n[1] - j) <= 1) {
								board[i][j]++;
							}
						} else {
							if(Math.abs(n[0] - i) + Math.abs(n[1] - j) <= 2) {
								board[i][j]++;
							}
						}
					}
				}
			}
		}

		int cnt = 0, max = 0;
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 10; j++) {
				if(board[i][j] == 0) cnt++;
				if(board[i][j] > max) max = board[i][j];
			}
		}
		System.out.println(cnt);
		System.out.println(max);
	}
}

Measured memory_bytes: 16924
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
	int m1,d1,m2,d2;
	cin>>m1>>d1>>m2>>d2;
	int ans = 0;
	if(m1+1==m2 || d1+1 != d2){
		cout << "1\n";
	}
	else{
		cout << "0\n";
	}
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	
	solve();
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <valarray>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>

using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  ll cnt[26] = {};
  for (int i = 0; i < n; ++i)
    cnt[s[i] - 'a']++;

  ll ans = 1;
  for (int i = 0; i < 26; ++i)
  {
    ans = ans * (cnt[i] + 1) % MOD;
  }
  ans--;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;



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

    unordered_map<int, bool> existing;

    int n;
    cin >> n;

    for (int i = 1; i <= n; ++i) {
        int x;
        cin >> x;

        existing[x] ^= 1;
    }

    cout << count_if(existing.begin(), existing.end(),
                     [](const auto& iter) {
                        return iter.second == 1;
                       });

    return 0;
}


Measured memory_bytes: 4388
S = list(map(str,input()))

odd = ['R','U','D']
even = ['L','U','D']

for i in range(len(S)):
    if (i+1)%2 == 0:
        if S[i] in 'R':
            print('No')
            exit()
    elif (i+1)%2 == 1:
        if S[i] in 'L':
            print('No')
            exit()
print('Yes')

Measured memory_bytes: 8984
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
  int h,w;
  cin >> h >> w;

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

  bool odd = false;
  vector<pair<int,int>> ans;
  stack<pair<int,int>> st;
  int cnt = 0;
  for(int i = 0;i < h;i++){
    if(i % 2 == 0){
      for(int j = 0;j < w;j++){
        if(odd == true)cnt++;
        st.push(make_pair(j+1,i+1));
        if(grid[i][j] % 2 == 1 && odd == true){
          for(int k = 0;k < cnt;k++){
            pair<int,int> p = st.top();
            ans.push_back(p);
            if(k != 0 && k != cnt - 1)ans.push_back(p);
            st.pop();
          }
          odd = false;
          cnt = 0;
        }
        else if(grid[i][j] % 2 == 1 && odd == false){
          odd = true;
          cnt++;
        }
      }
    }
    else{
      for(int j = w - 1;j >= 0;j--){
        if(odd == true)cnt++;
        st.push(make_pair(j+1,i+1));
        if(grid[i][j] % 2 == 1 && odd == true){
          for(int k = 0;k < cnt;k++){
            pair<int,int> p = st.top();
            ans.push_back(p);
            if(k != 0 && k != cnt - 1)ans.push_back(p);
            st.pop();
          }
          odd = false;
          cnt = 0;
        }
        else if(grid[i][j] % 2 == 1 && odd == false){
          odd = true;
          cnt++;
        }
      }
    }
  }

  cout << ans.size()/2 << endl;
  for(int i = 0;i < ans.size();i+=2){
    printf("%d %d %d %d\n",ans[i].second,ans[i].first,ans[i+1].second,ans[i+1].first);
  }

}

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

#define FOR(i,a,b)  for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      (v).begin(),(v).end()
#define BIT(n)      (1LL<<(n))
#define IN(x,l,r)   ((l)<=(x)&&(x)<=(r))
#define SHOW(x)     cout<<#x<<" = "<<x<<endl
#define SORT(v)     sort(ALL(v))
#define SZ(v)       (ll)(v).size()
#define UNIQ(v)     SORT(v);(v).erase(unique(ALL(v)),(v).end())
#define PERM(c)     for(bool p=1;p;p=next_permutation(ALL(c)))
#define PQ(T)       priority_queue<T,vector<T>,greater<T>>

template<typename T>string join(const vector<T>& v, string d=" ")
{stringstream s;REP(i,SZ(v))s<<d<<v[i];return s.str().substr(d.length());}

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v)
{if(SZ(v))s<<join(v,", ");return s;}

const ll inf = 1e15;
const ll mod = 1e9+7;
const double eps = 1e-10;

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

int main() {
    ll N; cin >> N;
    vector<ll> X(N), Y(N); REP(i, N) cin >> X[i], Y[i] = X[i];
    
    SORT(Y);
    ll m1 = Y[N / 2 - 1];
    ll m2 = Y[N / 2];
    
    REP(i, N) {
        if (X[i] <= m1) cout << m2 << endl; 
        else cout << m1 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 5376
using System;

class Maximum_Profit
{
    public static void Main()
    {
        int maxv, minv;
        int[] r = new int[2];
        int n = int.Parse(Console.ReadLine());

        Array.Resize(ref r, n);

        for (int i = 0; i < n; i++)
        {
            r[i] = int.Parse(Console.ReadLine());
        }

        maxv = r[1]-r[0];
        minv = r[0];

        for (int j = 1; j <= n - 1; j++)
        {
            if (maxv < r[j] - minv) maxv = r[j] - minv;
            if (minv > r[j]) minv = r[j];
        }

        Console.WriteLine(maxv);
    }
}

Measured memory_bytes: 10856
#include<iostream>
#include<algorithm>
using namespace std;
int a[200001]={};
int main(){
	int n,k;
	cin >> n >> k;
	int tmp;
	for(int i=0;i<n;i++){
		cin >> tmp;
		a[tmp]++;
	}
	sort(a,a+200001);
	reverse(a,a+200001);
	int ans=0;
	for(int i=k;a[i]>0;i++){
		ans+=a[i];
	}
	cout << ans << endl;
	return 0;
}


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

public class Main {
	int n;
	int A[];
	boolean res;
	void run() {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		A = new int[n];
		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] m = new int[q];
		for (int i = 0; i < m.length; i++) {
			m[i] = sc.nextInt();
		}
		for(int i = 0; i < q; i++) {
			boolean ans = solve(0, m[i]);
			if(ans) {
				System.out.println("yes");
			}else {
				System.out.println("no");
			}
		}
		
		
		sc.close();
	}
	
	boolean solve(int i, int m) {
		if(m == 0) return true;
		if(i >= n) return false;
		
		res = solve(i+1,m)||solve(i+1, m-A[i]);
		return res;
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

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


Measured memory_bytes: 26884
a = input()
b = input()
c = input()

s = {"a":a, "b":b, "c":c}

turn = "a"
while True:
  if len(s[turn])==0:
    break
  next_turn = s[turn][0]
  s[turn] = s[turn][1:]
  turn = next_turn

if turn=="a":
  print("A")
  exit()
if turn=="b":
  print("B")
  exit()
if turn=="c":
  print("C")
  exit()

Measured memory_bytes: 38256
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N = 0, M = 0;
		N = scan.nextInt();
		M = scan.nextInt();

		int K = 0;
		int[] arr = new int[100000];
		K = scan.nextInt();
		int l = 0;
		for (int i = 0; i < K; i++) {
			arr[i] = scan.nextInt();
		}

		int[][] A = new int[N][M];
		int flag = 1;
		for (int i = 0; i < N; i++) {
			if (flag == 1) {
				for (int j = M - 1; j >= 0; j--) {
					if (arr[l] == 0) {
						l++;
						arr[l]--;
					} else {
						arr[l]--;
					}
					A[i][j] = l + 1;
				}
			} else {
				for (int j = 0; j < M; j++) {
					if (arr[l] == 0) {
						l++;
						arr[l]--;
					} else {
						arr[l]--;
					}
					A[i][j] = l + 1;
				}
			}

			flag *= -1;
		}
		flag = 1;
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < M; j++) {
				System.out.print(A[i][j] + " ");
			}
			System.out.println();
		}

	}

}


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

constexpr int MOD = 1000000007;

using namespace std;

int main()
{
    int n;
    cin >> n;
    if (n < 3)
    {
        cout << 0 << endl;
        return 0;
    }
    vector<int> dp(n + 1);
    dp[0] = 1;
    dp[1] = 0;
    dp[2] = 0;


    for (int i = 3; i < n + 1; i++)
    {
        int s = 0;
        for (int j = 3; j <= i; j++)
            s = (s + dp[i - j]) % MOD;
        dp[i] = s;
    }


    cout << dp[n] << endl;
}

Measured memory_bytes: 3584
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#include <algorithm>
#include <iostream>
 
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define X first
#define Y second
#define pb(x) push_back(x)
#define FOR(k, n) for (int k = 0; k < n; k++)
#define FORN(k, s, n) for (int k = s; k < n; k++)
#define debug(x) printf("x = %d\n", x);
#define debug2(x, y) printf("x = %d, y = %d\n", x, y);
#define debug3(x, y, z) printf("x = %d, y = %d, z = %d\n", x, y, z);
#define debug4(x, y, z, t) printf("x = %d, y = %d, z = %d, t = %d\n", x, y, z, t);
 
#pragma warning(disable : 6031)
#pragma warning(disable : 4101)
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef complex<double> cd;
 
const int INF = 1e9;
const long long LINF = 1e18;
const double PI = acos(-1);
 
// Solution

const int MAXN = 10004;

int n, m, s, k, DP[MAXN], d[] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
set<int, greater<int>> S;

int main() {
    scanf("%d%d", &n, &m);

    for (int i = 0; i < m; i++) {
        scanf("%d", &s);
        S.insert(s);
    }

    for (int i = 1; i <= n; i++) {
        DP[i] = -1;
        for (int v : S) {
            if (d[v - 1] <= i) {
                DP[i] = max(DP[i], DP[i - d[v - 1]] + 1);
            }
        }
    }

    k = n;

    while (k > 0) {
        for (int v : S) {
            if (d[v - 1] <= k && DP[k - d[v - 1]] + 1 == DP[k]) {
                printf("%d", v);
                k -= d[v - 1];
                break;
            }
        }
    }

    printf("\n");

    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

  
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int n,m;
  cin >> n >> m;
  vector<int>a(n);
  rep(i,n) cin >> a[i];
  vector<int>ans(n);
  rep(i,m){
    int x;
    cin >> x;
    ll kyogi=n;
    rep(j,n){
      if(a[j]<=x){
        kyogi=min(kyogi,j);
      }
    }
    ans[kyogi]++;
  }
  cout << max_element(ans.begin(),ans.end())-ans.begin()+1 << endl;
        
}



Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define ALL(x) (x).begin(),(x).end()
typedef long long ll;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

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

  cout << R * 2 * M_PI << endl;

  return 0;
}

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

int main(){
    ll n, t, q;
    vector<ll> v;
    cin >> n;
    for(ll i = 0; i < n; i++){
        cin >> t;
        v.push_back(t);
    }
    cin >> q;
    for(ll i = 0; i < q; i++){
        cin >> t;
        printf("%lld %lld\n", (int) (lower_bound(v.begin(), v.end(), t) - v.begin()), (int) (upper_bound(v.begin(), v.end(), t) - v.begin()));
    }
    return 0;
}



Measured memory_bytes: 3916
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, k;
int a[110];

int dp[100100];

bool calc(int v) {
    if (dp[v] < 0) {
        bool res = false;
        for (int i = 0; i < n; i++) {
            if (a[i] <= v && !calc(v-a[i])) {
                res = true;
                break;
            }
        }
        dp[v] = res;
    }
    return dp[v];
}

bool solve() {
    memset(dp, -1, sizeof(dp));
    dp[0] = false;
    return calc(k);
}

void input() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];
}

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

    input();
    cout << (solve()?"First":"Second") << endl;
}


Measured memory_bytes: 5376
class Solution:

    def solve(self, N: int):

        def dfs(prev_str, num_used_char):
            if len(prev_str) == N:
                print(prev_str)
                return

            for i in range(num_used_char):
                c = chr(ord('a') + i)
                dfs(prev_str + c, num_used_char)

            c = chr(ord('a') + num_used_char)
            dfs(prev_str + c, num_used_char + 1)

        dfs('a', 1)


if __name__ == '__main__':

    # standard input
    N = int(input())
    # solve
    solution = Solution()
    answer = solution.solve(N)


Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;++i)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;

int main(){
  int a,b,k;cin>>a>>b>>k;
  for(int i=0;i<k;i++){
    if(i%2==0){
      b+=(a/2);
      a /= 2;
    }else{
      a += (b/2);
      b /= 2;
    }
  }
  printf("%d %d\n",a,b );
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
	int i;
	for ( i = 1; i <= n; i++ ){
		if ( i > 1 ) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

int main()
{
	int n, i, j, key;
	int A[N+1];
	scanf("%d", &n);
	for (i=1;i<=n;i++) scanf("%d", &A[i]);
	for (j=2;j<=n;j++) {
		trace(A, n);
		key=A[j];
		for (i=j-1;i>0&&A[i]>key;i--) A[i+1]=A[i];
		A[i+1]=key;
	}
	trace(A, n);

	return 0;
}

Measured memory_bytes: 608
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination {
private:
	int m_module = 1000000007;
	vector<struct Memo> memo;
public:
	int calculate(int, int);
	Combination(int, int);
};
int Combination::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination::Combination(int memo_max, int module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

void A_Round_One(void) {

	int A, B;
	cin >> A >> B;

	if		(A != 1 && B != 1)	cout << 1 << flush;
	else if (A != 2 && B != 2)	cout << 2 << flush;
	else						cout << 3 << flush;
}

void B_Strings_with_the_Same_Length(void) {

	int N;
	cin >> N;
	string S, T;
	cin >> S >> T;

	for (int loop = 0; loop < N; loop++) cout << S[loop] << T[loop] << flush;
	return;
}

void C_Snack(void) {

	int A, B;
	cin >> A >> B;

	if (A == 1 || B == 1) {
		cout << A * B << flush;
	}
	else {
		map<int, int> Afact;
		for (int loop = 2; loop * loop <= A; loop++) {
			if (A % loop == 0) {
				A /= loop;
				Afact[loop]++;
				loop--;
				if (A == 1) break;
			}
		}
		if (A > 1) Afact[A]++;
		map<int, int> Bfact;
		for (int loop = 2; loop * loop <= B; loop++) {
			if (B % loop == 0) {
				B /= loop;
				Bfact[loop]++;
				loop--;
				if (B == 1) break;
			}
		}
		if (B > 1) Bfact[B]++;

		map<int, int> LCMfact;
		for (auto it = Afact.begin(); it != Afact.end(); it++) LCMfact[it->first] = it->second;
		for (auto it = Bfact.begin(); it != Bfact.end(); it++) LCMfact[it->first] = max(LCMfact[it->first], it->second);
		
		long long LCM = 1;
		for (auto it = LCMfact.begin(); it != LCMfact.end(); it++) LCM *= (long long)pow(it->first, it->second);
		
		cout << LCM << flush;
	}

	return;
}

void D_Brick_Break(void) {

	int N;
	cin >> N;
	vector<int> A(N);
	for (int& it : A) cin >> it;

	int flag = 0;
	int counter = 0;
	for (int loop = 1; flag < N; loop++) {
		if (A[flag] != loop) {
			loop--;
			counter++;
		}
		flag++;
	}
	cout << ((counter == N) ? -1 : counter) << flush;
	return;
}

void E_Double_Factorial(void) {

	long long N;
	cin >> N;

	if (N % 2 == 0) {
		long long re = 0;
		for (int loop = 0; 10 * (long long)pow(5, loop) <= N; loop++) {
			re += (long long)(N / (10 * (long long)pow(5, loop)));
		}
		cout << re << flush;
	}
	else {
		cout << 0 << flush;
	}
	return;
}

int main(void) {

	//A_Round_One();
	//B_Strings_with_the_Same_Length();
	//C_Snack();
	//D_Brick_Break();
	E_Double_Factorial();
	return 0;
}


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

int main(){
    string s;
    cin>>s;
    int ans = 0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='1'){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
_ = input()
A = [int(a) for a in input().split(" ")]
for i in range(1, len(A)):
  print(" ".join([str(a) for a in A]))
  key = A[i]
  j = i - 1
  while j >= 0 and A[j] > key:
    A[j + 1] = A[j]
    j -= 1
  A[j + 1] = key
print(" ".join([str(a) for a in A]))

Measured memory_bytes: 7736
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <queue>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vstr=vector<string>;

void solve() {
    ll N,D;
    cin >> N >> D;
    vll X(N),Y(N);
    rep(i,N){
        cin >> X[i] >> Y[i];
    }
    ll ans = 0;
    D *= D;
    rep(i,N){
        double d = 1.0 * (X[i]*X[i] + Y[i]*Y[i]);
        if(d <= D) ans++;
    }
    print(ans);
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 6364
#include <iostream>
#include <string>
#include <algorithm>
#include <tuple>
#include <vector>
using namespace std;

int I, P, R;

int W[60][20]; // 不正解数
int C[60]; // 正解数
int T[60]; // 解答時間

int main() {
  while (scanf("%d%d%d", &I, &P, &R) != EOF && I) {
    fill(&W[0][0], &W[0][0]+60*20, 0);
    fill(C, C+60, 0);
    fill(T, T+60, 0);
    for (int i=0; i<R; i++) {
      int team, prob, time;
      string mes;
      cin >> team >> prob >> time >> mes;
      if (mes == "CORRECT") {
	C[team]++;
	T[team] += time + W[team][prob] * 1200;
      } else {
	W[team][prob]++;
      }
    }
    vector<tuple<int, int, int>> V;
    for (int i=1; i<=I; i++) {
      V.push_back(make_tuple(-1 * C[i], T[i], i));
    }
    sort(V.begin(), V.end());
    for (int i=0; i<I; i++) {
      cout << get<2>(V[i]) << " " << -1 * get<0>(V[i]) << " " << get<1>(V[i]) << endl;
    }
  }
}

Measured memory_bytes: 1268
#include<stdio.h>
         
        int main(void)
        {
         int m,m2,n,i;
         int count=0;
         float sum=0;
         int a[2000];
          
         scanf("%d",&n);
         scanf("%d",&m);
          
         for(i=0;i<n;i++)
         {
           scanf("%d",&a[i]);
           sum+=a[i];
         }
          m2=m*4;
          sum=float(sum/m2);
          
           for(i=0;i<n;i++)
         {
           if(a[i]>=sum)
             count+=1;
         }
          if(count>=m)
            printf("Yes");
          else
            printf("No");
          
          return 0;
        }

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Ti = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, m;
  cin >> n >> m;
  cout << (m*1900+(n-m)*100)*(1<<m) << endl;

  return 0;
}


Measured memory_bytes: 256
use std::io;
//use std::collections::HashMap;
//use std::collections::BinaryHeap;
//use std::collections::HashSet;
//use std::mem; // mem::swap(&mut x,&mut y);
use std::cmp; // cmp::max,cmp::min

// Rust memo: https://hackmd.io/i0lQY1OKTDW1t66TECOmiw?both

#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read_charvec() -> Vec<char> {
    read_line().chars().collect()
}

#[allow(dead_code)]
fn read_ints() -> Vec<i64> {
    let s = read_line();
    let split: Vec<&str> = s.split(" ").collect();
    split
        .iter()
        .map(|&x| x.to_string().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_int() -> i64 {
    read_ints()[0]
}

#[allow(dead_code)]
fn reverse(s: &String) -> String {
    s.chars().rev().collect::<String>()
}

#[allow(dead_code)]
fn read_lines(n: i64) -> Vec<String> {
    let mut xs = Vec::new();

    for _i in 0..n {
        xs.push(read_line());
    }

    xs
}

#[allow(dead_code)]
fn read_ints2(n: i64) -> Vec<i64> {
    read_lines(n).iter().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn arange(start: i64, end: i64, step: i64) -> Vec<i64> {
    let mut ret = Vec::new();
    let mut i = start;

    while i < end {
        ret.push(i);
        i += step;
    }

    ret
}

#[allow(dead_code)]
const DXS: [i64; 4] = [0, 0, 1, -1];
#[allow(dead_code)]
const DYS: [i64; 4] = [1, -1, 0, 0];
#[allow(dead_code)]
const INF: i64 = 99999999999;
#[allow(dead_code)]
const N_PRIME: i64 = 1000000007;

////////////////////////////////////////////////

fn f(n: i64) -> i64 {
    if n == 0 {
        return 0;
    } else {
        return n * (n - 1) / 2;
    }
}

fn main() {
    let xs = read_ints();
    let ans = f(xs[0]) + f(xs[1]);

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


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------


int n, m, q;
vector<int> g[100005];
int col[100005];

void dfs(int r, int c)
{
	stack<int> stk;
	stk.push(r);
	col[r] = c;

	while (!stk.empty()) {
		int u = stk.top(); stk.pop();
		for (int i = 0; i < g[u].size(); i++) {
			int v = g[u][i];
			if (col[v] == -1) {
				stk.push(v);
				col[v] = c;
			}
		}

	}
}

void solve()
{
	int c = 0;

	for (int i = 0; i < n; i++) {
		col[i] = -1;
	}

	for (int i = 0; i < n; i++) {
		if (col[i] == -1) {
			dfs(i, ++c);
		}
	}
}


int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int s, t;
		cin >> s >> t;
		g[s].push_back(t);
		g[t].push_back(s);
	}
	solve();
	cin >> q;
	for (int i = 0; i < q; i++) {
		int s, t;
		cin >> s >> t;
		if (col[s] == col[t]) {
			cout << "yes" << endl;
		}
		else {
			cout << "no" << endl;
		}
	}

	return 0;
}

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

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        int ab[] = new int[3];
        ab[0] = a * b;
        ab[1] = a + b;
        ab[2] = a - b;
        
        Arrays.sort(ab);
        
        System.out.println(ab[2]);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
#define MOD 1000000007

using namespace std;
int N;
unsigned long long P;

int main(void){
	//IO("test.in", "test.out");
	scanf("%d", &N);
	P = 1;
	for(int i = 1; i <= N; i++)
		P = (P * i) % MOD;
	printf("%llu\n", P);
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)
var buff []byte

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

func nextFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextInts(n int) (r []int) {
	r = make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt64

func maxInt(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func minInt(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buff, bufio.MaxScanTokenSize*1024)
	log.SetFlags(log.Lshortfile)
}

func main() {
	s := nextString()
	ans := s[:3]
	fmt.Println(string(ans))
}


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

int main() {
        int K;
        string S;

        cin >> S >> K;

        for(int i=0; i<K; i++){
                if(S[i]!='1'){
                        cout << S[i] <<endl;
                        return 0;
                }
        }
        cout << 1 <<endl;
        return 0;
}

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

int getmd(int a,int b,int c,int d){
    return abs(a-c)+abs(b-d);
}

int main(){
    int a[5],k;
    rep(i,5)    cin >> a[i];
    cin >> k;
    rep(i,5){
        rep(j,5){
            if(abs(a[i]-a[j])>k){
                puts(":(");
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;
vector<int> fact;
vector<int> ifact;
vector<int> inv;
vector<int> pow2;
const int MOD = 998244353;
int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}
int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}
int modpow(int a, int b)
{
	int r=1;
	while(b)
	{
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}
int choose(int a, int b)
{
	if(a<b) return 0;
	if(b==0) return 1;
	if(a==b) return 1;
	return mult(fact[a],mult(ifact[b],ifact[a-b]));
}
int inverse(int a)
{
	return modpow(a,MOD-2);
}
void init(int _n)
{
	fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
	fact.resize(_n+1);
	ifact.resize(_n+1);
	inv.resize(_n+1);
	pow2.resize(_n+1);
	pow2[0]=1;
	ifact[0]=1;
	fact[0]=1;
	for(int i=1;i<=_n;i++)
	{
		pow2[i]=add(pow2[i-1],pow2[i-1]);
		fact[i]=mult(fact[i-1],i);
		//ifact[i]=mult(ifact[i-1],inv[i]);
	}
	ifact[_n] = inverse(fact[_n]);
	for(int i=_n-1;i>=1;i--)
	{
		ifact[i] = mult(ifact[i + 1], i + 1);
	}
	for(int i=1;i<=_n;i++)
	{
		inv[i] = mult(fact[i-1],ifact[i]);
	}
}

int cnt[333333];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	int mx=0;
	for(int i=0;i<n;i++)
	{
		int x; cin>>x;
		if(i==0&&x!=0){cout<<0<<'\n'; return 0;}
		 cnt[x]++; mx=max(mx,x);
	}
	if(cnt[0]!=1)
	{
		cout<<0<<'\n'; return 0;
	}
	int ans=1;
	for(int i=1;i<=mx;i++)
	{
		if(cnt[i]==0){cout<<0<<'\n'; return 0;}
		ans=mult(ans,modpow(cnt[i-1],cnt[i]));
	}
	cout<<ans<<'\n';
}	


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define int ll

int n,m;
int a[1000000];
int l[1000000];
int ans;


signed main(){
  cin>>n>>m;
  rep(i,m){
    cin>>a[i];
  }

  if(n>=m){
    cout<<0<<endl;
    return 0;
  }

  sort(a,a+m);
  ans = a[m-1]-a[0];
  rep(i,m-1){
    l[i] = a[i+1]-a[i];
  }
  sort(l,l+m-1);
  rep(i,n){
    ans-=l[m-1-i];
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 5120
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n;
	cin>>n;
	vector<int> bf(n);
	vector<int> af(n);
	map<int ,int> odd;
	map<int ,int> odd2;
	FOR(i,0,n){
		cin>>bf[i];
		af[i]=bf[i];
		if(i%2==1){
			odd[bf[i]]++;
		}
	}
	sort(af.begin(),af.end());
	FOR(i,0,n){
		if(i%2==1){
			odd[af[i]]--;
		}
	}
	int ans=0;
	for(auto x:odd){
		if(x.ND>0){
			ans+=x.ND;
		}
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5760