akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author G. Guarnieri
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
        /*
        Rating 1-399 : gray
        Rating 400-799 : brown
        Rating 800-1199 : green
        Rating 1200-1599 : cyan
        Rating 1600-1999 : blue
        Rating 2000-2399 : yellow
        Rating 2400-2799 : orange
        Rating 2800-3199 : red
         */
            Set<Integer> colors = new HashSet<>();
            int n = in.nextInt();
            int choosers = 0;
            for (int i = 0; i < n; i++) {
                int current = getColor(in.nextInt());
                if (current < 0) {
                    ++choosers;
                }
                else {
                    colors.add(current);
                }
            }
            out.printf("%d %d\n",
                       Math.max(colors.size(), 1),
                       colors.size() + choosers);
        }

        private int getColor(int score) {
            return score < 3200 ? score / 400 : -1;
        }

    }
}



Measured memory_bytes: 21844
#include<stdio.h>
int main(void)
{
	int n,s[5],i,f,l;
	scanf("%d",&n);
	f=n/100;
	l=n%100;

	if((f>=1 && f<=12) && (l>=1 && l<=12))
		printf("AMBIGUOUS");
	else if((f>=0 && f<=99) && (l>=1 && l<= 12))
		printf("YYMM");
	else if((f>=1 && f<= 12) && (l>=00 && l<=99))
		printf("MMYY");
	else
		printf("NA");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a[112345], ma = 0;
    map<int, int> mp;
    rep(i,n){
        cin >> a[i];
        ma = max(ma, a[i]);
        mp[a[i] - 1]++;
        mp[a[i]]++;
        mp[a[i] + 1]++;
    }
    int ans = 0;
    for (int i = 0; i <= ma + 1;i++){
        ans = max(ans, mp[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5376
import java.math.BigDecimal;
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int X = sc.nextInt();

        HashMap<Integer, Long> primeCount = new HashMap<>();

        for (int i = 2; i <= X; i++) {
            int value = i;
            for (int j = 2; j <= i; j++) {
                while (value % j == 0) {
                    primeCount.put(j, primeCount.containsKey(j) ? primeCount.get(j) + 1 : 1);
                    value = value / j;
                }
            }
        }


        long ans = 1;
        for (Map.Entry<Integer, Long> entry: primeCount.entrySet()) {
            ans *= entry.getValue() + 1;
            ans = ans % 1000000007l;
        }
        System.out.println(ans);
    }

    private static boolean isPrime(int n) {
        for (int i = 2; i < n; i++) {
            if ((n % i) == 0) return false;
        }
        return true;
    }
}

Measured memory_bytes: 23124
#include <stdio.h>
int main(){
    int a,b,c,tmp;
    scanf("%d",&c);
    a = c/3600;
    tmp = c%3600;
    if(tmp/60 < 60){
        b = tmp/60;
        c = tmp%60;
    }else if(tmp/60 >= 60){
        b = 59;
        tmp = tmp - (59*60);
        c = tmp;
    }
    printf("%d:%d:%d\n",a,b,c);
    return 0;
}

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

using namespace std;

int main(){
  long long int n, k;
  cin >> n >> k;
  
  // k が n 以上、n の 2倍以下なら差を取った方がよい？
  int ans = 0;
  /*
  if(k>2*n) {
    cout << n << endl;
    return 0;
  } else if(k<=2*n && k>=n) {
    cout << abs(n-k) << endl;
    return 0;
  } else if(k<n){
    ans = n%k;
    if(ans >= abs(ans-k) && ans!=0) ans = ans-k;
    cout << abs(ans) << endl;
    return 0;
  } 
  */
  if(n%k > k-n%k) cout << k-n%k;
  if(n%k < k-n%k) cout << n%k;
  return 0;
}

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){_;
  int a,b,c;cin>>a>>b>>c;
  cout<<max(c-(a-b),0)<<endl;
}


Measured memory_bytes: 384
import sys
S = list(input())

if S[0] != 'A':
    print("WA")
    sys.exit()

if 'C' not in S[2:-1]:
    print("WA")
    sys.exit()


S.remove('A')
S.remove('C')

if str(S).islower():
    print("AC")
else:
    print("WA")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define rt return 0
#define endln "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (lli)(x.size())
const lli MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
// cout << fixed << setprecision(0) << pi <<endl;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// for multiset
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

vector<lli> seg, v;

void update(lli pos, lli in, lli val, lli l, lli r) {
    lli mid = (l + r) / 2;
    if (l > r || l > in || r < in) {
        return;
    }
    if (l == r) {
        v[in] = val;
        seg[pos] = val;
        return;
    }
    if (in <= mid) {
        update(2 * pos, in, val, l, mid);
    } else {
        update(2 * pos + 1, in, val, mid + 1, r);
    }
    seg[pos] = max(seg[2 * pos], seg[2 * pos + 1]);
    return;
}

lli query(lli pos, lli beg, lli end, lli l, lli r) {
    if (l > r || end < l || beg > r) {
        return 0;
    }
    if (beg <= l && end >= r) {
        return seg[pos];
    }
    lli mid = (l + r) / 2;
    return max(query(2 * pos, beg, end, l, mid),
               query(2 * pos + 1, beg, end, mid + 1, r));
}

void solve() {
    lli n, a, k;
    cin >> n >> k;
    vector<lli> store;
    for (lli i = 0; i < n; i++) {
        cin >> a;
        store.pb(a);
    }

    lli lim = 300000;
    seg.resize(4 * lim + 2, 0);
    v.resize(lim + 2, 0);

    for (lli i = 0; i < n; i++) {
        lli mn = store[i] - k;
        mn = max(mn, 0ll);
        lli mx = store[i] + k;
        mx = min(mx, lim);

        lli val = query(1, mn, mx, 0, lim);
        if (v[store[i]] < val + 1) {
            update(1, store[i], val + 1, 0, lim);
        }
    }

    lli ans = query(1, 0, lim, 0, lim);
    cout << ans << endl;
}

int main(void) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // lli t; cin >> t; while(t--)
    solve();
    rt;
}

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

int n,ans;
int a[200005],s[200005],x[200005];

bool check(){
	int N=2*n-1;
	int l=n,r=n,res=a[n];
	a[0]=a[1],a[N+1]=a[N];
	for(; l>=1&&a[l-1]!=a[l]&&a[r+1]!=a[r]; --l,++r) res^=1;
	return res;
}

int main()
{
	cin >> n;
	for(int i=1; i<=2*n-1; i++)	scanf("%d",&s[i]),x[i]=s[i];
	sort(s+1,s+n*2);
	int l=1,r=2*n-1;
	while(l<=r){
		int	mid=(l+r)>>1;
		for(int i=1; i<=2*n-1; i++) a[i]=x[i]>s[mid];
		if(!check()) r=mid-1,ans=mid;
		else l=mid+1;
	//	cout << mid<<endl;
	}
	printf("%d",s[ans]);
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include<cstring>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int           long long
#define umapii        unordered_map<int,int>
#define ps(x,y)       fixed<<setprecision(y)<<x // sets precision upto required digits
#define arr(a,n)      int n;cin>>n;int a[n];for(int i=0;i<n;i++){cin>>a[i];}
#define outarr(a,n)   for(int i=0;i<n;i++){cout<<a[i]<<" ";}
#define mod           1000000007
#define ff            first
#define big           1e15
#define ss            second
#define add           push_back
#define remove        pop_back
#define mapii         map<int,int>
#define large         *max_element
#define small         *min_element
#define float         double
#define pqi           priority_queue<int>
#define mpqi          priority_queue<int,vector<int>,greater<int>>
#define in(n)         int n;cin>>n;
#define w(t)          int t;cin>>t;while(t--)
#define vi            vector<int>
#define vivi          vector<vector<int>>
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>pbds;






int32_t main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output3.txt", "w", stdout);
#endif

    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            ans++;
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 3908
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
vector<int> G[100001];
int dist[3][100001];

void bfs(int id,int s){
	queue<int> que;
	que.push(s);
	memset(dist[id],-1,sizeof(dist[id]));
	dist[id][s]=0;
	while(que.size()){
		int v=que.front();
		que.pop();
		for(int i=0;i<G[v].size();i++){
			int next=G[v][i];
			if(dist[id][next]==-1){
				dist[id][next]=dist[id][v]+1;
				que.push(next);
			}
		}
	}
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	bfs(0,0);
	int a=0;
	for(int i=0;i<n;i++){
		if(dist[0][a]<dist[0][i])a=i;
	}
	bfs(1,a);
	for(int i=0;i<n;i++){
		if(dist[1][a]<dist[1][i])a=i;
	}
	bfs(2,a);
	for(int i=0;i<n;i++){
		printf("%d\n",(n-1)*2-max(dist[1][i],dist[2][i]));
	}
	return 0;
}

Measured memory_bytes: 8460
#include "bits/stdc++.h"
using namespace std;

int main(){
    int n;
    string s;
    cin >> n >> s;
    bool f = n%2==0;
    for(int i = 0; i < n/2; i++){
        if(s[i] != s[i+n/2]) f = false;
    }
    cout << (f ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;
const int MAX = 2100000;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint log_mul(lint base, lint bit) {
    lint res = 0;

    while (bit) {
        if (bit & 1) res = (res + base) % MOD;
        base = (base + base) % MOD;
        bit >>= 1;
    }

    return res;
}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    lint k;
    cin >> k;
    string s;
    cin >> s;
    int n = s.size();

    COMinit();

    lint res = 0;

    for (int x = 0; x <= k; x++) {
        lint t;

        t = COM(n-1+k-x, k-x);
        t *= modpow(25, k-x);
        t %= MOD;
        t *= modpow(26, x);
        t %= MOD;

        res += t;
        res %= MOD;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 53600
N = int(input())
S = []
for i in range(N):
    S.append(input())
S_S = sorted(S)

maxi = 1
count = 1
i = 0
tmp = [0]
while i<N-1:
    if S_S[i] == S_S[i+1]:
        count = count + 1
        if count > maxi:
            maxi = count
            tmp = []
        i = i + 1
    else:
        count = 1
        i = i + 1
    if maxi == count:
        tmp.append(i)
#print(maxi)
#print(S_S)
for i in range(len(tmp)):
    print(S_S[tmp[i]])


Measured memory_bytes: 28536
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll l,r,i,j,k,n,m,x;
	cin>>l>>r>>n;
	ll ctr=0;
	for(i=l;i<=r;i++)
	{
		if(i%n==0) ctr++;
	}
	cout<<ctr;
}

Measured memory_bytes: 3592
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		if(n%2==1) {
			System.out.println("No");
		}else {
			String s=sc.next();
		    int a=n/2;
		    int c=0;
		    for(int i=0;a<n;i++) {
		    	if(s.charAt(i)==s.charAt(a)) {
		    		c++;
		    	}a++;

		    }
		    if(c==n/2) {
		    	System.out.println("Yes");
		    }else {
		    	System.out.println("No");
		    }
		}

	}

}


Measured memory_bytes: 23508
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int ret = A;
        if (A<B) {
            ret = B;
            B--;
        }
        else {
            A--;
        }

        if (A>B) {
            ret += A;
        }
        else {
            ret += B;
        }


        System.out.println(ret);
    }

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll N;
    cin >> N;

    ll a = N%10;

    if(a==2||a==4||a==5||a==7||a==9) cout << "hon" << endl;
    else if(a==3) cout << "bon" << endl;
    else cout << "pon" << endl;

    return 0;
}

Measured memory_bytes: 3588
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
const long long MAX = (ll)3e4+100;


int main(void) {
   string S;
   cin>>S;
   rep(i,0,S.size()-1) {
      if (S[i]==S[i+1]) {
         cout<<i+1<<" "<<i+2<<endl;
         return 0;
      }
   }
   rep(i,0,S.size()-2) {
      if (S[i] == S[i+2]) {
         cout<<i+1<<" "<<i+3<<endl;
         return 0;
      }
   }
   cout<<-1<<" "<<-1<<endl;

   return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if(A + B + C >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var NKS = Sarray();
            var N = NKS[0];
            var K = NKS[1];
            var S = NKS[2];

            var Ai = new long[N];
            for (var i = 0; i < K; ++i)
                Ai[i] = S;
            for (var i = K; i < N; ++i)
                Ai[i] = (S + 1) % 1000000000;
            WriteLine(string.Join(" ", Ai));
            Out.Flush();
        }
    }
}

Measured memory_bytes: 23644
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define sz size
#define se second
#define fe first
#define mper make_pair
#define all(x) x.begin(), x.end()
#define mal ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
#define vl vector<ll>
#define vi vector<int>
#define vli vector <pair <ll, int> >
#define vll vector <pair <ll, ll> >
#define vii vector <pair <int, int> >
using namespace std;

string s;

int main(){

mal

cin >> s;

ll ans = 0;
ll cnt = 0;

for(int i = 0; i < s.sz(); ++i) {

    if(s[i] == 'W') {ans += cnt;}
    else {cnt++;}

}

cout << ans;


return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN = 1012;
const ll MOD = 1e9+7;
ll n,m,g[MN][MN],dp[MN][MN];
ll dfs (int i, int j) {
    if (i == n or j == m) return 0;
    if (g[i][j] == 0) return 0;
    if (dp[i][j] > -1) return dp[i][j];
    ll& res = dp[i][j];
    return res = (dfs(i+1,j)%MOD + dfs(i,j+1)%MOD) % MOD;
}
int main (void) {
    memset(dp,-1,sizeof(dp));
    ios::sync_with_stdio(false);cin.tie(0);
    cin >> n >> m;
    for (ll i = 0; i < n; i++) {
        string s; cin >> s;
        for (ll j = 0; j < m; j++)
            g[i][j] = s[j] == '.';
    }
    dp[n-1][m-1] = 1;
    ll ans = dfs(0,0) % MOD;
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 16256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
//#define inf 2000000000
#define inf 8000000000000000000
#define pi 3.14159265358979323846264338328
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#define ykh mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a)
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;

inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=3005;
//i_am_noob
int n,l,a[maxn];
ld ansx=0,ansy=0;

struct point{ld x,y;}p[maxn],suf[maxn],cur,ans;
point rot(point p, ld theta){
    point ret;
    ret.x=p.x*cos(theta)-p.y*sin(theta),ret.y=p.y*cos(theta)+p.x*sin(theta);
    return ret;
}
point to_point(ld theta){
    point ret;
    ret.x=cos(theta),ret.y=sin(theta);
    return ret;
}
inline ld dist(point p1, point p2){return sqrt((p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y));}

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    cout << fixed << setprecision(15);
    cin >> n >> l;
    rep(n) cin >> a[i];
    ans.x=ans.y=suf[0].x=suf[0].y=0;
    rep(n) p[i].x=cos(2*pi*a[i]/l),p[i].y=sin(2*pi*a[i]/l);
    rep2(i,1,n+1) suf[i].x=suf[i-1].x+cos(pi*a[n-i]/l),suf[i].y=suf[i-1].y+sin(pi*a[n-i]/l);
    rep2(i,1,n+1) suf[i].x/=i,suf[i].y/=i;
    rep(n) rep2(j,i+1,n){
        cur=rot(suf[n-1-j],pi*(a[i]+a[j])/l/2+pi/2);
        cur.x*=dist(to_point(2*pi*a[i]/l),to_point(pi*(a[i]+a[j])/l)),cur.y*=dist(to_point(2*pi*a[i]/l),to_point(pi*(a[i]+a[j])/l));
        cur.x+=cos(pi*(a[i]+a[j])/l),cur.y+=sin(pi*(a[i]+a[j])/l);
        ans.x+=cur.x*(n-1-j),ans.y+=cur.y*(n-1-j);
    }
    ans.x/=n*(n-1)*(n-2)/6,ans.y/=n*(n-1)*(n-2)/6;
    print2(ans.x,ans.y);
    return 0;
}


Measured memory_bytes: 4408
#[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 s = scan_split::<i32>();
    s.sort();
    println!("{}", if s[0] + s[1] == s[2] { "Yes" } else { "No" });
}

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

const ll INF = 1e18;
const int MX = 2005;
ll dp[MX][MX];
inline void chmax(ll& a, ll b) {
  a = max(a, b);
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n+1)rep(j,n+1) dp[i][j] = -INF;
  dp[0][0] = 0;
  vector<P> p;
  rep(i,n) p.emplace_back(a[i],i);
  sort(p.rbegin(), p.rend());
  rep(i,n) {
    int pi = p[i].second;
    rep(l,i+1) {
      int r = i-l;
      chmax(dp[i+1][l+1], dp[i][l]+ll(pi-l)*a[pi]);
      chmax(dp[i+1][l], dp[i][l]+ll((n-r-1)-pi)*a[pi]);
    }
  }
  ll ans = 0;
  rep(i,n+1) chmax(ans, dp[n][i]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 35004
#include <bits/stdc++.h>
using namespace std;
string s;
int i;

signed main(){ 
  cin>>s;
  sort(s.begin(),s.end());

  for(i=0;i<s.length();i+=2){
    if(s[i]!=s[i+1]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int card[4][13];
  int maisuu;
  char gara;
  int rank;


  for(int i=0; i<4; i++) {
    for(int j=1; j<=13; j++){
      card[i][j] = 0;
    }
  }

  scanf("%d\n",&maisuu);

  for(int i=0; i<maisuu; i++){
    scanf("%c %d\n",&gara,&rank);
    if(gara == 'S'){
      card[0][rank-1] = 1;
    }else if(gara == 'H'){
      card[1][rank-1] = 1;
    }else if(gara == 'C'){
      card[2][rank-1] = 1;
    }else if(gara == 'D'){
      card[3][rank-1] = 1;
    }
  }

 for(int j=1;j<=13;j++) {
    if(card[0][j-1] != 1) {
      printf("S %d\n",j);
    }
  }
  for(int j=1;j<=13;j++) {
    if(card[1][j-1] != 1) {
      printf("H %d\n",j);
    }
  }
  for(int j=1;j<=13;j++) {
    if(card[2][j-1] != 1) {
      printf("C %d\n",j);
    }
  }
  for(int j=1;j<=13;j++) {
    if(card[3][j-1] != 1) {
      printf("D %d\n",j);
    }
  }

  return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;


int main(){
	string s;cin >> s;
	ll ans = 0;
	rep(dig,1<<s.size()-1){
		int ind = 0;
		ll sum = 0;
		rep(i,s.size()-1){
			if(dig>>i&1){
				sum += stol(s.substr(ind,i-ind+1));
				ind = i+1;
			}
		}
		sum += stol(s.substr(ind,s.size()-ind+1));
		//cout << sum << endl;
		ans += sum;
	}
	cout << ans << endl;
} 


Measured memory_bytes: 3592
using System;
class Program{
    static void Main(string[] args){
        string[] nt = Console.ReadLine().Split(' ');
        int n = int.Parse(nt[0]);
        int t = int.Parse(nt[1]);
        string[] tempT = Console.ReadLine().Split(' ');
        int[] time = new int[tempT.Length];
        for(int i=0;i<time.Length;i++){
            time[i] = int.Parse(tempT[i]);
        }
        int amount = 0;
        int timeline = 0;
        for(int i=0;i<time.Length;i++){
            if(i == time.Length - 1){
                amount += t;
                break;
            }
            if(timeline + t > timeline + (time[i+1] - time[i])){
                amount +=  time[i+1] - time[i];
                timeline += time[i+1] - time[i];
            }else{
                amount += t;
                timeline += t;
            }
        }
        Console.WriteLine(amount);
    }
}

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

int main(){
  int H,W;
  cin>>H>>W;
  vector<vector<char>> a(H,vector<char>(W));
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      cin>>a.at(i).at(j);
    }
  }
  vector<int> i_remove;
  vector<int> j_remove;
  
  for (int i=0; i<H; i++){
    bool flag=false;
    for (int j=0; j<W; j++){
      if (a.at(i).at(j)=='#'){
        flag=true;
      }
    }
    if (!flag){
      i_remove.push_back(i);
    }
  }
  
  for (int j=0; j<W; j++){
    bool flag=false;
    for (int i=0; i<H; i++){
      if (a.at(i).at(j)=='#'){
        flag=true;
      }
    }
    if (!flag){
      j_remove.push_back(j);
    }
  }

  for (int i=0; i<H; i++){
    bool flag_i=false;
    for (int j=0; j<W; j++){
      if ((find(i_remove.begin(),i_remove.end(),i)!=i_remove.end())||(find(j_remove.begin(),j_remove.end(),j)!=j_remove.end())){
      } else {
        cout<<a.at(i).at(j);
        flag_i=true;
      }
    }
    if (flag_i){
      cout<<endl;
    }
  }
}

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

int main(){
	while(1){
		int n, a[10000];
		long ans=0;
		
		scanf(" %d", &n);
		if(n==0) break;
		for(int i=0; i<n; ++i)
			scanf(" %d", &a[i]);
			
		sort(a, a+n);
		
		for(int i=0; i<n; ++i)
			ans+=a[i]*(n-i-1);

		printf("%ld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1240
S = raw_input()
ans = "Yes"

for i in range(1,len(S)+1):
  if i % 2 == 1 and S[i-1] == "L":
    ans = "No"
    break
  elif i % 2 == 0 and S[i-1] == "R":
    ans = "No"
    break
print ans

Measured memory_bytes: 2568
// This is not my original code!

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

ll gcd(ll a,ll b){
  // 条件式?もし真なら:偽なら;
  // 再帰関数、ユークリッド
  return b?gcd(b,a%b):a;
}

int main()
{
	ios::sync_with_stdio(false);
	ll a,b;
	cin>>a>>b;
	ll x=gcd(a,b),res=0;
	for(ll i=2;i*i<=x;i++){
		if(x%i==0)res++;
		while(x%i==0)x/=i; // 一回カウントしたからあとは割り切っちゃう
	}
	if(x>1)res++; // 最後に残った素因数分をカウント
	cout<<res+1<<endl; // 1もカウント
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, T, H, L;
		int t[], h[];

		n = sc.nextInt();
		T = sc.nextInt();
		H = sc.nextInt();
		L = sc.nextInt();
		t = new int[n];
		h = new int[n];
		for (int i = 0; i < n; i++) {
			t[i] = sc.nextInt();
			h[i] = sc.nextInt();
		}

		int id = 0;
		int z = 0;
		while (true) {
			if (0 < t[id]) {
				t[id]--;
				z += 10;
				T++;
			} else if (0 < h[id]) {
				h[id]--;
				z += 100;
				H++;
			} else {
				break;
			}
			if (L < T) {
				break;
			}
			if (90 <= z) {
				if ((z - 90) / 10 <= T) {
					t[id] += (z - 90) / 10;
					T -= (z - 90) / 10;
					z = 0;
				} else {
					break;
				}
			}
			id = (id + 1) % n;
		}

		System.out.println(id + 1);
	}
}

Measured memory_bytes: 20196
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
//#include <multiset>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;

int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int x;
    cin>>x;
    cout<<1-x;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define N 1005
using namespace std;

const int inf = 1e7;
char grid[N][N];
priority_queue<tuple<int,int,int>> q;
int dist[N][N], n, m, cx, cy, dx, dy;

bool isok(int i, int j){
    return (i>=1 && j>=1 && i<=n && j<=m && grid[i][j] != '#');
}

int main(){
    fastio();
    cin >> n >> m;
    cin >> cx >> cy;
    cin >> dx >> dy;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin >> grid[i][j];
            dist[i][j] = inf;
        }
    }

    dist[cx][cy] = 0;
    q.push({-dist[cx][cy],cx,cy});

    int x, y, d;
    int a[4] = {0,0,1,-1}, b[4] = {1,-1,0,0};
    while(q.size()){
        tie(d,x,y) = q.top(); q.pop();
        d*=-1; 
        if(grid[x][y] == '.'){
            grid[x][y] = '#';
            for(int i=0;i<4;i++){
                if(isok(x+a[i],y+b[i]) && dist[x+a[i]][y+b[i]]>d){
                    dist[x+a[i]][y+b[i]] = d;
                    q.push({-dist[x+a[i]][y+b[i]],x+a[i],y+b[i]}); 
                }
            }

            for(int i=-2;i<=2;i++){
                for(int j=-2;j<=2;j++){
                    if(isok(x+i,y+j) && dist[x+i][y+j]>d+1){
                        dist[x+i][y+j] = d+1;
                        q.push({-dist[x+i][y+j],x+i,y+j});
                    }
                }
            }
        }
    }
    
    if(dist[dx][dy]==inf)
        dist[dx][dy] = -1;

    cout << dist[dx][dy] <<'\n';

    return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;

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

int main()
{
    int n;
    cin >> n;
    int flag[9] = {};
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        a = min(a/400,8);
        flag[a]++; 
    }

    int mi = 0,ma;
    for(int i = 0; i < 8; i++){
        if(flag[i] != 0) mi++;
    }
    ma = mi+flag[8];
    if(mi == 0) mi = 1;

    cout << mi << ' ' << ma << endl;

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  string ans = "APPROVED";
  rep(i, n) {
    if(a.at(i) % 2 == 0 && (a.at(i) % 3 != 0 && a.at(i) % 5 != 0)) ans = "DENIED";
  }
  cout << ans << endl;
} 

Measured memory_bytes: 256
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int T = stdIn.nextInt();
		int E = stdIn.nextInt();
		int min = T - E;
		int max = T + E;
		List<Integer> time = new ArrayList<Integer>();
		for(int i = 0; i < N; ++i)
		{
			int t = stdIn.nextInt();
			time.add(t);
		}
		boolean okFlag = false;
		for(int i = 0; i < N; ++i)
		{
			if(okFlag)
			{
				break;
			}
			okFlag = false;
			int sum = time.get(i);
			while(sum <= max)
			{
				if(min <= sum)
				{
					System.out.println(i + 1);
					okFlag = true;
					break;
				}
				sum += time.get(i);
			}
		}
		if(!okFlag)
		{
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 12000
s = input()
h = int(s[0:2])
is_mmyy = (h >= 1) & (h <= 12)
t = int(s[2:4])
is_yymm = (t >= 1) & (t <= 12)

if is_mmyy & is_yymm:
    print('AMBIGUOUS')
elif is_yymm:
    print('YYMM')
elif is_mmyy:
    print('MMYY')
else:
    print('NA')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull B=950527;
int n,m;
char str[1000005];
ull a[1000005];
 
int main(){
  scanf("%s",str);
  n=strlen(str);
  for(int i=0;i<n;i++){
    a[i]=str[i];
    if(i)a[i]+=a[i-1]*B;
  }
  scanf("%s",str);
  m=strlen(str);
  ull key=0,num=0,C=1;
  for(int i=0;i<m;i++){
    key=key*B+str[i];
    C*=B;
  }
  for(int i=0;i<n;i++){
    num=a[i];
    if(i-m>=0)num-=C*a[i-m];
    if(key==num){
      printf("%d\n",i-m+1);
    }
  }
    
  return 0;
}

Measured memory_bytes: 12008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n-1+m), b(n-1+m), in(n);
  vector<vector<int>> G(n);
  for (int i = 0; i < n+m-1; ++i) {
    cin >> a[i] >> b[i];
    a[i] --, b[i] --;
    G[a[i]].push_back(b[i]);
    in[b[i]] ++;
  }

  int root = -1;
  int edge = n+m-1;
  for (int i = 0; i < n; ++i) {
    if (in[i] == 0) {
      root = i;
      break;
    }
  }

  queue<int> que;
  que.push(root);
  vector<int> dist(n);

  while (!que.empty()) {
    auto now = que.front();
    que.pop();

    for (auto to : G[now]) {
      chmax(dist[to], dist[now] + 1);
      in[to] --;
      if (in[to] == 0) {
        // 根の子の入次数は1だから必ずここには入る
        // 親に対しても有向辺を貼る可能性はないので途中で探索が終わることもない
        que.push(to);
      }
    }
  }

  vector<int> ans(n, 0);
  for (int i = 0; i < n; ++i) {
    for (auto&& to : G[i]) {
      if (dist[to] - dist[i] == 1) {
        ans[to] = i+1;
      }
    }
  }

  for (auto it : ans) {
    cout << it << endl;
  }
}

Measured memory_bytes: 8192
S = str(input())
S_1 = []
for i in range((len(S)-1)//2):
    S_1.append(S[i])
S_2 = []
for j in range(len(S) - (len(S)+3)//2 +1):
    S_2.append(S[(len(S)+3)//2 - 1 + j])
s = []
for k in range(len(S)):
    s.append(S[k])
if list(s) == list(reversed(s)):
    if list(S_1) == list(reversed(S_1)):
        if S_2 == list(reversed(S_2)):
            print('Yes')
            exit()
print('No')


Measured memory_bytes: 3064
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
i=0
ans=0

while i<N:
  A = list(map(int, input().split()))
  j=0
  sum=0
  while j<M:
    sum += A[j]*B[j]
    j+=1
  if sum+C>0:
    ans+=1
  i+=1

print(ans)

Measured memory_bytes: 3064
def counting_sort(a, b, k)
  c = []
  (0..k).each do |i|
    c[i] = 0
  end

  (0..a.size-1).each do |j|
    c[a[j]] += 1
  end

  (1..k).each do |i|
    c[i] = c[i] + c[i-1]
  end

  (a.size-1).downto(0) do |j|
    b[c[a[j]]-1] = a[j]
    c[a[j]] -= 1
  end
end

a = []
b = []
n = gets.to_i
a = gets.split.map { |i| i.to_i }

counting_sort(a, b, a.max)
puts b*' '

Measured memory_bytes: 218108
#include <bits/stdc++.h>
using namespace std;
// (setq-default c-basic-offset 2)

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

  int Amax = INT_MIN;
  vector<int> A(n);
  for (int& Ai : A) {
    cin >> Ai;
    Amax = max(Amax, Ai);
  }

  vector<int> cnt(Amax + 1);
  for (int Ai : A) {
    if (cnt[Ai] != 0) {
      cnt[Ai] = 2;
      continue;
    }
    for (int e = Ai; e <= Amax; e += Ai) {
      cnt[e]++;
    }
  }
  int ret = 0;
  for (int Ai : A) {
    if (cnt[Ai] == 1) {
      ++ret;
    }
  }
  cout << ret << endl;
  return 0;
}

/*

#include <bits/stdc++.h>
using namespace std;
// (setq-default c-basic-offset 2)

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

  int Amax = INT_MIN;
  vector<int> A(n);
  for (int& Ai : A) {
    cin >> Ai;
    Amax = max(Amax, Ai);
  }

  vector<int> table(Amax + 1);
  for (int Ai : A) {
    for (int e = Ai; e <= Amax; e += Ai) {
      table[e]++;
    }
  }

  int ret = 0;
  for (int Ai : A) {
    if (table[Ai] == 1) {
      ++ret;
    }
  }

  cout << ret << endl;
  return 0;
}

*/


Measured memory_bytes: 7920
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

// index が条件を満たすかどうか
int main() {
	int n, m;
	cin >> n >> m;
	if (n == m) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

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

int main(){
  int N,K,n;
  cin>>N>>K;
  n=1;
  for(int i=0;i<N;i++){
    if(n<=K){
       n*=2;
    }
    else n+=K;
  }
  cout<<n<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define NUM 4

int main(void)
{
  int n[NUM][2];
  int i;
  for(i=0;i<NUM;i++){
    scanf("%d %d",&n[i][0],&n[i][1]);
    switch(n[i][0]){
    case 1:
      n[i][1] *= 6000;
      break;
    case 2:
      n[i][1] *= 4000;
      break;
    case 3:
      n[i][1] *= 3000;
      break;
    default:
      n[i][1] *= 2000;
      break;
    }
  }
  for(i=0;i<NUM;i++)
    printf("%d\n",n[i][1]);
  return 0;
}

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

int main(){
    string rev = "AIDUNYAN";
    sort(rev.begin(), rev.end());

    string d;
    cin >> d;

    for(int i=0; i < d.size(); i++){
        string dd = d.substr(i, rev.size());
        sort(dd.begin(), dd.end());
        if(rev == dd){
            d.replace(i, rev.size(), "AIZUNYAN");
            i += rev.size()-1;
        }
    }
    cout << d << endl;
}

Measured memory_bytes: 1216
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int A = sc.nextInt();
		if (X < A) {
			System.out.println(0);
		}
		else {
			System.out.println(10);
		}
	}
}


Measured memory_bytes: 22996
def examD():
    St = S()
    N = len(St)
    ans = [-1, -1]
    for lower in range(N - 1):
        if St[lower] == St[lower + 1]:
            ans = [lower+1, lower + 2]
            break
        elif lower < N - 2 and St[lower] == St[lower + 2]:
            ans = [lower+1, lower + 3]
            break

    print(" ".join(map(str, ans)))

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()

Measured memory_bytes: 39280
//abc167_a.cpp
//Sun May 10 20:56:11 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

int main(){
	string s,t;
	cin >> s >> t;

	int flag = 1;
	for (int i=0;i<s.length();i++){
		if (s[i]!=t[i]){
			flag = 0;
		}
	}

	if (flag){
		cout << "Yes" << endl;
	}else {
		cout << "No" << endl;
	}
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
void sort2array(double *a,long *b,long n){
    for(int i=0;i<n;i++){
        b[i]=i;
    }
    sort(b,b+n,[a](long i,long j)->bool {return a[i]<a[j];} );
}
//bを何回足せばaを超えるか
int wtover(int a,int b){
    if(a%b>0)return (a/b)+1;
    else return a/b;
}
const int INF=100000001,ID_MAX=20;
int bi_e[ID_MAX]={0};
//2進数表示したときの最高桁
int bi_max(long n){
    int m=0;
    for(m;pow(2,m)<=n;m++);m=m-1;
    return m;
}
//bi_eに二進数表示したやつを代入
void bi_exs(long n){
    rep(i,ID_MAX){
        bi_e[i]=0;
    }
    if(n<pow(2,ID_MAX)){
        int m=bi_max(n);
        long l;
        for(m;m>-1;m--){
            l=pow(2,m);
            bi_e[m]=n/l;
            n=n%l;
        }
    }
}
//x^n mod m (nが負の時は０)
long myPow(long x, long n, long m){
  if(n<0)return 0;
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}
const int N=200001;
int a[N],n,dp[N];

int main(){
    long int i,cou=0;
    //入力
    cin>>n;
    rep(i,n)cin>>a[i];
    //処理
    /*rep(i,n){
        long res;
        if(i==0)res=0;
        else if(i>=a[i]){
            for(int j=i-a[i];j>=0;j--){
                if(i-j==a[j]+a[i])cou++;
            }
        }
    }*/
    long int r[n],l[n];
    rep(i,n){
        l[i]=a[i]+i;
        r[i]=i-a[i];
    }
    sort(l,l+n);
    rep(i,n){
        long *a=lower_bound(l,l+n,r[i]),*b=upper_bound(l,l+n,r[i]);
        if(*a==r[i])*b==r[i]?cou=cou+(b-a)+1:cou=cou+(b-a);
    }
    //出力
    cout<<cou<<endl;
}

Measured memory_bytes: 7508
#!/usr/bin/env python3

import collections


def count_anagrams(n, ss):
    ctr = collections.Counter("".join(sorted(s)) for s in ss)
    res = sum(v * (v - 1) // 2 for v in ctr.values())
    return res


def main():
    n = int(input())
    ss = [input() for _ in range(n)]
    res = count_anagrams(n, ss)
    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 25324
using System;
using System.Linq;

namespace ConsoleApp8
{
	class Program
	{
		static void Main(string[] args)
		{
			// ごりら
			int sum = 0;
			var str = Console.ReadLine().Split(' ');
			int n = int.Parse(str[0]);
			int a = int.Parse(str[1]);
			int b = int.Parse(str[2]);
			int temp = 0;
			int temp2 = 0;
			for (int i = n; i > 0; i--)
			{
				temp2 = i;
				temp = 0;
				while (true)
				{
					temp += temp2 % 10;
					temp2 /= 10;
					if (temp2 == 0)
						break;
				}
				if (a <= temp && b >= temp)
					sum += i;
			}
			Console.WriteLine(sum);
		}
	}
}


Measured memory_bytes: 11092
s=list(map(int,input().split()))
t=[list(map(int,input().split())) for i in range(s[1])]
a=''
b=0
u=list(map(list,set(map(tuple,t))))
u=(sorted(u,key=lambda x: x[0]))
x=[0]*s[0]
for i in range(len(u)):
  c=t[i][0]-1
  if x[c]==0:
    x[c]+=t[i][1]+10
  else:
    b=1
if b==1:
  print(-1)
else:
  if len(x)>=2 and x[0]==10:
    print(-1)
  else:
    if len(x)==1 and (x[0]==10 or x[0]==0):
      print(0)
    else:
      x.reverse()
      for j in range(s[0]):
        if x[j]==0:
          if j+1==s[0]:
            a='1'+a
          else:
            a='0'+a
        else:
          x[j]=x[j]-10
          if j+1==s[0] and x[j]==0:
            a='1'+a
          else:
            a=str(x[j])+a
      print(a)

Measured memory_bytes: 3064
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

func Solve() {
  var N int
  NextInt(&N)
  var A []int
  NextIntVec(&A)
  T := make([][]int, N)
  var u, v int
  for i := 1; i < N; i++ {
    NextInt(&u, &v)
    u--
    v--
    T[u] = append(T[u], v)
    T[v] = append(T[v], u)
  }
  P := make([]int, N)
  DP := make([]int, N)
  limit := MaxInt(A...) + 1
  L := make([]int, N + 1)
  for i := range L[1:] { L[i + 1] = limit }
  var DFS func(u int)
  DFS = func(u int) {
    gta, lta := N, 0
    idx := -1
    for 1 < gta - lta {
      med := (gta + lta) / 2
      if L[med] == A[u] {
        idx = med
        break
      }
      if L[med] < A[u] {
        lta = med
      } else {
        gta = med
      }
    }
    if idx < 0 { idx = gta }
    val := L[idx]
    L[idx] = A[u]
    DP[u] = MaxInt(idx, DP[P[u]])
    for _, v := range T[u] {
      if v == P[u] { continue }
      P[v] = u
      DFS(v)
    }
    L[idx] = val
  }
  DFS(0)
  for _, dp := range DP {
    Write(dp)
  }
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

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

int main(){
  int n; cin >> n;
  int h[25];
  for (int i = 0; i < n; i++){
    cin >> h[i];
  }
  int m = 0, ans = 0;
  for (int i = 0; i < n; i++){
    if (h[i] >= m) ans++;
    m = max(m, h[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256