akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#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 fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
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;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.out


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    ll n;
    cin>>n;
    vll a(n),b(n),c(n);
    rep(i,n){
        cin>>a[i];
        b[i]=a[i];
        c[i]=a[i];
    }
    for(int i=0;i<n-1;i++){
        b[i+1]-=b[i];
        b[i]=0;
    }
    ll lest=b[n-1];
    cout<<lest<<" ";
    for(int i=0;i<n-1;i++){
        c[i]-=lest/2;
        lest=c[i]*2;
        cout<<lest;
        if(i!=n-2)cout<<" ";
        else cout<<endl;
    }
    
//////////////////////////////////////////////////////
return 0;}


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

using namespace std;

int main(int, char**)
{
	unsigned int n, ans = 0;
	string a, b, c;
	cin >> n >> a >> b >> c;

	for (unsigned int i = 0; i < n; i++) {
		if (a[i] == b[i] && a[i] == c[i]) continue;
		if (a[i] == b[i]) ++ans;
		else if (a[i] == c[i]) ++ans;
		else if (b[i] == c[i]) ++ans;
		else ans += 2;
// cerr << ans << " ";
	}

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


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
	string s;
	string t;
	cin >> s;
	cin >> t;
	bool bad = false;

	int size = s.size();
//	cout << size;

	for(int i = 0; i < size; i++){
		if(s[i] != t[i]){
			bad = true;
//			cout << i;
			break;
		}
	}

	if(bad)
		cout << "No";
	else
		cout << "Yes";
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 2005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 + c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int H,W,ans;
char s[MAXN][MAXN];
int tr[MAXN],tl[MAXN],h[MAXN],l[MAXN],r[MAXN];
bool check(int x,int y) {
    return ((s[x - 1][y - 1] == '#') + (s[x - 1][y] == '#') + (s[x][y - 1] == '#') + (s[x][y] == '#')) & 1;
}
void Solve() {
    read(H);read(W);
    ans = max(H,W);
    for(int i = 0 ; i < H ; ++i) {
        scanf("%s",s[i]);
    }
    for(int i = 1 ; i <= W - 1; ++i) l[i] = 0,r[i] = W;
    tr[W] = W;
    for(int i = 1 ; i < H ; ++i) {
        for(int j = 1 ; j < W ; ++j) {
            if(check(i,j)) tl[j] = j;
            else tl[j] = tl[j - 1];
        }
        for(int j = W - 1 ; j >= 1 ; --j) {
            if(check(i,j)) tr[j] = j;
            else tr[j] = tr[j + 1];
        }
        for(int j = 1 ; j < W ; ++j) {
            if(check(i,j)) {
                h[j] = 0,l[j] = 0,r[j] = W;
            }
            else {
                l[j] = max(tl[j],l[j]);
                r[j] = min(tr[j],r[j]);
                h[j]++;
                ans = max(ans,(r[j] - l[j] - 1 + 1) * (h[j] + 1));
            }
        }
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 4224
#include <stdio.h>
#include <string.h>
int main()
{
  
 
    char s[100], p[100] ,ss[201] ;
 
 
 
    scanf("%s", s);
    scanf("%s", p);
 
    strcat( ss, s );
    strcat( ss, s );
 
 
    if ( strstr( ss , p ) != '\0' )
        printf("Yes\n") ;
    else
        printf("No\n") ;
return 0;
}

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

using namespace std;

int main(void) {
    long long N, A, B;
    cin >> N >> A >> B;

    if (A > B)
        cout << "0\n";
    else if (N == 1 && A != B)
        cout << "0\n";
    else {
        if (A == B) N--;
        else N -= 2;
        cout << N * (B - A) + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  string s;
  cin >> s;
  string ret(s.size(), 'x');
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b


mm=m*6

hh=h*30+30*m/60
if hh-mm<=180:
    cos = math.cos(math.radians(abs(hh-mm)))
else:
    cos = math.cos(math.radians(360-abs(hh-mm)))
#print(cos)
cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)


Measured memory_bytes: 9512
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

public class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = fs.nextInt();
        }
        Arrays.sort(a);
        System.out.println(Math.abs(a[0] - a[n - 1]));
    }
}


Measured memory_bytes: 81876
print((388130742,597534442,616680192,329869205,170591295,333099663,133009077,738390145,866398347,718889563,252858375,847205021,915711339,123820509,940737264,371653459,323137024,353770801,206282374,847501730,25328739,842176273,569725155,781042769,427196161,570246669,191483611,673385295,324759692,245601370,975058685,406959393,515140586,305799096,981760191,986519078,414054379,149602322,221791721,792638194,696683714,725438992,702530485,51018086,751629411,971550783,664630886,256852905,775465589,799008836,113468411,39816123,501575626,124885216,998121103,181836645,639213333,123883652,785892908,763737161,534833116,978442997,88638656,604356692,409213624,68697295,649970414,855462856,783022045,23314687,531294469,996291083,549054109,639056669,858533109,159693437,604119499,737209731,44657419,51688048,580025381,776803305,261943303,733354121,794717734,478366600,127504505,33985227,9058467,2414454,643550,171531,45719,12185,3247,865,230,61)[2-int(input())])

Measured memory_bytes: 3064
n,m = gets.chomp.split(" ").map(&:to_i)

if n%2 == 1
  (1..m).each do |i|
    puts "#{i} #{m*2-i+1}"
  end
else
  if m%2 == 1
    (1..m/2+1).each do |i|
      puts "#{i} #{m-i+2}"
    end
    (1..m/2).each do |i|
      puts "#{m+1+i} #{m+m+1+1-i}"
    end
  else
    (1..m/2).each do |i|
      puts "#{i} #{m-i+2}"
      puts "#{m+1+i} #{m+m+1+1-i}"
    end
  end
end

Measured memory_bytes: 14384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
//#define DEBUG
 
 
int main(void)
{
  unsigned long long a,b,c,d,e;
  cin >> a >> b >> c;
  d = a*b;
  if( c < a+b){
    cout << "No";
  }else{
    e = c-a-b;
    if( 4*d<e*e )
    {
      cout << "Yes";
    }else{
      cout << "No";
    }
  }
  
//    cout << 4*d  << endl;
//   cout << e*e;
  
  return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;


int main() {
	int n,ans=0;
	cin >> n;
	for (int i = 1; 2*i-1 <= n; i++) {
		int count = 0;
		for (int j = 1; j <= 2*i-1;j++) {
			if ((2*i-1) % j == 0) {
				count++;
			}
			if (count == 8) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <unordered_map>  
#define N 55556
using namespace std;
unordered_map<int, int> mp;  
int arr[N];
int memo[N];
 int count2=0;
//エラトステネスの篩
void Eratosthenes(){
	for(int i = 0; i < N; i++){
		arr[i] = 1;
	}
	for(int i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}
int count=0;
 
for(int i = 2; i < N; i++){
		if(arr[i]){
memo[count2]=i;
count2++;
	}
}
}
 
 
//素数
int main(void){
	Eratosthenes();
	int n;
cin >>n;
int a[count2];
for(int i=0;i<count2;i++){
a[i]=memo[i];
}
int count=0;
for(int i=0;i<count2;i++){
if(a[i]%5==1){
cout<<a[i]<<" ";
count++;
}
if(count==n){
break;
}
}
	return 0;
}

Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int[] a = new int[n];
			for(int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}
			int q = sc.nextInt();
			for(int i = 0; i < q; i++) {
				/* 返り値に注意*/
				int loc = Arrays.binarySearch(a, sc.nextInt());
				System.out.println(loc < 0 ? "0" : "1");
			}
		}
	}
}



Measured memory_bytes: 106916
#include <iostream>
#include<algorithm>
#include<vector> //動的配列
#include<string> 
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>


//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;

typedef long long ll;


using namespace std;

typedef pair<int, int> P;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

ll k;
int a,b,c;



int main(){
    cin>>a>>b>>c>>k;
    if (k%2==1){
        cout<<b-a<<endl;
    }else {
        cout<<a-b<<endl;
    }
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SIZE(a) int((a).size())

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_LARGE = 1000000100;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

void Main()
{
	const int ken1 = 0;
	const int ken2 = 1;
	const int pa = 2;

	int n,m;
	cin >> n >> m;
	VVI e(n);
	REP(i,m){
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		e[a].push_back(b);
	}
	int s,t;
	cin >> s >> t;
	s--;
	t--;

	VI cost(n*3,INT_LARGE);
	priority_queue<PII, vector<PII>, greater<PII>> q;

	//start
	REP(i,SIZE(e[s])){
		q.push(make_pair(1,n*ken1 + e[s][i]));
	}

	while(!q.empty()){
		PII p = q.top();
		q.pop();

		int v = p.second % n;
		int type = p.second / n;
		int c = p.first;

		if((v == t) && (type == pa)){
			cout << p.first << endl;
			return;
		}

		if(cost[p.second] <= c){
			continue;
		}
		cost[p.second] = c;

		REP(i,SIZE(e[v])){
			if(type == ken1){
				if(cost[n*ken2 + e[v][i]] <= c){
					continue;
				}
				q.push(make_pair(c,n*ken2 + e[v][i]));
			}
			if(type == ken2){
				if(cost[n*pa + e[v][i]] <= c){
					continue;
				}
				q.push(make_pair(c,n*pa + e[v][i]));
			}
			if(type == pa){
				if(cost[n*ken1 + e[v][i]] <= c+1){
					continue;
				}
				q.push(make_pair(c+1,n*ken1 + e[v][i]));
			}
		}



	}
	cout << "-1" << endl;




	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define ull         unsigned long long int
#define ll          long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> 
 
const long long INF = (long long) 1e12+1;
const long long mod = (long long) 20437;
const long long hell = (long long) 1000000007;

ll power(ll x,ll y,ll m){
  ll res=1;
  while(y>0){
    if(y%2) res=(x%m*res%m)%m;
    x=(x%m*x%m)%m;    
    y=y/2;
  }
  
  return res%m;
}
 
ll modinv(ll x){
  return power(x,hell-2,1);
}

ll gcd(ll a,ll b){
    while(b!=0){
		ll t=b;
		b=a%t;
		a=t;
	}
	return a;
}    
    
void fastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
} 

void solve(){
    int n;
    cin>>n;
    
    int res[n+1];
    memset(res,0,sizeof(res));
    
    for(int x=1;x<=100;x++){
        for(int y=1;y<=100;y++){
            for(int z=1;z<=100;z++){
                int cur=x*x+y*y+z*z+x*y+y*z+z*x;
                if(cur<=n)
                res[cur]++;
            }
        }
    }
    forn(i,1,n+1){
        cout<<res[i]<<"\n";    
    }
}    
    
int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;    
   
   while(test--)
   solve();
}

Measured memory_bytes: 3568
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner input = new Scanner(System.in);
		int H = input.nextInt();
		int W = input.nextInt();
		int N = input.nextInt();
		int[] arr = new int[N];
		for (int i = 0; i < N; i++) {
			arr[i] = input.nextInt();
		}

		int[][] mat = new int[H][W];
		int dir = 0;
		int ind = 0;
		for (int r = 0; r < mat.length; r++) {
			if (dir % 2 == 0) {
				for (int c = 0; c < mat[0].length; c++) {
					mat[r][c] = ind + 1;

					if (arr[ind] > 0) {
						arr[ind]--;
						if (arr[ind] == 0) {
							ind++;
						}
					}
				}
			} else {
				for (int c = mat[0].length - 1; c >= 0; c--) {
					mat[r][c] = ind + 1;
					
					if (arr[ind] > 0) {
						arr[ind]--;
						if (arr[ind] == 0) {
							ind++;
						}
					}
				}

			}
			dir++;
		}
		for (int r = 0; r < mat.length; r++) {
			for (int c = 0; c < mat[0].length; c++) {
				System.out.print(mat[r][c] + " ");
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 34512
N = int(input())
A = [int(input()) for _ in range(N)]

import bisect

B = sorted(A)
ans = 0
for i in range(N):
    idx = bisect.bisect_left(B, A[i])
    if (i-idx)%2 == 1:
        ans += 1

print(ans//2)

Measured memory_bytes: 8292
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; ++i)

using namespace std;

int dp[1003][1003];

int main()
{
	int N, M;
	scanf("%d%d", &N, &M);
	
	int D[1000], C[1000];
	REP(i, N) scanf("%d", &D[i]);
	REP(i, M) scanf("%d", &C[i]);
	
	memset(dp, 0x3f, sizeof(dp));
	dp[0][0] = 0;
	for(int i=0; i<=N; i++){
		for(int j=0; j<=M; j++){
			dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
			dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + C[j]*D[i]);
		}
	}
	
	printf("%d\n", dp[N][M]);
	
	return 0;
}

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

    using namespace std;
    typedef long long ll;
    typedef double dd;
    #define all(v) v.begin(),v.end()
    #define endl "\n";

    void fast() {

        cin.tie(0);
        cin.sync_with_stdio(0);
    }

    int freq[26];

    int main() {
        fast();
        string s;cin>>s;
        for(char c:s)freq[c-'a']++;
        for (int i = 0; i <26 ; ++i) {
            if((freq[i]&1))return cout<<"No",0;
        }
        cout<<"Yes";

    }


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

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

const int inf = 999999999;
const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

vector<ll> s[3];

// bを固定したときにa,cで条件を満たすindexのリスト
ll a_ix_end[100010], c_ix_start[100010];

int main() {
	cin.tie(0);
	int N;
	cin >> N;
	REP(i, 3) {
		REP(j, N) {
			int num;
			cin >> num;
			s[i].push_back(num);
		}
	}
	REP(i, 3) {
		sort(s[i].begin(),s[i].end());
	}


	ll ix = 0;
	REP(b_ix, N) {
		while (1) {
			if (ix == N) {
				a_ix_end[b_ix] = N;
				break;
			}
			if (s[1][b_ix] <= s[0][ix]) {
				a_ix_end[b_ix] = ix;
				break;
			}
			else ix++;
		}
//		cout << a_ix_end[b_ix] << " ";
	}
//	cout << endl;

	ix = 0;
	REP(b_ix, N) {
		while (1) {
			if (ix == N) {
				c_ix_start[b_ix] = N;
				break;
			}
			if (s[1][b_ix] < s[2][ix]) {
				c_ix_start[b_ix] = ix;
				break;
			}
			else ix++;
		}
//		cout << c_ix_start[b_ix] << " ";
	}
//	cout << endl;

	ll ans = 0;
	REP(b_ix, N) {
		ans += a_ix_end[b_ix] * (N - c_ix_start[b_ix]);
	}
	cout << ans;
	system("pause");
	return 0;
}

Measured memory_bytes: 4468
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        HashMap<String, Integer> cards = new HashMap<String, Integer>();
        
        for (int i = 0; i < n; i++) {
            String key = br.readLine();
            if (cards.get(key) == null) cards.put(key, 1);
            else cards.put(key, cards.get(key) + 1);
        }
        
        int m = Integer.parseInt(br.readLine());
        
        for (int i = 0; i < m; i++) {
            String key = br.readLine();
            if (cards.get(key) == null) cards.put(key, -1);
            else cards.put(key, cards.get(key) - 1);
        }
        
        int max = 0;
        for (int value : cards.values()) {
            if (max < value) max = value;
        }
        
        System.out.println(max);
    }
}


Measured memory_bytes: 21332
#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 <iomanip>
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1000000000;
const int MOD = 1000000007;

typedef pair<int, int> P;
int myAbs(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

using Graph = vector<vector<int>>;
//再帰とかグラフを使うときは予めNの最大値のグローバル配列を取っておく
int N;
bool E[101][101];
vector<bool> seen;
typedef pair<int, int> P;
int D[101];
//頂点状態を表すcolor[]において、0は未訪問、1は訪問中、2は完了を表す。
int color[101];
int find_time = 0;

void bfs(int start) {
    //全頂点を未訪問にして距離も初期化(INF)
    for (int i = 0; i < 101; i++) D[i] = -1;
    queue<int> Q;
    //最初の頂点をキューに入れる
    Q.push(start);
    int v;
    //最初の頂点は距離0
    D[start] = 0;
    //キューが空になるまで探索
    while (!Q.empty()) {
        v = Q.front();
        Q.pop();
        for (int i = 1; i <= N; i++) {
            //今訪問している頂点vから辺があるか&&すでに訪問済み(距離がINFではない)を確認
            if (!E[v][i]) continue;
            if (D[i] != -1) continue;
            //未訪問かつ辺があったなら元の頂点の距離に1を足す
            D[i] = D[v] + 1;
            //発見した頂点をキューに入れて再度探索
            Q.push(i);
        }
    }
    for (int i = 1; i <= N; i++) {
        cout << i << " " << D[i] << endl;
    }
}

int main() {
    int N; cin >> N;
    int A[20], X[20][20], Y[20][20];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        for (int j = 0; j < A[i]; j++) {
            cin >> X[i][j] >> Y[i][j];
            X[i][j]--;
        }
    }
    int ans = 0;
    int count = 0;
    bool ok = true;
    for (int tmp = 0; tmp < (1 << N); tmp++) {
        bitset<15> S(tmp);
        ok = true;
        count = 0;
        for (int i = 0; i < N; i++) {
            if (S.test(i)) {
                count++;
                for (int j = 0; j < A[i]; j++) {
                    int A, B;
                    A = S.test(X[i][j]);
                    if (A != Y[i][j]) ok = false;
                }
            }
        }
        if (ok) ans = max(ans, count);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007
#define LINF 10000000000000007LL
#define ll long long
using namespace std;
signed main(){
	ll a,b;
	cin>>a>>b;
	ll ans = 0;
	if( a==b ){
		cout<<a<<endl;
		return 0;
	}
	if( a+1==b){
		cout<<(a^b)<<endl;
		return 0;
	}
	if( a%2 == 1){
		ans = ans ^ a;
		a++;
	}
	if( b%2 == 0){
		ans = ans^b;
		b--;
	}
	int sa = (b-1-a)/2;
	if( sa % 2 == 0 ){
		ans = ans ^ 1;
		cout<<ans<<endl;
		return 0;
	}
	else{
		cout<<ans<<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
import sys
import math
import collections
from collections import deque
#x = int(input())
x, y, A, B, C = map(int, sys.stdin.readline().split())
#s = input()

a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))
c = list(map(int, sys.stdin.readline().split()))

a.sort(reverse = True)
b.sort(reverse = True)

for i in range(x):
    c.append(a[i])

for i in range(y):
    c.append(b[i])

c.sort(reverse = True)
ans = 0
for i in range(x+y):
    ans += c[i]

print(ans)




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

int count(int **lines,int place,int depth){
    //lines: lines in the graph 
    //place: number that searching now
    int N=lines[0][0];
    int uplines[N+1][N+1];
    int *tmp[N+1];
    int sum=0;
    if(depth==N) return 1;
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N;j++)
            uplines[i][j]=lines[i][j];
        uplines[i][place]=0;
        tmp[i]=uplines[i];
    }
    for(int i=1;i<=N;i++)
        if(uplines[place][i]==1) sum+=count(tmp,i,depth+1);
    return sum;
}

int main(){
    int N,M;
    //data input
    cin>>N;
    cin>>M;
    int a[M],b[M];
    int lines[N+1][N+1];
    int *tmp[N+1];
    for(int i=0;i<M;i++){
        cin>>a[i];
        cin>>b[i];
    }

    //initialize
    for(int i=0;i<=N;i++){
        for(int j=1;j<=N;j++)
            lines[i][j]=0;        
        tmp[i]=lines[i];
    }
    lines[0][0]=N;

    //classification
    for(int i=1;i<=N;i++){
        for(int j=0;j<M;j++){
            if(a[j]==i)lines[i][b[j]]=1;
            if(b[j]==i)lines[i][a[j]]=1;
        }
    }
    cout<<count(tmp,1,1)<<endl;
    return 0;
}

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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rep1r(i, n) for (int i = ((int)(n)); i > 0; --i)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(5);
    int x, y;
    cin >> x >> y;
    cout << gcd(x, y) << endl;

    return 0;
}



Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<ll> vc;
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
const ll mod = 1e9+7;
long long powmod(long long px, long long py, long long pmod){
	if(py == 0) return 1;
	if(py % 2 == 0) return powmod((px * px) % pmod, py / 2, pmod);
	else return (px * powmod(px, py - 1, pmod)) % pmod;
} 

int main() {
    // your code goes here
    ll n,k,dp[100005],ans=0;
    vc ps[100005];
    n=3;
    cin >> k;
    rep(i,1,k){
        for(ll j=2;i*j<=k;j++){
            ps[i].pb(i*j);
        }
    }
    dp[k]=1;
    repr(i,k-1,1){
        dp[i]=powmod(k/i,n,mod);
        reps(j,ps[i]) dp[i]=(dp[i]+mod-dp[ps[i][j]])%mod;
    }
    rep(i,1,k) ans=(ans+i*dp[i]%mod)%mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5956
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; 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(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#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 pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N,A,B;
  cin >> N >> A >> B;
  cout << min(N * A,B) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    char a[200]={0};
    while(cin>>a){
        string s;
        for(int i=0;i<strlen(a);i++){

            if(a[i]=='@'){
                for(int j=0;j<a[i+1]-'0';j++)s+=a[i+2];
                i+=2;
            }
            else s+=a[i];

        }
        cout<<s<<endl;

        memset(a,0,strlen(a));

}

	return 0;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

vector<int> g[111111];

int dfs(int nd=1){
  

 
  
  vector<int> w;
  for(int i=0;i<g[nd].size();i++){
    w.pb(dfs(g[nd][i]));
  }
  //cout<<endl;
  //dbg(nd); 
  sort(all(w));
  int n=w.size();
  int ma=0;
  for(int i=0;i<n;i++){
    //dbg(w[i]);
    ma=max(ma,(n-i)+w[i]);
  }

  return ma;
}

int main(){
  int n;
  cin>>n;
  for(int i=2;i<=n;i++){
    int a;
    cin>>a;
    g[a].pb(i);
  }

  cout<<dfs()<<endl;
  
  return 0;
}


Measured memory_bytes: 13824
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iostream>
#include<queue>
#include<stack>
#define Max 100002
using namespace std;

vector<int>vec;



int main(){

	
	int n,x,i,j,index;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&x);
		vec.push_back(x);
	}
	sort(vec.begin(),vec.end());
	int c = 0;
	for(i=0;i<n-2;i++){
		for(j=i+1;j<n-1;j++){
			auto it = lower_bound(vec.begin(),vec.end(),vec[i]+vec[j]);
			index = distance(vec.begin(),it);
			c += (index-(j+1));
			//printf("index: %d %d %d\n",j,index,(index-(j+1)));
		}
	}
	printf("%d\n",c);
	return 0;
}

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

int main(){
	
	int n;
	
	cin >> n;
	
	vector <int> a(n);
	vector <int> b;
	
	for (int i = 0; i < n; i++){
		cin >> a[i];
		b.push_back(a[i]);
	}
	
	sort(b.begin(), b.end(), greater<int>());
	
	int maxv1 = b[0];
	int maxv2 = b[1];
	
	
	for (int i = 0; i < n; i++){
		if (a[i] != maxv1){
			cout << maxv1 << endl;
		} else {
			cout << maxv2 << endl;
		}
	}
	
	
}

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int h, a;
    cin >> h >> a;
    cout << (h+a-1)/a << endl;
}

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

const int MAX = 1000001; 

struct Query 
{ 
	int l, r, idx; 
}; 

bool cmp(Query x, Query y) 
{ 
	return x.r < y.r; 
} 

void update(int idx, int val, int bit[], int n) 
{ 
	for (; idx <= n; idx += idx&-idx) 
		bit[idx] += val; 
} 


int query(int idx, int bit[], int n) 
{ 
	int sum = 0; 
	for (; idx>0; idx-=idx&-idx) 
		sum += bit[idx]; 
	return sum; 
} 

void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
	
	int bit[n+1]; 
	memset(bit, 0, sizeof(bit)); 

	
	int last_visit[MAX]; 
	memset(last_visit, -1, sizeof(last_visit)); 

	int ans[q]; 
	int query_counter = 0; 
	for (int i=0; i<n; i++) 
	{ 
		if (last_visit[arr[i]] !=-1) 
			update (last_visit[arr[i]] + 1, -1, bit, n); 

		last_visit[arr[i]] = i; 
		update(i + 1, 1, bit, n); 

		while (query_counter < q && queries[query_counter].r == i) 
		{ 
			ans[queries[query_counter].idx] = 
					query(queries[query_counter].r + 1, bit, n)- 
					query(queries[query_counter].l, bit, n); 
			query_counter++; 
		} 
	} 

	for (int i=0; i<q; i++) 
		cout << ans[i] << endl; 
} 

// driver code 
int main() 
{ 
    int n,q;
    cin>>n>>q;
	int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    } 
	Query queries[q]; 
	for(int i=0; i<q; i++)
    {
        queries[i].idx = i;
        cin>>queries[i].l>>queries[i].r;
        queries[i].l--;
        queries[i].r--;
    }
	sort(queries, queries+q, cmp); 
	answeringQueries(a, n, queries, q); 
	return 0; 
} 


Measured memory_bytes: 19372
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    ll ans = (ll)1e19;
    vector<P> p(n); rep (i, n) cin >> p[i].first >> p[i].second;
    rep (x1, n) {
        repp (x2, x1 + 1, n) {
            rep (y1, n) {
                repp (y2, y1 + 1, n) {
                    int h1 = p[x1].first, h2 = p[x2].first, w1 = p[y1].second, w2 = p[y2].second;
                    if (h1 > h2) swap(h1, h2); if (w1 > w2) swap(w1, w2);
                    int tmp = 0;
                    rep (i, n) {
                        if (h1 <= p[i].first && p[i].first <= h2
                         && w1 <= p[i].second && p[i].second <= w2) {
                            tmp++;
                        }
                    }
                    eprintf("%lld x:(%d,%d) y:(%d,%d)\n", (ll)(h2 - h1) * (w2 - w1), h1, h2, w1, w2);
                    if (tmp >= k) chmin(ans, (ll)(h2 - h1) * (w2 - w1));
                }
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ta = [[0] * N for _ in range(30)]
tb = [[0] * N for _ in range(30)]
mxl = max(max(a), max(b)).bit_length()
for i in range(mxl):
  x = 1 << i
  for j in range(N):
    ta[i][j] = int((a[j] & x) > 0)
    tb[i][j] = int((b[j] & x) > 0)

class KmpSearch:
  def __init__(self, word):
    self.word = word
    self.table = [0] * (len(word) + 1)
    self.table[0] = -1
    i, j = 0, 1
    while j < len(self.word):
      matched = self.word[i] == self.word[j]
      if not matched and i > 0:
        i = self.table[i]
      else:
        if matched:
          i += 1
        j += 1
        self.table[j] = i
  def search(self, text):
    table = self.table
    word = self.word
    i, p = 0, 0
    res = []
    while i < len(text):
      if text[i] == word[p]:
        i += 1
        p += 1
      elif p == 0:
        i += 1
      else:
        p = table[p]
      if p == len(word):
        res.append(i - p)
        p = table[p]
    return res
res = [0] * N
vis = [1 for _ in range(N)]
for i in range(mxl):
  kmp = KmpSearch(ta[i])
  s = [0] * (2 * N - 1)
  for j in range(2 * N - 1): s[j] = tb[i][j % N] ^ 1
  xs = set(kmp.search(s))
  tvis = [0] * N
  for j in range(N):
    tvis[j] |= (j in xs)
    res[j] += (j in xs) << i
  xs = set(kmp.search(tb[i] + tb[i][: -1]))
  for j in range(N):
    tvis[j] |= (j in xs)
  for j in range(N):
    vis[j] &= tvis[j]
#print(res, vis)
rres = []
for i in range(N):
  if vis[i]: rres.append(((N - i) % N, res[i]))
rres.sort(key = lambda x: (x[0], x[1]))
for r in rres: print(*r)

Measured memory_bytes: 263616
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    for (auto& x : a) {
        cin >> x;
    }
    int ans = *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end());
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop, heapify
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

graph = defaultdict(list)
for _ in range(M):
	a, b = MAP()
	graph[a-1].append(b-1)
	graph[b-1].append(a-1)

#print(graph)
#print(graph[0])

for x in graph[0]:
	for y in graph[x]:
		if y == N-1:
			print("POSSIBLE")
			break
	else:
		continue
	break
else:
	print("IMPOSSIBLE")




Measured memory_bytes: 58464
import sys
import os
import math
import bisect
import collections
import itertools

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    X = ii()
    A = collections.Counter(il())

    ret = 0
    for k, v in A.items():
        if k > v:
            ret += v
        if k < v:
            ret += abs(k-v)
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;
}

Measured memory_bytes: 768
<?php
$num = trim(fgets(STDIN));
$num = explode("\n", $num);

$score = 0;
$hit = 0;
$out = 0;

while ($line = fgets(STDIN)) {
  $line = explode("\n", $line);
  if ($line[0] == 'HIT') {
    $hit++;
    if ($hit > 3) {
      $hit = $hit - 1;
      $score += 1;
    }   
  } else if ($line[0] == 'OUT') {
    $out++;
    if ($out > 2) {
      $out = 0;
      printf($score . "\n");
      $score = 0;
      $hit = 0;
    }   
  } else if ($line[0] == 'HOMERUN') {                                                                                                                                                                                                            
    $score = $hit + 1 + $score;
    $hit = 0;
  }
}

Measured memory_bytes: 15416
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
#include <queue>

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define ft first
#define sd second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PII;
typedef queue<int> QI;

const LL mod=1000000007;
LL powmod(LL a,LL b) {LL res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

int n,w,d,p[23];

struct node{
    int x,y,l,r,to;
    bool ab=true;
    void read(){
        int x1,y1;char c;
        scanf("%d%d %c",&x1,&y1,&c);
        x=x1;y=y1;if(c=='N')to=1;else if(c=='E')to=2;else if(c=='S')to=3;else to=4;
    }
    void work(){
        if(to==1){
            int s=d-y,yo=w-x;
            if(x>s)l=x-s;
            else l=p[4]+y+x;
            if(yo>s)r=x+s;
            else r=p[2]+(s-yo);
        }else if(to==2){
            int s=d-y,yo=w-x;
            if(yo>s)l=x+s;
            else l=p[2]+(s-yo);
            if(yo>y)r=p[3]+yo-y;
            else r=p[2]+s+yo;
        }else if(to==3){
            int s=d-y,yo=w-x;
            if(yo>y)l=p[3]+yo-y;
            else l=p[2]+s+yo;
            if(x>y)r=p[3]+yo+y;
            else r=p[4]+y-x;
        }else{
            int s=d-y,yo=w-x;
            if(x>y)l=p[3]+yo+y;
            else l=p[4]+y-x;
            if(x>s)r=x-s;
            else r=p[4]+y+x;
        }
        if(r<l)r+=w+w+d+d;
    }
}a[2333];

bool cmp(node x,node y){
    if(x.l==y.l)return x.r<y.r;
    else return x.l<y.l;
}

int work(int x){
    int now=-1,re=0;
    rep(i,x,n){
      //  cout<<"!!!"<<i<<a[i].ab<<endl;
        if(a[i].ab){
            if(now>=a[i].l && now<=a[i].r)continue;
            else now=a[i].r,re++;
        }
    }
    rep(i,0,x){
      //  cout<<"!!!"<<i<<a[i].ab<<endl;
        if(a[i].ab){
            if(now>=(a[i].l+w+w+d+d)&&now<=(a[i].r+w+w+d+d))continue;
            else now=a[i].r+w+w+d+d,re++;
        }
    }
    return re;
}

int main(){
    scanf("%d%d%d",&n,&w,&d);p[1]=0;p[2]=w;p[3]=w+d;p[4]=w+d+w;
    rep(i,0,n){a[i].read();a[i].work();}
    sort(a,a+n,cmp);
    int ans=23333;
    rep(i,0,n){
        rep(j,0,n){
            if(i==j)continue;
            if(a[i].ab && a[j].ab){
                if(a[i].l<=a[j].l && a[i].r>=a[j].r)a[i].ab=false;
                if(a[i].l<=(a[j].l+w+w+d+d)&&a[i].r>=(a[j].r+w+w+d+d))a[i].ab=false;
            }
        }
    }
    rep(i,0,n){
        ans=min(ans,work(i));
    }
   /* rep(i,0,n){
        if(a[i].ab)cout<<a[i].l<<' '<<a[i].r<<endl;
    }*/
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3296
import math

a, b, h, m = [int(x) for x in input().split(' ')]

a1 = (2 * math.pi) * (h / 12) + (2 * math.pi) * (m / (60 * 12))
a2 = (2 * math.pi) * (m / 60)
diff = max(a1, a2) - min(a1, a2)
if diff > math.pi:
    diff = (2 * math.pi) - diff

ds = a * a + b * b - 2 * a * b * math.cos(diff)
print(math.sqrt(ds))


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

namespace ATCode_Buttons
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int max = 0;

            for (int i = 0; i < 2; ++i)
            {
                if (A <= B)
                {
                    max += B;
                    B = B - 1;
                }
                else
                {
                    max += A;
                    A = A - 1;
                }
            }
            Console.WriteLine(max);
            Console.Read();

        }
    }
}


Measured memory_bytes: 11092