akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {
    public static void main(String[] args) {
      	Scanner sc=new Scanner(System.in);
      	int n=sc.nextInt();
      	String s=sc.next();
      	int l=s.length();
      	String o="";
      	byte[] b=s.getBytes();
      	for(int i=0;i<l;i++){
          	b[i]+=n;
          	if(b[i]>90)b[i]-=26;
        }
      o=new String(b);
      	System.out.println(o);
    }
}

Measured memory_bytes: 23764
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

P = [i + a for i, a in enumerate(A, start=1)]
Q = [j - a for j, a in enumerate(A, start=1)]

ans = 0
QC = Counter(Q)
for p in P:
    ans += QC[p]

print(ans)


Measured memory_bytes: 50664
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#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 show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int n, k;


int count(int b){

    if (b <= k) return 0;
    if (k == 0) return n;
    int ans = 0;
    ans = ((b-k)*(n/b)) + max(0,((n%b)-k+1));
    return ans;
}


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

    ll ans = 0;
    rep1(b, n){
        ans += (ll)count(b);
        //cout << ans << endl;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n, a[1000002]={0}, b[1000002]={0};
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d", &a[i]);
    b[a[i]]++;
  }

  int ans=0;
  for(int i=1;i<=1000000;i++){
    if(b[i]==1)
      ans++;
    if(b[i]>0){
      for(int j=2;j*i<=1000000;j++){
        b[i*j]=0;
      }
    }
  }  
  printf("%d", ans); 
  return 0;
}


Measured memory_bytes: 9968
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
#define DEBUG 0
#define ll long long
#define Pll pair<ll, ll>
#define Pii pair<int, int>
 
using namespace std;
struct edge{int from, to; ll cost;};

ll mypow(ll p, ll n){
    ll ret = 1;
    rep(n){
        ret *= p;
        if(LLONG_MAX / p <= ret){
            return LLONG_MAX;
        }
    }
    return ret;
}

signed main(){
    ll N, A;
    cin >> N >> A;

    if(N<=3){
        cout << N << endl;
        return 0;
    }
    
    ll ans = N;
    reppp(k, 1, 40){
        ll ok = 10e12;
        ll ng = 1;
        while(abs(ok-ng) > 1){
            ll mid = (ok+ng)/2;
            ll tmp = mypow(mid, (ll)(k+1));
            if(tmp >= N || tmp == LLONG_MAX){
                ok = mid;
            }else{
                ng = mid;
            }
        }
        ll s1_num = 0;
        while(s1_num <= k && pow(ok-1, s1_num) * pow(ok, k+1-s1_num) >= N) s1_num++;
        if(s1_num < k+1 || pow(ok-1, s1_num) * pow(ok, k+1-s1_num) < N) s1_num--;
        //cout << k << " " << ok << " " << s1_num << endl;
        ans = min(ans, A*k + (ok-1)*s1_num + ok*(k+1-s1_num));
        //cout << A*k + (ok-1)*s1_num + ok*(k+1-s1_num) << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>






#define typ ll


const int N=310;
int prnt[N];
typ d[N];
bool vst[N];
vector<pair<int,int>>adj[N];
priority_queue<pair<typ,int>,vector<pair<typ,int>>,greater<pair<typ,int>>>m2;
pair<typ,int>p;

void dijkstra(int s,int n)
{
	for(int i=1;i<=n;i++)
	{
		d[i]=-1;
		vst[i]=false;
	}
	d[s]=0;
	p.first=d[s];
	p.second=s;
	m2.push(p);
	while(!m2.empty())
	{
		p=m2.top();
		int u=p.second;
		m2.pop();
		if(vst[u])continue;
		vst[u]=true;
		for(int i=0,v,w;i<adj[u].size();i++)
		{
			v=adj[u][i].first;
			w=adj[u][i].second;
			if(d[v]==-1 || d[u]+w<d[v])
			{
				prnt[v]=u;
				d[v]=d[u]+w;
				p.first=d[v];
				p.second=v;
				m2.push(p);
			}
		}
	}
}









ll n,u,v,w;
ll res;
vector<pair<int,pair<int,int>>>e;









void solve()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=i;j++)cin>>w;
		for(int j=i+1;j<=n;j++)
		{
			cin>>w;
			e.pb(mp(w,mp(i,j)));
		}
	}
	sort(e.begin(),e.end());
	res=0;
	for(int i=0;i<e.size();i++)
	{
		w=e[i].first;
		u=e[i].second.first;
		v=e[i].second.second;
		dijkstra(u,n);
		if(d[v]==-1||d[v]>w)
		{
			adj[u].pb(mp(v,w));
			adj[v].pb(mp(u,w));
			res+=w;
		}
		else if(d[v]<w)
		{
			cout<<"-1\n";
			return;
		}
	}
	cout<<res<<"\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 1148
#include<iostream>
using namespace std;
int main(){
  int n;
  int i,j,k;
  int build[4][3][10]={{{}}};
  cin >> n;
  int b,f,r,v;
  for(i=0;i<n;i++){
    cin >> b >> f >> r >> v;
    build[b-1][f-1][r-1]+=v;
  }
  for(i=0;i<4;i++){
    for(j=0;j<3;j++){
      for(k=0;k<10;k++){
	cout << " ";
	cout << build[i][j][k];
      }
      cout << endl;
    }
    if(i<3)cout << "####################" << endl;
  }
  return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
   ll n;cin >>n;
   vector<ll>prime;
   vector<bool>isprime(n,true);
    for (ll i = 2; i<=n; ++i) {
        if(isprime[i]){
            prime.push_back(i);
            for (ll j = 2*i; j<=n;j+=i) {
                isprime[j]=false;
            }
        }
    }
    map<ll,int>p;
    for (int i =2; i <=n; ++i) {
        ll c=i;
        for(auto u:prime){
            while(c%u==0){
                p[u]++;
                c/=u;
            }
        }
    }
    ll ans=1;
    for(auto u:p){
//        cout <<u.first<<" "<<u.second<<endl;
        ans*=(u.second+1)%mod;
        ans%=mod;
    }
//    ans%=mod;
    cout <<ans <<endl;
   return 0;
}



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

#define rep(i, a) for (int i = 0; i < (a); i++ )
#define FOR(i, m, n) for(int i = m; i < n; i++)
 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);
//----------------------------------------------------------------

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main(){
    int N;
    cin >> N;
    map<ll,ll> S;

    rep(i,N) {
        auto F = prime_factorize(i+1);

        rep(j,F.size()) {
            if(!S.count(F[j].first)) {
                S[F[j].first]=F[j].second;
            }
            else {
                S[F[j].first] += F[j].second;
            }
        }

    }

    ll ans = 1;
    for (auto p:S) {
        ans *= p.second+1;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int x1, y, x2, y2;
int x3, y3, x4, y4;

int main() {
	scanf("%d %d %d %d", &x1, &y, &x2, &y2);
	int dy = y2 - y, dx = x2 - x1;
	if(!dx) {
		x3 = x2 - dy, y3 = y2;
		x4 = x1 - dy, y4 = y;
	}
	else if(!dy) {
		x3 = x2, x4 = x1;
		y3 = y2 + dx, y4 = y + dx;
	}
	else {
		x3 = x2 - dy, x4 = x1 - dy;
		y3 = y2 + dx, y4 = y + dx;
	}
	printf("%d %d %d %d\n", x3, y3, x4, y4);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
#define mx 10000000000008
#define mod 1000000007
ll n,m,i,j,k,l,t,arr[sz],brr[sz],crr[sz];
vector<ll>v;
int main()
{
    t=1;
   // scanf("%lld",&t);
    while(t--)
    {
     scanf("%lld %lld %lld",&n,&m,&k);
     m*=k;
     if(m>=n)
        printf("Yes\n");
     else
        printf("No\n");
    }
    return 0;
}


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

using namespace std;

typedef long long int ll;
 
template<class T> inline bool chmax(T& a,T b){ if(a<b){ a=b; return true;} return false; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){ a=b; return true;} return false; }
 
typedef pair<int,int> pair;

int main(){
  int n,k; cin >> n >> k;
  
  double ans=0.0;
  int nc=n+1;
  double M=log2(k);
  while(nc>0){
    nc--;
    //cout << nc << endl;

    if(nc>=k){
      ans+=1.0;
      continue;
    }

    double N=log2(nc);
    double x=ceil(M-N); //cout << x << endl;
    ans+=pow(0.5,x); //printf("%.10Lf\n",ans);
  }

  ans*=1.0/n;

  printf("%.10lf\n",ans);
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(100000)

def dfs1(v,p):
    val=1
    pre_mul=[1]
    rev_mul=[]
    for c in links[v]:
        if c==p:
            pre_mul.append(val)
            rev_mul.append(1)
            continue
        res=1+dfs1(c,v)
        val*=res
        val%=m
        pre_mul.append(val)
        rev_mul.append(res)
    dp[v]=val
    for i in range(len(rev_mul)-2,-1,-1):
        rev_mul[i]*=rev_mul[i+1]
        rev_mul[i]%=m
    rev_mul.append(1)
    pre_muls[v]=[pre_mul,rev_mul]
    return val

def dfs2(v,p,a):
    dp[v]=dp[v]*a%m
    pmv=pre_muls[v]
    for i,c in enumerate(links[v]):
        if c==p:
            continue
        pmc=pmv[0][i]*pmv[1][i+1]%m
        pmc=pmc*a%m
        dfs2(c,v,pmc+1)

n,m=map(int,input().split())
links=[[] for _ in range(n)]
dp=[0 for _ in range(n)]
pre_muls=[None for _ in range(n)]
for line in sys.stdin.readlines():
    x,y=map(int, line.split())
    x-=1
    y-=1
    links[x].append(y)
    links[y].append(x)
dfs1(0,None)
dfs2(0,None,1)
print('\n'.join(map(str,dp)))


Measured memory_bytes: 180868
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    long long int p=-10000000000;
    long long int q=10000000000;
    long long int r=-10000000000;
    long long int s=10000000000;
    for(int i=0;i<n;i++){
    	long long int x,y;
    	cin>>x>>y;
    	p=max(p,x+y);
    	r=max(r,x-y);
    	q=min(q,x+y);
    	s=min(s,x-y);
	}
	long long int ans=-100000000000;
	ans=max(p-q,r-s);
    cout<<ans<<"\n";
	return 0;
}
	

Measured memory_bytes: 3632
import java.util.*;


public class Main {

	public static void main(String[] args) {
		
		// ?????????????????§??°?????\???
		Scanner scanner = new Scanner(System.in);
		String line = scanner.nextLine();
		String array[] = line.split(" ");
		Integer a = Integer.parseInt(array[0]);
		Integer b = Integer.parseInt(array[1]);
		scanner.close();
		
		if (a < b) {
		System.out.println("a < b");	
		} else if(a > b) {
		System.out.println("a > b");	
		} else {
		System.out.println("a == b");	
		}
		
	}

}

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

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

  vector<int> abc(3);
  for (int i = 0; i < s.size(); ++i) {
    abc[s[i] - 'a']++;
  }

  int ab = abs(abc[0] - abc[1]);
  int bc = abs(abc[1] - abc[2]);
  int ca = abs(abc[2] - abc[0]);

  bool can = ab < 2 && bc < 2 && ca < 2;

  if (can)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(){
	int a,b,d;
	char op;
	while(1){
		scanf("%d %c %d",&a,&op,&b);
		if(op=='?')break;
		else if(op=='+')printf("%d\n",a+b);
		else if(op=='-')printf("%d\n",a-b);
		else if(op=='*')printf("%d\n",a*b);
		else if(op=='/')printf("%d\n",a/b);
	}
	return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
const int N = 3003;

int n, m;
char a[N], b[N];

int dp[N][N];
int main()
{
    cin >> a >> b;
    n = strlen(a);
    m = strlen(b);
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 1; j <= m; ++j)
        {
            if (a[i - 1] == b[j - 1])
                dp[i][j] = dp[i - 1][j - 1] + 1;
            else
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
        }
    }
    vector<char> ans;
    int i = n, j = m;
    while (1)
    {
        if (!i || !j)
            break;
        if (a[i - 1] == b[j - 1])
        {
            ans.push_back(a[i - 1]);
            --j;
            --i;
            continue;
        }
        if (dp[i - 1][j] > dp[i][j - 1])
        {
            --i;
        }
        else
        {
            --j;
        }
    }
    reverse(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); ++i)
        cout << ans[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int X[101010];
int W,H,N;
int main(){
  cin >> W >> H >> N;
  rep(i,0,N - 1){
    int a,b;
    cin >> a >> b;
    X[b] = max(X[b],a);
  }
  for(int i = H - 1;i >= 1;i--){
    X[i - 1] = max(X[i - 1],X[i]);
  }
  int ans = W + H;
  rep(i,0,H - 1){
    ans = min(ans , i + X[i + 1]);
  }
  cout << ans << endl;
}



Measured memory_bytes: 3496
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define endl "\n"
const ll mod = 1000000007;
 
void testCase() {
    ll k;
    cin >> k;
    priority_queue <ll, vector<ll>, greater<ll>> q;
    q.push(1);
    q.push(2);
    q.push(3);
    q.push(4);
    q.push(5);
    q.push(6);
    q.push(7);
    q.push(8);
    q.push(9);
    map <ll, int> vis;
    vis[1] = 1;
    vis[2] = 1;
    vis[3] = 1;
    vis[4] = 1;
    vis[5] = 1;
    vis[6] = 1;
    vis[7] = 1;
    vis[8] = 1;
    vis[9] = 1;
    int cnt = 0;
    while (cnt < k) {
        ll val = q.top();
        q.pop();
        //cout << val << endl;
        cnt++;
        if (cnt == k) {
            cout << val << endl;
            return;
        }
        int di = val%10;
        for (int i=0; i<=9; i++) {
            int dif = abs (di - i);
            if (dif <= 1) {
                ll no = val*10 + i;
                if (vis[no] == 0) {
                    q.push(no);
                    vis[no] = 1;
                }
            }
        }
    }
    return;
}
 
int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    testCase();
    return 0;
}

Measured memory_bytes: 19952
#include<algorithm>
#include<array>
#include<climits>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

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


Measured memory_bytes: 256
#include <stdio.h>
#define max 100000

int n , m,q,from,to;
int rank[max],parent[max];

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

void unite(int x,int y)
{
	x = find(x);
	y = find(y);
	
	if(x == y)
	{
		return;
	}
	if(rank[x] < rank[y])
	{
		parent[x] = y;
	}
	else{
		parent[y] = x;
		if(rank[x] == rank[y])
		{
			rank[x]++;
		}
	}
}

int main(void)
{
	scanf("%d %d",&n,&m);
	
	for(int i = 0; i < n; i++)
	{
		rank[i] = 0;
		parent[i] = i;
	}
	for(int i = 0; i < m; i++)
	{
		scanf("%d %d",&from,&to);
		if(find(from) == find(to))
		{
			continue;
		}
		unite(from,to);
	}
	scanf("%d",&q);
	int left , right;
	
	for( int i = 0; i < q; i++)
	{
		scanf("%d %d",&left,&right);
		if(find(left) == find(right))
		{
			printf("yes\n");
		}
		else{
			printf("no\n");
		}
	}
	return 0;
}


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


int main() {
    int N, P;
    string S;
    cin >> N >> P >> S;
    long int ans = 0;

    if(P%2==0 || P%5==0) {
        for(int i=0; i<N; i++) {
            if( (S[i]-'0') % P == 0 ) {
                ans += i+1;
            }
        }
    } else {
        map<int, int> mp;
        mp[0] = 1;
        for(int i=1; i<P; i++) mp[i] = 0;
        int c = 0, pw = 1;
        for(int i=N-1; i>=0; i--) {
            c = ((S[i]-'0') * pw + c) % P;
            ans += mp[c];
            mp[c]++;
            pw = (pw*10) % P;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 900
#define _CRT_SECURE_NO_WARNINGS
#define MOD 998244353
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <functional>
#include <algorithm>
#include <iterator>
#include <cstdio>
#include <utility>
#include <unordered_map>
#include <cmath>
#include <chrono>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

typedef pair<ll, ll> P;
struct edge { ll to, cost; };

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

inline ll madd(ll a, ll b) {
	a %= MOD;b %= MOD;
	return (a + b) % MOD;
}
inline ll msub(ll a, ll b) {
	a %= MOD;b %= MOD;
	a += MOD;
	return (a - b) % MOD;
}
inline ll mmul(ll a, ll b) {
	a %= MOD;b %= MOD;
	return (a*b) % MOD;
}
inline ll mpow(ll a, ll r) {
	long long res = 1;
	while (r > 0) {
		if (r & 1) res = res * a % MOD;
		a = a * a % MOD;
		r >>= 1;
	}
	return res;
}
inline ll minv(ll a) {
	a %= MOD;
	ll b = MOD, u = 0, v = 1;
	while (a) {
		ll t = b / a;
		b -= t * a; swap(a, b);
		u -= t * v; swap(u, v);
	}
	if (u < 0) u += MOD;
	return u;
}
inline ll mdiv(ll a, ll b) {
	a %= MOD;
	a *= minv(b);
	return a%MOD;
}



struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

/*int V;
vector<edge> G[MAX_V];
int d[MAX_V]:
void dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P>> q;
	fill(d, d + V, INF);


}*/
int main(void) {
	int n;
	cin >> n;
	cout << (n - 2) * 180;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define VI vector<int>
#define PII pair<int, int>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
const int INF=1<<30; const ll LINF=1LL<<60 ; const ll MOD=1e9+7 ;
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; }
//-------------------


int main(){
	int a,b,c;
	cin >> a >> b >> c;
	bool ok = true;
	if(a != b) ok = false;
	if(b != c) ok = false;
	if(c != a) ok = false;

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

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef int Int;
typedef pair<Int,Int> pii;
typedef pair<Int,double> pid;
typedef pair<double,double> pdd;
typedef pair<Int,pii> pip;
typedef pair<double,Int> pdp;
#define A first
#define B second
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (x).size()
#define CLR(x) memset(x,0,sizeof x)
#define pdebug() printf("%d\n",__LINE__)
#define Itype(a) typeof(a.begin()) 
#define REP(i,a,b) for(int i = (a);i <= (b);i++)
#define FORO(i,n) REP(i,0,(int)n-1)
#define FORI(i,n) REP(i,1,(int)n)
#define FORIT(i,t) for(Itype(t) i = t.begin();i != t.end();i++)
#define eps 1e-6
#define sqr(x) ((x)*(x))
#define dist(_a,_b) sqrt(sqr(_a.A-_b.A)+sqr(_a.B-_b.B))
#define norm(_a) sqrt(sqr(_a.A)+sqr(_a.B))
template<typename T>void getMin(T &a,T b) { if(a > b) a = b; }
template<typename T>void getMax(T &a,T b) { if(a < b) a = b; }
const int MOD = 1000000007;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    ll toty = 0;
    double totb = 0;
    FORO(i, N) {
        double x; string u;
        cin >> x >> u;
        if(u == "BTC") totb += x;
        else toty += (ll)x;
    }
    printf("%lf\n",(double)toty + totb * 380000.);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
int main()
{
    int n,m,i,j,k,maxans,extra;
    cin >> n >> k;
    vector<pii>ed;
    maxans=(n-2)+(n-2)*(n-3)/2;
    if(k>maxans) cout << -1 << endl;
    else
    {
        ed.pb(mp(1,2));
        for(i=3;i<=min(n,k+2);i++)
        {
            ed.pb(mp(2,i));
        }

        for(i=k+3;i<=n;i++)
        {
            for(j=1;j<i;j++)
            {
                ed.pb(mp(j,i));
            }
        }
        j=ed.size();
        extra = maxans-k;

        if(extra){
            for(i=3;i<=min(n,k+2);i++)
            {
                for(j=i+1;j<=min(n,k+2);j++)
                {
                    ed.pb(mp(i,j));
                    extra--;
                    if(!extra) break;
                }
                if(!extra) break;
            }
        }
        j=ed.size();
        cout << j << endl;
        for(i=0;i<j;i++) cout << ed[i].xx << ' ' << ed[i].yy << endl;

    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#ifdef __DEBUG__
    void debug_out() { cerr << endl; } 
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) {cerr << " " << H; debug_out(T...);}
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 
#endif

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<pll> P;
inline void input(){
    fast_io();
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        ll x,y; cin >> x >> y;
        P.emplace_back(x+y,x-y);
    }
}

void chmax(ll &a, ll b){if(a<b) a=b;};

inline int solve(){
    ll ans = 0;
    sort(P.begin(),P.end());
    chmax(ans, abs(P[0].first - P[N-1].first));
    auto cmp_sec = [](pll a, pll b){return a.second < b.second;};
    sort(P.begin(),P.end(),cmp_sec);
    chmax(ans, abs(P[0].second - P[N-1].second));
    cout << ans << endl;
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 7420
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <math.h>

using namespace std;

int main() {
	int h1, m1, h2, m2, t;
	cin >> h1 >> m1 >> h2 >> m2 >> t;
	int mm1 = h1 * 60 + m1;
	int mm2 = h2 * 60 + m2;
	cout << max(mm2 - mm1 - t, 0) << endl;
	return 0;
}

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

int main(){
  int N ; 
  cin >> N ; 
  int Y ; 
  cin >> Y ;
  
  for(long long i = 0 ; i <= N ; i++){
    for(long long j = 0 ; j <= N ; j++){
      long long k = N - i - j ; 
      if(k*1000 + j*5000 + i*10000 == Y && k >= 0 && i >= 0 && j >= 0){
        cout << i << " " << j << " " << k << endl;
        return 0 ; 
      }
    }
  }
  
  cout << -1 << " " << -1 << " " << -1 << endl ; 
}

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

int main(){
    ll q, h, s, d, n;
    cin >> q >> h >> s >> d;
    cin >> n;
    int a = min(4*q,min(h*2,s));
    if(2*a < d){
        cout << a*n << endl;
    } else {
        cout << (n/2)*d + (n%2)*a << endl;
    }
    return 0;
}

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

const int mod = 1000000007;

int main(){
    int h, w, k;
    cin >> h >> w >> k;

    vector<vector<int> > dp(h+1, vector<int>(w, 0));//w個の0を要素に持つvectorをh+1個持つvector(dp)
    dp[0][0] = 1;
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            for(int k = 0; k < 1 << (w-1); ++k){
                bool ok = true;
                for(int l = 0; l < w-2; ++l){
                    if(((k >> l) & 1) && ((k >> (l+1)) & 1)){
                        ok = false;
                    }
                }
                if(ok){
                    if(j >= 1 && ((k >> (j-1)) & 1)){
                        dp[i+1][j-1] += dp[i][j];
                        dp[i+1][j-1] %= mod;
                    }else if(j <= w-2 && ((k >> j) & 1)){
                        dp[i+1][j+1] += dp[i][j];
                        dp[i+1][j+1] %= mod;
                    }else{
                        dp[i+1][j] += dp[i][j];
                        dp[i+1][j] %= mod;
                    }
                }
            }
        }
    }
    cout << dp[h][k - 1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main (){
	long long int input=0;
	long long int output=0;
	scanf("%lld", &input);
	for (int i = 0; i<=input;i++){
		if (i %3 != 0 && i %5 != 0){
			output += i;
		}
	}
	printf("%lld",output);
}

Measured memory_bytes: 1736
def kmpTable(w):
    lw = len(w)
    nx = [-1] * (lw + 1)
    j = -1
    for i in range(lw):
        while j >= 0 and w[i] != w[j]:
            j = nx[j]
        j += 1
        nx[i + 1] = j
    return tuple(nx)
def kmpSearch(s, w):
    ls = len(s)
    start = 0
    w_idx = 0
    ret = []
    nx = kmpTable(w)
    while start + w_idx < ls:
        if s[start + w_idx] == w[w_idx]:
            w_idx += 1
            if w_idx == len(w):
                ret.append(start)
                start = start + w_idx - nx[w_idx]
                w_idx = nx[w_idx]
        else:
            if w_idx == 0:
                start += 1
            else:
                start = start + w_idx - nx[w_idx]
                w_idx = nx[w_idx]
    return tuple(ret)
T = input()
P = input()
ans = kmpSearch(T, P)
if ans:
    print("\n".join(map(str, ans)))	



Measured memory_bytes: 121324
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main 
{
	static class C implements Comparator<Team>
	{

		@Override
		public int compare(Team arg0, Team arg1) 
		{
			int a = arg1.solved - arg0.solved;
			if(a == 0) a = arg0.time - arg1.time;
			
			return a;
		}
		
	}
	
	static class C2 implements Comparator<Team>
	{

		@Override
		public int compare(Team arg0, Team arg1) 
		{
			int a = arg1.solved - arg0.solved;
			if(a == 0) a = arg0.time - arg1.time;
			if(a == 0) a = arg1.index - arg0.index;
			
			return a;
		}
		
	}
	
	static class Team
	{
		int index;
		int solved;
		int time;
		
		public Team(int i)
		{
			index = i;
		}
	}

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		while(true)
		{
			int m = sc.nextInt();
			int t = sc.nextInt();
			int p = sc.nextInt();
			int r = sc.nextInt();
			
			if(m == 0 && t == 0 && p == 0 && r == 0)return;
			
			int[][] attempts = new int[p][t];
			
			Team[] tim = new Team[t];
			for(int i = 0; i < t; i++)
			{
				tim[i] = new Team(i+1);
			}
			
			for(int i = 0; i < r; i++)
			{
				int min = sc.nextInt();
				int team = sc.nextInt()-1;
				int prob = sc.nextInt()-1;
				boolean solved = sc.nextInt() == 0;
				
				if(solved)
				{
					
					tim[team].solved++;
					tim[team].time += min + (attempts[prob][team] * 20);
				}
				else
				{
					attempts[prob][team]++;
				}
			}
			
			C c = new C();
			C2 c2 = new C2();
			Arrays.sort(tim, c2);
			
			for(int i = 0; i < t; i++)
			{
				System.out.print(tim[i].index);
				
				if(i < t-1)
				{
					if(c.compare(tim[i], tim[i+1]) == 0)
					{
						System.out.print("=");
					}
					else
					{
						System.out.print(",");
					}
				}
			}
			System.out.print("\n");
		}

	}

}



Measured memory_bytes: 67876
def bmod(b,x,m)
  # b^x mod m
  ans = 1
  q = 1
  b = b % m
  while x >= q
    if (x & q) > 0
      ans = (ans*b) % m
    end
    #p [q,b,(x&q),ans]
    q *= 2 
    b = (b*b) % m
  end
  ans
end

def modinv(n,m)
  # x: n*x mod m = 1
  bmod(n,m-2,m)
end

def cmod(n,m)
  v = 1
  (0..n).map { |r|
    a = v
    v = (v * (n-r)) % m
    if r > 0
      v = (v * modinv(r+1, m)) % m
    end
    a
  }
end

M = 1000000007

_ = $stdin.gets
A = $stdin.gets.chomp.split(" ").map{ |a| a.to_i }
N = A.size-1


D = A.inject(:+) - N*(N+1)/2
K1 = A.index(D)
K2 = A.rindex(D)

C1 = cmod(N+1,M)
C0 = cmod(N+1-(K2-K1+1),M)
def lparr1(k); C1[k] end
def lparr0(k); C0[k] end

ans = (1..N+1).map{ |k| lparr1(k) }

(0..N+1-(K2-K1+1)).each { |k|
  #p [k,lparr0(k)]
  ans[k] = (ans[k] + M - lparr0(k)) % M
}

puts ans


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

const int MAX = 5050;
bool dp1[MAX][MAX];
bool dp2[MAX][MAX];

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec[i];
  }
  
  dp1[0][0] = true;
  dp2[0][0] = true;
  
  for(int i=0; i<N; i++){
    for(int j=0; j<=K; j++){
      if(dp1[i][j]){
        dp1[i+1][j] = true;
        if(j + vec[i] <= K){
          dp1[i+1][j + vec[i]] = true;
        }
      }
    }
  }
  
  reverse(vec.begin(),vec.end());
  
  for(int i=0; i<N; i++){
    for(int j=0; j<=K; j++){
      if(dp2[i][j]){
        dp2[i+1][j] = true;
        if(j + vec[i] <= K){
          dp2[i+1][j + vec[i]] = true;
        }
      }
    }
  }
  
  
  reverse(vec.begin(),vec.end());
  
  int ans = N;
  
  for(int i=0; i<N; i++){
    bool need = false;
    vector<int> sum(MAX,0);
    for(int j=0; j<MAX; j++){
      if(dp2[N-i-1][j]){
        sum[j] = 1;
      }
    }
    for(int j=0; j<MAX-1; j++){
      sum[j+1] += sum[j];
    }
    for(int j=0; j<K; j++){
      if(!dp1[i][j]){
        continue;
      }
      if(j + vec[i] >= K){
        need = true;
        continue;
      }
      if(sum[K-j-1] != sum[K-vec[i]-j-1]){
        need = true;
      }
    }
    if(need){
      ans--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 52868
#include<bits/stdc++.h>
using namespace std;
bool isprime(int n){
	int m = sqrt(n);
	for(int i = 2; i <= m; i++){
		if(n % i == 0) return 0;
	}
	return 1;
}
int main()
{
	int n;
	cin >> n;
	int k = 11;
	while(n){
		if(isprime(k) && k % 10 == 1){
			cout << k << ' ';
			n--;
		}
		k += 10;
	}
	cout << endl;
	return 0;
}

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

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

    int n;
    cin >> n;

    vector<ll> a(n), x(n);
    rep(i, 0, n)
    {
        cin >> x[i];
        if (i % 2)
            a[0] -= x[i];
        else
            a[0] += x[i];
    }
    rep(i, 1, n)
    {
        a[i] = 2 * x[i - 1] - a[i - 1];
    }
    for (auto z : a)
        cout << z << ' ';
    cout << endl;

    return 0;
}


Measured memory_bytes: 2944
s = input()
l = []
t = s[0]
m = 1
for i in range(1,len(s)):
    if s[i] == t:
        m += 1
    else:
        t = s[i]
        l.append(m)
        m = 1
l.append(m)

if len(l) == 1:
    print(1,l[0])
    exit()
if l[0] > 1:
    print(1,l[0]+l[1])
    exit()

for i in range(len(s)-2):
    if s[i] == s[i+2] and s[i] != s[i+1]:
        print(i+1,i+3)
        exit()
if max(l) == 1:
    print(-1,-1)
    exit()

ruiseki = [l[0]]
for i in range(1,len(l)):
    ruiseki.append(ruiseki[i-1] + l[i])

for i in range(len(ruiseki)-1):
    if ruiseki[i+1] - ruiseki[i] > 1:
        print(ruiseki[i],ruiseki[i+1])
        exit()


Measured memory_bytes: 47536
#include <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007
 
using namespace std;
 
 
int main(){
    int K; cin >> K;
    vector<vector<ll> > dp(15);
    vector<ll> ANS;
    for (int i = 1; i < 10; i++)
    {
        dp.at(0).push_back(i);
        ANS.push_back(i);
    }
    
    for (int i = 1; i < 12; i++)
    {
        for (int j = 0; j < dp.at(i-1).size(); j++)
        {
            if(dp.at(i-1).at(j) % 10 == 0){
                dp.at(i).push_back(dp.at(i-1).at(j)*10);
                dp.at(i).push_back(dp.at(i-1).at(j)*10+1);
                ANS.push_back(dp.at(i-1).at(j)*10);
                ANS.push_back(dp.at(i-1).at(j)*10+1);
            }
            else if(dp[i-1][j] % 10 == 9){
                dp.at(i).push_back(dp.at(i-1).at(j)*10+8);
                dp.at(i).push_back(dp.at(i-1).at(j)*10+9);
                ANS.push_back(dp.at(i-1).at(j)*10+8);
                ANS.push_back(dp.at(i-1).at(j)*10+9);
            }
            else{
                dp.at(i).push_back(dp.at(i-1).at(j)*10 + dp.at(i-1).at(j) % 10 - 1);
                dp.at(i).push_back(dp.at(i-1).at(j)*10 + dp.at(i-1).at(j) % 10);
                dp.at(i).push_back(dp.at(i-1).at(j)*10 + dp.at(i-1).at(j) % 10 + 1);
                ANS.push_back(dp.at(i-1).at(j)*10 + dp.at(i-1).at(j) % 10 - 1);
                ANS.push_back(dp.at(i-1).at(j)*10 + dp.at(i-1).at(j) % 10);
                ANS.push_back(dp.at(i-1).at(j)*10 + dp.at(i-1).at(j) % 10 + 1);
            }
        }
    }
    cout << ANS.at(K-1) << endl;
}

Measured memory_bytes: 46948
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n; cin >> n;
  vector<int> a(n); REP(i,n) cin >> a[i];
  sort(ALL(a));

  int n_max = a[n-1];
  int idx = lower_bound(ALL(a), n_max/2) - a.begin();
  int n_min = a[idx] < (n_max - a[idx-1]) ? a[idx] : a[idx - 1];
  cout << n_max << " " << n_min << endl;
  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    // Write Your Code Below
    ll N, ans;
    ans = 0;
    cin >> N;
    vector<ll> v(3*N);
    rep(i,3*N){
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    rep(i,N){
        ans += v[(3*N)-2*(i+1)];
    }
    cout << ans << endl;
}


Measured memory_bytes: 2560
from collections import Counter

N = int(input())
a = list(map(int, input().split()))

na = len(set(a))
cnt = Counter(a)
ls = cnt.most_common()
lst = [ 2 for i in ls if i[1]%2==0]

if len(lst)%2==1:
    print(na - 1)
else:print(na)


Measured memory_bytes: 26076
#include<bits/stdc++.h>
using namespace std;
void FastInputOutput()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
set < string > subStrings(string s, int n)
{
    set < string > st ;
	for (int i = 0; i < n; i++){
            string tp = "";
		for (int j = i ; j < n && j <= i + 5 ; ++j){
            tp += s[j] ;
			st.insert(tp);
	}
	}
        return st ;
}
int main()
{
    FastInputOutput() ;
	string s ;
	cin >> s ;
	int k ;
	cin >> k ;
	set < string > Sub = subStrings(s , s.size());
	set < string > :: iterator it = Sub.begin();
	int out = 1 ;
	for( ; it != Sub.end() ; ++it){
        if(out == k ){
           cout << *it << endl ;
           break ;
        }
        out++ ;
        }

	return 0;
}


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

const char q='+';
const char w='-';
const char e='=';
const int r=7;

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

int main()
{
	int a,b,c,d,m,i;
	cin>>m;
	d=m%10;
	c=m/10%10;
	b=m/100%10;
	a=m/1000;
	i=max(max(a,b),max(c,d));
	if(i==a)
	{
		if(a+b+c+d==7){cout<<a<<q<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a+b+c-d==7){cout<<a<<q<<b<<q<<c<<w<<d<<e<<r<<endl;}
		else if(a+b-c+d==7){cout<<a<<q<<b<<w<<c<<q<<d<<e<<r<<endl;}
		else if(a+b-c-d==7){cout<<a<<q<<b<<w<<c<<w<<d<<e<<r<<endl;}
		else if(a-b+c+d==7){cout<<a<<w<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a-b+c-d==7){cout<<a<<w<<b<<q<<c<<w<<d<<e<<r<<endl;}
		else if(a-b-c+d==7){cout<<a<<w<<b<<w<<c<<q<<d<<e<<r<<endl;}
		else if(a-b-c-d==7){cout<<a<<w<<b<<w<<c<<w<<d<<e<<r<<endl;}
	}
	else if(i==b)
	{
		if(a+b+c+d==7){cout<<a<<q<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a+b+c-d==7){cout<<a<<q<<b<<q<<c<<w<<d<<e<<r<<endl;}
		else if(a+b-c+d==7){cout<<a<<q<<b<<w<<c<<q<<d<<e<<r<<endl;}
		else if(a+b-c-d==7){cout<<a<<q<<b<<w<<c<<w<<d<<e<<r<<endl;}
		else if(a+b+c+d==7){cout<<a<<q<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a+b+c-d==7){cout<<a<<q<<b<<q<<c<<w<<d<<e<<r<<endl;}
		else if(a+b-c+d==7){cout<<a<<q<<b<<w<<c<<q<<d<<e<<r<<endl;}
		else if(a+b-c-d==7){cout<<a<<q<<b<<w<<c<<w<<d<<e<<r<<endl;}
	}
	else if(i==c)
	{
		if(a+b+c+d==7){cout<<a<<q<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a+b+c-d==7){cout<<a<<q<<b<<q<<c<<w<<d<<e<<r<<endl;}
		else if(a+b+c+d==7){cout<<a<<q<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a+b+c-d==7){cout<<a<<q<<b<<q<<c<<w<<d<<e<<r<<endl;}
		else if(a-b+c+d==7){cout<<a<<w<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a-b+c-d==7){cout<<a<<w<<b<<q<<c<<w<<d<<e<<r<<endl;}
		else if(a-b+c+d==7){cout<<a<<w<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a-b+c-d==7){cout<<a<<w<<b<<q<<c<<w<<d<<e<<r<<endl;}
	}
	else if(i==d)
	{
		if(a+b+c+d==7){cout<<a<<q<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a+b+c+d==7){cout<<a<<q<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a+b-c+d==7){cout<<a<<q<<b<<w<<c<<q<<d<<e<<r<<endl;}
		else if(a+b-c+d==7){cout<<a<<q<<b<<w<<c<<q<<d<<e<<r<<endl;}
		else if(a-b+c+d==7){cout<<a<<w<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a-b+c+d==7){cout<<a<<w<<b<<q<<c<<q<<d<<e<<r<<endl;}
		else if(a-b-c+d==7){cout<<a<<w<<b<<w<<c<<q<<d<<e<<r<<endl;}
		else if(a-b-c+d==7){cout<<a<<w<<b<<w<<c<<q<<d<<e<<r<<endl;}
	}
}

Measured memory_bytes: 256
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

ll ans[1000006];
void pre(){
    for(int i=1;i<=1000001;i++){
        if(i%3!=0 && i%5!=0)ans[i] = ans[i-1]+i;
        else ans[i]=ans[i-1];
    }
}

int main(){
    IOS
    //freopen("output.txt","w",stdout);
    pre();
    int n;
    cin>>n;

    cout<<ans[n]<<"\n";
}


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

typedef pair <int, int> P;
#define fir first
#define sec second

int main(void)
{
	int m, n, i, j;
	while (cin >> n, n){
		vector <P> star, chart;
		P a;
		for (i = 0; i < n; i++) {
			cin >> a.fir >> a.sec;
			chart.push_back(a);
		}
		cin >> m;
		for (i = 0; i < m; i++)	{
			cin >> a.fir >> a.sec;
			star.push_back(a);
		}
		sort(chart.begin(), chart.end());
		sort(star.begin(), star.end());
		
		for (i = 0; i < m; i++){
			int cnt = 0;
			for (j = 0; j < m; j++){
				a = star[j];
				a.fir += (chart[0].fir - star[i].fir);
				a.sec += (chart[0].sec - star[i].sec);
				if (chart[cnt] == a) cnt++;
				if (cnt == n) break;
			}
			if (cnt == n){
				cout << star[i].fir - chart[0].fir << " " << star[i].sec - chart[0].sec << endl;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#define IOS ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define deb(x) cout << #x << " " << x << endl;
#define fi(i,a,b) for(int i = a; i<b; i++)
#define fd(i,a,b) for(int i = a; i>=b; i--)
#define ll long long int
#define pii pair<int, int>
#define vi vector<int>
#define N 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
using namespace std;

//*************************************************************************************

void solve () {

    int a, b, c; cin>>a>>b>>c; int arr[10] = {0};

    arr[a]++; arr[b]++; arr[c]++;

    if(arr[5]==2 && arr[7]==1){cout<<"YES"<<endl;}
    else cout<<"NO"<<endl;
}

int main(){

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    IOS;

    int t=1;
    while(t--){solve();}
    return 0 ;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

void swap(int *a, int *b)
{
	if(*b > *a) {
		int temp = *a;
		*a = *b;
		*b = temp;
	}
}

int main()
{
	int a, b;

	while (cin >> a >> b)
	{
		int A = a, B = b;
		while (a != b) {
			swap(&a, &b);

			a -= b;
		}

		cout << a << ' ' << (A/a)*B << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,l;
    string st[102];
    cin>>n>>l;
    for(int i=1;i<=n;i++)
        cin>>st[i];
    for(int i=1;i<=n;i++)//冒泡排序主部分
        for(int j=1;j<=n-i;j++)
        {
            if(st[j]>st[j+1])swap(st[j],st[j+1]);//交换
        }
    for(int i=1;i<=n;i++)
    {
        cout<<st[i];//输出
    }   
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){
  int n, x, y, z, gcd;
  set<int> ans;
  cin >> n;

  if(n == 2){
    cin >> x >> y;
    gcd = __gcd(x, y);
  }else{
    cin >> x >> y >> z;
    gcd = __gcd(x, __gcd(y, z));
  }

  for(int i=1; i<=sqrt(gcd); ++i){
    if(gcd%i == 0){
      ans.insert(i);
      ans.insert(gcd/i);
    }
  }
  for(set<int>::iterator i=ans.begin(); i!=ans.end(); ++i)
    cout << *i << endl;

  return 0;
}

Measured memory_bytes: 1196
public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		java.util.Scanner scan = new java.util.Scanner(System.in);

		double x1 = scan.nextDouble();
		double y1 = scan.nextDouble();

		double x2 = scan.nextDouble();
		double y2 = scan.nextDouble();

		double kyoriX2 = (x1 - x2) * (x1 - x2);
		double kyoriY2 = (y1 - y2) * (y1 - y2);

		System.out.println(Math.sqrt(kyoriX2 + kyoriY2));
	}

}

Measured memory_bytes: 28100
X, Y, Z, K = gets.split.map &:to_i
A = gets.split.map(&:to_i).sort.reverse
B = gets.split.map(&:to_i).sort.reverse
C = gets.split.map(&:to_i).sort.reverse

a = []
X.times{|x|
  Y.times{|y|
    Z.times{|z|
      break if (x + 1) * (y + 1) * (z + 1) > K
      a << A[x] + B[y] + C[z]
    }
  }
}

p *a.max(K).sort.reverse


Measured memory_bytes: 3192
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9+5;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  long double a,b;
  cin >> a >> b;
  cout << (ll)(floor(a*b)) << endl;
}

Measured memory_bytes: 3748
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        if isCLKWISE(phU) : continue
        while(True):
            del phU[-2]
            try:
                if isCLKWISE(phU) : break
            except IndexError : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        if isCLKWISE(phL) : continue
        while(True):
            del phL[-2]
            try:
                if isCLKWISE(phL) : break
            except IndexError : break
      
    ph = phU + phL[1:-1]
    return ph
  
n = range(int(input()))
P = [[int(x) for x in input().split()] for _ in n]
P = ConvexHullScan(P)
P.reverse()
print(len(P))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(P)])[2]
P = P[idx:] + P[:idx]
for p in P : print(p[0],p[1])

Measured memory_bytes: 33144