akhauriyash/Code-Regression huggingface dataset:
#define __mode_debug__
/*   ξ
     ll
   ＿ll＿
 ／  ∞  ＼
│*  Ａ  *│
│*  Ｃ  *│
│*  祈  *│
│*  願  *│
│*      *│
 ￣￣￣￣￣    */
//C++14 (GCC 5.4.1)
#include <bits/stdc++.h>
using namespace std;
#ifdef __mode_debug__
    #define DBG
#else
    #define DBG if(false)
#endif

#define LLINF (1LL<<60)
using ll = long long;
#define mod  1000000007

#define whole(a) (a).begin(),(a).end()
#define rwhole(a) (a).rbegin(),(a).rend()

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)
#define each(itr,ds) for(auto itr=(ds).begin();itr!=(ds).end();itr++)

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

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

//DUMP
//  ostream vector<T> , vector<vector<T>> , set<T> ,queue<T> , priority_queue<T> , pair<T,U> , map<T,U>
template<class T> ostream& operator<<(ostream&os,vector<T>&vec){os<<"{ ";rep(i,vec.size()) os<<((i==0)?"":", ")<<i<<":"<<vec[i];os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,vector<vector<T>>&vec){os<<"{"<<endl;rep(i,vec.size())os<<"\t   "<<i<<":"<<vec[i]<<((i==vec.size()-1)? "":",")<<endl;os<<"\t }";return os;}
template<class T> ostream& operator<<(ostream&os,set<T>&p){os<<"{ ";each(itr,p)  os<<((itr==p.begin())?"":", ")<<*itr;os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,queue<T>&p){queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.front();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T> ostream& operator<<(ostream&os,priority_queue<T>&p){priority_queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.top();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T,class U> ostream& operator<<(ostream&os,pair<T,U>&p){os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T,class U> ostream& operator<<(ostream&os,map<T,U>&p){os<<"{ ";each(itr,p)os<<((itr==p.begin())?"":", ")<<itr->first<<":"<<itr->second;os<<" }";return os;}
void dump_f(string &nm,char t){cerr<<endl;}
template<class T,class... Ts> void dump_f(string &nm,char t,T &&x,Ts&&... ts){int l=nm.find_first_of(',');string name(nm,0,l),nx(nm,l+1,-1);if(t=='\n') cerr<<"  "<<name<<"\t: "<<x<<t;else cerr << name<<": "<<x<<","<<t;dump_f(nx,t,forward<Ts>(ts)...);}
template<class... Ts> void dump_m(int &&ln,string &&nm,char t,Ts&&... ts){cerr<<"[ln: "<<ln<<"]"<<t;dump_f(nm,t,forward<Ts>(ts)...);}
#define dump(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\n',__VA_ARGS__)
#define dl(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\t',__VA_ARGS__)

#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(whole(V),c))

int main() {
    ios::sync_with_stdio(false);//stdout<=>cout
    cin.tie(nullptr);//cin<=>cout


    int N;
    cin >>N;
    vector<int> X(N);
    rep(i,N) cin >> X[i];

    ll ans=LLINF;
    repd(p,1,101){
        ll t=0;
        rep(i,N) t+=(X[i]-p)*(X[i]-p);
        chmin(ans,t);
    }
    cout << ans <<endl;


    return (0);
}

Measured memory_bytes: 256
def f(x):
    if x%4 == 0:
        return x
    elif x%4 == 1:
        return 1
    elif x%4 == 2:
        return x^1
    elif x%4 == 3 or a == 0:
        return 0

a,b = map(int,input().split())
print(f(b)^f(a-1))


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

int main()
{
    int n, y;
    cin >> n >> y;
    
    int a=-1,b=-1,c=-1;
    
    for(int i = 0; i <= n; i++)
    {
        for(int j = 0; j <= n; j++)
        {
            int k = n - i - j;
            if(k >= 0)
            {
                int kq = i * 10000 + j * 5000 + 1000 * k;
                if(kq == y){
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
    }
    cout << a << " " << b << " " <<  c << endl;
    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end

ll dp[3010]={};

int main(){
    int n,t; scanf("%d%d",&n,&t);
    vector<pair<int,int>> p(n);
    rep(i,0,n)scanf("%d%d",&p[i].first,&p[i].second);
    sort(ALL(p));
    ll ans=0;
    rep(i,0,t+1)dp[i]=-INF;
    dp[0]=0;
    rep(i,0,n){
        rrep(j,t-1,-1)if(dp[j]!=-INF){
            chmax(dp[min(t,j+p[i].first)],dp[j]+p[i].second);
        }
    }
    rep(i,0,t+1)chmax(ans,dp[i]);
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
map1 = {
' ' => '101',
'\'' => '000000',
',' => '000011',
'-' => '10010001',
'.' => '010001',
'?' => '000001',
'A' => '100101',
'B' => '10011010',
'C' => '0101',
'D' => '0001',
'E' => '110',
'F' => '01001',
'G' => '10011011',
'H' => '010000',
'I' => '0111',
'J' => '10011000',
'K' => '0110',
'L' => '00100',
'M' => '10011001',
'N' => '10011110',
'O' => '00101',
'P' => '111',
'Q' => '10011111',
'R' => '1000',
'S' => '00110',
'T' => '00111',
'U' => '10011100',
'V' => '10011101',
'W' => '000010',
'X' => '10010010',
'Y' => '10010011',
'Z' => '10010000',
}
map2 = {
'00000' => 'A',
'00001' => 'B',
'00010' => 'C',
'00011' => 'D',
'00100' => 'E',
'00101' => 'F',
'00110' => 'G',
'00111' => 'H',
'01000' => 'I',
'01001' => 'J',
'01010' => 'K',
'01011' => 'L',
'01100' => 'M',
'01101' => 'N',
'01110' => 'O',
'01111' => 'P',
'10000' => 'Q',
'10001' => 'R',
'10010' => 'S',
'10011' => 'T',
'10100' => 'U',
'10101' => 'V',
'10110' => 'W',
'10111' => 'X',
'11000' => 'Y',
'11001' => 'Z',
'11010' => ' ',
'11011' => '.',
'11100' => ',',
'11101' => '-',
'11110' => '\'',
'11111' => '?',
}

readlines.each do |l|
  s = l.chars.map{|c| map1[c]}.join
  s += "0" * (5 - s.size % 5) if s.size % 5 != 0
  puts s.scan(/.{5}/).map{|c| map2[c] }.join
end

Measured memory_bytes: 6108
#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <algorithm>

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

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

int par[1000000];

void init(int n) {
  rep(i, n+1) par[i] = i;
}

int root(int x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = root(par[x]);
  }
}

bool same(int x, int y) {
  return root(x) == root(y);
}

void unite(int x, int y) {
  x = root(x);
  y = root(y);
  if (x == y) return;
  
  par[x] = y;
}

int main()
{
  int N, M;
  cin >> N >> M;

  init(N);

  rep(i, M)
  {
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    
    if (!same(A, B)) {
      unite(A, B);
    }
  }

  vector<int> count(N, 0);
  int mx = 0;
  rep(i, N) {
    count[root(i)]++;
  }
  rep(i, N) {
    mx = std::max(mx, count[root(i)]);
  }

  cout << mx << endl;

  return 0;
}


Measured memory_bytes: 10916
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define ms(s,x) memset(s,x,sizeof(s))
#define pb push_back
#define inf 0x3f3f3f3f
#define IOS ios::sync_with_stdio(false);cin.tie(0)
typedef long long ll;
using namespace std;

const double PI = acos(-1.0);
const double eps = 1e-8;
const int MAXN = 1e5+5;
const ll MOD = 1e9+7;

int box[MAXN];

int main()
{
    IOS;
    ms(box, 0);
    const int MIN = 0, MAX = 1e4;
    int n, num;
    cin >> n;
    rep(i, 1, n){
        cin >> num;
        box[num]++;
    }
    int t = 0;
    rep(i, MIN, MAX){
        rep(j, 1, box[i]){
            if (t++)
                cout << ' ';
            cout << i;
        }
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 3560
import Control.Monad
import Control.Monad.ST
import qualified Data.ByteString.Char8 as C
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM

main = C.interact $ put . sol . get

get = U.unfoldr (C.readInt . C.dropWhile (<'0'))

put = C.unlines . fmap (C.pack . show) . U.toList

sol v = runST $ do
  h <- UM.replicate (10^5+1) 0
  U.forM_ as $ UM.unsafeModify h (+ 1)
  r <- UM.unsafeNew q
  let
    f s i bc = do
      let (b,c) = (bc U.! 0,bc U.! 1)
      cnt <- UM.unsafeRead h b
      UM.unsafeWrite h b 0
      UM.unsafeModify h (+ cnt) c
      UM.unsafeWrite r i (s+cnt*(c-b))
      return $ s+cnt*(c-b)
  V.ifoldM_ f (U.sum as) qs
  U.unsafeFreeze r
  where
  n = v U.! 0
  as = U.slice 1 n v
  q = v U.! (n+1)
  qs = V.unfoldrN q (Just . U.splitAt 2) $ U.unsafeDrop (n+2) v

Measured memory_bytes: 30264
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
template<typename T>   T gcd(T a, T b) { return b ? gcd(b, a % b) : a;}
template<typename T>   T lcm(T a, T b) { return a / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v)cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;	}
int lg2(int x)   {   return 32 - __builtin_clz(x) - 1;	}


//Variables Declaration


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

 	int a,b,c;
 	cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b;





	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <cmath>
#include <stack>
using namespace std;

#define val first
#define prev second
#define INF 10000000000
#define EPS 1e-6

static const int N_MAX = 15;
double dptab[1 << N_MAX][N_MAX];
int N;
int dist[N_MAX][N_MAX];
int baggage[N_MAX];

double velocity(int status) {
	int w = 0;
	for(int i = 0; i < N; i++) {
		if(status & (1 << i))
			w += baggage[i];
	}

	return 2000.0 / (70 + 20*w);
}

double bitdp(int status, int current) {
	/* debug
	cout << hex << status << endl;
	// */

	if(dptab[status][current] != INF) {
		return dptab[status][current];
	}
	for(int i = 0; i < N; i++) {
		if(status & (1 << i)) {
			dptab[status][current] = min(dptab[status][current], bitdp(status & ~(1 << current), i) + dist[i][current] / velocity(status & ~(1 << current)));
		}
	}
	return dptab[status][current];
}

int main() {
	// init
	for(int i = 0; i < (1 << N_MAX); i++)
		for(int j = 0; j < N_MAX; j++)
			dptab[i][j] = INF;

	// input
	cin >> N;

	int in[N_MAX][3];
	for(int i = 0; i < N; i++) {
		cin >> in[i][0] >> in[i][1] >> in[i][2];
	}

	for(int i = 0; i < N; i++) {
		for(int j = 0; j < N; j++) {
			dist[i][j] = dist[j][i] = abs(in[i][1] - in[j][1]);
		}
		baggage[i] = in[i][2];
	}

	// init
	for(int i = 0; i < N; i++)
		dptab[1 << i][i] = 0;

	double ans = INF;
	int last = -1;
	for(int i = 0; i < N; i++) {
		double tmp = bitdp((1 << N) - 1,i);
		if(ans > tmp) {
			ans = tmp;
			last = i;
		}
	}

	if(last < 0) {
		abort();
	}
	//cout << "ans:" << ans << endl;

	stack<int> path;
	int flg = (1 << N) - 1;
	while(flg) {
		path.push(in[last][0]);
		flg &= ~(1 << last);
		for(int i = 0; i < N; i++) {
			if(flg & (1 << i)) {
				double cost;
				cost = dist[i][last] / velocity(flg);

				if(fabs(cost + bitdp(flg, i) - bitdp(flg | (1 << last), last)) < EPS) {
					last = i;
					break;
				}
			}
		}
	}

	while(path.size() > 1){
		cout << path.top() << " ";
		path.pop();
	}
	cout << path.top() << endl;

	return 0;
}

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

using namespace std;


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

	
	int h,a;
	cin >> h >> a;
	int res = h/a;
	if (h % a) res++;
	cout << res;
}

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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i=0;i<n;++i){
        int l;
        cin >> l;
        v.push_back(l);
    }
    sort(v.rbegin(), v.rend());
    int ans = 0;
    for(int i=0;i<n;++i){
        for(int j=i+1;j<n;++j){
            int ok = j, ng = n;
            while(abs(ok-ng) > 1){
                int mid = (ok + ng) / 2;
                if(v[j]+v[mid] > v[i])ok = mid;
                else ng = mid;
            }
            //cout << i << " " << j << " " << ok << endl;
            ans += ok - j;
        }
    }
    cout << ans << endl;

    return 0;
}


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

void initialize();
int isEmpty();
int isFull();
void push(int x);
int pop();

int top;
int s[101];

int main()
{
  char x;
  int n;
  int i,j;
  int count=0;
  int sum=0;

  initialize();

  while(scanf("%c",&x) != EOF){
    switch(x){

    case' ':
      sum = 0;
      if(count > 1){
	for(i=0; i<count; i++){
	  n = 1;
	  for(j=1; j<=i; j++){
	    n *= 10;
	  }
	  sum += pop()*n;
	}
	push(sum);
      }
      count = 0;
      break;
 
    case'+':
      push(pop() + pop());
      break;
    
    case'-':
      n = pop();
      push(pop() - n);
      break;

    case'*':
      push(pop() * pop());
      break;

    case'\n':
      printf("%d\n",s[top]);
      exit(0);
      break;

    default:
      push(atoi(&x));
      count++;
      break;
    }
  }
  
    return 0;
}

void initialize(){
  top = 0;
}

int isEmpty(){
  return top == 0;
}

int isFull(){
  return top >= 100;
}

  
void push(int x){
  if(isFull()){
    exit(0);
  }
  top++;
  s[top] = x;
} 

int pop(){
  if(isEmpty()){
    exit(1);
  }
  top--;
  return s[top+1];
}



Measured memory_bytes: 2744
#include <iostream>
using namespace std;
static const int N = 100;

int main()
{
    int M[N][N];
    int n, u, k, v;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
            M[i][j] = 0;
    }

    for (int i = 0; i < n; i++)
    {
        cin >> u >> k;
        u--;
        for (int j = 0; j < k; j++)
        {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (j)
                cout << " ";
            cout << M[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <cstdio>
#include <cctype>
using namespace std;


struct variable{
	int size;
	map<int,int> values;

	variable() : size(-1) {}
	variable(int s) : size(s) {}

	int at(int n){
		map<int,int>::iterator it = values.find(n);
		if( it == values.end() ) throw 1;
		return it->second;
	}
	
	int set(int n, int v){
		if( n >= size ) throw 1;
		values[n] = v;
	}
};

map<char,variable> vars;
stringstream ss;


int expression(){
	if( isdigit(ss.peek()) ){
		int n;
		ss >> n;
		return n;
	}

	char v;
	ss >> v;
	ss.ignore();
	int n = expression();
	ss.ignore();
	
	return vars[v].at(n);
}


void execute(const string &str){
	ss.clear();
	ss.str(str);

	char v;
	ss >> v;
	ss.ignore();
	int n = expression();
	ss.ignore();

	if( ss.peek() == '=' ){
		ss.ignore();
		vars[v].set( n, expression() );
	}
	else{
		vars[v] = variable(n);
	}
}


int main(){
	while(true){
		vector<string> program;
		string str;
		while(cin >> str, str[0] != '.'){
			program.push_back(str);
		}

		if( program.empty() ) break;

		vars.clear();
		int i;
		try{
			for(i = 0; i < program.size(); ++i){
				execute( program[i] );
			}
			puts("0");
		}
		catch(int){
			printf("%d\n", i + 1);
		}
	}
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    cin >> S;
    int ans = 0;
    for(int i=0; i<S.size(); i++){
        if(S[i] == 'o') ans++;
    }
    if(ans+(15-S.size()) >= 8){
        cout <<"YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

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

int main(){
  int X,Y,Z;cin>>X>>Y>>Z;
  int count=0;
  int left=Z;
  while(true){
    if(left+Y+Z<=X){
      count++;
      left+=Y+Z;
    }
    else break;
  }
  cout<<count<<endl;
}



Measured memory_bytes: 3536
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    l=[]
    for i in s:
        if i=='0' or i=='1':
            l.append(i)
        else:
            if len(l)>=1:
                l.pop(-1)
    print(''.join(l))
resolve()

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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  ll x;
  cin >> x;
  const int lim = 1e3;

  auto pow5 = [](auto t) { return t * t * t * t * t; };

  for (int i = 0; i < lim; i++) {
    for (int j = -lim; j < lim; j++) {
      if (pow5(i) - pow5(j) == x) {
        cout << i << ' ' << j << endl;
        return;
      }
    }
  }
}

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

  solve();
  return 0;
}


Measured memory_bytes: 3652
import itertools
N = int(input())
# = str(input())
# = map(int, input().split())
L = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]
count = 0
numbers = []
for i in range(N):
    numbers.append(i)

c = list(itertools.combinations(numbers, 3))

cn = len(c)
for i in range(cn):
    if L[c[i][0]]+L[c[i][1]]>L[c[i][2]] and L[c[i][1]]+L[c[i][2]]>L[c[i][0]] and L[c[i][2]]+L[c[i][0]]>L[c[i][1]]:
        if L[c[i][0]] != L[c[i][1]] and L[c[i][1]] != L[c[i][2]] and L[c[i][2]] != L[c[i][0]]:
            count+=1

print(count)


Measured memory_bytes: 20468
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll A,B,C,D;
  cin >> A >> B >> C >> D;
  cout << min(A,B)+min(C,D) << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
N_ = str(N)
n = len(N_)

if n == 1:
    print(N)
    exit()

for i in range(1, n):
    if N_[i] != '9':
        break
else:
    ans = int(N_[0]) + 9*(n-1)
    print(ans)
    exit()

ans = int(N_[0])-1 + 9*(n-1)
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a+b>=24)cout<<a+b-24<<endl;
    else cout<<a+b<<endl;
}

Measured memory_bytes: 256
#if 0
2020.05.03

  考虑一个点到一个矩阵的路径数，转为四个矩阵的加加减减，每个通过组合数可以化简到 O(1) 。那么
枚举中间矩阵的所有点然后计算就可以做到 O(n^2) 。考虑枚举进入中间矩阵的点 (a, b) ，可以简单算
出方案数，但是每条路径的贡献系数不一，取决于在中间矩阵经过了多少点。但如果直到离开中间矩阵的
点 (c, d) ，那么贡献系数就是 (c + d - a - b + 1) ，在 (a, b) 算上 (1 - a - b) 的贡献系数，在
(c, d) 算上 (c + d) 的贡献系数即可，复杂度 O(n) 。
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
} read;

const int maxn = 2000005, mod = 1000000007;
ll fac[maxn], ifac[maxn];

inline ll power (ll x, int k) {
	if (k < 0) k += mod - 1;
	ll res = 1;
	while (k) {
		if (k & 1) (res *= x) %= mod;
		(x *= x) %= mod;
		k >>= 1;
	}
	return res;
}

inline ll C (int n, int m) {
	return fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}

void combinator_init (int n) {
	fac[0] = 1;
	for (int i = 1; i <= n; i ++)
		fac[i] = fac[i - 1] * i % mod;
	ifac[n] = power(fac[n], -1);
	for (int i = n; i; i --)
		ifac[i - 1] = ifac[i] * i % mod;
}

ll F (int n, int m) {
	if (n < 0 or m < 0) return 0;
	return C(n + m + 2, m + 1) - 1;
}

ll G (int x1, int x2, int y1, int y2) {
	/* if (x1 > x2 or y1 > y2) debug("ERROR\n"); */
	/* if (x1 < 0 or y1 < 0) debug("ERROR\n"); */
	-- x1, -- y1;
	return (F(x2, y2) - F(x1, y2) - F(x2, y1) + F(x1, y1) + mod * 2) % mod;
}

int main () {
	combinator_init(2000002);
	int x1 = read, x2 = read, x3 = read, x4 = read, x5 = read, x6 = read;
	int y1 = read, y2 = read, y3 = read, y4 = read, y5 = read, y6 = read;

	ll ans = 0;

	for (int i = x3; i <= x4; i ++)
		(ans += G(x5 - i, x6 - i, y5 - y4 - 1, y6 - y4 - 1) *
		 G(i - x2, i - x1, y4 - y2, y4 - y1) % mod *
		 (1 + i + y4)) %= mod;

	for (int i = y3; i <= y4; i ++)
		(ans += G(x5 - x4 - 1, x6 - x4 - 1, y5 - i, y6 - i) *
		 G(x4 - x2, x4 - x1, i - y2, i - y1) % mod *
		 (1 + i + x4)) %= mod;

	for (int i = x3; i <= x4; i ++)
		(ans += G(i - x2, i - x1, y3 - y2 - 1, y3 - y1 - 1) *
		 G(x5 - i, x6 - i, y5 - y3, y6 - y3) % mod *
		 (mod - i - y3)) %= mod;

	for (int i = y3; i <= y4; i ++)
		(ans += G(x3 - x2 - 1, x3 - x1 - 1, i - y2, i - y1) *
		 G(x5 - x3, x6 - x3, y5 - i, y6 - i) % mod *
		 (mod - i - x3)) %= mod;

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


Measured memory_bytes: 31360
INT_MAX=10**11+7
MOD=10**9+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
#=======================================================================
import math as M
k=int(input())
a,b=INPUT()
bool=False
for i in range(a,b+1):
    if i%k==0:
        print("OK")
        bool=True
        break
if bool is False:
    print("NG")

    


Measured memory_bytes: 61988
#!/usr/bin/env python3
import math
n = int(input())
txy = [map(int, input().split()) for _ in range(n)]
t, x, y = [list(i) for i in zip(*txy)]

gt = 0
gx = 0
gy = 0

for i in range(n):
    wt = t[i] -gt
    ww = abs(x[i] - gx) + abs(y[i] - gy)
    if (wt < ww) or ((wt - ww) % 2 == 1):
        print("No")
        break

    gt = t[i]
    gx = x[i]
    gy = y[i]

else:
    print("Yes")

Measured memory_bytes: 63612
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,z,w,a[2010];
    cin>>n>>z>>w;
    rep(i,n){
        cin>>a[i];
    }
    if(n==1){
        cout<<abs(w-a[0])<<endl;
    } else{
        cout<<max(abs(a[n-1]-a[n-2]),abs(w-a[n-1]))<<endl;;
    }
    return 0;
}

Measured memory_bytes: 256
###入力
n, m = map(int, input().split())

###到達しているか否かのサイン
sign = []
for i in range(n):
    sign.append("o")

###グラフ
graph = []
for i in range(n):
    graph.append([])

###隣接行列
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    for j in range(n):
        if a == j:
            graph[j].append(b)
        if b == j:
            graph[j].append(a)

###深さ優先探索
###dfsはxからスタートしてoの箇所を全て回収する場合の数
def dfs(x, i=0):
    sign[x] = "x"
    
    ###すべてのノードが到達済みなら終了
    if sign == ["x" for k in range(n)]:
        return i + 1
    
    ###隣接するすべての点に対して、未到達ならdfsを適用
    for j in graph[x]:
        if sign[j] == "o":
            
            ###一旦xにする（後で戻す）
            sign[j] = "x"
            
            ###重要重要重要重要重要重要重要重要重要重要重要重要重要重要重要重要重要重要
            ###右辺のiにはこれまでの場合の数が蓄積されている
            ###そのiの上にjスタートの場合の数が加算される
            ###それを新たなiとする
            ###つまり、足し算の操作は右辺で完結している
            ###iはここでしか動かないことに注意
            ###重要重要重要重要重要重要重要重要重要重要重要重要重要重要重要重要重要重要
            
            i = dfs(j, i)
            
            ###戻した
            sign[j] = "o"
    return i

print(dfs(0))


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

const int INF = 1e9;

struct Edge {
    int from, to, cap, flow;
    Edge(int from, int to, int cap, int flow):from(from), to(to), cap(cap), flow(flow){}   
};

struct Dinic {
    int n;
    vector<Edge> edges;
    vector<vector<int>> g;
    
    vector<int> d; //depth of a node
    int flow = 0;
    
    Dinic(int n) : n(n) {
        g.assign(n + 1, vector<int>());
    }
    
    void addEdge(int from, int to, int cap) {
        edges.push_back(Edge(from , to, cap, 0));
        edges.push_back(Edge(to, from, 0, 0));
        g[from].push_back(edges.size() - 2);
        g[to].push_back(edges.size() - 1);   
    }
    
    int solve(int s, int t) {
       while (bfs(s, t)) {
           vector<int> cur(n + 1, 0);
           flow += dfs(s, INF, s, t, cur);
       }
       return flow;
    }
    
    
    bool bfs(int s, int t) {
        d.assign(n + 1, 0); //depth
        
        vector<bool> vis(n + 1, false);
        queue<int> q;
        d[s] = 0;
        vis[s] = true;
        q.push(s);
        while (!q.empty()) {
            int u = q.front(); q.pop();
            for (int edgeId : g[u]) {
                Edge e = edges[edgeId];
                if (!vis[e.to] && e.cap > e.flow) {
                    vis[e.to] = true;
                    d[e.to] = d[u] + 1;
                    q.push(e.to);
                }
            }
        }
        return vis[t];
    }
    
    int dfs(int u, int a, int s, int t, vector<int>& cur) {
        if (u == t || a == 0) {
            return a;
        }
        int currentFlow = 0, f;
        for (int& i = cur[u]; i < g[u].size(); i++) {
           Edge& e = edges[g[u][i]];
           if (d[u] + 1 == d[e.to] && (f = dfs(e.to, min(a, e.cap - e.flow), s, t,cur)) > 0) {
               e.flow += f;
               edges[(g[u][i] ^ 1)].flow -= f;
               currentFlow += f;
               a -= f;
               if (a == 0) {
                   break;
               }
           }
        }
        return currentFlow;
    }
    
};

int main() {
    int v, e, s, t;
    //cin >> v >> e >> s >> t;
    cin >> v >> e;
    s = 0;
    t = v - 1;
    Dinic maxflow(v);
    for (int i = 0; i < e; i++) {
        int from, to, cap;
        cin >> from >> to >> cap;
        maxflow.addEdge(from, to, cap);
    }
    int ans = maxflow.solve(s, t);
    cout << ans << endl;
    
    return 0;
}

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

using namespace std;

int main(){
    int N, M;

    cin >> N >> M;
    // M/N以下のMの最大の約数dじゃね？
    // K=M/dとしたとき、K>=N
    // Kをd個の整数に分けるのはeasyじゃん
    // 間に合うかな

    int MAX=1;
    for (int i=1; i*i <= M; i++){
        if (M % i != 0) continue;
        if (M/i <= M/N) MAX = max(M/i, MAX);
        else if (i <= M/N) MAX = max(MAX, i);
    }

    cout << MAX << endl;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    long long int a,b,c,d,l=0,k=0,x,y,i;
     cin>>a>>b;
     for(i=1;i<a;i++){
        k=k+i;
    }
    for(i=1;i<b;i++){
    l=l+i;
}
    cout<<k+l;
    return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())
if x==1 or x==3 or x==5 or x==7 or x==8 or x==10 or x==12:
    ans = 1
elif x==4 or x==6 or x==9 or x==11:
    ans = 2
else:
    ans = 3
if y==1 or y==3 or y==5 or y==7 or y==8 or y==10 or y==12:
    sna = 1
elif y==4 or y==6 or y==9 or y==11:
    sna = 2
else:
    sna = 3
if ans == sna:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
using System;

namespace Temp
{
    class Program
    {
        static void Main(string[] args)
        {
            int N;

            N = int.Parse(Console.ReadLine());

            string[] input1 = Console.ReadLine().Split(' ');

            var V = new int[N];
            for (int h = 0; h < N; h++)
            {
                V[h] = int.Parse(input1[h]);

                //Console.WriteLine(V[h]);
            }

            string[] input2 = Console.ReadLine().Split(' ');

            var C = new int[N];
            for (int h = 0; h < N; h++)
            {
                C[h] = int.Parse(input2[h]);


               // Console.WriteLine(C[h]);

            }

            int ProfSUM = 0;
            var Prof = new int[N];

            for (int h = 0; h < N; h++)
            {
                Prof[h] = V[h] - C[h];
                //Console.WriteLine(Prof[h]);

                if (Prof[h]>=0)
                {
                    ProfSUM += Prof[h];
                }

            }

            Console.WriteLine(ProfSUM);


        }
    }
}

Measured memory_bytes: 13140
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    private final static Scanner sc = new Scanner(System.in);

    /**
     * 本処理を実行します。
     */
    public static void execute() {
        String s = nextString();

        List<Character> cList = new ArrayList<>();

        for (int i = 0; i < s.length(); i++) {
            cList.add(s.charAt(i));
        }
        //Collections.sort(cList);

        for (char c = 'a'; c <= 'z'; c++) {
            if (!cList.contains(c)) {
                out(c);
                return;
            }
        }

        out("None");
    }

    /**
     * 次の標準入力をintで受け取ります。
     * @return 標準入力値(int)
     */
    public static int nextInt() {
        return sc.nextInt();
    }

    /**
     * 次の標準入力をStringで受け取ります。
     * @return 標準入力値(String)
     */
    public static String nextString() {
        return sc.next();
    }

    /**
     * 次の標準入力を指定回数分intで受け取ります。
     * @param n 取得回数
     * @return 取得した標準入力値の配列(int)
     */
    public static int[] nextInts(int n) {
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = nextInt();
        }

        return arr;
    }

    /**
     * 標準出力にオブジェクトを出力します。
     * @param o 出力対象
     */
    public static void out(Object o) {
        System.out.println(o);
    }

    public static void main(String[] args) {
        execute();
    }
}

Measured memory_bytes: 28116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
typedef pair<ll, ll> Pair;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define FIND(x,key) x.find(key) != x.end()
#define IN_RANGE_V2(v,k,x,y) (0<=x+dx[k]&&x+dx[k]<v[y].size()&&0<=y+dy[k]&&y+dy[k]<v.size())
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define PRINT_ARRAY_V(a) REPALL(__i,a) {cout<<a[__i]<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};
//const VI dx = {1, 1, 0, -1, -1, -1, 0, 1};
//const VI dy = {0, 1, 1, 1, 0, -1, -1, -1};

VVLL values(3333, VLL(3333));
VVLL cval(3333, VLL(4));

void solve()
{
    ll R, C, K;
    cin>>R>>C>>K;
    REP(i,K) {
        ll r, c, v;
        cin>>r>>c>>v;
        r--; c--;
        values[r][c] = v;
    }

    cval[0][1] = values[0][0];
    REP(i,R+C-1) {
        VVLL tval(3333, VLL(4));
        REP(j,R) {
            ll k = i - j;
            if (k < 0) break;
            else if (k >= C) continue;

            REP(t,4) {
                CHMAX(tval[j][t], cval[j][t]);
                if (t < 3)
                    CHMAX(tval[j][t+1], cval[j][t] + values[j][k+1]);
                CHMAX(tval[j+1][0], cval[j][t]);
                CHMAX(tval[j+1][1], cval[j][t] + values[j+1][k]);
            }
        }
        cval = tval;

        //cout<<i<<sspace<<*MAX_ELEMENT(cval[i])<<endl;
    }
    cout<<*MAX_ELEMENT(cval[R])<<endl;
}

int main()
{
    cout<<fixed<<setprecision(20);
    int __t = 1;
    //cin>>__t;
    REP(i,__t) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 90968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, pii> plii;
#define pb push_back

const ll OO = 1000000000000000000LL;
const int MAXS = 5000;
const int MAXN = 50;

vector<pair<pii, ll>> adj[MAXN][MAXS+1];
ll dists[MAXN][MAXS+1];

void dijkstra(pii start, int n) {
    for(int i = 0; i < n; i++) {
        for(int s = 0; s <= MAXS; s++) {
            dists[i][s] = OO;
        }
    }
    priority_queue<plii, vector<plii>, greater<>> Q;
    Q.push({0LL, start});
    dists[start.first][start.second] = 0;

    while(!Q.empty()) {
        auto t = Q.top(); Q.pop();
        ll d = t.first;
        pii u = t.second;
        if (d > dists[u.first][u.second]) continue;
        for(auto e : adj[u.first][u.second]) {
            auto v = e.first;
            ll w = e.second;
            if (d+w < dists[v.first][v.second]) {
                dists[v.first][v.second] = d+w;
                Q.push({d+w, v});
            }
        }
    }
}

int main() {
    int n, m, S;
    cin >> n >> m >> S;
    S = min(S, MAXS);
    for(int i = 0; i < m; i++) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--, v--;
        for(int s = 0; s <= MAXS; s++) {
            int ss = s - a;
            if (ss < 0) continue;
            adj[u][s].pb({{v,ss}, b});
            adj[v][s].pb({{u,ss}, b});
        }
    }
    for(int i = 0; i < n; i++) {
        int c, d;
        cin >> c >> d;
        for(int s = 0; s <= MAXS; s++) {
            int ss = s + c;
            ss = min(ss, MAXS);
            adj[i][s].pb({{i,ss}, d});
        }
    }
    dijkstra({0, S}, n);
    for(int i = 1; i < n; i++) {
        ll ans = OO;
        for(int s = 0; s <= MAXS; s++) {
            ans = min(ans, dists[i][s]);
        }
        cout << ans << endl;
    }
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  vector<int> mm(n, -1);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    mm[a] = max(mm[a], h[b]);
    mm[b] = max(mm[b], h[a]);
  }

  int ans = 0;
  rep(i, n) if (h[i] > mm[i]) ans++;

  cout << ans << endl;
}


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

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

using namespace std;

int main() {
    int n[5];
    rep(i, 5){
        cin >> n[i];
    }
    int k;
    cin >> k;
    bool flag = false;
    rep(i, 4){
        if(abs(n[0] - n[i+1]) > k){
            flag = true;
            break;
        }
    }
    if(!flag){
        rep(i, 3){
            if(abs(n[1] - n[i+2]) > k){
                flag = true;
                break;
            }
        }
    }
    if(!flag){
        rep(i, 2){
            if(abs(n[2] - n[i+3]) > k){
                flag = true;
                break;
            }
        }
    }
    if(!flag && abs(n[3] - n[4]) > k){
        flag = true;
    }
    if(flag){
        cout << ":(" << endl;
    }else {
        cout << "Yay!" << endl;
    }
}


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

using namespace std;

int main() {
 string S,T;
 cin>>S>>T;
 
 int c=0,n1=S.length(),n2=T.length();
 c=abs(n1-n2);
  for(int i=0;i<min(S.size(),T.size());++i)
  {
      if(S[i]!=T[i])
      {
          c++;
      }
  }
  
  cout<<c<<endl;
   
   
}

Measured memory_bytes: 3848
using System;

    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long a = int.Parse(input[0]);
            long b = int.Parse(input[2]);
            if(input[1] == "+")
            {
                Console.WriteLine(a + b);
            }
            if(input[1] == "-")
            {
                Console.WriteLine(a - b);
            }
        }
    }

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

mod = 10 ** 9 + 7

def make_divisors(N) :
  divisors = []
  for i in range(1, N + 1) :
    if i * i > N :
      break
    if N % i == 0:
      divisors.append(i)
      if i != N // i:
        divisors.append(N // i)

  return divisors

cnt = [0] * (K + 1)

ret = 0
for i in range(K, 0, -1) :
  cnt[i] += pow(K // i, N, mod)
  ret += i * cnt[i] % mod
  ret %= mod
  for j in make_divisors(i) :
    if j == i :
      continue
    cnt[j] -= cnt[i]

print(ret)

Measured memory_bytes: 69184
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int a, b; cin >> a >> b;
	cout << max({a + b, a - b, a * b}) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

   int n;
	cin >> n;
	vector<double> v(n);
	rep(i,n){
		cin >> v[i];
	}

	rep(i,n-1){
    	std::sort(v.begin(),v.end());
		v[i+1] = (v[i]+v[i+1])/2;
	}
	

	cout << v[n-1] << endl;
}

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

struct P{
    P(){}
    P(double a, double b){
	x = a;y = b;
    }
    double x, y;
    double det(P p){
	return x * p.y - y * p.x;
    }
    P operator-(P p){
	return P(x - p.x, y - p.y);
    }
};

bool comp_p(const P &x, const P &y){
    if(x.x == y.x)return x.y < y.y;
    return x.x < y.x;
}

P ans[1050];

int main(){
    int n;
    double a, b;
    while(cin >> n, n){
	vector<P> ps;
	for(int i = 0;i < n;i++){
	    scanf("%lf,%lf", &a, &b);
	    ps.push_back(P(a, b));
	}
	sort(ps.begin(), ps.end(), comp_p);
	int res = 0;
	for(int i = 0;i < ps.size();i++){
	    while(res > 1 && (ans[res - 1] - ans[res - 2]).det(ps[i] - ans[res - 1]) <= 0)res--;
	    ans[res++] = ps[i];
	}
	for(int i = ps.size() - 2, t = res;i >= 0;i--){
	    while(res > t && (ans[res - 1] - ans[res - 2]).det(ps[i] - ans[res - 1]) <= 0)res--;
	    ans[res++] = ps[i];
	}
	res--;
	cout << n - res << endl;
    }
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    string S;
    cin >> S;
    int N = S.size();
    rep(i,N) cout << "x";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 2e5; int n;
struct Point
{
  lli x, y;
  void read() { scanf("%lld %lld", &x, &y); x--, y--; }
  lli dist(Point &other)
  {
    return abs(x - other.x) + abs(y - other.y);
  }
};
Point points[maxN];

vector<Point> getClosests(Point from)
{
  vector<pair<lli, int>> dists(n);
  for (int i = 0; i < n; i++)
    dists[i] = {points[i].dist(from), i};
  sort(dists.begin(), dists.end());
  vector<Point> ans(n);
  for (int i = 0; i < n; i++)
    ans[i] = points[dists[i].second];
  return ans;
}

int main()
{
  while (scanf("%d", &n) != EOF)
  {
    for (int i = 0; i < n; i++)
      points[i].read();

    vector<vector<Point>> closests;
    closests.push_back(getClosests(Point{0, 0}));
    closests.push_back(getClosests(Point{0, (lli)1e9}));
    closests.push_back(getClosests(Point{(lli)1e9, (lli)1e9}));
    closests.push_back(getClosests(Point{(lli)1e9, 0}));
    // vector<Point> leftdown = getClosests(Point{0, 0});
    // vector<Point> leftup = getClosests(Point{0, (lli)1e9});
    // vector<Point> rightup = getClosests(Point{(lli)1e9, (lli)1e9});
    // vector<Point> rightdown = getClosests(Point{(lli)1e9, 0});

    lli ans = 0;
    for (int i = 0; i < 4; i++)
      for (int j = i + 1; j < 4; j++)
        ans = max(ans, closests[i][0].dist(closests[j][0]));
    printf("%lld\n", ans);
  }
  return 0;
}

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

using namespace std;


int main() {
    int N;
    cin >> N;
    vector<int> X(3 * N);

    long long ans = 0;
    for (int i = 0; i < 3 * N; i++) {
        cin >> X[i];
    }
    sort(X.begin(), X.end());
    int o = 0;
    for(int i = 3 * N - 1 ; i >= N ; i--){
        ans += o * X[i];
        o ^= 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int h,w,i,j;
  cin>>h>>w;
  long int a[h][w];
  char c;
  cin>>c;
  a[0][0]=1;
  for(j=1;j<w;j++){
    cin>>c;
    if(c=='.'){
      a[0][j]=a[0][j-1];
    }else{
      a[0][j]=0;
    }
  }
  for(i=1;i<h;i++){
    cin>>c;
    if(c=='.'){
      a[i][0]=a[i-1][0];
    }else{
      a[i][0]=0;
    }
    for(j=1;j<w;j++){
      cin>>c;
      if(c=='.'){
        a[i][j]=(a[i][j-1]+a[i-1][j])%1000000007;
      }else{
        a[i][j]=0;
      }
    }
  }
  cout<<a[h-1][w-1];
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin>>n;
    int m;
    vector<pair<int,int>> ans;
    if(n%2==1){
        m=(n-1)*(n-1)/2;
        cout<<m<<endl;
        for(int i=1;i<n;i++){
            for(int j=i+1;j<=n;j++){
                if(j!=n-i){
                    cout<<i<<" "<<j<<endl;
                }
            }
        }
    }
    else {
        m=n*(n/2-1);
        cout<<m<<endl;
        for(int i=1;i<n;i++){
            for(int j=i+1;j<=n;j++){
                if(j!=n+1-i) cout<<i<<" "<<j<<endl;
            }
        }
    }
}


Measured memory_bytes: 256
n = int(raw_input())
A = map(int, raw_input().strip().split(' '))
q = int(raw_input())
M = map(int, raw_input().strip().split(' '))

memo = []
for i in range(len(A)+1):
    memo.append([None]*2000)

def solve(i,m):
    if memo[i][m] != None: return memo[i][m]
    if m == 0:
        memo[i][m] = True
        return True
    elif i >= n:
        memo[i][m] = False
        return False
    else:
        ret = solve(i+1,m) | solve(i+1,m-A[i])
        memo[i][m] = ret
        return ret

for m in M:
    if solve(0,m): print "yes"
    else: print "no"

Measured memory_bytes: 6680
#include<iostream>
#include<string>
#include <vector>
#include<map>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<bitset>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define vsort(v) sort(v.begin(), v.end())
#define rv(v) reverse(v.begin(), v.end())
#define ll long long
using vll = vector<ll>;
const ll MOD = 1e9 + 7;

int main() {
	vii c(3, vi(3));
	rep(i, 3) {
		rep(j, 3) {
			cin >> c[i][j];
		}
	}
	vi a(3), b(3);
	a[0] = 0;
	rep(j, 3) b[j] = c[0][j];
	rep(i, 2) a[i + 1] = c[i + 1][0] - b[0];
	bool flag = true;
	rep(i, 3) {
		rep(j, 3) {
			if (a[i] + b[j] != c[i][j]) flag = flag&&false;
		}
	}
	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256