akhauriyash/Code-Regression huggingface dataset:
/*** 𝕒𝕜𝕤𝕙𝕒𝕪𝕜𝕦𝕞𝕒𝕣𝟡𝟡 ***/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD=1e9+7;
const long double PI = acos(-1);
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=1e6+1;
 
typedef long long ll;
typedef long double ld;

void test_case()
{
    ll n,i,j,sum=0;
    cin>>n;
    f(i,1,n+1)
    {
        if(i%3==0 || i%5==0)
            continue;
        else
            sum+=i;
    }
    cout<<sum<<'\n';

}

int main()
{
    IOS();
 
    int tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}

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

int main() {
  int a, b, c, d;
  
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  
  if ( a + b > c + d) {
    cout << "Left" << endl;
  }else if ( a + b < c + d) {
        cout << "Right" << endl;
  } else if (a + b == c + d) {
        cout << "Balanced" << endl;
  }
}

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

int main() {
  int n;
  cin>>n;
  map<int, int> m;
  long long sum = 0;
  for (int i=0; i<n; i++) {
    int ai;
    cin>>ai;
    ++m[ai];
    sum += ai;
  }
  int Q;
  cin>>Q;
  for (int _=0; _<Q; _++) {
    int b, c;
    cin>>b>>c;
    if (m.find(b) == m.end()) {
      cout<<sum<<endl;
      continue;
    }
    int tmp = m[b];
    sum -= 1LL * tmp * b;
    sum += 1LL * tmp * c;
    m.erase(b);
    m[c] += tmp;
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 6560
#include<iostream>
int main()
{
	int data[10000][2];
	int number;
	for(int i = 0;; i++)
	{
		for(int j = 0; j < 2; j++)
		{
			std::cin >> data[i][j];
		}
		if(data[i][0] == 0 && data[i][1] == 0)
		{
			number = i;
			break;
		}
	}
	for(int i = 0; i < number; i++)
	{
		std::cout << (data[i][0] > data[i][1] ? data[i][1] : data[i][0]) << ' ' <<  (data[i][0] > data[i][1] ? data[i][0] : data[i][1]) << std::endl;
	}
	return 0;
}


Measured memory_bytes: 2988
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long ll;
int N;
ll X;

vector<ll> a(1, 1);
vector<ll> p(1, 1);

ll f(int N, ll X) {
  if (N == 0) {
    if (X <= 0) {
      return 0;
    }
    else {
      return 1;
    }
  }
  else if (X <= 1 + a[N-1]) {
    return f(N-1, X-1);
  }
  else {
    return p[N-1] + 1 + f(N-1, X-2-a[N-1]);
  }
}

int main() {
  cin >> N >> X;  
  for (int i = 0; i < N; ++i) {
    a.push_back(a[i] * 2 + 3);
    p.push_back(p[i] * 2 + 1);
  }

  cout << f(N, X) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

enum LOC{
	to_left,
	to_right,
};

struct Info{
	bool operator<(const struct Info &arg) const{
		return per_time < arg.per_time;
	};
	int per_time,sum_time,rest_count;
	double position,pre_pos;
	LOC loc;
	bool erased;
};

int N;
LOC most_slow_loc;
int most_slow_id,most_slow_sum_time,most_slow_per_time;

void func(){

	vector<Info> V;

	for(int i = 0; i < N; i++){
		Info info;
		scanf("%d %d",&info.per_time,&info.rest_count);
		info.sum_time = 0;
		info.loc = to_left;
		info.position = 0;
		info.erased = false;
		V.push_back(info);
	}

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

	int num = N;
	int ans = 0,index;
	double tmp;

	for(int time = 1; time <= 160000; time++){

		if(num == 1){

			for(int i = 0; i < V.size();i++){
				if(V[i].erased == false){
					index = i;
					break;
				}
			}

			V[index].position = (double)(time-V[index].sum_time)/(double)V[index].per_time;

			if(V[index].position >= 1.0){
				if(V[index].loc == to_left){
					ans = time + V[index].per_time + 2*(V[index].rest_count-1)*V[index].per_time;
					num--;
				}else{
					V[index].rest_count -= 1;
					if(V[index].rest_count == 0){
						ans = time;
						num--;
					}else{
						ans = time + 2*V[index].rest_count*V[index].per_time;
						num--;
					}
				}
			}

		}else{

			for(int i = V.size()-1; i >= 0; i--){
				if(V[i].erased)continue;
				V[i].pre_pos = V[i].position;
				V[i].position = (double)(time-V[i].sum_time)/(double)V[i].per_time;
			}
			for(int i = V.size()-2; i >= 0;i--){
				if(V[i].erased)continue;
				index = -1;
				for(int k = i+1; k < V.size();k++){
					if(V[k].erased == true || k == i)continue;

					if(V[i].loc == V[k].loc && V[i].pre_pos < V[k].pre_pos){
						if(index == -1){
							tmp = V[k].pre_pos;
							index = k;
						}else{
							if(tmp > V[k].pre_pos){
								tmp = V[k].pre_pos;
								index = k;
							}
						}
					}
				}
				if(index == -1){
					//Do nothing
				}else{
					if(V[i].position >= V[index].position){
						if(V[index].position >= 1.0){

						}else{
							V[i].position = V[index].position-EPS;
						}
					}
				}
			}

			for(int i = 0; i < V.size();i++){
				if(V[i].erased)continue;

				if(V[i].position >= 1.0){
					V[i].sum_time = time;
					V[i].position = 0.0;
					if(V[i].loc == to_left){
						V[i].loc = to_right;
					}else{
						V[i].rest_count -= 1;
						if(V[i].rest_count == 0){
							ans = time;
							V[i].erased = true;
							num--;
						}else{
							V[i].loc = to_left;
						}
					}
				}
			}
		}

		if(num == 0)break;
	}

	printf("%d\n",ans);
}

int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
#define mod ll(10e8+7)
using namespace std;
int main()
{
    ll n,r;
    cin>>n>>r;
    if(n>=10)
        cout<<r<<endl;
    else cout<<r+100*(10-n)<<endl;
    return 0;
}


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

using namespace std;

#define boost                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long int
// #define int ll
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<ll, ll>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for (auto &z : v)
#define sp << ' ' <<
#define sps << ' '
#define nl "\n"
// #define nl endl
#define fat 1000000007
// #define fat 998244353
#define PI_2 1.57079632679489661923

int main()
{
    boost;
    time_t tic, toc;

    ll tt = 1, n, m, k = 0, i, j, p, q;
    ll a, b, c, h, w, u, v, x, y;
    ll l = 0, r = 0;
    ll ans = 0;

    bool poss = true;

    string s, t, tmp;

    // cin >> tt;
    tic = clock();
    for(int _ = 1; _ <= tt; _++){
        // cout << "Case #" << _ << ": ";
        cin >> h >> w >> k;
        vector<string> clr(h);
        for(i = 0; i < h; i++){
            cin >> clr[i];
        }

        ans = 0;
        ll tmp = 0;
        ll rmsk = (1 << h), cmsk = (1 << w);
        for(i = 0; i < rmsk; i++){
            for(j = 0; j < cmsk; j++){
                tmp = 0;
                for(r = 0; r < h; r++){
                    for(c = 0; c < w; c++){
                        if((1 << r)&i) continue;
                        if((1 << c)&j) continue;

                        if(clr[r][c] == '#') tmp++;
                    }
                }
                ans += (tmp == k);
            }
        }
        cout << ans << nl;
    } 
    // cerr << (clock() - tic*1.0) / CLOCKS_PER_SEC << nl;
    return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007

//read question carefully!

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //   cin >> t;
    while (t--)
    {
        string s;
        cin >> s;
        int q;
        cin >> q;
        string f = "", b = "";

        int cur = 0;
        while (q--)
        {
            int x;
            cin >> x;
            if (x == 1)
            {
                cur ^= 1;
            }
            else
            {
                int y;
                cin >> y;
                char ch;
                cin >> ch;
                y--;
                if (y ^ cur)
                {
                    b += ch;
                }
                else
                {
                    f += ch;
                }
            }
        }
        if (cur)
        {
            swap(f, b);
            reverse(s.begin(), s.end());
        }
        reverse(f.begin(), f.end());
        cout << f << s << b << "\n";
    }
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define int long long int
#define endl "\n"
using namespace std;
void solve()
{
	bool flag=true;
	//Enter your code here Tanmay:)
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b||b==c||a==c)
		flag=false;
	if(a==b&&b==c)
		flag=true;
	if(flag)
		cout<<"No";
	else
		cout<<"Yes";
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}
/*
int eulortotent(int n)
     {
    //Enter your code here Tanmay:)
    int total=n;
        for(int p=2;p*p<=n;p++)
        {
            if (n%p==0)
        {
            total /= p;
            total *= (p-1);
            while ( n % p == 0 ) 
                n /= p;
        }
    }

    if(n>1)
    {
        total/=n;
        total*=(n-1);
    }

  return total;
}
*/

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MOD 1000000007LL
#define MAX 100005
#define NIL -1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> doup;

ll H, W;
char s[50][50];
ll d[50][50];
ll black=0;
ll dx[4]={-1, 0, 1, 0};
ll dy[4]={0, -1, 0, 1};

void bfs() {
    queue<P> que;
    ll i;
    que.push(P(0, 0));
    d[0][0]=1;
    
    while(que.size()) {
        P p=que.front(); que.pop();
        
        if(p.first==H-1 && p.second==W-1) break;
        for(i=0; i<4; i++) {
            ll nx=p.first+dx[i], ny=p.second+dy[i];
            if(0<=nx && nx<H && 0<=ny && ny<W && s[nx][ny]!='#' && d[nx][ny]==INF) {
                d[nx][ny]=d[p.first][p.second]+1;
                que.push(P(nx, ny));
            }
        }
    }
}



int main(void) {
    ll i, j;
    cin >> H >> W;
    ll ans=0;
    for(i=0; i<H; i++) {
        for(j=0; j<W; j++) {
            cin >> s[i][j];
            d[i][j]=INF;
            
            if(s[i][j]=='#')
                black++;
        }
    }
    
    bfs();
    
    ans=H*W-d[H-1][W-1]-black;
    if(d[H-1][W-1]!=INF)
        cout << ans << endl;
    else
        cout << -1 << endl;
}


Measured memory_bytes: 256
import std.stdio;
import std.range;
import std.algorithm;
import std.array;
import std.string;

void main() {
    int h, w;
    readf("%d %d\n", &h, &w);
    // bool[50][50] x;
    bool[][] x;
    x.length = h;
    foreach (i; 0..h) {
        string s;
        readf("%s\n", &s);
        x[i] = s.map!(c => c == '#').array;
    }

    foreach (i; 0..h) {
        foreach (j; 0..w) {
            if (x[i][j]) {
                if (
                    (i > 0 && x[i-1][j]) ||
                    (j > 0 && x[i][j-1]) ||
                    (i < h-1 && x[i+1][j]) ||
                    (j < w-1 && x[i][j+1])
                    ) continue;
                write("No");
                return;
            }
        }
    }
    write("Yes");
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;
    static CF_Reader in;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in = new CF_Reader();

        int n = in.intNext();
        int m = in.intNext();

        StringBuilder result = new StringBuilder();
        int half = m / 2;
        int ln = half * 2;
        for (int i = 1; i <= half; i++) result.append(String.format("%d %d\n", i, ln - i + 2));
        int k = half * 2 + 2;
        if (m % 2 == 1) {
            half += 1;
            ln = half * 2;
        }
        for (int i = 0; i < half; i++) result.append(String.format("%d %d\n", i + k, ln - i - 1 + k));
        out.println(result);

        out.close();
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


Measured memory_bytes: 93728
#include <stdio.h>
//#include <stdlib.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int n, ans;
  scanf("%d", &n);
  if (n<105) ans = 0;
  else if (n<135) ans = 1;
  else if (n<165) ans = 2;
  else if (n<189) ans = 3;
  else if (n<195) ans = 4;
  else ans = 5;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

ll n;
ll d[MAXN];

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	
	cin >> n;

	for (int i = 0; i < n; ++i)
		cin >> d[i];

	sort(d, d+n);

	ll minn = LLONG_MAX;

	for (int p = d[0]; p <= d[n-1]; ++p)
	{
		ll ans = 0;
		for (int i = 0; i < n; ++i)
			ans += (d[i]-p) * (d[i]-p);
	
		minn = min(ans, minn);
	}


	cout << minn << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    string st;
    cin>>st;
    int x;
    for (int i=0;i<st.size();i++)
    {
        x=st[i]-'A'+n;
        x%=26;
        char ch='A'+x;
        cout<<ch;
    }
    cout<<endl;
    return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
typedef long long ll;
const int MAX = 999999999;

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

    int fx = 0;
    for(auto itr = n.begin(); itr != n.end(); itr ++){
        fx += *itr - '0';
    }

    if(stoi(n) % fx == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// << fixed << setprecision
// --------------------------------------
#include <cassert>
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
mint dp[100005][4];
string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> s;
  int sl = s.length();
  dp[0][0] = 1;
  REP(i, sl) {
    REP(j, 4) {
      if(s[i] != '?') dp[i + 1][j] += dp[i][j];
      else dp[i + 1][j] += dp[i][j] * 3;
    }

    if(s[i] == 'A' || s[i] == '?') dp[i + 1][1] += dp[i][0];
    if(s[i] == 'B' || s[i] == '?') dp[i + 1][2] += dp[i][1];
    if(s[i] == 'C' || s[i] == '?') dp[i + 1][3] += dp[i][2];
  }

  cout << dp[sl][3] << endl;
}


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

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


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  cin>>n;
  set<ll> s;
  rep(i,0,n){
    ll a;
    cin>>a;
    if(s.count(a)) s.erase(a);
    else s.insert(a);
  }
  cout<<s.size()<<endl;
}

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

typedef long long ll;

int main() { 
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<vector<bool>> a(n, vector<bool> (26));
	vector<vector<bool>> b(n, vector<bool> (26));
	a[0][s[0] - 'a'] = 1;
	for (int i = 1; i < n; ++i) {
		for (int j = 0; j < 26; ++j) {
			a[i][j] = a[i - 1][j];
		}
		a[i][s[i] - 'a'] = 1;
	}
	b[n - 1][s[n - 1] - 'a'] = 1;
	for (int i = n - 2; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) {
			b[i][j] = b[i + 1][j];
		}
		b[i][s[i] - 'a'] = 1;
	}
	int ans = 0;
	for (int i = 0; i + 1 < n; ++i) {
		int p = 0;
		for (int j = 0; j <  26; ++j) {
			p += min(a[i][j],b[i + 1][j]);
		}
		ans = max(ans,p);
	}
	cout << ans;
}


Measured memory_bytes: 256
/**
 *    author:  tourist
 *    created: 14.07.2019 15:48:21       
**/
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    --x; --y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  if (m % 2 == 1) {
    cout << -1 << '\n';
    return 0;
  }
  vector<pair<int, int>> res;
  vector<int> deg(n, 0);
  vector<int> depth(n, -1);
  function<void(int, int)> Dfs = [&](int v, int pr) {
    for (int u : g[v]) {
      if (depth[u] == -1) {
        depth[u] = depth[v] + 1;
        Dfs(u, v);
      } else {
        if (depth[u] > depth[v]) {
          res.emplace_back(v, u);
          ++deg[v];
        }
      }
    }
    if (deg[v] % 2 == 1) {
      assert(pr != -1);
      res.emplace_back(v, pr);
      ++deg[v];
    } else {
      if (pr != -1) {
        res.emplace_back(pr, v);
        ++deg[pr];
      }
    }
  };
  depth[0] = 0;
  Dfs(0, -1);
  for (auto& p : res) {
    cout << p.first + 1 << " " << p.second + 1 << '\n';
  }
  return 0;
}

Measured memory_bytes: 14836
//abc070_d.cpp
//Sun Sep 30 14:57:55 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;
struct edge {ll to, cost;};

vector<edge> G[100000];
ll d[100000];
ll v,e;

void dijkstra (ll s){
	priority_queue<P, vector<P>, greater<P>> pq; //小さい順 
	fill (d,d+v,LLINF);
	d[s] = 0;
	pq.push(P(0,s));
	while(!pq.empty()){
		P p = pq.top();
		pq.pop();
		ll vtemp = p.second;
//		cout << p.first << " " << p.second << "     ";
		if (d[vtemp] < p.first){
//			cout << "pass" << endl;
			continue;
		}
		for (int i=0;i<G[vtemp].size();i++){
			edge e = G[vtemp][i];
			if (d[e.to] > d[vtemp] + e.cost){
				d[e.to] = d[vtemp] + e.cost;
				pq.push(P(d[e.to],e.to));
			}
		}
//		for (int i=0;i<v;i++){
//			cout << d[i] << " ";
//		}
//		printf("\n");
	}
}


int main(){
	cin >> v;
	e = v-1;

	for (int i=0;i<v-1;i++){
		ll a,b,c;
		cin >> a >> b >> c;
		a--;
		b--;
		edge temp;
		temp.to = b;
		temp.cost = c;
		G[a].push_back(temp);
		temp.to = a;
		G[b].push_back(temp);
	}

	ll q,k;
	cin >> q >> k;
	k--;
	dijkstra(k);
	ll dk[v-1];
	for (int i=0;i<v;i++){
		dk[i] = d[i];
	}

	for (int i=0;i<q;i++){
		ll x,y;
		ll ans = 0;
		cin >> x >> y;
		x--;
		y--;
//		dijkstra(x);
//		ans += d[k];
//		dijkstra(k);
		ans += dk[x] + dk[y];
		cout << ans << endl;
	}

//	cout << << endl;
//	printf("%.4f\n",ans);
}

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

typedef long long LL;
typedef unsigned long long ULL;
#define int long long
#define debug printf("fuck %d\n", __LINE__);

inline LL read() {
	LL res = 0, bo = 1; char ch = getchar();
	while(ch < '0' || ch > '9') { if (ch == '-') bo = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9') { res = (res << 1) + (res << 3) + ch - '0'; ch = getchar(); }
	return bo * res;
}

template<typename T> void read(T &x) { x = read(); }
template<typename T, typename ...Argv> void read(T &a, Argv &...argv) { read(a); read(argv...); }

LL a[20];

LL dfs(int l, int r, LL cl, LL cr) {
	if (r - l <= 1) return 0;
	LL ans = 1e18;
	for (int i = l + 1; i < r; ++ i) {
		ans = std::min(dfs(l, i, cl, cl + cr) + dfs(i, r, cl + cr, cr) + a[i] * (cl + cr), ans);
	}
	return ans;
}

signed main() {
	int n = read();
	for (int i = 1; i <= n; ++ i) a[i] = read();
	std::cout << dfs(1, n, 1, 1) + a[1] + a[n] << std::endl;
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>

using namespace std;

int N,K,p[2000];

int main()
{
    cin >> N >> K;
    for(int i = 0;i < N; ++i)
        cin >> p[i];
    sort(p,p + N);
    int ans = 0;
    for(int i = 0; i< K; ++i)
        ans += p[i];
    cout << ans << endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	vector<long long> H;
	for(int i=0;i<n;i++){
        int x;
        cin>>x;
        H.push_back(x);
	}
	sort(H.begin(),H.end());
	long long int sum=0;
	for(int i=0;i<n-k;i++){
        sum+=H[i];
	}
	cout<<sum<<endl;


}


Measured memory_bytes: 2420
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC087A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, a, b, c;
            x = int.Parse(Console.ReadLine());
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());

            c = (x - a) % b;

            Console.WriteLine(c);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
D, G = map(int, input().split())
ps = []
cs = []
for i in range(D):
    p, c = map(int, input().split())
    ps.append(p)
    cs.append(c)

ans = 1 << 60
for S in range(1 << D):
    score = 0
    num = 0
    for i in range(D):
        if (S >> i) & 1:
            score += cs[i] + ps[i] * 100 * (i + 1)
            num += ps[i]
    for i in reversed(range(D)):
        if not (S >> i) & 1:
            index = 0
            while score < G and index < ps[i]:
                score += 100 * (i + 1)
                num += 1
                index += 1
    if score >= G:
        ans = min(ans, num)
print(ans)


Measured memory_bytes: 3064
s,t=input(),input()
n=len(s)
m=len(t)
ans="z"*(n+1)
for i in range(n-m+1):
    p=s[:i].replace("?","a")

    for j in range(m):
        if s[i+j]in("?",t[j]):
            p+=t[j]
        else:break
    else:

        p+=s[len(p):].replace("?","a")
        ans=min(ans,p)
print("UNRESTORABLE" if len(ans)==n+1 else ans)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main{

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter wr = new PrintWriter(System.out);
        String str = br.readLine().trim();
        
        if(str.contains("a")&&str.contains("b")&&str.contains("c"))System.out.println("Yes");
        else System.out.println("No");

	}

}

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


def solve(r: int):
    print(3 * r * r)


# Generated by 1.1.4 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()
    r = int(next(tokens))  # type: int
    solve(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <stdio.h>

int main() {
	int r = 0;
	scanf("%d", &r);
	
	if (r < 1200) {
		printf("ABC");
	}else if (r < 2800) {
		printf("ARC");
	}
	else {
		printf("AGC");
	}

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

int main() {
    string a;
    cin >> a;
    sort(a.begin(), a.end());
    if (a.at(0) == a.at(1) && a.at(1) != a.at(2) && a.at(2) == a.at(3))cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
function main(input) {
  const n = parseInt(input[0]);
  switch(n%10){
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      console.log("hon");
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      console.log("pon");
      break;
    case 3:
      console.log("bon");
      break;
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 29628
#include<stdio.h>
int main(void){
  int N,i,j;
  int A[100]={0};
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<N-1;i++){
    for(j=i+1;j<N;j++){
      if(A[i]<A[j]){
    	int t=A[i];
    	A[i]=A[j];
    	A[j]=t;
  		}
    }
  }
  printf("%d\n",A[0]-A[N-1]);
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main(void)
{
    char str[1001];
    while(scanf("%s",str) != EOF){
        int i;
        for(i = 0; i < strlen(str); i++){
            if(str[i] == 'A' || str[i] == 'B' || str[i] == 'C'){
                str[i] += 23;
            }
            else{
                str[i] -= 3;
            }
        }
        printf("%s\n",str);
    }
    return 0;
}

Measured memory_bytes: 524
open Printf open Scanf
open Array

let () = scanf " %d" @@ fun n ->
  printf "%.120f" (
    init n (fun _ -> scanf " %f %s" @@ fun x -> function
    | "BTC" -> x *. 380000.
    | "JPY" -> x
    ) |> fold_left (+.) 0.
  )

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define Yes()           printf("Yes\n")
#define No()            printf("No\n")
#define YES()           printf("YES\n")
#define NO()            printf("NO\n")
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

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

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int n; cin >> n;
  vector<int> a(n); rep(i, n) cin >> a[i];
  int ans = 0;
  int i = 1;
  while (i < n) {
    if (a[i-1] == a[i]) {
      i += 2;
      ans++;
    } else {
      i++;
    }
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


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

int main() {
  string S;
  cin >> S;
  
  if(S == "AAA" || S == "BBB"){
    cout << "No" << endl;
  }
  
  if(S != "AAA" && S != "BBB"){
  	cout << "Yes" << endl;
  }
  
}


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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
 ll gcd(ll a,ll b){
 if(b == 0) return a;
 return gcd(b,a%b);
 }

//最小公倍数
 ll lcm(ll a,ll b){
 ll g = gcd(a,b);
 return a / g * b; // Be careful not to overflow  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 




int main(){
  int K, S;
  cin >> K >> S;

  int cnt = 0;
  REP(y, K + 1)REP(x, K + 1){
    int Z = S - y - x;
    if(Z >= 0 && Z <= K) cnt++;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 256
N = int(input())
B = [i for i in map(int, input().split())]

A = [0] * N
for i in range(N - 1):
    if i == 0:
        A[i] = B[i]
    if A[i] > B[i]:
        A[i] = B[i]
    A[i + 1] = B[i]
print(sum(A))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int>A(N);
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        if(A[i]%2 == 1) {
            cnt++;
        }
    }
    if(cnt%2 == 1) {
        cout << "NO" << endl;
    }
    else {
        cout << "YES" << endl;
    }
}

Measured memory_bytes: 640
s = input()
s = s[::-1]
ans = ["maerd","remaerd","esare","resare"]
flag = 1
while len(s) != 0 and flag == 1:
    flag = 0
    if s[:5] in ans:
        s = s[5:]
        flag = 1
    elif s[:7] in ans:
        s = s[7:]
        flag = 1
    elif s[:6] in ans:
        s = s[6:]
        flag = 1
        
if flag == 0:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3188
from scipy.sparse import*
def main():
  f=csgraph.floyd_warshall
  n,m,l,*t=map(int,open(0).read().split())
  d=[[0]*(n+1)for _ in range(n+1)]
  for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
  d=f(f(d,0)<=l)-1
  d[d>n]=-1
  print('\n'.join(map(str,[d[i]for i in zip(*[iter(t[m*3+1:])]*2)])))
main()

Measured memory_bytes: 40760
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};

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

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

	int a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	int mini=a[0],dif=0,ans=0;
	bool newmini=true;
	for(int i=1;i<n;i++){
		if(a[i-1]<mini){
			mini=a[i-1];
			newmini=true;
		}
		if(a[i]-mini > dif){
			dif = a[i]-mini;
			ans=1;
			newmini=false;
		}else if(a[i]-mini==dif && newmini){
			ans++;
		}
	}
	cout << ans << "\n";

	return 0;
}

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



  int mi=100;
  int ma=105;
  while (mi<=n) {
    if(mi<=n && n<=ma){
      std::cout << "1" << '\n';
      return 0;
    }
    mi+=100;
    ma+=105;
  }

  std::cout << "0" << '\n';

  return 0;
}


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

int N, W;
int v[101];
int w[101];
int dp[101][10001];

int rec(int i, int j){
    if(i < 0 || j < 0) return 0;
    if(dp[i][j] != -1) return dp[i][j];
    
    int ret = 0;
    if(j >= w[i]) ret = max(rec(i-1, j), rec(i-1, j-w[i]) + v[i]);
    else ret = rec(i-1, j);
    
    return dp[i][j] = ret;
}

int main(void){
    // Your code here!
    cin >> N >> W;
    
    for(int i = 0; i < N; i++) cin >> v[i] >> w[i];
    for(int i = 0; i <= 100; i++) for(int j = 0; j <= 10000; j++) dp[i][j] = -1;
    cout << rec(N-1, W) << endl;
}



Measured memory_bytes: 7052
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define ll long long 
int cmp(const void*a,const void*b){return *(int*)a-*(int*)b;}
int main(){
    int a[3];
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    qsort(a,3,sizeof(int),cmp);
    if(a[0]==a[1]){
        if(a[1]!=a[2]){
            puts("Yes");
            return 0;
        }
    }
    else if(a[0]==a[2]){
        if(a[1]!=a[2]){
            puts("Yes");
            return 0;    
        }
    }
    else if(a[1]==a[2]){
        if(a[0]!=a[1]){
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    string tmp;
    int count = 1;
    for(int i = 0; i < n; i++){
        cin >> s.at(i);
    }
    sort(s.begin(), s.end());
    tmp = s.at(0);
    for(int i = 1; i < n; i++){
        if(tmp != s.at(i)){
            count++;
            tmp = s.at(i);
        }
    }
    cout << count << endl;

}

Measured memory_bytes: 9600
from sys import stdin

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        j = B[i] - A[i]
        if j <= 0:
            ans += B[i]
        else:
            ans += min(A[i] + A[i+1], B[i])
            A[i+1] = max(0, A[i+1] - j)
    print(ans)

input = lambda: stdin.readline()
main()


Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;
struct Sieve {
    ll n;
    vi f;
    vi primes;
    // constructor
    Sieve(ll n=1) : n(n), f(n+1,0) {
        f.at(0) = -1;
        f.at(1) = -1;
        for(ll i = 2; i <= n; ++i){
            if (f.at(i)!=0) continue;
            primes.push_back(i);
            f.at(i) = i;
            for (ll j = i*i; j <= n; j += i) {
                if(f.at(j)==0) f.at(j) = i;
            }
        }
    }
    // xが素数かを判定
    bool isPrime(ll x) {
        return f.at(x) == x;
    }
    // xを素因数分解する関数(分解後の値を昇順の配列にして返す)
    // (100) => ([2,2,5,5]);
    vi primeFactorizedList(ll x) {
        vi res;
        while (x != 1) {
            res.push_back(f.at(x));
            x /= f.at(x);
        }
        return res;
    }
    // 素因数分解したときの各因数の個数をsecondに持つpairにする
    vector<P> primeFactorizedPair(ll x) {
        vi fl = primeFactorizedList(x);
        if (fl.size() == 0) return {};
        vector<P> res(1, P(fl.at(0), 0));
        for (ll p : fl) {
            if (res.back().first == p) {
                res.back().second++;
            } else {
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
};

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll n;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a.at(i);
    Sieve si(1000001);
    vi used(1000001);
    bool pairwise = true;
    bool setwise = true;
    rep(i,n){
        auto list = si.primeFactorizedPair(a.at(i));
        for(auto x : list){
            if(used.at(x.first)!=0) pairwise = false;
            used.at(x.first)++;
        }
    }
    rep(i,1000001){
        if(used.at(i)==n){
            setwise = false;
            break;
        }
    }
    if(pairwise){
        cout << "pairwise coprime" << endl;
    }else if(setwise){
        cout << "setwise coprime" << endl;
    }else{
        cout << "not coprime" << endl;
    }
}

Measured memory_bytes: 27492
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORP(i, m, n) for(int i = m; i < n+1; i++)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
using UnweightedGraph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
const int INF = 2000000000ll;
const long double PI = acosl(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int power(int a, int b) {return b?power(a*a,b/2)*(b%2?a:1):1;}
int perm(int N, int K){
    int x=1;
    for(int i=1;i<=K;i++)
    {
        x=x*(N-i+1);
    }
    return x;
}
int factorial(int N) {return perm(N,N);}
int comb(int N,int K) {return factorial(N)/factorial(K)/factorial(N-K);}
int hcomb(int N, int K) {return comb(N+K-1, N-1);}

int dtoi(double d) {return round(d);}

int isprime(int n) {
    if (n < 2) return 0;
    for (int i = 2; i*i <= n; ++i) {
        if (n % i ==  0) return 0;
    }
    return 1;
}

int mystoll(string S){
    int num = 0;
    for (int i = (int) S.length()-1; i >= 0; i--){
        num += (S[i]-'0') * power(10,S.length()-1-i);
    }
    return num;
}

template<class T>
int SUM(T a) {
    int sum = 0;
    for(auto iter : a) sum += iter;
    return sum;
}

void solve(int N, const vector<int> & A);

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int N;
    cin >> N;
    vector<int> A(N);
    unordered_map<int,int> L,R;
    REP (i, N) {
        cin >> A[i];
        L[A[i]+i]++;
        R[i-A[i]]++;
    }
    int ans = 0;
    for (auto itr : L) {
        ans += itr.second * R[itr.first];
    }
    pa;
    return 0;
}


/*
cd ~/Desktop/Programming/AtCoder/contest/abc166/abc166_e && sh test.sh
cd ~/Desktop/Programming/AtCoder/contest/abc166/abc166_e && sh etest.sh
cd ~/Desktop/Programming/AtCoder/contest/abc166/abc166_e && sh submit.sh
*/


Measured memory_bytes: 27964
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
vector<int>E[100010];
long long size[100010];
const long long mod=1e9+7;
int p=9901;
map<long,long>MP;
map<long,long>:: iterator temp;
void dfs(long long a)
{
	int i;
	size[a]=1;
	for(i=0;i<int(E[a].size());i++)
	{
		int v=E[a][i];	
		dfs(v);
		size[a]=(size[a]+p*size[v])%mod;
	}
//	size[a]=1+cur*n;
//	size[a]=(cur+size[a])%mod;
	MP[size[a]]++;
}
long long C(long long n,long long x)
{//从n中?x个
	if(n<x)
		return 0;
	return n*(n-1)/x;
}


int main()
{
	// freopen( "E.txt", "r", stdin );
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		memset(size,0,sizeof(size));
		int a,b;
		int i;
		for(i=1;i<n;i++)
		{
		 scanf("%d%d",&a,&b);
		 E[a].push_back(b);
		}
		dfs(1);
		sort(size+1,size+n+1);
		long long ans=0;
		long long sum=1;
		
		
		
		for(i=2;i<=n;i++)
		{
			if(size[i]==size[i-1])
				sum++;
			else
			{
				ans+=C(sum,2);
				sum=1;
			}
		}
		ans+=C(sum,2);
		
		// for(temp=MP.begin();temp!=MP.end();temp++)
		// 	ans += C(temp->second,2);
        printf("%lld\n",ans);
		for(i=1;i<=n;i++)
			E[i].clear();
		MP.clear();
	}
	return 0;
}

Measured memory_bytes: 25140
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    string t = s;
    reverse(t.begin(), t.end());
    cout << (s == t ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
s = sorted([int(input()) for _ in range(N)])

ans = sum(s)
if ans % 10 == 0:
  d = ans
  for i in range(N):
    if s[i]%10 != 0:
      d = s[i]
      break
  print(ans-d)
else:
  print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int N = sc.nextInt();
			int[] a = new int[N];
			int[] gcd_front = new int[N];
			int[] gcd_back = new int[N];
			for (int i = 0; i < N; i++) {
				a[i] = sc.nextInt();
				if (i == 0) gcd_front[i] = a[i];
				else gcd_front[i] = gcd(gcd_front[i - 1], a[i]);
			}
			gcd_back[N - 1] = a[N - 1];
			for (int i = N - 2; i >= 0; i--) {
				gcd_back[i] = gcd(gcd_back[i + 1], a[i]);
			}
			int max_gcd = 0;
			for (int i = 0; i < N; i++) {
				if (i == 0) max_gcd = Math.max(max_gcd, gcd_back[i + 1]);
				else if (i == N - 1) max_gcd = Math.max(max_gcd, gcd_front[i - 1]);
				else max_gcd = Math.max(max_gcd, gcd(gcd_front[i - 1], gcd_back[i + 1]));
			}
			System.out.println(max_gcd);
		}
	}

	static int gcd(int x, int y) {
		if (y == 0) return x;
		return gcd(y, x % y);
	}
}

Measured memory_bytes: 60232