akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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


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

    int s = 0;
    rep(i,1,c+1)s += i;
    P(s - b);
    return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
#define skip continue
#define NAME "code"
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
void faster(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
 
const int MAXN = 2e5 + 1;
const ll INF = 1e18;
const ld pi = acos(-1);
const int dx[4] = {-1, -1, 1, 1};
const int dy[4] = {-1, 1, -1, 1};

ll n, ans;
string s;

int main(){
 
    faster();
 
    cin >> s;

    n = s.size();

    ll cnt = 1, k = 0;

    for(int i = 0; i + 1 < n; ++i){

        if(s[i] == s[i + 1]){
            cnt++;
        }
        else{ 
            if(s[i] == '>'){
                ans += max(k, cnt);
            }
            k = cnt;
            ans += ((cnt - 1) * cnt / 2);
            cnt = 1;
        }
    }

    ans += ((cnt - 1) * cnt / 2);
    if(s.back() == '<'){
        k = cnt;
        cnt = 0;
    }
    ans += max(k, cnt);
    cout << ans;

    return 0;
}


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

signed main(){

  int n;
  cin>>n;

  vector<vector<unsigned long>> a(1<<n);

  for(int b=0;b<(1<<n);++b){
    bitset<20> bit(b);
    a[b].resize(bit.count()+1);
    a[b][0] = bit.to_ulong();
    int idx = 1;
    for(int i=0;i<n;++i){
      if(bit[i])a[b][idx++]=i;
    }
  }
  sort(a.begin(),a.end(),[](auto& a,auto& b){return a[0]<b[0];});

  for(auto v:a){
    cout<<v[0]<<":";
    for(int i=1;i<v.size();++i){
      cout<<" "<<v[i];
    }
    cout<<endl;
  }

}


Measured memory_bytes: 32268
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.BitSet;

public class Main {
	private static final int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] L = new int[M];
		int[] R = new int[M];
		sc.fill(L, R);

		BitSet set = new BitSet(N);
		set.flip(0, N);
		BitSet tmp = new BitSet(N);
		for (int i = 0; i < M; i++) {
			tmp.clear();
			tmp.set(L[i] - 1, R[i]);
			set.and(tmp);
		}

		System.out.println(set.cardinality());
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public char nextChar() throws IOException {
			return (char) skip();
		}

		public int nextInt() throws IOException {
			int num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}

Measured memory_bytes: 22740
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;

int main(){
	int n; cin >> n;
	set<string> s;
	while(n--){
		string str; cin >> str;
		s.insert(str);
	}
	cout << s.size() << endl;
	return 0;
}

Measured memory_bytes: 19224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,m;
  cin >> n >> m;
  cout << (n-1)*(m-1) << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


const int INF = 1 << 20;

int main()
{
    int n, p;
	cin >> n;
	
	vector<vint> G(n, vint(n, INF));
	
	rep(i, n)
	{
		int r1, k1;
		
		cin >> r1 >> k1;
		
		rep(j, k1)
		{
			int buf;
			cin >> buf;
	
			G[r1 - 1][buf - 1] = 1;
		}
	}
	
	
	rep(k, n) rep(i, n) rep(j, n)
		chmin(G[i][j], G[i][k] + G[k][j]);
	
	
	cin >> p;
	
	rep(i, p)
	{
		int s1, d1, v1;
		cin >> s1 >> d1 >> v1;
		
		int cost = G[s1 - 1][d1 - 1];
		
		if(cost == INF || v1 <= cost)
		{
			cout << "NA" << endl;
		}
		else
		{
			cout << cost + 1 << endl;
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int main() {
    int na, nb, m;
    cin >> na >> nb >> m;
    vector<int> a(na), b(nb);
    for (int i = 0; i < na; ++i) cin >> a[i];
    for (int i = 0; i < nb; ++i) cin >> b[i];
    int ans = *min_element(begin(a), end(a)) + *min_element(begin(b), end(b));
    for (int i = 0; i < m; ++i) {
        int x, y, c;
        cin >> x >> y >> c;
        ans = min(ans, a[x - 1] + b[y - 1] - c);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int a [10010];
    int n , m ;
    scanf ( "%d%d" ,& n ,& m );
    for ( int i =0; i < m ; i ++) scanf ( "%d" ,& a [ i ]);
    int s =0;
    for ( int i =0; i < m ; i ++) s += a [ i ];
    if ( s > n ){
    printf ( "-1\n" );
    } else {
    printf ( "%d\n" , n - s );
    }
	return 0;
}


Measured memory_bytes: 3824
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  string s;
  int a,k,i;
  cin >> s >> k;
  for(i=0;i<s.length();i++){
    if(s.at(i)!='1')break;
  }
  if(k-1<i){
    cout << s.at(k-1) << endl;
  }else{
    cout << s.at(i) << endl;
  }
}

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

int N,K;
vector<int> d;
vector<vector<int>> A;

int main(){
    cin>>N>>K;
    d.resize(K);
    A.resize(K,vector<int>());
    for(int i=0;i<K;i++){
        cin>>d[i];
        A[i].resize(d[i]);
        for(int j=0;j<d[i];j++){
            cin>>A[i][j];
        }
    }
    int count=0;
    for(int i=1;i<=N;i++){
        bool have=false;
        for(auto v:A){
            for(auto p:v){
                if(p==i)have=true;
            }
        }
        if(!have)count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3680
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

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

int main(){
    ll a,b,n;
    cin >> a >> b >> n;

    ll x = min(b-1,n);
   
    P(a*x/b);
    
    return  0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
#define abs(a) ((a) < 0 ? - (a) : (a))
using namespace std;
int main() {
  int n;
  cin >> n;
  
  vector<long long int> a, b;
  for (int i = 1; i <= n + 1 ; i++) {
    long long int ai;
    cin >> ai;
    a.push_back(ai);
  }
  for (int i = 1; i <= n; i++) {
    long long int bi;
    cin >> bi;
    b.push_back(bi);
  }
  
  long long int count = 0;
  for (int i = 0; i < b.size(); i++) {
    if (a[i] >= b[i]) {
      count += b[i];
      continue;
    }
    else {
      count += a[i];
      b[i] -= a[i];
      if (a[i+1] >= b[i]) {
        count += b[i];
        a[i+1] -= b[i];
        continue;
      }
      else {
        count += a[i+1];
        a[i+1] = 0;
      }
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 2676
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
string s;
ll n;
string sub_string(int i,int j){
	string t;
	for(int k=0;k<i;k++)t+=s[k];
	for(int k=j+1;k<n;k++)t+=s[k];
	return t;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>s;n=s.size();
	if(n<7){
		cout<<"NO";
		return 0;
	}
	if(s=="keyence"){
		cout<<"YES";
		return 0;
	}
	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			if(sub_string(i,j)=="keyence"){
				cout<<"YES";
				return 0;
			}
		}
	}
	cout<<"NO";
	return 0;
}


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

int main(){
    while (true){

        int n;
        cin>>n;
        if (n==0) break;
        vector<int> v(n,0);
        int sum=0;
        rep(i,n) {
            cin>>v[i];
            sum+=v[i];
        }
        sort(v.begin(),v.end());
        cout<<(sum-v[0]-v[n-1])/(n-2)<<endl;

    }
    return  0;
}


Measured memory_bytes: 3112
#include <bits//stdc++.h>
using namespace std;
#define rep(i,n,k) for(int i=n;i<k;i++)
#define int long long 
signed main(void){
    int n,m,ans,p,q;
    ans=0;
    cin>>n;
    cout<<n*n<<endl;
    
}


Measured memory_bytes: 256
/******************************************
* AUTHOR : DHRUV GUPTA *
* NICK : COSMOGOD *
* INSTITUTION : LNMIIT *
******************************************/

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1000000007

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

	int n,k;
	cin >> n >> k;
	int a[n];
	for(int i=0;i<n;i++)
		cin >> a[i];

	bool dp[k+1];
	memset(dp,false,sizeof(dp));
	for(int i=1;i<=k;i++){
		for(int j=0;j<n;j++){
			if(i>=a[j] && !dp[i-a[j]]){
				dp[i] = true;
			}
		}
	}

	if(dp[k]==true)
		cout << "First";
	else
		cout << "Second";

	return 0;
}

Measured memory_bytes: 384
def answercount(n , s):

    not10min = 101
    for i in range(n):
        if int(s[i]) % 10 != 0:
            not10min = min(not10min , s[i])

    if not10min == 101:
        return 0

    if int(sum(s)) % 10 == 0:
        return (int(sum(s)) - not10min)

    return int(sum(s))

def main():
    n = int(input())
    s = [int(input()) for i in range(n)]
    print(answercount(n , s))

if __name__ == '__main__':
    main()


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

int solve(int p, int q, int r){
    return min({p+q, p+r, q+r});
}

int main(){
    int p,q,r;
    cin>>p>>q>>r;
    cout<<solve(p,q,r)<<"\n";

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int gcd(int x, int y){
    if(y==0)return x;
  return gcd(y, x%y);
}
 
int main(){
  int x, y;
  cin >> x >> y;
  int g=gcd(x,y);
  cout << (x+1)+(y+1)-(g+1) << endl;
  return 0;
}


Measured memory_bytes: 3108
n = int(input())
abc_list = []
for i in range(3):
    abc_list.append(input())
ans = 0
diff = 0

for i in range(n):
    if abc_list[0][i] != abc_list[1][i]:
        diff += 1
    if abc_list[0][i] != abc_list[2][i]:
        diff += 1

    if diff == 0:
        pass
    elif diff == 1:
        ans += 1
    elif diff == 2 and abc_list[1][i] == abc_list[2][i]:
        ans += 1
    else:
        ans += 2
    diff = 0

print(ans)

Measured memory_bytes: 3064
import random
import sys

n, m = map(int, input().split())
# n, m = 200000, 200000
group = {i: 0 for i in range(1, n+1)}
edge = {}
g_mem = {}
g_num = 0
g_con = set()

for i in range(m):
    a, b = map(int, input().split())
    # a, b = random.sample(range(1,n+1), 2)
    if group[a]==0 and group[b] == 0:
        g_num += 1
        group[a] = g_num
        group[b] = g_num
        g_mem[g_num] = 2
    elif group[a] == 0:
        group[a] = group[b]
        g_mem[group[b]] += 1
    elif group[b] == 0:
        group[b] = group[a]
        g_mem[group[a]] += 1
    elif group[a] != group[b]:
        if edge.get(group[a]):
            edge[group[a]].add(group[b])
        else:
            edge[group[a]] = {group[b]}
        if edge.get(group[b]):
            edge[group[b]].add(group[a])
        else:
            edge[group[b]] = {group[a]}

# print(g_mem)
# print(sum(g_mem.values()))
# print(edge)

g_reached = {i: 0 for i in range(1, g_num+1)}
ans = list(g_mem.values())
for now in range(1, g_num+1):
    if g_reached[now] == 0:
        g_reached[now] = 1
        if edge.get(now):
            count = g_mem[now]
            queue = set(edge[now])
            while len(queue) > 0:
                next_now = queue.pop()
                if g_reached[next_now] == 0:
                    g_reached[next_now] = 1
                    count += g_mem[next_now]
                    queue |= edge[next_now]
                queue -= {now}
                now = next_now
            ans.append(count)


# print(ans)
if len(ans) > 0:
    print(max(ans))
else:
    print(1)


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

char a[252521];
int cnt[26];

int main(){
  scanf("%s",a);
  int n = strlen(a);
  ll ans = (ll)n * (n+1) / 2;
  ans++;
  REP(i,n){
    cnt[a[i]-'a']++;
    ans -= cnt[a[i]-'a'];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;

int main(){
  int n, k;
  cin >> n >> k;
  if(n%2==1){
    if(n/2+1>=k)puts("YES");
    else puts("NO");
  }
  else{
    if(n/2>=k)puts("YES");
    else puts("NO");
  }

  return 0;
}


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

#include <atcoder/all>

using namespace std;
using namespace atcoder;

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define per(i, b) per2(i, 0, b)
#define per2(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define ALL(c) (c).begin(), (c).end()
#define SZ(x) ((int)(x).size())

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    rep(i, n) cout << "ACL";
    cout << endl;
    return 0;
}

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

int main() {
  int K;
    cin >> K;
   string S;
  cin >> S;
  int judge;
  judge = S.size();
  if (judge <= K){
    cout << S << endl;
  }
  else{
    for (int i = 0; i < K; i++){
      cout << S.at(i);
    }
    cout << "..." << endl;
  }
}

Measured memory_bytes: 3632
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    s = 0
    m = inf
    for _ in range(n):
        a,b = LI()
        if a > b and m > b:
            m = b
        s += a

    if m == inf:
        return 0
    return s - m


print(main())




Measured memory_bytes: 7748
#include <iostream>
#include <algorithm>
using namespace std;
typedef pair<int, int> P;
int main(void){
    int n, x, y, m=50;
    P z[50];
    bool u[50];
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> x >> y;
        z[i] = P(x, y);
    }
    if(n == 1){
        cout << 1 << endl;
        return 0;
    }
    sort(z, z+n);
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j != i){
                int p = z[i].first - z[j].first;
                int q = z[i].second - z[j].second;
                int r = 1, a, b;
                for(int k=0;k<n;k++){
                    u[k] = false;
                }
                u[i] = u[j] = true;
                a = z[i].first;
                b = z[i].second;
                for(int k=0;k<n-2;k++){
                    bool f = false;
                    for(int l=0;l<n;l++){
                        if(!u[l]){
                            x = z[l].first;
                            y = z[l].second;
                            if(x-a == p && y-b == q){
                                a = x;
                                b = y;
                                f = true;
                                u[l] = true;
                                break;
                            }
                        }
                    }
                    if(f)continue;
                    r++;
                    for(int l=0;l<n;l++){
                        if(!u[l]){
                            a = z[l].first;
                            b = z[l].second;
                            u[l] = true;
                            break;
                        }
                    }
                }
                m = min(m, r);
            }
        }
    }
    cout << m << endl;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn main() {
    input! {
        X: i64,
    }

    let mut money = X;

    let mut happiness: i64 = 0;
    let fh_coins = money / 500;
    money -= 500 * fh_coins;
    happiness += 1000 * fh_coins;

    let fv_coins = money / 5;
    // money -= 5 * fv_coins;
    happiness += 5 * fv_coins;

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


Measured memory_bytes: 2096
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 MAX = 1000000;
  vector<i64> primes = {2};
  vector<bool> is_prime(MAX / 2 + 1, true); // is_prime[i] = true if i * 2 + 1 is prime
  is_prime[0] = false;
  int i, j, k;
  REP(1, MAX/2+1, i) {
    if(is_prime[i]) {
      int p = i * 2 + 1;
      primes.pb(p);
      int q = p * 3;
      while(q <= MAX) {
	is_prime[(q-1) / 2] = false;
	q += p * 2;
      }
    }
  }

  i64 M = sz(primes);
  i64 N;
  cin >> N;
  vector<unordered_map<int,int>> factors(N);
  REP(0, N, i) {
    int A;
    //cin >> A;
    scanf("%d", &A);
    if(binary_search(all(primes), A)) {
      auto lb = lower_bound(all(primes), A);
      factors[i][lb-primes.begin()] = 1;
    }
    else {
      REP(0, M, j) {
	i64 ct = 0;
	if(A < primes[j])
	  break;
	while(A % primes[j] == 0) {
	  A /= primes[j];
	  ++ct;
	}
	if(ct > 0)
	  factors[i][j] = ct;
      }
    }
  }

  vector<int> lcm(M, 0);
  REP(0, N, i) {
    for(auto p: factors[i]) {
      i64 j = p.first;
      int ct = p.second;
      lcm[j] = max(lcm[j], ct);
    }
  }

  i64 ans = 0, NUM = 1000000007;
  i64 lcm_num = 1;
  REP(0, M, i) {
    REP(0, lcm[i], j) {
      lcm_num *= primes[i];
      lcm_num %= NUM;
    }
  }

  vector<i64> inv_primes(M, 1);
  {
    REP(0, M, i) {
      i64 P = NUM - 2;
      i64 p = primes[i];
      while(P != 0) {
	if(P % 2 == 1) {
	  inv_primes[i] *= p;
	  inv_primes[i] %= NUM;
	}
	p = p * p;
	p %= NUM;
	P /= 2;
      }
    }
  }

  REP(0, N, i) {
    i64 b = lcm_num;
    for(auto p: factors[i]) {
      i64 j = p.first;
      i64 ct = p.second;
      REP(0, ct, k) {
	b *= inv_primes[j];
	b %= NUM;
      }
    }
    ans += b;
    ans %= NUM;
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 4856
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

void printAns(int a) { cout << a << endl; }

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

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

ll INF = 10000000;
ll mod = 1000000007;//10^9+7


//番号ズレ注意！！
int main() {
    int N, H[110];
    cin >> N;
    int ans = 0;
    REP(i, N) {
        cin >> H[i];
        bool can = true;
        REP(j, i ) {
            if (H[j] > H[i]) {
                can = false;
                break;
            }
        }
        if (can)ans++;
    }
    printAns(ans);

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x;
    cin >> x;
    f(i,-200,200){
        f(j,-200,200){
            int a = pow(i,5);
            int b = pow(j,5);
            // cout << a << " " << b << "\n";
            if(a < b){
                continue;
            }
            if(a - b == x){
                cout << i << " " << j;
                return 0;
            }
        }
    }
    return 0;
}
 


Measured memory_bytes: 4076
#include <iostream>

using namespace std;

typedef long long ll;

ll par[100010];
ll sz[100010];

void init(ll n) {
    for (ll i = 0; i < n; i++) {
        par[i] = i;
        sz[i] = 0;
    }
}

ll find(ll x) {
    if (par[x] == x)
        return x;
    else 
        return par[x] = find(par[x]);
}

void unite(ll x, ll y) {
    x = find(x);    y = find(y);

    if (x == y)
        return ;
    else if (sz[x] < sz[y])
        par[x] =  y;    
    else {
        par[y] = x;
        if (sz[x] == sz[y]) 
            sz[x]++;
    }
}

ll same(ll x, ll y) {
    return find(x) == find(y);
}

int main() {
    ll N, M;    cin >> N >> M;
    ll *p = new ll[N];
    for (ll i = 0; i < N; i++)
        cin >> p[i];

    init(N);

    for (ll i = 0; i < M; i++) {
        ll x, y;    cin >> x >> y;
        unite(x-1, y-1);
    }

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        if (same(p[i]-1, i))
            ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
  int l;
  char S[1001];
  scanf("%s",S);
  l=strlen(S);
  printf("%s",S);
  if(strncmp("s",&S[l-1],1)==0) printf("es");
  else printf("s");
  return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); ++i)
#define rep2(i, n) for(ll i = 1; i <= ll(n); ++i)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); ++i)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); ++i)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll a, b, c;
  cin >> a >> b >> c;
  
  cout << ((a-c)*(c-b)>=0 ? "Yes" : "No") << newl;
  return 0;
}


Measured memory_bytes: 256
// This file is a "Hello, world!" in Java language by OpenJDK for wandbox.

import java.util.*;

class Main
{
    public static void main(String[] args) 
    {
        Scanner sc = new Scanner(System.in);
        int n=Integer.parseInt(sc.next());
        ArrayList<Integer> v = new ArrayList<>(n);
        for (int i=0;i<n;i++){
            v.add(Integer.parseInt(sc.next()));
            //v[i]=scan.nextInt();
        }
        ArrayList<Integer> w = new ArrayList<>(v);
        Collections.sort(v);        
        int med1=v.get(n/2);
        int med2=v.get(n/2-1);
        for(int i=0;i<n;i++){
            if (w.get(i)<med1){
                System.out.println(med1);
            }else{
                System.out.println(med2);
            }
        }
    }
}

// OpenJDK reference:
//   http://openjdk.java.net/

// Java language references:
//   http://docs.oracle.com/javase


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

typedef long long ll;
#define MAXN 200010
#define X first
#define Y second

ll a[100];

int main()
{
	//freopen("in.in", "r", stdin);
	//freopen("out.out", "w", stdout);
	
	ll K; int N;
	cin >> K;
	if (K == 0)
	{
		printf("2\n1 1\n");
		return 0;
	}
	if (K == 1)
	{
		printf("3\n1 0 3\n");
		return 0;
	}
	if (K <= 50)
	{
		N = K;
		printf("%d\n", N);
		for (int i = 1; i <= N; ++i)
		printf("%lld%c", K, i == N ? '\n':' ');
		return 0;
	}
	
	N = 50;
	int t = K % 50;  K -= t;
	for (int i = 1; i <= 50; ++i)
	 	a[i] = K / N - 1 + N;
	for (int i = 1; i <= t; ++i)
	{
		a[i] += N;
		for (int j = 1; j <= N; ++j)
		{
			if (j == i) continue;
			else a[j]--;
		}
	}
	printf("%d\n", N);
	for (int i = 1; i <= N; ++i)
		printf("%lld%c", a[i], i == N ? '\n':' ');
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll a,b;
int main(){FAST;
cin>>a>>b;
cout<<max({a+b,a-b,a*b});
return 0;
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define X first
#define Y second

using namespace std;
typedef long long llint;

const int maxn = 2e5+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 18;
const int off = 1 << logo;
const int treesiz = off << 1;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	
	if (a + b + c > 21) cout << "bust";
	else cout << "win";
	return 0;
}



Measured memory_bytes: 3608
//#pragma GCC optimize(2)
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cassert>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<bitset>
#define heap priority_queue<int,vector<int>,greater<int> >
#define _heap priority_queue<int,vector<int>,less<int> >
#define _for(a,b,c) for((a)=(b);(a)<=(c);++(a))
#define __for(a,b,c) for((a)=b;(a)>=(c);--(a))
#define _init(a,b) memset((a),(b),sizeof (a))
#define LL long long
#define mod 1e9+7
#define INF 0x3f3f3f3f
using namespace std;

namespace FastIO {
	template<typename tp> inline void read(tp &x) {
		x=0; register char c=getchar(); register bool f=0;
		for(;c<'0'||c>'9';f|=(c=='-'),c = getchar());
		for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0',c = getchar());
		if(f) x=-x;
	}
	template<typename tp> inline void write(tp x) {
		if (x==0) return (void) (putchar('0'));
		if (x<0) putchar('-'),x=-x;
		int pr[20]; register int cnt=0;
		for (;x;x/=10) pr[++cnt]=x%10;
		while (cnt) putchar(pr[cnt--]+'0');
	}
	template<typename tp> inline void writeln(tp x) {
		write(x);
		putchar('\n');
	}
}
using namespace FastIO;

//------------Coding Area------------
const int N=2e5+1;
int n,i;
LL d[N];
map<LL,LL> q;
int main(){
	read(n);
	LL ans=0;
	q[0]++;
	LL cache;
	_for(i,1,n) read(d[i]),q[d[i]+=d[i-1]]++;
	for(auto i=q.begin();i!=q.end();i++) if((*i).second==1) continue;
	else {
		cache=(*i).second;
		ans+=(cache*cache-cache)>>1;
	}
	writeln(ans);
}

Measured memory_bytes: 14336
import sys,math,copy
input = sys.stdin.readline

N=int(input().strip())
An=[int(x) for x in input().strip().split()]
Bn=[-1 for _ in range(N)]
Sum=0
for i in range(N-1,-1,-1):
    temp=0
    index=(i+1)*2
    while index <= N:
        temp=temp^Bn[index-1]
        index+=(i+1)

    ball= An[i] ^ temp
    Sum+=ball
    Bn[i]= ball

print(Sum)
if Sum!=0:
    ans=[str(x+1) for x in range(N) if Bn[x]==1]
    print(' '.join(ans))

Measured memory_bytes: 18104
/*
  AOJ 0142
  Title:Nature of Prime Numbers
  @kankichi573
*/
#include <stdio.h>
#include <string.h>

int n;
int sqr_cnt;
int sqr_table[10000];
int diff_table[5000];
void register1(int n)
{
  int i;
  for(i=0;i<sqr_cnt;i++)
    if(n == sqr_table[i])
      return;
  sqr_table[sqr_cnt]=n;
  sqr_cnt++;
  //printf("rg=%d\n",n);
}

all_diff()
{
  int i,j,d;

  for(i=0;i<sqr_cnt;i++)
    for(j=0;j<sqr_cnt;j++)
      {
	if(i==j)
	  continue;

	d=sqr_table[i]-sqr_table[j];
	//printf("d0=%d:",d);
	if(d<0)
	  d += n;
	//printf("d1=%d:",d);
	if(d > (n-1)/2)
	  d = n -d;
	//printf("d=%d\n",d);
	diff_table[d]++;
      }
}
clear()
{
  memset(sqr_table,0,10000*sizeof(int));
  memset(diff_table,0,10000*sizeof(int));
}
display()
{
  int i;
  for(i=1;i<=(n-1)/2;i++)
    printf("%d\n",diff_table[i]);
}
main()
{
  int i,w;

  while(scanf("%d",&n) && n)
    {
      sqr_cnt=0;
      clear();
      for(i=1;i<=n-1;i++)
	{
	  w = (i*i) % n;
	  register1(w);
	}
      //printf("cnt=%d\n",sqr_cnt);
      all_diff();
      display();
    }
  return(0);
}

Measured memory_bytes: 664
s = 3
arr =[]
for _ in range(s):
        arr.append(list(map(int, input().rstrip().split())))
#print(arr)
 
check = [[0,0,0],[0,0,0],[0,0,0]]
#print(check)
 
#check データ
N = int(input())
#print(N)
 
for i in range(N):
    data = int(input())
    for k in range(3):
        for j in range(3):
            if data == arr[j][k]:
                check[j][k]= 1
#print(check)
 
#chek ビンゴ
answer = "No"
for k in range(3):
    if check[k][0] == 1 and check[k][1]== 1 and check[k][2] == 1:
        answer = "Yes"
 
for j in range(3):
    if check[0][j] == 1 and check[1][j] == 1 and check[2][j] == 1:
        answer = "Yes"
 
if check[0][0] == 1 and check[1][1] == 1 and check[2][2] == 1:
    answer = "Yes"
 
if check[0][2] == 1 and check[1][1] == 1 and check[2][0] == 1:
    answer = "Yes"
 
 
print(answer)


Measured memory_bytes: 3192
#include<iostream>
#include<string>
using namespace std;
int main() {
	int W, H, a, b, c;
	cin >> W >> H >> a >> b >> c;
	if (a >= c && a <= (W - c) && b >= c && b <= (H - c)) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
		
}




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

int main(){
  long N,K;cin>>N>>K;
  vector<long> A(N);
  for(int i=0;i<N;i++) cin>>A.at(i);
  sort(A.begin(),A.end());
  long left=1;
  long right=A.at(N-1);
  while(left<right){
    long X=(left+right)/2;
    long ans=0;
    for(int i=0;i<N;i++){
      ans+=A.at(i)/X;
      if(A.at(i)%X==0) ans--;
    }
    if(ans>K) left=X+1;
    else right=X;
  }
  cout<<right<<endl;
}


Measured memory_bytes: 4740
// https://atcoder.jp/contests/dp/tasks/dp_w

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define ITR(c,it)  for(auto it = c.begin(); it != c.end(); it++)

//------------------------------------------------------------------------------
#define LC(k)   (k * 2 + 1)
#define RC(k)   (k * 2 + 2)
#define M(l,r)  ((l + r) / 2)

template<typename T> class SegTree2 {
public:
  int n;
  int sz;
  T def;
  vector<T> sm;
  vector<T> sx;

  void init(int _n, T _def) {
    n = _n;
    def = _def;
    sz = 1; while (sz < n) sz <<= 1;
    sz = sz * 2 - 1;
    sm.resize(sz, 0);
    sx.resize(sz, 0);
  }

  void add(int a, int b, T x, int k, int l, int r) {
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      sm[k] += x;
      sx[k] += x;
      return;
    }
    add(a, b, x, LC(k), l, M(l, r));
    add(a, b, x, RC(k), M(l, r), r);
    sx[k] = sm[k] + max(sx[LC(k)], sx[RC(k)]);
  }

  void add(int a, int b, T x) {
    add(a, b, x, 0, 0, n);
  }

  T query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return def;
    if (a <= l && r <= b) return sx[k];
    T vl = query(a, b, LC(k), l, M(l, r));
    T vr = query(a, b, RC(k), M(l, r), r);
    return sm[k] + max(vl, vr);
  }

  T query(int a, int b) {
    return query(a, b, 0, 0, n);
  }

  void dump() {
    REP(i, sz) printf("%d%c", sm[i], i + 1 == sz ? '\n' : ' ');
    REP(i, sz) printf("%d%c", sx[i], i + 1 == sz ? '\n' : ' ');
  }
};

//------------------------------------------------------------------------------
const int N_MAX = 2*1e5;
const int M_MAX = 2*1e5;
const int A_I_MAX = 1e9;
const ll INF = 1e18;

int N, M;
int l[M_MAX];
int r[M_MAX];
int a[M_MAX];

SegTree2<ll> st;
vector<int> add[N_MAX + 1];
vector<pair<int, int>> del[N_MAX + 1];

void solve() {
  REP(i, M) {
    add[l[i]].push_back(a[i]);
    del[r[i]].push_back({l[i], a[i]});
  }
  st.init(N + 1, -INF);
  ll ans = 0;
  FOR(i, 1, N) {
    ITR(add[i], it) st.add(0, i, *it);
    ll dp = st.query(0, i);
    ans = max(ans, dp);
    st.add(i, i + 1, dp);
    ITR(del[i], it) st.add(0, it->first, -it->second);
  }
  printf("%lld\n", ans);
}

void input() {
  scanf("%d%d", &N, &M);
  REP(i, M) scanf("%d%d%d", l + i, r + i, a + i);
}

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


Measured memory_bytes: 32640
import java.util.*;

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

    int a = sc.nextInt();
    int b = sc.nextInt();
    String s = "";
    if (a >= 13) s = Integer.toString(b);
    else if (6 <= a && a <= 12) s = Integer.toString(b/2);
    else s = "0";
    System.out.println(s);
  }
}


Measured memory_bytes: 22608
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
n = input()
s = raw_input()

m = n
left = s[:0].count('#')
right = s[0:].count('.')
m = min(m, left + right)
for i in range(len(s)):
    if s[i] == '.':
        right -= 1
    else:
        left += 1
    m = min(m, right + left)
print m


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

using namespace std;

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

  int n;
  uint64_t k;
  cin >> n >> k;
  vector<pair<int, int>> ins(n);
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    ins[i] = make_pair(a, b);
  }
  sort(ins.begin(), ins.end(),
       [](const pair<int, int> &l, const pair<int, int> &r) {
         return l.first < r.first;
       });

  for (int i = 0; i < n; ++i) {
    if (k <= (uint64_t)ins[i].second) {
      cout << ins[i].first << "\n";
      break;
    }
    k -= ins[i].second;
  }
}


Measured memory_bytes: 1024
n = int(input())
L = list(map(int,input().split()))
dp = [0]*n
if n%2 == 0:
  for i in range(n//2):
    if L[n-i-1] == 1:
      dp[n-i-1] += 1
  for i in range(n//2,0,-1):
    cur = 0
    for j in range(n//i):
      cur += dp[i*(j+1)-1]
    if cur%2 != L[i-1]%2:
      dp[i-1] += 1
else:
  for i in range(n//2+1):
    if L[n-i-1] == 1:
      dp[n-i-1] += 1
  for i in range(n//2,0,-1):
    cur = 0
    for j in range(n//i):
      cur += dp[i*(j+1)-1]
    if cur%2 != L[i-1]%2:
      dp[i-1] += 1
if sum(dp) == 0:
  print(0)
else:
  T = []
  for i in range(n):
    if dp[i] == 1:
      T.append(i+1)
  print(len(T))
  print(' '.join(map(str, T)))

Measured memory_bytes: 19892
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define fo(i,n) for(int i=1;i<=n;i++)
#define fo1(i,n) for(int i=0;i<n;i++)
#define lli long long int
#define llu unsigned long long int
#define vi vector <int>
#define vii vector <long long int>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define mk make_pair
#define mpp map<int,int>
#define ff first
#define ss second
#define mod 1000000007

using namespace std;

int main() 
{ 
	int t=1;
	//cin>>t;
	while(t--)
	{
	    int a,b;
	    cin>>a>>b;
		cout<<a*b<<"\n";
	}
} 

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long ans = Long.MAX_VALUE;
		for(long i = 1; i <= Math.sqrt(n); i++) {
			if(n % i == 0) {
				long tmp = n / i;
				ans = Math.min(tmp + i - 2, ans);
			}
		}
		System.out.println(ans);
	}

}


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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    string s; cin>>s;
    int n = s.size();
    if(s[n-1]!='s')cout<<s<<'s'<<endl;
    else cout<<s<<"es"<<endl;
}


Measured memory_bytes: 3644