akhauriyash/Code-Regression huggingface dataset:
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
//#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

bool s(int n){
    int a=n%10;
    while(n){
        if(n%10!=a)return 0;
        n/=10;
    }
    return 1;
}

signed main (){
    int x,y,xx,yy;
    cin>>x>>y>>xx>>yy;
    int dx=xx-x; int dy=yy-y;
    cout<<xx-dy<<" ";
    cout<<yy+dx<<" ";
    cout<<x-dy<<" ";
    cout<<y+dx;
    cout<<endl;


    
}
/*
1-21-2
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define DEC(i, a, b) for (int i = (a); i > (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  string S = {"ACGT"};
  string P = {"TGCA"};
  string b;
  cin >> b;
  cout << P[S.find(b)] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  int a, b;
  cin >> a  >> b;

  if((a * b) % 2 == 0){
    cout << "Even" << endl;
  }
  else{
    cout << "Odd" << endl;
  }

  return 0;
}


Measured memory_bytes: 888
import copy
N=int(input())
n=(N//2)*2
g=[set() for i in range(N)]
tmp={i for i in range(n)}
for i in range(n):
  g[i]=copy.copy(tmp)
  g[i].remove(i)
  g[i].remove(n-1-i)
count=0
if N%2!=0:
  g[N-1]=copy.copy(tmp)
  for i in range(N-1):
    g[i].add(N-1)
for i in range(N):
  count+=len(g[i])
print(count//2)

for i in range(N):
  for x in g[i]:
    print(i+1,x+1)
    g[x].remove(i)

Measured memory_bytes: 4504
using System;
    using System.Collections.Generic;
    using System.Linq;

    class Program
    {
        static void Main(string[] args)
        {
            //input
            string[] input = Console.ReadLine().Split(' ');
            int k = int.Parse(input[0]);
            int n = int.Parse(input[1]);
            string[] input2 = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(input2[i]);
            }

            int[] sa = new int[n];
            for (int i = 0; i < n -1 ; i++)
            {
                sa[i + 1] = a[i + 1] - a[i];
            }
            //sa[0] = a[0] - 0;
            //sa[n] = k - a[n-1];
            sa[0] = a[n - 1] - a[0];

            sa[0] = sa[0] > k / 2 ? k - sa[0] : sa[0];

            //var list = new List<int>();
            //list.AddRange(sa);
            //var list = new List<int>();
            //for (int i = 0; i < sa.Length; i++)
            //{
            //    //if (sa[i] == 0 || sa[i] == k) continue;
            //    if (sa[i] > k / 2 )
            //    {
            //        sa[i] = k - sa[i];
            //    }
            //    list.Add(sa[i]);
            //}

            //if (!list.Any())
            //{
            //    Console.WriteLine(0);
            //    return;
            //}
            //int[] new_sa = list.ToArray();
            Array.Sort(sa);
            int ans = 0;
            //int sikoukaisuu = n == 2 ? 2 : n - 1;
            for (int i = 0; i < n - 1; i++)
            {
                ans += sa[i];
            }

            Console.WriteLine(ans);
        }
    }

Measured memory_bytes: 34652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
/*
string S_str[H];
cins(S_str, S_str + H);
S_str[i][j];
*/
inline int at(ll x, int k){ return (x >> k) & 1; }
#define rep(i, n) for(ll i = 0; i < n; i++)


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

}


Measured memory_bytes: 256
s=list(input())
counts=0
lists=[]
a=len(s)
for i in range (1,a+1):
    if s[i-1]=='A':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='G':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='T':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='C':
        counts=counts+1
        lists.append(counts)
    else:
        counts=0
lists.sort()
k=len(lists)
if k==0:
    print(0)
else:
    print(lists[k-1])

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

using namespace std;

#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vi>

typedef long long ll;

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

int main() {
  ll A, B, C, D, ans = 0;
  cin >> A >> B >> C >> D;
  ll tmp = C * D / gcd(C, D);
  A -= 1;
  ans = B - (B / C + B / D - (B / tmp));
  ans -= A - ((A / C + A / D - A / tmp));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>

#include <algorithm>
#include <functional>
#include <vector>

using namespace std;

typedef long long ll;

const int N = 100010;

int n;
int a[N], b[N];
ll need;
vector<int> give;

int main() {
  scanf("%d", &n);
  int cnt = 0;
  for (int i = 0; i < n; ++i)
    scanf("%d", &a[i]);
  for (int i = 0; i < n; ++i)
    scanf("%d", &b[i]);
  while (n--) {
    if (a[n] <= b[n]) {
      if (a[n] < b[n])
        ++cnt;
      need += b[n] - a[n];
    } else
      give.push_back(a[n] - b[n]);
  }
  sort(give.begin(), give.end(), greater<int>());
  int cur = 0;
  while (cur < give.size() && need > 0) {
    need -= give[cur++];
  }
  if (need <= 0)
    printf("%d\n", cnt + cur);
  else
    puts("-1");
  return 0;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 100010
ll a[N], n, k;

int main(){
	cin>>n>>k;
	rep(i, n) cin>>a[i];
	ll cnt = 0, cnt2 = 0;
	rep(i, k) cnt2 += a[i];
	for(int i = k; i < n; i++) if(a[i]>0) cnt += a[i];
	ll res = cnt+max(cnt2, 0LL);
	for(int i = k; i < n; i++){
		cnt2 = cnt2+a[i]-a[i-k];
		if(a[i]>0) cnt -= a[i];
		if(a[i-k]>0) cnt += a[i-k];
		chmax(res, cnt+max(cnt2, 0LL));
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
	using namespace std;
	#define xxx ios::sync_with_stdio(),cin.tie(0),cout.tie(0)
	#define rep(i,n) for(int i=0;i<n;i++)
	#define int long long
	int bp(int a, int b, int m) {
   		a %= m;
   		int res = 1;
    	while (b > 0) {
        	if (b & 1)
            	res = res * a % m;
       		a = a * a % m;
       	 	b >>= 1;
 	    }
    return res;
	}
	int max(int a, int b){
		return (a>b)?a:b;	
	}
	int csb( int n) 
{ 
    int count = 0; 
    while (n) { 
        count += n & 1; 
        n >>= 1; 
    } 
    return count; 
} 
	int solve(int x){
		int r=0;
		while(x>0){
			int t=csb(x);
			x%=t;
			r++;
		}
		return r;
	}

	signed main(){
		int test=1;
		//cin>>test;
		while(test--){
			int n;
			cin>>n;
			string s;
			cin>>s;
			int tn=1;
			for(int i=1;i<n;i++){
				if(s[i]!=s[i-1]) tn++;
			}
			cout<<tn<<endl;
		}
		return 0;
	}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
    int N, M;
    cin >> N >> M;
    map<int, int> modM;
    vector<int> A(N);
    vector<int> SUM(N + 1);
    SUM[0] = 0;
    rep(i, N)
    {
        cin >> A[i];
        SUM[i + 1] = SUM[i] + A[i];
        SUM[i + 1] %= M;
    }
    long long ans = 0;
    rep(i, N + 1)
    {
        ans += modM[SUM[i]];
        modM[SUM[i]]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  vector<string> S(2),T(2);
  cin>>S[0]>>S[1];
  T[0]=S[1];
  T[1]=S[0];
  reverse(ALL(T[0]));
  reverse(ALL(T[1]));
  string ans="NO";
  if(S[0]==T[0]&&S[1]==T[1])
    ans="YES";
  cout<<ans;
  }


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

int main(){
  int n;
  cin >> n;
  map<string,int> poll;
  string s;
  
  int pmax=0;
  
  for(int i=0; i<n; i++){
    cin >> s;
    poll[s]++;
    pmax = max(pmax, poll[s]);
  }
  
  for(auto m : poll){
    if(m.second==pmax)
      cout << m.first << endl;
  }
  
  return 0;
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define testcase ll T; cin >> T; for (ll tc = 1; tc <= T; tc++)
#define M 1000000007
#define MM 2000000000000000000
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
#define r2 1.41421356237
ll powmod(ll a,ll b,ll mod) {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 gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  //testcase {
  ll a,b,c,d,ans,anss=-MM;
  cin>>a>>b>>c>>d;
  ans=a*c; anss=max(ans,anss);
 ans=a*d; anss=max(ans,anss);
 ans=c*b; anss=max(ans,anss);
 ans=b*d; anss=max(ans,anss);
 cout<<anss;
  //}
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<utility>
using namespace std;

typedef long long int lli;

int nlist[100];
int N,A;  
lli dp[60][3000][60];

int main(){
  cin>>N>>A;
  for(int i=0;i<N;i++){
    cin>>nlist[i];
  }
  dp[0][0][0] = 1;
  
  for(int i=0;i<N;i++){
    for(int j=0;j<3000;j++){
      for(int k=0;k<N;k++){
	dp[i+1][j][k] += dp[i][j][k];
	if(j + nlist[i] < 3000)
	  dp[i+1][j + nlist[i]][k + 1] += dp[i][j][k];
      }
    }
  }
  lli ans = 0;
  for(int i=0;i<3000;i++){
    for(int j=1;j<=N;j++){
      if(j*A == i)
	ans += dp[N][i][j];
    }
  }
    
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 70528
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
using static AtCoder.Program;
 
namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new ABC134().SolveB(new ConsoleInput(Console.In, ' '));
        }
    }
 
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
 
    }
  class ABC134
    {
        public void SolveB(ConsoleInput cin)
        {
            var n = cin.ReadInt;
            var d = cin.ReadInt;
            WriteLine(Ceiling(n / (2.0 * d + 1)));
            ReadLine();
        }
    }
}

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

int main() {
	string a, b;
	cin >> a >> b;
	
	b.pop_back();
	if (a == b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

int main(){
	int n;
	cin >> n;
	int time[1000000] = { };
	for(int i = 0; i < n; i++){
		int m;
		cin >> m;
		time[m + 2]++;
		time[m + 1]++;
		time[m]++;
	}
	int ans;
	int max = 0;
	for(int i = 0; i < 1000000; i++){
		if(max < time[i]){
			ans = i;
			max = time[i];
		}
	}
	cout << time[ans] << endl;
}

Measured memory_bytes: 4096
import Control.Monad (replicateM)

reachable :: [[Int]] -> Bool
reachable (p0:p1:[]) = reach p0 p1
reachable (p0:p1:ps) = reach p0 p1 && reachable (p1:ps)

reach :: [Int] -> [Int] -> Bool
reach [t0,x0,y0] [t1,x1,y1] = accessible && sameParity
  where
    tick = t1 - t0
    shortest = abs (x1 - x0) + abs (y1 - y0)
    accessible = shortest <= tick
    sameParity = (shortest + tick) `mod` 2 == 0

main :: IO ()
main = do
  n <- readLn
  ps <- replicateM n (map read . words <$> getLine)
  putStrLn $ if reachable ([0,0,0]:ps) then "Yes" else "No"


Measured memory_bytes: 81276
# include <bits/stdc++.h>
using namespace std;
# define eps 1e-8
# define INF 1e20
# define pi  acos(-1.0)
# define MX  105
struct Node
{
    double t,v;
    double ev; //从重点的最大速度
}seg[MX];

int n;
double spd, ans;

void gogo(int x)
{
    double l=0, r=seg[x].t;
    double res = 0;
    while (l<r-eps) // <
    {
        double mid = (l+r)/2;
        if (mid + spd > seg[x].v-eps)
        {
            if ((seg[x].v - seg[x+1].ev) + mid < seg[x].t+eps)
            {
                res = mid;
                l = mid;
            }
            else r = mid;
        }
        else
        {
            if (mid + spd - (seg[x].t-mid) - seg[x+1].ev < -eps) //<=
            {
                res = mid;
                l = mid;
            }
            else r = mid;
        }
    }

    double jia, yun, jian;
    if (spd + res < seg[x].v)
    {
        jia = res;
        yun = 0;
        jian = seg[x].t - jia;
    }
    else
    {
        jia = seg[x].v - spd;
        yun = res - jia;
        jian = seg[x].t - jia - yun;
    }
    ans += 1.0/2.0*jia*jia + spd * jia;
    ans += yun * seg[x].v;

    if (res+spd < seg[x].v)
    {
        ans += -1.0/2.0*jian*jian +  (spd+jia) * jian;
        spd = spd + jia - jian;
    }
    else
    {
        ans += -1.0/2.0*jian*jian +  seg[x].v * jian;
        spd = seg[x].v - jian;
    }

}

int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
        scanf("%lf",&seg[i].t);
    for (int i=1;i<=n;i++)
        scanf("%lf",&seg[i].v);
    spd=0.0;
    for (int i=n;i>=1;i--)
    {
        if (spd+seg[i].t < seg[i].v+eps) //<=
            spd += seg[i].t;
        else
            spd = seg[i].v;
        seg[i].ev = spd;
    }
    ans = 0;
    spd = 0;
    seg[n+1] = (Node){0.0, 0.0, 0.0};

    for (int i=1;i<=n;i++)
    {
        gogo(i);
    }
    printf("%.5f\n",ans);
    return 0;
}


Measured memory_bytes: 256
from collections import Counter, defaultdict
n = int(input())
s = [input() for i in range(n)]

cnt = defaultdict(lambda :[0, 0])
for S in s:
    temp = Counter(S)
    for key, val in temp.items():
        if cnt[key] == [0, 0]:
            cnt[key] = [val, 1]
            continue
        if cnt[key][0] > val:cnt[key][0] = val
        cnt[key][1] = cnt[key][1] + 1

ans = []
for key, val in cnt.items():
    if val[1] == n:
        ans += key * val[0]
print(*sorted(ans), sep='')
#print(cnt)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define ll long long int
#define fip ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define reptUsual(b) for(i=0; i<b; ++i)
#define reptArIn(i,a,b,ar) for( i=a; i<b; ++i) cin>>ar[i];
#define rept(i,a,b) for(i=a; i<b; ++i)
#define maX(a,b)    ( (a) > (b) ? (a) : (b))
#define miN(a,b)    ( (a) < (b) ? (a) : (b))
#define pb(a) push_back(a)
using namespace std;

int main()
{
    fip;
    int n,x,a,i,sum=0,c=0;
    cin>>n>>x;
    reptUsual(n)
    {
        cin>>a;
        sum+=a;
        if(sum<=x)
            c++;
    }
    cout<<c+1;

    return 0;

}

Measured memory_bytes: 256
def div_minus2(n: int)->tuple:
    """n を -2 で割ったときの商とあまりを計算する。
    """
    d = n // (-2)
    r = n % (-2)
    if r == -1:
        return d+1, 1
    return d, r


def base_2number(N: int) -> int:
    if N == 0:
        return '0'
    # N > 0
    s = ''
    while N != 0:
        d, r = div_minus2(N)
        N = d
        s = str(r) + s

    return s


if __name__ == "__main__":
    N = int(input())
    ans = base_2number(N)
    print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ff              first
#define ss              second
#define f(i,n)          for(int i=0;i<n;i++)
#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define rightmostbit(x) __builtin_ffsll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         cout << fixed; cout << setprecision(x); cout << y;
#define pi              3.141592653589793238
#define mk(a,n)         int n;cin>>n;vi a(n);for(int i=0;i<n;i++) cin>>a[i]
#define w(x)            int x; cin>>x; while(x--)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
typedef tree<pii, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void g_b()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
}
int32_t main()
{
	g_b();
	int n; cin >> n;
	if (n >= 30) cout << "Yes";
	else cout << "No";

	return 0;

}



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

using namespace std;

int main(void){
  int N;
  cin >> N;
  vector<int> C(N), S(N), F(N);
  for(int i = 0; i < N - 1; i++) cin >> C[i] >> S[i] >> F[i];
  C[N - 1] = 0;
  S[N - 1] = 0;
  F[N - 1] = 1;
  for(int i = 0; i < N; i++){
    int t = 0;
    for(int j = i; j < N - 1; j++){
      if(t >= S[j]) t = C[j] + F[j] * ((t + F[j] - 1) / F[j]);
      else t = S[j] + C[j];
    }
    cout << t << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc=new Scanner(System.in);
        boolean b=true;
        int n=sc.nextInt();
        long l=1000000000;
        l*=l;
        long po=1;
        for(int i=0;i<n;i++){
            if(po==0){
                break;
            }else{
                long a=sc.nextLong();
                if((l/po>=a)){
                    po*=a;
                }else{
                    b=false;
                }
            }
        }
        System.out.println(b?po:(po==0)?0:-1);
    }
}


Measured memory_bytes: 59988
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  int D,N,a=0;
  cin >>D >>N;
  if(D==0){
    for(int i=1;i<=N;i++){
      if(i%100==0){
        a++;
      }
    }
    cout << N+a;   
  }else if(D==1){
    for(int i=1;i<=N*100;i++){
      if(i%10000==0){
        a += 100;
      }
    }
    cout << N*100+a;
  }else{
   for(int i=1;i<=N*10000;i++){
      if(i%1000000==0){
        a += 10000;
      }
    }
    cout << N*10000+a;
  }  
}

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

int main() {

  int A,B;
  cin >> A >> B;
  
  if((A%3==0)||(B%3==0)||((A+B)%3==0)){
  cout << "Possible" << endl;
  }else{
    cout  << "Impossible" << endl;
  }

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}



int main() {
	int a, b, c,d; cin >> a;
	//string s,t,u; cin >> s>>t>>u;
	//vector<int> n(3);
	cout << a * (a + 1) / 2;
	

	cout << endl;
	return 0;
}

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

using namespace std;

#define ll long long

ll gcd(ll a, ll b){
	if (b == 0) {
		return a;
	} else {
		return gcd(b, a%b);
	}
}

ll lcm(ll a, ll b) {
	ll qwer = gcd(a, b);
	return a/qwer*b;
}

void solve() {
	int n;
	cin >> n;
	ll ans = 1LL;
	for (int i = 0; i < n; i++) {
		ll a;
		cin >> a;
		ans = lcm(ans, a);
	}
	cout << ans << "\n";
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}



Measured memory_bytes: 3696
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramE
    {
        static void Main()
        {
            int n = NextInt, m = NextInt;
            var array = Enumerable.Range(1, m).Select(i => new int[]{i, i}).ToArray();
            var used = Enumerable.Repeat(false, n).ToArray();

            int now = m + 1;
            for (int i = m - 1; i >= 0 ; i--)
            {
                while (used[now - array[i][0]] || used[n - now + array[i][0]] || now - array[i][0] == n - now + array[i][0])
                {
                    now++;
                }

                used[now - array[i][0]] = true;
                used[n - now + array[i][0]] = true;
                array[i][1] = now++;
            }

            System.Console.WriteLine(string.Join("\n", array.Select(l => $"{l[0]} {l[1]}")));
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


Measured memory_bytes: 44752
N = int(input())
A = [int(k) for k in input().split()]
B = [int(j) for j in input().split()]
D = [0] * (N+1)
for i in range(N):
	if A[i] >= B[i]:
		D[i]+=B[i]
	else:
		D[i]+=A[i]
		C = B[i]-A[i]
		if A[i+1] >= C:
			D[i+1]+=C
			A[i+1]-=C
		else:
			D[i+1]+=A[i+1]
			A[i+1]=0

print(sum(D))


Measured memory_bytes: 19156
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
string s[5];
int main()
{
	int n,out=0;
	cin>>n;
	rep(i,3) cin>>s[i];
	rep(i,n){
		string t="";
		rep(j,3) t+=s[j][i];
		sort(All(t));
		rep(j,2){
			if(t[j]!=t[j+1]) out++;
		}
	}
	cout<<out<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n = int(input())
a = [int(item) for item in input().split()]
b = [int(item) for item in input().split()]

odd_bit = 0b0101010101010101010101
eve_bit = 0b1010101010101010101010
full_bit = 2**n - 1

odd_num = (n + 1) // 2
ans = 10**9 

for i in range(2**n):
    invi = full_bit ^ i
    odd = bin(i & odd_bit).count("1") + bin(invi & eve_bit).count("1")
    if odd != odd_num:
        continue
    odd_card = []
    eve_card = []
    for j in range(n):
        if i & 1 << j:
            if j % 2 == 0:
                odd_card.append((a[j], j))
            else:
                eve_card.append((a[j], j))
        else:
            if j % 2 == 0:
                eve_card.append((b[j], j))
            else:
                odd_card.append((b[j], j))
    odd_card.sort()
    eve_card.sort()
    odd_itr = 0
    eve_itr = 0
    curr = 0
    val = 0
    ok = True
    perm = []
    for i in range(n):
        if i % 2 == 0:
            num, index = odd_card[odd_itr]
            perm.append(index)
            odd_itr += 1
        else:
            num, index = eve_card[eve_itr]
            perm.append(index)
            eve_itr += 1
        if num < curr:
            ok = False
            break
        curr = num
    if ok:
        val = 0
        visited = [0] * n
        itr = 0
        for item in perm:
            visited[item] = 1
            val += itr - sum(visited[:item])
            itr += 1
        ans = min(ans, val)

if ans == 10**9:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 53468
# coding: utf-8


def main():
    n, m = map(int, raw_input().split())

    s = [0] * 200010
    t = [0] * 200010
    for _ in xrange(m):
        a, b = map(int, raw_input().split())
        if a == 1:
            s[b] = True
        if b == n:
            t[a] = True

    for i in xrange(1, n+1):
        if s[i] and t[i]:
            print "POSSIBLE"
            return

    print "IMPOSSIBLE"

main()


Measured memory_bytes: 5764
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;


int main(){
  int n,k; cin>>n>>k;
  map<int,int> mp;
  rep(i,n){
    int a; cin>>a;
    mp[a]++;
  }
  if(mp.size()<=k)
  cout<<0<<endl;
  else{
    int c=mp.size()-k;
    int ans=0;
    vector<int> b;
    for(auto itr=mp.begin();itr!=mp.end();itr++){
      b.pb(itr->sc);
    }
    sort(ALL(b));
    rep(i,c)
    ans+=b[i];
    cout<<ans<<endl;
  }


  return 0;
}


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

main() {
    int n;
    cin >> n;
    vector <int> a(n);
    rep(i, 0, n) { scanf("%d", &a[i]); }
    int d = 1, ans = 0;
    rep(i, 0, n) {
        if (i + 1 < n && a[i] == a[i + 1]) {
            ++d;
        } else {
            ans += d / 2;
            d = 1;
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let it = s.trim().split_whitespace();
    let a: Vec<usize> = it.map(|s| s.parse().unwrap()).collect();
    let sum = a.into_iter().fold(0, |s, a| s + a);
    let ans = if sum >= 22 {"bust"} else {"win"};
    println!("{}", ans);
}

fn main() {
    run();
}

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

int main()
{
  int n;
  scanf("%d",&n);
  int x[500];
  for(int i=0;i<n;i++){
    scanf("%d",x+i);
    x[i]--;
  }
  priority_queue<pair<int,int> > Q;
  for(int i=0;i<n;i++){
    for(int k=0;k<i;k++){
      Q.push(make_pair(-x[i],i));
    }
  }
  static int A[500000];
  for(int i=0;i<n*n;i++){
    A[i]=-1;
  }
  for(int i=0;i<n;i++){
    A[x[i]]=i;
  }
  int T[500];
  for(int i=0;i<n;i++){
    T[i]=i;
  }
  bool F=0;
  for(int i=0;i<n*n;i++){
    if(A[i]!=-1){
      int j=A[i];
      if(T[j]!=0){
	F=1;
	break;
      }
      for(int k=0;k<n-j-1;k++){
	Q.push(make_pair(-n*n-1,j));
      }
    }
    else{
      if(Q.empty()){
	F=1;
	break;
      }
      A[i]=Q.top().second;
      T[A[i]]--;
      Q.pop();
    }
  }
  if(F){
    puts("No ");
  }
  else{
    puts("Yes ");
    for(int i=0;i<n*n;i++){
      printf("%d ",A[i]+1);
    }
    putchar('\n');
  }
  return 0;
}


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


def main():
    turn = sa[0]
    while True:
        if turn == 'a':
            if len(sa) == 0:
                print('A')
                break
            turn = sa[0]
            sa.pop(0)
        if turn == 'b':
            if len(sb) == 0:
                print('B')
                break
            turn = sb[0]
            sb.pop(0)
        if turn == 'c':
            if len(sc) == 0:
                print('C')
                break
            turn = sc[0]
            sc.pop(0)


if __name__ == '__main__':
    a = input()
    b = input()
    c = input()

    sa = [i for i in a]
    sb = [i for i in b]
    sc = [i for i in c]

    main()


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

int main() {
	int a, b; cin >> a >> b;
	if (a > b) cout << '1' << endl;
	else {
		if (b % a == 0) cout << b / a << endl;
		else if (b % a != 0) cout << (b / a) + 1 << endl;
	}
}


Measured memory_bytes: 3108
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();

        int array[][] = new int[N][2];

        for (int i = 0; i < N; i++) {
            array[i][0] = sc.nextInt();
            array[i][1] = sc.nextInt();
        }

        Arrays.sort(array, (a, b) -> Integer.compare(a[0], b[0]));

        long res = 0;

        for(int[] pair: array) {
            int a = pair[0];
            int b = pair[1];

            if ( b > M ) {
                res += (long)a * (long)M;
                break;
            } else {
                res += (long)a * (long)b;
                M -= b;
            }
        }

        System.out.println(res);

    }
}


Measured memory_bytes: 94028
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


string to_str(int num){
  string str;
  drep(i,3,0){
    int c = 1;
    rep(j,i)c *= 10;
    str.pb(num/c + '0');
    num = num%c;
  }
  return str;
}

signed main(){
  while(true){
    string str;cin >> str;
    if(str == "0000")break;
    if(str[0] == str[1] and str[1] == str[2] and str[2] == str[3]){
      cout << "NA" << endl;continue;
    }
    int cnt = 0;
    while(true){
      if(str == "6174")break;
      string s1, s2;
      sort(all(str));
      s1 = str;
      reverse(all(str));
      s2 = str;
      int res = atoll(s2.c_str()) - atoll(s1.c_str());
      str = to_str(res);
      cnt++;
      // cout << s1 << " " << s2 << " " << str << endl;
    }
    cout << cnt << endl;
  }
  return 0;
}



Measured memory_bytes: 3208
s = input()

if s[0] != 'A':
    print("WA")
    exit()
cnt = 0
s_list = list(s)
s_list[0] = 'a'
for i in range(2, len(s) - 1):
    if s[i] == 'C':
        s_list[i] = 'c'
        cnt += 1
if cnt != 1:
    print("WA")
    exit()
s = "".join(s_list)
for i in range(len(s)):
    if ord(s[i]) >= ord("A") and ord(s[i]) <= ord("Z"):
        print("WA")
        exit()

print("AC")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define f first
#define s second
#define N 1001
#define INF (1e9)
using namespace std;
typedef complex<double> P; //Point
typedef pair<P,P> L; //Line, Segment
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
vector<P> A,B; 

double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }
int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;   // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(cross(b,c) < -EPS) return -1; // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

bool isIntersect(L s1, L s2){
  return ( ccw(s1.f,s1.s,s2.f) * ccw(s1.f,s1.s,s2.s) <= 0 &&
           ccw(s2.f,s2.s,s1.f) * ccw(s2.f,s2.s,s1.s) <= 0 );
}

typedef pair<double,int> Pi;
double dijkstra(){
  vector<double>D(N,INF);
  priority_queue<Pi,vector<Pi>,greater<Pi> >Q;
  Q.push(Pi(0,0));
  D[0]=0;
  while(!Q.empty()){
    Pi t=Q.top();Q.pop();
    int pos=t.s;
    double cost=t.f;
    if(D[pos]<cost)continue;
    if(pos==1)return cost;    
    for(int i=0;i<B.size();i++){
      double ncost=cost+abs(B[pos]-B[i]);
      if(isIntersect(L(A[0],A[1]),L(B[pos],B[i]))||D[i]<=ncost)continue;
      D[i]=ncost;
      Q.push(Pi(ncost,i));
    }
  }
  return INF;
}

int main(){
  int n,m;
  cin>>n>>m;
  A.resize(n),B.resize(m);
  for(int i=0,x,y;i<n;i++)cin>>x>>y,A[i]=P(x,y);
  for(int i=0,x,y;i<m;i++)cin>>x>>y,B[i]=P(x,y);
  double ans=abs(A[0]-A[1])+dijkstra();
  swap(A,B);
  ans=min(ans,abs(A[0]-A[1])+dijkstra());
  if(ans>=INF) ans=-1;
  printf("%.10f\n",ans);
  return 0;
}

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

using namespace std;

using ll = long long;

using vi = vector<int>;
using vll = vector<ll>;

using pi = pair<int, int>;
using pll = pair<ll, ll>;

constexpr auto MOD = 1e9 + 7;
constexpr auto INF = 0x3f3f3f3f;

#define rep(i, a, b) for (auto i = a; i < b; ++i)

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

template <class T> void print(const T &val) { cout << val << '\n'; }

template <class Iterator> void print(Iterator begin, Iterator end) {
  for (auto it = begin; it != end; ++it) {
    cout << *it << ' ';
  }

  cout << '\n';
}

map<ll, ll> factors(ll n) {
  map<ll, ll> f;

  while (n % 2 == 0) {
    n /= 2;
    f[2]++;
  }

  for (auto d = 3; d <= sqrt(n); d += 2) {
    while (n % d == 0) {
      f[d]++;
      n /= d;
    }
  }

  if (n > 1) {
    f[n]++;
  }

  return f;
}

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

  ll n;
  cin >> n;

  auto f = factors(n);

  ll ans = 0;

  for (auto &i : f) {
    auto x = i.first;
    auto y = i.second;

    ll k = 1;

    while (true) {
      if (y >= k) {
        ans++;
        y -= k;
        ++k;
      } else {
        break;
      }
    }
  }

  print(ans);
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
 int main(){
    int x=0;
    cin >> x;
    int y=0,n=0,sum=0;
    y=(x/500);
    n=((x%500)/5);
     sum=(n*5)+(y*1000);
    cout<<sum<<"\n";
 }

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int r, c, sum,sum2;
		r = scan.nextInt();
		c = scan.nextInt();
		sum = 0;// ????¨????
		sum2 = 0;//??¨??????????¨????
		// ????¬???????????????????
		int num[][] = new int[r + 1][c + 1];
		// ?????????????´?
		for (int count = 0; count < r; count++) {
			for (int count2 = 0; count2 < c; count2++) {
				num[count][count2] = scan.nextInt();
			}
		}
		
		// ?¨??????¨StringBuilder???????´??????????????????? r=1 c=8
		for (int count3 = 0; count3 < (r + 1); count3++) {
			for (int count4 = 0; count4 < (c + 1); count4++) {
				if(count3 == r){break;}//????????????????????????????????????
				if (count4 == c) {// ???????¨??????¨???
					// ????????¨??????????¨?
					for (int count5 = 0; count5 < (c+1); count5++) {
						sum = sum + num[count3][count5];
					}
					sb.append(sum);
					sb.append("\n");
					sum = 0;// sum????????????
				} else {// ??????????????¨???
					sb.append(num[count3][count4]);
					sb.append(" ");
				}
			}
			sum = 0;//sum ????????????
			if(count3 == r){//???????¨??????¨???
				for(int count6=0;count6<c;count6++){
					for(int count7=0;count7<r;count7++){
						sum = sum + num[count7][count6];
					}
					sum2 = sum2 + sum;
					sb.append(sum);
					sb.append(" ");
					sum = 0;//sum????????????
				}
			}
		}
		sb.append(sum2);
		System.out.println(new String(sb));

	}
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vs a(3);
  rep(i,3) cin>>a[i];
  ll ans=0;
  rep(i,n){
    set<char> s;
    ll cnt=2;
    rep(j,3){
      if(s.count(a[j][i])) cnt--;
      s.insert(a[j][i]);
    }
    ans+=cnt;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#  ABC 090: B – Palindromic Numbers
a, b = [int(s) for s in input().split()]
number_of_parindromics = 0

for i in range(a, b + 1):
    if str(i) == str(i)[::-1]:
        number_of_parindromics += 1

print(number_of_parindromics)

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

#define rep(i, j, n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};

struct edge {
  int to, idx;
};

vvt<edge> e(101000);

vt<i64> dijkstra(int s, vt<i64> &cost) {
  vt<i64> dist(101000, 1e18);
  dist[s] = 0;

  priority_queue<pair<int, i64>, vt<pair<int, i64>>, greater<pair<int, i64>>> que;
  que.push({s, 0});

  while(!que.empty()) {
    auto p = que.top();
    que.pop();

    int v = p.first;
    i64 d = p.second;

    if(dist[v] < d) continue;

    for(auto &nxt : e[v]) {
      if(dist[nxt.to] <= dist[v] + cost[nxt.idx]) continue;

      dist[nxt.to] = dist[v] + cost[nxt.idx];
      que.push({nxt.to, dist[nxt.to]});
    }
  }
  
  return dist;
}

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

  int n, m, s, t;
  cin >> n >> m >> s >> t;
  s--; t--;

  vt<i64> a(m), b(m);
  rep(i, 0, m) {
    int u, v;
    cin >> u >> v >> a[i] >> b[i];
    u--; v--;
    e[u].push_back({v, i});
    e[v].push_back({u, i});
  }

  auto dist1 = dijkstra(s, a);
  auto dist2 = dijkstra(t, b);

  vt<i64> ans;
  i64 res = 0;
  for(int i = n - 1; i >= 0; --i) {
    res = max(res, (i64)1e15 - dist1[i] - dist2[i]);
    ans.push_back(res);
  }

  for(int i = n - 1; i >= 0; --i) cout << ans[i] << endl;
}


Measured memory_bytes: 16832
def main():
    N = int(input())
    L = list(map(int, input().split()))
    ans = 0

    for i in range(N-2):
        for j in range(i+1, N-1):
            for k in range(j+1, N):
                a = L[i]
                b = L[j]
                c = L[k]
                if (a + b <= c) or (b + c <= a) or (c + a <= b):
                    continue
                if (a != b and b != c and c != a):
                    ans += 1
                    
    
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 73316
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> num = new ArrayList<Integer>();
		ArrayList<String> param = new ArrayList<String>();
		int system = 0; // 文字の空白区切り 0:ON 1:OFF

		while (sc.hasNext()) {
			if (sc.hasNextInt()) {
				num.add(sc.nextInt());
			} else {
				if (system == 0)
					param.add(sc.next());
				if (system == 1)
					param.add(sc.nextLine());
			}
		}
		Method(num, param);
	}

	static void Method(ArrayList<Integer> num, ArrayList<String> param) {

		System.out.println((int)(num.get(1) * Math.pow(num.get(1)-1,num.get(0)-1)));
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M; cin >> N >> M;
  vector<int> cnt(N, 0);
  REP(i, M){
    int a, b; cin >> a >> b; a--; b--;
    cnt[a]++;
    cnt[b]++;
  }
  bool flag = true;
  REP(i, N){
    if(cnt[i]%2 != 0){
      flag = false;
    }
  }
  if(flag){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 3700
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <climits>

using namespace std;

class Job{
public:
	int a;
	int b;
};

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

	int a;
	string s;
	cin >> a;
	cin >> s;

	if (a >= 3200) {
		cout << s << endl;
	}
	else {
		cout << "red" << endl;
	}

	return 0;
}

Measured memory_bytes: 256