akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ctype.h>
using namespace std;

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int a, b;
    cin >> a >> b;

    // 処理
    // 出力
    cout << (a - 1) * (b - 1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
#define pb push_back
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
ll inf=1e18;
ll p= 1e9+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p-2, p);
}
typedef pair<ll, ll> pi;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll i,j,x,y,k,t,m,n,z,a,b,c,d,r;
     
           string s;
           cin>>k>>s;
           n=s.length();
           if(n>k)
           {
               for(i=0;i<k;i++)
               cout<<s[i];
               cout<<"...";
               
           }
           else
           cout<<s;
    return 0;
 
    
}

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

int main() {

int N, K, d, number;
int counter=0;
cin >> N >> K;

vector<int> sunuke(N);

for(int i = 0; i < K; i++){
    cin >> d;
    for(int i = 0; i < d; i++){
        cin >> number;
        sunuke.at(number-1)=1;
    }
}

for(int i = 0; i < N; i++){
    if(sunuke.at(i)==0){
    counter++;
    }
}

cout << counter << endl;

}

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

int m[101];

int main(){
  int n,q;
  int i,j;
  int d,x;
  int max,a,f;
  
  while(1){
    f=0;
    max=-1;
    for(i=0;i<101;i++){
      m[i]=0;
    }
    cin >> n >> q;
    if(n==0 && q==0)break;
    q--;
    for(i=0;i<n;i++){
      cin >> d;
      if(d==0)f=1;
      for(j=0;j<d;j++){
	cin >> x;
	m[x]++;
      }
    }
    a=0;
    for(i=0;i<100;i++){
      if(q<m[i]){
	q=m[i];
	a=i;
      }
      m[i]=0;
    }
    cout << a << endl;
  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
using namespace std;
using P=pair<int,int>;
using G=vector<vector<int>>;
using ll=long long;

string subsum(int* A,int n,int m){
  bitset<2010> E(1);

  rep(i,0,n){
    E |= (E<<A[i]);
  }

  if(E.test(m)) return "yes";
  else return "no";
}

vector<bool> seen;
vector<int> d;
vector<int> f;
#define pi 3.141592653589793

vector<int64_t> dsy(vector<int64_t>dis,vector<vector<pair<int64_t,int64_t>>> g,int64_t start,int64_t goal){
    int n=dis.size();
    priority_queue<pair<int64_t,int64_t>,vector<pair<int64_t,int64_t>>,greater<pair<int64_t,int64_t>>> Q;
    dis[start]=0;
    Q.push(make_pair(0,start));

    while(!Q.empty()){
        int pos=Q.top().second;Q.pop();
        for(int i=0;i<g.at(pos).size();i++){
            int to=g.at(pos).at(i).first;
            int cost=g.at(pos).at(i).second;
            if(dis[to]==-1||dis[to]>dis[pos]+cost){
                dis[to]=dis[pos]+cost;
                Q.push(make_pair(dis[to],to));
            }
        }
    }
    return dis;
}


int main(int argc,char **argv){
  int n; cin>>n;
  cout<<180*(n-2)<<endl;
  }

Measured memory_bytes: 256
program AGC011A
    implicit none
    integer(8)::N,C,K,ans,tl,i,pcount
    integer(8),allocatable,dimension(:)::T
    read(5,*)N,C,K
    allocate(T(N))
    read*,T
    T=iqsort(T)
    ans=0
    tl=T(1)+K
    pcount=0
    do i=2,N
        if(T(i)<=tl)then
            pcount=pcount+1
        else
            ans=ans+1
            pcount=0
            tl=T(i)+K
        end if
        if(pcount>=C)then
            pcount=0
            tl=T(i)+K
            ans=ans+1
        end if
    end do

    print'(i0)',ans+1
contains
    recursive function iqsort(ix) result(ires)
      integer(8), allocatable :: ires(:)
      integer(8), intent(in)  :: ix(:)
      integer :: k
      if (size(ix) <= 1) then 
        ires = ix
      else  
        k = ix(size(ix) / 2)
        ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] 
      end if
    end function iqsort
end program AGC011A

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

int main(){
    long long n,a,b;
    cin>>n>>a>>b;
    long long h[n];
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    long long ans=1e9;
    long long ret=ans;
    long long l=0,r=1e9;
    while(l+1!=r){
        long long c=0;
        ret=(l+r)/2;
        for(int i=0;i<n;i++){
            if(h[i]>ret*b) c+=(h[i]-ret*b+a-b-1)/(a-b);
        }
        if(c<=ret){
            r=ret;
        }
        else{
            l=ret;
            
        }
        cerr<<l<<" "<<ret<<" "<<r<<endl;
    }
    cout<<r<<endl;

}

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

using namespace std;

#define int long long

const int MOD = 1e9 + 7;
const int INF = 1e9;

typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

int par[200000];
int Rank[200000];

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

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

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if(Rank[x] < Rank[y]) par[x] = y;
	else {
		par[y] = x;
		if(Rank[x] == Rank[y]) ++Rank[x];
	}
}

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

int road[200000], rail[200000];
map<P, int> mp;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N, K, L;
	cin >> N >> K >> L;
	init(N);
	for(int i = 0; i < K; ++i) {
		int p, q;
		cin >> p >> q;
		--p; --q;
		unite(p, q);
	}
	for(int i = 0; i < N; ++i) road[i] = find(i);
	init(N);
	for(int i = 0; i < L; ++i) {
		int r, s;
		cin >> r >> s;
		--r; --s;
		unite(r, s);	
	}
	for(int i = 0; i < N; ++i) rail[i] = find(i);
	for(int i = 0; i < N; ++i) ++mp[P(road[i], rail[i])];
	for(int i = 0; i < N; ++i) {
		cout << mp[P(road[i], rail[i])]	;
		cout << ((i == N - 1) ? "\n" : " ");
	}
	return 0;
}

Measured memory_bytes: 18304
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vp;
typedef vector<T> vt;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//---------------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
//--------------------------------------------------------------

void Main(){
  int a;
  int b;
  cin>>a>>b;
  string s,t;
  rep(i,b) s+=to_string(a); 
  rep(i,a) t+=to_string(b);
  cout<<((s>t)? t:s);
} int main(int argc,char** argv)
{fastio; myio; Main();}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int s[10000];
int main()
{
    int n;
    cin>>n;
    int m=0;
    for(int i=0; i<n; i++)
    {
        scanf("%d",&s[i]);
    }
    for(int i=0; i<n; i++)
    {
        for(int k=i+1; k<n; k++)
        {
            if(s[k]!=s[i])
            for(int r=k+1; r<n; r++)
            {
                if(s[i]+s[k]>s[r]&&s[r]+s[k]>s[i]&&s[i]+s[r]>s[k]&&s[k]!=s[r]&&s[r]!=s[i])
                {

                     m++;
                }

            }
        }

    }

    printf("%d\n",m);
    return 0;
}


Measured memory_bytes: 3824
n = int(input())
log = []

last = ""
ans = "Yes"

for i in range(n):
    s = input()
    if (last != "" and last != s[0]) or (s in log):
        ans = "No"
        break
    log.append(s)
    last = s[len(s) - 1]


print(ans)

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

struct UnionFind {
    vector<int> p;
    UnionFind(int n) {
        p.assign(n, -1);
    }
    int find(int a) {
        if (p[a] == -1) return a;
        return p[a] = find(p[a]);
    }
    void unite(int a, int b) {
        int p_a = find(a), p_b = find(b);
        if (p_a == p_b) return;
        p[p_a] = p_b;
    }
    bool same(int a, int b) {
        if (find(a) == find(b)) return true;
        return false;
    }
};
int main() {
    int n, q;
    cin >> n >> q;
    UnionFind uf(n);
    for (int i = 0; i < q; i++) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) uf.unite(u, v);
        else cout << uf.same(u, v) << endl;
    }
    return 0;
}

Measured memory_bytes: 3992
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define INPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in"
#define OUTPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

vector<int> f, vis;

int go(int n)
{
    //cout << n << "\n";
    if(n <= 0)
    {
        return 0;
    }
    
    if(vis[n] == 0)
    {
        vis[n] = 1;
        for(int i = 1; i <= n; i *= 6)
        {
            f[n] = min(f[n], go(n - i) + 1);
        }
        
        for(int i = 1; i <= n; i *= 9)
        {
            f[n] = min(f[n], go(n - i) + 1);
        }
    }
    
    return f[n];
}

void solve()
{
    int n;
    cin >> n;
    f.assign(n + 1, inf);
    vis.assign(n + 1, 0);
    cout << go(n);
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    //freopen(INPUT, "r", stdin);freopen(OUTPUT, "w", stdout);
    //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 5760
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 100005;
using namespace std;

int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  string s,ans;
  cin >> s;
  ans += s[0];
  for (int i = 1; i < s.size(); ++i)
  {
    if( ans[ans.size()-1] != s[i])
        ans += s[i];
  }
  cout << ans.size();
  return 0;
}

Measured memory_bytes: 512
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] h = new int[n];
    int max = 0;
    int count = 0;
    for(int i = 0;i<n;i++){
      h[i] = sc.nextInt();
      if(max <= h[i]){
        max = h[i];
        count++;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 35800
import java.util.*;
 
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    int n = Arrays.stream(N.split("")).mapToInt(Integer::parseInt).sum();
    System.out.println(Integer.parseInt(N)%n == 0 ? "Yes" : "No");
  }
}

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

using namespace std;

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

  long long ans = 0;

  unordered_map<string, int> m;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;

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

    if (m.count(s)) ans += m[s]++;
    else m.emplace(s, 1);
  }

  cout << ans << endl;
}


Measured memory_bytes: 10660
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    ll y;
    cin >> n >> y;
    for (ll i = 0; i <= n; ++i) {
        for (ll j = 0; j <= n; ++j) {
            if (n - i - j < 0) continue;
            ll sum = 10000LL * i + 5000LL * j + 1000LL * (n - i - j);
            if (sum == y) {
                printf("%lld %lld %lld\n", i, j, n - i - j);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}


Measured memory_bytes: 384
import bisect
N = int(input())
L = list(map(int, input().split()))
ans = 0
L = sorted(L)

for a_index in range(N):
    for b_index in range(a_index+1, N):
        a_and_b = L[a_index] + L[b_index]
        c_index = bisect.bisect_left(L,L[a_index]+L[b_index])
        ans += max(0, c_index - b_index - 1)
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main() {
	int fl=1;
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++) {
		if((i%2==0 && s[i]=='L') || (i%2!=0 && s[i]=='R')) {
			fl=0;
			break;
		}
	}
	if(fl==0) cout<<"No";
	else cout<<"Yes";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef pair<long long, long long> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<typename T>
void out(T N) {
	cout << N << endl;
}
int main() {
	long long A, B; cin >> A >> B;
	out(A * B);
}

Measured memory_bytes: 3596
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<array>
#include<deque>
#include<queue>
#include<map>
#include<cmath>
#include<stdio.h>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::array;
using std::queue;
using std::deque;
using std::priority_queue;
using std::multimap;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;
using std::sin;
using std::cos;
using std::log;

using lli = long long int;
using ulli = unsigned long long int;

#define INF 999999999;
#define MOD 1000000007;
#define PI 3.141592653589793;

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

ulli A, B;

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

	cin >>A >> B;
	if(A > 0 && A < 10 && B > 0 && B < 10){
		cout << A*B << "\n";
	}else{
		cout << "-1\n";
	}

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int fx4[] = {1 , -1 , 0 , 0};
int fy4[] = {0 , 0 , 1 , -1};
int Kfx[]= {-2,-2,2,2,1,1,-1,-1}; ///knight move x - exis
int Kfy[]= {1,-1,1,-1,2,-2,2,-2}; ///knight move y- exis
int fx8[]= {1,1,1,0,0,-1,-1,-1};
int fy8[]= {0,1,-1,1,-1,0,1,-1};
#define ll long long int
#define pii pair<int,int>
#define llu unsigned long long
#define inf 1<<28
#define gama 0.57721566490
#define PI              acos(-1.0)
#define INF             0x7fffffff
#define MOD             1000000007
#define EPS             1e-7
#define all(r)(r).begin(),(r).end()
/*
bool status[mx];
void sieve(){
   long long int  i,j;
    for(i=2;i<=mx;i++)
    {
        status[i]=0;
    }
    for( i=2;i<=sqrt(mx);i++){
        if(status[i]==0)
        {
            for(j=i*i;j<=mx;j+=i){
                status[j]=1;
            }
        }
    }
}*/
ll BM( ll a , ll b , ll m )
{
    if ( b == 0 ) return 1 ;
    ll x = BM(a,b/2,m);
    x = (( x % m) * (x % m))%m;

    if( b % 2 ) x = (( x % m) * (a %m)) % m ;
    return x ;
}
#define dd double
#define sc scanf
#define pr printf
#define VI vector<int>
#define VS vector<string>
#define VC vector<char>
#define VLL vector<long long int>
#define FILE freopen("input.txt","rt",stdin); freopen("output.txt","w",stdout);
#define p_b push_back
#define mem(x,y) memset(x,y,sizeof(x))
#define F(i,a,b) for(i=a;i<=b;i++)
#define sc1(a) scanf("%d",&a)
#define scL1(a) scanf("%lld",&a)
#define scL2(a,b) scanf("%lld%lld",&a,&b)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define fori(N)          for(int i = 0; i<(N); i++)
#define forj(N)         for(int j = 0; j<(N); j++)
#define fork(N)         for(int k = 0; k<(N); k++)
#define forl(N)         for(int l = 0; l<(N); l++)
#define ford(N)         for(int d = 0; d<(N); d++)
#define fori1(N)          for(int i = 1; i<=(N); i++)
#define forj1(N)         for(int j = 1; j<=(N); j++)
#define fork1(N)         for(int k = 1; k<=(N); k++)
#define ford1(N)         for(int d = 1; d<=(N); d++)
#define sqr(x)           (x)*(x)
#define TEST int test,te=0;cin>>test;
#define segment_tree int l=(n*2),r=(n*2)+1,mid=(l+r)/2
#define Mx 100005
#define mx 10005

int main()
{


    char a;
    cin>>a;
    pr("%c\n",a+1);
//    cout<<a+1<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{
		var S = Console.ReadLine();
		if (S[0] == S[1] && S[0] == S[2])
			Console.WriteLine("No");
		else
			Console.WriteLine("Yes");
	}
}

Measured memory_bytes: 13140
class Unionfind():
    
    def __init__(self,n):
        self.n = n
        self.parents = [-1]*n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
        
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x==y:
            return 

        if self.parents[x]>self.parents[y]:
            x,y = y,x
        
        self.parents[x]+=self.parents[y]
        self.parents[y]= x

    def size(self, x):
        return -self.parents[self.find[x]]
    
    def same(self, x, y):
        return self.find(x)==self.find(y)

    def members(self, x):
        root = self.find(x)
        return [ i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [ i for i, x in enumerate(self.parents) if x < 0]
    
    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __ser__(self):
        return '\n'.join('{}: {}'.format(r, sself.members(r)) for r in self.roots())

n,k,l = map(int, input().split())
a = Unionfind(n)
b = Unionfind(n)
for i in range(k):
    p,q = map(int, input().split())
    p -=1
    q -=1
    a.union(p,q)

for i in range(l):
    r,s = map(int, input().split())
    r-=1
    s-=1
    b.union(r,s)

c = [(a.find(x),b.find(x)) for x in range(n)]
count = {}
for i in c:
    if i in count:
        count[i]+=1
    else:
        count[i] = 1
print(*[count[i] for i in c])

Measured memory_bytes: 44068
L, R = map(int, input().split())

R_alt = min(L+2018, R)

ans = 2018 ** 2

for i in range(L, R_alt):
  for j in range(i+1, R_alt+1):
    tmp = i%2019 * j%2019
    if ans > tmp:
      ans = tmp

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
#define ll long long
#define rep(i, s, g) for (ll i = (s); i < (g); i++)
#define MOD 1000000007
using namespace std;
ll fact(ll i)
{
	return i * i * i * i * i;
}
int main()
{
  ll X; cin >> X;
  ll A, B;
  for (B = -1000; B < 1000; B++) {
  	for (A = -1000; A < 1000; A++) {
    	if (fact(A) - fact(B) == X) {
        	cout << A << " " << B << endl;
          	return 0;
        } 
    }
  }
}

Measured memory_bytes: 3616
#include<stdio.h>
int main(){
int a[4],b[4],asum,bsum;
scanf("%d %d %d %d\n%d %d %d %d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3]);
asum = a[0]+a[1]+a[2]+a[3];
bsum = b[0]+b[1]+b[2]+b[3];
if(asum>bsum)printf("%d\n",asum);else printf("%d\n",bsum);
return 0;
}

Measured memory_bytes: 592
import sys
import math

for x in sys.stdin:
    n = len(x)
    J = 0
    I = 0
    for j in range(n-2):

        if x[j:j+3] == "JOI":
            J += 1
        elif  x[j:j+3] == "IOI":
            I += 1
    print(J)
    print(I)


Measured memory_bytes: 5628
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

struct Node {
    int key;
    Node* next;
    Node* prev;
};

Node* nil;

Node* listSearch(int key) {
    Node *cur = nil->next;
    while (cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void init() {
    nil = (Node*)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList() {
    Node* cur = nil->next;
    int isf = 0;
    while (1) {
        if (cur == nil) break;
        if (isf++ > 0) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(Node* t) {
    if (t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() {
    deleteNode(nil->next);
}

void deleteLast() {
    deleteNode(nil->prev);
}

void deleteKey(int key) {
    deleteNode(listSearch(key));
}

void insert(int key) {
    Node* x = (Node*)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

int main(void){
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for (i = 0; i < n; i++) {
        scanf("%s%d", com, &key);
        if (com[0] == 'i') {insert(key); np++; size++;}
        else if (com[0] == 'd') {
            if (strlen(com) > 6) {
                if (com[6] == 'F') deleteFirst();
                else if (com[6] == 'L') deleteLast();
            }
            else {
                deleteKey(key); nd++;
            }
            size--;
        }
    }
    printList();
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}



Measured memory_bytes: 33940
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long LL;
map<int, map<int,int> > d; //exists
map<int, map<int,int> > l; // freq[sum][xval]
vector<int> xval;// 
vector<int> freq; // 
int n;
int a[210000], b[210000];
int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
	if(a[0] != 0 || b[1] != 0 || a[1] != b[0] || a[1] == 0 || b[0] == 0){
		cout << -1 << endl; return 0;
	}
	for(int i = 0; i < n; i++){
		if(a[i] + b[i] < a[0] + b[0]){
			cout << -1 << endl; return 0;
		}
		if(i >= 2 && (a[i] == 0 || b[i] == 0) ){
			cout << -1 << endl; return 0;
		}
		d[a[i]][b[i]] = 1;
		l[a[i]+b[i]][a[i]]++;
	}
	for(int i = 0; i < n; i++){
		if(a[i] > 0){
			if(!d[a[i]-1][b[i]-1] && !d[a[i]-1][b[i]] && !d[a[i]-1][b[i]+1]){
				cout << -1 << endl; return 0;
			}
		}
		if(b[i] > 0){
			if(!d[a[i]-1][b[i]-1] && !d[a[i]][b[i]-1] && !d[a[i]+1][b[i]-1]){
				cout << -1 << endl; return 0;
			}
		}
	}

	LL ans = 0;
	for(int i = 0; i < 210000; i++){
		xval.clear();
		freq.clear();
		for(map<int, int>::iterator it = l[i].begin(); it != l[i].end(); it++){
			xval.push_back(it->first);
			freq.push_back(it->second);
		}
		int l = 0;
		for(int j = 0; j < xval.size(); j++){
			int numl = freq[j];
			int numd = freq[j];
			numl -= l;
			if(numl < 0) numl = 0;
			int xc = xval[j];
			int yc = i-xval[j];
			if(xc == 0) numl = 0;
			if(yc == 0) numd = 0;
			if(d[xc-1][yc-1]){
				int r = min(numl,numd);
				numl -= r;
				numd -= r;
				ans += r;
			}
			ans += numl;
			l = numd;
			ans += numd;
			if(j + 1 == xval.size() || xval[j+1] != xval[j] + 1) l = 0;	
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 49652
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define F first
#define S second
#define pb push_back
mt19937 rnd;


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    int k, x;
    cin >> k >> x;
    if (500 * k >= x) cout << "Yes\n";
    else cout << "No\n";

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 100000 + 1000;

int n, m;
long long d[2 * MAXN], ans = 0;


int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> m;
	int x = 0;
	cin >> x;
	for(int i = 2; i <= n; i++)
	{
		int y, y0;
		cin >> y, y0 = y;
		if(y < x) y += m;
		ans += y - x;
		d[x + 2] += 1;
		d[y + 1] -= 1;
		d[y + 1] -= y - x - 1;
		d[y + 2] += y - x - 1;
		x = y0;
	}
	for(int i = 1; i <= 2 * m; i++)
		d[i] += d[i - 1];
	for(int i = 1; i <= 2 * m; i++)
		d[i] += d[i - 1];
	for(int i = 1; i <= m; i++)
		d[i] += d[i + m];
	// for(int i = 1; i <= m; i++)
	// 	cerr << d[i] << ' ';
	// cerr << endl;

	long long mx = 0;
	for(int i = 1; i <= m; i++)
		mx = max(mx, d[i]);
	ans -= mx;

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 1792
#[allow(dead_code)]
fn scan<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn scan_split<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|t| t.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn scan_split_with<T: std::str::FromStr>(ch: char) -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split(ch)
        .map(|t| t.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn scan_lines<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| scan::<T>()).collect()
}

#[allow(unused_macros)]
macro_rules! scan_as_tuple {
    ( $t:ty ) => {
        (scan::<$t>(),)
    };
    ( $( $t:ty ),* ) => {
        {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).ok();
            let v = s.trim().split_whitespace();
            let mut it = v;
            let ret = ( $(it.next().unwrap().parse::<$t>().ok().unwrap()),* );
            assert!(it.next() == None, "not all tokens consumed");
            ret
        }
    };
}

fn main() {
    let (mut a, mut b) = scan_as_tuple!(i32, i32);
    if a == 1 { a += 13 }
    if b == 1 { b += 13 }

    println!("{}", match Ord::cmp(&a, &b) {
        std::cmp::Ordering::Greater => "Alice",
        std::cmp::Ordering::Less => "Bob",
        std::cmp::Ordering::Equal => "Draw",
    });
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        string s,a;
        ll ss,sa,j=0;
        cin>>s>>a;
        ss=s.size();
        sa=a.size();
        if(ss!=sa-1)
        {
            cout<<"No";
        }
        else
        {
            for(ll i=0;i<ss;i++)
            {
                if(s[i]==a[i])
                j++;
            }
            if(j==ss)
            cout<<"Yes";
            else
            cout<<"No";
        }
        
    }        
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int w=1,ans=0,t=1;
	while(t<=n){
		t*=10;
		w++;
	}
	t/=10; w--;
	if(w%2==1){
		ans+=n-t+1;
	}
	while(w){
		if(w%2==0){
			ans+=t-t/10;
		}
		w--;
		t/=10;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val isPrime = eratosthenes(55555)
    val primes = (1..55555).filter { isPrime[it] }
    primes
            .filter { it.mod(5) == 1 }
            .take(N)
            .forEach { 
                print(it)
                print(" ")
            }
}

fun eratosthenes(N: Int) : BooleanArray {
    val isPrime = BooleanArray(N + 1)
    isPrime.fill(true)
    isPrime[0] = false
    isPrime[1] = false

    (2..N).forEach {
        if (isPrime[it]) {
            var i = 2
            while (i * it <= N) {
                isPrime[i*it] = false
                i++
            }
        }
    }

    return isPrime
}


Measured memory_bytes: 38560
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int main(){
string n,tmp;
getline(cin,n);
for(int i=0;i<n.size();i++){
	if(n[i]=='a'&&n[i+1]=='p'&&n[i+2]=='p'&&n[i+3]=='l'&&n[i+4]=='e'){
	cout<<"peach";
	i+=4;
	}
	else if(n[i]=='p'&&n[i+1]=='e'&&n[i+2]=='a'&&n[i+3]=='c'&&n[i+4]=='h'){
	cout<<"apple";
	i+=4;
	}
	else cout<<n[i];
}
cout<<endl;
return 0;
}

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

int main(){

  int64_t N;
  cin >> N;


   vector<int64_t> data(N+1,0);
 
   data[0]=2;
   data[1]=1;
  
  for(int i =2; i<N+1 ; i++){
    data[i] = data[i-2]+data[i-1]; 
  }

  cout << data[N] << endl;
}

Measured memory_bytes: 256
use std::io;

fn main() {
    let mut input_line:String = String::new();
    io::stdin().read_line(&mut input_line).expect("err");

    let inputs: Vec<&str> = input_line.split_whitespace().collect();

    let a = inputs[0].parse::<i64>().unwrap();
    let b = inputs[1].parse::<i64>().unwrap();
    let x = inputs[2].parse::<i64>().unwrap();

    let ans: i64 = f(b, x)-f(a-1, x);

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

fn f(n: i64, x: i64) -> i64 {
   if n == -1{
       return 0;
   }else{
       return (n/x)+1;
   }
}

Measured memory_bytes: 2084
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

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

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

string f(string a)
{
    while (a.size() < 4) a = '0' + a;

    return a;
}

int to_int(string s)
{
    int res = 0;

    int i = 0;
    while (s[i] == '0') i++;

    for (; i < s.size(); ++i) {
        res *= 10;
        res += s[i] - '0';
    }

    return res;
}

string to_str(int a)
{
    string res = "";

    do {
        res += (a % 10) + '0';
        a /= 10;
    } while (a);

    reverse(all(res));

    return f(res);
}

int solve(int now, string N)
{
    if (N == "6174") return now;

    string l = N, s = N;
    sort(rall(l));
    sort(all(s));

    return solve(now + 1, to_str(to_int(l) - to_int(s)));
}

bool check(string a)
{
    char c = a[0];
    bool f = true;

    rep(i, a.size()) {
        if (a[i] != c) return true;
    }

    return false;
}

signed main()
{
    string N;
    
    while (true) {
        cin >> N;

        if (check(N)) {
            cout << solve(0, N) << endl;
        } else {
            if (N[0] == '0') {
                break;
            }

            cout << "NA" << endl;
        }
    }
}

Measured memory_bytes: 1220
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    val k = sc.nextInt()

    val ans = (1..k).map { a -> (1..k).map { b -> (1..k).map { c -> gcd(a, gcd(b, c)) }.sum() }.sum() }.sum()
    println(ans)
}

fun gcd(a: Int, b: Int) : Int {
    return if (b == 0)  a else gcd(b, a % b)
}


Measured memory_bytes: 60536
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);
		int h =sc.nextInt();
		int w=sc.nextInt();
	    
		while(true){
			if(h==0 && w==0) break;
			StringBuilder sh1 = new StringBuilder();
	        for (int i = 0; i < w/2; i++) {
	            sh1.append("#.");
	        }
	        if(sh1.length()<w) sh1.append("#");
	
	        StringBuilder sh2 = new StringBuilder();
	        for (int i = 0; i < w/2; i++) {
	            sh2.append(".#");
	        }
	        if(sh2.length()<w) sh2.append(".");
	
	        for(int i=0;i<h;i++){
	        	if(i%2==0) System.out.println(sh1);
	        	if(i%2==1) System.out.println(sh2);
	        }
	        System.out.println();
	        
			h =sc.nextInt();
			w=sc.nextInt();
		}
	}

}

Measured memory_bytes: 21020
#include <stdio.h>

int max(int,int);

int main(void)
{
  int N,cnt=1;
  int H[101];
  
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d",&H[i]);
  }
  
  int h=H[0];
  
  for(int i=1;i<N;i++){
    if(h<=H[i]){
      cnt+=1;
    }
    h = max(h,H[i]);
  }

  printf("%d",cnt);
  
  return 0;
}

int max(int a,int b){
  if(a<=b){
    return b;
  }else{
    return a;
  }
}

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

typedef long long ll;

int main() {
    int N;
    string S;
    cin >> N >> S;
    for (int i=0;i<S.length();i++){
        S[i] = 'A' + (S[i] - 'A' + N) % 26;
    }
    cout << S << endl;

    return 0;
}

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

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

	int n;
	cin >> n;
	vector<int> h(n);
	for (int& x : h) {
		cin >> x;
	}

	for (int i = n-2; i >= 0; i--) {
		if (h[i] <= h[i+1]) {
			continue;
		}
		h[i]--;
		if (h[i] > h[i+1]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}



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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;
#define PI acos(-1)

void solve() {
    int a, b, h, m;
    cin >> a >> b >> h >> m;

    long double ha = h * 30 + m * 0.5;
    // cout << PI << endl;
    const double halfC = PI / 180;
    long double hm = m * 6;

//    cout << ha << " " << hm << endl;

    long double hh = abs(ha - hm);
    if (hh > 360 - hh)
        hh = 360 - hh;
//    cout << hh << endl;
    hh *= halfC;
    // cout << ha << " " << hm << endl;

//    cout << hh << endl;
    long double ans = b * b + a * a - 2 * a * b * cos(hh);
    ans = sqrt(ans);
    cout << fixed << setprecision(10) << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 4180
process.stdin.resume();
process.stdin.setEncoding('ascii');

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

process.stdin.on('data', function (data) {
    input_stdin += data;
});

process.on('SIGINT', function(){
    input_stdin_array = input_stdin.split("\n");
    main();
    process.exit();
});

process.stdin.on('end', function () {
    input_stdin_array = input_stdin.split("\n");
    main();    
});

function readLine() {
    return input_stdin_array[input_currentline++];
}

/////////////// ignore above this line ////////////////////


function main() {
	var b1,b2,h;
	b1 = parseInt(readLine());
	b2 = parseInt(readLine());
	h = parseInt(readLine())/2;
    var ans = (b1+b2)*h;
	
	console.log(ans.toString()); 
    process.exit();
}

Measured memory_bytes: 7628
/// {{{ Author: Wang, Yen-Jen
// include
#include <bits/stdc++.h>

// using
using namespace std;

// types
typedef long long ll;
typedef pair<int,int> pii;

// macro
#define SZ(x) ((int)x.size())
#define ALL(x) (x).begin() , (x).end()
#define REP(i , n) for(int i = 0; i < int(n); i++)
#define REP1(i , a , b) for(int i = a; i <= int(b); i++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define LC o<<1 , l , m
#define RC o<<1|1 , m + 1 , r
#define MS(x , v) memset(x , (v) , sizeof(x))

// input
inline bool SR(int &x) {
  return scanf("%d",&x) == 1;
}

inline bool SR(ll &x) {
  return scanf("%lld",&x) == 1;
}

inline bool SR(double &x) {
  return scanf("%lf",&x) == 1;
}

inline bool SR(char *s) {
  return scanf("%s",s) == 1;
}

inline bool RI() {
  return true;
}

template<typename I , typename... T> inline bool RI(I &x , T&... tail) {
  return SR(x) && RI(tail...);
}

// output
inline void SP(const int x) {
  printf("%d",x);
}

inline void SP(const ll x) {
  printf("%lld",x);
}

inline void SP(const double x) {
  printf("%.16lf",x);
}

inline void SP(const char *s) {
  printf("%s",s);
}

inline void PL() {
  puts("");
}

template<typename I , typename... T> inline void PL(const I x , const T... tail) {
  SP(x);
  if(sizeof...(tail)) putchar(' ');
  PL(tail...);
}

// debug
#define WangYenJen

#ifdef WangYenJen
template<typename I> void _DOING(const char *s , I&& x) {
  cerr << s << " = " << x << endl;
}

template<typename I , typename... T> void _DOING(const char *s , I&& x , T&&... tail) {
  int c = 0;
  while(*s != ',' || c != 0) {
    if(*s == '(' || *s == '[' || *s == '{') c++;
    if(*s == ')' || *s == ']' || *s == '}') c--;
    cerr << *s++;
  }
  cerr << " = " << x << " , ";
  _DOING(s + 1 , tail...);
}

#define DEBUG(...) \
do {\
  fprintf(stderr , "%s: Line %d - ",__PRETTY_FUNCTION__,__LINE__);\
  _DOING(#__VA_ARGS__ , __VA_ARGS__);\
} while(0);

#else
#define DEBUG(...)

#endif

// constant number
const int INF = 0x3f3f3f3f;
const ll INF64 = 0x3f3f3f3f3f3f3f3fll;

// random function
inline int RAND() {
  static int x = 880301;
  return (x = x * 0xdefaced + 1) % 0x7fffffff;
}
/// }}}

int main() {
  int a, b;
  RI(a, b);
  if (a > 0 && b > 0) PL("Positive");
  else if (a < 0 && b < 0) PL((b - a + 1) % 2 ? "Negative" : "Positive");
  else PL("Zero");
  return 0;
}



Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var n = cin.ReadInt;
            var dic = new Dictionary<string, long>();
            for(int i = 0; i < n; i++)
            {
                var s = new string(cin.Read.OrderBy(v => v).ToArray());
                if (!dic.ContainsKey(s))
                    dic[s] = 1;
                else dic[s]++;
            }
            var ans = 0L;
            foreach(var p in dic.Values)
            {
                ans += p * (p - 1) / 2;
            }
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 28172
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,l,r) for(int i=(r)-1,i##_left=(l);i>=i##_left;--i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
template<class T>
string join(vector<T>& v, string delim="") { ostringstream os; rep(i,v.size())i?os<<delim<<v[i]:os<<v[0]; return os.str(); }
#pragma endregion RegionDefs

ll c[114514];

void solve()
{
    IN(n);
    for (ll x = 1; x*x<n; ++x) {
        for (ll y = 1; y*y<n; ++y) {
            for (ll z = 1; z*z<n; ++z) {
                c[x*x+y*y+z*z+x*y+y*z+z*x]++;
            }
        }
    }
    reps(i, 1, n+1) {
        cout << c[i] << endl;
    }
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

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

using namespace std;
int main() {

	int n, t;
	cin >> n >> t;

	ll total = 0;
	bool OK = false;

	vector<int> ts(n);

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

	for (int i = 0; i < n-1; i++)
	{
		int now = ts[i + 1] - ts[i];
		total += min(now, t);
	}

	total += t;

	 cout << total << endl;
}

Measured memory_bytes: 1024
n=int(input())
A=list(map(int,input().split()))
ans=int(1000000000)
for i in range(-1000,1000):
    now=int(0)
    for j in range(n):
        now+=(i-A[j])*(i-A[j])
    if now<ans:
        ans=now
        
print(ans)


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

int main() {
    int n;
    string s;
    cin>>n>>s;
    int mx=0;
    for (int i=1;i<n;i++) {
        set<char> a,b;
        for (int j=0;j<i;j++)
            a.insert(s[j]);
        for (int j=i;j<n;j++)
            b.insert(s[j]);
        int cnt=0;
        for (char c:a)
            if (b.count(c))
                cnt++;
        mx=max(mx,cnt);
    }
    cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    int n = kbd.nextInt();
	    int keta = kbd.nextInt();
	    if(! (n==0 && keta==0))
		solve(n, keta);
	}
    }
    
    //20回計算して、上から調べる
    static void solve(int n, int keta){
	int[] m = new int[21];
	int[] min = new int[keta];
	String ss;
	int mMax, mMin, i, j;
	int[] p = {1000, 0, 0};

	//計算
	m[0] = n;
	for(i=0; i<m.length-1; i++){
	    //System.out.println(m[i]);
	    putKeta(m[i], min);
	    sort(min);
	    ss = "";
	    for(j=0; j<keta; j++){
		ss += min[j];
	    }
	    mMin = Integer.parseInt(ss);
	    ss = "";
	    for(j=keta-1; j>=0; j--){
		ss += min[j];
	    }
	    mMax = Integer.parseInt(ss);

	    m[i+1] = mMax-mMin;
	}

	//i>j, ペア探し
	for(i=m.length-1; i>0; i--){
	    for(j=i-1; j>=0; j--){
		//System.out.println(i+" "+j+" *"+m[i]+" "+m[j]);
		if(m[i]==m[j] && j<=p[0]){
		    p[0] = j;
		    p[1] = m[i];
		    p[2] = i-j;
		}
	    }
	}

	System.out.println(p[0]+" "+p[1]+" "+p[2]);
    }

    static void putKeta(int n, int[] min){
	int keta = min.length;  //現在の桁
	int i, a;
	while(keta>0){
	    a = 1;
	    for(i=1; i<keta; i++) a = a*10;
	    min[keta-1] = (n/a)%10;
	    keta--;
	    //System.out.println(min[keta]);
	}
    }

    static void sort(int[] min){
	int i, j;
	for(i=0; i<min.length; i++){
	    for(j=i; j<min.length; j++){
		if(min[i] > min[j]){
		    int w = min[i];
		    min[i] = min[j];
		    min[j] = w;
		}
	    }
	}
    }
}

Measured memory_bytes: 26708
def h_m_div(a,b,c)
  num = 0
  for i in a..b
    if c%i == 0
      num = num+1
    end
  end
  num
end


ar = gets.split(" ")
a = ar[0].to_i
b = ar[1].to_i
c = ar[2].to_i

puts h_m_div(a,b,c)

Measured memory_bytes: 8684