akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}
struct UnionFind {
    VI d;
    UnionFind(int n = 0): d(n,-1) {}
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x,int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};
int deg[100005];
VI to[100005];

struct mint {
  LL x; // typedef long long ll;
  mint(LL x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(LL t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(MOD-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
    if(n == 0) return 1;
    mint x = f(n/2);
    x *= x;
    if(n%2 == 1) x *= 2;
    return x;
}

mint choose(int n,int a) {
    mint x = 1, y = 1;
    rep(i,a) {
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

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

    rep(i , s.length()) {
      if(s[i] == '?') s[i] = 'D';
    }

    cout << s << endl;
}


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

int X[9], Y[9];
vector<int> P;

long double getDist(long double x1, long double y1, long double x2, long double y2)
{
    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

long double solve()
{
    long double sum = 0;

    for(int i=1; i<P.size(); i++)
        sum += getDist(X[ P[i] ], Y[ P[i] ], X[ P[i-1] ], Y[ P[i-1] ]);
    
    return sum;
}

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

    int N;
    cin >> N;

    for(int i=1; i<=N; i++)
    {
        cin >> X[i] >> Y[i];
        P.push_back(i);
    }

    int x = 0;
    long double ans = 0;

    do {
        x++;
        ans += solve();
    } while(next_permutation(P.begin(), P.end()));

    cout << fixed << setprecision(9) << ans / x << "\n";

    return 0;
}


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

int main()
{
    char S[101];
    scanf("%s", S);
    int i;
    int N = strlen(S);
    int count = 0;
    for(i=0; i<(int)(N/2); i++) {
        // printf("%d=%c, %c\n", i, S[i], S[N-1-i]);
        if(S[i] != S[N-1-i]) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int a[5],temp,i,j;
    
    for(i=0;i<5;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<5;i++)
    {
        for(j=i+1;j<5;j++)
        {
            if(a[i]<a[j])
            {
                temp=a[i];
                a[i]=a[j];
                a[j]=temp;
            }
        }
    }
    for(i=0;i<4;i++)
        printf("%d ",a[i]);
    printf("%d\n",a[4]);
    return 0;
}


Measured memory_bytes: 2104
import java.io.*;

public class Main{
	public static void main(String[] args){
		try {
			int W,H,x,y,r;
			BufferedReader br = new BufferedReader(
					new InputStreamReader(System.in));
			//キーボード入力を受け取る	
			String str = br.readLine();
			//キーボード入力した文字列を変数ｓｔｒへ代入
			String[] strAry = str.split(" ");
			//文字列をsplitメソッドを使い、空白で分割する
			//配列を生成する

			W = Integer.parseInt(strAry[0]);
			//Wにキーボード入力の要素[0]を代入する
			H = Integer.parseInt(strAry[1]);
			//Wにキーボード入力の要素[1]を代入する
			x = Integer.parseInt(strAry[2]);
			//Wにキーボード入力の要素[2]を代入する
			y = Integer.parseInt(strAry[3]);
			//Wにキーボード入力の要素[3]を代入する
			r = Integer.parseInt(strAry[4]);
			//Wにキーボード入力の要素[4]を代入する

			//長方形の中に円が含まれるかをif文で判定する
			if(x-r>=0 && x+r<=W &&
					y-r>=0 && y+r<=H){
			//xに関してはx-rをした際に-になると左枠を超える
			//wより横軸x＋rが大きくなると上枠を超える
			//y-rをした際に-になると右枠を超える
			//hより横軸y＋rが大きくなると下枠を超える

				System.out.println("Yes");
				//条件と一致した場合Yesを出力
			}else{
				System.out.println("No");
				//条件と異なる場合はNoを出力
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

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

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextInt();
            }

            Arrays.sort(A);

            for (int i = 1; i < A.length; i++) {
                if (A[i - 1] == A[i]) {
                    System.out.println("NO");
                    return;
                }
            }

            System.out.println("YES");
        }
    }

}


Measured memory_bytes: 63456
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	int n;
	Scanner scan=new Scanner(System.in);
	n=scan.nextInt();
	int a[]=new int[n];
	for(int i=0;i<n;i++)
	    {
		a[i]=scan.nextInt();
	    }
	int j=0,k=n-1,tmp;
	while(true)
	    {		
		if((j==k) || (j>k))break;
		tmp=a[j];
		a[j]=a[k];
		a[k]=tmp;
		j++;
		k--;
	    }
	for(int i=0;i<n;i++)
	    {
if(i==n-1)
{
System.out.println(a[i]);
break;
}
		System.out.print(a[i]+" ");
	
	    }
    }
}

Measured memory_bytes: 19092
/// Author : HASEBUL HASSAN TANIM ///
#include <bits/stdc++.h>
using namespace std;

#define fast ios_base::sync_with_stdio(0);cin.tie(0);
#define pb push_back
#define pp pop_back
#define scan(t) scanf("%d",&t)
#define sscan(t) scanf("%lld",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define LL long long
#define ull unsigned long long
#define rock(cont) cont.begin(), cont.end()
#define roll(a,n) arr,arr+n
#define rep(i,n) for(int i=0 ; i<n ; i++)
#define repp(i, n) for(int i=1 ; i<=n ; i++)
#define print(t) printf("%d",t)
#define pprint(t) printf("%lld",t)
#define co(x) cout<<x
#define nl printf("\n")
#define el cout<<endl
#define INF (int)1e9

const int RT = 10000000;

vector<int>prime;
vector<LL>factor;
bitset<10000003> status;



int gcd(LL a,LL b){ return b==0 ? a: gcd(b,a%b);}
int lcm(LL a,LL b) { return a* (b/gcd(a,b));}

vector<int> Divisors(int n)
{
    vector<int> v;
    int limit=sqrt(n);
    for (int i=1; i<=limit; i++)
    {
        if (n%i==0)
        {
            if (n/i == i)
                v.push_back(i);
            else
            {
                v.push_back(i);
                v.push_back(n/i);
            }
        }
    }
    return v;
}

void sieve()
{
    int rt = sqrt(RT);
    //for(int i = 4; i <= rt; i+=2) status[i]=true;
    for(int i = 3; i <= rt; i+=2)
        if(!status[i])
            for(int j = i*i; j < RT; j+=(i<<1))
                status[j] = true;

    prime.push_back(2);

    for(int i = 3; i <= RT; i+=2)
        if(!status[i])
            prime.push_back(i);
}

LL primefac(LL n)
{
    int pf_idx=0,pf=prime[pf_idx],SIZE=prime.size();
    LL ANS=1,step=0;
    while(pf*pf<=n&&pf<SIZE)
    {
        if(n%pf==0)
        {
            while(n%pf==0) {n/=pf;}
            ANS=pf;
            step++;
        }
        pf=prime[++pf_idx];
        //cout<<pf<<" "<<n<<" "<<ANS<<endl;
    }
    if(n!=1) { ANS=max(ANS,n); step++; }
    if(step>1)
    {
      return ANS;
    }
    else
    {
        return -1;
    }
}

int main()
{
    fast;
    set<string>S;
    int n;
    cin>>n;
    string s;
    for(int i=1;i<=n;i++)
    {
        cin>>s;
        S.insert(s);
    }
    cout<<S.size()<<endl;
}


Measured memory_bytes: 19204
// Last Change:        12/08/2018 21:27:46.
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <list>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;


int main() {
  int N, K, h[100000];
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }
  sort(h, h + N);
  int ans = 1000000005;
  for (int i = 0; i < N - K + 1; i++) {
    ans = min(h[K + i - 1] - h[i], ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define ff first
#define ss second
#define MOD 1000000007
#define pb push_back
#define EPS 1e-6
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64; 
long long const INF = 1e18 + 42;
 
 
int main(){
	fast;
	double n;
	cin>>n;
	n/=3;
	double ans= n*n*n;
	cout<<fixed<<setprecision(12)<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 1000000000000000000
int n,m,dp[5005][5005],ds[5005][5005],dt[5005][5005][2];
ll ans;
int main(void){
    cin>>n>>m;
    int a=n/2,b=(n-1)/2;
    for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			if(i==0)dp[i][j]=1;
			else{
				if(i>=j)dp[i][j]=dp[i-j][j];
				if(j>0)dp[i][j]=(dp[i][j]+dp[i][j-1])%m;
			}
		}
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			ds[i][j]=dp[i][j];
			if(i>0)ds[i][j]=(ds[i][j]+ds[i-1][j])%m;
		}
	}
	int pre=0,cur=1;
	for(int i=0;i<=n-1;i++)dt[0][i][pre]=1;
	for(int i=1;i<=b;i++){
		for(int j=0;j<=n-1;j++)dt[j][0][cur]=0,dt[0][j][cur]=1;
		for(int j=1;j<=n-1;j++){
			int mx=n-1-(b+1-i)*j;
			for(int k=1;k<=mx;k++){
				dt[k][j][cur]=dt[k][j-1][cur];
				if(k-j>=0)dt[k][j][cur]=(dt[k][j][cur]+dt[k-j][j][pre])%m;
			}
		}
		swap(pre,cur);
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i-1;j++){
			ans=(ans+ll(dt[j][n-i][pre])*ll(ds[i-1-j][a])%m)%m;
		}
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 391552
#include <bits/stdc++.h>
//#define int long long

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

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int c[3][3];
    REP(i, 3) REP(j, 3) cin >> c[i][j];

    vector<int> a(3, 0), b(3, 0);
    bool ans = true;
    REP(i, 3) {
        b[i] = c[0][i];
        a[i] = c[i][0] - b[0];
    }
    REP(i, 3) REP(j, 3){
        ans &= c[i][j] == a[i] + b[j];
    }
    cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
namespace Test
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class Test
    {
        public static void Main(string[] args)
        {
            var t = new Test();
            var input = t.ConvertLongList(t.ReadInput());
            long n = input[0];
            long k = input[1];
            var val = n;
            var memory = long.MaxValue;
            while (true)
            {
                if (k == 1)
                {
                    break;
                }

                memory = val;

                if (val > k)
                {
                    val = val % k;
                }
                else if (val <= k)
                {
                    val = Math.Abs(val - k);
                    break;
                }
            }

            if (k == 1)
            {
                Console.WriteLine(0);
            }
            else if (n < val)
            {
                Console.WriteLine(n);
            }
            else
            {
                Console.WriteLine(val);
            }


        }

        public int Gcd(int a, int b)
        {
            for (var i = b; i > 1; i -= 1)
            {
                if (a % i == 0 && b % i == 0)
                {
                    return i;
                }
            }
            return 1;
        }

        public string[] ReadInput()
        {
            return Console.ReadLine().Split(' ');
        }

        public List<int> ConvertIntList(string[] x)
        {
            var convertedList = new List<int>(x.Length);
            for (var i = 0; i < x.Length; i++)
            {
                convertedList.Add(int.Parse(x[i]));
            }

            return convertedList;
        }

        public List<double> ConvertDoubleList(string[] x)
        {
            var convertedList = new List<double>(x.Length);
            for (var i = 0; i < x.Length; i++)
            {
                convertedList.Add(double.Parse(x[i]));
            }

            return convertedList;
        }

        public List<long> ConvertLongList(string[] x)
        {
            var convertedList = new List<long>(x.Length);
            for (var i = 0; i < x.Length; i++)
            {
                convertedList.Add(long.Parse(x[i]));
            }

            return convertedList;
        }

        public int CountContainWords(string source, string word)
        {
            var count = 0;
            var loopCount = source.Length - (word.Length - 1);
            for (var i = 0; i < loopCount; i++)
            {
                if (source.Substring(i, word.Length) == word)
                {
                    count++;
                }
            }
            return count;
        }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

vector<pair<ll, int>> factorize(ll n){
    vector<pair<ll, int>> res;
    for (ll i = 2; i*i <= n; ++i){
        if (n%i) continue;
        res.emplace_back(i, 0);
        while (n%i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

const int MAX = 1e6+5;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> d(MAX);
    rep(i,n){
        cin >> a[i];
        d[a[i]]++;
    }

    bool p = true;
    for(int i = 2; i <= MAX; i++){
        int cnt = 0;
        for(int j = i; j <= MAX; j += i){
            cnt += d[j];
        }
        if (cnt > 1) p = false;
    }

    if (p){
        cout << "pairwise coprime" << endl;
        return 0;
    }

    int g = a[0];
    for(int i = 1; i < n; i++){
        g = __gcd(g, a[i]);
    }

    if (g == 1){
        cout << "setwise coprime" << endl;
        return 0;
    }

    cout << "not coprime" << endl;
    return 0;
}

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

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;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#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 range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
	int n;
	while(cin >> n,n){
		int sell[10]={0};
		rep(i,n){
			int a;
			cin >> a;
			sell[a]++;
		}
		rep(i,10){
			if(sell[i]==0){
				puts("-");
			}else{
				rep(j,sell[i]) putchar('*');
				puts("");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 2980
function NotOne(arr){
   var cnt=[0,0,0,0,0,0,0,0,0,0];
   arr.forEach(function(v){cnt[(v-0)]++;});
   var bad=[];
   cnt.forEach(function(v,i){if(v>=2)bad.push(i);});
   var result=[];
   arr.forEach(function(v,i){if(bad.indexOf(v)!=-1)result.push(i);});
   return result;
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=input.trim().split("\n");
var STR="";
var n=Arr.shift()-0;
for(var I=0;I<n;I++){
   var yx=[];
   var YX=[];
   for(var i=0;i<9;i++){
      var v=Arr.shift().split(" ").map(Number);
      yx.push(v);
      YX.push([0,0,0,0,0,0,0,0,0]);
   }
   for(var i=0;i<9;i++){
      var reX=NotOne(yx[i]);
      reX.forEach(function(v){YX[i][v]++;});
      var yy=[];
      for(var j=0;j<9;j++)yy.push(yx[j][i]);
      var reY=NotOne(yy);
      reY.forEach(function(v){YX[v][i]++;});
      var y=~~(i/3);
      var x=i%3;
      var z=[
      [0+y*3, 0+x*3], [0+y*3, 1+x*3], [0+y*3, 2+x*3],
      [1+y*3, 0+x*3], [1+y*3, 1+x*3], [1+y*3, 2+x*3],
      [2+y*3, 0+x*3], [2+y*3, 1+x*3], [2+y*3, 2+x*3]
      ];
      var zz=[];
      z.forEach(function(v){zz.push(yx[v[0]][v[1]]);});
      var reZ=NotOne(zz);
      reZ.forEach(function(v){YX[z[v][0]][z[v][1]]++;});
   }
   for(var i=0;i<9;i++){
      for(var j=0;j<9;j++){
         yx[i][j]=(YX[i][j]>=1)?"*"+yx[i][j]:" "+yx[i][j];
      }
   }
   STR+=yx.join("\n").replace(/\,/g,"")+"\n\n";
}
console.log(STR.trim());

Measured memory_bytes: 10088
//2020-05-15 17:34:54
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; ++i)

using namespace std;
using ll = long long;
struct Combination
{
    ll n;
    vector<ll> nCk;
    Combination(ll n):n(n){}
    void make_nCk(){
        nCk.push_back(1);
        for (int i = 1; i < n; i++){
            nCk.push_back(nCk[i-1] * (n-i));
            nCk[i] /= i;
        }
    }
    ll f(ll k){return nCk[k];}
};
int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int n, p; cin >> n >> p;
    int even=0, odd=0;
    rep(i, n){
        int a; cin >> a;
        if (a % 2)odd++;
        else even++;
    }
    Combination com(odd+1);
    com.make_nCk();
    ll y = 1;
    rep(i, even)y*=2;
    ll ans = 0;
    for (int i = p; i <= odd; i+=2)
        ans += y * com.f(i);
    cout << ans << endl;
    
}

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

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        Integer[] sticks = new Integer[N];

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

            sticks[i] = Integer.parseInt(sc.next());
        }

        sc.close();

        Arrays.sort(sticks);

      int count = 0;

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

          for(int j = i+1; j < N-1; j++) {

              int serch = ~Arrays.binarySearch(sticks, sticks[i] + sticks[j], (x,y)->x.compareTo(y)>=0?1:-1);
              
              count += (serch <= 0) ? 0 : serch -j -1;
          }
      }

      System.out.println(count);

    }
}


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

int main()
{
	int a[2];
	cin>>a[0]>>a[1];
	int sum=0;
	sort(a,a+2);
	sum+=a[1];
	a[1]--;
	sort(a,a+2);
	sum+=a[1];
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
    vector<vector<int>> a(3, vector<int>(3));
    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            scanf("%d", &a[i][j]);
        }
    }
    sort(a.begin(), a.end());
    for (int i = 1; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            if (a[i][j] < a[i - 1][j])
            {
                printf("No\n");
                return 0;
            }
            a[i][j] -= a[0][j];
        }
        if (a[i][0] != a[i][1] || a[i][1] != a[i][2])
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>
#include <bitset>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
	char c;
	cin >> c;
	cout << (char)(c + 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX_C 400
#define MAX_N 25000
#define P 1000000007
using namespace std;
typedef long long lnt;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, m, c, a[MAX_N+5]; bool flag, mrk[MAX_C+5];
lnt f[MAX_N+5][MAX_C+5], g[MAX_N+5][MAX_C+5]; int lp, rp;
lnt Fac(int x) {
	lnt ret = 1;
	for (int i = 1; i <= x; i++)
		(ret *= i) %= P;
	return ret;
}
lnt Pow(lnt x, int k) {
	lnt ret = 1;
	for (; k; k >>= 1, x = x*x%P)
		if (k&1) ret = ret*x%P;
	return ret;
}
int main() {
	read(n), read(c), read(m);
	lnt tot = Pow(c, n-m)*(n-m+1)%P;
	for (int i = 1; i <= m; i++) read(a[i]);
	for (int l = 1; l+c-1 <= m; l++) {
		memset(mrk, false, sizeof mrk);
		for (int r = l; r <= l+c; r++)
			if (r == l+c) flag = true;
			else if (mrk[a[r]]) break;
			else mrk[a[r]] = true;
		if (flag) return printf("%lld\n", tot), 0;
	}
	memset(mrk, false, sizeof mrk);
	for (int i = 1; i <= m; i++)
		if (mrk[a[i]]) break;
		else mrk[a[i]] = true, lp++;
	memset(mrk, false, sizeof mrk);
	for (int i = m; i >= 1; i--)
		if (mrk[a[i]]) break;
		else mrk[a[i]] = true, rp++;
	if (lp == m && rp == m) {
		f[0][0] = 1;
		for (int i = 1; i <= n; i++) {
			lnt sf = 0, sg = 0;
			for (int j = c-1; j; j--) {
				(sf += f[i-1][j]) %= P, f[i][j] = (f[i-1][j-1]*(c-j+1)%P+sf)%P;
				(sg += g[i-1][j]) %= P, g[i][j] = (g[i-1][j-1]*(c-j+1)%P+sg)%P;
				if (j >= m) (g[i][j] += f[i][j]) %= P;
			}
		}
		lnt sum = 0;
		for (int i = 1; i < c; i++) (sum += g[n][i]) %= P;
		(tot += P-sum*Fac(c-m)%P*Pow(Fac(c), P-2)%P) %= P;
	} else {
		f[0][lp] = g[0][rp] = 1;
		for (int i = 1; i <= n; i++) {
			lnt sf = 0, sg = 0;
			for (int j = c-1; j; j--)
				(sf += f[i-1][j]) %= P, f[i][j] = (f[i-1][j-1]*(c-j+1)%P+sf)%P, 
				(sg += g[i-1][j]) %= P, g[i][j] = (g[i-1][j-1]*(c-j+1)%P+sg)%P;
		}
		for (int l = 0, r = n-m; l <= n-m && r >= 0; l++, r--) {
			lnt sf = 0, sg = 0;
			for (int i = 1; i < c; i++) (sf += f[l][i]) %= P;
			for (int i = 1; i < c; i++) (sg += g[r][i]) %= P;
			(tot += P-sf*sg%P) %= P;
		}
	}
	return printf("%lld\n", tot), 0;
}


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

const int N = 333;

double dp[N][N][N];

int n;

double f(int x, int y, int z)
{
  //~ cerr << x << ' ' << y << ' ' << z << endl;
  if(x < 0 || y < 0 || z < 0) return 0;
  if(dp[x][y][z] >= -.5) return dp[x][y][z];
  
  double& ans = dp[x][y][z];
  
  if((n -x -y -z) == n) return ans = 0;
  
  ans =
   (1.0 * x / n * (f(x-1, y+1, z) + 1.0) +
    1.0 * y / n * (f(x, y-1, z+1) + 1.0) +
    1.0 * z / n * (f(x, y, z-1) + 1.0) +
    1.0 * (n -x -y -z) / n)
    /
    (1.0 - 1.0 * (n -x -y -z) / n);
  return ans;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  
  int x=0, y=0,z=0;
  cin >> n;
  for(int i=1;i<=n;++i)
  {
    int a;
    cin >> a;
    if(a == 3) ++x;
    if(a == 2) ++y;
    if(a == 1) ++z;
  }
  
  for(int i=0;i<N;++i)
    for(int j=0;j<N;++j)
      for(int k=0;k<N;++k)
        dp[i][j][k] = -1.0;
  cout << fixed << setprecision(10) << f(x, y, z) << endl;
  
  return 0;
}


Measured memory_bytes: 288768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e3 + 5, mod = 1e9 + 7, inf = 0x3f3f3f3f;
ll dp[maxn][maxn];
int a[maxn], b[maxn];
ll ps[maxn], pt[maxn];;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll lc = c / __gcd(c, d) * d;
    cout << b - a + 1 - (b / c - (a - 1) / c + b / d - (a - 1) / d - (b / lc - (a - 1) / lc)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std; 

const int N = 2e5 + 10;
typedef long long ll;
int n, fa[N], vis[N], p[N];
ll ans, f[N], sum1[N], sum0[N];
struct node {
    int x, s0, s1;
    bool operator < (const node& a) const {  // !!!
        return 1ll * s1 * a.s0 > 1ll * s0 * a.s1;  // 这么写，实现小根堆
    }
};
priority_queue<node> q;  // https://www.cnblogs.com/dingxiaoqiang/p/7096293.html

int getfa(int x) {
    return fa[x] == x ? x : fa[x] = getfa(fa[x]);
}

void merge(int x, int y) {
    x = getfa(x), y = getfa(y);
    if (x == y) return; 
    fa[x] = y;
}

int main() {
    cin >> n;
    rep(i, 1, n) fa[i] = i;
    rep(i, 2, n) scanf("%d", &p[i]);
    rep(i, 1, n) {
        int x; scanf("%d", &x);
        if (!x) {
            sum0[i] = 1;
            q.push((node){i, 1, 0});
        } else {
            sum1[i] = 1;
            q.push((node){i, 0, 1});
        }
    }
    vis[0] = 1;
    int s1 = 0;
    while (q.size()) {
        node t = q.top(); q.pop();
        if (vis[t.x] || t.s1 != sum1[t.x] || t.s0 != sum0[t.x]) continue;
        int x = t.x;
        vis[x] = 1;
        int y = getfa(p[x]);
        if (vis[y]) {
            ans += f[x] + 1ll * s1 * sum0[x];
            s1 += sum1[x];
        } else {
            f[y] += f[x] + 1ll * sum1[y] * sum0[x];
            sum0[y] += sum0[x];
            sum1[y] += sum1[x];
            q.push((node){y, sum0[y], sum1[y]});
            merge(x, y);
        }
    }
    printf("%lld\n", ans);
    return 0;
}


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

using namespace std;

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;

#define INF (1e9)

// テンプレート関数
#define REP(i, x, n) for (int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)

int main()
{
    int X, A;
    cin >> X >> A;
    int ans = 0;

    if (X >= A) {
        ans = 10;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
/* 
    Author - linpaws07 
*/
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define inf (int)1e9
#define f first
#define s second
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define scd(t) scanf("%d",&t)
#define sclld(t) scanf("%lld",&t)
#define scc(t) scanf("%c",&t)
#define scs(t) scanf("%s",t)
#define scf(t) scanf("%f",&t)
#define sclf(t) scanf("%lf",&t)
#define memst(a, b) memset(a, (b), sizeof(a))
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int,int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rp(i,n) for(int i=0;i<(n);i++)
#define fr(i,a,b) for(int i=(a);i<(b);i++)
#define fre(i,a,b) for(int i=(a);i<=(b);i++)
#define frd(i,a,b) for(int i=(a);i>=(b);i--)
inline bool eq(double a, double b) { return fabs(a-b) < 1e-9; }
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
auto start = high_resolution_clock::now();
inline void measure();

int h[100002];
int dp[100002];
int main(){
    FAST
    //Do awesome things here
    int n, k;
    cin >> n >> k;
    rp(i, n){
        cin >> h[i];
    }
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    fr(i, 2, n){
        int ans = inf;
        fre(j, 1, k){
            if(i - j < 0)  break;
            ans = min(dp[i - j] + abs(h[i] - h[i - j]), ans);
        }
        dp[i] = ans;
    }
    cout << dp[n - 1] << endl;
    return 0;
}


inline void measure(){
    auto stop = high_resolution_clock::now(); 
    auto duration = duration_cast<milliseconds>(stop - start);
    cout << duration.count() << endl;
}

Measured memory_bytes: 1024
N = gets.to_i
as = gets.split.map(&:to_i)

ans = 1
while as.length > 1
    if as[0] == as[1]
        as.shift
        next
    elsif as[0] > as[1]
        while as[0] >= as[1]
            as.shift
            break if as.length < 2
        end
        as.shift
        ans += 1 if as.length > 0
    else
        while as[0] <= as[1]
            as.shift
            break if as.length < 2
        end
        as.shift
        ans += 1 if as.length > 0
    end
end
puts ans

Measured memory_bytes: 8460
import sys

def main():
    input = sys.stdin.readline
    AB = list(map(int, input().split()))
    A = AB[0]
    B = AB[1]

    if A >= 10 or B >= 10:
        ans = -1
    else:
        ans = A * B
    print(ans)


if __name__ == '__main__':
    main()

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

int main() {
	int r, c; cin >> r >> c;
	int s[110][110];

	for (int i = 0; i < r; ++i) {
		for (int j = 0; j < c; ++j) cin >> s[i][j];
	}

	for (int j = 0; j < c; ++j) {
		int sum = 0;
		for (int i = 0; i < r; ++i) {
			sum += s[i][j];
		}
		s[r][j] = sum;
	}
	for (int i = 0; i < r; ++i) {
		int sum = 0;
		for (int j = 0; j < c; ++j) {
			sum += s[i][j];
		}
		s[i][c] = sum;
	}
	int sum = 0;
	for (int j = 0; j < c; ++j) sum += s[r][j];
	s[r][c] = sum;

	for (int i = 0; i <= r; ++i) {
		for (int j = 0; j <= c; ++j) {
			cout << s[i][j];
			if (j != c) cout << " ";
		}
		cout << endl;
	}
}


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

ll a, b; //2,5
int main()
{
    ll n;
    cin >> n;
    a = b = 0;
    if (n % 2 == 0)
    {
        a = n / 2;
        n /= 2;
        ll now = 5;
        while (now <= n)
        {
            b += n / now;
            now *= 5;
        }
        now = 2;
        while (now <= n)
        {
            a += n / now;
            now *= 2;
        }
        printf("%lld\n", min(a, b));
    }
    else
    {
        printf("0\n");
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)


ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oie(ll x){ cout << x << endl; }
void ode(ld x){ cout << fixed << setprecision(10) << x << endl; }
void ose(string x){ cout << x << endl; }
void oe(){ cout << endl; }

// 素因数分解
void fp(ll N, map<ll,ll> &d){
    if(N==1){ return; }
    ll n=N;
    for(ll i=2;;i++){
        while(n%i==0){ n/=i; d[i]++; }
        if(n==1){ break; }
        if(i*i>=N){ d[n]++; break; }
    }
}

int main(){
    ll N=ii();
    map<ll,ll> d;
    fp(N, d);
    ll ret=0;
    for(auto [p,c]:d){
        for(int i=1;;i++){
            if(c>=i){
                ret++;
                c-=i;
            }else{
                break;
            }
        }
    }
    oie(ret);

    return 0;
}

Measured memory_bytes: 3632
import itertools
import math

N=int(input())
X=[]
Y=[]
dist=[ [ 0 for j in range(N) ] for i in range(N) ]
for n in range(N):
  x,y=map(int,input().split())
  X.append(x)
  Y.append(y)

for i in range(N):
  for j in range(N):
    dist[i][j]=math.sqrt( (X[i]-X[j])**2 + (Y[i]-Y[j])**2 )

l=[ i for i in range(N) ]
P=itertools.permutations(l,N)
ans=0
for p in P:
  p=list(p)
  for i in range(N-1):
    ans+=dist[p[i]][p[i+1]]
print(ans/math.factorial(N))

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

const int MAXN = 2e3 + 5;
int a[MAXN];

bool check(int a, int b, int c){
    return (a < b + c) && (b < a + c) && (c < a + b);
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a, a + n);
    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            int l = j, r = n;
            while(r - l > 1){
                int mid = (l + r) >> 1;
                if(check(a[i], a[j], a[mid]))l = mid;
                else r = mid;
            }
            ans += l - j;
        }
    }
    cout << ans << endl;
    return 0;
}

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


ls = [0]*n
param_list = [0]*2**n
for i in range(2**n):
    l = [False]*n
    for id_r, row in enumerate(ls):
        if i & (2 ** id_r) >0:
            l[id_r] = True
    param_list[i] = l 

count = 0    

k_list = [list(map(int, input().split())) for _ in range(m)]
ps = list(map(int, input().split()))



for param in param_list:
    for i in range(m):
        tr_num = 0
        for a in range(1,k_list[i][0]+1):
            if param[k_list[i][a]-1]:
                tr_num +=1
            else:
                continue
        if tr_num % 2 is ps[i]:
            if i == m-1:
                count +=1
                
            else:
                continue
        else:
            break

print(count)
    

Measured memory_bytes: 9280
#!/usr/bin/python3
import copy

(n, k) = map(int, input().split())

a = tuple(map(lambda x: int(x) - 1, input().split()))

ct = 0
tt = {}
tl = []

tt[ct] = 0
tl = [ ct ]

rs = 0
rc = 0

for i in range(1, k + 1):
    ct = a[ct]

    if ct in tt:
        rs = tt[ct]
        rc = i - rs
        break
    else:
        tt[ct] = i
        tl.append(ct)
    
else:
    #print(tl)
    print(tl[-1] + 1)
    exit()


k = k - rs
km = k % rc
#print(tl, rs, rc)
print(tl[rs + km] + 1)



Measured memory_bytes: 120800
#include <iostream>

using namespace std;

int main()
{
	int colors_count[9] = {0,0,0,0,0,0,0,0,0},n;
	cin >> n;
	int input;
	for(int i=0;i < n;i ++)
	{
		cin >> input;
		if(input < 3200)
		{
			for(int j=0;j < 8;j ++)
			{
				if(j*400 <= input && input < (j+1)*400)
				{
					colors_count[j] ++;
				}
			}
		}
		else
		{
			colors_count[8] ++;
		}
	}

	int max_type = 0,min_type = 0;
	for(int i=0;i < 8;i ++)
	{
		if(colors_count[i])
		{
			min_type += 1;
		}
	}

	max_type = min_type;
	
	if(min_type == 0 && colors_count[8])
	{
		min_type = 1;
	}

	max_type += colors_count[8];
	
	cout << min_type << " " << max_type << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;

int main(){
  ll N;
  cin>>N;
if(N==1){cout<<0<<endl;}
if(N>=2){
ll ans10=1;
ll ans9=1;
ll ans8=1;
ll NUM=10e8+7;
  for(ll i=0;i<N;i++){
  ans10=ans10*10;
  ans10=ans10%NUM;
  ans9=ans9*9;
  ans9=ans9%NUM;
  ans8=ans8*8;
  ans8=ans8%NUM;
  }
  
  
  ll ans=ans10-2*ans9+ans8;
  ans=ans%NUM;
  if(ans<0){ans=ans+NUM;}
  cout<<ans<<endl;
}
  

}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REPZ(i, z, n) for(decltype(n) i = (z); i < (n); i++)
#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(all(v)))
#define MIN(v) (*min_element(all(v)))
#define INF 1000000000000 //1E+12
#define MOD 1000000007    //合同式の法

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<

typedef long long ll;
typedef unsigned long long ul;
// 1s間で可能なループ回数2E+8回
// intの最大値2147483647~2E+9
// long longの最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<> push_back
// 連想配列map<key,value> insert,
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 setprecision()
// to_string<->stoi
// stoll(longlong)
// stod(double)
// 大文字65-90(-32)
// 小文字97-122(+32)
using namespace std;
const ll mod=1000000000+7;

int main(){
  // faster
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n,k; cin >> n >> k;
  ll res=0;
  for(ll i=k;i<=n+1;i++){
    res+=i*(2*n+1-i)/2-i*(i-1)/2+1;
    res%=mod;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3660
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
	string s[3];
	for(int i=0;i<3;i++){
		cin >> s[i];
	}
	cout << s[0][0] << s[1][1] << s[2][2] << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String t = sc.nextLine();
    if (t.matches(s + ".")) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 38648
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#define endl '\n'
#define ll long long
#define pb push_back
#define pi 3.14159265358979323846264338327950288419716939937510
#define RUN_FAST ios::sync_with_stdio(false);
#define sz 100
using namespace std;

int main()
{
    RUN_FAST;
    ll n, x, tmp, i, j, cnt;
    ll sum=0;
    vector <ll> v;
    cin >> n;
    tmp=n;
    while (tmp--) {
        cin >> x;
        sum+=x;
        v.push_back(x);
    }
    ll arr[100110]={0};
    sort(v.begin(), v.end());
    for (i=0; i<n; i++) {
        cnt=1;
        tmp=v[i];
        for (j=i+1; j<n; j++) {
            if (v[j]!=tmp) {
                break;
            }
            cnt++;
        }
        arr[tmp]=cnt;
        i=j-1;
    }
    ll q, a, b;
    cin >> q;
    while (q--) {
        cin >> a >> b;
        tmp=arr[a];
        sum-=tmp*a;
        sum+=tmp*b;
        arr[b]=arr[b]+tmp;
        arr[a]=0;
        cout << sum << endl;
    }
    v.clear();
    return 0;
}


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

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

int main() {
    //cout.precision(10);
    vector<int> a(3);
    for(int i = 0; i < 3; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    cout << 10 * a[2] + a[1] + a[0] << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 標準入力を取得
N = int(input())

# 求解処理


def S(n: int) -> int:
    return sum(map(int, str(n)))


ans = str()
if N % S(N) == 0:
    ans = "Yes"
else:
    ans = "No"

# 結果出力
print(ans)


Measured memory_bytes: 9152
from math import sqrt

x1, y1, r1 = map(float, input().split())
x2, y2, r2 = map(float, input().split())

d = sqrt((x1 - x2)**2 + (y1 - y2)**2)
g = max(r1 - r2, r2 - r1)

if d <  g:
    print(0)

if d == g:
    print(1)

if d >  g:
    if d <  r1 + r2: print(2)
    if d == r1 + r2: print(3)
    if d >  r1 + r2: print(4)


Measured memory_bytes: 5648
n = int(input())
cout = ""
for i in range(1, n+1):
	x = i
	if x % 3 == 0:
		cout += " " + str(i)
	else:
		while x:
			if x % 10 == 3:
				cout += " " + str(i)
				break
			x //= 10
print(cout)

Measured memory_bytes: 7676
#include<stdio.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<sstream>
#include<math.h>
#define FOR(i,a) for(int i=0;i<a;i++)
using namespace std;
int main() {
	int n, m;
	cin >> n >> m;
	int a[n];
	int b[m];
	int ans[n];
	int maxcount = 0;
	FOR(i, n) {
		cin >> a[i];
		ans[i] = 0;
	}
	FOR(i, m) {
		cin >> b[i];
		FOR(j, n) {
			if (a[j] <= b[i]) {
				ans[j]++;
				break;
			}
		}
	}
	int pos = 0;
	FOR(i, n) {
		if (maxcount < ans[i]) {
			maxcount = ans[i];
			pos = i;
		}
	}
	cout << pos + 1 << endl;
	return 0;
}

Measured memory_bytes: 3092
#include <stdio.h>

int main(void){
    int h,n;
    scanf("%d %d",&h,&n);
    int a[n];
    int i;
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    int sum=0;
    for(i=0;i<n;i++){
        sum += a[i];
    }
    if(sum>=h){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int x, y;
  cin >> x >> y;
  cout << x + y / 2 << endl;

  return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

priority_queue<int, vector<int>, greater<int>> qmaxv;
priority_queue<int> qminv;
const int INF = 1e6;
ll max_sum[INF + 1], min_sum[INF + 1], maxv = 0, minv = 0;
ll a[INF], ans = -1e16;

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

    rep(i, 3 * n) cin >> a[i];

    rep(i, n)
    {
        qmaxv.push(a[i]);
        qminv.push(a[2 * n + i]);
        maxv += a[i];
        minv += a[2 * n + i];
    }
    max_sum[0] = maxv, min_sum[n] = minv;
    rep(i, n)
    {
        qmaxv.push(a[n + i]);
        maxv = maxv + a[n + i] - qmaxv.top();
        max_sum[i + 1] = maxv;
        qmaxv.pop();
        qminv.push(a[2 * n - 1 - i]);
        minv = minv + a[2 * n - 1 - i] - qminv.top();
        min_sum[n - 1 - i] = minv;
        qminv.pop();
    }

    rep(i, n + 1) ans = max(ans, max_sum[i] - min_sum[i]);

    OP(ans);

    return 0;
}

Measured memory_bytes: 13556
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int rb = sc.nextInt();
		int bb = sc.nextInt();
		String U = sc.next();
		sc.close();
		if (U.equals(S)) {
			rb--;
		}
		if(U.equals(T)) {
			bb--;
		}
		System.out.println(rb + " " + bb);
	}

}


Measured memory_bytes: 23380
N, M = map(int, input().split())
L = [0] * M
R = [0] * M

for i in range(M):
    L[i], R[i] = map(int, input().split())
LL = max(L)
RR = min(R)
ans = 0
for i in range(N):
    if LL <= i + 1 <= RR:
        ans += 1
    else:
        pass
print(ans)

Measured memory_bytes: 10868
#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>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = 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 PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
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;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

LL S, C;

int main(void) {
    cin >> S >> C;
    LL ans = min(S, C / 2);
    S -= ans; C -= ans * 2;
    ans += C / 4;
    cout << ans << endl;
}


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

typedef long long lli;
typedef vector<int> Vi;
typedef vector<lli> Vl;
typedef pair<int, int> Pii;
typedef pair<lli, lli> Pll;


//===

const int MOD = (int)1e9 + 7;


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

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

	Vl dp(X + 1);
	for (int x = 0; x <= X; ++x) dp[x] = x;

	for (int i = 0; i < N; ++i) {
		for (int x = X; x >= 0; --x) {
			dp[x] = (dp[x % S[i]] + i * dp[x]) % MOD;
		}
	}

	cout << dp[X] << endl;
}

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

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

#define X() real()
#define Y() imag()
#define x(p) (p).X()
#define y(p) (p).Y()
#define SZ(P) (int)(P.size())
#define curr(P, i) P[(i)%SZ(P)]
#define next(P, i) P[(i+1)%SZ(P)]
#define prev(P, i) P[(i+SZ(P)-1)%SZ(P)]?´

using D = double;
using P = complex<D>;
namespace std {
  bool operator < (const P& a, const P& b) {
    return x(a) != x(b) ? x(a) < x(b) : y(a) < y(b);
  }
}
D dot(const P& a, const P& b) {
  return x(conj(a)*b);
}
D cross(const P& a, const P& b) {
  return y(conj(a)*b);
}
int ccw(P a, P b, P c) {
  b -= a;
  c -= a;
  if(cross(b, c) > 0) return +1;
  if(cross(b, c) < 0) return -1;
  if(dot(b, c) < 0) return +2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}
const D EPS = 1e-8;
const D PI = acos(-1);

struct C {
  P p;
  D r;
};

P makeP(D arg, D r=1.0) {
  return r * P{cos(arg), sin(arg)};
}
P rotP(const P& p, D arg) {
  return p * makeP(arg);
} 

vector<P> getNorm(const P& p) {
  return {rotP(p, PI/2.0)/abs(p), rotP(p, -PI/2.0)/abs(p)};
}

vector<C> makeC(const P& a, const P& b, D r = 1.0) {
  P m = (a+b)/2.0;
  D d = sqrt(r*r-abs(m-a)*abs(m-a));
  auto ps = getNorm(b-a);
  rep(i, 2) ps[i] = d*ps[i]+m;
  vector<C> ret;
  rep(i, 2) ret.push_back(C{ps[i], r});
  return ret;
}
bool include(const C& c, const P& p) {
  return abs(c.p-p) < c.r+EPS;
}

int main() {
  int n;
  while(cin >> n && n) {
    vector<P> ps(n);
    rep(i, n) {
      D x, y;
      cin >> x >> y;
      ps[i] = P{x, y};
    }
    int ans = 1;
    rep(i, n) rep(j, i) {
      auto cs = makeC(ps[i], ps[j]);
      for(auto& c : cs) {
	int tmp = 0;	
	rep(k, n) if(include(c, ps[k])) tmp++;
	ans = max(ans, tmp);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3376