akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ABC026A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);

            int c = a * b;
            if (c == 1 || c ==3 ||c == 9)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] input = new int[N];
		for (Integer i = 0; i < input.length; i++) {
			input[i] = sc.nextInt();
		}
		double ans = 0;
		for (int i = 0; i < input.length; i++) {
			ans += (double) 1 / input[i];
		}
		ans = 1 / ans;
		System.out.println(String.format("%.5f", ans));
		sc.close();
	}
}

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

using namespace std;
  vector<long long int> DP;
  vector<int> h;
long long int DP_function(int i){
	if(i<0)return 999999999;
	if(DP[i] == -1)
		DP[i] = min(abs(h[i -2] - h[i]) + DP_function(i - 2), abs(h[i - 1] - h[i]) + DP_function(i - 1));

	return DP[i];
}

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

	h.resize(N);
	for(int index = 0; index < N; index++)
		cin >> h[index];

	 DP.resize(N, -1);
   DP[0]=0;
	cout << DP_function(N-1);

	return 0;
}


Measured memory_bytes: 7680
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
minimum = 10**9
index = -1
for i in range(n):
  if minimum > a[i]:
    index = i
    minimum = a[i]
ans = 1+(i-1)//(k-1)+(n-i-1)//(k-1)
print(ans)

Measured memory_bytes: 13812
/*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1102

??????
?¨???????????????°????????????????????????????????????????????¨??????
?¨????????????§??????10000????¶??????????overflow??¨??¨??????

?§£???
?§?????§£???
pair???first????????°???second????????°?????????????????????

??¨??????
???????????±??????????????§is_over????????????????????????
overflow????????????????????´???????°?????????????????¶?????????????WA?????????
?????°??¨???????¬??????¨???????°????????????????????????¨?????????10+-10i???
??????i??¨?????§????????????1i
 */
#include <bits/stdc++.h>
  
using namespace std;
  
typedef string::const_iterator State;
typedef pair<int, int> Pii; //first:?????°???second:?????°
  
#define fr first
#define sc second

bool is_over = false;
  
struct Parser {
  Pii expression(State &idx) {
    Pii ret = term(idx);
    while ( 1 ) {
      if ( *idx == '+' ) {
	idx++;
	Pii tmp = term(idx);
	ret.fr = ret.fr + tmp.fr;
	ret.sc = ret.sc + tmp.sc;
      } else if ( *idx == '-' ) {
	idx++;
	Pii tmp = term(idx);
	ret.fr = ret.fr - tmp.fr;
	ret.sc = ret.sc - tmp.sc;
      } else {
	break;
      }
      if ( abs(ret.fr) > 10000 || abs(ret.sc) > 10000 ) is_over = true;
    }
    return ret;
  }
    
  Pii term(State &idx) {
    Pii ret = factor(idx);
    while ( 1 ) {
      if ( *idx == '*' ) {
	idx++;
	Pii tmp = factor(idx), tmp2 = ret;
	ret.fr = tmp2.fr * tmp.fr - tmp2.sc * tmp.sc;
	ret.sc = tmp2.fr * tmp.sc + tmp2.sc * tmp.fr;
      } else {
	break;
      }
      if ( abs(ret.fr) > 10000 || abs(ret.sc) > 10000 ) is_over = true;
    }
    return ret;
  }
  
  Pii factor(State &idx) {
    Pii ret;
    if ( *idx == '(' ) {
      idx++;
      ret = expression(idx);
      idx++;
    } else {
      ret = number(idx);
    }
    return ret;
  }
  
  Pii number(State &idx) {
    int tmp = 0;
    while ( '0' <= *idx && *idx <= '9' ) {
      tmp *= 10;
      tmp += *idx - '0';
      if ( abs(tmp) > 10000 ) is_over = true;
      idx++;
    }
    if ( *idx == 'i' ) {
      idx++;
      return Pii(0, 1); //i???0+1i??¨??????????????????
    }
   
    else return Pii(tmp, 0);
  }
};
  
int main()
{
  string s;
  while ( cin >> s ) {
    is_over = false;
    Parser ps;
    string tmp = s.substr(0, s.size() - 1);
    State idx = s.begin();
  
    Pii ret = ps.expression(idx);
    if ( abs(ret.fr) > 10000 || abs(ret.sc) > 10000 ) is_over = true;
    if ( is_over ) cout << "overflow" << endl;
    else if ( ret.fr == 0 && ret.sc == 0 ) cout << 0 << endl;
    else if ( ret.fr == 0 ) printf("%di\n", ret.sc);
    else if ( ret.sc == 0 ) printf("%d\n", ret.fr);
    else printf("%d%+di\n", ret.fr, ret.sc); //?????°??¨????¬????????°?????????????
  }
  
  return 0;
}

Measured memory_bytes: 3224
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll A,B,X; cin>>A>>B>>X;

  ll N = X/B * B - 1;
  if(N == -1) N = X;
  // cout<<N<<endl;
  // nを利用
  ll tmp1 = floor(A*N/B);
  ll tmp2 = A * floor(N/B);

  ll ans = tmp1 - tmp2;
  cout<<ans<<endl;

}


Measured memory_bytes: 3592
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N, D = map(int, input().split())
ans = 0
for n in range(N):
    x, y = map(int, input().split())
    ans += x ** 2 + y ** 2 <= D ** 2
print(ans)




Measured memory_bytes: 10852
#include <bits/stdc++.h>
using namespace std;
long n, a1, a2, ans = 1000;
int main(){
    cin >> n >> a1;
    while(--n){
        a2 = a1; cin >> a1;
        if(a1 > a2) ans += ans/a2*(a1-a2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) x.begin(),x.end()
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, n, m) for(int i = n; i >= m; i--)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;

int main(){

  int N;
  cin >> N;

  string S;

  cin >> S;

  ll MOD=998244353;

  ll ans=1;

  ll ct=N;

  char c1='O',c2='O';

  int v1=0, v2=0;

  rep(i,3*N){
    char c=S[i];

    if(c1=='O'){
      c1=c;
      v1=1;
      ans=(ans*ct)%MOD;
      ct--;
    }
    else if(c2=='O'){
      if(c==c1){
        v1+=1;
        ans=(ans*ct)%MOD;
        ct--;
      }
      else{
        c2=c;
        v2=1;
        ans=(ans*v1)%MOD;
      }
    }
    else if(c!=c1 && c!=c2){
      ans=(ans*min(v1,v2))%MOD;
      v1-=1;
      v2-=1;
    }
    else{
      if(v1==v2){
        if(c==c1){
          v1+=1;
          ans=(ans*ct)%MOD;
          ct--;
        }
        else{
          v2+=1;
          ans=(ans*ct)%MOD;
          ct--;
        }
      }
      else if(v1<v2){
        if(c==c1){
          ans=(ans*(v2-v1))%MOD;
          v1+=1;
        }
        else{
          v2+=1;
          ans=(ans*ct)%MOD;
          ct--;
        }
      }
      else{
        if(c==c2){
          ans=(ans*(v1-v2))%MOD;
          v2+=1;
        }
        else{
          v1+=1;
          ans=(ans*ct)%MOD;
          ct--;
        }
      }
    }

    if(v2==0) c2='O';
    if(v1==0){
      if(v2==0) c1='O';
      else{
        c1=c2;
        v1=v2;
        c2='O';
        v2=0;
      }
    }

  }

  cout << ans <<endl;
  return 0;
}


Measured memory_bytes: 900
#include<bits/stdc++.h>
#include<string.h>
#include<tuple>
#define all(c) c.begin(),c.end()
#define tr(x,n) for(int i=x;x<n?i<n:i>=n;x<n?i++:i--)
#define ll long long int
#define pb push_back
#define em emplace_back
#define mp make_pair
#define mt make_tuple
#define debug(c) cout<<c<<endl;
#define isro ios_base::sync_with_stdio(false);
#define find(v,x) find(all(v),x)!=v.end()

ll mod=1e9+7;

using namespace std;
typedef vector<ll>vi;
typedef vector<vi>vii;
typedef pair<ll,ll>pi;
typedef tuple<ll,ll,ll>ti;

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

    vi v(n);

    for(ll i=0;i<n;i++){
        cin>>v[i];
    }

    ll count=0;
    for(ll i=1;i<n-1;i++){

        if((v[i]>v[i-1] and v[i]<v[i+1]) or (v[i]>v[i+1] and v[i]<v[i-1])){
            count++;
        }
    }

    cout<<count<<endl;

}

Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <queue>
#include <iomanip> 
#include <math.h>
#include <unordered_map>
#include <functional> 

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }

using namespace std;


int main() {

	ios_base::sync_with_stdio(0);cin.tie(0);
	
	string s;

	cin >> s;

	s[3] = '8';

	cout << s <<endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[105];
int main() {
    cin>>n;
    if(n==1){
    	cout<<n<<endl;
    	return 0;
	 }
    a[1]=2;
    for(int i=2;i<=100;i++)
        a[i]=a[i-1]*2;
    for(int i=1;i<=100;i++)
        if(n>=a[i]&&n<a[i+1]){
            cout<<a[i]<<endl;
            return 0;
        }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;

class Program
{
	static void Main(string[] args)
	{
		long N = long.Parse(Console.ReadLine());
		long sum = 0;
		for(long l = 1;l <= N; l++)
		{
			if(!(l % 3 == 0 || l % 5 == 0))
			{
				sum += l;
			}
		}
		Console.WriteLine(sum);
	}
}

//string s = Console.ReadLine();
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];
//int N = int.Parse(Console.ReadLine());

//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.ReadKey();

//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];


Measured memory_bytes: 27532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N,D,X;
	cin >> N >> D >> X;
	ll ans=0,k;
	D--;
	FOR(i,0,N){
		cin >> k;
		ans += 1+D/k;
	}
	cout << ans + X << endl;
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int c, int k, int[] a) {
    a.sort();
    auto q = DList!int(a);
    int ans = 0;
    while (!q.empty) {
        int time = q.front + k; // 出発時刻
        q.removeFront;
        int passengers = 1; // 乗客
        while (!q.empty && q.front <= time && passengers < c) {
            passengers++;
            q.removeFront;
        }
        ans++;
    }
    return ans;
}

void main() {
    auto nck = readints;
    int n = nck[0], c = nck[1], k = nck[2];
    int[] a;
    for (int i = 0; i < n; i++) a ~= readint;
    writeln(calc(c, k, a));
}


Measured memory_bytes: 7164
#include <iostream>

using namespace std;

int main() {
	int n, t, a, b, i, p = 0;
	long long ans=0;
	cin >> n >> t >> a;
	for (i = 0; i < n-1; i++) {
		if (p == 0) {
			cin >> b;
			if ((b - a) >= t) {
				ans += t;
			}
			else {
				ans += b - a;
			}
			p = 1;
		}
		else {
			cin >> a;
			if ((a - b) >= t) {
				ans += t;
			}
			else {
				ans += a - b;
			}
			p = 0;
		}
	}
	ans += t;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
	for (int i = 1; i <= 9; i++)
	{
		for (int j = 1; j <= 9; j++)
		{
			cout << i << 'x' << j << '=' << i*j << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1112
//============================================================================
// Name        : abc126c.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;

int main() {
	double N, K;
	cin >> N >> K;
	double ans = 0;

	for(int i = 1; i <= N; ++i){
		double count = 0;
		for(int j = i; j < K; j *= 2){
			++count;
		}
		ans += 1.0 / (N * pow(2.0, count));
	}

	printf("%0.12lf\n", ans);

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
vector<vector<char > > box;
int check(int,int);
int N;
int main(){
    int C;
    cin>>C>>N;
    box.resize(N);
    for(int i=0;i<N;++i){
        box[i].resize(N);
    }
    for(int y=0;y<N;++y){
        for(int x=0;x<N;++x){
            cin>>box[x][y];
            box[x][y]-='0';
        }
    }
    int num=0;
    for(int y=0;y<N;++y){
        for(int x=0;x<N;++x){
            num+=check(x,y);
        }
    }
    int ans=num==0?1:0;
    for(int i=0;i<C-1;++i){
        int time;
        cin>>time;
        for(int j=0;j<time;++j){
            int x,y;
            cin>>y>>x;
            --x;
            --y;
            num-=check(x,y)*2;
            box[x][y]=!box[x][y];
            num+=check(x,y)*2;
        }
        if(num==0){
            ++ans;
        }
    }
    cout<<ans<<endl;
    return 0;
}

int check(int x,int y){
    int res=0;
    if(box[x][y]!=box[N-x-1][y]){
        ++res;
    }
    if(box[x][y]!=box[x][N-y-1]){
        ++res;
    }
    return res;
}

Measured memory_bytes: 3904
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<int> num;
    UnionFind(int N) : par(N), rank(N), num(N) {
        for(int i = 0; i < N; i++) {
            par[i] = i;
            rank[i] = 0;
            num[i] = 1;
        }
    }
    
    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) rank[x]++;
        par[y] = x;
        num[x] += num[y];
        num[y] = 0;
        return true;
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

struct edge {
    int from, to, weight;
};

bool comp_edge(edge &a, edge &b) {
    return a.weight < b.weight;
}

int main(int argc, const char * argv[]) {
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n; cin >> n;
    vector<pair<int, int>> xs(n), ys(n);
    for (int i = 0; i < n; i++) {
        int x, y; cin >> x >> y;
        xs[i] = make_pair(x, i);
        ys[i] = make_pair(y, i);
    }
    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());
    
    vector<edge> G;
    for (int i = 0; i < n - 1; i++) {
        G.push_back({xs[i].second, xs[i + 1].second, xs[i + 1].first - xs[i].first});
        G.push_back({ys[i].second, ys[i + 1].second, ys[i + 1].first - ys[i].first});
    }
    
    sort(G.begin(), G.end(), comp_edge);
    
    UnionFind tree(n);
    int64_t ans = 0;
    
    for (int i = 0; i < G.size(); i++) {
        int s = G[i].from, t = G[i].to;
        if (!tree.same(s, t)) {
            ans += G[i].weight;
            tree.unite(s, t);
        }
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 6516
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int count = 0;
		for (int i = 0; i < N; i++) {
			int n = sc.nextInt();
			while (n % 2 == 0) {
				n = (n >> 1);
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 34264
main(a,b,c){
    scanf ("%d%d%d",&a,&b,&c);
    if(a>b)a+=b,b=a-b,a-=b;
    if(b>c)b+=c,c=b-c,b-=c;
    if(a>b)a+=b,b=a-b,a-=b;
    printf("%d %d %d\n", a, b, c);
}

Measured memory_bytes: 1752
require 'rbconfig'
STACK_SIZE = 64*1024*1024
if ENV['RUBY_THREAD_VM_STACK_SIZE'].to_i < STACK_SIZE
  ENV['RUBY_THREAD_VM_STACK_SIZE'] = STACK_SIZE.to_s
  exec("#{RbConfig::CONFIG['ruby_install_name']} --disable-gems #{__FILE__}")
end

def dfs(node, edges, known)
  known[node] = true
  edges[node].each do |other|
    unless known[other]
      dfs(other, edges, known)
    end
  end
end

n, m = gets.split.map(&:to_i)
table = m.times.map { gets.split.map(&:to_i) }
known = Array.new(n)
edges = Hash.new { [] }

table.each do |x, y, z|
  x -= 1
  y -= 1
  edges[x] <<= y
  edges[y] <<= x
end

cost = 0
(0...n).each do |i|
  unless known[i]
    cost +=1

    dfs(i, edges, known)
  end
end
puts cost


Measured memory_bytes: 224484
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i,j;
    long long res=0;
    for(i=1;i<=n;i++)
    {
        long long int s=0;
        for(j=1;;j++)
        {
            if(i*j<=n) s+=(i*j);
            else break;
        }
        //cout<<s<<endl;
        res += s;
    }
    cout<<res;
    return 0;
}


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

int main(){
    int n;
    multiset<ll> s, status, tmp;
    //sは与えられる集合、statusはシミュレーションの状態、tmpはstatusのコピー先
    
    //入力部
    cin >> n;
    int j;
    for(int i = 0; i < (1 << n); i++){
        cin >> j;
        s.insert(j);
    }

    status.insert(*(s.rbegin()));
    s.erase(*(s.rbegin()));
    for(int i = 0; i < n; i++){
        multiset<ll> tmp(status); //状態を保存しておき、tmpを変化させていく、statusは参照するだけ
        for(auto e : status){ //現在の状態の最小の値から見ていく
            auto itr = s.lower_bound(e); //現在見ている値の中で最も左にあるものを参照
            if(itr == s.begin()){ //その位置が最左端ならシミュレーション失敗
                cout << "No" << endl;
                return 0;
            }
            tmp.insert(*prev(itr)); //見ている値よりも小さい物を取る
            s.erase(prev(itr));
        }
        status = tmp; //状態を更新する
    }

    //シミュレーションに成功したらYes
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 24832
/*
	
	@Raghul

*/	
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll n;
	cin>>n;
	string a,b,c;
	cin>>a>>b>>c;
	ll ans = 0;
	for(int i=0;i<n;i++){
		set <char> s;
		s.insert(a[i]);
		s.insert(b[i]);
		s.insert(c[i]);
		ans += s.size()-1;
		s.clear();
	}
	cout<<ans;
	return 0;
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> ii;

int X[200005];
int dir[200005];
ii dest[200005];
int res[200005];

int n, L, T; 
void c(int &x){
	x %= L;
	if(x < 0) x += L;
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	
	cin >> n >> L >> T;
	for(int i = 1;i <= n;i++){
		cin >> X[i] >> dir[i];
		if(dir[i] == 1) dest[i].first = X[i] + T;
		else dest[i].first = X[i] - T;
		c(dest[i].first);
	}
	
	int offset = X[1];
	
	for(int i = 1;i <= n;i++) X[i] = X[i] - offset;
	
	int anchor = 0;
	
	for(int i = 1;i <= n;i++){
		if(dir[i] == dir[1]) continue;
		
		int low = 0;
		int high = 302345678;
		
		while(low != high - 1){
			int s = (low + high) / 2;
			
			int need = (s-1)*L;
			if(dir[1] == 1) need += X[i];
			else need += L - X[i];
			
			if(need < 2*T) low = s;
			else high = s; 
		}
		
		anchor += low;
	}
	
	anchor %= n;
	if(dir[1] == 1){
		dest[1].second = anchor+1;
	}
	else{
		dest[1].second = n-anchor+1;
		if(dest[1].second > n) dest[1].second -= n;
	}
	
	sort(dest+1,dest+1+n, [&](ii a, ii b){
		if(a.first != b.first) return a.first < b.first;
		if(dir[1] == 1) return a.second > b.second;
		else return a.second < b.second;
	});
	int pos = -1;
	for(int i = 1;i <= n;i++){
		if(dest[i].second != 0){
			pos = i; break;
		}
	}
	
	for(int i = 1;i < n;i++){
		int a = pos + i - 1;
		int b = pos + i;
		if(a > n) a -= n;
		if(b > n) b -= n;
		
		
		dest[b].second = dest[a].second + 1;
		if(dest[b].second > n) dest[b].second -= n;		
	}
	
	for(int i = 1;i <= n;i++){
		res[dest[i].second] = dest[i].first;
	}
	
	for(int i = 1;i <= n;i++){
		cout << res[i] << "\n";
	}
	
}




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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ANS(ans) cout << ans << endl;
#define FLG(flg) if(flg) cout << "Yes" << endl; else cout << "No" << endl;
#define YES cout << "Yes" << endl;
#define NO cout << "No" << endl;
#define COUT(s) cout << s << endl;
#define AN vector<int> a(n); for(int i = 0; i < n; i++) cin >> a[i];
#define IN  int n;  cin >> n;
#define VI  vector<int> 
#define SS stringstream ss;
#define SOLVE cout << solve() << endl;

int main() {
    long double a, b, x,ans;
    cin >> a >> b >> x;
    cout << setprecision(12);
    if(x >= (a * a * b) /2 )  ans = (180 * atan((2 * (a * a * b - x)) / (a * a * a))) / M_PI;
    else ans = (180 * atan((a * b * b) / (2 * x)) / M_PI);
    cout << ans << endl;
}

Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

//#include <bits/stdc++.h>
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <random>
#include <assert.h>
#include <time.h>
#include <random>
#include <chrono>
#include <memory>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)

#define plus dfghjk
#define minus tyughj
#define y1 tyjnm

using namespace std;

inline void setmin(int &x, int y) { if (y < x) x = y; }
inline void setmax(int &x, int y) { if (y > x) x = y; }
inline void setmin(ll &x, ll y) { if (y < x) x = y; }
inline void setmax(ll &x, ll y) { if (y > x) x = y; }

const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = 998244353;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

int T;
int p[N], r[N], sz[N];
ll ans;

void init(int n) {
    T = n;
    rep(i, 0, n) {
        p[i] = i;
        r[i] = 0;
        sz[i] = 1;
    }
    ans = 1LL * n * (n - 1) / 2;
}

int get(int x) {
    if (x != p[x]) {
        p[x] = get(p[x]);
    }
    return p[x];
}

void uni(int x, int y) {
    x = get(x); y = get(y);
    if (x == y) {
        return;
    }
    ans -= 1LL * sz[x] * (T - sz[x]);
    ans -= 1LL * sz[y] * (T - sz[y]);
    ans += 1LL * sz[x] * sz[y];
    if (r[x] >= r[y]) {
        p[y] = x;
        sz[x] += sz[y];
        ans += 1LL * sz[x] * (T - sz[x]);
    } else {
        p[x] = y;
        sz[y] += sz[x];
        ans += 1LL * sz[y] * (T - sz[y]);
    }
    if (r[x] == r[y]) {
        r[x]++;
    }
}

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n, m;
    cin >> n >> m;
    int e[m][2];
    rep(i, 0, m) {
        cin >> e[i][0] >> e[i][1];
        e[i][0]--; e[i][1]--;
    }
    ll out[m];
    init(n);
    repb(i, m - 1, -1) {
        out[i] = ans;
        uni(e[i][0], e[i][1]);
    }
    rep(i, 0, m) {
        cout << out[i] << " ";
    }
    cout << "\n";
    return 0;
}

Measured memory_bytes: 4096
from itertools import permutations
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(M)]

# path候補を全列挙
route = [i for i in range(2, N+1)]
routes = list(permutations(route))
ans = 0

for route in routes:
    now = 1
    for r in route:
        if ([now, r] not in AB) and ([r, now] not in AB):
            now = r
            break
        now = r
    else:
        ans += 1

print(ans)

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

int n,l;

int main(){
	cin >> n >> l;
	int tot = 0;
	int maksi = 1;
	for(int i=1;i<=n;i++){
		int tmp = l+i-1;
		tot+=tmp;
		if(abs(l+maksi-1) > abs(l+i-1)){
			maksi = i;
		}
	}
	tot-=(l+maksi-1);
	cout << tot << 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 = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
char itoa(int n) { return n + '0';}
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  string s;
  cin >> s;
  rep(i,s.size()) {
    if (s[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3608
struct DFS {
    n: Vec<char>,
    k: usize,
}

impl DFS {
    fn new() -> DFS {
        let n = read::<String>().chars().collect();
        let k = read();
        DFS {
            n: n,
            k: k,
        }
    }

    fn dfs(&self, i: usize, buf0: Vec<u64>, buf1: Vec<u64>) -> u64{
        if i >= self.n.len() {
            buf0[self.k]+ buf1[self.k]
        } else {
            let ni = self.n[i].to_digit(10).expect("Failed to Convert char to digit") as u64;
            let mut next0 = vec![0; self.k + 1];
            let mut next1 = vec![0; self.k + 1];

            next0[0] = buf0[0] + if ni != 0 { buf1[0] } else { 0 };
            next1[0] = if ni != 0 { 0 } else { buf1[0] };
            for j in 1..(self.k + 1) {
                next0[j] = buf0[j-1] * 9 + buf0[j];
                if ni != 0 {
                    next0[j] += buf1[j] + buf1[j-1] * (ni - 1);
                }

                next1[j] = if ni > 0 { buf1[j-1] } else { buf1[j] };
            }

            self.dfs(i + 1, next0, next1)
        }
    }
}



fn main() {
    let d = DFS::new();    
    let mut buf1 = vec![0; d.k + 1];
    buf1[0] = 1;
    println!("{:?}", d.dfs(0, vec![0; d.k + 1], buf1));
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}




Measured memory_bytes: 4352
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	ar := make([]int, n+1)
	for i := 1; i <= n; i++ {
		fmt.Scan(&ar[i])
	}
	ans := 0
	v := 1
	for {
		if ar[v] == 0 {
			fmt.Println(-1)
			return
		}
		ans++
		if ar[v] == 2 {
			fmt.Println(ans)
			return
		}
		v, ar[v] = ar[v], 0
	}
}


Measured memory_bytes: 5504
#include<iostream>

using namespace std;

int dp[45] = {1,1};
int fibo(int n){
  if(dp[n] != 0) return dp[n];
  dp[n] = fibo(n-1) + fibo(n-2);
  return dp[n];
}

int main() {
  int n;
  cin >> n;
  cout << fibo(n) << endl;
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int N,M,e[100][100],deg[100];
vector<int> vs;
vector<int> vc;
int ans;
void dfs(int x,int left){
	if(left==0){
		bool can=1;
		rep(i,vc.size()) rep(j,i) if(e[vc[i]][vc[j]]==0) can=0;
		if(can){
			int sum=0;
			for(int i:vc){
				int tmp=1e9;
				for(int j:vc) if(i!=j) chmin(tmp,e[i][j]);
				sum+=tmp;
			}
			chmax(ans,sum);
		}
		return;
	}
	if(x==vs.size()) return;
	dfs(x+1,left);
	vc.pb(vs[x]);
	dfs(x+1,left-1);
	vc.pop_back();
}
int main(){
	cin>>N>>M;
	rep(i,M){
		int a,b,c;
		cin>>a>>b>>c;
		a--,b--;
		e[a][b]=e[b][a]=c;
		deg[a]++,deg[b]++;
	}
	for(int d=2;d<=14;d++){
		vs.clear();
		rep(i,N) if(deg[i]>=d-1) vs.pb(i);
		dfs(0,d);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1256
#include <complex>
#include <cmath>
#include <stdio.h>
#include <iostream>
using namespace std;

class xy_t{
public:
  double x;
  double y;
};

xy_t P[110];
int main(){
  int N = 0;
  double mx, my;
  while(scanf("%lf,%lf", &mx, &my) != EOF){
    P[N].x = mx;
    P[N].y = my;
    N++;
  }
  double sum = 0.0;
  for(int i=0; i+2<N; i++){
    xy_t a=P[0], b=P[i+1], c=P[i+2];
    sum += 0.5*abs((b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x));
    
   
  }
  printf("%.6f\n", abs(sum));
}

Measured memory_bytes: 1240
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int d;
    while(~scanf("%d",&d))

    {
        if(d==22) printf("Christmas Eve Eve Eve\n");
        if(d==23) printf("Christmas Eve Eve\n");
            if(d==24) printf("Christmas Eve\n");
        if(d==25) printf("Christmas\n");
    }
    return 0;
}


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

int main(void) {
    int n;
    int a;
    bool check;
    
    cin >> n;
    
    for(int i = 1; i <= n; ++i) {
        a = i;
        check = true;
        if(a % 3 == 0) {
            cout << ' ' << i;
            check = false;
        }
        while(check && (a > 0)) {
            if(a % 10 == 3) {
                cout << ' ' << i;
                check = false;
            }
            a /= 10;
        }
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3108
n,m=map(int,input().split())
acl=[0]*n
wal=[0]*n
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=='AC' and acl[p]==0:
        acl[p]+=1
    elif s=='WA' and acl[p]==0:
        wal[p]+=1
wa=0
for i,ac in enumerate(acl):
    if ac==1:
        wa+=wal[i]

print(sum(acl),wa)
    

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
int n;
cin >> n;
map<string,int> mp;
for(int i = 0; i< n; i++){
string s;
cin >> s;
mp[s]++;
}
cout << "AC x  " << mp["AC"] << endl;
cout << "WA x  " << mp["WA"] << endl;
cout << "TLE x  " << mp["TLE"] << endl;
cout << "RE x  " << mp["RE"] << endl;
return 0;
}



Measured memory_bytes: 3644
x = int(input())
ans = []
if x < 4:
  print(1)
else:
  for i in range(2, x):
    temp = i
    if i**2 == x:
      print(x)
      break
    elif i**2 > x:
      print(max(ans))
      break
    else:
      while True:
        temp *= i
        if temp > x:
          temp //= i
          break
      ans.append(temp)
      

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<pair<ll, ll>> a(n);
  for (auto& e : a) cin >> e.first >> e.second;

  set<pair<ll, ll>> p;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      p.insert({a[j].first - a[i].first, a[j].second - a[i].second});
    }
  }

  int r = n;
  for (auto e : p) {
    int rt = 0;
    set<pair<int, int>> t(begin(a), end(a));
    while (!t.empty()) {
      rt++;
      auto x = *begin(t);
      for (int i = 0; abs(x.first + i * e.first) <= 1e9 && abs(x.second + i * e.second) <= 1e9; i++) {
        pair<ll, ll> y = {x.first + i * e.first, x.second + i * e.second};
        if (t.count(y)) {
          t.erase(y);
        } else {
          break;
        }
      }
    }
    r = min(r, rt);
  }
  cout << r << endl;
}


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

const int N = 100 + 10;

int n , x[N];
long long ans = 1e18;

int main(){
	scanf("%d" , &n);
	for(int i = 1; i <= n; i++) scanf("%d" , &x[i]);
	for(int k = 1; k <= 100; k++){
		long long sum = 0;
		for(int i = 1; i <= n; i++)
			sum += 1ll * (x[i] - k) * (x[i] - k);
		ans = min(ans , sum);
	}
	printf("%lld" , ans);
	return 0;
}

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

    #define ll long long
    #define pb push_back
    #define mod 1000000007
    #define mk make_pair


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

      ll n;
      cin>>n;
      ll i,j;
      ll arr[n][n-1];
      for(i=0;i<n;i++){
        for(j=0;j<n-1;j++){
            cin>>arr[i][j]; arr[i][j]--;
        }
      }
      ll node[n][n];
      memset(node,0,sizeof node);
      ll v=0;
      for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            node[i][j]=v;
            v++;
        }
      }
      vector<vector<ll>> g(n*n);
      vector<ll> ind(n*n,0);

      for(i=0;i<n;i++){
        ll pre;
        pre=node[min(i,arr[i][0])][max(i,arr[i][0])];
        for(j=1;j<n-1;j++){
            ll next=node[min(i,arr[i][j])][max(i,arr[i][j])];
            ind[next]++;
            g[pre].pb(next);
            pre=next;
        }

      }
      queue<ll> q;
      vector<ll> dp(v,0);
      for(i=0;i<v;i++){
        if(ind[i]==0){q.push(i); dp[i]=1; }
      }

      while(!q.empty()){
        ll t=q.front();
        q.pop();
        for(int s:g[t]){
            dp[s]=max(dp[s],dp[t]+1);
            ind[s]--;
            if(ind[s]==0){
                q.push(s);
            }
        }
      }
      
      ll ans=0;
      for(i=0;i<v;i++){
        if(ind[i]>0){
            cout<<"-1\n";
            return 0;
        }
        ans=max(ans,dp[i]);
      }
      cout<<ans<<"\n";

      return 0;
      
      }

Measured memory_bytes: 66688
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
vector<int> F[100001];
vector<int> B[100001];
int bel=0;
vector<int> belong[100000];
map<int,int> p;
int visited[100000]={};
void dfs(int now,int c){
    int cn=0;
    if(!visited[now]){
        visited[now]=1;
        belong[c].push_back(now);
        p[now]=c;
        //keyは人、値は所属番号
        for(int j=0;j<F[now].size();j++){
            int child = F[now][j];
            if(!visited[child]){
                dfs(child,c);
                cn++;
            }
        }
        if(cn==0){
            bel++;
        }
    }
    
}
int main(){
    int n,m,k;
    cin>>n>>m>>k;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        F[a].push_back(b);
        F[b].push_back(a);
    }
    map<int,vector<int>> B;
    rep(i,k){
        int a,b;
        cin>>a>>b;
        //B[a].push_back(b);
       // B[b].push_back(a);
       B[a].push_back(b);
       B[b].push_back(a);
    }
    for(int i=1;i<=n;i++){
        /*
        cout<<i<<"がブロックしてる人 ";
        rep(j,B[i].size()){
            cout<<B[i][j]<<" ";
        }
        cout<<endl;
        */
    }
    for(int i=1;i<=n;i++){
        dfs(i,bel);
    }
    /*
    rep(i,bel){
        cout<<i<<"個目のグループ所属 ";
        rep(j,belong[i].size()){
            cout<<belong[i][j]<<" ";
        }
        cout<<endl;
    }
    */
    for(int i=1;i<=n;i++){
        int block=0;
        if(B[i].size()>=1){
            rep(j,B[i].size()){
                if(p[i]==p[B[i][j]]){
    
                    block++;
                }
            }
        }
        int bsize=belong[p[i]].size();
        int fsize=F[i].size();
        //cout<<bsize<<"-"<<fsize<<"-1-"<<block<<"=";
        cout<<bsize-fsize-1-block<<" ";
    }
}

Measured memory_bytes: 29176
#include "bits/stdc++.h"
using namespace std;
//template <typename... T> void read(T& ... t){ ((cin >> t), ...); }
//template <typename... T> void write(T ... t){ ((cout << t), ...); }
//#define int long long
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define size(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define ln '\n'
using LL = long long;
using pii = pair<int,int>;
const int INF = 2e9;
const int MAXN = 2e5 +3;
int n,k;
int arr[MAXN];

int32_t main(){ FAST;
	cin >> n >> k;
	for(int i=1; i<=n; ++i) cin >> arr[i];

        sort(arr+1, arr+n+1);
	
        LL sum = 0;
        for(int i=1; i<=n-k; ++i) sum += arr[i];
        cout << sum << ln;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#define ll long long
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}

ll a[210];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<2*n;i++)scanf("%lld",a+i);
	sortup(a,2*n);
	int ans=0;
	for(int i=0;i<n;i++)ans+=a[2*i];
	printf("%d",ans);
}

Measured memory_bytes: 128
w = ["Sunny", "Cloudy", "Rainy"]
def today(x):
  if x == "Sunny":
    return 1
  elif x == "Cloudy":
    return 2
  elif x == "Rainy":
    return 0
  
a = input()
t = w[today(a)]
print(t)
  
  

Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
	int i, f, buf, height[10], rank[3];
	
	for (i = 0; i < 10; i++){
		scanf("%d", &height[i]);
	}
	
	for (i = 0; i < 3; i++){
		rank[i] = 0;
	}
	
	for (i = 0; i < 3; i++){
		for (f = 0; f < 10; f++){
			if (height[f] > rank[i]){
				buf = rank[i];
				rank[i] = height[f];
				height[f] = buf;
			}
		}
	}
	
	for (i = 0; i < 3; i++){
		printf("%d\n", rank[i]);
	}
	
	return (0);
}

Measured memory_bytes: 600
#include <stdio.h>
#include <math.h>

int main(void) {
  double a, b, c, px, py, r, x[3], y[3], t[5];
  int n;

  while (scanf("%d", &n) != EOF) {
    while (n--) {
      scanf("%lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2]);
      
      t[0]=(x[1]*x[1]+y[1]*y[1]-x[0]*x[0]-y[0]*y[0])*(y[1]-y[2])
	-(x[2]*x[2]+y[2]*y[2]-x[1]*x[1]-y[1]*y[1])*(y[0]-y[1]);
      t[1]=(x[0]-x[1])*(y[1]-y[2])-(y[0]-y[1])*(x[1]-x[2]);
      a = t[0] / t[1];

      t[2]=(x[2]*x[2]+y[2]*y[2]-x[1]*x[1]-y[1]*y[1])*(x[0]-x[1])
	-(x[1]*x[1]+y[1]*y[1]-x[0]*x[0]-y[0]*y[0])*(x[1]-x[2]);
      t[3]=((x[0]-x[1])*(y[1]-y[2])-(y[0]-y[1])*(x[1]-x[2]));
      b = t[2] / t[3];
      
      c=-x[0]*(x[0]+a)-y[0]*(y[0]+b);

      px = -a / 2;
      py = -b / 2;

      t[4] = (a*a+b*b)/4 - c;
      r = sqrt(t[4]);

      printf("%.3lf %.3lf %.3lf\n", px, py, r);
    }
  }
  return 0;
}

Measured memory_bytes: 664
s = gets.chomp
if s == s.reverse && s[0..(s.size - 2) / 2] == s[0..(s.size - 2) / 2].reverse && s[((s.size + 2) / 2)..s.size] == s[((s.size + 2) / 2)..s.size].reverse
  print "Yes"
else
  print "No"
end

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

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector < int >X(M);
	for (int i = 0; i < M; i++) {
		cin >> X[i];
	}

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

	vector < int >diff(M - 1);
	for (int i = 0; i < M - 1; i++) {
		diff[i] = X[i + 1] - X[i];
	}

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

	for (int i = 0; i < N - 1 && diff.size(); i++) {
		diff.pop_back();
	}

	int ans = accumulate(diff.begin(), diff.end(), 0);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
N = int(input())
S = input()

def judge(n):
    j = 0
    for i in range(N):
        if S[i] == n[j]:
            j += 1
        if j == 3:
            return True
    return False

ans = 0

for num in range(1000):
    num = str(num)
    num = "0" * (3-len(num)) + num
    if judge(num):
        ans += 1

print(ans)

Measured memory_bytes: 39408
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {


		int W = nextInt();
		int H = nextInt();
		int N = nextInt();
		int[] h = {0,H};
		int[] w = {0,W};
		for(int i=0;i<N;i++){
			int[] in = nextInts();
			if(in[2]==1){
				w[0]=Math.max(w[0],in[0]);
			}else if(in[2]==2){
				w[1]=Math.min(w[1],in[0]);
			}else if(in[2]==3){
				h[0]=Math.max(h[0],in[1]);
			}else{
				h[1]=Math.min(h[1],in[1]);
			}
		}



		System.out.println(Math.max((h[1]-h[0]),0)*Math.max((w[1]-w[0]),0));

	}

public static long gcd(long a, long b) {
	long x, y;
	if (a < b) {
		x = b;
		y = a;
	} else {
		x = a;
		y = b;
	}
	long r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}

Measured memory_bytes: 21460
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep2(i,x,y) for (int i = x; i < (y); ++i)
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int INF = 100100101;
int main()
{
  ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
  vector<int> a(3);
  rep(i, 3) cin >> a[i];
  sort(a.begin(), a.end());
  rep(i, 3) {
    if(i < 2) cout << a[i] << " ";
    else cout << a[i];
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3156
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main()
{
	int n;
	cin>>n;
	vector<int> A;
	for(int i =0;i<n;i++)
	{
		int a;
        cin>>a;
        A.push_back(a);
	}
	
	vector<int> dp;
	for(int i =0;i<n;i++)
	dp.push_back(0);
	
	dp[1]= abs(A[1]-A[0]);
	for(int i =2;i<n;i++)
	dp[i] = min((dp[i-1] + abs(A[i] - A[i-1])), (dp[i-2] + abs(A[i]-A[i-2])));
	
	cout<<dp[n-1];
	return 0;
}

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

using namespace std;
int dp[100000],n,arr[100000],k;
int bt(int i)
{
    if(dp[i]!=-1)
        return dp[i];
    if(i>=n)
        return 99999999;
    if(i==n-1)
        return 0;
    int &ret=dp[i];
    ret=bt(i+1)+abs(arr[i]-arr[i+1]);
    for(int s=1;s<=k&&i+s<n;s++)
    {
        ret=min(bt(i+s)+abs(arr[i]-arr[i+s]),ret);
    }
    return ret;
}
int main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    cout<<bt(0);
}


Measured memory_bytes: 5760
S = input()

num_dict = {}

for i in range(len(S)):
    if S[i] in num_dict:
        num_dict[S[i]] += 1
    else:
        num_dict[S[i]] = 1

if len(num_dict) == 2 and \
    len([i for i, x in enumerate(num_dict.values()) if x == 2]):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940