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

struct Point {
  int t;
  int x;
  int y;
};

int calc_distance(Point p, Point q) {
  return abs(p.x - q.x) + abs(p.y - q.y);
}

int main() {
  int n;
  cin >> n;
  vector<Point> v(n + 1);
  v.at(0) = {0, 0, 0};
  for (int i = 1; i < n + 1; ++i) {
    auto& e = v.at(i);
    cin >> e.t;
    cin >> e.x;
    cin >> e.y;
  }

  string res = "Yes";
  Point prevP = v.at(0);
  for (int i = 1; i < n + 1; ++i) {
    Point p = v.at(i);
    int diff = (p.t - prevP.t) - calc_distance(p, prevP);
    if (!(diff >= 0 && diff % 2 == 0)) {
      res = "No";
      break;
    }
    prevP = p;
  }

  cout << res << endl;
}


Measured memory_bytes: 1408
#include<iostream>
#include<bits/stdc++.h>
#include<vector>
#define vi vector<int>
#define lli long long int
#define fo(i,n) for(int i=1;i<=n;i++)
#define foo(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
#define vii vector<lli>

#define ok ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#define vp vector<pair<lli,lli>>
#include <map>           
lli mod=1000000007;      

vi r(300003),c(300003);   

int main(){
   int a,b,c,k;
   cin>>a>>b>>c>>k;
   if(a>=b){
   while(a>=b){
   	b*=2;
   	k--;
   }
   }
   if(c<=b){
   	while(c<=b){
   		c*=2;
   		k--;
	   }
   }
  if(k>=0) cout<<"Yes";
  else cout<<"No";
}

/*int main(){
	lli n,k;
	lli prod=1,temp;
	cin>>n>>k;
	vii v(n);
	vii t;
	vi ans;
	foo(i,n) cin>>v[i];
	foo(i,k) prod*=v[i];
	temp=prod;
	int d=0;
	for(int i=k;i<n;i++){
		prod/=v[d];
		prod*=v[i];
		t.pb(prod);
		d++;
	}
	if(temp<t[0]) ans.pb(1);
	else ans.pb(0);
	for(int i=1;i<t.size();i++){
		if(t[i]>t[i-1])
		ans.pb(1);
		else ans.pb(0);
	}
	
	foo(i,t.size()) cout<<t[i]<<" ";
	foo(i,ans.size()){
		if(ans[i]) cout<<"Yes\n";
		else cout<<"No\n";
	}
}*/


Measured memory_bytes: 5424
import java.util.*;
 
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		
		if(a>=1&&b>=1&&9>=a&&9>=b) {
			System.out.println(a*b);
		}else {
			System.out.println(-1);
		}

		
 
		sc.close();
	}
}

Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

using namespace std;
int main(){
    int N;
    int M;
    cin >>N>>M;

    int A[M+1]={};
int k;
int a;
for(int i=1;i<=N;i++){

cin >>k;
for(int l=0;l<k;l++){
    cin >> a;
A[a]++;
}

}
    int ans=0;
    for(int i=1;i<=M;i++){
        if(A[i]==N){
            ans++;
        }
    }

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

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int r;
	while(scanf("%d",&r)!=EOF)
	{
		if(r>=0&&r<1200)
	    	printf("ABC\n");
	    else if(r>=1200&&r<2800)
	            printf("ARC\n");
	        else if(r>=2800&&r<=4208)
	                printf("AGC\n");
	    
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include<cstdint>
#define MAX 9223372036854775807
using namespace std;
struct Edge {
	int to, cost;
	Edge(int to, int cost) : to(to), cost(cost) {}
};

vector<vector<Edge> > graph;
vector<int64_t> dist;
vector<bool> distInf;

void bellman_ford(int n) {
	dist = vector<int64_t>(n, MAX);
	distInf = vector<bool>(n, false);
	dist[0] = 0;
	for (int i = 0;i < n;i ++) {
		for (int j = 0;j < n;j ++) {
			for (int k = 0;k < graph[j].size();k ++) {
				Edge e = graph[j][k];
				if (dist[j] != MAX && dist[e.to] > dist[j] + e.cost) {
					dist[e.to] = dist[j] + e.cost;
					if (i == n - 1) {
						distInf[e.to] = true;
					}
				}
			}
		}
	}
	
	for (int i = 0;i < n;i ++) {
		for (int j = 0;j < n;j ++) {
			for (int k = 0;k < graph[j].size();k ++) {
				Edge e = graph[j][k];
				if (dist[e.to] > dist[j] + e.cost) distInf[e.to] = true;
			}
		}
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	graph = vector<vector<Edge> >(N);
	for (int i = 0; i < M;i ++) {
		int a, b, c;
		cin >> a >> b >> c;
		graph[-- a].push_back(Edge(-- b, 0 - c));
	}
	bellman_ford(N);
	
	if (distInf[N-1]) cout << "inf";
	else cout << 0 - dist[N - 1];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main() { 
    ll n;
    cin >> n;
    ll a = 100, cut = 0;
    if (a == n) {
        cout << 0 << endl;
        return 0;
    }
    while (a < n) {
        cut++;
        ll b = a * 0.01;
        a += b;
    }
    cout << cut << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;

int main() {
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    vector<string> a(n), b(n);
    string g,d;
    REP(i,n)cin>>a[i]>>b[i];
    cin>>g>>d;
    queue<pair<int,string>> q;
    q.push(make_pair(0,g));
    int res = -1;
    while(!q.empty()) {
      int m; string s;
      tie(m,s) = q.front(); q.pop();
      if (m > d.size()) {
        break;
      } else if (s == d) {
        res = m;
        break;
      } else {
        REP(i,n) {
          string cp = s;
          int j = 0;
          while ((j = cp.find(a[i], j)) != string::npos) {
            cp.replace(j, a[i].size(), b[i]);
            j += b[i].size();
          }
          if (cp != s) q.push(make_pair(m+1, cp));
        }
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 10860
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define ll unsigned long long int
#define test long int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
#define mm 1000000007

bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int binaryExponentiation(int x, int n) //function to calculate x raise to power n
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x;
		x = x * x;
		n = n / 2;
	}
	return result;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-______________________________________________________________________________

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	while (c != 0 || a != 0)
	{
		c = c - b;
		if (c <= 0)
		{
			cout << "Yes" << en;
			break;
		}
		a = a - d;
		if (a <= 0) {
			cout << "No" << en;
			break;
		}
	}

	return 0;
}


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

typedef long long ll;

int main() {
	// your code goes here
	ll n;
	cin>>n;
	
	ll a[n];
	for(int i=0;i<n;i++){
	    cin>>a[i];
	}
	
	ll count=0;
	ll m=INT_MIN;
	for(int i=0;i<n;i++){
	    if(a[i]>=a[i+1]){
	        count++;
	    }
	    if(a[i]<a[i+1]){
	         m=max(m,count);
	        count=0;
	    }
	   
	}
	 m=max(m,count);
	cout<<m<<endl;
	return 0;
}


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

namespace aziz
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] XY = Console.ReadLine().Split(' ');
            int X = int.Parse(XY[0]);
            int Y = int.Parse(XY[1]);
            int legs;
            string result = "No";
            for(int i=0; i<=X; i++)
            {
               legs = 2 * i + ( X - i ) * 4;
               if(legs == Y)
               {
                   result = "Yes";
                   break;
               }
            }
            Console.WriteLine(result);
        }
    }
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

signed main()
{
  char c; cin >> c;
  cout << (char)(c + 1) << endl;
  return 0;
}


Measured memory_bytes: 256
/*
welcome to my code           hi from    s_agnik1511 
Don't just copy it.
Analyze it.
coz that's what heroes do.....
*/
#include<bits/stdc++.h>
#include<algorithm>
#include<string.h>
#include<numeric>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
#define dude             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mesc(number,character)   char f[number];memset(f,character,number);
#define mesi(number,value)   int f[number];memset(f,value,number);
#define specio           ifstream cin("input.txt");ofstream cout("output.txt");
#define fr(i,start,end)  for(i=start;i<=end;i++)
#define rf(i,start,end)  for(i=start;i>=end;i--)
#define tst              int t;cin>>t;while(t--)
#define ai               ll n,i;cin>>n;ll a[n];
#define pi               3.14159265358979323846
#define ll               long long int
#define acc              accumulate
#define ld               long double
#define pb               push_back
#define r0               return 0;
#define pp               pop_back
#define vec              vector
#define sec              second
#define S                string
#define D                double
#define len              length
#define br               break;
#define wh               while
#define fs               first
#define F                float
#define gcd              __gcd
#define sz               size
#define endl              "\n"
#define sp              " "
const ll ifn=-1000000000000000000;
const ll inf=1000000000000000000;
const int N=100000;
ll arr[1000005],n,a[1000005],k;
ll frog(ll i) {
    if(i==n-1) {
        return 0;
    }
    else if(i>n-1) {
        return INT_MAX;
    }
    else {
        if(arr[i]!=-1) {
            return arr[i];
        }
        else {
        //ll r,l;
        //l=abs(a[i]-a[i+1])+frog(i+1);
        //r=INT_MAX;r=abs(a[i]-a[i+2])+frog(i+2);
          ll cnt=INT_MAX,j;
          fr(j,1,k) {
            cnt=min(cnt,abs(a[i]-a[i+j])+frog(i+j));
          }
        return arr[i]=cnt;
        }
    }
}

int main() {
    dude
    memset(arr,-1,1000005);
    cin>>n>>k;
    ll i;
    fr(i,0,n-1) {
        cin>>a[i];
    }
    cout<<frog(0);
   r0
}


Measured memory_bytes: 13068
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  int k, x;
  cin >> k >> x;
  int sum = 500 * k;
  if(sum >= x) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
program main

        implicit none
        integer L, tmpL, digit, c
        integer i, t
        logical k(20)

        read(*,*) L
        tmpL = L

        c = 0
        do i=1,20
          k(i) = .false.
        enddo

        digit = 1
        do
          if ( tmpL .eq. 0 ) goto 100
          if ( iand(tmpL,1) .ne. 0 ) then
            k(digit) = .true.
            c = c + 1
          endif
          tmpL = ishft(tmpL, -1)
          digit = digit + 1
        enddo
100     continue

        write(*, '(I0,X,I0)') digit-1, (digit-2)*2+(c-1)


        t = 1
        do i=1, digit-2
          write(*, '(I0,X,I0,X,I0)') i, i+1, 0
          write(*, '(I0,X,I0,X,I0)') i, i+1, t
          if ( k(i) .eqv. .true. ) then
            write(*, '(I0,X,I0,X,I0)') i, digit-1, L-t
            L = L - t
          endif
          t = ishft(t, 1)
        enddo

      end

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
int main(void){
    // Your code here!
    double a,b,c,d,h,s,l;
    
    cin >> a >> b >> c;
    
    s = 0.5*a*b*sin(M_PI*c/180);
    d = sqrt(a*a + b*b - 2*a*b*cos(M_PI*c/180));
    l=a+b+d;
    h = 2*s/a;
    
    cout << fixed << setprecision(10) << s << endl;
    cout << fixed << setprecision(8) << l << endl;
    cout << fixed << setprecision(8) << h << endl;
    
}



Measured memory_bytes: 3492
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
		int m = sc.nextInt();
        int[] list = new int[n];
        for(int i = 0; i < m; i++) {
          list[sc.nextInt() - 1]++;
          list[sc.nextInt() - 1]++;
        }
    
		for(int i = 0; i < n; i++) {
          // 出力
		  System.out.println(list[i]);
        }
	}
}

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

//#define int long long
#define DBG 0
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) c.begin(),c.end()
static const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
static const int MOD = (int)(1e9 + 7);

//????????????
class Dice {
private:
	map<char, string> mp;
public:
	//string d = "UFRLBD";
	string d = "RENSWL";
	vector<int> v; //UFRLBD:123456
	Dice(vector<int> v) :v(v) {
		mp[d[0]] = "2354";
		mp[d[1]] = "1463";
		mp[d[2]] = "1265";
		mp[d[3]] = "1562";
		mp[d[4]] = "1364";
		mp[d[5]] = "2453";
	};
	void roll(int a) { roll(d[a]); }
	void roll(char c) { roll(mp[c]); }
	void roll(string s) {
		int tmp = v[s[0] - '1'];
		rep(i, 1, s.size())v[s[i - 1] - '1'] = v[s[i] - '1'];
		v[s[s.size() - 1] - '1'] = tmp;
	}
	bool operator==(const Dice &D)const { return v == D.v; }
};

signed main() {
	vector<int> v1(6); rep(i, 0, 6) { cin >> v1[i]; }
	vector<int> v2(6); rep(i, 0, 6) { cin >> v2[i]; }
	Dice D1(v1), D2(v2);
	rep(i, 0, 1000) {
		if (D1 == D2) {
			cout << "Yes" << endl;
			return 0;
		}
		D2.roll(rand() % 6);
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

// 三分探索
template<typename T, typename F>
pair<T, T> tsearch(T lower, T upper, ll max_loop, F f) {
	REP(_, max_loop) {
		T nl = (lower * 2 + upper) / 3;
		T nu = (lower + upper * 2) / 3;
		if (f(nl) < f(nu)) { // 最小値探索の場合は < にする
			upper = nu;
		} else {
			lower = nl;
		}
	}

	return{ lower, upper };
}

template<typename F> ll bsearch(ll ok, ll ng, F f) {
	while (abs(ok - ng) > 1) {
		ll middle = (ok + ng) / 2;
		(f(middle) ? ok : ng) = middle;
	}
	return ok;
}

int main() {
	#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
	#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	ll n; cin >> n;
	FOR(i, 1, TEN(5)) {
		if (i * (i + 1) / 2 >= n) {
			cout << i << endl;
			return 0;
		}
	}

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<stack>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;
ll INF = 1e18;

vector<pair<long long, long long> > res;

int main() {
	int n;
	cin >> n;
	vector<ll> a(n), b(n);
	rep(i, n) cin >> a[i] >> b[i];
	if (n % 2 == 1) {
		sort(a.begin(), a.end());
		sort(b.rbegin(), b.rend());
		int k = n / 2;
		ll mi = a[k];
		ll ma = b[k];
		cout << ma - mi + (ll)1 << endl;
	}
	else {
		int k = n / 2;
		sort(a.begin(), a.end());
		sort(b.rbegin(), b.rend());
        long double mi=(long double)(a[k-1]+a[k])/(long double)2;
        long double ma=(long double)(b[k-1]+b[k])/(long double)2;
        cout<<(ll)((ma-mi)*(long double)2+(long double)1)<<endl;
	}
}


Measured memory_bytes: 6376
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;
const int maxn=2e5+7;
set<int> s;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    cout<<s.size()<<endl;
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    if(n%1000 == 0) cout << 0 << endl;
    else cout << 1000 - n%1000 << endl;
    return 0;
}


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

int main()
{
    int n,a,b;
    cin>>n;
    a=n%10;
    if (a==9)
        cout<<"Yes"<<endl;
    else
    {
        n=n/10;
        b=n%10;
        if (b==9)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


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

int main(){
    int n,c;
    cin>>n>>c;
    int cake[c];
    n++;
    int sum=0;
    int ans=0;


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

    for(int i=0;i<c;i++){
        sum += cake[i];
    }

    ans = sum/n;

    if(sum - (ans*n)> 0)ans++;

    cout<<ans<<endl;


    return 0;
}



Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	int n;
	cin >> n;
	vector<string> s(n);
	rep(i, n) cin >> s[i];
	map<string, int> mp;
	rep(i, n) mp[s[i]]++;
	int mx = 0;
	for (auto i : mp) chmax(mx, i.second);
	for (auto i : mp) {
		if (i.second == mx) cout << i.first << '\n';
	}
}

Measured memory_bytes: 25472
#include<stdio.h>
#include<string.h>
int main()
{
    char s[15000];
    int N,i,j;
    scanf("%d",&N);
    scanf("%s",s);
    j=strlen(s);
    for(i=0;i<j;i++)
    {

        if(s[i]+N>'Z')
            s[i]=s[i]+N-26;
        else s[i]=s[i]+N;

    }
    printf("%s",s);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
 
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define V vector<int>
 
#define pb(a) push_back(a)
#define mp make_pair
 
int main(){
 
  int n,k;scanf("%d%d",&n,&k);
  V a(n);REP(i,n)scanf("%d",&(a[i]));
  sort(ALL(a),greater<int>());
  vector<bitset<5001>> table(n);
  REP(i,n)table[i].set(i);
  vector<bitset<5001>> dp(k,~bitset<5001>());
  dp[0] = ~dp[0];
  REP(i,n)
    for(int j=k-1;j>=a[i];j--)
      if(!dp[j-a[i]][5000])
        dp[j] &= (dp[j-a[i]] | table[i]);
  int cou = n;
  REP(i,n)FOR(j,max(0,k-a[i]),k)if(!dp[j][i]){cou--;break;}
  printf("%d",cou);
 
	return 0;
}


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

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < 10; i++) {
    if (n % i == 0 and (n / i) < 10) {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

typedef long long ll;

using namespace std;

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	int ans = 0;
	if(b<c) {
		ans = b+min(a+b+1,c);
	}else {
		ans = b+c;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin>>n;
  vector<int> a;
  for(int i=0;i<n;i++){
    int tmp;
    cin>>tmp;
    a.push_back(tmp);
  }
  int now=0;
  int next=a[0]-1;
  int count=1;
  if(a[0]==2){
    cout<<count<<endl;
  }else{
    a[0]=0;
    for(int i=0;i<n;i++){
      now=next;
      count++;
      if(a[now]==2){
        cout<<count<<endl;
        break;
      }else if(a[now]==0){
        cout<<-1<<endl;
        break;
      }else{
        next=a[now]-1;
        a[now]=0;
        }
    }
  }
  return 0;
}


Measured memory_bytes: 892
N, K =map(int, input().split())

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

mod=10**9 +7
count=0
for i in range(N):
  for j in range(i+1, N):
    if A[i]>A[j]:
      count+=K
  for k in range(N):
    if A[i]>A[k]:
      count+=(K-1)*K//2
  

print(int(count%mod))

Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define abs(x) ((x) > 0 ? (x) : -(x))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9 + 7
#define endl printf("\n")
typedef long long ll;

int sort(const void *a, const void *b){
  int A = *(int *)a, B = *(int *)b;
  if(A > B) return  1;
  if(A < B) return -1;
  return 0;
}

int
main(int argc, char *argv[])
{
  char s[100001];
  scanf("%s", s);

  int a[100000];
  int n = strlen(s);
  int k = 0;
  for(int i = 0; i < n - 1; i++){
    if(s[i] != s[i + 1]) a[k++] = i;
  }

  a[k++] = n - 1;

  int b[100000] = {};
  

  for(int i = 0; i < k/2; i++){
    if(i == 0){
      for(int j = 0; j <= a[1]; j++){
	if(abs(a[0] - j) % 2 == 1) b[a[0] + 1]++;
	else b[a[0]]++;
      }
    }
        else{
      for(int j = a[2 * i - 1] + 1; j <= a[2 * i + 1]; j++){
	if(abs(a[2 * i] - j) % 2 == 1) b[a[2 * i] + 1]++;
	else b[a[2 * i]]++;
	}
	}
  }

  for(int i = 0; i < n; i++) printf("%d ", b[i]); endl;

  return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        scanf("%d", &arr[i]);
    }
    return 0;
}

#define NUM_MAX 100000
#define K_MAX 100000
#define INF (NUM_MAX+1)

int main(void) {
    int num, ulimit;
    int arr[NUM_MAX];
    get_int2(&num, &ulimit);

    fget_array(arr, num);

    int left;
    int right = 0;
    static int map[K_MAX+1];
    int cnt = 0;
    int ans = INF;

    for(left = 0; left < num; left++) {
        for(; right < num; right++) {
            if(cnt == ulimit) break;
            int cur = arr[right];
            if(cur > ulimit) continue; // ignore map
            if(!map[cur]) cnt++;
            map[cur]++;
        }
        if(cnt != ulimit) break;
        ans = min(ans, right - left);
        map[arr[left]]--;
        if(!map[arr[left]]) cnt--;
    }

    printf("%d\n", ans == INF ? 0 : ans);
    
    return 0;
}


Measured memory_bytes: 2504
#[allow(unused_macros)]
macro_rules! invec {
    ( $t:ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s.trim().split_whitespace().map(|s| s.parse::<$t>().unwrap()).collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }}
}

#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($(
            {
                 splits.next().unwrap().parse::<$t>().unwrap()
            },
        )*)
    }}
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (s,) = input!(String);

    let sv: Vec<char> = s.chars().collect();

    let mut left = 0;
    let mut right = sv.len() - 1;
    let mut count = 0;

    loop {
        if right <= left {
            break;
        } else if sv[left] == sv[right] {
            left += 1;
            right -= 1;
        } else if sv[left] == 'x' && sv[right] != 'x' {
            left += 1;
            count += 1;
        } else if sv[right] == 'x' && sv[left] != 'x' {
            right -= 1;
            count += 1;
        } else {
            println!("{}", -1);
            std::process::exit(0);
        }
    }

    println!("{}", count);

}

fn main() {
    solve();
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
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))
template <class T> vector<T> make_vec(size_t a, T val) {
    return vector<T>(a, val);
}
template <class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec(ts...))>(a, make_vec(ts...));
}
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
template <typename T> struct edge {
    int to;
    T cost;
    edge(int t, T c) : to(t), cost(c) {}
};
template <typename T> using WGraph = vector<vector<edge<T>>>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    int R, S, P;
    cin >> R >> S >> P;
    string T;
    cin >> T;
    auto dp = make_vec(N + 1, 3, 0LL);
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < 3; k++) {
                if(i - K >= 0 && k == j)
                    continue;
                int point = 0;
                if(k == 0) {
                    if(T[i] == 's')
                        point = R;
                } else if(k == 1) {
                    if(T[i] == 'r')
                        point = P;
                } else if(k == 2) {
                    if(T[i] == 'p')
                        point = S;
                }
                dp[i][k] =
                    max(dp[i][k], (i - K >= 0 ? dp[i - K][j] : 0) + point);
            }
        }
    }
    ll res = 0;
    for(int i = N - 1; i >= N - K; i--) {
        ll tmp = 0;
        for(int j = 0; j < 3; j++) {
            tmp = max(tmp, dp[i][j]);
        }
        res += tmp;
    }
    cout << res << endl;
}

Measured memory_bytes: 8780
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
map<string,int> m;
string s;
while(n--)
{
cin>>s;
m[s]++;
}
cin>>n;
while(n--)
{
    cin>>s;
    m[s]--;
}
int ans=0;
for(auto x:m)
{
    ans=max(ans,x.second);
}
cout<<ans;
return 0;
}
 


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 1952
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = LLONG_MAX / 3;
const double eps = (1e-9);

//組み合わせの数nCrを計算
ll calcNumOfCombination(ll n, ll r){
  ll num = 1;
  for(ll i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

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

  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a[i];
    a[i] %= m;
  }
  vector<ll> s(n+1, 0);
  rep(i, n) {
    s[i+1] = (s[i] + a[i]) % m;
  }
  map<ll, ll> mp;
  for (auto& v : s) {
    mp[v]++;
  }
  ll ans = 0;
  for (auto& p : mp) {
    if (p.second > 1) ans += calcNumOfCombination(p.second, 2);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define qwq(x) cerr<<"# "<<#x<<" = "<<x<<endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=100005;
int d[N],vis[N],n,m,a,b,c,t,A,B;
vi e[N];

void dfs(int u,int c){
	vis[u]|=c;
	for(auto v:e[u]){
		if(v==A||v==B||(vis[v]&c))continue;
		dfs(v,c);
	}
}

bool chk(){
	rep(i,1,n)
		if(d[i]==4){
			if(!A)A=i;
			else B=i;
		}
	dfs(A,1),dfs(B,2);
	rep(i,1,n)
		if(i!=A&&i!=B&&vis[i]!=3)
			return 0;
	return 1;
}

int main(){
	read(n),read(m);
	rep(i,1,m){
		read(a),read(b);
		d[a]++,d[b]++;
		e[a].pb(b),e[b].pb(a);
	}
	rep(i,1,n){
		if(d[i]&1)return puts("No"),0;
		c+=d[i]-2; t+=(d[i]>2);
	}
	if(c<4)return puts("No"),0;
	if(t!=2)return puts("Yes"),0;
	if(m==n+2&&chk())puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 7296
S = input()

if "N" in S:
    if "S" not in S:
        print("No")
    elif "E" in S:
        if "W" not in S:
            print("No")
        else:
            print("Yes")
    else:
        if "W" in S:
            print("No")
        else:
            print("Yes")


else:
    if "S" in S:
        print("No")
    elif "E" in S:
        if "W" not in S:
            print("No")
        else:
            print("Yes")
    else:
        if "W" in S:
            print("No")
        else:
            print("Yes")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define pb push_back
#define pob pop_back
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
#define all(x) x.begin(), x.end()
#define M_PI 3.14159265358979323846
#define epsilon (double)(0.00000000001)
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
    return;
}
ll powe[200005];
void power()
{
    powe[0]=1;
    REP(i,1,200005)
    {
        powe[i]=mymod(2*powe[i-1],num);
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
}
ll n; 
struct node
{
	vll adj;
    ll dist;
   // ll max_depth;
    ll cwgd;
};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    cout<<fix((double)(M_PI * n * 2),10)<<endl;
	return 0;
}


Measured memory_bytes: 3808
#include<iostream>
#include<stack>
#include<string>
#include<iomanip>
using namespace std;

int main()
{
    int n, v[20][10];
    string s;

    while( cin >> n )
    {
        if( !n )
            break;
        
        for( int i = 0; i < 20; i++ )
            for( int j = 0; j < 10; j++ )
                v[i][j] = -4;

        for( int i = 0; i < n; i++ )
        {
            string s;
            cin >> s;
            for( int j = 0; j < s.size(); j++ )
            {
                switch(s[j])
                {
                    case '+' :
                        v[i][j] = -1;
                        break;
                    case '*' :
                        v[i][j] = -2;
                        break;
                    case '.' :
                        v[i][j] = -3;
                        break;
                    default :
                        v[i][j] = s[j] - '0';
                        break;
                }
            }
        }

        int s = 0, t = 0, op = 0;
        for( int j = 9; j > 0; j-- )
        {
            for( int i = 0; i < 20; i++ )
            {
                if( v[i][j-1] == -1 )
                {
                    op = -1;
                    s = i; t = j - 1;
                    v[i][j-1] = 0;
                }
                else if( v[i][j-1] == -2 )
                {
                    op = -2;
                    s = i; t = j - 1;
                    v[i][j-1] = 1;
                }
                if( 0 <= v[i][j] )
                {
                    if( op == -1 )
                        v[s][t] += v[i][j];
                    else
                        v[s][t] *= v[i][j];
                }
            }
        }
        cout << v[0][0] << endl;
    }
    return 0;
}


Measured memory_bytes: 3172
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		int ans = 0;
		for (int i = 1; i <= n; i++) {
			if (Integer.toString(i).length() % 2 == 1) {
				ans++;
			}
		}
		pr.println(ans);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 25940
import java.util.*;

class Main{

    static final int DIV = 100000007;

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();
        int[] x = new int[w+1];
        int[] y = new int[h+1];
        for(int i = 0;i < n;i++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            if(c == 1)for(int j = 0;j<a;j++)x[j]++;
            if(c == 2)for(int j = a+1;j<=w;j++)x[j]++;
            if(c == 3)for(int j = 0;j<b;j++)y[j]++;
            if(c == 4)for(int j = b+1;j<=h;j++)y[j]++; 
        }
        int xans = 0;
        int yans = 0;
        int ans = 0;
        for(int i=0;i<=w;i++)if(x[i]==0)xans++;
        for(int j=0;j<=h;j++)if(y[j]==0)yans++;
        if(xans>0&&yans>0)ans = (xans-1)*(yans-1);
        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    from itertools import accumulate
    acc = list(accumulate(reversed(A), lambda a,b: (a+b)%MOD))[::-1]
    ans = 0
    for i in range(N-1):
        ans = (ans + A[i] * acc[i+1] % MOD) % MOD
    return ans


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 43760
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
  		long ans=0;

  		long[] h=new long[n];
		for(int c=0;c<n;c++){
    		h[c]=sc.nextInt();
          	ans+=h[c];
    	}
  		Arrays.sort(h);
  		int c=n-1;
  if(n<=k){
  		ans=0;
  }else{
     while(k>0){
  		ans-=h[c];
       c--;
     k--;
   }
  }		
    	System.out.println(ans);
    }
}

Measured memory_bytes: 89540
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll MODI=(ll)1e6+3;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll mod_pow(ll x,ll n,ll mod){
	ll res=1;
	while(n>0){
		if(n&1)res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}

int q;
int x[100100],d[100100],n[100100];

ll xnd[1000100LL],xd[1000100LL];
int main(){
	cin>>q;
	REP(i,q){
		cin>>x[i]>>d[i]>>n[i];
	}
	xnd[0]=1;
	for(ll i=1;i<=1000050;i++){
		xnd[i]=(xnd[i-1]*i)%MODI;
	}
	
	xd[1000002]=mod_pow(xnd[1000002],MODI-2,MODI);
	for(ll i=1000002;i>0;i--){
		xd[i-1]=(xd[i]*i%MODI);
	}
	//cout<<"2"<<endl;
	
	for(int i=0;i<q;i++){
		if(d[i]==0){
			cout<<mod_pow(x[i],n[i],MODI)<<endl;
		/*}else if(((x[i]*mod_pow(d[i],MODI-2,MODI)-1))/MODI!=(((x[i]*mod_pow(d[i],MODI-2,MODI))+n[i-1]))/MODI){
			cout<<0<<endl;*/
		}else{
			auto ii=x[i]*mod_pow(d[i],MODI-2,MODI)%MODI;
			 if (ii + n[i] - 1 >= MODI || ii == 0) cout << 0 <<endl;
			 //cout<<xd[ii-1]<<endl;
			else cout<<(xnd[ii+n[i]-1]*xd[ii-1]%MODI)*mod_pow(d[i],n[i],MODI)%MODI<<endl;
			 
		}
	}
	return 0;
}

Measured memory_bytes: 17664
using System;
using System.Text;

namespace ALDS1_6_A {
    class Program {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            int[] A = new int[n + 1];
            int[] B = new int[n + 1];
            int[] C = new int[10001];

            for (int i = 1, j = 0; i <= n; i++, j++) {
                int temp = int.Parse(input[j]);
                A[i] = temp;
                C[temp]++;
            }

            for (int i = 1; i < 10001; i++) {
                C[i] += C[i - 1];
            }

            for (int i = n; i > 0; i--) {
                B[C[A[i]]] = A[i];
                C[A[i]]--;
            }

            StringBuilder sb = new StringBuilder();
            sb.Append(B[1]);
            for (int i = 2; i <= n; i++)
                sb.AppendFormat(" {0}", B[i]);
            Console.WriteLine(sb.ToString());
        }
    }
}

Measured memory_bytes: 232168
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

void main() {
    int n;
    scan(n);
    int[string] cnt;
    cnt["AC"] = cnt["WA"] = cnt["TLE"] = cnt["RE"] = 0;
    foreach (i; 0 .. n) {
        string s;
        scan(s);
        cnt[s]++;
    }
    writefln("AC x %s", cnt["AC"]);
    writefln("WA x %s", cnt["WA"]);
    writefln("TLE x %s", cnt["TLE"]);
    writefln("RE x %s", cnt["RE"]);
}

void scan(T...)(ref T args) {
    auto line = readln.split; // @suppress(dscanner.suspicious.unmodified)
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args)
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args)
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 3844
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

int main(void) {
    int n;
    std::scanf("%d", &n);
    int x = 0;
    for (int a = n; a > 0; a /= 10) x += a % 10;
    if (n % x == 0) {
        std::puts("Yes");
    }
    else {
        std::puts("No");
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,a[1001]={0,1};
  for(int i=2;i<32;i++)
    for(int j=i*i;j<=1000;j*=i)
      a[j]=1;
  cin>>x;
  for(int i=x;i>=0;i--)
    if(a[i]==1){
      cout<<i<<endl;
      break;
    }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>　　　 //STL 通用算法
#include <bitset>　　　　　//STL 位集容器
#include <cctype>         //字符处理
#include <cerrno> 　　　　 //定义错误码
#include <cfloat>　　　　 //浮点数处理
#include <ciso646>         //对应各种运算符的宏
#include <climits> 　　　　//定义各种数据类型最值的常量
#include <clocale> 　　　　//定义本地化函数
#include <cmath> 　　　　　//定义数学函数
#include <complex>　　　　 //复数类
#include <csignal>         //信号机制支持
#include <csetjmp>         //异常处理支持
#include <cstdarg>         //不定参数列表支持
#include <cstddef>         //常用常量
#include <cstdio> 　　　　 //定义输入／输出函数
#include <cstdlib> 　　　　//定义杂项函数及内存分配函数
#include <cstring> 　　　　//字符串处理
#include <ctime> 　　　　　//定义关于时间的函数
#include <cwchar> 　　　　 //宽字符处理及输入／输出
#include <cwctype> 　　　　//宽字符分类
#include <deque>　　　　　 //STL 双端队列容器
#include <exception>　　　 //异常处理类
#include <fstream> 　　　 //文件输入／输出
#include <functional>　　　//STL 定义运算函数（代替运算符）
#include <limits> 　　　　 //定义各种数据类型最值常量
#include <list>　　　　　　//STL 线性列表容器
#include <locale>         //本地化特定信息
#include <map>　　　　　　 //STL 映射容器
#include <memory>         //STL通过分配器进行的内存分配
#include<new>            //动态内存分配
#include <numeric>         //STL常用的数字操作
#include <iomanip> 　　　 //参数化输入／输出
#include <ios>　　　　　　 //基本输入／输出支持
#include <iosfwd>　　　　　//输入／输出系统使用的前置声明
#include <iostream> 　　　//数据流输入／输出
#include <istream>　　　　 //基本输入流
#include <iterator>        //STL迭代器
#include <ostream>　　　　 //基本输出流
#include <queue>　　　　　 //STL 队列容器
#include <set>　　　　　　 //STL 集合容器
#include <sstream>　　　　 //基于字符串的流
#include <stack>　　　　　 //STL 堆栈容器
#include <stdexcept>　　　 //标准异常类
#include <streambuf>　　　 //底层输入／输出支持
#include <string>　　　　　//字符串类
#include <typeinfo>        //运行期间类型信息
#include <utility>　　　　 //STL 通用模板类
#include <valarray>        //对包含值的数组的操作
#include <vector>　　　　　//STL 动态数组容器
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

const int MAXN=2e5+10;
const int MOD=998244353;
const int INF=0x3f3f3f3f;

inline int read(){
	int x=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c))x=(x<<3)+(x<<1)+c-'0',c=getchar();
	return x*f;
}
inline ll readll(){
	ll x=0;int f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-') f=-1;c=getchar();}
	while(isdigit(c)) x=(x<<3ll)+(x<<1ll)+1ll*(c-'0'),c=getchar();
	return x*f;
}
int gcd(int x,int y){
	return y?gcd(y,x%y):x;
}
ll gcd(ll x,ll y){
	return y?gcd(y,x%y):x;
}

int n,a[MAXN];
string s;

int main(){
  	ios::sync_with_stdio(0);
  	cin.tie(0);
	cin>>n;
	cin>>s;
	for(int i=1;i<=n;i++) a[i]=a[i-1]+(s[i-1]=='R');
	cout<<a[n]-a[a[n]]<<'\n';
	return 0;
}


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

int main()
{
    int n;
    cin>>n;
    
    int a[n][n];
    
    for(int i=0; i<n; i++)
    {
        
    cin>>a[i][0];
    cin>>a[i][1];
    
    }
    
    int count =0;
    
    for(int i=0; i<n; i++)
    {
        if(a[i][0]==a[i][1])
        count++;
        
        else
        count=0;
        
        if(count==3)
        {
            cout<<"Yes"<<endl;
            break;
        }
        
        else if(i==n-1)
         cout<<"No"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 3668
from itertools import permutations 
n,m=map(int,input().split())
cost=[]
for i in range(m):
    cost.append([int(i) for i in input().split()])
clr=[]
for i in range(n):
    clr.append([int(i) for i in input().split()])
l=[i for i in range(m)]
ind=[[0 for j in range(m)] for i in range(4)]
for i in range(n):
    for j in range(n):
        curr=(i+1+j+1)%3 
        ind[curr][clr[i][j]-1]+=1 
mini=10**9 
for i in range(m):
    for j in range(m):
        for k in range(m):
            if i==j or i==k or j==k:
                continue 
            curr=0 
            for it in range(3): 
                for it1 in range(m): 
                    if it==0:
                        k1=i 
                    elif it==1:
                        k1=j 
                    else:
                        k1=k 
                    curr+=ind[it][it1]*cost[it1][k1] 
            mini=min(mini,curr)
print(mini)


Measured memory_bytes: 46044
#!/usr/bin/env python3
S = input().strip()
T = input().strip()

trans = dict()
ans = True
for s, t in zip(S, T):
    if trans.get(s, t) != t:
        ans = False
        break
    trans[s] = t

# print(trans)
print('Yes' if ans and len(set(trans.values())) == len(trans) else 'No')

Measured memory_bytes: 3632