akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include "boost/multiprecision/cpp_int.hpp"
using ll = long long;
using ull = unsigned long long;
namespace mp = boost::multiprecision;

int main() {

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

	int N; std::cin >> N;

	if (N % 10 == 9 || N / 10 == 9)std::cout << "Yes";
	else std::cout << "No";

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;
typedef unsigned long long ull;

inline int scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
using namespace std;
const int maxn = 100005;
int a[105];
int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
    cin >> a[i];
    int dang = a[1];
    int sum = 1;
    int ans = 0;
    for(int i = 2; i <= n; i++)
    {
        if(a[i] == dang){
            sum++;
        }
        else {
            ans += sum/2;
            sum = 1;
            dang = a[i];
        }
    }
    ans += sum/2;
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;

ll K, A, B;
ll Ans;

int main(int argc, char *argv[]) {
    scanf("%lld%lld%lld", &K, &A, &B);
    if (A >= B - 1 || K <= A - 1) {
        printf("%lld\n", K + 1);
        return 0;
    }
    Ans = 1;
    K -= A - 1; Ans += A - 1;
    Ans -= (K / 2) * A;
    Ans += (K / 2) * B;
    if (K & 1) Ans++;
    printf("%lld\n", Ans);
    return 0;
}



Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
 
int main()
{
    string a, b;
    cin >> a >> b;
    if (b.size() - a.size() != 1) {
        cout << "No" << endl;
    } else {
        if (b.substr(0,a.size()) != a) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  vector<vector<ll>> brd(3, vector<ll>(3));
  vector<vector<bool>> marked(3, vector<bool>(3));
  for (ll i = 0; i < 3; i++) {
    for (ll j = 0; j < 3; j++) {
      cin >> brd.at(i).at(j);
    }
  }
  ll N; cin >> N;
  for (ll k = 0; k < N; k++) {
    ll b; cin >> b;
    for (ll i = 0; i < 3; i++) {
      for (ll j = 0; j < 3; j++) {
	if (brd.at(i).at(j) == b) marked.at(i).at(j) = true;
      }
    }
  }

  for (ll i = 0; i < 3; i++) {
    ll ok = true;
    for (ll j = 0; j < 3; j++) {
      if (!marked.at(i).at(j)) {
	ok = false;
	break;
      }
    }
    if (ok) {
      cout << "Yes\n";
      return 0;
    }
  }
  for (ll i = 0; i < 3; i++) {
    ll ok = true;
    for (ll j = 0; j < 3; j++) {
      if (!marked.at(j).at(i)) {
	ok = false;
	break;
      }
    }
    if (ok) {
      cout << "Yes\n";
      return 0;
    }
  }
  {
    ll ok = true;
    for (ll j = 0; j < 3; j++) {
      if (!marked.at(j).at(j)) {
	ok = false;
	break;
      }
    }
    if (ok) {
      cout << "Yes\n";
      return 0;
    }
  }
  {
    ll ok = true;
    for (ll j = 0; j < 3; j++) {
      if (!marked.at(j).at(2-j)) {
	ok = false;
	break;
      }
    }
    if (ok) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
int main(){
  int n,k,a=1;
std::cin>>n>>k;
  for(int i=0;i<n;i++){
  if(a>k){
    a+=k;
  }
    else{
     a=a*2; 
    }
  }
  std::cout<<a<<std::endl;
}

Measured memory_bytes: 256
def main():
    NK = list(map(int, input().split()))
    S = input()
    N, K = NK[0], NK[1]
    ans = ""
    for i in range(0, N):
        if i == K-1:
            ans += S[i].lower()
        else:
            ans += S[i]
    print(ans)
main()

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 1e5+23;
const long long inf = 1e15;

vector<pair<int, int>> g[N];
long long D[N];

void solve() {
  int n, m; scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int l, r, c; scanf("%d%d%d", &l, &r, &c);
    g[l-1].emplace_back(r-1, c);
  }
  for (int i = 1; i < n; ++i) {
    g[i].emplace_back(i-1, 0);
    D[i] = inf;
  }
  priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> pq;
  pq.emplace(0, 0);
  D[0] = 0;
  while (!pq.empty()) {
    long long d = pq.top().first, u = pq.top().second;
    pq.pop();
    if (d > D[u]) continue;
    for (const auto &p: g[u]) {
      if (D[p.first] <= D[u]+p.second) continue;
      pq.emplace(D[u]+p.second, p.first);
      D[p.first] = D[u]+p.second;
    }
  }
  if (D[n-1] == inf) D[n-1] = -1;
  printf("%lld", D[n-1]);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 10996
include Math

a, b, c_ang = gets.split.map(&:to_f)
C = c_ang / 180 * PI
c = sqrt(a**2 + b**2 -2 * a * b * cos(C))
h = sqrt(c**2 - ((a**2 + c**2 - b**2) / (2 * a))**2)
L = a + b + c
S = a * h / 2

puts S, L, h


Measured memory_bytes: 6948
#include <cstdio>
#include <cstdlib>

using namespace std;

template <class Type>
class Bit {
    public:
    Bit(int n) : size(n + 1) {
        bit = (Type *)calloc(size, sizeof(Type));
    }
    
    ~Bit() {
        free(bit);
    }
    
    void add(int x, Type value) {
        for (x++; x < size; x += x & -x) bit[x] += value;
    }
    
    //[0,x]
    Type sum(int x) {
        Type value = 0;
        
        for (x++; x > 0; x -= x & -x) value += bit[x];
        
        return value;
    }
    
    //[x,y]
    Type get(int x, int y) {
        return sum(y) - sum(x - 1);
    }
    
    private:
    
    int size;
    Type *bit;
};

int a[3][100000];
int b[300000][2];
int c[100000];
int f[100000];

int main() {
    int n, c1 = 0, c2 = 0, i, j;
    long long sum1 = 0, sum2 = 0;
    
    scanf("%d", &n);
    
    for (i = 0; i < 3; i++) {
        for (j = 0; j < n; j++) {
            scanf("%d", &a[i][j]);
            
            a[i][j]--;
            
            b[a[i][j]][0] = i;
            b[a[i][j]][1] = j;
        }
    }
    
    for (i = 0; i < n * 3; i += 3) {
        int x = b[i][0];
        int y = b[i][1];
        int z = i / 3;
        
        if (z % 2 != y % 2 || x == 1 || b[i + 1][1] != y || b[i + 2][1] != y) {
            puts("No");
            
            return 0;
        }
        
        c[y] = z;
        
        if (x == 0) {
            if (b[i + 1][0] != 1 || b[i + 2][0] != 2) {
                puts("No");
                
                return 0;
            }
        } else {
            if (b[i + 1][0] != 1 || b[i + 2][0] != 0) {
                puts("No");
                
                return 0;
            }
            
            f[y] = 1;
        }
    }
    
    Bit <int> b1(n + 1);
    Bit <int> b2(n + 1);
    
    for (i = 0; i < n; i++) {
        if (i % 2 == 0) {
            sum1 += b1.get(c[i], n);
            b1.add(c[i], 1);
            c1 += f[i];
        } else {
            sum2 += b2.get(c[i], n);
            b2.add(c[i], 1);
            c2 += f[i];
        }
    }
    
    if (sum1 % 2 == c2 % 2 && sum2 % 2 == c1 % 2) {
        puts("Yes");
    } else {
        puts("No");
    }
    
    return 0;
}


Measured memory_bytes: 5376
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  int a,b,h,ans=0;
  cin>>a>>b>>h;
  ans=(a+b)*h/2;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
const int mod = 1e9+7;
const int maxn = 2e5+5;
const double EPS = 1e-6;
using namespace std;
struct node{
	int v,s;
}num[maxn];
int sum[maxn]={0};
bool cmp(node a,node b){
	return a.s<b.s;
}
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	int a;
	int t = 0;
	rep(i,0,n) {
		scanf("%d",&a);
		if(sum[a]==0) t++;
		sum[a]++;
	}
	if(t<=k) return printf("0\n"),0;
	int cnt = 0;
	rep(i,1,n+1) {
		if(sum[i]==0) continue;
		num[cnt].v = i;
		num[cnt++].s = sum[i];
	}
	sort(num,num+cnt,cmp);
	int ans = 0;
	rep(i,0,cnt){
		ans+=num[i].s;
		t--;
		if(t<=k) break;
	}
	cout<<ans<<endl;
	return 0;
}



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

map<char,char> go,back;

string S,T;
int main () {
    cin >> S >> T;
    bool flag = true;
    for(int i=0; i<S.size(); i++) {
        if(go[S[i]] && go[S[i]] != T[i]) flag = false;
        if(back[T[i]] && back[T[i]] != S[i]) flag = false;
        go[S[i]] = T[i];
        back[T[i]] = S[i];
    }
    cout << ( flag ? "Yes" : "No" ) << endl;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    int a[N];
    int i, min = 1001, max = -1;

    for(i=0; i<N; ++i) {
        cin >> a[i];
        if(min > a[i]) min = a[i];
        if(max < a[i]) max = a[i];
    }

    cout << max - min << endl;

    return 0;
}


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

typedef long long ll;
priority_queue<ll>q1;
priority_queue<ll,vector<ll>,greater<ll> >q2;
priority_queue<ll>q3;
ll a[200005];
ll mod=1e9+7;

int main()
{
	int n,k;
	cin>>n>>k;
	ll inf=(1e9+7)*(1e9+7);
	ll sum5=1ll;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]<0){
			q1.push(a[i]);
			q2.push(a[i]);
		}
		else {
			q3.push(a[i]);
		}
		sum5=(sum5*a[i])%mod;
	}
	if(k==n){
		cout<<((sum5+mod)%mod)<<endl;
		return 0;
	}
	if(q1.size()==n){
		
		ll sum=1ll;
		if(k%2==0){
			while(k>0){
				sum=(sum*q2.top())%mod;
				q2.pop();
				k--;
			}
		}
		else {
			while(k>0){
				sum=(sum*q1.top())%mod;
				q1.pop();
				k--;
			}
		}
		cout<<((sum+mod)%mod)<<endl;
		return 0;
	}
	ll sum=1ll;
	if(k%2==1){
		sum=q3.top();
		q3.pop();
		k--;
	}
	while(k>=2){
		k-=2;
		if(q2.size()<2){
			sum=(sum*(q3.top()))%mod;
			q3.pop();
			sum=(sum*(q3.top()))%mod;
			q3.pop();
			continue;
		}
		if(q3.size()<2){
			sum=(sum*(q2.top()))%mod;
			q2.pop();
			sum=(sum*(q2.top()))%mod;
			q2.pop();
			continue;
		}
		ll t1,t2,t3,t4;
		t1=q2.top();
		q2.pop();
		t2=q2.top();
		q2.pop();
		t3=q3.top();
		q3.pop();
		t4=q3.top();
		q3.pop();
		if(t1*t2>=t3*t4){
			sum=(sum*t1)%mod;
			sum=(sum*t2)%mod;
			q3.push(t3);
			q3.push(t4);
		}
		else {
			sum=(sum*t3)%mod;
			sum=(sum*t4)%mod;
			q2.push(t1);
			q2.push(t2);
		}
	}
	cout<<((sum+mod)%mod)<<endl;
	return 0;
}

Measured memory_bytes: 8148
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const a = parseInt(args[0][0], 10)
	const b = parseInt(args[0][1], 10)
	const c = parseInt(args[0][2], 10)
	if (a + b >= c) console.log('Yes')
	else console.log('No')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 21192
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


X,Y = MI()
print('Alice' if abs(X-Y) >= 2 else 'Brown')


Measured memory_bytes: 61976
#include<bits/stdc++.h>
using namespace std;
signed main()
{
 char a,b;
  cin>>a>>b;
  if(a=='H'){
    cout<<b<<"\n";
  }else{
    if(b=='H'){
      cout<<'D'<<"\n";
    }else{
      cout<<'H'<<"\n";
    }
  }
}

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

int main()
{
  int nagasa;
  int ans = 0;
  char s[100];
  cin>>s;
  nagasa = strlen(s);
  for(int i=0;i<nagasa;i++)
  {
    if(s[i]!=s[nagasa-1-i])ans++;
  }
  cout<<ans/2<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    public static void Main()
    {
        int N = Cin<int>();
        int M = Cin<int>();
        List<bool> visit = Enumerable.Repeat(false, N).ToList();
        Glaph glaph = new Glaph(visit);
        glaph.visit[0] = true;
        glaph.now_Node = 0;
        List<int>[] edge = new List<int>[N];
        for (int i = 0; i < N; i++) edge[i] = new List<int>();
        for (int i = 0; i < M; i++)
        {
            int[] inp = Line<int[]>().Select(v => v - 1).ToArray();
            edge[inp[0]].Add(inp[1]);
            edge[inp[1]].Add(inp[0]);
        }
        long ans = 0;
        Stack<Glaph> stack = new Stack<Glaph>();
        stack.Push(glaph);
        while (stack.Count() != 0)
        {
            Glaph now_state = stack.Pop();
            if (now_state.visit.All(v => v == true)) ans++;
            foreach (var i in edge[now_state.now_Node])
            {
                if (!now_state.visit[i])
                {
                    Glaph next_state = new Glaph(now_state.visit);
                    next_state.visit[i] = true;
                    next_state.now_Node = i;
                    stack.Push(next_state);
                }
            }
        }
        Console.WriteLine(ans);
    }
}

public class Glaph
{
    public List<bool> visit;
    public int now_Node { get; set; }
    public Glaph(List<bool> b) { visit = new List<bool>(b); }
}

public class Input
{
    private static Queue<string> queue = new Queue<string>();
    public static T Cin<T>()
    {
        if (queue.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) queue.Enqueue(s);
        if (typeof(T) == typeof(int)) return (T)(object)int.Parse(queue.Dequeue());
        else if (typeof(T) == typeof(long)) return (T)(object)long.Parse(queue.Dequeue());
        else if (typeof(T) == typeof(string)) return (T)(object)(queue.Dequeue());
        else if (typeof(T) == typeof(double)) return (T)(object)double.Parse(queue.Dequeue());
        else return (T)(object)(-1);
    }
    public static T Line<T>()
    {
        if (typeof(T) == typeof(int[]))
        {
            return (T)(object)Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        else if (typeof(T) == typeof(long[]))
        {
            return (T)(object)Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        else if (typeof(T) == typeof(string[]))
        {
            return (T)(object)Console.ReadLine().Split(' ').ToArray();
        }
        else if (typeof(T) == typeof(double[]))
        {
            return (T)(object)Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
        else return (T)(object)(-1);
    }
}

Measured memory_bytes: 15700
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define int long long
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9+7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
unsigned day;
if(dow < dow1) dow += 7;
day = dow - dow1;
day += 7 * n - 6;
return day;
}
unsigned DayToWeekNumber(unsigned day)
{
  return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
  return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main(){
	int N;
	cin>>N;
	vector<char>a(N*3);
	rep(i,N*3)cin>>a[i];
	int AC=0;
	int WA=0;
	int TLE=0;
	int RE=0;
	rep(i,N*3){
		if(a[i]=='A'){
          AC++;
          i++;
        }
		if(a[i]=='W'){
          WA++;
          i++;
        }
		if(a[i]=='T'){
          TLE++;
          i+=2;
        }
		if(a[i]=='R'){
          RE++;
          i++;
        }
	}
	cout<<"AC"<<" "<<"x"<<" "<<AC<<endl<<"WA"<<" "<<"x"<<" "<<WA<<endl<<"TLE"<<" "<<"x"<<" "<<TLE<<endl<<"RE"<<" "<<"x"<<" "<<RE<<endl;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;
typedef pair<string, int> P;

bool pairCompare(P firstElof, P secondElof)
{
    if (firstElof.first != secondElof.first) return firstElof.first < secondElof.first;
    else return firstElof.second > secondElof.second;
}

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

    vector<P> r(N);
    map<P, int> re;

    rep(i, N) {
        cin >> r[i].first >> r[i].second;
        re[P(r[i].first, r[i].second)] = i + 1;
    }

    sort(r.begin(), r.end(), pairCompare);

    rep(i, N) {
        cout << re[P(r[i].first, r[i].second)] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
tokuten_list = list(map(int, input().split()))
soutokuten = sum(tokuten_list)
asikiri_line = soutokuten / (4 * M)
kekka = "No"
ninki_count = 0
for tokuten in tokuten_list:
    if tokuten >= asikiri_line:
        ninki_count += 1
        if ninki_count >= M:
            kekka = "Yes"
            break

print(kekka)


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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000

using namespace std;
typedef long long ll;
typedef pair<ll ,ll> P;
const ll mod = 1e9+7;
const long double EPS = 0.0000000001;

string s;
int main(){
	cin >> s;
	if(s[0] == s[1] and s[1] == s[2]){
		cout << "No" << endl;
	}else {
		cout << "Yes" << endl;
	}
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to only numbers
rs = lambda: stdin.readline().rstrip()  # ignores trailing space

N = ri()
x = int((2*N) ** .5)
if x * (x+1) < 2 * N:
    x += 1
diff = x * (x+1) * .5 - N
for i in range(x, 0, -1):
    if i <= diff:
        diff -= i
    else:
        print(i)
# 57


Measured memory_bytes: 3316
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;

int main() {
  double a, b, x;
  cin >> a >> b >> x;
  double ans = 0;
  if (a * a * b / 2 >= x) {
    ans = atan(2 * x / (a * b * b));

  } else {
    ans = atan(a * a * a / (2 * a * a * b - 2 * x));
  }
  cout << fixed << setprecision(10) << 90.0 - (ans * 180.0) / M_PI << endl;
}


Measured memory_bytes: 888
mod = 10 ** 9 + 7

S = input()
N = len(S)

dp = [[0] * 2 for _ in range(N + 10)]
dp[0][0] = 1

for i in range(N):
    nd = int(S[i])
    for k in range(2):
        for a in range(2):
            for b in range(2):
                ni = i + 1
                nk = k
                if a == b == 1:
                    continue
                if nk == 0:
                    if nd == 1 and a + b == 0:
                        nk += 1
                    if nd == 0 and a + b == 1:
                        continue
                dp[ni][nk] += dp[i][k]
                dp[ni][nk] %= mod

ans = (dp[N][0] + dp[N][1]) % mod
print(ans)

Measured memory_bytes: 19820
#include <stdio.h>
#include <stdlib.h>
struct Node{
  int k;
  struct Node *n;
 struct  Node *p;
};
typedef struct Node Node; 

Node *nil;
void insert(int);
void delete(Node *);
void deletefirst();
void deletelast();
Node * search(int);
void deletek(int);
void print();



int main(){
  int n,i,d;
  char c[12];
  nil=(Node *)malloc(sizeof(Node));
  nil->n=nil;
  nil->p=nil;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",c);

    if(c[0]=='i') {
      scanf("%d",&d);
      insert(d);

    }
  else if(c[0]=='d'&&c[6]=='F') deletefirst();
  else if(c[0]=='d'&&c[6]=='L') deletelast();

  else {
    scanf("%d",&d);
    deletek(d);
  }
  }

  print();

  return 0;
}



void insert(int d){
  Node *x;
  x=(Node *)malloc(sizeof(Node));
  x->k=d;
  x->n=nil->n;
  nil->n->p=x;
  nil->n=x;
  x->p=nil;
}
void delete(Node *c){

  if(c==nil) return;
  c->p->n=c->n;
  c->n->p=c->p;
  free(c);
  
}
void deletefirst(){
  delete(nil->n);
}
void deletelast(){
  delete(nil->p);
}
void deletek(int d){
  delete(search(d));

}

Node* search(int d){
  Node *c;
  c=nil->n;
  while(c!=nil&&c->k!=d){
    c=c->n;
  }
  return c;
}

void print(){
  Node *c=nil->n;
  int i;
  while(1){
    if(c==nil)break;
    if(i++>0)printf(" ");
    printf("%d",c->k);
    c=c->n;
  }
  printf("\n");
}

Measured memory_bytes: 31784
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x/10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int m,int mod){
	int res=1,bas=x;
	while(m){
		if(m&1) res=(1ll*res*bas)%mod;
		bas=(1ll*bas*bas)%mod,m>>=1;
	}
	return res;
}
const int N = 55;
int n,sum[N];
string s;
map<string,int> mp;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(ri i=1;i<=n;++i)
		cin>>s,mp[s]=i,read(sum[i]),sum[i]+=sum[i-1];
	cin>>s,print(sum[n]-sum[mp[s]]);
	return 0;
}

Measured memory_bytes: 256
#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 int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	char c;
	cin >> c;
	if(c <= 'Z' && c >= 'A') {
		cout << 'A';
	}
	else {
		cout << 'a';
	}

	return 0;
}

Measured memory_bytes: 3612
#include "bits/stdc++.h"
using namespace std;
#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
typedef long long ll;

const int INF = 1e9 + 7;
const long long LLINF = 1e18;

ll n, k;
ll a[101010];
ll gcd(ll a, ll b) {
    if(a<b) swap(a, b);

    if (b == 0) return a;
    return gcd(b, a%b);
}
int main() {
    cin>>n>>k;
    REP(i, 0, n) cin>>a[i];

    sort(a, a+n);
    ll gg=a[n-1];
    RREP(i, 0, n){
        gg=gcd(gg, a[i]);
    }

    if(k%gg==0 && k<=a[n-1]) cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main(){
    int H, W, D;
    vector<vector<int>> A;
    map<int, P> mp;
    cin >> H >> W >> D;
    A = vector<vector<int>>(H, vector<int>(W,0));
    for(int h=0; h<H; h++) for(int w=0; w<W; w++) {
        cin >> A[h][w];
        mp[A[h][w]] = P(h,w);
    }


    vector<int> dist(H*W+1);
    fill(dist.begin(), dist.end(), -1);
    dist[0] = 0;
    for(int i=0; i<=H*W; i++){
        if(i/D==0) dist[i] = 0;
        else{
            int dh = abs(mp[i].first - mp[i-D].first);
            int dw = abs(mp[i].second - mp[i-D].second);
            dist[i] = dist[i-D] + dh + dw;
        }
    }

    int Q;  cin >> Q;
    for(int i=0; i<Q; i++){
        int L,R;  cin >> L >> R;
        cout << dist[R] - dist[L] << endl;
    }
}


Measured memory_bytes: 7424
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  string s;
  cin >> s;
  v2li v(s.size()+1, v1li(13, 0)); v1i u(s.size());
  v[0][0] = 1; u[0] = 1;
  rep(i, s.size()-1) u[i+1] = u[i] * 10 % 13;
  rep(i, s.size()){
    rep(j, 13){
      if(s[s.size()-1-i] == '?'){
        rep(k, 10) v[i+1][(j+k*u[i]) % 13] += v[i][j];
      }
      else v[i+1][(j+(s[s.size()-1-i]-'0')*u[i])%13] += v[i][j];
    }
    rep(j, 13) v[i+1][j] %= mod1;
  }
  cout << v[s.size()][5] << endl;
  return 0;
}

Measured memory_bytes: 14080
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>

using namespace std;

#define MAX_N 128;

int ans;


int main()
{
    int e;
    
    int ans = 100000000;;
    int temp = 10000000;
    
    
    while(cin >> e && e)
    {
        ans = 100000;
        for(int z=0; z<=100; ++z)
        {
            for(int y=0; y<=1000; ++y)
            {
                
                int m = (e-y*y-z*z*z) + y*y + z*z*z;
                if(m == e)
                {
                    int x = e-y*y-z*z*z;
                    if(x < 0){break;}
                    temp = x+y+z;
                    if(ans > temp){ans = temp;}
                }
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1160
def insertionSort(A,n,g):
    cnt = 0
    for i in range(g,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt+=1
        A[j+g] = v
    return cnt

def shellSort(A,n):
    cnt = 0
    G = make_G(A)
    m = len(G)
    for i in range(m):
        cnt += insertionSort(A, n, G[i])
    
    return m,G,cnt,A

def make_G(A):
    length_A = len(A)
    i=1
    while 4**i+3*(2**(i-1)) < length_A:
        i+=1
    G = [0 for j in range(i)]
    for k in range(i):
        G[k] = 4**k+3*(2**(k-1))
    G[0] = 1
    G.reverse()
    return G


n = int(input())
A = [0 for i in range(n)]
for i in range(n):
    A[i] = int(input())

m,G,cnt,A = shellSort(A,n)
print(m)
print(*G)
print(cnt)
for i in range(len(A)):
    print(A[i])


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

int main() {
  int x;cin>>x;
  while(1){
    bool ans=true;
    for(int i=2;i<x;i++){
      if(x%i==0)ans=false;
    }
    if(ans)break;
    x++;
  }
  cout<<x<<endl;
}

Measured memory_bytes: 3640
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int d;
	cin>>d;
	if(d==25){
		printf("Christmas\n");
	}else if(d==24){
		printf("Christmas Eve");
	}else if(d==23){
		printf("Christmas Eve Eve");
	}else if(d==22){
		printf("Christmas Eve Eve Eve");
	}else{
		
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <time.h>
#include <stack>
#include <queue>
#include <random>
#include <fstream>
#define endl '\n'
#define flush fflush(stdout), cout.flush()
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define debug cout << "ok" << endl
#define finish(x) return cout << x << endl, 0
typedef long long ll;
typedef long double ldb;
const int md = 1e9 + 7;
const ll hs = 199;
const ldb eps = 1e-9, pi = acos(-1);
using namespace std;

ll ans;
string s;
int n, c[26] = {};

int main() {
	fast;
	cin >> s;
	n = s.size();
	ans = (ll)n * n + 2;
	for (auto &i : s) c[i - 'a']++;
	for (int i = 0; i < 26; i++) ans -= (ll)c[i] * c[i];
	cout << ans / 2 << endl;
}

Measured memory_bytes: 720
from collections import Counter

def abc(v):
  n = len(v)
  v_e = Counter(v[::2]).most_common(2)
  v_o = Counter(v[1::2]).most_common(2)
  if v_e[0][0] != v_o[0][0]:
    return n - v_e[0][1] - v_o[0][1]
  else:
    if len(v_o)==1 or len(v_e)==1:
      return n//2
    else:
      return n - max(v_e[0][1] + v_o[1][1], v_e[1][1] + v_o[0][1])
    
input()
print(abc(list(map(int, input().split()))))

Measured memory_bytes: 15588
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

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

void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    int N,A;
    cin >> N >> A;
    cout << N*N-A << endl;
}


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

void print(char s[], int a, int b) {
  int i;
  for (i = a; i <= b; i++)
    printf("%c", s[i]);
  putchar('\n');
}


void replace(char s[], int a, int b, char p[]) {
  int i;
  for (i = a; i <= b; i++)
    s[i] = p[i - a];
}


void reverse(char s[], int a, int b) {
  int i;
  char st[1001];
  for (i = a; i <= b; i++) {
    st[b - i] = s[i];
  }
  for (i = a; i <= b; i++) {
    s[i] = st[i - a];
  }
}


int main() {
  int i;
  int num;
  char str[1001], p[1001], order[8];

  scanf("%s %d", str, &num);
  for (i = 0; i < num; i++) {
    int n1, n2;
    scanf("%s %d %d", order, &n1, &n2);

    if (strcmp(order, "print") == 0) {
      print(str, n1, n2);
    } else if (strcmp(order, "replace") == 0) {
      scanf("%s", p);
      replace(str, n1, n2, p);
    } else {
      reverse(str, n1, n2);
    }
  }

  return 0;
}



Measured memory_bytes: 2124
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int N = b - a;
  int sum = 0;
  int ans = 0;
  for (int i = 1; i <=  N; i++) {
    sum += i;
  }
  ans = sum - b;
  cout << ans << endl;
}

Measured memory_bytes: 256
use std::str::FromStr;

trait Readable {
    fn read_item(s: &str) -> Self;
    fn read_line(s: String) -> Self where Self: std::marker::Sized {
        Self::read_item(&s)
    }
}

impl Readable for usize {
    fn read_item(s: &str) -> usize { usize::from_str(s).unwrap() }
}

impl Readable for u64 {
    fn read_item(s: &str) -> u64 { u64::from_str(s).unwrap() }
}

impl Readable for String {
    fn read_item(s: &str) -> String { s.to_string() }
    fn read_line(s: String) -> String { s }
}

impl<T1, T2> Readable for (T1, T2) where T1: Readable, T2: Readable {
    fn read_item(s: &str) -> (T1, T2) {
        let items: Vec<&str> = s.split(' ').collect();
        assert!(items.len() == 2);
        (T1::read_item(items[0]), T2::read_item(items[1]))
    }
}

fn read<T>() -> T where T: Readable {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();

    let last = line.pop();
    match last {
        Some(ch) if ch != '\n' => line.push(ch),
        _ => ()
    }

    T::read_line(line)
}

fn verify(animals: &[u8], parities: &[u8]) -> bool {
    let last = animals.len() - 1;
    (parities[0] + animals[last] + animals[0] + animals[1]) % 2 == 0 &&
        (parities[last] + animals[last-1] + animals[last] + animals[0]) % 2 == 0
}

fn main() {
    let n: usize = read();
    let line: String = read();
    let parities: Vec<u8> = line.chars().map(|ch| {
        if ch == 'o' { 0 } else { 1 }
    }).collect();

    let mut animalss = [vec![0,0], vec![0,1], vec![1,0], vec![1,1]];
    for animals in animalss.iter_mut() {
        for i in 1..n-1 {
            let p = (animals[i-1] + animals[i] + parities[i]) % 2;
            animals.push(p);
        }
        if verify(&animals, &parities) {
            let ans: String = animals.iter()
                .map(|&p| if p == 0 { 'S' } else { 'W' })
                .into_iter().collect();
            println!("{}", ans);
            std::process::exit(0);
        }
    }

    println!("-1");
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<ll> S;
void input(){
    fast_io();
    cin >> N;
    for (int i = 0; i < 1<<N; i++)
    {
        ll s; cin >> s;
        S.push_back(s);
    }
    // sort(S.begin(),S.end(),greater<ll>());
    sort(S.begin(),S.end());
}

bool pesudo_solve(){
    auto chk = [&](int n){
        int idx = 1<<n;
        for (int i = 0; i < idx; i++) if(S[i]<=S[i+idx]) return false;
        return true;
        };
    for (int i = 0; i < N; i++) if(!chk(i)) return false;
    return true;
}

bool solve(){
    vector<int> a;
    a.push_back(S.back());
    S.back() = -1;
    for (int i = 0; i < N; i++)
    {
        sort(a.begin(),a.end());
        vector<int> tmp = a;
        int idx = (1<<N)-1;
        while(idx>=0 && !tmp.empty()){
            if(S[idx]==-1){
                idx--; continue;
            }
            if(S[idx]<tmp.back()){
                a.push_back(S[idx]);
                S[idx] = -1;
                tmp.pop_back();
            }
            idx--;
        }
        if(!tmp.empty()) return false;
    }
    return true;
}



int main()
{
    input();
    string ans = solve()?"Yes":"No";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4336
#include <stdio.h>

int main(void){
  int r,c,i,j;
  static int s[101][101];

  scanf("%d%d",&r,&c);

  for(i=0;i<=r;i++){
    for(j=0;j<c;j++){
      scanf("%d", &s[i][j]);
      printf("%d ", s[i][j]);
      s[i][c] += s[i][j];
      s[r][j] += s[i][j];
    }
    printf("%d\n",s[i][c]);
  }

  return 0;
}



Measured memory_bytes: 2104
input_values = []
while True:
    input_value = input().split()
    input_values.append(input_value)
    if input_value[0] == '0' and input_value[1] == '0':
        break

for input_value in input_values:
    height = int(input_value[0])
    width = int(input_value[1])
    if height > 0 and width > 0:
        for i in range(height):
            line = ''
            for j in range(width):
                line += "#"
            print(line)
        print()



Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acosl(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define MXN 200005
LL fra[30000007];
LL inv[30000007];
const int mod=1e9+7;
LL f_pow(LL a,LL b){
    LL res=1,temp=a;
    while(b){
        if(b&1)res=res*temp%mod;
        temp=temp*temp%mod;
        b>>=1;
    }
    return res;
}
void build(){
    fra[0]=1;
    for(int i = 1;i<=30000000;i++){
        fra[i]=fra[i-1]*i%mod;
    }
    inv[30000000]=f_pow(fra[30000000],mod-2);
    for(int i =29999999;i>=0;i--){
        inv[i]=inv[i+1]*(i+1)%mod;
    }
}
LL P(int a,int b){
    if(a<b)return 0;
    return fra[a]*inv[a-b]%mod;
}
int main(){
    build();
    int h,w,k;
    scanf("%d %d %d",&h,&w,&k);
    LL ans=P(h+w,k)*k%mod;
   // printf("%lld\n",ans);
    LL edge=h+w,inter=(LL)h*w%mod;
    for(int i = 1;i<=k;i++){
        ans+=edge*P(h+w-1,k-1)%mod*i%mod;
        ans%=mod;
    }
  //  printf("%lld\n",ans);
    LL last=0;
    for(int i = 2;i<=k;i++){
        LL cnt=((P(h+w,i)-2*P(h+w-1,i)+P(h+w-2,i))%mod+mod)%mod;
      //  printf("%lld\n",cnt);
        ans+=inter*cnt%mod*P(h+w-i,k-i)%mod;
        //ans+=inter*((cnt-last)%mod+mod)%mod*P(h+w-i,k-i)%mod*(k-i+1)%mod;
        //last=cnt;
        ans%=mod;
    }
    printf("%lld\n",ans);
}
/*

23847657 
23458792534

102334155
111111111 
111111111
*/

Measured memory_bytes: 468992
# 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
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i=0; i<n; i++) {
      int a = sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();
      if (a > b && a > c) {
        if(a*a == b*b + c*c) {
          System.out.println("YES");
          continue;
        }
      }
      else if(b > a && b > c) {
        if(b*b == a*a + c*c) {
          System.out.println("YES");
          continue;
        }
      }
      else if(c > a && c > b) {
        if(c*c == a*a + b*b) {
          System.out.println("YES");
          continue;
        }
      }
      System.out.println("NO");
    }    
  }
}

Measured memory_bytes: 32664
import Text.Printf
main = do
  str<-getLine
  let [h,w]=map read $ words $ str::[Int]
  if(h==0 && w==0)
  then return ()
  else do
    putStrLn $ concat.(map (++"\n")) $ [["#."!!(mod (x+y) 2)|x<-[1..w]] | y<-[1..h]]
    main

Measured memory_bytes: 3944
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ab = Integer.parseInt(String.valueOf(a) + String.valueOf(b));

		for(int i = 1; i < 318; i++) {
			if(i*i == ab) {
				System.out.println("Yes");
				break;
			} else if(i*i > ab) {
				System.out.println("No");
				break;
			}
		}
	}
}

Measured memory_bytes: 23764
import java.util.*;

public class Main {
	static int get(int a) {
		int b = 2;
		for(int i = 3;i <= a / 3;i += 2) {
			if(a % i == 0) {
				b ++;
			}
		}
		return b;
	}
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int m = 0;
		if(a >= 105)m ++;
		for(int i = 107;i <= a;i += 2) {
			if(get(i) == 8)m ++;
		}
		System.out.println(m);
	}
}


Measured memory_bytes: 20692
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) {return (n==0)?1:10*TEN(n-1);}

int main() {
    int n;
    scanf("%d", &n);
    int a[n], ra[n+1];
    for (int i = 0; i < n; i++) {
        scanf("%d", a+i);
        ra[a[i]] = i;
    }
    ll ans = 0;
    set<int> s;
    s.insert(-1); s.insert(n);
    for (int d = 1; d <= n; d++) {
        int i = ra[d];
        auto it = s.lower_bound(i);
        int r = *it;
        it--;
        int l = *it;
        ans += ll(d)*(i-l)*(r-i);
        s.insert(i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11136
import sys

input = sys.stdin.readline

n = int(input())

a = list(map(int, input().split()))

a.sort(reverse=True)

alice = 0
bob = 0

for index, value in enumerate(a):
    if index % 2 == 0:
        alice += value
    else:
        bob += value

ans = alice - bob

print(ans)


Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    N = input().strip()
    ans = sum([int(n) for n in N])

    for i in range(len(N)-1):
        if N[i] == 0:
            continue
        else:
            ans = max(ans, sum([int(n) for n in N[:i]]) +
                      int(N[i])-1 + 9*(len(N)-i-1))

    return ans


if __name__ == "__main__":
    print(main())

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s;
    int l;
    l = 0;
    cin >> s;
    for (int i=0; i < s.length(); i++)
    {
        if (s[i] == 'x') l++;
    }
    if (l > 7) cout << "NO" << endl;
    else cout << "YES" << endl;
    
    return 0;
    
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, a: "List[int]"):
    from collections import Counter
    ma, mi = max(a), min(a)
    if ma >= N or mi < 1:
        raise
    if ma - mi > 1:
        return False
    if ma == mi:
        return ma == N - 1 or  2 * ma <= N
    c = Counter(a)
    # pairがpairでない
    if c[ma] % 2 != 0:
        return False
    x = ma - c[ma] // 2
    if x < 0:
        return False
    # pair以外、すべてalone(crowdが0個)
    if x == c[mi]:
        return True
    # crowdを1つ以上作れるなら0以上c[mi]-2以下の好きな數を作れる
    return x <= c[mi] - 2

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(YES if solve(N, a) else NO)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14244