akhauriyash/Code-Regression huggingface dataset:
using System.Collections.Generic;
using System.Linq;
using System;
using System.Text;

public class P
{
	public int x { get; set; }
	public int y { get; set; }
}

public class hello
{
	public static bool first = true;

	public static void Main()
	{
		var n = int.Parse(Console.ReadLine().Trim());
		var p = 0;
		var sb = new StringBuilder();
		while (p++ < n)
		{
			var map = new int[9, 9];
			for (int i = 0; i < 9; i++)
			{
				string[] line = Console.ReadLine().Trim().Split(' ');
				for (int j = 0; j < 9; j++) map[i, j] = int.Parse(line[j]);
			}
			var ps = new List<P>();
			check0(map, ps);
			check1(map, ps);
			for (int i = 0; i < 3; i++)
				for (int j = 0; j < 3; j++)
					check2(map, ps, i * 3, j * 3);
			getAns(map, ps, sb);
		}
		Console.Write(sb);
	}
	static void getAns(int[,] map, List<P> ps, StringBuilder sb)
	{
		var a = new string[9][];
		for (int i = 0; i < 9; i++) a[i] = new string[18];
		for (int i = 0; i < 9; i++)
			for (int j = 0; j < 9; j++)
			{
				a[i][2 * j] = " ";
				a[i][2 * j + 1] = map[i, j].ToString();
			}
		foreach (var x in ps)
			a[x.x][2 * x.y] = "*";
		if (first) first = false;
		else sb.Append("\n");
		for (int i = 0; i < 9; i++)
			sb.Append(string.Join("", a[i]) + "\n");
	}
	static void check2(int[,] map, List<P> ps, int x, int y)
	{
		var a = new List<P>[10];
		for (int j = 0; j < 10; j++) a[j] = new List<P>();
		for (int i = x; i < x + 3; i++)
			for (int j = y; j < y + 3; j++)
				a[map[i, j]].Add(new P { x = i, y = j });
		for (int i = 1; i < 10; i++)
			if (a[i].Count() >= 2)
				foreach (var z in a[i]) ps.Add(z);

	}
	static void check1(int[,] map, List<P> ps)
	{
		for (int i = 0; i < 9; i++)
		{
			var a = new List<P>[10];
			for (int j = 0; j < 10; j++) a[j] = new List<P>();
			for (int j = 0; j < 9; j++) a[map[j, i]].Add(new P { x = j, y = i });
			for (int j = 1; j < 10; j++)
				if (a[j].Count() >= 2)
					foreach (var x in a[j]) ps.Add(x);
		}
	}
	static void check0(int[,] map, List<P> ps)
	{

		for (int i = 0; i < 9; i++)
		{
			var a = new List<P>[10];
			for (int j = 0; j < 10; j++) a[j] = new List<P>();
			for (int j = 0; j < 9; j++) a[map[i, j]].Add(new P { x = i, y = j });
			for (int j = 1; j < 10; j++)
				if (a[j].Count() >= 2)
					foreach (var x in a[j]) ps.Add(x);
		}
	}
}



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

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

    int a, b, c, sum = 0;
    cin >> a >> b >> c;
    for (int i = 1; i <= 100 ; i++) {
        sum += a;
        if (sum % b == c) {
            cout << "YES";
            return 0;
        }
    }
    
    cout << "NO";
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
const int mod = 100000;

int dp[2][2001][3001];

int main(int argc, char const* argv[])
{
	int n, m, s;
	do{
			cin >> n >> m >> s;
			if(n == 0)break;
			for(int i = 0; i < n * n; i++){
					for(int j = 1; j <= m; j++){
							for(int k = 1; k <= s; k++){
									if(i == 1){
											if(j < k)dp[1][j][k] = 0;
											else dp[1][j][k] = 1;
									}
									dp[(i + 1) & 1][j][k] = dp[(i + 1) & 1][j-1][k];
									if(k -j >= 0)dp[(i + 1) & 1][j][k] += dp[i & 1][j-1][k-j];
									dp[(i + 1) & 1][j][k] %= mod;
									// cout << i << " " << j << " " << k << " " << dp[(i + 1) & 1][j][k] << endl;
							}
					}
			}
			cout << dp[(n*n) & 1][m][s] << endl;
	}while(true);
	return 0;
}



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

#define Q 1000000007

int main(void){
  int n;
  int a[200010];
  long long acc[200010], ans;
  
  cin >> n;
  acc[0] = 0;
  for (int i=1; i<=n; i++){
    cin >> a[i];
    acc[i] = acc[i-1] + a[i];
    acc[i] %= Q;
  }
  ans = 0;
  for (int i=1; i<=n-1; i++){
    ans += (a[i]*((acc[n]-acc[i]+Q)%Q)) % Q;
    ans %= Q;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5944
#include <cstdio>

#define SE(a, b) ((a == '\0') && (b == '\0')) ? 1 : 0

int main(void)
{
    char r[5], a[5];
    while (1){
        scanf("%s %s", r, a);
        if (r[0] == '0' && a[0] == '0' && SE(r[1], a[1])) break;
        int hit = 0, blow = 0;
        for (int i = 0; i < 4; i++){
            if (r[i] == a[i]) hit++;
        }
        for (int i = 0; i < 4; i++){
            for (int j = 0; j < 4; j++){
                if (r[i] == a[j]) blow++;
            }
        }
        printf("%d %d\n", hit, blow - hit);
    }
    
    return (0);
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    int n;
    long sum = 0;
    cin >> n;
    vector<int> l(n);
    for(int i = 0; i < n; i++){
        cin >> l[i];
        sum += l[i]-1;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int c[509],s[509],f[509];

main()
{
   int n;
   cin>>n;
   for (int i=0; i<n-1; i++)
   {
       cin>>c[i]>>s[i]>>f[i];
   }

   for(int i=0; i<n; i++)
   {
       int t=0;
       for (int j=i; j<n-1; j++)
       {
           if(t<s[j])
           {
               t=s[j]+c[j];
           }
           else
           {
               while(t%f[j]!=0) t++;
               t+=c[j];
           }
       }
       cout<<t<<endl;
   }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> vec(N);
  for(int i=0; i<N;i++){
    cin>>vec.at(i);
  }
  vector<int> vec1(N);
  for(int i=0; i<N;i++){
    vec1.at(i)=i+1;
  }
  int ans=0;
  for(int i=0;i<N;i++){
    if(vec[i]!=vec1[i]){
      ans++;
    }
    if(ans==3){
     cout<<"NO"<<endl;
     break;
    }
  }
  if(ans==0){
    cout<<"YES"<<endl;
  }
  if(ans==2){
    cout<<"YES"<<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll fact(ll n){
	
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
  
int nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
 
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second<b.second);} 


void solve()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	while(a>0&&c>0)
	{
		c-=b;
		if(c<=0){
			break;
		}
		a-=d;
		// cout<<c<<a<<endl;
	}
	if(a>0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return;
}

int main()
{
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3600
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        ll n, x;
        cin >> n >> x;
        vector<ll> a(n);
        rep(i, n) cin >> a[i];
        sort(a.begin(), a.end());
        ll ans = 0;
        rep(i, n) {
            if (i == n - 1) {
                if (a[i] == x) ans++;
            } else if (a[i] <= x) x -= a[i], ans++;
        }
        cout << ans << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

int main()
{
	int n;
	cin>>n;
	string base2="";
	if(n==0)
	{
	base2="0";	
	}
	while (n!=0)
	{
		if(n%2!=0)
		{
			if(n>0)
			{
				n=-n/2;

			}else
			{
				n=(-n/2)+1;
			}
			
			base2='1'+ base2;
		}else
		{
			n=-n/2;
			base2='0'+base2;
		}
		
	}
	cout<<base2<<endl;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < n; i++)
#define REPR(i,n) for(int i = n; i >= 0; i--)
#define FOR(i,m, n) for(int i = m-1; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
using namespace std;
typedef long long ll;
int main(){
    string s,c;
    int q,f,t,j;
    cin>>s>>q;
  	j=1;
    REP(i,q){
        cin>>t;
        if(t==1)j*=-1;
        else {
            cin>>f>>c;
            if(f==2)f=-1;
            if(f*j==1)s.insert(0, c);
            else s+=c;
         //cout<<s<<endl;
        }
    }
  	if(j==-1)reverse(ALL(s));
    cout<<s<<endl;
}



Measured memory_bytes: 900
#include<bits/stdc++.h>
#define ll long long int 
#define mod 1000000007
#define se second
#define fi first
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971
#define MAX 9223372036854775807
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
//	cout<<fixed<<setprecision(10);
	ll n;
	cin>>n;
	ll x,y,z;
	x=100;
	y=0;
	double xx=101.0/100.0;
	while(x<n)
	{
		x=x*xx;
		y++;
	}
	cout<<y;
	return 0;
}

Measured memory_bytes: 3652
require 'openssl'
N,*A = $<.read.split.map &:to_i
M = (10**9+7).to_bn
l = A.inject {|s,i| s.lcm(i) }.to_bn
l = l.mod_add(0.to_bn, M)
p A.inject(0.to_bn) { |s,i|
  s = s.mod_add(l*i.to_bn.mod_inverse(M), M)
  }.to_i

Measured memory_bytes: 63868
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,rec1,rec2;
	cin>>a>>b;
	rec1=a*b;
	cin>>c>>d;
	rec2=c*d;
	if(rec1>rec2){
		cout<<rec1;
	}else{
		if(rec1<rec2){
			cout<<rec2;
		}else
		cout<<rec1;
	}
	
}

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

int main(){
    int A,B,M;
    cin >> A >> B >> M;
    vector<int> a(A),b(B);
    int amin=1e+8,bmin=1e+8,ans,mmin=1e+8;
    rep(i,A) {
        cin >> a.at(i);
        amin = min(amin,a.at(i));
    }

    rep(i,B) {
        cin >> b.at(i);
        bmin = min(bmin,b.at(i));
    }

    vector<int> x(M),y(M),c(M);
    rep(i,M) {
        cin >> x.at(i) >> y.at(i) >> c.at(i);
        mmin = min(mmin,(a.at(x.at(i)-1) + b.at(y.at(i)-1)-c.at(i)));
    }

    ans = min((amin + bmin),mmin);
    cout << ans;
}

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

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vector<int> > vvi;
typedef set<int> si;
typedef map<string, int> msi;
typedef map<int, int> mii;

#define INF 1000000000
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) SORT(x),(x).erase(unique((x).begin(),(x).end()),(x).end())
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define SZ(a) int((a).size())
#define CLR(a) memset(a,0,sizeof(a))
#define SET(a,b) memset(a,b,sizeof(a))

#define FOR(i,a,b) for (int i = int(a); i < int(b); i++)
#define FORD(i,a,b) for(int i=int(b)-1; i>=int(a); i--)
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REP1(i,n) for (int i = 1; i <= int(n); i++)
#define REV(i, n) for (int i = int(n)-1; i >=0 ; i--)

#define sd(n) scanf("%d",&n)
#define dsd(n) int n; scanf("%d",&n)
#define sd2(a,b) scanf("%d%d",&a,&b)
#define dsd2(a,b) int a,b; scanf("%d%d",&a,&b)
#define sd3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define dsd3(a,b,c) int a,b,c; scanf("%d%d%d",&a,&b,&c)
#define pd(n) printf("%d\n",n)
#define pds(n) printf("%d ",n)
#define sll(n) scanf("%lld",&n)
#define dsll(n) ll n; scanf("%lld",&n)
#define sll2(a,b) scanf("%lld%lld",&a,&b)
#define dsll2(a,b) ll a,b; scanf("%lld%lld",&a,&b)
#define sll3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define dsll3(a,b,c) ll a,b,c; scanf("%lld%lld%lld",&a,&b,&c)
#define pll(n) printf("%lld\n",n)	
#define plls(n) printf("%lld ",n)	
#define print(x) cout<< x << "\n"

#define trace(x) cout << '>' << #x << ':' << x << "\n"
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << "\n"
#define trace3(a,b,c) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);
const int oo = 0x3f3f3f3f;

int cmp(double x, double y = 0, double tol = EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

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

const int MAX_N = 200010;
const int MAXN = 1010;
//int arr[MAXN][MAXN];

int main(){
    dsd2(N,W);
    vll dp(N*1000+1,1ll*INF*INF);
    dp[0]=0;
    int sum=0;
    REP(i,N){
        dsd2(w,v);
        sum+=v;
        REV(i,N*1000-v+1){
            dp[i+v]=min(dp[i+v],dp[i]+w);
        }
    }
    int ans=0;
    REP(i,sum+1){
        if(dp[i]<=W)
            ans=max(ans,i);
    }
    pd(ans);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <memory>
#include <cstring>
#include <cassert>
#include <numeric>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define REP2(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(S) (S).begin(), (S).end()
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  int n;
  while (cin >> n && n){
    vector<string> vs(n);
    REP(i, n) cin >> vs[i];

    REP2(i, 1, n){
      size_t j = 0;
      while (!isalpha(vs[i][j])){
        vs[i][j++] = ' ';
      }
      j--;
      vs[i][j] = '+';

      size_t k = i - 1;
      while (vs[k][j] == ' '){
        vs[k][j] = '|';
        k--;
      }
    }

    REP(i, n){
      cout << vs[i] << endl;
    }
  }
  return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  int n;
  double t, a;
  cin >> n >> t >> a;
  double min_diff = 10000;
  int ans = 0;
  rep(i, n) {
    double h;
    cin >> h;    
    double temp = abs(t - 0.006 * h - a);
    if (temp < min_diff) {
      min_diff = temp; 
      ans = i+1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int N;
  char S[100];
  scanf("%d", &N);
  scanf("%s", S);
  if(N % 2 == 1) {
    printf("No");
    return 0;
  }
  for (int i = 0; i < N / 2; i++) {
    if (S[i] != S[N / 2 + i]) {
      printf("No");
      return 0;
    }
  }
  printf("Yes");
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

int getsum(const int l, const int r, const int u, const int d, vector<vector<int>>&sums) {
	int num= sums[d][r] - sums[d][l] - sums[u][r] + sums[u][l];
	return num;
}

int main() {
	
	int N; cin >> N;
	vector<vector<int>>field(N+1, vector<int>(N+1)),sums(N+1,vector<int>(N+1));
	for (int i = 1; i <= N; ++i) {
		for (int j = 1; j <= N; ++j) {
			cin >> field[i][j];
			sums[i][j] = field[i][j];
		}
	}
	for (int i = 1; i <= N; ++i) {
		for (int j = 1; j <= N; ++j) {
			sums[i][j] += sums[i - 1][j] + sums[i][j - 1] - sums[i - 1][j - 1];
		}
	}
	int ans = 0;
	for (int u = 0; u <= N; ++u) {
		for (int d = u + 2; d <= N; ++d) {
			vector<int>kakko0(N),kakko1(N);
			int minus = getsum(0, N, u, u+1,sums)+getsum(0,N,d-1,d,sums);
			for (int k = 0; k < N; ++k) {
				kakko0[k] = getsum(0, k+1, u, d,sums) - getsum(0, k, u + 1, d - 1,sums);
				kakko1[k] = getsum(k, N, u, d, sums) - getsum(k+1, N, u + 1, d - 1, sums);
			}
			int  j = 0;
			for (int i = 1; i < N; ++i) {
				if (kakko1[j] < kakko1[i-1]) {
					j = i-1;
				}
				const int num = kakko0[i] + kakko1[j] - minus;
				ans = max(ans,num);
			}
		}
	}
	for (int u = 0; u < N; ++u) {
		for (int d = u + 1; d <= min(N,u + 2); ++d) {
			for (int l = 0; l < N; ++l) {
				for (int r = l + 1; r <=N; ++r) {
					const int num = getsum(l, r, u, d, sums);
					ans = max(ans, num);
				}
			}
		}
	}
	for (int l = 0; l < N; ++l) {
		for (int r = l + 1; r <= min(N, l + 2); ++r) {
			for (int u = 0; u < N; ++u) {
				for (int d = u + 1; d <= N; ++d) {
					const int num = getsum(l, r, u, d, sums);
					ans = max(ans, num);
				}
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
#include<ctype.h>

char ch;

int i=0;
main(){
while(1){
	scanf("%c",&ch);
	if(islower(ch)){
    	printf("%c",toupper(ch));
    }else if(isupper(ch)){
    	printf("%c",tolower(ch));
    }else{
    printf("%c",ch);
    }
    if ( ch == '\n' ) break;
    }
    
return 0;
}

Measured memory_bytes: 524
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res

def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b = LI()
    print(max(a+b,a-b,a*b))
    return

#B
def B():
    k,x = LI()
    ans = []
    for i in range(x-k+1,x+k):
        ans.append(i)
    print(*ans)
    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 39152
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<iomanip>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{"; for(auto nth : list){ cout << nth << " ";}cout << "}" << endl;

using namespace std;

string table[]={"qwertasdfgzxcvb","yuiophjklnm"};


int main(){
	
	while(true){
		long n,a,b,c,x;
		cin >> n >> a >> b >> c >> x;
		if(n==0&&a==0&&b==0&&c==0&&x==0) break;

		vector<int> list;
		for(int i=0;i<n;i++){
			int tmp;
			cin >> tmp;
			list.push_back(tmp);	
		}

		int count=list.size()-1;

		for(int i=0;i<=10001;i++){
			bool flag=true;
			for(int k=0;k<list.size()-count;k++){
				if(list[k]==x){
		//			cout << "X:" << x << ",i:" << i << endl;
					list[k]=-1;
					count--;
					break;
				}
			}
			for(int k=0;k<list.size();k++){
				if(list[k]!=-1){
					flag=false;
				}
			}
				
			x=((a*x)+b)%c;
			
			if(i>=10001){
				cout << -1 << endl;
				break;
			}

			if(flag){ 
				cout << i << endl;
				break;
			}
		}

	}

}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}

int main(){
    int n,m;cin >> n >> m;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    vb c(n,true);
    rep(i,m){
        int a,b;cin >> a >> b;
        --a;--b;
        if(h[a] == h[b]){
            c[a] = false;
            c[b] = false;
        }
        else if(h[a] > h[b]){
            c[b] = false;
        }
        else if(h[a] < h[b]){
            c[a] = false;
        }
    }
    //rep(i,n) cout << i << " " << c[i] << "\n";
    int ans = 0;
    rep(i,n) if(c[i]) ++ans;
    cout << ans << endl;
}

Measured memory_bytes: 3784
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

//using edge = struct{ll from, to;};

int main(){
    ll N; cin >> N;
    ll ans = 0;
    for (ll i = 1; i*i < N; i++) {
        if(N % i != 0) continue;
        ll c1 = i;
        ll c2 = N / i;
        
        if(c1 < c2 - 1 && c2 >= 2){
            ans += c2-1;
        }
        if(c2 < c1 - 1 && c1 >= 2){
            ans += c1-1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,ju,ans; cin>>n;
    ans=n;
    vector<int> a(n,0),c(1000001,0);
    rep(i,n) cin>>a[i];
    sort(al(a));
    rep(i,n){
        if(i<n-1 && a[i+1]==a[i]){
            ans--;
            c[a[i]]=1;
            continue;
        }
        ju=0;
        for(int j=1;j*j<=a[i];j++){
            if(a[i]%j==0){
                if(c[j]==1 || c[a[i]/j]==1){
                    c[a[i]]=1; ans--;
                    ju=1;
                }
            }
            if(ju) break;
        }
        c[a[i]]=1;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 7944
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main() {

    long A, B;
    cin >> A >> B;

    if ((A + B) % 2 == 0) {
        cout << (A + B) / 2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
//αlphabet
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;
const int INF = 1 << 29;
int main ()
{
    char a;
    int diff = 'a' - 'A';
    cin >> a;
    if (a >= 'A' && a <= 'Z') {
        cout << 'A' << endl;
        return 0;
    }
    cout << 'a' << endl;

    return 0;
}

Measured memory_bytes: 3032
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=200005;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
ll a[N];
int main()
{
    std::ios::sync_with_stdio(false);
    int n;
    while(cin>>n)
    {
        for(int i=1; i<=n; i++)
        {
            cin>>a[i];
        }
        ll ans1=0,ans2=0,sum=0;
        for(int i=1; i<=n; i++)
        {
            if(i%2)
            {
                if(sum+a[i]>0)
                {
                    sum+=a[i];
                    continue;
                }
                ans1+=1-sum-a[i];
                sum=1;
            }
            else
            {
                if(sum+a[i]<0)
                {
                    sum+=a[i];
                    continue;
                }
                ans1+=sum+a[i]+1;
                sum=-1;
            }
        }
        sum=0;
        for(int i=1; i<=n; i++)
        {
            if(i%2)
            {
                if(sum+a[i]<0)
                {
                    sum+=a[i];
                    continue;
                }
                ans2+=sum+a[i]+1;
                sum=-1;
            }
            else
            {
                if(sum+a[i]>0)
                {
                    sum+=a[i];
                    continue;
                }
                ans2+=1-sum-a[i];
                sum=1;
            }
        }
        cout<<min(ans1,ans2)<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, m;
vector<deque<int> > sequences;
deque<int> v;
void f(int i, int val){
    if(i == n){
        v.push_back(val);
        sequences.push_back(v);
        v.pop_back();
        return;
    }
    v.push_back(val);
    for(int j = val; j <= m; j++)
        f(i + 1, j);
    v.pop_back();
    return;
}


int main()
{
    int q;
    cin >> n >> m >> q;
    for(int i = 1; i <= m; i++)
        f(1,i);

    vector<vector<int> > cond(q, vector<int>(4));
    for(auto &x: cond){
        for(auto &y: x)
            cin >> y;
    }
    ll ans = 0;
    for(auto &x: sequences){
        ll mx = 0;
        for(auto &y: cond){
            if(x[y[1] - 1] - x[y[0] - 1] == y[2])
                mx += y[3];
        }
        ans = max(ans, mx);
    }

    cout << ans << '\n';
}

Measured memory_bytes: 65368
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, m;
  cin >> n;
  map<string, int> mp;
  rep(i, 0, n) {
    string s;
    cin >> s;
    mp[s]++;
  }
  cin >> m;
  rep(i, 0, m) {
    string s;
    cin >> s;
    mp[s]--;
  }

  int ans = 0;
  for (auto mm : mp) {
    chmax(ans, mm.second);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
class UnionFind
  def initialize(n)
    @size = Array.new(n, 1)
    @rank = Array.new(n, 0)
    @parent = []

    (0..n).each do |i|
      @parent[i] = i
    end
  end

  def find(x)
    if @parent[x] == x
      x
    else
      @parent[x] = find(@parent[x])
    end
  end

  def unite(x, y)
    x = find(x)
    y = find(y)
    return if x == y

    if @rank[x] < @rank[y]
      @parent[x] = y
      @size[y] += @size[x]
    else
      @parent[y] = x
      @size[x] += @size[y]

      @rank[x] += 1 if @rank[x] == @rank[y]
    end
  end

  def same?(x, y)
    find(x) == find(y)
  end

  def size(x)
    @size[find(x)]
  end
end

N = gets.to_i
P = N.times.map { |i| [i] + gets.split.map(&:to_i) }
P.sort_by! { |id, x, y| x }

uf = UnionFind.new(N + 1)
stack = [[-1, -Float::INFINITY]]

P.each do |id, x, y|
  # p [:id, id, :y, y, :x, x, :cnt, cnt]

  while stack.last.last > y
    stack.pop
  end

  uid = stack.last.first

  if uid != -1
    uf.unite(id, uid)
  end

  stack.push([id, y])
end

stack = [[-1, Float::INFINITY]]

P.reverse_each do |id, x, y|
  while stack.last.last < y
    stack.pop
  end

  uid = stack.last.first

  if uid != -1
    uf.unite(id, uid)
  end

  stack.push([id, y])
end

P.sort_by! { |id, x, y| y }
stack = [[-1, -Float::INFINITY]]

P.each do |id, x, y|
  # p [:id, id, :y, y, :x, x, :cnt, cnt]

  while stack.last.last > x
    stack.pop
  end

  uid = stack.last.first

  if uid != -1
    uf.unite(id, uid)
  end

  stack.push([id, x])
end

stack = [[-1, Float::INFINITY]]

P.reverse_each do |id, x, y|
  while stack.last.last < x
    stack.pop
  end

  uid = stack.last.first

  if uid != -1
    uf.unite(id, uid)
  end

  stack.push([id, x])
end

puts (0...N).map { |x| uf.size(x) }


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

using namespace std;

int main() {
  int a, b, x;
  cin >> a >> b >> x;
  int m = a * a * b;
  double v = 0.0;
  double res = 0;
  if (x * 2 <= m) {
    v = 2 * x;
    v = v / a / b;
    res = atan(b / v) * 180.0 / M_PI;
  } else {
    v = m * 2 - x * 2;
    v = v / a / a;
    res = atan(v / a) * 180.0 / M_PI;
  }
  cout << fixed << setprecision(10) << res << endl;
  return 0;
}

Measured memory_bytes: 512
main(i){
	char s[128];
	for(;scanf("%s",s),s[0]-'0';){
		int sc[]={0,0};
		for(i=1;s[i];i++){
				sc[s[i]-'A']++;
		}
		sc[sc[0]<sc[1]]++;
		printf("%d %d\n",sc[0],sc[1]);
	}
	exit(0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL //デバッグ出力系
#define dout cout
#define debug() if(true)
#else
#define dout if(false) cout
#define debug() if(false)
#endif//
#define next asdnext
#define prev asdprev
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define vrep(i, v) for(auto &i : v)
#define all(x) (x).begin(),(x).end()
#define vout(v) for(auto &i:v){cout<<i<<" ";}cout<<"\n"; //配列出力
#define vin(v) for(auto &i:v)cin>>i; //配列入力
#define vec(v,n) vector<int> v(n,0);
typedef long long ll;
typedef unsigned long long ull;

void Main() {
	string S;
	cin >> S;
	sort(all(S));
	if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

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

const ll inf = 100000000000;

struct edge{int to; ll cost;};
vector<edge> G[100000];

int main(){
	int n,m,r;
	scanf("%d%d%d",&n,&m,&r);
	for(int i=0;i<m;i++){
		int s,t;
		ll d;
		edge e;
		scanf("%d%d%lld",&s,&t,&d);
		e.to = t; e.cost = d;
		G[s].push_back(e);
	}
	priority_queue<P,vector<P>,greater<P> > pq;
	ll dist[100000];
	fill(dist,dist+n,inf);
	dist[r] = 0;
	pq.push(make_pair(0,r));
	while(!pq.empty()){
		P now = pq.top(); pq.pop();
		if(dist[now.second]<now.first) continue;
		for(int i=0;i<G[now.second].size();i++){
			if(dist[G[now.second][i].to]>dist[now.second]+G[now.second][i].cost){
				dist[G[now.second][i].to] = dist[now.second] + G[now.second][i].cost;
				pq.push(make_pair(dist[G[now.second][i].to],G[now.second][i].to));
			}
		}
	}
	for(int i=0;i<n;i++){
		if(dist[i]==inf) printf("INF\n");
		else printf("%lld\n",dist[i]);
	}
}



Measured memory_bytes: 19008
#include<bits/stdc++.h>
#define lp3(i,a,b) for(int i=a;i<b;i++)
#define lp2(i,n) for(int i=0;i<n;i++)
#define ll long long
using namespace std;
int main(){
	int a,b,ans=0;
	cin>>a>>b;
	if(a%b!=0)ans=1;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <chrono> //1e+9で割る auto end= chrono::system_clock::now()-st;  cout<<end.count()%1e+9<<endl;
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef long double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(ll i=0;i<x;i++)
#define rep1(i,x) for(ll i=1;i<=x;i++)
#define rrep(i,x) for(ll i=x-1;i>=0;i--)
#define rrep1(i,x) for(ll i=x;i>0;i--)

ll N;
string s;

int main()
{
	cin>>N;
	cin>>s;
	ll a=0,b=0;
	rep(i,N){
		if(s[i]=='(') a++;
		else{
			if(a>=1) a--;
			else b++;
		}
	}
	rep(i,b) printf("(");
	cout<<s;
	rep(i,a) printf(")");
	cout<<endl;
}

Measured memory_bytes: 256
# n = gets.split.map(&:to_i)
# array = readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }


n = gets.to_i
t,a = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)


res = 0
min = 10000000000000
h.each_with_index do |g,i|
  k = ((t - g * 0.006) - a).abs
  if min > k
    min = k
    res = i+1
  end
end

puts res.to_i




Measured memory_bytes: 1788
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n,m,q;
mat g;
vll v;
vll d;
vll c;
mat dp;
matb bl;
vll ans;

lli read(lli x,lli y){
    if(bl[x][y]) return dp[x][y];
    bl[x][y] = true;
    if(y == 10) return dp[x][y];
    for(lli i = 0;i < g[x].size();i++){
        dp[x][y] = max(dp[x][y],read(g[x][i],y+1));
    }
    return dp[x][y];
}

int main(){
    cin >> n >> m;
    g = mat(n+1);
    for(lli i = 0;i < m;i++){
        lli a,b;
        cin >> a >> b;
        g[a].push_back(b);g[b].push_back(a);

    }
    cin >> q;
    v = vll(q+1);d = vll(q+1);c = vll(q+1);
    for(lli i = 1;i <= q;i++) cin >> v[i] >> d[i] >> c[i];
    dp = mat(n+1,vll(11));
    bl = matb(n+1,vbl(11));
    for(lli i = 1;i <= q;i++) dp[v[i]][d[i]] = i;

    ans = vll(n+1);
    for(lli i = 1;i <= n;i++){
        for(lli j = 0;j <= 10;j++){
            ans[i] = max(ans[i],read(i,j));
        }
    }
    
    for(lli i = 1;i <= n;i++) cout << c[ans[i]] << endl;


}

Measured memory_bytes: 28788
def main():

  N, M = map(int, input().split())

  hyoko = list(map(int, input().split()))
  path =[]
  for i in range(M):
    A, B = map(int, input().split())
    path .append([A,B])
  
  # print('N:{},M:{}'.format(N,M))
  # print('hyoko:{}'.format(hyoko))
  # print('path:{}'.format(path))

  good_obs = [1 for i in range(N)]

  for i in path:
    A = i[0]-1
    B = i[1]-1
    # print('path:{},A{}:{},B{}:{}'.format(i,A,hyoko[A],B,hyoko[B]))
    if hyoko[A] > hyoko[B]:
      good_obs[B] = 0
    elif hyoko[B] > hyoko[A]:
      good_obs[A] = 0
    else:
      good_obs[A] = 0
      good_obs[B] = 0
    

  print(sum(good_obs))


if __name__ == "__main__":
  main()

Measured memory_bytes: 28952
#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(false), cin.tie(NULL);

using namespace std;
const int N = 1e6 + 4;
const int X[] = {1,0,-1,0,1,-1,1,-1};
const int Y[] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1e9 + 7;
const long long INF = 1e18;
const int inf = 1e9;

int main () {
	boost;
	long long n;
	cin >> n;
	cout << n * (n - 1) / 2;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
# from math import factorial


MOD = 1000000007  # type: int
# def cmb(n, r):
#     return (factorial(n) // (factorial(r) * factorial(n - r))%MOD)

def solve(S: str):
    S = S[::-1]
    dp = [[0] * 13 for _ in range(len(S))]
    # dp[LENGTH][MOD]

    s = S[0]
    if s == "?":
        for i in range(10):
            dp[0][i] = 1
    else:
        dp[0][int(s)] = 1
    for l in range(1, len(S)):
        s = S[l]
        pow_l = pow(10, l, 13)
        if s == "?":
            for m in range(13):
                for i in range(10):
                    dp[l][(m + pow_l * i) % 13] += dp[l-1][m]% MOD
        else:
            i = int(s)
            for m in range(13):
                dp[l][(m + pow_l * i) % 13] += dp[l-1][m] % MOD

    # print(dp)
    print(dp[-1][5]% MOD)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


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

vector<int> divisor(int n) {
  vector<int> res;
  for (int i=1; i*i<=n; i++) {
    if (n%i==0) {
      res.push_back(i);
      if (i!=n/i) res.push_back(n/i);
    }
  }
  return res;
}

int main() {
  int x; cin>>x;
  vector<int> P=divisor(x);
  int n=P.size();
  rep(i, n) {
    for (int j=-100000; j<=100000; j++) {
      int b=j;
      int a=b+P[i];
      ll tmp=a*a*a*a+a*a*a*b+a*a*b*b+a*b*b*b+b*b*b*b;
      if (tmp*P[i]==x) {
        cout<<a<<" "<<b<<endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 3628
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!size_t;

  auto ans = 0;
  foreach (_; 0..n) {
    auto rd = readln.split.to!(int[]), l = rd[0], r = rd[1];
    ans += r - l + 1;
  }

  writeln(ans);
}


Measured memory_bytes: 380
#include "bits/stdc++.h"
  
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
  
int main(){
    string s;
    cin>>s;
      
    int p[26]={};
    rep(i,s.size()){
        p[s[i]-'a']++;
    }
      
    if(s.size()%2==0){
        int odd = 0;
        rep(i,26)if(p[i]%2)odd++;
        cout<<odd/2+odd%2<<endl;
    }
    else{
        int ans = INF;
        rep(i,s.size()){
            p[s[i]-'a']--;
              
            int odd = 0;
            rep(i,26)if(p[i]%2)odd++;
            ans = min(ans,odd/2+odd%2);
              
            p[s[i]-'a']++;
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3196
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

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


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

int main(){
    string s1,s2,s3;
    cin>>s1>>s2>>s3;
    cout<<s1[0]<<s2[1]<<s3[2]<<endl;
}

Measured memory_bytes: 256
def main():
  s = str(input())
  s_ = set(list(s))
  t =  str(input())
  t_ =  set(list(t))
  alphabet = "abcdefghijklmnopqrstuvwxyz"
  if t_ <= s_:
    length_s = len(s)
    
    res = [[length_s]*(26)  for _ in range(length_s+1)]
    for i in range(length_s-1, -1, -1):
      for j in range(26):
        if s[i] == alphabet[j]:
          res[i][j] = i+1
        else:
          res[i][j] = res[i+1][j]
    ans = 0
    now = 0
    for i in range(len(t)):
      for j in range(26):
        if t[i] == alphabet[j]:
          ans += res[now][j]-now
          now = res[now][j]
          if now == length_s:
            if t[i] == s[-1]:
              now = 0
            else:
              ans += res[0][j]
              now = res[0][j]
    print(ans)
  else:
    print(-1)
if  __name__  == "__main__":
  main()

Measured memory_bytes: 35396
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL a,b,q,s[100010],t[100010],x,ss[100010],tt[100010],ans=1e18;

int main()
{
	cin>>a>>b>>q;
	rep(i,a) cin>>s[i],ss[i]=1e18;
	rep(i,b) cin>>t[i],tt[i]=1e18;
	rep(i,a)
	{
		LL pos=lower_bound(t,t+b,s[i])-t;
		if(pos<b&&pos>=0) ss[i]=t[pos]-s[i];
		if(pos-1<b&&pos-1>=0) ss[i]=min(ss[i],s[i]-t[pos-1]);
	}
	rep(i,b)
	{
		int pos=lower_bound(s,s+a,t[i])-s;
		if(pos<a&&pos>=0) tt[i]=s[pos]-t[i];
		if(pos-1<a&&pos-1>=0) tt[i]=min(tt[i],t[i]-s[pos-1]);
	}/*
	rep(i,a) cout<<ss[i]<<' ';
	cout<<endl;
	rep(i,b) cout<<tt[i]<<' ';
	cout<<endl<<endl;*/
	while(q--)
	{
		cin>>x;
		LL pos=lower_bound(s,s+a,x)-s;
		if(pos<a&&pos>=0) ans=min(ans,s[pos]-x+ss[pos]);//cout<<s[pos]<<' '<<x<<' '<<ss[pos]<<endl;
		if(pos-1<a&&pos-1>=0) ans=min(ans,x-s[pos-1]+ss[pos-1]);//cout<<s[pos-1]<<' '<<x<<' '<<ss[pos-1]<<endl;
		pos=lower_bound(t,t+b,x)-t;
		if(pos<b&&pos>=0) ans=min(ans,t[pos]-x+tt[pos]);//cout<<t[pos]<<' '<<x<<' '<<tt[pos]<<endl;
		if(pos-1<b&&pos-1>=0) ans=min(ans,x-t[pos-1]+tt[pos-1]);//cout<<t[pos-1]<<' '<<x<<' '<<tt[pos-1]<<endl;
		cout<<ans<<endl;
		ans=1e18;
	}
	rt0;
}

Measured memory_bytes: 4480
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
using ll = long long;




int main() {
	string s;
	cin >> s;
	if (s[0] == '9' || s[1] == '9') cout << "Yes" << endl;
	else cout<< "No" << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long num = sc.nextLong();
		long ans = 0;
		long prv = -1;
		long tmp = -1;
		for(int i = 0; i < num; i ++) {
			prv = tmp;
			tmp = sc.nextLong();
			if(prv == tmp) {
				tmp = -1;
				ans ++;
			}
		}
		System.out.println(ans);
	}
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1e9+7) {
  int val = (a % mod) + (b % mod);
  if (val < 0) { val += mod; }
  a = val;
}

// ------------------------------------------------------------------------------------------

const int MOD = 1e9 + 7;

string K;
int D;

int dp[11111][2][111];

signed main() {
  cin >> K >> D;
  int n = K.size();

  dp[0][0][0] = 1;
  for (int digit = 0; digit < n; digit++) {
    for (int smaller : {0, 1}) {
      for (int modD = 0; modD < D; modD++) {
        int lim = smaller ? 9 : K[digit] - '0';
        for (int num = 0; num <= lim; num++) {
          Add(dp[digit+1][smaller || num < lim][(modD + num) % D], dp[digit][smaller][modD]);
        }
      }
    }
  }

  int ans = 0;
  for (int smaller : {0, 1}) {
    Add(ans, dp[n][smaller][0]);
  }
  Add(ans, -1LL);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 18688