akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

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

using namespace std;
using lint = long long;

unsigned euclid_gcd(unsigned a, unsigned b)
{
  if(a > b) return euclid_gcd(b, a);
  unsigned r;
  while(r = a % b){
    a = b;
    b = r;
  }
  return b;
}

int main(void)
{
    lint A, B;
    cin >> A >> B;
    lint gcd = euclid_gcd(A, B);
    cout << A * B / gcd << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <sstream>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,ta,tb,x=0,ans;
    cin >> n >> ta;
    ans=ta;
    for(int i=0;i<n;i++){
        cin >> tb;
        if(tb-x>ta){ans+=ta;}
        else if(tb-x<=ta){
            ans+= tb-x;
        }
        x=tb;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
char s[11],s1[11],s2[11];
int a,b;
inline bool check(char* s1,char* s2) {
	int len1=strlen(s1),len2=strlen(s2);
	if(len1!=len2) return false;
	for(res i=0;i<len1;++i) if(s1[i]!=s2[i]) return false;
	return true;
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>s1>>s2>>a>>b>>s;
	if(check(s1,s)) --a;else --b;
	cout<<a<<' '<<b<<'\n';
	cout<<flush;
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

    vector<int> a;
    for(int i = 0; i < n; i++){
        int tmp;
        cin >>tmp;
        a.push_back(tmp);
    }

    int broken = 0;
    int next = 1;
    for(int i = 0; i < n; i++){
        if(a[i] != next){
            broken++;
        }else{
            next++;
        }
    }

    if(broken == n){
        printf("-1\n");
    }else{
        printf("%d\n", broken);
    }

    return 0;
}

Measured memory_bytes: 1400
import numpy as np
s=int(input())

flag=0
threshold=np.array([600, 800, 1000, 1200, 1400, 1600, 1800])
Kyu=np.array([8,7,6,5,4,3,2,1])
for i in range(np.size(threshold)):
    if s< threshold[i]:
        print(Kyu[i])
        flag=1
        break
if flag==0:
    print(Kyu[-1])

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

using namespace std;

typedef long long ll;
const int maxn = (int) 1e5 + 1;

int a, b;
int main(){
    cin >> a >> b;
    if(a > b){
        swap(a, b);
    }
    b -= a;
    if(b % 2 == 0){
        cout << (b + a) - b / 2;
    }
    else {
        cout << "IMPOSSIBLE";
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
    int N;
    cin>>N;
    int hand=N/100;
    char h='0'+hand;
    int judge=100*hand+10*hand+hand;
    if(judge<N)
    {
        hand++;
        cout<<100*hand+10*hand+hand<<endl;

    }
    else if(judge>N)
    {
        cout<<judge<<endl;
    }
    else
    {
        cout<<N<<endl;
    }
    
    

}

Measured memory_bytes: 256
X = []
Y = []
Z = []
for i in range(5):
  x = int(input())
  y = x%10
  z = x//10 + 1
  X.append(x)
  Z.append(z)
  if y != 0:
    Y.append(y)
if len(Y)==0:
  print((sum(Z)-5)*10)
else:
  print((sum(Z)-(6-len(Y)))*10+min(Y))


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {

    int N, M; cin >> N >> M;
    vector<pair<int, int> > ab(M); 
    rep(i, M) cin >> ab[i].second >> ab[i].first;

    Sort(ab);

    int sum = 0, tmp = 0;

    rep (i, M) {

        if (ab[i].second <= tmp && tmp < ab[i].first) continue;

        tmp = ab[i].first - 1; sum++;
    }

    cout << sum << endl;
    return 0;

}

Measured memory_bytes: 1024
#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
using namespace std;

int main()
{
  int64_t N, ans = 0, rcnt = 0, minnum = 10e+7, a;
  cin >> N;

  for (int64_t i = 0; i < N; i++)
  {
    cin >> a;
    ans += abs(a);
    minnum = min(minnum, abs(a));
    if (a < 0)
    {
      rcnt++;
    }
  }

  if (rcnt % 2 != 0)
  {
    ans -= minnum * 2;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3156
A,B = map(int,input().split(' '))

def gcd(a,b):
	while b:
		a,b = b, a%b
	return a

def primeFactorization(n):
	res = {}
	m = int(n**0.5)
	for i in range(2,m+1):
		cnt = 0
		while n % i == 0:
			n = n//i
			cnt+=1
		if cnt > 0:
			res[i] = cnt
	if n > 1:
		res[n] = 1
	return res

N = gcd(A,B)
f = primeFactorization(N)

print(len(f)+1)


Measured memory_bytes: 3188
import sys
h,w = map(int, input().split())
f = [['*']*(w+2)]
for _ in range(h):
  f.append(['*'] + list(input()) + ['*'])
f.append(['*']*(w+2))

dirs = [(1,0), (-1,0), (0,1), (0,-1)]
for i in range(1, h+1):
  for j in range(1, w+1):
    if f[i][j]=='#':
      flag = True
      for d in dirs:
        x,y = i+d[0],j+d[1]
        if f[x][y]=='#':
          flag = False
          break
      if flag:
        print("No")
        sys.exit()
print("Yes")

Measured memory_bytes: 3064
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define sz size()
#define mk make_pair
#define clr clear()
#define B begin()
#define E end()
#define EM empty()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define all(cont) cont.begin(),cont.end()
#define pb push_back
string en="\n";
string t="hello";
#define sqr(a) ((a) * (a))
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef unsigned long long ULL;
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
    string a;
    while(cin>>a)
    {
        sort(all(a));
        bool f=0;
        for(i=0;i<a.sz-1;i++)
        {
             if(a.at(i)==a.at(i+1))
             {
                 f=1;
                 break;
             }
        }
        if(f) cout<<"no"<<en;
        else cout<<"yes"<<en;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int h, w;
	cin >> h >> w;
	
	vector<string> grid(h);
	for(int i = 0; i < h; ++i) {
		cin >> grid[i];
	}
	
	vector<int> dx = {0, 1}, dy = {1, 0};
	vector< vector<ll> > dp(h + 10, vector<ll>(w + 10, 0LL));
	dp[0][0] = 1;
	
	for(int i = 0; i < h; ++i) {
		for(int j = 0; j < w; ++j) {
			if( grid[i][j] == '#' ) continue;
			
			for(int k = 0; k < 2; ++k) {
				if( i + dx[k] < h && j + dy[k] < w ) {
					if( grid[i + dx[k]][j + dy[k]] == '.' ) {
						dp[i + dx[k]][j + dy[k]] += dp[i][j];
						dp[i + dx[k]][j + dy[k]] %= MOD_LL;
					}
				}
			}		
		}
	}
	
	cout << dp[h - 1][w - 1] << endl;
	
	return 0;
}


Measured memory_bytes: 13288
s = input()
t = input()

ss = len(s)
tt = len(t)

ans = 1000

for i in range(ss-tt+1):
    tmp = 0
    for j in range(tt):
        if s[i+j] == t[j]:
            tmp = tmp
        else:
            tmp = tmp + 1
    if tmp < ans:
        ans = tmp

print(ans)


Measured memory_bytes: 9108
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int main() {
  int n;
  string s;
  cin >> n >> s;
  int cnt = 0, ans = 0;
  rep(i, n) {
    if (s[i] == 'I') cnt++;
    else cnt--;
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}

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

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

  for(int i=0; i<N; i++){
    if(!(i%2))count++;
  }

  if(count>=K){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }

return 0;

}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

map<long long, int> factorization(long long N) {
	map<long long, int> re;
	while (true) {
		if (N % 2 == 0) {
			N /= 2;
			re[2]++;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	for (int loop = 3; (long long)loop * (long long)loop <= N; loop += 2) {
		if (N % loop == 0) {
			N /= loop;
			re[loop]++;
			loop -= 2;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	return re;
}

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination1 {
private:
	int m_module = 1000000007;
	vector<struct Memo> memo;
public:
	int calculate(int, int);
	Combination1(int, int);
};
int Combination1::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination1::Combination1(int memo_max, int module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

class Combination2 {
private:
	int size = 0;
	bool add(int);
public:
	vector<int> sequence;
	bool next_combination(void);
	Combination2(int, int);
};
bool Combination2::add(int index) {
	if (index == (int)sequence.size() - 1 && sequence[index] == size - 1
		|| index < (int)sequence.size() - 1 && sequence[index] == sequence[index + 1] - 1) {
		if (index == 0) {
			return false;
		}
		else {
			bool re = add(index - 1);
			sequence[index] = sequence[index - 1] + 1;
			return re;
		}
	}
	else {
		sequence[index]++;
		return true;
	}
}
bool Combination2::next_combination(void) {
	return (sequence.size() == 0) ? false : add(sequence.size() - 1);
}
Combination2::Combination2(int n, int r) {
	size = n;
	for (int loop = 0; loop < r; loop++) sequence.push_back(loop);
	return;
}

void A_Coffee(void) {
	string S; cin >> S;
	cout << ((S[2] == S[3] && S[4] == S[5]) ? "Yes" : "No");
	return;
}

void B_Golden_Coins(void) {
	int X; cin >> X;
	int happy = 0;
	happy = int(X / 500) * 1000 + int((X - int(X / 500) * 500) / 5) * 5;
	cout << happy << flush;
	return;
}

int main(void) {

	//A_Coffee();
	B_Golden_Coins();
	return 0;
}


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

using namespace std;

int main() {
    string s; cin >> s;
    int num=0;

    for (int i = 0; i < 3; i++) {
        if (s[i] == s[i + 1]) num++;
    }

    if (num >= 1) {
        cout << "Bad" << endl;
    }
    else {
        cout << "Good" << endl;
    }

    return 0;
} 


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
inline bool chmin(T &a, const T b) { return a > b && (a = b, true); }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int H, N;
	cin >> H >> N;

	vector<int> A(N), B(N);
	for (int i = 0; i < N; i++) cin >> A[i] >> B[i];

	vector<int> dp(H + 1, INF);
	dp[0] = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < N; j++) {
			chmin(dp[min(i + A[j], H)], dp[i] + B[j]);
		}
	}

	cout << dp[H] << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<char> word(N);
  vector<int> wtotal(N);
  vector<int> count(N);
  for (int i = 0; i < N; i++) {
    cin >> word.at(i);
  }
  int total = 0;
  for (int i = 0; i < N; i++) {
    if (word.at(i) == 'W') {
      total++;
    }
    wtotal.at(i) = total;
  }
  for (int i = 1; i < N; i++) {
    count.at(i) += wtotal.at(i - 1);
    count.at(i) += (N - 1 - i) - (wtotal.at(N - 1) - wtotal.at(i));
  }
  count.at(0) = (N - 1) - (wtotal.at(N - 1) - wtotal.at(0));
  sort(count.begin(), count.end());
  cout << count.at(0) <<endl;
  return 0;
}

Measured memory_bytes: 5892
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
#define SET(a,c) memset(a,c,sizeof(a))

#define DEBUG(x) cout<< #x <<": "<<x<<endl

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll INF = INT_MAX/3;
const ll MOD = 1000000007;
const double EPS = 1e-14;
const int dx[] = {1,0,-1,0} , dy[] = {0,1,0,-1};


int main(){
    string s;
    ll K;
    cin >> s;
    cin >> K;
    REP(i,s.size()){
        int d = 26 - (s[i]-'a');
        if( d < 26 && K >= d ){
            s[i] = 'a';
            K -= d;
        }
    }
    if( K > 0){
        K = K%26;
        s[s.size()-1] = 'a' + (s[s.size()-1] - 'a' + K)%26;
    }
    cout << s << endl;

    return 0;
}




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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



i64 n;
void solve(){
	cin >> n;
	
	string s;
	int i = 0;
	while(n){
		if(n>>i&1){
			s = '1'+s;
			n += (1LL<<i)*(-1+2*(i&1));
		}
		else{
			s = '0'+s;
		}
		i++;
	}
	if(s.size()==0) cout << 0 << endl;
	else cout << s << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(a) (a).begin(), (a).end()

using namespace std;

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

    vector<int> A(N);

    REP(i, N)
    {
        cin >> A[i];
    }

    sort(ALL(A), greater<>());

    vector<int> arr;

    int prev_key = -1;
    int prev_n = 0;
    REP(i, N)
    {
        if( prev_key == A[i] )
        {
            prev_n++;
        }
        else
        {
            if( prev_n >= 4 )
            {
                arr.push_back(prev_key);
                arr.push_back(prev_key);
            }
            else if( prev_n >= 2 )
            {
                arr.push_back(prev_key);
            }

            prev_n = 1;
            prev_key = A[i];
        }
    }
    if( prev_n >= 4 )
    {
        arr.push_back(prev_key);
        arr.push_back(prev_key);
    }
    else if( prev_n >= 2 )
    {
        arr.push_back(prev_key);
    }

    if( arr.size() < 2 )
    {
        cout << 0 << endl;
    }
    else
    {
        cout << ((unsigned long) arr[0]) * arr[1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {

	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int q = sc.nextInt();
			if((n|q) == 0) break;
			int [] freq = new int[101];
			for(int i = 0; i < n; i++){
				int k = sc.nextInt();
				for(int j = 0; j < k; j++){
					freq[sc.nextInt()]++;
				}
			}
			int max = q-1, ind = 0;
			for(int i = 0; i < 101; i++){
				if(max < freq[i]){
					max = freq[i];
					ind = i;
				}
			}
			System.out.println(ind);
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 62664
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
    string s, t; cin >> s >> t;
    for(char a = 'a'; a <= 'z'; a++){
        string k = s;
        k += a;
        if(k == t){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    system("pause");
}


Measured memory_bytes: 3628
/*input
5
abaaaaaaaa
oneplustwo
aaaaaaaaba
twoplusone
aaaabaaaaa
*/
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

signed main() {
	IOS;
	int n;
	cin>>n;
	map<string,int> mp;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		sort(s.begin(), s.end());
		mp[s]++;
	}
	int ans = 0 ;
	for(auto x : mp){
		ans +=( x.s * (x.s - 1))>> 1;
	}
	cout << ans ;
return 0;
}


Measured memory_bytes: 11264
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0
inf = float("inf")

a, b = I()
print(a-b+1)


Measured memory_bytes: 10196
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[100005][2];
int x[100005];
int main(){
	int N,A,B;
	scanf("%d%d%d%d",&N,&A,&B,x+1);
	dp[1][0]=dp[1][1]=0;
	for(int i=2;i<=N;i++){
		scanf("%d",x+i);
		dp[i][0]=min(dp[i-1][0],dp[i-1][1])+(ll)(x[i]-x[i-1])*A;
		dp[i][1]=min(dp[i-1][0],dp[i-1][1])+B;
	}
	printf("%lld\n",min(dp[N][0],dp[N][1]));
	return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack> 
#include <bitset>
#include <queue>
#include <assert.h>
using namespace std;

const int N = 310;
const int mod = 998244353;
int dp[N][N][N];
char s[N];
vector<int> v;

/*
 * dp[i][j]
 *
 */

void add(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;
}

int main()
{
	int m;
	scanf("%s%d", s + 1, &m);
	int n = strlen(s + 1);
	int cnt = 0;
	s[0] = '0';
	for (int i = n; i >= 0; i--) {
		if (s[i] == '0') {
			v.push_back(cnt);
			cnt = 0;
		} else {
			cnt++;
		}
	}
	if (v.size() == 1) {
		cout << 1 << endl;
		return 0;
	}

	m = min(m, n);
	for (int j = 0; j <= v[0]; j++)
		dp[0][j][j] = 1;

	for (int i = 0; i + 1 < v.size(); i++) {
		for (int j = 0; j <= m; j++) {
			for (int k = 0; k <= n; k++) {
				if (dp[i][j][k] == 0) continue;
				int valid = v[i + 1];
				for (int r = 1; r <= valid; r++)
					add(dp[i + 1][j + r][k + r], dp[i][j][k]);
				for (int r = 0; r <= k; r++)
					add(dp[i + 1][j][r], dp[i][j][k]);
			}
		}
	}

    int ans = 0;
	for (int i = 0; i <= m; i++)
		add(ans, dp[v.size() - 1][i][0]);

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


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

char s[3010], t[3010], c[3010][3010], ans[3010];
int dp[3010][3010];
pair<int,int> from[3010][3010];
int main() {
        scanf("%s%s", s, t);
        int n = strlen(s), m = strlen(t);
        for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                        from[i][j] = {-1, -1};
                        c[i][j] = dp[i][j] = 0;
                        if (dp[i - 1][j] > dp[i][j]) from[i][j] = {i - 1, j}, dp[i][j] = dp[i - 1][j];
                        if (dp[i][j - 1] > dp[i][j]) from[i][j] = {i, j - 1}, dp[i][j] = dp[i][j - 1];
                        if ((s[i] == t[j]) && dp[i - 1][j - 1] + 1 > dp[i][j]) {
                                from[i][j] = {i - 1, j - 1};
                                c[i][j] = s[i];
                                dp[i][j] = dp[i - 1][j - 1] + 1;
                        }
                }
        }


        int i = n - 1, j = m - 1, k = 0;
        while (dp[n - 1][m - 1]) {
                if (c[i][j] ^ 0) ans[k++] = c[i][j], dp[n - 1][m - 1]--;
                auto w = from[i][j];
                i = w.first, j = w.second;
        }

        reverse(ans, ans + strlen(ans));
        printf("%s", ans);
}

Measured memory_bytes: 118400
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a := nextFloat(sc)
	b := nextFloat(sc)

	x := int64(a) / int64(b)
	y := int64(a) % int64(b)
	z := a / b
	fmt.Printf("%d %d %f\n", x, y, z)
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextFloat(sc *bufio.Scanner) float64 {
	f, err := strconv.ParseFloat(nextString(sc), 64)
	if err != nil {
		panic(err)
	}
	return f
}



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

int main() {
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  int count = 0;
  for(int i=0; i <= A; i++) {
    for(int j=0; j <= B; j++) {
      for(int k=0; k <= C; k++){
        int total = 500*i + 100*j + 50*k;
        if(total == X){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include <complex>
#include <cmath>
#include<cstdio>
using namespace std;
typedef complex<double> xy_t;

xy_t P[110];
double cross_product(xy_t a, xy_t b) { 
    return (conj(a)*b).imag(); 
}

int main() {
// 入力例 読み込んだ点の個数を N とする
    int n;
    cin >> n;
    //int N=0;
    double x, y;
    //while (scanf("%lf,%lf", &x, &y)!=EOF) {
    //   P[N++] = xy_t(x,y);
    //}
   for(int i=0; i<n; i++){
        scanf("%lf %lf", &x, &y);
        P[i] = xy_t(x,y);
    }
// 面積計算
    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 +=  cross_product(b-a,c-a)/2;// 三角形 abc の面積を加算
    }
    printf("%.1f\n", abs(sum));
}


Measured memory_bytes: 3212
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

int w, h;
bool vw, vb;
vector<string> board;
bool visited[60][60];

bool inBoard(int x, int y) {
    return x >= 0 && x < w && y >= 0 && y < h;
}

void dfs(int x, int y) {
    visited[y][x] = true;
    rep(dir, 4) {
	int nx = x + dx[dir];
	int ny = y + dy[dir];
	if (visited[ny][nx]) continue;
	if (!inBoard(nx, ny)) continue;
	if (board[ny][nx] == 'W') vw = true;
	else if (board[ny][nx] == 'B') vb = true;
	else dfs(nx, ny);
    }
}

signed main() {
    while (cin >> w >> h) {
	if (!w) break;

	board.clear();
	inputVector(board, h);

	vector<string> which = board;
	rep(y, h) {
	    rep(x, w) {
		if (which[y][x] != '.') continue;
		memset(visited, false, sizeof(visited));
		vw = false; vb = false;
		dfs(x, y);
		rep(ty, h) {
		    rep(tx, w) {
			if (!visited[ty][tx]) continue;
			if (vw && !vb) which[ty][tx] = 'w';
			else if (!vw && vb) which[ty][tx] = 'b';
			else which[ty][tx] = ' ';
		    }
		}
	    }
	}

	int retb = 0, retw = 0;
	rep(y, h) {
	    rep(x, w) {
		if (which[y][x] == 'b') retb++;
		else if (which[y][x] == 'w') retw++;
	    }
	}
	cout << retb << ' ' << retw << endl;
    }

    return 0;
}

Measured memory_bytes: 3320
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;

class Dice {
private:
	int surface[6];
	void next(int a, int b, int c, int d);
	

public:
	Dice(int surface[6]);
	Dice();
	void role(char dir);// W E N S
	void rot(char dir); //L or R
	void set(int pos, int num);
	int get(int pos);
	void settop(int prevpos);
	bool operator ==(Dice so);
	bool operator !=(Dice so);
};

int main(void) {
	Dice dice[100], dicebuf;
	int n;
	scanf("%d", &n);
	for (int m = 0; n > m; m++) {
		for (int i = 0; 6 > i; i++) {
			int buf;
			scanf("%d", &buf);
			dice[m].set(i, buf);
		}
		for (int k = 0; m > k; k++) {
			for (int i = 0; 6 > i; i++) {
				dicebuf = dice[m];
				dicebuf.settop(i);
				for (int j = 0; 4 > j; j++) {
					dicebuf.rot('R');
					if (dicebuf == dice[k]) {
						printf("No\n");
						return 0;
					}
				}
			}
		}
	}
	printf("Yes\n");
	return 0;
}

void Dice::next(int a, int b, int c, int d)
{
	swap(surface[c], surface[d]);
	swap(surface[b], surface[c]);
	swap(surface[a], surface[b]);
}

Dice::Dice(int surface[6])
{
	for (int i = 0; 6 > i; i++)
		Dice::surface[i] = surface[i];
}

Dice::Dice()
{
	for (int i = 0; 6 > i; i++) surface[i] = 0;
}

void Dice::role(char dir)
{
	switch (dir) {
	case 'W': next(0,3,5,2);  break;
	case 'E': next(0,2,5,3);  break;
	case 'N': next(0,4,5,1);  break;
	case 'S': next(0,1,5,4);  break;
	}
}

void Dice::rot(char dir)
{
	switch (dir) {
	case 'L': next(1, 3, 4, 2); break;
	case 'R': next(1, 2, 4, 3); break;
	}
}

void Dice::set(int pos, int num)
{
	surface[pos] = num;
}

int Dice::get(int pos)
{
	return surface[pos];
}

void Dice::settop(int prevpos) //?????????????????????
{
	switch (prevpos) {
	case 0:  break;
	case 1: role('N'); break;
	case 2: role('W'); break;
	case 3: role('E'); break;
	case 4: role('S'); break;
	case 5: role('N'); role('N'); break;
	}
}

bool Dice::operator ==(Dice so)
{
	for (int i = 0; 6 > i; i++) if(this->get(i) != so.get(i))
		return false;
	return true;
}

bool Dice::operator !=(Dice so)
{
	for (int i = 0; 6 > i; i++) if (surface[i] != so.get(i))
		return true;
	return false;
}

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

bool edge[700][700];
bool ok[701][351];
int col[700];

int main(){
    int n, m;
    cin >> n >> m;
    for(int i=0;i<m;++i){
        int a, b;
        cin >> a >> b;
        edge[a-1][b-1] = true;
        edge[b-1][a-1] = true;
    }

    vector<pair<int,int>> cnt;
    for(int i=0;i<n;++i){
        if(col[i] != 0) continue;
        queue<int> q;
        q.push(i);
        cnt.emplace_back(1, 0);
        col[i] = 1;
        while(!q.empty()){
            int t = q.front();
            q.pop();
            for(int j=0;j<n;++j){
                if(t == j || edge[t][j]) continue;
                if(col[j] == 0){
                    col[j] = -col[t];
                    q.push(j);
                    (col[j]>0 ? cnt.back().first : cnt.back().second) += 1;
                }else{
                    if(col[t] == col[j]){
                        cout << -1 << endl;
                        return 0;
                    }
                }
            }
        }
    }

    ok[0][0] = true;
    for(int i=0;i<cnt.size();++i){
        for(int j=0;j<=n/2;++j){
            if(ok[i][j]){
                if(j + cnt[i].first <= n/2) ok[i+1][j + cnt[i].first] = true;
                if(j + cnt[i].second <= n/2) ok[i+1][j + cnt[i].second] = true;
            }
        }
    }

    for(int i=n/2;i>=0;--i){
        if(ok[cnt.size()][i]){
            int j = n-i;
            cout << i*(i-1)/2 + j*(j-1)/2 << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std; // 575

const int MAX = 100000;
const int INF = 1073741823; // 10^30-1、使わない辺とかに用いる
int main() {
	static int N, K, h[MAX];
	cin >> N >> K;
	for (int i = 0;i < N;++ i) cin >> h[i];
	static int dp[MAX];
	dp[0] = 0;
	for (int i = 1;i < N;++ i) dp[i] = INF;
	for (int i = 1;i < N;++ i) for (int j = max(0, i - K);j < i;++ j) dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
	cout << dp[N - 1];
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

さっきと同じDPだね、計算量はO(NK)
*/

Measured memory_bytes: 1024
s=input()
if int(s[2:])!=0 and int(s[2:])<=12:
  if int(s[:2])!=0 and int(s[:2])<=12:
    print('AMBIGUOUS')
  else:
    print('YYMM')
else:
  if int(s[:2])!=0 and int(s[:2])<=12:
    print('MMYY')
  else:
    print('NA')


Measured memory_bytes: 2940
S = input()

ans = 0
power = 0
for s in S:
    if power == 0:
        if s == 'g':
            power += 1
        else:
            power += 1
            ans -= 1
        continue
    if s == 'g':
        ans += 1
        power -= 1
    else:
        power -= 1
print(ans)


Measured memory_bytes: 39664
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	s := make([]string, n)
	for i := range s {
		fmt.Scan(&s[i])
	}
	sort.Strings(s)

	count := n
	for i := range s {
		if i != n-1 {
			if s[i] == s[i+1] {
				count--
			}
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 12064
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <string>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main() {
    int a;
    int b;
    int ans=-1;
    cin >> a >> b;
    double tmp;
    double tmp_int8;
    double tmp_int10;
    for(int i=10; i<2000; i++){
        tmp=(double)i*0.08;
        tmp_int8=(int)tmp;
        tmp=(double)i*0.1;
        tmp_int10=(int)tmp;
        //cout << i << " " << tmp_int8 << " " << tmp_int10 << endl;
        if(tmp_int8==a && tmp_int10==b){
            ans=i;
            break;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  const arr = lines.shift().split(' ').map(Number);
  buildMaxHeap(arr);
  console.log(arr.reduce((s, e) => s += ' ' + e, ''));
})();

function buildMaxHeap(arr) {
  const n = arr.length;
  let left, right, largest;
  const maxHeapify = (i) => {
    left = 2 * i + 1;
    right = 2 * i + 2;
    if (left < n && arr[left] > arr[i]) largest = left;
    else largest = i;
    if (right < n && arr[right] > arr[largest]) largest = right;
    if (largest != i) {
      arr[largest] = [arr[i], arr[i] = arr[largest]][0];
      maxHeapify(largest);
    }
  };

  for (let i = Math.floor(arr.length / 2); i >= 0; i--) maxHeapify(i);
}



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

def readInts():
  return [int(s) for s in input().split(" ")]

def main():
  A, B = readInts()
  ans = 0
  if A >= B:
    ans += A
    A -= 1
  else:
    ans += B
    B -= 1

  ans += max(A, B)
  print(ans)

if __name__ == "__main__":
  main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }


int n;
string s;

int main()
{
	cin >> n >> s;
	int cnt = 0;
	for(int i = 0; i < n-2; i++)
	{
		if(s[i] == 'A') 
		{
			if(s[i+1] == 'B' && s[i+2] == 'C') cnt++;
		}
	}	
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n,m,q;
	cin>>n>>m>>q;
	vector<ll> a(q),b(q),c(q),d(q);
	rep(i,q){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		a[i]--,b[i]--;
	}
	ll ans=0;
	auto dfs=[&](auto &dfs,vector<ll> now,ll num)->void{
		if(now.size()==n){
			ll cur=0;
			rep(i,q){
				if(now[b[i]]-now[a[i]]==c[i]){
					cur+=d[i];
				}
			}
			chmax(ans,cur);
			return ;
		}
		FOR(i,num,m+1){
			vector<ll> ne(now);
			ne.push_back(i);
			dfs(dfs,ne,i);
		}
	};
	vector<ll> now;
	dfs(dfs,now,1);
	cout<<ans<<endl;
}

Measured memory_bytes: 3660
#include <stdio.h>
#include <stdlib.h>
int main(void){
    
    int x,y;
    char line[100];
    //fgets(line,sizeof(line),stdin);
    scanf("%d",&x);
    //fgets(line,sizeof(line),stdin);
    scanf("%d",&y);
    
  	if( x-y  == 0){
    	printf("%d",x+y);  
    }else{
      if(x>=y){
        printf("%d",(x*2)-1);
      }else{
        printf("%d",(y*2)-1);
      }
    }   
    return 0;
}

Measured memory_bytes: 128
def main():
    n = int(input())
    a = [int(s) for s in input().split()]
    print(solve(a))

def solve(a):
    cands = []
    s = set()
    for i in a:
        if i in s:
            cands.append(i)
            s.remove(i)
        else:
            s.add(i)
    
    x = sorted(cands, reverse=True)
    if len(x) < 2:
        return 0
    
    return x[0] * x[1]

main()


Measured memory_bytes: 14252
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) //[l, r)
#define rep(i,n) REP(i,0,n)           //[0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showslr(n,l,r) cerr<<#n<<" = ";REP(i,l,r){cerr<<n[i]<<", ";}cerr<<endl //[l, r)

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}

void _DEBUG(){cerr<<endl;}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<",";_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<endl;out(b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

vi vec(3);

signed main(){
    io();

    rep(i,3) in(vec[i]);
    sort(rall(vec));
    out(vec[0]*10+vec[1]+vec[2]);

    return 0;
}


Measured memory_bytes: 888
#include<stdio.h>
int main()
{
    int a,b,c,d,sum;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    sum=a>=b?b:a;
    if(c>=d)
        sum=sum+d;
    else
        sum=sum+c;
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
 
int main(){
    int a, b, c;
    if(scanf("%d %d %d", &a, &b, &c) < 1) {
        fprintf(stderr, "error: ill-formed fraction.\n");
        exit(1);
    }
    int kind = 3;
    if(a == b){
        kind--;
    }
    if(b == c){
        kind--;
    }
    if(a == c){
        kind--;
    }
    if(a == b && b == c && a == c){
        kind++;
    }
    printf("%d", kind);
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e5+5;
int n,i,he[N],lt[N],f[N];
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
int dn,d[N];
void dfs(int x){
	for (int y=he[x];y;y=lt[y]) dfs(y);
	dn=0;
	for (int y=he[x];y;y=lt[y]) d[++dn]=f[y];
	sort(d+1,d+dn+1);
	for (int i=1;i<=dn;i++) f[x]=max(f[x],d[i])+1;
}
int main(){
	for (n=read(),i=2;i<=n;i++){
		int x=read();lt[i]=he[x];he[x]=i;
	}
	dfs(1);
	printf("%d",f[1]);
}

Measured memory_bytes: 4480
import sys
sys.setrecursionlimit(10**6)
def get_articulation_points(G, N, start=0):
    v_min = [0]*N; order = [None]*N
    result = []; count = 0
    def dfs(v, prev):
        nonlocal count
        r_min = order[v] = count
        fcnt = 0; p_art = 0
        count += 1
        for w in G[v]:
            if w == prev:
                continue
            if order[w] is None:
                ret = dfs(w, v)
                p_art |= (order[v] <= ret)
                r_min = min(r_min, ret)
                fcnt += 1
            else:
                r_min = min(r_min, order[w])
        p_art |= (r_min == order[v] and len(G[v]) > 1)
        if (prev == -1 and fcnt > 1) or (prev != -1 and p_art):
            result.append(v)
        return r_min
    dfs(start, -1)
    return result

n, m = map(int, input().split())
G = [[] for i in range(n)]
for i in range(m):
    s, t = map(int, input().split())
    G[s].append(t)
    G[t].append(s)
*_,=map(print,sorted(get_articulation_points(G, n)))

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))
template<typename T> inline bool __max__(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool __min__(T &x, const T &y) { return x > y ? x = y, 1 : 0; }

#define pb push_back
#define mp make_pair

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;


int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;

    cin >> n;

    ll a[n];
    bool isEven = true;
    ll ans = 0;

    int i;

    for (i = 0; i < n; i++) {
        cin >> a[i];

        if (a[i] % 2LL != 0LL) isEven = false;
    }

    while (isEven) {
        for (i = 0; i < n; i++) {
            a[i] /= 2LL;

            if (a[i] % 2LL != 0LL) isEven = false;
        }

        ans++;
    }

    cout << ans << '\n';

    return 0;
}


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

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

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

  int sn = s.size(), tn = t.size();

  int ans=10000;
  rep(i,sn-tn+1){
    int change=0;
    rep(j,tn){
      if(s.at(i+j)!=t.at(j)) change++;
    }
    ans = min(ans, change);
  }

  cout << ans;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

int main() {
	int n, x, t;
	scanf("%d %d %d", &n, &x, &t);
	printf("%d\n", t * ((n / x) + (n % x == 0 ? 0 : 1)));
	return 0;
}
//ios_base::sync_with_stdio(false);
//cin.tie(0);
//tod-ngen


Measured memory_bytes: 3812
import java.util.*;
import static java.lang.System.*;
import java.io.*;
import java.math.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        int[][] scr = new int[2][n];
        int[][] dp = new int[2][n];
        for(int i = 0; i < 2; i++) {
        	for(int j = 0; j < n; j++) {
        		scr[i][j] = sc.nextInt();
        	}
        }
        
        dp[0][0] = scr[0][0];
        dp[1][0] = dp[0][0] + scr[1][0];
        for(int i = 1; i <n; i++) {
        	dp[0][i] = dp[0][i -1] + scr[0][i];
        }
        for(int i = 1; i < n; i++) {
        	int max = Math.max(dp[0][i], dp[1][i - 1]);
        	dp[1][i] = max + scr[1][i];
        }
        out.println(dp[1][n - 1]);
        
        out.close();
}

static 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());}
}
}


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

public class Main{
	public static void main(String[] args) throws IOException{
		Scanner stdIn = null;
		List<Integer> result = new ArrayList<Integer>();
		
		try{
			stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
			while( stdIn.hasNext() ){
				int n = stdIn.nextInt();
				result.add(n*(n+1)/2+1);
			}
			for(Integer sum : result){
				System.out.println(sum);
			}
		} finally {
			if( stdIn != null ){
				stdIn.close();
			}
		}
	}
}

Measured memory_bytes: 12000
n,k = map(int,input().split())
def sum_wa(a):
  seki = 1/2 * a * (a+1)
  return int(seki)

def return_wa(n,a):
  g = 1/2 * n * (n+1)
  a = 1/2 * a * (a-1)
  return int(g -a)
  
    
z = 10**9 + 7    
ans = 0    

for i in range(k,n+2):
      seki = return_wa(n,n+1-i)  - sum_wa(i-1) + 1
      seki = seki % z 
      ans += seki
      
print(ans%z)

Measured memory_bytes: 9188
# coding: utf-8
'''
#a, b = input().split() #(int(i) for i in input.split())
a, b = map(int, input().split())
print(a,b)
c1 = abs(a-b)//2;
c2 = abs(b-a)/2;
if c1==c2:
  	print(str(abs(c1)))

else:         
	print('IMPOSSIBLE')
'''
    
# coding: utf-8
a, b = map(int, input().split())
if abs(b - a) // 2 == abs(b - a) / 2:
    print(abs(max(a, b) - abs(b - a) // 2))
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 2940