akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
#define fi first
#define se second
#define upb upper_bound
#define lwb lower_bound
#define show(x) cout << #x << " is " << x << "\n";
const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y){
    if(y<=0) return 1;
    ll ans = 1;
    x %= mod;
    while(y){
        if(y&1)
            ans = (x * ans) % mod;
        x = (x * x) % mod;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = (a - b); if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = (a + b); if(c >= mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//------------------------------------------------------------------------------------------

//const ll N = 2e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<<fixed<<setprecision(10);

	ll a, b, c, d;
	cin>>a>>b>>c>>d;
	cout<<max({a*c, a*d, b*c, b*d});


    return 0;
}


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

int a,b,c;
int k;

int main(){
	cin>>a>>b>>c;
	cin>>k;
	for(int i=0;i<=k;++i){
		int f1=a<(b<<i);
		int f2=(b<<i)<(c<<(k-i));
		if(f1&f2){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
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 FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
#define EPS 1e-10
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const int INF = 1e9;

int main() {
    int m, n;
    while (cin >> m && m){
        VI t(m), h(101,24);
        REP(i,m) cin >> t[i];
        cin >> n;
        REP(i,n){
            int d, m;
            cin >> d >> m;
            d--;
            h[d] = min(h[d],m);
        }
        VVI dp(101,VI(m,INF));
        dp[0][0] = 0;
        REP(i,100) REP(j,m){
            dp[i+1][0] = min(dp[i+1][0], dp[i][j] + 1);
            if (t[(j+1)%m] <= h[i+1])
                dp[i+1][(j+1)%m] = min(dp[i+1][(j+1)%m], dp[i][j]);
        }
        int ans = INF;
        REP(j,m) ans = min(ans, dp[100][j]);
        cout << ans << endl;

    }
    return 0;
}

Measured memory_bytes: 3088
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    val m = cin.nextInt()

    val a = Array<Array<Int>>(n, { Array<Int>(m, { cin.nextInt()-1 }) })

    val count = Array<MutableList<Int>>(m, { mutableListOf() })

    val point = Array<Int>(n, { 0 })
    val valid = Array<Boolean>(m, { true })

    for (i in 0..n-1) {
        count[a[i][0]].add(i)
    }

    var min_of_max = -1
    var valid_num = m

    while (valid_num > 1) {
        var count_max = count[0].size
        var count_max_idx = 0
        for (i in 0..m-1) {
            if (count[i].size > count_max) {
                count_max = count[i].size
                count_max_idx = i
            }
        }

        if (0 > min_of_max || min_of_max > count_max) {
            min_of_max = count_max
        }

        valid[count_max_idx] = false
        valid_num -= 1

        for (person in count[count_max_idx]) {
            while (!valid[a[person][point[person]]]) {
                point[person] += 1
            }
            count[a[person][point[person]]].add(person)
        }

        count[count_max_idx] = mutableListOf()
    }

    if (m == 1) {
        min_of_max = n
    }
    
    println(min_of_max)
}

Measured memory_bytes: 54864
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup cin.tie(0);ios::sync_with_stdio(false);
#define eb emplace_back
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int main()
{
    ciosup;
    int n;
    cin >> n;
    int w[n],x[n],y[n];
    REP(i,n) cin >> w[i];


    REP(i,n){
        if (i == 0){
            x[i] = w[i];
        }else{
            x[i] = x[i - 1] + w[i];
        }
    }
    IREP(i,n){
        if (i == n-1){
            y[i] = w[i];
        }else{
            y[i] = y[i + 1] + w[i];
        }
    }
    int ans = 10000;
    REP(i, n-1)
    {
        ans = min(ans, abs(y[i + 1] - x[i]));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N, L, tot = 0, max;
  
  scanf("%d", &N);
  
  for (int i = 0; i < N; i++){
    scanf("%d", &L);
    if(i == 0){
      max = L;
    } else {
      if(max < L){
        tot += max;
        max = L;
      } else {
        tot += L;
      }
    }
  }
  
  if(max < tot){
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  
  return 0;
}

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

    typedef long long ll;
    typedef long double ld;
    ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
    ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
    #define endl '\n'
    #define max3(a,b,c) max(a,max(b,c))
    #define min3(a,b,c) min(a,min(b,c))
    #define FOR(i,a,n,j) for(int i=a;i<n;i+=j)

    const int INF = 1e9+9;




    int main()
    {

        ll a,b,c,k,ans=0;
        cin>>a>>b>>c>>k;
        ans += a<k ? a:k;
        k-=a+b;
        if(k<0) cout<<ans<<endl;
        else{
            ans-= k;
            cout<<ans<<endl;
        }

    return 0;
    }
        // gotcha;


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

ll mypow(long long k, long long n) {
	long long temp = 1;

	k = k % DIV;
	while (n) {
		if (n % 2) temp = temp * k % DIV;
		k = k * k % DIV;
		n = n / 2;
	}
	return temp % DIV;
}

ll aa(ll a, ll b) {
	return (a % DIV) * (b % DIV) % DIV;
}


int main() {
	int K; cin >> K;
	string s; cin >> s;
	int N = s.size();
	
	vector<ll> f(N + K + 1), invf(N + K + 1), v25(K + 1), v26(K + 1);
	f[0] = 1, invf[0] = 1, v25[0] = 1, v26[0] = 1;
	for (int i = 1; i <= N + K; i++) {
		f[i] = f[i - 1] * i;
		f[i] %= DIV;
		invf[i] = mypow(f[i], DIV - 2);
		if (i <= K) {
			v25[i] = (v25[i - 1] * 25) % DIV;
			v26[i] = (v26[i - 1] * 26) % DIV;
		}
	}

	ll ans = 0, a25 = 1, a26 = 1;
	for (int i = 0; i <= K; i++) {
		ll temp = aa((aa(f[N + K - i - 1], invf[N - 1])), aa(aa(invf[K - i], v25[K - i]), v26[i]));
		ans += temp;
		ans %= DIV;
	}

	cout << ans << endl;
}




Measured memory_bytes: 51116
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int a,b;
	cin >> a >> b;

	int d = b-a;

	int sum = 0;
	for(int i = 1; i <= d ; i++ )
		sum += i;
	

	cout << sum - b << endl;
	ret 0;
}

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

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << p.first << " " << p.second;
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

typedef struct {
  ll x;
  ll y;
  ll h;
} S_Pos;

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

  ll N;
  std::cin >> N;

  ll max_h = 0LL;
  std::vector< S_Pos > vp(N);
  for (ll i = 0; i < N; i++) {
    std::cin >> vp[i].x >> vp[i].y >> vp[i].h;
    max_h = std::max(max_h, vp[i].h);
  }

  for (ll cx = 0LL; cx <= 100; cx++) {
    for (ll cy = 0LL; cy <= 100; cy++) {
      for (ll h = max_h; h <= max_h+100; h++) {
	bool judge = true;
	for (ll i = 0; i < N; i++) {
	  if (vp[i].h != std::max(h - std::abs(vp[i].x - cx) - std::abs(vp[i].y - cy), 0LL)) {
	    judge = false;
	    break;
	  }
	}
	if (judge == true) {
	  print(cx, cy, h);
	  return 0;
	}
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	int kingaku;
	int[] goukei = new int[4];
	int n;
	
	public void syurui(){
		
		for(n=0;n<=3;n++){
		int syurui = sc.nextInt();
		int maisuu = sc.nextInt();
		
			switch (syurui){
				case 1: kingaku = 6000;break;
				case 2: kingaku = 4000;break;
				case 3: kingaku = 3000;break;
				case 4: kingaku = 2000;break;
			}	
			
		goukei[n] = kingaku * maisuu;
		}
	}
	
	public void hyouji(){
		for(n=0;n<=3;n++){
			System.out.println(goukei[n]);
		}
		
	}
	
	public static void main(String[] args) {
       Main uriage= new Main();
      uriage.syurui();
       uriage.hyouji();
       
       
   }
}

Measured memory_bytes: 17164
n=int(input())
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))
ab.sort(key=lambda x:x[1])
l=[]
tmp=0
for i in range(n):
    tmp+=ab[i][0]
    l.append(tmp)

f=False
for i in range(n):
    if l[i]>ab[i][1]:
        f=True

print("YNeos"[f::2])


Measured memory_bytes: 58288
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int>vi;
#define pb push_back
#define sc(n) scanf("%d",&n)
#define lsc(n) scanf("%lld",&n)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define rev1(i,n) for(i=n;i>0;i--)
#define in insert
#define IT ::iterator
#define pr(n) printf("%d\n",n)
#define lpr(n) printf("%lld\n",n);


int main()
{
	string s,t;
	cin >> s >> t;
	ll sz=s.size(),i;
	ll ans=0LL;
	rep(i,sz)
	{
		if(s[i]!=t[i])
		{
			ans++;
		}
	}
	cout << ans;
    return 0;
}


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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    
    if(a > b) swap(a, b);
    if(b > c) swap(b, c);
    if(a > b) swap(a, b);
    
    cout<<a<<" "<<b<<" "<<c<<endl;
    
    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
using s64 = signed long long;
using u64 = unsigned long long;
using f128 = long double;

int main()
{
    s64 x = 0;
    cin >> x;

    if(x == 0)
    {
        cout << "1" << endl;
    }
    else
    {
        cout << "0" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ld T,X; cin >> T >> X;
    cout << fixed << setprecision(15);
    cout << T / X << endl;
}

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

int main() {
	
	int a, b;
	cin >> a >> b;
	
	if(a >= 13) cout << b << endl;
	else if(a >= 6) cout << b/2 << endl;
	else cout << 0 << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	alpha := "abcdefghijklmnopqrstuvwxyz"
	m := make(map[string]int)
	for i := range s {
		m[string(s[i])]++
	}
	for i := range alpha {
		if m[string(alpha[i])] == 0 {
			fmt.Println(string(alpha[i]))
			return
		}
	}
	fmt.Println("None")
}


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

int main() {
  int h,w;
  cin>>h>>w;
  string s;
  for(int i=0;i<w+2;i++){
    cout<<'#';
  }
  cout<<endl;
  for(int i=0;i<h;i++){
    cin>>s;
    cout<<'#'<<s<<'#'<<endl;
  }
  for(int i=0;i<w+2;i++){
    cout<<'#';
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {
    std::deque<int> deq;
    deq.emplace_back(1);
    for (int b=2;b<=1000;b++) {
        int tmp=b;
        for (int p=2;tmp*b<=1000;p++) {
            tmp=tmp*b;
            deq.emplace_back(tmp);
        }
    }
    sort(deq.begin(),deq.end());
    int n;
    cin>>n;
    auto result=find(deq.begin(),deq.end(),n);
    if (result!=deq.end()) {
        cout<<*result<<endl;
    } else {
        auto itr=lower_bound(deq.begin(),deq.end(),n);
        int hoge=distance(deq.begin(),itr);
        cout<<deq[hoge-1]<<endl;
    }
}

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

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

int c[1000];

int main(){
	int n,m,max=0;
	cin >> n >> m;
	int a[1000],b;
	rep(i,n) cin >> a[i];
	rep(i,m){
		cin >> b;
		int j;
		for(j=0;a[j]>b;j++);
		c[j]++;
	}
	rep(i,n) if(c[max]<c[i]) max=i; 
	cout << max+1 << endl;
}

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

using namespace std;
string lca(string s,string t){
 int n=s.length();
 int m=t.length();
   vector<vector<int> >dp(n+1,vector<int>(m+1,0));
   for(int i=1;i<=n;++i){
    for(int j=1;j<=m;++j){
        if(s[i-1]==t[j-1]){
            dp[i][j]=1+dp[i-1][j-1];
        }else{
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
   }
   string ans;
   int i=n;
   int j=m;
   while(i>0 && j>0){
       if(s[i-1]==t[j-1]){
          ans.push_back(s[i-1]);
          j--;
          i--;
       }else{
         if(dp[i-1][j]>dp[i][j-1])
            i--;
         else
            j--;
       }

   }
   reverse(ans.begin(),ans.end());
   return ans;
}
int main()
{
  string s,t;
  cin >> s >> t;
  cout << lca(s,t) <<endl;
}

Measured memory_bytes: 38572
import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0 and k%2 ==1 :
  if zero >= 1:
    ans = 0
  else:
    minus.sort(reverse=True)
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2 == 1:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)


Measured memory_bytes: 31800
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		 long  n = scn.nextLong();
		 long a = scn.nextLong();
		 long b = scn.nextLong();
		 
		 long val = a+b;
		  long ans=(n/val);
		   ans = ans*a;
		    long val1 = (n%val);
		      ans+= val1<a?val1:a;
		      System.out.println(ans);

	}

}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 100005
using namespace std;
int n,in[M][3],dp[M][3];
int main()
{
    while (~scanf("%d",&n)) {
        REP(i,1,n) REP(j,0,2) scanf("%d",&in[i][j]);

        REP(i,1,n) REP(j,0,2) {
            dp[i][j] = 0;
            REP(k,0,2) if(j!=k) {
                dp[i][j] = max(dp[i][j], dp[i-1][k] + in[i][j]);
            }
        }
        printf("%d\n", max(dp[n][0], max(dp[n][1], dp[n][2])));
    }
    
    return 0;
}



Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            StreamScanner scan = new StreamScanner(System.Console.OpenStandardInput());
            long n = scan.Long();
            long a = scan.Long();
            long b = scan.Long();
            long kore = n / (a + b);
            long atomax = Math.Min(n % (a + b), a);
            Console.WriteLine(a * kore + atomax);

        }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        private readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) throw new EndOfStreamException();
            if (ptr >= len)
            {
                ptr = 0;
                if ((len = str.Read(buf, 0, 1024)) <= 0)
                {
                    isEof = true;
                    return 0;
                }
            }
            return buf[ptr++];
        }
        public char Char()
        {
            byte b = 0;
            do b = read();
            while (b < 33 || 126 < b);
            return (char)b;
        }
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (int)Long(); }
        public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }
    }
    public class UnionFind
    {
        public int[] data;

        public UnionFind(int size)
        {
            data = new int[size];
            for (int i = 0; i < size; i++) data[i] = -1;
        }

        public bool Unite(int x, int y)
        {
            x = Root(x);
            y = Root(y);

            if (x != y)
            {
                if (data[y] < data[x])
                {
                    var tmp = y;
                    y = x;
                    x = tmp;
                }
                data[x] += data[y];
                data[y] = x;
            }
            return x != y;
        }

        public bool IsSameGroup(int x, int y)
        {
            return Root(x) == Root(y);
        }

        public int Root(int x)
        {
            return data[x] < 0 ? x : data[x] = Root(data[x]);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=1e9+7;
  string s, r, y;
  cin>>s;
  if(s=="SUN") cout<<7;
  else if(s=="MON") cout<<6;
  else if(s=="TUE") cout<<5;
  else if(s=="WED") cout<<4;
  else if(s=="THU") cout<<3;
  else if(s=="FRI") cout<<2;
  else cout<<1;
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
 //  cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}


Measured memory_bytes: 3596
#include <stdio.h>
int main(void){
    int i = 1;
    int n = 1;
    
    while(n <= 10000){
        scanf("%d",&i);
        if(i == 0){
            break;
        }
        printf("Case %d: %d\n",n,i);
        n++;
    }
    
}

Measured memory_bytes: 1808
a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;n<51;n++)for(m[n]=1e5,d=5;~d;d--)if(a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d]))m[n]=T;for(;scanf("%d",&n),n;)printf("%d\n",m[n/100]);exit(0);}

Measured memory_bytes: 596
N,M,C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int, input().split())) for i in range(N)]
ans = 0

for i in range(N):
  tmp = C
  for j in range(M):
    tmp += A[i][j]*B[j]
  if tmp > 0:
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
//#define maxi 1e18
#define pll pair<ll,ll>
#define inf 1000000007
map<ll,ll> m;
int main(){
    ll n,i,j,sum=0;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            sum+=(a[i]*a[j]);
        }
    }
    cout<<sum;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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

long long  n, m, q, ans;
vector<vector<long long >> quad;

void func(long long  i, long long  prev, vector<long long > num) {
	if (i == n) {
		long long  curr = 0;
		for (auto i : quad) {
			if ((num[i[1] - 1] - num[i[0] - 1]) == i[2]) curr += i[3];
		}
		ans = max(ans, curr);
		return;
	}

	for (long long  dig = prev; dig <= m; dig++) {
		num.push_back(dig);
		func(i + 1, dig, num);
		num.pop_back();
	}

	return;
}

int  main() {

	cin >> n >> m >> q;
	quad.resize(q, vector<long long >(4, 0));
	for (long long  i = 0; i <= q - 1; i++) for (long long  j = 0; j <= 3; j++) cin >> quad[i][j];
	func(0, 1, vector<long long >());

	cout << ans;

	return 0;
}

Measured memory_bytes: 3660
#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  st first
#define  nd second
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define MAXN  1<<17
#define MOD   1000000007
#define int long long
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef gp_hash_table<int, int, hash<int > > ht;
int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  int n;
  cin>>n;
  cout<<((n-1)*n)/2;
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int Q;
    cin >> Q;
    vector<P> items(Q);
    rep(q, Q) cin >> items[q].first >> items[q].second;
    int n = 100000;
    vector<bool> is_prime(n + 1, true);
    int i = 2;
    while (pow(i, 2) <= n) {
        if (is_prime[i]) {
            int j = i + i;
            while (j <= n) {
                is_prime[j] = false;
                j += i;
            }
        }
        i++;
    }
    vector<ll> S(n + 1, 0);
    is_prime[1] = false;
    rep(j, n) {
        if (j >= 2 && is_prime[j] && is_prime[(j + 1) / 2]) {
            S[j + 1] += S[j] + 1;
        } else {
            S[j + 1] = S[j];
        }
    }
    rep(q, Q) {
        P p = items[q];
        cout << S[p.second + 1] - S[p.first] << '\n';
    }
}

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


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

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 200010;
const int MOD = 1000000007;
const int LOG = 20;

ll fen[N];
int n, h[N], a[N];

void add(int id, ll x){
	id++;
	for (; id < N; id += id & (-id)) fen[id] = max(fen[id], x);
}

ll get(int id){
	id++;
	ll res = 0;
	for (; id; id -= id & (-id)) res = max(res, fen[id]);
	return res;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> h[i];
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++){
		ll x = get(h[i] - 1) + a[i];
		add(h[i], x);
	}
	cout << get(n);



	return 0;
}

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

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a*b)/gcd(a,b)
#define ff              first
#define ss              second
#define int             long long
#define pb              emplace_back
#define mp              make_pair
#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 zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             INT_MAX
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(x)			x.begin(),x.end()
#define digits(x)		floor(log10(x))+1
#define FIO				ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

class dsu {
private:
	int *id;
	int* sz;

	int root(int i) {
		while (i != id[i]) {
			id[i] = id[id[i]];
			i = id[i];
		}
		return i;
	}
public:
	int n;
	dsu(int v) {
		n = v;
		id = new int[n];
		sz = new int[n];

		for (int i = 0; i < n; i++) {
			id[i] = i;
			sz[i] = 0;
		}
	}

	bool find(int p , int q) {
		return root(p) == root(q);
	}

	void join(int p , int q) {
		int i = root(p);
		int j = root(q);
		if (i == j) {
			return;
		}
		if (sz[i] < sz[j]) {
			id[i] = j ;
			sz[j] += sz[i];
		}
		else {
			id[j] = i;
			sz[i] += sz[j];
		}
	}
};

int nCr(int n , int r ) {
	int p = 1, k = 1;

	if (n - r < r ) {
		r = n - r;
	}
	if (r != 0) {
		while (r != 0) {
			p *= n ;
			k *= r ;
			int m = __gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else {
		p = 1;
	}
	return p ;
}

int modPower(int x, int y , int p) {
	//Used to calculate (x^y)%p
	int res = 1;
	if (y == 0) {
		return 1;
	}

	x = x % p;
	if (x == 0) {
		return 0  ;
	}

	while (y > 0) {
		if (y & 1) {
			res = (res * x) % p;
		}

		y >>= 1;
		x = (x * x) % p;
	}
	return res ;

}


bool notAll7(int n) {

	bool ans = false;

	while (n) {
		int c = n % 10;
		if (c != 7) {
			ans = true;
			break;
		}
		n /= 10;
	}
	return ans;
}

int32_t main() {
	FIO;

	int k ;
	cin >> k;

	if (k & 1) {
		if (k % 10 == 5) {
			cout << -1;
		}
		else {
			int d = digits(k);
			int val ;
			int count ;
			switch (d) {
			case 1: val = 7; count = 1; break;
			case 2: val = 77; count = 2 ; break;
			case 3: val = 777; count = 3 ; break;
			case 4: val = 7777; count =  4; break;
			case 5: val = 77777; count = 5 ; break;
			case 6: val = 777777; count = 6 ; break;
			case 7: val = 7777777; count = 7 ; break;
			}
			val = val % k;
			while (val % k != 0) {
				val *= 10;
				val += 7;
				val %= k;
				count++;
			}
			cout << count;
		}
	}
	else {
		cout << -1;
	}







	return 0;
}


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

public class Main {
  private static String solve(char[] cs) {
    char cFirst = cs[0];
    char cLast = cs[cs.length - 1];
    return (cFirst == cLast) == (cs.length % 2 != 0) ? "Second" : "First";
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    char[] cs = reader.nextCharArray();
    out.println(solve(cs));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 24276
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

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

    vector<int64_t> a(n);
    for (auto&& aa : a) {
        cin >> aa;
    }

    unordered_map<int64_t, int64_t> pos;
    vector<int64_t> next(n);
    for (auto i : irange(n - 1, -1L, -1L)) {
        if (pos.count(a[i]) > 0) {
            next[i] = pos[a[i]];
        } else {
            next[i] = -1;
        }
        pos[a[i]] = i;
    }

    vector<int64_t> hop(n);
    for (auto i : irange(n - 1, -1L, -1L)) {
        if (next[i] < 0) {
            hop[i] = i;
        } else if (next[i] == n - 1) {
            hop[i] = -1;
        } else {
            hop[i] = hop[next[i] + 1];
        }
    }

    unordered_map<int64_t, int64_t> first;
    unordered_map<int64_t, int64_t> last;
    for (auto i : irange(0L, n)) {
        if (first.count(a[i]) == 0) {
            first[a[i]] = i;
        }
        last[a[i]] = i;
    }

    vector<pair<int64_t, int64_t>> arr;
    auto hhh = hop[0];
    while (hhh >= 0) {
        arr.emplace_back(a[hhh], hhh);

        if (hhh == n - 1) {
            break;
        }

        hhh = hop[hhh + 1];
    }

    if (arr.empty()) {
        // output is empty
        cout << endl;
        return 0;
    }

    int64_t offset = 0;
    auto cur_num = arr.front().first;
    unordered_map<int64_t, int64_t> appear;
    vector<int64_t> hop_idx;
    hop_idx.push_back(-1);
    hop_idx.push_back(arr.front().second);
    appear[-1] = 0;
    appear[arr.front().second] = 1;
    while (true) {
        auto f = first[cur_num];

        if (f == n - 1) {
            hop_idx.push_back(-1);
            break;
        }

        auto h = hop[f + 1];
        hop_idx.push_back(h);
        if (appear.count(h) > 0) {
            offset = appear[h];
            break;
        }

        cur_num = a[h];
        appear[h] = hop_idx.size() - 1;
    }
    int64_t prd = hop_idx.size() - offset - 1;
    cerr << offset << " " << prd << endl;

    int64_t hh = 0;
    if (k < offset) {
        hh = hop_idx[k];
    } else {
        hh = hop_idx[(k - offset) % prd + offset];
    }

    if (hh < 0) {
        // output is empty
        cout << endl;
        return 0;
    }

    arr.clear();
    hhh = hh;
    while (hhh >= 0) {
        arr.emplace_back(a[hhh], hhh);

        if (hhh == n - 1) {
            break;
        }

        hhh = hop[hhh + 1];
    }

    const auto* delim = "";
    for (auto aa : arr) {
        cout << delim << aa.first;
        delim = " ";
    }
    cout << endl;
}

Measured memory_bytes: 43968
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <unordered_map>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

long long factorial(long long n) {
    long long result = 1;
    for (long long i = 1; i <= n; i++) {
        result *= i;
    }
    return result;
}

long long combination(long long n, long long r) {
    long long result = factorial(n) / factorial(n - r) / factorial(r);
    // cout << "combination " << n << " C " << r << "is " << result << endl;
    return result;
}

long long combination_improved(long long n, long long r) {
    long long d      = n - r;
    long long result = 1;
    while (n > 1 || d > 1 || r > 1) {
        if (n > 1) {
            result *= n;
            n--;
        }
        if (d > 1 && result % d == 0) {
            result /= d;
            d--;
        }
        if (r > 1 && result % r == 0) {
            result /= r;
            r--;
        }
    }
    // cout << "combination " << n << " C " << r << "is " << result << endl;
    return result;
}

int main(void) {
    // cout << std::fixed << std::setprecision(10);
    // cin.tie(0);
    // std::ios::sync_with_stdio(false);
    long long n, m;
    long long count;
    long long cum[100001];
    std::multimap<long long, long long> mod_map; //(mod M,number)
    cin >> n >> m;
    long long m1;
    for (int i = 0; i < n; i++) {
        cin >> m1;
        if (i == 0)
            cum[i] = m1;
        else
            cum[i] = cum[i - 1] + m1;
    }
    for (int i = 0; i < n; i++) {
        mod_map.insert(std::make_pair(cum[i] % m, cum[i]));
    }

    int prev = m;
    for (auto itr : mod_map) {
        // cout << itr.first << " " << itr.second << endl;
        if (prev != itr.first) {
            if (itr.first == 0) {
                if (mod_map.count(0) >= 1)
                    count += combination_improved(mod_map.count(0) + 1, 2);
            } else {
                if (mod_map.count(itr.first) >= 2) {
                    count += combination_improved(mod_map.count(itr.first), 2);
                }
            }
        }
        prev = itr.first;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 7296
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S =sc.next();
		sc.close();

		int zero = 0;
		int one = 0;
		for(int i = 0;i < S.length();i++) {
			if(S.charAt(i)=='0') {
				zero++;
			}else {
				one++;
			}
		}
		System.out.println(2*Math.min(zero, one));
	}
}

Measured memory_bytes: 24092
re=0
tle=0
wa=0
ac=0
ip=[]
n=int(input())
for i in range(n):
  ip.append(input())
for i in range(n):
  if ip[i]=="AC":
    ac=ac+1
  if ip[i]=="TLE":
    tle=tle+1
  if ip[i]=="WA":
    wa=wa+1
  if ip[i]=="RE":
    re=re+1
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))

Measured memory_bytes: 16236
import math,itertools,fractions,heapq,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# Summarize count of factor within list -- START --
def summarize_list(l):
  sl=sorted(l)

  a=sl[0]
  c=1
  res=[]

  for x in sl[1:]:
    if x==a:
      c+=1
    else:
      res.append([a,c])
      a=x
      c=1
  res.append([a,c])

  return res
# Summarize count of factor within list --- END ---

def main():
  n=I()
  l=LI()

  l=summarize_list(l)

  for x,y in l:
    if y!=1:
      return 'NO'
  return 'YES'

# main()
print(main())


Measured memory_bytes: 37712
#include<stdio.h>
int main(){
  int n;
  int max = -1000000;
  int min = 1000000;
  long long sum = 0;
  int i;
  scanf("%d", &n);
  for(i = 1 ; i <= n ; i++){
    int a;
    scanf("%d", &a);
    sum = sum + a;
    if(a < min){
      min = a;
    }
    if(a > max){
      max = a;
    }
  }
  printf("%d %d %lld\n", min, max, sum);
  return 0;
}



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

namespace AOJ.Codes
{
    //問題の名称... 2104 : CountryRoad
    //問題文のURL... http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2104&lang=jp
    //所要時間... AAA
    //学んだこと... AAA
    //教室内の大まかな着席位置... 中央 x 奥

    class _2104_CountryRoad
    {
        static void Main(string[] args)
        {
            //データ数読み込み
            var t = int.Parse(Console.ReadLine());

            for (int i = 0; i < t; i++)
            {
                //読み込んで計算

                var line1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
                var n = line1[0];
                var k = line1[1];
                var line2 = Console.ReadLine().Split().Select(int.Parse).ToArray();

                var Distances = new List<int>();

                for (int j = 0; j < line2.Length-1; j++)
                    Distances.Add(line2[j + 1] - line2[j]);

                Distances.Sort();
                Distances.Reverse();

                for (int l = 0; l < k-1; l++)
                {
                    try
                    {
                        Distances.RemoveAt(0);
                    }
                    catch (Exception)
                    {
                    }

                }

                var sum = Distances.Sum();

                //出力
                Console.WriteLine(sum);
            }

            //Enterを押して終了
            Console.ReadLine();
        }
    }
}



Measured memory_bytes: 44108
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
x,y = map(int,input().split())
mod = 10**9+7
if (x+y) % 3 != 0:
  print(0)
elif abs(y-x) > min(x,y)*2:
  print(0)
else:
  print(cmb((y+x) // 3,(2*y-x) // 3,mod))

Measured memory_bytes: 127432
#include <cstring>
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

typedef long long ll;
const int MAXN = 222;
const int MAXR = 1111;
const ll INF = 1ll<<55;
int N, M, R;
// d1: land d2: sea
ll d1[MAXN][MAXN], d2[MAXN][MAXN];
int z[MAXR];

ll dp[MAXR][MAXN];

ll dfs(int turn, int ship) {
	ll& ret = dp[turn][ship];
	if (ret >= 0) return ret;
	if (turn == R-1) return ret = 0;
	// 徒歩
	ret = d1[z[turn]][z[turn+1]] + dfs(turn+1, ship);
	// 船
	for (int v = 0; v < N; v++) {
		ll tmp = d1[z[turn]][ship] + d2[ship][v] + d1[v][z[turn+1]];
		if (tmp >= INF) continue;
		tmp += dfs(turn+1, v);
		ret = min(ret, tmp);
	}
	return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (cin >> N >> M) {
    	if (N==0 && M==0) break;
    	for (int i = 0; i < N; i++) {
    		for (int j = 0; j < N; j++) {
    			d1[i][j] = d2[i][j] = INF;
    		}
    		d1[i][i] = d2[i][i] = 0;
    	}
    	for (int i = 0; i < M; i++) {
    		int x, y, t;
    		char sl;
    		cin >> x >> y >> t >> sl;
    		x--; y--;
    		if (sl == 'L') {
    			d1[x][y] = min<ll>(d1[x][y], t);
    			d1[y][x] = d1[x][y];
    		} else {
    			d2[x][y] = min<ll>(d2[x][y], t);
    			d2[y][x] = d2[x][y];
    		}
    	}
    	for (int k = 0; k < N; k++) for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) {
    		d1[i][j] = min(d1[i][j], d1[i][k] + d1[k][j]);
    		d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
    	}
    	cin >> R;
    	for (int i = 0; i < R; i++) {
    		cin >> z[i];
    		z[i]--;
    	}
    	memset(dp, -1, sizeof(dp));
    	cout << dfs(0, z[0]) << endl;
    }
    return 0;
}


Measured memory_bytes: 5816
#include<bits/stdc++.h>
#define INF 2147483647
#define SYOU(x) setprecision(x)
using namespace std;
int i[1111111];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d=0,e,f;
  string s;
  cin >>a>>b>>c;
  d=a*b;
  cout <<min(d,c)<<'\n';
  return (0);
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=2e5+5;
char s[N];
int mod[N];
int main(){
cin>>s;
int k=1,res=0,ans=0;
for(int i=strlen(s)-1;i>=0;i--){
    mod[res]++;
    res=(res+(s[i]-'0')*k)%2019;
    ans+=mod[res];
    k=k*10%2019;
}
cout<<ans;


return 0;
}


Measured memory_bytes: 3784