akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int total = 0;
        
        int[] T = new int[N];
        
        for(int i=0;i<N;i++) {
			T[i] = sc.nextInt();
			total += T[i];
		}
		int m = sc.nextInt();
        
        for(int i=0;i<m;i++) {
			int P = sc.nextInt();
			int X = sc.nextInt();
			System.out.println(total-(T[P-1]-X));
		}
	}
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n, w; cin >> n >> w;
    vector<pair<ll, ll>> wv(n+1);
    repf(i, n) cin >> wv[i].first >> wv[i].second;
    vector<vector<ll>> dp(n+1, vector<ll>(w+1, 0));

    for(ll i=1; i<=n; i++){
        for(ll j=0; j<=w; j++){
            // i番目の品物まで候補に考えたとき、重さjまで許容した場合の最大価値
            if(wv[i].first <= j) dp[i][j] = max(dp[i-1][j], dp[i-1][j-wv[i].first]+wv[i].second);
            else dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[n][w] << endl;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>	
#define int long long int
#define pb push_back
#define endl "\n"
#define F first
#define S second 
#define mod 1000000007     
using namespace std;
const int N = 21;
int dp[(1 << N) + 5];
main()
{	
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n;
	cin >> n;
	int arr[n][n];
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
			cin >> arr[i - 1][j - 1];
	for(int i = 0; i < n; i++){
		if(arr[0][i])
			dp[(1 << i)] = 1;
	}
	for(int mask = 0; mask < (1 << n) - 1; mask++){
		for(int j = 0; j < n; j++){
			if(mask & (1 << j))
				continue;
			int on = __builtin_popcount(mask);
			int new_mask = (1 << j) | mask;
			if(arr[on][j])
				dp[new_mask] += dp[mask];
				dp[new_mask] %= mod;

		}
	}
	cout << dp[(1 << n) - 1];
}

Measured memory_bytes: 16640
#include<iostream>
#include<algorithm>

using namespace std;

#define INF 100000000

int s, e, r, m;

int dijk(int d[][101]) {
  int mi, i, j;
  int c[m + 1] = {};
    
  for(i = 0; i <= m; i++) {
    c[i] = INF;
  }
    
  int f[m + 1] = {};
  mi = s;
  c[s] = 0;

  for(i = 0; i < m; i++){
    f[mi] = 1;

    for(j = 0; j <= m; j++) {
      if(f[j] == 1) continue;
      if(c[j] > d[mi][j] + c[mi]) {
	c[j] = d[mi][j] + c[mi];
      }
    }

    int MIN = INF * 2;

    for(j = 0; j <= m; j++) {
      if(f[j] == 1) continue;
      if(MIN > c[j]) {
	MIN = c[j];
	mi = j;
      }
    }
  }
  if(c[e] == INF) return -1;
  return c[e];
}

  
int main() {
  int i, j, r, k, a,b, cost;
  while(cin >> m >> k, k != 0 || m != 0) {
    int d[101][101] = {};
    
    for(i = 0; i <= m; i++) {
      for(j = 0;j <= m; j++) {
	d[i][j]  = INF;
      }
    }
    
    for(i = 0; i < k; i++) {
      cin >> r;
      if(r == 1) {
	cin >> a >> b >> cost;
	d[a][b] = d[b][a] = min(cost, d[a][b]);
     }
      else {
	cin >> s >> e;
	cout << dijk(d) << endl;
      }
    }
    
  }
  return 0;
}

Measured memory_bytes: 3032
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

flag = 'No'
for i in range(N-M+1):
    for j in range(N-M+1):
        check = []
        for k in range(M):
            if A[i+k][j:j+M] == B[k]:
                check.append(1)
            else:
                check.append(-1)
        if sum(check) == M:
            flag = 'Yes'
print(flag)			


Measured memory_bytes: 3060
package main

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

const Mod = 1e9 + 7

func main() {
	N := ReadInt()
	m := make(map[int]int)
	for i := 2; i <= N; i++ {
		factors := Factorization(i)
		for _, factor := range factors {
			f, cnt := factor[0], factor[1]
			m[f] += cnt
		}
	}
	ans := 1
	for _, cnt := range m {
		ans = ans * (cnt + 1) % Mod
	}
	fmt.Println(ans)
}

func Factorization(n int) [][]int {
	res := [][]int{}
	for i := 2; i*i <= n; i++ {
		if n%i != 0 {
			continue
		}
		cnt := 0
		for n%i == 0 {
			n /= i
			cnt++
		}
		res = append(res, []int{i, cnt})
	}
	if n != 1 {
		res = append(res, []int{n, 1})
	}
	return res
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }


Measured memory_bytes: 1980
#include <string>
#include <set>
#include <iostream>

int main() {
    std::string s;
    std::set<char> seen;
    bool repeated = false;

    std::cin >> s;
    for (char c : s) {
        if (seen.find(c) == seen.end())
            seen.insert(c);
        else {
            repeated = true;
            break;
        }
    }

    std::cout << (repeated ? "no" : "yes") << std::endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    String S = s.next();
    String T = s.next();
    System.out.println(changesRequired(S, T));
    s.close();
  }

  private static Integer changesRequired(String S, String T) {
    int answer = T.length();
    for (int i = 0; i <= S.length() - T.length(); i++) {
      int changesRequired = 0;
      for (int j = 0; j < T.length(); j++) {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      }
      answer = Math.min(answer, changesRequired);
    }
    return answer;
  }
}


Measured memory_bytes: 35684
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define rep(i, n) for(int i = 0;i < n;i++)
#define reprb(i, n) for(int i = n;i >= 0;i--)
#define reps(i, m, n) for(int i = m;i < n;i++)
#define repsb(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
vector<int> a;
vector<int> b;

int main(int argc,char const *argv[]) {
	int n,s,mx=0,mi=0,total=0;
	while(true)
	{
		total=0,mx=0,mi=100000;
		cin>>n;

		if(n==0)	break;
		rep(i,n){
			cin>>s;
			total+=s;
			mx=max(s,mx);
			mi=min(s,mi);
		}
		total=total-mi-mx;
		total=total/(n-2);
		a.pb(total);
	}
	rep(i,a.size()){
		cout<<a[i]<<endl;
	}
	return 0;
}



Measured memory_bytes: 3120
#include<bits/stdc++.h>
#define rep(i,a,n) for(ll i=a;i<n;i++)
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin>>n;
  char c[n];
  rep(i,0,n)cin>>c[i];
  ll i=0;
  ll j=n-1;
  ll ans=0;
  while(i<=j){
    if(c[i]=='W'){
      while(i<=j){
        if(c[j]=='R'){
          swap(c[i],c[j]);
          ans++;
          break;
        }
        j--;
      }
    }
    i++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3824
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

int a[100005];
int b[100005];

set_t p;

int main(){
    int n,t;
    cin >> n>> t;
    int mi=INF;
    int vl=0;
    rep(i,n){
        cin >> a[i];
        mi=min(mi,a[i]);
        b[i]=a[i]-mi;
        if(vl==b[i]){
            p.insert(i);
        }else if(b[i]>vl){
            vl=b[i];
            p.clear();
            p.insert(i);
            cerr<<i<<endl;
        }
        //vl=max(vl,b[i]);
    }
    cout<<p.size()<<endl;
    
    return 0;
}

Measured memory_bytes: 3452
n=gets.chomp.split.map(&:to_i)
a=n[2]-n[0]
b=n[3]-n[1]
(1..b).each do
  print "U"
end
(1..a).each do
  print "R"
end
(1..b).each do
  print "D"
end
(1..a).each do
  print "L"
end
print "L"
(1..b+1).each do
  print "U"
end
(1..a+1).each do
  print "R"
end
print "DR"
(1..b+1).each do
  print "D"
end
(1..a+1).each do
  print "L"
end
print "U"

Measured memory_bytes: 1788
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d",&a);
	scanf("%d",&b);
	if(a==1){
		a=13+a;
	}
	if(b==1){
		b=13+b;
	}
	if(a>b){
		printf("Alice\n");
	}
	if(a<b){
		printf("Bob\n");
	}
	if(a==b){
		printf("Draw\n");
	}
	return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    vector<int> v(n);
    int s = 0;
    for(int i = 0; i < n; ++i) {
        cin >> v[i];
        s += v[i];

    }
    sort(all(v));
    if(s - v[n - 1] > v[n - 1]) cout << "Yes";
    else cout << "No";
    cout << endl;

    return 0;
}



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) {
	string s;
	int k;
	cin >> s >> k;
	
	int n = s.size();
	set<string> st;
	
	for(int i = 0; i < n; ++i) {
		for(int j = 1; j <= k; ++j) {
			string tmp = s.substr(i, j);
			st.insert(tmp);
		}
	}
	
	int cnt = 1;
	for(auto &x : st) {
		if( cnt == k ) {
			cout << x << endl;
			break;
		}
		
		cnt++;
	}
	
	return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define int long long
#define mod 1000000007
using namespace std;
vector<string>v;
signed main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		char c[20]; cin >> c;
		sort(c, c + 10);
		v.push_back((string)c);
	}
	sort(v.begin(), v.end());
	int ans = 0, cnt = 1;
	for (int i = 1; i < n; i++) {
		if (v[i] == v[i - 1]) {
			ans += cnt++;
		}
		else cnt = 1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5748
s = input()
a, b, c = 0, 0, 0
for i in s:
    if i == 'a':
        a += 1
    elif i == 'b':
        b += 1
    else:
        c += 1

flag = True
if (a + b == 0) or (b + c == 0) or (c + a == 0):
    if a + b + c != 1:
        flag = False
elif a * b * c == 0:
    if a + b + c != 2:
        flag = False
else:
    mn = min(a, b, c)
    mx = max(a, b, c)
    if mx - mn > 1:
        flag = False

print('YES' if flag else 'NO')


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  int n,L[100];
  cin >> n;

  int ma = 0;
  for(int i = 0; i < n; i++) {
    cin >> L[i];
    ma = max(ma, L[i]);
  }
  int sum = 0;
  for(int i = 0; i < n; i++)
     sum += L[i];

  if(ma < sum-ma)
    cout << "Yes" << endl;
  else
    cout << "No" << endl; 
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI 3.1415926535897932384
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	double a,b,h,m;
	cin>>a>>b>>h>>m;
	double theta=abs((PI/6*h+PI/360*m)-(PI/30*m));
	double ans;
	ans=sqrt(a*a+b*b-2*a*b*cos(theta));
	printf("%.20f\n",ans);
	return 0;
}


Measured memory_bytes: 4160
import java.util.Scanner;
class Main 
{
  public static void main(String[] args) 
  {
    Scanner input=new Scanner(System.in);
    int a=input.nextInt();
    int b=input.nextInt();
    int c=input.nextInt();
    if(a>=-100 && b>=-100 && c>=-100 && a<=100 && b<=100 && c<=100)
    {
      if(a==b && a!=c)
      {
        System.out.println(c);
      }else
      if(b==c && b!=a)
      {
        System.out.println(a);
      }else
      if(a==c && a!=b)
      {
      System.out.println(b);
      }
    }
  }
}

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

int main() {
  int X;
  cin >> X;
  int ans = 1;
  for (int a = 2; a * a <= X; ++a) {
    for (int pw = a * a; pw <= X; pw *= a) {
      ans = max(ans, pw);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

void solve() {
    int H, N;
    cin >> H >> N;
    const int INF = INT_MAX / 3;
    vi dp(H + 1, INF);
    dp[0] = 0;
    rep(i, N) {
        int A, B;
        cin >> A >> B;
        rep(j, H) {
            smin(dp[min(j + A, H)], dp[j] + B);
        }
    }
    cout << dp.back() << endl;
}

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

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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(string s;cin>>s;){
		rep(i,8){
			int res=s[0]-'0';
			rep(j,3){
				if(i>>j&1)
					res+=s[j+1]-'0';
				else
					res-=s[j+1]-'0';
			}
			if(res==7){
				rep(j,3)
					cout<<s[j]<<"-+"[i>>j&1];
				cout<<s[3]<<"=7"<<endl;
				break;
			}
		}
	}
}


Measured memory_bytes: 256
#include <iostream>
int d[10][10];
void init(){
    for(int i = 0;i < 10;i++){
        for(int j = 0;j < 10;j++){
            d[i][j] = (i == j)? 0 : 10000;
        }
    }
}
int main(){
    int n;
    while(std::cin >> n){
        if(n == 0){
            break;
        }
        init();
        for(int i = 0;i < n;i++){
            int a , b , cost;
            std::cin >> a >> b >> cost;
            d[a][b] = std::min(d[a][b] , cost);
            d[b][a] = std::min(d[b][a] , cost);
        }
        for(int k = 0;k < 10;k++){
            for(int i = 0;i < 10;i++){
                for(int j = 0;j < 10;j++){
                    d[i][j] = std::min(d[i][j] , d[i][k] + d[k][j]);
                }
            }
        }
        int ans = -1 , ans_d = 10000;
        for(int i = 0;i < 10;i++){
            int sum = 0;
            bool tf = false;
            for(int j = 0;j < 10;j++){
                sum += (d[i][j] == 10000)? 0 : d[i][j];
                tf = (d[i][j] == 10000 || i == j)? tf : true;
            }
            if(sum < ans_d && tf){
                ans = i , ans_d = sum;
            }
        }
        std::cout << ans << " " << ans_d << "\n";
    }
    return 0;
}


Measured memory_bytes: 3048
N = int(input())
S = input()
W = [0] * (N)
E = [0] * (N)
count = 0
ans = N + 1
for i in range(N):
  if S[i] == "W":
    count += 1
  W[i] = count
#print(W)
count = 0
for id,i in enumerate(range(N-1,-1,-1)):
  if S[i] == "E":
    count += 1
  E[id] = count
#print(E)
for leader in range(N):
  if leader == 0:
    ans = min(ans,E[-1])
  if leader == N - 1:
    ans = min(ans,W[-1])
  else:
    ans = min(ans,W[leader-1]+E[N-leader-2])
print(ans)

Measured memory_bytes: 19488
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int main(void)
{
    // Your code here!
    string S;
    cin >> S;
    long sum = 0;

    long N;
    N = S.length();

    for (long i = 0; i < pow(2, N - 1); i++)
    {
        long index = 1;
        long scale = 1;
        long tmp_sum = S[0] - '0';
        for (long b = 1; b < N; b++)
        {
            if (i & index)
            {
                tmp_sum += S[b] - '0';
            }
            else
            {
                tmp_sum -= S[b] - '0';
            }

            index = index << 1;
        }

        index = 1;
        if (tmp_sum == 7)
        {
            cout << S[0];
            for (long b = 1; b < N; b++)
            {
                if (i & index)
                {
                    cout << '+';
                }
                else
                {
                    cout << '-';
                }
                cout << S[b];
                index = index << 1;
            }
            cout << "=7";
            break;
        }
    }
}

Measured memory_bytes: 256
from collections import defaultdict
from scipy.misc import comb

N = int(input())
S = [input() for _ in range(N)]

dd = defaultdict(int)
for i in range(N):
  s = "".join(sorted(S[i]))
  dd[s] += 1

ans = 0
for key, val in dd.items():
  ans += comb(val, 2, exact=True)

print(ans)

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

int main()
{
	int n;
	cin >> n;
	long long int tmp, sum = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> tmp;
		sum += tmp;
	}
	cout << sum - n;
}

Measured memory_bytes: 3628
H, W, N = list(map(int, input().split()))
ans = {}
for i in range(N):
  a, b = list(map(int, input().split()))
  for j in range(-1, 2):
    for k in range(-1, 2):
      if (a+j)>=2 and (b+k)>=2 and (a+j)<=(H-1) and (b+k)<=(W-1):
        key = str(a+j) + "_" + str(b+k)
        ans[key] = ans.get(key, 0) + 1
ans_value = list(ans.values())
ans_n0 = 0
for i in range(1, 10):
  ans_n0 = ans_n0 + ans_value.count(i)
print((H-2)*(W-2)-ans_n0)
for i in range(1, 10):
  print(ans_value.count(i))


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

int main() {int a,b,f=0,x;cin>>a>>b;
 for(int i=0;i<=1250;i++){
 if(2*i/25==a && i/10==b){f=1;x=i;break;}}
  if(f){cout<<x<<endl;}
   else{cout<<-1<<endl;}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

  int N,M,C;

  cin >> N >> M >> C;

  int B[20];

  for(int i = 0;i < M;i++) cin >> B[i];

  int A[20][20];

  for(int i = 0;i < N;i++)
    for(int j = 0;j < M;j++)
      cin >> A[i][j];

  int count = 0;

  for(int i = 0;i < N;i++){

    int sum = 0;

    for(int j = 0;j < M;j++){

      sum += A[i][j]*B[j];

    }


    if(sum + C > 0) count++;

  }

  cout << count << "\n";


}

Measured memory_bytes: 256
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; i<n; ++i)
#define rep1(i, n) for(int i = 1; i<n; ++i)
#define debug(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  string s;
  ll k;
  cin >> s >> k;
  set<string> eu;
  rep(i, s.size()){
    rep1(j, k + 1){
      if(s.size() < i + j){
        continue;
      }
      eu.insert(s.substr(i, j));
    }
  }

  // for(auto && a:eu){
  //   cout << a << endl;
  // }

  auto iter = eu.begin();

  rep1(i, k){
    iter++;
  }
  cout << *iter;
}
#endif


Measured memory_bytes: 1664
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val L, R = sc.nextLong()

    // L <= i < j <= R
    // 2019で割り切れる数値が, L以上R以下で1つ以上ある時には, 当然最小値0
    // L以上R以下で1つも無い時には, Lの値がもっとも2019で割り切れる数が大きいということ
    // つまりL, L + 1を選べばいい
    // R - Lの中が2019個あれば問題ない
    val min = if (R - L >= 2019L) 0L
    else {
      val candidates = for {
        i <- L to (R - 1)
        j <- (i + 1) to R
      } yield (i * j) % 2019L
      candidates.min
    }
    println(min)
  }

}


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

int main(){
  long N,tmp,flug=0;
  cin >> N;
  vector<long> H(N);
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  sort(H.begin(),H.end());
  /*
  for(int i=0;i<N-K;i++) sum += H[i];
  */
  for(int i=0;i<N-1;i++){
    if(H[i]==H[i+1]) flug++;
  }
  if(flug==0) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

int grundy[210][210];
bool visited[210][210];

int dfs(int w, int b){
  if(visited[w][b]) return grundy[w][b];
  visited[w][b] = true;

  set<int> vec;
  
  if(w >= 1) vec.insert(dfs(w-1, b));
  if(b >= 1) vec.insert(dfs(w+1, b-1));

  for(int i=1;i<=min(w, b);i++){
    vec.insert(dfs(w, b-i));
  }

  int next = 0;
  for(auto v : vec){
    if(next != v) break;
    next++;
  }
  
  return grundy[w][b] = next;
}

int main(){
  int n;

  scanf("%d", &n);

  int g = 0;
  
  for(int i=0;i<n;i++){
    int w, b;
    scanf("%d%d", &w, &b);

    g ^= dfs(w, b);
  }

  printf("%d\n", !g);
  
  return 0;
}





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

int main(){
	int n,m;
	while( cin >> n >> m , n || m ){
		vector<int> vc;
		vc.push_back( 0 );

		for(int i=0 ; i < n+m ; i++ ){
			int t;
			cin >> t;
			vc.push_back( t );
		}
		sort( vc.begin() , vc.end() );
		int ans = 0;
		for(int i=1 ; i < vc.size() ; i++ ){
			int d = vc[i] - vc[i-1];
			ans = max( ans , d );
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1028
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_171
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            string s = Read();
            if (s[0] >= 'a' && s[0] <= 'z')
            {
                WriteLine('a');
            }
            else
            {
                WriteLine('A');
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 25676
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define RREP(i,a) for(long (i)=(a)-1;(i)>=0;(i)--)
#define FORR(i,a,b) for(long (i)=(a)-1;(i)>=(b);(i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<<C<<endl;
#define VI vector<int>
#define VL vector<long>
#define VD vector<double>
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<long,long>
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define FORE(a,b) for(auto &&a:b)

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF=1e9;
const int MOD=INF+7;

long gcd(long a,long b){
    long m=a%b;
    if(m==0) return b;
    return gcd(b,m);
}

int main(void)
{
    LL N,X; cin>>N>>X;
    cout<<3*(N-gcd(N,X))<<endl;
    return 0;
}


Measured memory_bytes: 256
use std::io::Read;
use std::cmp::min;

fn main() {
    let mut buf = String::new();

    // 標準入力から全部bufに読み込む
    std::io::stdin().read_to_string(&mut buf).unwrap();

    // 読み込んだStringを空白で分解する
    let mut iter = buf.split_whitespace();

    let n = iter.next().unwrap();

    let mut count_0_origin = 0;
    let mut count_1_origin = 0;
    for i in 0..n.len() {
        let v: i32 = n[i..i + 1].parse().unwrap();
        if v % 2 == (i % 2) as i32 {
            count_1_origin += 1;
        } else {
            count_0_origin += 1;
        }
    }

    println!("{}", min(count_0_origin, count_1_origin));
}


Measured memory_bytes: 4352
s=int(input())
A=s//1000
B=s//100%10
C=s//10%10
D=s%10

for k in range(1<<3):
    op1=k&1
    op2=k>>1&1
    op3=k>>2&1
    t=A;ans=str(A)
    if op1:
        t+=B;ans+='+'+str(B)
    else:
        t-=B;ans+='-'+str(B)
    if op2:
        t+=C;ans+='+'+str(C)
    else:
        t-=C;ans+='-'+str(C)
    if op3:
        t+=D;ans+='+'+str(D)+'=7'
    else:
        t-=D;ans+='-'+str(D)+'=7'
    if t==7:
        print(ans)
        break

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)                    \
  for (int i = 0; i < (int)(n); i++) \
    ;

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

int main() {
  long n, k;
  cin >> n >> k;

  vector<long> p(n);
  for (long &x : p) {
    cin >> x;
  }

  sort(p.begin(), p.end());
  vector<long> csump(p.size() + 1, 0);
  for (int i = 1; i <= p.size(); i++) {
    csump.at(i) = csump.at(i - 1) + p.at(i - 1);
  }

  cout << csump.at(k) << endl;
}


Measured memory_bytes: 3652
package main

import (
	"fmt"
	"math"
)

func main() {
	var A, B, C, X, Y, x, y, s int
	fmt.Scan(&A, &B, &C, &X, &Y)
	m := math.MaxInt64
	for ab := 0; ab < 200010; ab++ {
		s = ab * C
		x = X - ab/2
		y = Y - ab/2
		if x > 0 {
			s += x * A
		}
		if y > 0 {
			s += y * B
		}
		m = min(m, s)
	}
	fmt.Println(m)
}

func min(a, b int) int {
	if b < a {
		return b
	}
	return a
}

Measured memory_bytes: 512
import java.io.File;
import java.io.FileInputStream;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String c = sc.next();
		String m = "aiueo";
		System.out.println(m.contains(c) ? "vowel" : "consonant");
	}
}

Measured memory_bytes: 23124
#include "bits/stdc++.h"
#include <chrono>
#include <random>
#include <cstdio>
#define ll long long int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define mod 1000000007LL
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
const int N=500001;
// vector<pair<ll, ll> > adj[N];
// bool vis[N];
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
#define pi 3.14159265358979323846264338
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
ll inf = 100000000000000000;
vector <int> adj[N];


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

    rep(i, n-1)
    {
        int a, b;
        cin>>a>>b;

        adj[a].pb(b);
        adj[b].pb(a);
    }   

    int dist1[n+1], distn[n+1];

    rep(i, n+1) 
    {
        dist1[i] = INT_MAX;
        distn[i] = INT_MAX;
    }

    queue<int> q;
    q.push(1);

    dist1[1] = 0;

    while(q.size())
    {
        int p = q.front();
        q.pop();

        for(auto j:adj[p])
        {
            if(dist1[j] > dist1[p] + 1)
            {
                dist1[j] = dist1[p] + 1;
                q.push(j);
            } 
        }
    }

    // rep(i, n)
    // {
    //     cout<<dist1[i+1]<<" ";
    // }
    // cout<<endl;

    q.push(n);

    distn[n] = 0;

    while(q.size())
    {
        int p = q.front();
        q.pop();

        for(auto j:adj[p])
        {
            if(distn[j] > distn[p] + 1)
            {
                distn[j] = distn[p] + 1;
                q.push(j);
            } 
        }
    }

    // rep(i, n)
    // {
    //     cout<<distn[i+1]<<" ";
    // }
    // cout<<endl;

    int p = 0, r = 0;

    for(int i = 1; i <= n; i++)
    {
        if(dist1[i] <= distn[i]) p++;
        else r++;
    }

    if(p > r)
    {
        cout<<"Fennec"<<endl;
    }
    else
    {
        cout<<"Snuke"<<endl;
    }
    



     
}

int main()
{

    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)

    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }


    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 19552
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    ll x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
  	ll x3 = x2-(y2-y1);
  	ll y3 = y2+(x2-x1);
  	ll x4 = x3-(x2-x1);
  	ll y4 = y3-(y2-y1);
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}

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

int main() {
	int n[100000], s, i;
	n[0] = 1;
	n[1] = 1;

	cin >> s;

	for (i = 2; i <=s; i++) {
		n[i] = n[i-1] + n[i-2];
	}

	cout << n[s] << endl;

	return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 100000 + 5;

int n, x[maxn], y[maxn];

int main() {
  scanf("%d", &n);
  vector<int> p;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", x + i, y + i);
    p.push_back(i);
  }
  long double sum = 0;
  int cnt = 0;
  auto cal = [&](int a, int b) -> long double {
    return sqrt((x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]));
  };
  do {
    for (int i = 1; i < n; i++) {
      sum += cal(p[i - 1], p[i]);
    }
    cnt++;
  } while (next_permutation(begin(p), end(p)));
  cout << fixed << setprecision(8);
  cout << sum / cnt;
  return 0;
}

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

int size;
int e[100];

bool solve(){
    if(e[0] % 2 == 0 || e[1] % 2 == 0) return false;

    for(int i = 2; i < 100; i++){
        if(e[i] % 2 != 0) return false;
    }

    return true;
}

int main(){
    int a, b;
    while(scanf("%d %d", &a, &b) != EOF){
        std::fill(e, e + 100, 0);

        e[a - 1]++;
        e[b - 1]++;

        while(1){
            scanf("%d %d", &a, &b);
            if(a == 0 && b == 0) break;

            e[a - 1]++;
            e[b - 1]++;

        }

        if(solve()){
            printf("OK\n");
        }else{
            printf("NG\n");
        }
    }

    return 0;
}

Measured memory_bytes: 2564
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define f first
#define s second
#define mp make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef vector<pll> vplll;

int main(){
	
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;cin>>s;
    ll c=0;
    for(char x:s){
    	if(x=='o')
    		++c;
    }
    // cout<<c<<endl;
    if(c+15-s.size()>=8)
    	cout<<"YES"<<endl;
    else
    	cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.JSC_2019_qual
{
    class B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] nk = ReadInts();
            long n = nk[0];
            long k = nk[1];
            long[] array = ReadLongs();
            long[] cnts = new long[2005];
            long[] smalls = new long[n];
            for(long i = n - 1; i >= 0; i--)
            {
                for(long j = 0; j < array[i]; j++)
                {
                    smalls[i] += cnts[j];
                }
                cnts[array[i]]++;
            }
            long[] allSmalls = new long[n];
            for(int i = 0; i < n; i++)
            {
                for(long j = 0; j < array[i]; j++)
                {
                    allSmalls[i] += cnts[j];
                }
            }
            long mask = 1000000000 + 7;
            long res = 0;
            for(int i = 0; i < n; i++)
            {
                res += smalls[i] * k;
                long tmp = (k - 1) * k / 2;
                tmp %= mask;
                tmp *= allSmalls[i];
                res += tmp;
                res %= mask;
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13244
import java.util.Scanner;

class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = sc.nextInt();
		String S = sc.next();
		char[] chars = S.toCharArray();
		char[] result = new char[chars.length];
		for (int i = 0; i < chars.length; i++) {
			char c = chars[i];
			result[i] = (char) ((c - 'A' + N) % 26 + 'A');
		}
		System.out.println(String.copyValueOf(result));
	}
}

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

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 21972
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main
{
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		int n = ni();
		out.println(n <= 999 ? "ABC" : "ABD");
	}
			
	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception 
	{ new Main().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf)
		{
			ptrbuf = 0;
			try 
			{ lenbuf = is.read(inbuf); } 
			catch (IOException e) 
			{ throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c)
	{ return !(c >= 33 && c <= 126); }
	private int skip() 
	{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() 
	{ return Double.parseDouble(ns()); }
	private char nc()
	{ return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b)))
		{ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private String nsl()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b) && b != ' '))
		{ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b)))
		{
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}
		
		while(true)
		{
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private static void tr(Object... o) 
	{ System.out.println(Arrays.deepToString(o)); }
}


Measured memory_bytes: 20948
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

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

    string ans;

    if(n % 2 == 0){
        ans = (k <= n / 2)? "YES" : "NO";
    }else{
        ans = (k <= (n + 1) / 2)? "YES" : "NO";
    }

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

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
	public static void main(String args[]) throws Exception{
		Scanner cin= new Scanner(System.in);
		while(true){
			int H= cin.nextInt();
			int W= cin.nextInt();
			
			if( H==0 && W==0 ){
				break;
			}
			else{
				int i,j;
				for(i=0;i<H;i++){
					if( i==0 || i==H-1 ){
						for(j=0;j<W;j++){
							System.out.print("#");
						}
					}
					else{
						for(j=0;j<W;j++){
							if( j==0 || j==W-1 ){
								System.out.print("#");
							}
							else{
								System.out.print(".");
							}
						}
					}
					System.out.print("\n");
				}
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 25764
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

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

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

int main() {
  int n[10];
  string s;  
  
  while(cin >> s) {
    REP(i, 10) n[i] = s[i] - '0';

    for(int i = 9; i >= 0; i--) {
      for(int j = 0; j < i; j++) {
	n[j] = (n[j]+n[j+1]) % 10;
      }
    }
    cout << n[0] << endl;
  }
}

Measured memory_bytes: 1180
#include<iostream>
using namespace std;
int main(){
        int n;
        cin>>n;
        int N[100001];
        int num[100000]={0};
        for(int i=0;i<n;i++){
                cin>>N[i];
        }
        for(int i=0;i<n;i++){
                num[N[i]]++;
                num[N[i]+1]++;
                num[N[i]+2]++;
        }
        int ans=0;
        for(int i=0;i<100000;i++){
                if(ans<num[i]){
                        ans=num[i];
                }
        }
        cout<<ans;
}

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

using namespace std;
 
#define MD 1000000007
typedef long long int ll;

int main(){
    int a,b;
    cin>>a>>b;
    int i=1;
    while(1){
        int tmp=i*(i+1)/2;
        if(tmp>=a){
            int dis=tmp-a,tmp2=(i+1)*(i+2)/2;
            if(tmp2-dis==b){
                cout<<dis<<endl;
                break;
            }
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 256
import math
a, b = map(int, input().split())


def calc_a(n):
    return n // 0.08


def calc_b(n):
    return n / 0.1


estimate = int(min(calc_a(a), calc_b(b)))
for i in range(estimate, estimate*2):
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        print(i)
        exit()

print(-1)

Measured memory_bytes: 38384