akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;
const int mod = 1000000007;

int main() {

  int N,tmp=0,minimum=INF;
  cin>>N;
  vector<int> A(N);
  for(int i=0; i<N; i++){cin>>A[i];}
  //vector<vector<int>> A(N,vector<int>(M));
  //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
  sort(A.begin(),A.end());
  for(int j=1; j<=100; j++){
    for(int i=0; i<N; i++){
    tmp+=((A[i]-j)*(A[i]-j));
    }
   minimum = min(minimum , tmp);
    tmp=0;
  }
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //
  cout << minimum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ctype.h>

#define INF 200000000
#define MOD 1000000007

using namespace std;

int main()
{
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    if (k >= (e - a))
    {
        cout << "Yay!\n";
        return 0;
    }
    else
    {
        cout << ":(\n";
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
/*input
2
1 1
*/
 
 
#include <bits/stdc++.h>
using namespace std;
 
#define ld long double
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define INTMAX  2147483647
#define INTMIN  -2147483648
#define LLMAX 9223372036854775807
#define LLMIN -9223372036854775808
#define MOD 1000000007
typedef map<long long int, long long int> mpi;
typedef set<long long int> seti;
typedef multiset<long long int> mseti;
typedef priority_queue<long long int> pq;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define PI 3.1415926535
#define dbg(x) cerr << "\n" << (#x) << " = " << (x) << endl ;
//#define cerr if(false)cerr

// cout<<fixed<<setprecision(10)<<(v1+v2+v3)<<endl;
  
struct node{
    ll val;
};
struct Interval {int start, end;};
bool compare(struct node n1, struct node n2) {
    return (n1.val < n2.val);
}






int main(){
	int n; cin>>n;
	vll a(n,0); for(int i=0;i<n;i++)cin>>a[i];
	long long int ans = 0;
	for(int i=0;i<n-2;i++){
		for(int j=i+1;j<n-1;j++){
			for(int k=j+1;k<n;k++){
				if(a[i] == a[j])continue;
				if(a[j] == a[k])continue;
				if(a[k] == a[i])continue;
				vll t(3,0);
				t[0] = a[i];
				t[1] = a[j];
				t[2] = a[k];
				sort(t.begin(),t.end());
				if(t[0] + t[1] > t[2])
					++ans;
			}
		}
	}
	cout<<ans<<endl;
	return 0;	
}















 

Measured memory_bytes: 3628
import bisect
from collections import defaultdict
n, m = map(int, input().split())
dic = defaultdict(lambda : [])
cities = []
for _ in range(m):
    p, y = map(int, input().split())
    cities.append((p, y))
    dic[p].append(y)
for key, vals in dic.items():
    dic[key] = sorted(vals)
for p, y in cities:
    pos = bisect.bisect_right(dic[p], y)
    print('{:06}{:06}'.format(p, pos))

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

int main()
{
	int N, Y;
	cin >> N >> Y; Y /= 1000;
	for (int i = 0; i * 10 <= Y; i++) {
		if ((Y - i * 10 - (N - i)) % 4 == 0) {
			int y = (Y - i * 10 - (N - i)) / 4;
			int z = N - i - y;
			if (y >= 0 && z >= 0) {
				cout << i << ' ' << y << ' ' << z << endl;
				return 0;
			}
		}
	}
	cout << -1 << ' ' << -1 << ' ' << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>

#define rep(p,q) for(int i = p; i < q;i++)

using namespace std;

int town[100001];
string num[100001];
int main(void) {
	int n, m;
	cin >> n >> m;
	vector<pair<int, long long>> clm =  vector<pair<int, long long>>();
	map< pair<int, long long>, int> mp;
	
	rep(0, 100001) town[i] = 0;
	rep(0, m) {
		long long y;
		int p;
		cin >> p >> y;
		clm.push_back(make_pair(p, y));
		mp[make_pair(p, y)] = i;
	}
	sort(clm.begin(),clm.end());
	
	rep(0, 100001) num[i] = "";
	for (auto &x : clm) {
		std::ostringstream ss;
		town[x.first]++;
		ss << std::setw(6) << std::setfill('0') << x.first << std::setw(6) << std::setfill('0') << town[x.first];
		std::string s(ss.str());
		num[mp[x]] = s;
	
	}
	rep(0,m) {
		if (num[i] != "") cout << num[i] << endl;
	}
}

Measured memory_bytes: 15216
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        char[] data = S.toCharArray();
        int[] digits = new int[4];
        for (int i = 0; i < 4; i++) {
            digits[i] = data[i] - '0';
        }
        int i = 0;
        int j = 0;
        int k = 0;
        boolean found = false;
        for (i = 0; i <= 1; i++) {
            for (j = 0; j <= 1; j++) {
                for (k = 0; k <= 1; k++) {
                    int answer = digits[0];
                    answer += (i == 0 ? 1 : -1) * digits[1];
                    answer += (j == 0 ? 1 : -1) * digits[2];
                    answer += (k == 0 ? 1 : -1) * digits[3];
                    if (answer == 7) {
                        found = true;
                        break;
                    }
                }
                if (found) {
                    break;
                }
            }
            if (found) {
                break;
            }
        }
        StringBuilder sb = new StringBuilder();
        sb.append(digits[0]);
        sb.append(i == 0 ? '+' : '-');
        sb.append(digits[1]);
        sb.append(j == 0 ? '+' : '-');
        sb.append(digits[2]);
        sb.append(k == 0 ? '+' : '-');
        sb.append(digits[3]);
        sb.append("=7");
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 22996
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int n;
    cin >> n;
    VI a(n), b(n);
    REP(i,n){
        a[i] = in();
        b[i] = in();
    }
    sort(ALL(a));
    sort(ALL(b));
    int ans = 0, m = n / 2;
    if (n % 2 == 1){
        ans = b[m] - a[m] + 1;
    }else{
        ll ma = b[m] + b[m - 1];
        ll mi = a[m] + a[m - 1];
        ans = ma - mi + 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4844
#include<iostream>
    #include<algorithm>
    #include<stack>
    #include<queue>
    #include<string>
    #include<functional>
    using namespace std;
     
    #define INF (1<<21)
    #define MOD 1000000007
   
    int main() {
        int n,a,b;
        cin>>n>>a>>b;
        cout<<min(n*a,b)<<endl;
        return 0;


    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll I=1000000000000000001;
const int INF=1000000;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int dp[41][401][401];
int a[41],b[41],c[41];
int main(void) {

	int n,ma,mb;
	cin>>n>>ma>>mb;
	rep(i,n)cin>>a[i]>>b[i]>>c[i];
	rep(k,n+1){
		for(int i=0; i<=400; i++){
			for(int j=0; j<=400; j++){
				dp[k][i][j]=INF;
			}
		}
	}
	dp[0][0][0]=0;
	rep(i,n){
		for(int j=0; j<=400; j++){
			for(int k=0; k<=400; k++){
				if(dp[i][j][k]==INF)continue;
				dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
				dp[i+1][j+a[i]][k+b[i]]=min(dp[i][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
			}
		}
	}
	int total=INF;
	for(int j=1; j<=400; j++){
		for(int k=1; k<=400; k++){
			if(j*mb==k*ma){
				total=min(total,dp[n][j][k]);
			}
		}
	}
	if(total==INF)total=-1;
	cout<<total<<endl;
	return 0;

}


Measured memory_bytes: 25984
#include <bits/stdc++.h>
using namespace std;
int n, t[100000], a[100000];
int main(void) {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> t[i];
  for (int i = 0; i < n; i++) cin >> a[i];

  long long ans = 1;
  for (int i = 1; i < n; i++) {
    if (t[i] <= a[i]) {
      if (t[i] == t[i-1] && (i+1 < n && a[i] == a[i+1])) ans = (ans * t[i]) % 1000000007;
    }
    if (t[i-1] < t[i] && t[i] > a[i]) ans *= 0;
  }

  for (int i = n-2; i >= 0; i--) {
    if (t[i] > a[i]) {
      if (a[i] == a[i+1] && (i-1 >= 0 && t[i-1] == t[i])) ans = (ans * a[i]) % 1000000007;
    }
    if (a[i] > a[i+1] && a[i] > t[i]) ans *= 0;
  }

  if (n == 1) {
    if (t[0] != a[0]) cout << 0 << endl;
    else cout << 1 << endl;
  } else {
    cout << ans << endl;
  }
}


Measured memory_bytes: 1024
N, M, Q = map(int, input().split())
train = [[0]*(N+1) for _ in range(N+1)]

for i in range(M):
  a, b = map(int, input().split())
  train[a][b] += 1
  
for i in range(1, N+1):
  for j in range(1, N+1):
    train[i][j] += train[i][j-1]


for i in range(Q):
  ans = 0
  l, r = map(int, input().split())
  for j in range(l, r+1):
    ans += train[j][r]-train[j][l-1]
  print(ans)


Measured memory_bytes: 53208
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
using namespace std;
using ll=long long;
#define MOD  1000000007


int main(int argc, char const *argv[]) {
  string S,T;
  std::cin >> S >> T;
  bool ans=false;

  for(int i=0; i<S.size(); i++){
    if(S==T){
       ans=true;
       break;
     }
    S=S.back() + S.substr(0,S.size()-1);
  }
  if(ans) std::cout << "Yes" << '\n';
  else std::cout << "No" << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long 
#define db long double
#define all(a) a.begin(),a.end()
#define pb push_back
#define f(i,l,u) for(ll i=l;i<u;i++)
#define lb lower_bound
#define ub upper_bound
#define pii pair<ll,ll> 
ll fac[1000001];
void powe(ll p)
{
     fac[0] = 1; 

     
    for (ll i = 1; i <= 1000000; i++) 
        fac[i] = (fac[i - 1] *i) % p; 
  
}
 
 
        
      long long power( long long x, 
                         ll y, ll p) 
{ 
   long long res = 1; // Initialize result 
  
    x = x % p; 
    while (y > 0) { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res * x) % p; 
  
        // y must be even now 
        y = y >> 1; // y = y/2 
        x = (x * x) % p; 
    } 
    return res; 
} 
  
// Returns n^(-1) mod p 
 long long modInverse( long long n, ll p) 
{ 
    return power(n, p - 2, p); 
} 
  
// Returns nCr % p using Fermat's little 
// theorem. 
 long long nCrModPFermat( long long n, 
                                 ll r, ll p) 
{ 
    // Base case 
    if (r == 0) 
        return 1; 
  
       return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p; 
} 
 ll gcd(ll a,ll b)
 {
     if(b==0)
     return a;
     return gcd(b,a%b);
 }
  
int main() {
   ll t=1;

   //cin>>t;
  
   while(t--)
   {
       ll ans=-100000000000000;

ll n,k;
cin>>n>>k;
ll p[n+1];
ll c[n+1];

f(i,1,1+n)
{
    cin>>p[i];
}
f(i,1,n+1)
{cin>>c[i];
}





f(i,1,n+1)
{

vector<ll> v;
//cout<<i<<endl;
ll ii=i;
    while(1)
    {
        v.pb(ii);
      //  cout<<"pushed "<<ii<<endl;
        if(p[ii]==i)
        {
           // cout<<69<<" ii "<<endl;
        break;
        
            
        }
        ii=p[ii];
        
        
        
    }
    //f(iii,0,v.size())
  //  cout<<v[iii]<<" ";
  //  cout<<endl;
  ll pre[v.size()+1];
    pre[0]=0;
   
    f(j,0,v.size())
 {  
    // cout<<"v[j]= "<<v[j]<<endl;
     
     pre[j+1]=pre[j]+c[v[j]];
     
  //  cout<<"pre[j]= "<<pre[j]<<endl;

 //   cout<<"c[v[j]]= "<<c[v[j]]<<endl;
     
 }
//f(j,0,v.size()+1)
//cout<<pre[j]<<" ";
//cout<<endl;
ll anstemp=-1000000000000000;
ll v_size=v.size();
f(ti,0,min(v_size,k))
anstemp=max(anstemp,pre[ti+1]);
    //cout<<"anstemp= "<<anstemp<<endl;
    if(k>v.size())
    {
        anstemp=max(anstemp,anstemp+(ll)(pre[v_size]*((k/v_size)-1)));
        
        for(ll tii=0;tii<=k%v_size;tii++)
        anstemp=max(anstemp,pre[tii]+(ll)(pre[v_size]*(k/v.size())));
        
        
    }
   // cout<<"anstemp= "<<anstemp<<endl;
    
    ans=max(ans,anstemp);
  
}


    cout<<ans<<endl;
    



   }
  


      

return 0;    
}


Measured memory_bytes: 3848
var
a,b,c,i,j,k,n,s:longint;
begin
readln(a);
readln(b);
readln(c);
readln(n);
for i:=0 to a do 
for j:=0 to b do 
for k:=0 to c do 
if i*500+j*100+k*50=n then inc(s);
writeln(s);
end.

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

int main(){
  int a,b,c,result1,result2;
  cin >> a >> b >> c;
  if(a == 5){
    result2  += 1;
  }else if(a == 7){
    result1 += 1;
  }
  if(b == 5){
    result2  += 1;
  }else if(b == 7){
    result1 += 1;
  }
  if(c == 5){
    result2  += 1;
  }else if(c == 7){
    result1 += 1;
  }


  if(result1 == 1 && result2 == 2){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;


const int nax = 200, rax = 8;
int dis[nax][nax],dp[1<<rax][rax],a[rax];
int n,m,r;
int solve(int msk,int prv){
	if( msk + 1 == 1 << r )return 0;
	int &ans = dp[msk][prv];
	if( ans != -1 )return ans;
	ans = 1e17;
	for(int i=0;i<r;i++){
		if( msk >> i & 1 )continue;
		ans = min( ans , dis[a[prv]][a[i]] + solve(msk|1<<i,i));
	}
	return ans;
}
int32_t main(){
	IOS
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<nax;i++){
		for(int j=0;j<nax;j++){
			dis[i][j]=1e17;
		}
		dis[i][i]=0;
	}
	cin>>n>>m>>r;
	for(int i=0;i<r;i++){
		cin>>a[i];--a[i];
	}
	for(int i=0;i<m;i++){
		int u,v,w;cin>>u>>v>>w;--u,--v;
		dis[u][v]=dis[v][u]=min(dis[u][v],w);
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<n;k++){
				dis[j][k]=min(dis[j][k],dis[j][i]+dis[i][k]);
			}
		}
	}
	int ans=1e17;
	for(int i=0;i<r;i++){
		ans=min(ans,solve(1<<i,i));
	}
	cout<<ans;
	
}
/*
 * long long or int?
 * index out of bound? 
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


Measured memory_bytes: 3944
#include<algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
#define N 55
using namespace std;
char Fuck[N][N];
int n,m,cnt;
int vis[N][N];
struct node
{
	int x, y;
}q[N*N];
bool nmsl[N][N];
const int r[]={1,-1,0,0};
const int w[]={0,0,1,-1};
inline void bfs(int sx, int sy)
{
	int hd,tl,dx,dy,fx,fy;
	hd=tl=1;
	q[1].x=sx;
	q[1].y=sy;
	while(hd<=tl)
	{
		fx=q[hd].x;
		fy=q[hd].y;
		hd++;
		for(int i=0;i<4;++i)
		{
			dx=fx+r[i];
			dy=fy+w[i];
			if(dx<1||dy<1||dx>n||dy>m||Fuck[dx][dy]=='#'||nmsl[dx][dy]==1) 
			continue;
			nmsl[dx][dy]=1;
			tl++;
			q[tl].x=dx;
			q[tl].y=dy;
			vis[dx][dy]=vis[fx][fy]+1;
			if(dx==n&&dy==m) 
			return ;
		}
	}
}
int main()
{
	cin>>n>>m;
	memset(vis,127/3,sizeof vis );
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=m;++j)
		{
			cin>>Fuck[i][j];
			if(Fuck[i][j]=='#') 
			cnt++;
		}
	}
	vis[1][1]=1;
	nmsl[1][1]=1;
	bfs(1,1);
	int ans=n*m-cnt-vis[n][m];
	if(ans<0) 
	puts("-1");
	else 
	printf("%d",ans);
}

Measured memory_bytes: 3776
import java.util.*;
import java.awt.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();
        String s = sc.next();
        String t = sc.next();

        int l = gcd(m, n);
        int nl = m / l;
        int ml = n / l;
        long ans = (long)nl * (long)n;
        long np = 0;
        int ni = 0;
        long mp = 0;
        int mi = 0;
        while (true) {
            if (np == mp) {
                if (s.charAt(ni) != t.charAt(mi)) {
                    ans = -1;
                    break;
                }
                np += nl;
                ni++;
            } else if (np > mp) {
                mp += ml;
                mi++;
            } else if (np < mp) {
                np += nl;
                ni++;
            }

            if (ni >= n || mi >= m) {
                break;
            }
        }

        System.out.println(ans);
    }

    public static int gcd(int m, int n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
}

Measured memory_bytes: 26256
S = input()
ans = True
cnt = [0] * 26
for i in range(len(S)):
    cnt[ord(S[i]) - ord('a')] += 1
for i in range(26):
    if cnt[i] > 1:
        ans = False
if ans == True:
    print('yes')
else:
    print('no')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  for(int i=1;i<=9;i++){
    if(n%i==0&&n/i<=9){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
edges = [list(map(int, input().split())) for i in range(M)]
root = [i for i in range(N+1)]
comp_size = [1] * (N+1)

def find_root(x):
    a = root[x]
    if a == x:
        return x
    y = find_root(a)
    root[x] = y
    return y

def find_root(x):
  y = root[x]
  if x == y:
    return x
  z = find_root(y)
  root[x] = z
  return z

def merge(x, y):
    rx = find_root(x)
    ry = find_root(y)
    if rx == ry:
        return 0
    sx = comp_size[rx]
    sy = comp_size[ry]
    if sx >= sy:
        root[ry] = rx
        comp_size[rx] += sy
    else:
        root[rx] = ry
        comp_size[ry] += sx
    return sx * sy

result = N * (N-1) // 2
answer = []
for x, y in edges[::-1]:
    answer.append(result)
    result -= merge(x, y)

for r in answer[::-1]:
    print(r)


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

int main()
{
    int ans[10004];
    int n;
    cin >> n;
    int x, y, z;
    for( int i = 0; i <= 10000; i++ ) ans[i] = 0;

    for( x = 1; x <= 100; x++ )
    {
        for( y = 1; y <= 100; y++ )
        {
            for( z = 1; z <= 100; z++ )
            {
                int t = x * x + y * y + z * z + x * y + y * z + z * x;
                if( t <= 10000 ) ans[t]++;
            }
        }
    }
    for( int i = 1; i <= n; i++ ) cout << ans[i] << endl;
}

Measured memory_bytes: 3628
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &a[i])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	var ans int64
	for i := 0; i < n-1; i++ {
		ans += int64(a[(i+1)/2])
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5996
# -*- coding: utf-8 -*-

import re
import sys

n = int(raw_input())
a = map(int, re.split('\s', raw_input()))

ans = 10000000001

all = sum(a)
tmp = 0

if (n == 2):
        print abs(a[0] - a[1])
        sys.exit()

for i in range(0, n-2):
        tmp += a[i]
        hoge = abs(all - 2 * tmp)
        if (ans > hoge):
                ans = hoge

print ans


Measured memory_bytes: 18416
#include<cstdio>
#include<cstring>
char str[305];
int dp[305][305][305],K;
int max(int a,int b){return a>b?a:b;}
int main(){
	scanf("%s%d",str,&K); int lens=strlen(str);
	for(int i=0;i<lens;++i)
		for(int k=0;k<=K;++k)
			dp[i][i][k]=1;
	for(int l=1;l<lens;++l)
		for(int i=0;i+l<lens;++i){
			int j=i+l;
			for(int k=0;k<=K;++k){
				dp[i][j][k]=max(dp[i+1][j][k],dp[i][j-1][k]);
				if(k>0) dp[i][j][k]=max(dp[i+1][j-1][k-1]+2,dp[i][j][k]);
				if(str[i]==str[j]) dp[i][j][k]=max(dp[i+1][j-1][k]+2,dp[i][j][k]);
	        }
	    }
	printf("%d\n",dp[0][lens-1][K]);
}

Measured memory_bytes: 110720
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  string S;
  cin >> S;
  if (S.size()==2) cout << S << endl;
  else {
    reverse(S.begin(), S.end());
    cout << S << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 1;

set <pair<long long, long long> > sl, sr;
long long l[N], r[N];

int main() {
    long long i, j, n;
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (i = 0; i < n; ++i) {
        cin >> l[i] >> r[i];
        sl.insert({l[i], i});
        sr.insert({r[i], i});
    }
    long long x = 0, ans = 0, val = 0;
    for (i = 0; i < n; ++i)
    if (i % 2 == 0) {
        set <pair<long long, long long > > :: iterator it = sl.end();
        --it;
        long long j = (*it).second;
        sl.erase(it);
        sr.erase(sr.find({r[j], j}));
        if (l[j] <= x && x <= r[j])
            continue;
        if (abs(l[j] - x) < abs(r[j] - x)) {
            val += abs(l[j] - x);
            x = l[j];
        } else {
            val += abs(r[j] - x);
            x = r[j];
        }
    } else {
        set <pair<long long, long long > > :: iterator it = sr.begin();
        long long j = (*it).second;
        sr.erase(it);
        sl.erase(sl.find({l[j], j}));
        if (l[j] <= x && x <= r[j])
            continue;
        if (abs(l[j] - x) < abs(r[j] - x)) {
            val += abs(l[j] - x);
            x = l[j];
        } else {
            val += abs(r[j] - x);
            x = r[j];
        }
    }
    ans = val + abs(x);
     for (i = 0; i < n; ++i) {
        sl.insert({l[i], i});
        sr.insert({r[i], i});
    }
    x = 0;
    val = 0;
    for (i = 0; i < n; ++i)
    if (i % 2 == 1) {
        set <pair<long long, long long > > :: iterator it = sl.end();
        --it;
        long long j = (*it).second;
        sl.erase(it);
        sr.erase(sr.find({r[j], j}));
        if (l[j] <= x && x <= r[j])
            continue;
        if (abs(l[j] - x) < abs(r[j] - x)) {
            val += abs(l[j] - x);
            x = l[j];
        } else {
            val += abs(r[j] - x);
            x = r[j];
        }
    } else {
        set <pair<long long, long long > > :: iterator it = sr.begin();
        long long j = (*it).second;
        sr.erase(it);
        sl.erase(sl.find({l[j], j}));
        if (l[j] <= x && x <= r[j])
            continue;
        if (abs(l[j] - x) < abs(r[j] - x)) {
            val += abs(l[j] - x);
            x = l[j];
        } else {
            val += abs(r[j] - x);
            x = r[j];
        }
    }
    cout << max(ans, val + abs(x));
}

Measured memory_bytes: 16384
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
  int N;
  cin >> N;
  set<pair<ll, ll>> S;
  for (int n = 0; n < N; ++n) {
    ll X, L;
    cin >> X >> L;
    S.emplace(X-L, X+L);
  }
  
  auto it = S.begin();
  while (1) {
    auto itNext = it;
    ++itNext;
    if (itNext == S.end()) {
      break;
    }
    
    if (it->second <= itNext->first) {
      ++it;
      continue;
    }
    if (it->second < itNext->second) {
      S.erase(itNext);
    } else {
      it = S.erase(it);
    }
  }
  cout << S.size() << endl;
  
  return 0;  
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
 
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

ll lcm(ll a,ll b){
    return (a * b) / __gcd(a,b);
}

const ll INF = 10010001010;
const int inf = 1000034000;
 
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    ll count = 0;

    for(int i = 0;i < N;i++){
        cin >> A[i] >> B[i];
    }
    for(int i = N-1;i >= 0;i--){
        ll X = count + A[i];
        if(X % B[i] != 0){
            count += B[i] - X % B[i];
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 4048
#include "bits/stdc++.h"
//#define int long long
#define loop(i, a, b) for(int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int MOD = 1e9 + 7, INF = 1e9;
using vi = vector <int>;
using vvi = vector <vi>;
//g++ -std==c++14

signed main(){
    string s;
    cin >> s;
    int cnt = 0;
    rep(i, s.size())
        cnt += s[i] - '0';
    
    if(atoi(s.c_str()) % cnt== 0)
        cout << "Yes" << endl;
    else   
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int w,h;
    while (cin>>w>>h) {
        if (w==0&&h==0) {
            break;
        } else {
            std::vector<vector<char>> vec(h,vector<char>(w));
            bool seen[h][w];
            char c;
            int now_H,now_W;
            for (int i=0;i<h;i++) {
                for (int j=0;j<w;j++) {
                    cin>>c;
                    vec[i][j]=c;
                    if (c=='@') {
                        now_H=i;
                        now_W=j;
                        seen[i][j]=true;
                    } else {
                        seen[i][j]=false;
                    }
                }
            }
            int count=1;
            std::deque<pair<int,int>> place;
            place.emplace_back(make_pair(now_H,now_W));
            while (place.size()!=0) {
                int tmp_H=place.front().first;
                int tmp_W=place.front().second;
                if (tmp_H+1<h&&seen[tmp_H+1][tmp_W]==false&&vec[tmp_H+1][tmp_W]!='#'&&vec[tmp_H+1][tmp_W]!='@') {
                    tmp_H++;
                    seen[tmp_H][tmp_W]=true;
                    place.emplace_back(make_pair(tmp_H,tmp_W));
                    count++;
                } else if (tmp_H-1>=0&&seen[tmp_H-1][tmp_W]==false&&vec[tmp_H-1][tmp_W]!='#'&&vec[tmp_H-1][tmp_W]!='@') {
                    tmp_H--;
                    seen[tmp_H][tmp_W]=true;
                    place.emplace_back(make_pair(tmp_H,tmp_W));
                    count++;
                } else if (tmp_W+1<w&&seen[tmp_H][tmp_W+1]==false&&vec[tmp_H][tmp_W+1]!='#'&&vec[tmp_H][tmp_W+1]!='@') {
                    tmp_W++;
                    seen[tmp_H][tmp_W]=true;
                    place.emplace_back(make_pair(tmp_H,tmp_W));
                    count++;
                } else if (tmp_W-1>=0&&seen[tmp_H][tmp_W-1]==false&&vec[tmp_H][tmp_W-1]!='#'&&vec[tmp_H][tmp_W-1]!='@') {
                    tmp_W--;
                    seen[tmp_H][tmp_W]=true;
                    place.emplace_back(make_pair(tmp_H,tmp_W));
                    count++;
                } else {
                    place.pop_front();
                }
            }
            cout<<count<<endl;
        }
    }
}


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

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

  if(res ==0){
    i=j=k=-1;
    cout << i << " " << j << " " << k;
  }
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<ll,ll>
int  u[200];
ll mod = 1000000007;
P p[200005];
ll i, b, c, k,j, n, m, z = 0,mi=10;
char g;
string s[3] = { "Sunny","Cloudy","Rainy" };
string ss;

vector<ll> v;
int main() {
cin >> ss;
rep(i, ss.size()) {
	g = ss[i];
	if (i % 2 == 0 && g == 'L') {
		cout << "No";
		return 0;
	}
	if (i % 2 == 1 && g == 'R') {
		cout << "No";
		return 0;
	}
}
cout << "Yes";
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int gcd(int a, int b) {
  if (a==1 || b==1) return 1;
  int r = a%b;
  if (r == 0) return b;
  return gcd(b, r);
}

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

  vector<int> a(n);
  vector<int> l(n);
  vector<int> r(n);
  for (int i=0; i<n; i++) {
    cin >> a[i];
  }

  if (n<=2) {
    cout << max(a[0],a[1]) << endl;
    return 0;
  }

  l[0] = a[0];
  r[n-1] = a[n-1];

  for (int i=1; i<n; i++) {
    l[i] = gcd(l[i-1], a[i]);
    r[n-i-1] = gcd(r[n-i],  a[n-i-1]);
  }

  // for (int i=0; i<n; i++) cout << l[i] << " ";
  // cout << endl;

  // for (int i=0; i<n; i++) cout << r[i] << " ";
  // cout << endl;

  int ans = max(l[n-2],r[1]);
  for (int i=1; i<n-1; i++) {
    ans = max(ans, gcd(l[i-1], r[i+1]));
  }

  cout << ans << endl;
}

Measured memory_bytes: 1408
#include"bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()
#define MOD 1000000007

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b) {
    if (a % b == 0) {
        return(b);
    }
    else {
        return(gcd(b, a % b));
    }
}

template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

int main(void) {
    ll n;
    cin>>n;
    vector<ll>a(n);
    rep(i,n){
        cin>>a[i];
    }
    sort(ALL(a));
    
    ll ans=0;
    rep(i,n-1){
        ans+=a[n-(i+1)/2-1];
    }
    cout<<ans;
}


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

int main()
{
    int n;
    cin>>n;
    vector<ll> v(n);
    map<ll,ll> mp;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        mp[v[i]]++;
    }
    ll sum=0;
    for(auto it:mp)
    sum+=((it.second*(it.second-1))/2);
    for(int i=0;i<n;i++)
    {
        ll ans=sum;
        ans-=((mp[v[i]]*(mp[v[i]]-1))/2);
        ans+=(((mp[v[i]]-1)*(mp[v[i]]-2))/2);
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 11008
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    n = gets.chomp.to_i

    ans = 0
    n.times do
      l, r = gets.chomp.split.map(&:to_i)
      ans += (r - l) + 1
    end

    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 2300
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;

const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
//const long long int pl=1000000;
long long int X;
int main(){

    cout << fixed << setprecision(18);
    cin>>X;
    cout<<10-X/200<<endl;
    
}



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

using LL = long long;

#define ALL(a) begin((a)), end((a))
#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 debug(x) cout << #x << " : " << x << '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const LL LINF = 1e16;

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

  int ans = 0;
  int n;
  cin >> n;
  vector<int> p(n);
  FOR(i, 0, n) { cin >> p[i]; }
  vector<int> temp(3);

  FOR(i, 1, n - 1) {
    temp[0] = p[i - 1];
    temp[1] = p[i];
    temp[2] = p[i + 1];

    if (temp[0] < temp[1] && temp[1] < temp[2]) {
      ans++;
    } else if (temp[0] > temp[1] && temp[1] > temp[2]) {
      ans++;
    }
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "3", "1 10 100" ].parse.expand.solve == "Yes" );
	assert( [ "4", "1 2 3 4" ].parse.expand.solve == "No" );
	assert( [ "3", "1 4 1" ].parse.expand.solve == "Yes" );
	assert( [ "2", "1 1" ].parse.expand.solve == "No" );
	assert( [ "6", "2 7 1 8 2 8" ].parse.expand.solve == "Yes" );
	
	assert( [ "6", "2 2 7 8 1 8 1" ].parse.expand.solve == "No" );		// 追加ケース
	assert( [ "6", "2 2" ].parse.expand.solve == "Yes" );		// 追加ケース
	assert( [ "6", "2 2 2" ].parse.expand.solve == "Yes" );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.strip.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	// 4の倍数があれば、4の倍数を4の倍数以外で挟めば条件を満たせる
	auto q = as.count!( ( a ) => a % 4 == 0 );
	auto qq = ( ( 0 < q ) ? 1 : 0 ) + q * 2;		// 4の倍数を使って条件を満たせる要素数
	if( as.length <= qq ) return "Yes";
	
	// 2の倍数があれば、2の倍数同士を並べれば条件を満たせる（ただし4の倍数の隣に置く必要がある）
	auto d = as.count!( ( a ) => ( a % 4 != 0 ) && ( a % 2 == 0 ) );
	auto dd = q * 2 + d;		// 4の倍数と2の倍数を使って条件を満たせる要素数
	if( as.length <= dd ) return "Yes";
	
	return "No";
}


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

using namespace std;

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

const int MM = 1e9 + 7;
const double eps = 1e-8;
const int MAXN = 2e6 + 10;

int n, m;

void prework(){

}

void read(){

}

int K;
ll C[2222][2222];
ll pw[2222];
ll f[2222][2222];
ll sum[2222][2222];

void solve(int casi){
	cin>>n>>K;
	C[0][0] = C[1][0] = C[1][1] = 1;
	for(int i = 2; i <= 2000; i++){
		C[i][0] = C[i][i] = 1;
		for(int j = 1; j < i; j++)
			C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MM;
	}
	pw[0] = 1;
	for(int i = 1; i <= 2000; i++){
		pw[i] = (2 * pw[i-1]) % MM;
	}
	ll ans = 0;//pw[n-K-1];
	f[0][0] = 1;
	for(int i = 0; i <= n; i++)
		sum[0][i] = 1;
	for(int i = 1; i < K; i++){
		for(int j = 0; j <= n - i; j++){
			f[i][j] = sum[i-1][j+1];
		}
		sum[i][0] = f[i][0];
		for(int j = 1; j <= n - i; j++)
			sum[i][j] = (sum[i][j-1] + f[i][j]) % MM;
	}
	for(int i = 0; i <= n - K; i++)
		ans = (ans + f[K-1][i]) % MM;
	cout<<((K!=n)?(ans * pw[n-K-1] % MM):ans)<<endl;
}

void printans(){

}


int main(){
	prework();
	int T = 1;
//	cin>>T;
	for(int i = 1; i <= T; i++){
		read();
		solve(i);
		printans();
	}
	return 0;
}


Measured memory_bytes: 70144
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
struct point{
	LL x,y;
};
int main(){
	int n;
	cin>>n;
	point a[n];
	for(int i=0;i<n;i++) cin>>a[i].x>>a[i].y;
	sort(a,a+n,[](point p, point l){
			return p.x+p.y>l.x+l.y;
			});
	LL ans=abs(a[0].x-a[n-1].x)+abs(a[0].y-a[n-1].y);
	sort(a,a+n,[](point p, point l){
			return p.x+l.y>l.x+p.y;
			});
	ans=max(ans,abs(a[0].x-a[n-1].x)+abs(a[0].y-a[n-1].y));
	cout<<ans<<"\n";
}	


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

int main() {
    int N, K; cin >> N >> K;
    vector<long long> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    //ソート
    sort(a.begin(), a.end());

    //K差の最小値
    long long res = 1LL<<60; //初期値を大きく取っておく「1LL<<60」は2^60の意味
    //0番目とK−1番目の差,1番目とK番目の差,2番目とK+1番目の差...のうちの最小値を求める
    for (int i = 0; i+K-1 < N; ++i) res = min(res, a[i+K-1] - a[i]);
    cout << res << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

int N, X, Y, a[3004][3004], ans[10005];
vector<int> graph[3004];
queue<int> q;

int main() {
	cin >> N >> X >> Y;
	for (int i = 2; i < N; i++) {
		graph[i].push_back(i - 1);
		graph[i].push_back(i + 1);
	}
	graph[1].push_back(2);
	graph[N].push_back(N - 1);
	graph[X].push_back(Y);
	graph[Y].push_back(X);
	for (int i = 1; i <= N; i++) {
		a[i][i] = 0;
		q.push(i);
		while (!q.empty()) {
			int f = q.front();
			q.pop();
			for (int j = 0; j < graph[f].size(); j++) {
				if (a[i][graph[f][j]] == 0 && graph[f][j] != i) {
					a[i][graph[f][j]] = a[i][f] + 1;
					q.push(graph[f][j]);
				}
			}
		}
	}
	for (int i = 1; i < N; i++) {
		for (int j = i + 1; j <= N; j++) {
			ans[a[i][j]]++;
		}
	}
	for (int i = 1; i <= N - 1; i++) {
		cout << ans[i] << endl;
	}
	
	return 0;
}

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

#define N 1000

char A[N+1],B[N+1];
 
int lcn(){
  int i,j,m,n,max=0;
  int c[N+1][N+1];
  m=strlen(A);
  n=strlen(B);
  for(i=1;i<=m;i++) c[i][0]=0;
  for(j=1;j<=n;j++) c[0][j]=0;
 
  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(A[i-1]==B[j-1]) c[i][j]=c[i-1][j-1] + 1;
      else if(c[i-1][j]>=c[i][j-1]) c[i][j]=c[i-1][j];
      else c[i][j]=c[i][j-1];
      max=Max(max,c[i][j]);
    }
  }
  return max;
}
 
int Max(int a,int b){
  if(a>=b) return a;
  else return b;
}
int main(){
  int i,j,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",A);
    scanf("%s",B);
    printf("%d\n",lcn());
  }
 
  return 0;
}

Measured memory_bytes: 4512
#include<iostream>
#include<iomanip>
#include<limits>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include <functional>

#define big ((long long)(1e9)+7)

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
	double r;
	cin >> r;
	double pai = 3.14;
	cout << 2*r*pai << endl;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 998244353
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

bool eq(pair<ll,ll> a)
{
    return a.ff == a.ss;
}

int main()
{
  FAST/**/
   
   ll n,k;
   cin>>n>>k;
   
   pii arr[k];
   rep(k)
        cin>>arr[i].ff>>arr[i].ss;
   
   ll dp[n+2];
   memset(dp,0,sizeof(dp));
   ll pref[n+2];
   memset(pref,0,sizeof(pref));
   dp[n] = 1;
   pref[n] = 1;
   for(ll i=n-1;i>0;i--)
   {
       repi(j,k)
       {
           ll x = arr[j].ff+i;
           ll y = arr[j].ss+i;
           y = min(y,n);
           if(y<x)
                continue;
           ll tot = (pref[x]-pref[y+1]+mod)%mod;
           dp[i]+=tot;
           dp[i]%=mod;
       }
       pref[i] = (dp[i] + pref[i+1])%mod;
   }
   
   cout<<dp[1];
           
   
   return 0;        
}  

  
          
   

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

int main()
{
    int a, b, c, k;
    int i, sum=0, count=0;
    cin >> a >> b >> c >> k;

    if(a-k>=0){
        cout << k << endl;
    }else{
        count = k-a;
        if(b-count>=0){
            cout << a << endl;
        }else{
            count -= b;
            cout << a-count << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

int main(){
  ll a,b,c; cin>>a>>b>>c;
  if(c<=a+b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;  
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
// Need start
#include<vector>
// Need end
using namespace std;
typedef long long ll;

// Copy start
class UnionFind {
    private:
        vector<int> parent;
        vector<int> node_rank;
        vector<int> sizes;
    public:
        UnionFind(int node_num):
        parent(vector<int>(node_num)), node_rank(vector<int>(node_num)), sizes(vector<int>(node_num)) {
            for (int i = 0; i < node_num; ++i) {
                parent[i] = i;
                node_rank[i] = 0;
                sizes[i] = 1;
            }
        }
        int root(int u) {
            return parent[u] == u ? u : parent[u] = root(parent[u]);
        }
        bool same(int u, int v) {
            return root(u) == root(v);
        }
        void unite(int u, int v) {
            u = root(u);
            v = root(v);
            if (u == v) return;
            if (node_rank[u] < node_rank[v]) {
                parent[u] = v;
                sizes[v] += sizes[u];
            }
            else {
                parent[v] = u;
                sizes[u] += sizes[v];
                if (node_rank[u] == node_rank[v]) {
                    node_rank[u]++;
                }
            }
        }
        int get_size(int u) {
            return sizes[root(u)];
        }
};
// Copy end

int main() {
    // This sample is Atcoder Beginners Contest 120 D
    ll N, M;
    cin >> N >> M;
    UnionFind uf(N);
    vector<ll> A(M), B(M);
    for (ll i = 0; i < M; i++) {
        cin >> A[i] >> B[i];
        A[i]--, B[i]--;
    }
    ll now_sizes = N * (N - 1) / 2;
    vector<ll> ans;
    for (ll i = M - 1; i >= 0; i--) {
        ans.push_back(now_sizes);
        if (uf.same(A[i], B[i])) {
            continue;
        }
        else {
            now_sizes -= (ll)uf.get_size(A[i]) * (ll)uf.get_size(B[i]);
            uf.unite(A[i], B[i]);
        }
    }
    reverse(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4980
#include <stdio.h>

int main(void) {
	long int n,i,j;
	scanf("%ld",&n);
	long int h[n];
	for(i=0;i<n;i++){
		scanf("%ld",&h[i]);
	}
	for(i=0;i<n-1;i++){
		j=i+1;
		if(h[i]<h[j]){
			h[j]-=1;
		}
	}
	for(i=0;i<n-1;i++){
		j=i+1;
		if(h[i]>h[j]){
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	// your code goes here
	return 0;
}


Measured memory_bytes: 896