akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 998244353
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,n;
    cin>>a>>b>>n;
    int ans=0;
    ans=max(ans,(a*n)/b-a*(n/b));
    n=(n/b)*b;
    n--;
    if(n<0)n=0;
    ans=max(ans,(a*n)/b-a*(n/b));
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3648
def main():
    args = input().rstrip().split(' ')
    N, A, B = int(args[0]), int(args[1]), int(args[2])
    unit = int(N/(A+B))
    rem = N % (A+B)
    if(rem > A):
        brem = A
    else:
        brem = rem
    print(A*unit + brem)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int  long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
using namespace std;
const int N=2e5+100,mod=1e9+7;
ll power(ll n,ll k){
    if (k==0) return 1;
    if (k%2==1){
        ll x=power(n,k/2);
        return x*x%mod*n%mod;
    }
    ll x=power(n,k/2);
    return x*x%mod;
}
vector <int> g[N];
ll dp[N];
ll s=0;
ll n;
ll dfs(ll v,ll p){
    dp[v]=1;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u==p) continue;
        dfs(u,v);
        dp[v]+=dp[u];
    }
    ll o=0,w=0;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u==p) continue;
        ll k=power(2,dp[u]);
        ll y=power(2,n-dp[v]);
        ll t=power(2,n-dp[u]-1);
        ll t1=power(t,mod-2);
        ll k1=power(k,mod-2);
        ll y1=power(y,mod-2);
        //s+=(1*power(2,mod-2)%mod)*((k-1)*k1%mod)%mod*((y-1)*y1%mod)%mod;
        o+=(1*power(2,mod-2)%mod)*((k-1)*k1%mod)%mod*t1;
        o%=mod;
        s%=mod;
    }
    ll r=power(2,dp[v]-1);
    ll d=power(2,n-dp[v]);
    ll d1=power(d,mod-2)%mod;
    s+=(1*power(2,mod-2)%mod)*((r-1)*power(r,mod-2)%mod)%mod*((d-1)*d1%mod)%mod;
    w=(1*power(2,mod-2)%mod)*((r-1)*power(r,mod-2)%mod)%mod*d1%mod;
    s+=(w-o+mod);
    s%=mod;
}
int32_t main(){
    sync;
    cin >> n;
    for (int i=0;i<n-1;i++){
        ll u,v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    dfs(1,1);
    cout << s;
}


Measured memory_bytes: 26496
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextInt();
        long B = sc.nextInt();
        long res = lcm(A, B);
        System.out.println(res);
    }
    public static long gcd(long a, long b) {
        if(b==0) {
            return a;
        } else {
            long t = a%b;
            return gcd(b, t);
        }
    }

    public static long lcm(long a, long b) {
        long g = gcd(a,b);
        return a / g * b;
    }
}


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

#define lld long long int
#define llu unsigned long long

int main()
{
    //freopen("input.txt", "w", stdin);

    int r,g,b,res = 1;

    while(cin>>r>>g>>b)
    {
        res = ((r*10+g)*10)+b;

        if(res % 4)
            cout<<"NO\n";
        else
            cout<<"YES\n";
    }
    return 0;
}


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


int main()
{
    vector<bool> primes(10000+10,true);
    primes[0]=primes[1]=false;
    for(int c=2;c<primes.size();c++)
    {
        if(!primes[c]) continue;
        for(int c2=c+c;c2<primes.size();c2+=c)
        {
            primes[c2]=false;
        }
    }

    int N;
    while(cin>>N)
    {
        int res = 0;
        for(int c=1;c<=N;c++)
        {
            res+=(primes[c] && primes[N-c+1] ? 1:0);
        }
        cout<<res<<endl;
    }
}

Measured memory_bytes: 1196
import sys

N = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().split()))


min_val = -100
for i in range(-100, 101):
    sum_calc = 0
    for j in range(N):
        sum_calc += (a[j] - i)*(a[j] - i)
    if i == -100:
        min_val = i
        min_sum_calc = sum_calc
    if min_sum_calc > sum_calc:
        min_val = i
        min_sum_calc = sum_calc

print(min_sum_calc)

Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
    int h;
    int a;
    int b;
    int cnt = 0;
    int i;
    
    scanf("%d%d%d", &h, &a, &b);
    
    for(i = a; i <= b; i++)
    {
        if(h % i == 0)
        {
            cnt++;
        }
    }
    
    printf("%d\n", cnt);
    
    return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int M,D,cnt=0;
int main()
{
	cin>>M>>D;
	for(int m=1;m<=M;m++)
		for(int d=10;d<=D;d++)
			if((d%10)*(d/10)==m&&(d%10)>=2&&(d/10)>=2)
				++cnt;
	cout<<cnt<<endl;
	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, m, a, b;
// それぞれ 頂点0から行ける点全て、頂点n-1に行ける点全て
// 片方をソートして他方の値で二分探索すればok
vi mid, from;

int main() {
	cin >> n >> m;
	rep(i,m) {
		cin >> a >> b;
		a--, b--;
		if (a==0) mid.pb(b);
		else if (b==n-1) from.pb(a);
	}
	
	sort(all(from));
	each(itr,mid) {
		if (binary_search(all(from), itr)) {
			cout << "POSSIBLE" << ln;
			return 0;
		}
	}
	cout << "IMPOSSIBLE" << ln;
}

Measured memory_bytes: 1276
#include<iostream>
#include<string>
using namespace std;
int main(){
	string a;
	while(true){
		getline(cin,a);
		if(a=="END OF INPUT")
			break;
		int count=0;
		for(int i=0;i<a.size();i++){
			if(a[i]==' '){
				cout<<count;
				count=0;
			}
			else
				count++;
		}
		cout<<count<<endl;
	}
	return 0;
}

Measured memory_bytes: 1184
#include<iostream>
using namespace std;
int s, b, nS, nB;
int z[101], r[101];
int main(){
    cin >> nS >> nB;
    for(s=1; s<=nS; s++){cin>>z[s];}
    for(b=1; b<=nB; b++){
        for(s=1; s<=nS; s++){
            r[s] = z[s]%b;
        }
        for(s=1; s<=nS-1; s++){
            if(r[s] > r[s+1]){
                swap(z[s], z[s+1]);
                swap(r[s], r[s+1]);
            }
        }
    }
    for(s=1; s<=nS; s++){
        cout << z[s] << endl;
    }
}
void swap(int x, int y){
     int w;
     w = x;
     x = y;
     y = w;
}

Measured memory_bytes: 3088
#include<iostream>

int main(){
    /*long long int a,b,c;
    std::cin>>a>>b;
    c=1;  */  
    long long m, n, ans = 1ll;
    const long long mod = 1000000007ll;
    std::cin >> m >> n;
    for (long long i = 0ll; (i + 9) < n; i += 10) {
        ans *= ((((m*m*m)%mod)*((m*m*m)%mod)%mod)*(m*m*m)%mod*m)%mod;
        ans %= mod;
    }
    
   /* for(long long int i=0;i<b/10*10;i+=10){
        c=c*a*a*a*a;
        c=c%1000000007;
        c=c*a*a*a*a;
        c=c%1000000007;
        c=c*a;
        c=c%1000000007;
        c=c*a;
        c=c%1000000007;
    }*/
    for(long long int i=0;i<n%10;i++){
        ans=ans*m;
        ans=ans%1000000007;
    }
    std::cout<<ans<<std::endl;
}



Measured memory_bytes: 3100
# -*- coding: utf-8 -*-
def main():
    N = int(input())
    d = {}
    ans = 0
    for _ in range(N):
        s = "".join(sorted(list(input())))
        if s in d:
            ans += d[s]
            d[s] += 1
        else:
            d[s] = 1
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 17800
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

int A[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

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

  int K;
  cin>>K;
  cout<<A[K-1]<<endl;

  return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	count := map[rune]int{}
	scanner := bufio.NewScanner(os.Stdin)

	for scanner.Scan() {
		s := strings.ToLower(scanner.Text())
		for _, c := range(s) {
			count[c] += 1
		}
	}

	for c := 'a'; c <= 'z'; c++ {
		fmt.Printf("%c : %d\n", c, count[c])
	}
}



Measured memory_bytes: 1096
import java.util.*;

public class Main {

	public static void main(String[] args) {
		int[] n;
		int storn;
		Scanner s = new Scanner(System.in);
		while(true){
			int x = s.nextInt();
			if(x==0) break;
			n = new int[x];
			storn = s.nextInt();
			for(int i=0;i<x;i++)
				n[i]=0;
			int k=0;
			int max=storn;
			while(true){
				if(storn==0){
					storn=n[k];
					n[k]=0;
				}else{
					n[k] += 1;
					storn -= 1;
				}
				if(n[k]==max){
					System.out.println(k);
					break;
				}
				k++;
				if(k==x) k=0;
			}

		}


	}

}

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

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	int n; 
	while(1) {
		if(scanf("%d", &n) == EOF) break;
		int total = 0;
		rep2(i,1,(600/n)) {
			total += n * n * i * n * i;
		}
		cout << total << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include <stdio.h>
using namespace std;
int main()
{
    char a[12];

    int i;
    for(i=0; i<12; i++)
        scanf("%c",&a[i]);
    for(i=0; i<4; i++)
        printf("%c",a[i]);
    printf(" ");
    for(i=4; i<12; i++)
        printf("%c",a[i]);
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
using System;
class _0027
{
    public static void Main()
    {
        string str = Console.ReadLine();
        while (str != "0 0")
        {
            DateTime dt = new DateTime(2004, int.Parse(str.Split()[0]), int.Parse(str.Split()[1]));
            Console.WriteLine(dt.DayOfWeek);
            str = Console.ReadLine();
        }
    }
}

Measured memory_bytes: 5832
module.exports=function(e){var r={};function n(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)n.d(t,o,function(r){return e[r]}.bind(null,o));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=0)}([function(e,r,n){n(1)(n(2).readFileSync("/dev/stdin","UTF-8"))},function(e,r){e.exports=function(e){for(var r=e.split("\n"),n=Number(r[0]),t=r[1].split(" ").map(function(e){return Number(e)}),o={},u={},i=0,c=0,f=0;f<n;f++)f%2==0?(o[t[f]]||(o[t[f]]=0),o[t[f]]+=1,i+=1):(u[t[f]]||(u[t[f]]=0),u[t[f]]+=1,c+=1);var a=[],l=0,s=0,d=i+c,p=i+c;for(var b in o){var v={num:Number(b),count:o[b],isOdd:!0};a.push(v),l+=1}for(var m in 1==l&&(d=o[Object.keys(o)[0]]),u){var y={num:Number(m),count:u[m],isOdd:!1};a.push(y),s+=1}1==s&&(p=u[Object.keys(u)[0]]),a.sort(function(e,r){return r.count-e.count});for(var O,j,g=i+c,x=0;x<a.length;x++){var S=a[x];if(S.isOdd?O=S:j=S,O&&j&&O.num!=j.num){g=i-O.count+(c-j.count);break}}var _=Math.min(g,d,p);console.log(_)}},function(e,r){e.exports=require("fs")}]);

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

int main()
{
    string s,k,u;
    int x,y;
    cin>>s>>k;
    cin>>x>>y;
    cin>>u;
    if(u==s){
        x=x-1;
    }
    else{
        y=y-1;
    }
    cout<<x<<" "<<y;

    return 0;
}


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

int main(){
  int N,M;
  M = 1;
  cin >> N;
  while(1){
    if(N > M){
      M = M*2;
    }
    else if(N == M){
      cout << M << endl;
      break;
    }else if (N < M){
      cout << M/2 << endl;
      break;
    }
  }
  
    
}



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

using namespace std;

typedef long long LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = N; i >= 0; i--)

template<typename Container>
bool include(const Container& c, const typename Container::value_type& v) {
  return ( c.end() != std::find(c.begin(),c.end(),v) );
}

template<class T>
vector<T> unique_vec(const vector<T> &v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  return v;
}

int main() {
  LL N;
  cin >> N;
  vector<LL> A(N);
  rep(i, N)
    cin >> A[i];

  LL s = 0;
  rep(i, N-1) {
    LL d = A[i+1] - A[i];
    // cout << d << endl;
    if (d < 0) {
      s += abs(d);
      A[i+1] += abs(d);
      // cout << s << endl;
    }
  }
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 4776
import io.{StdIn => in}

object Main extends App {
  val Array(sn, sk) = in.readLine.split(" ")
  val n = sn.toInt
  val k = sk.toInt
  val size = sn.size
  val d = in.readLine.split(" ").map(_.toInt)
  val digits = Array.range(0, 11) diff d
  // println(digits.mkString(" "))
  val ans = Array.ofDim[Int](size+1)

  val res = sn.reverse./:(size)((idx,c) => {
    val i = c.toString.toInt + ans(idx)
    val isChange = d.exists(_ == i)
    val dn = if(isChange) digits.minBy(e => if(e > i) e else 11) else i
    // print(i + "," + dn + " ")
    if(isChange) {
      if(dn == 10 && idx != 1) ans(idx-1) = 1
      else if(dn == 10) ans(idx-1) = (digits diff Array(0)).min
      ans(idx) = if(dn != 10) dn else digits.min
      if(idx != 4) (idx+1 to size).foreach(i => ans(i) = digits.min)
    }
    else ans(idx) = i
    idx - 1
  })

  println(ans.mkString.toInt)
}

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

int main(){

  int a,b,c;
  cin >> a >> b >> c;
  if(a+b==c||a+c==b||b+c==a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }


}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
s = int(input())

searched = [0]*(10**6+1)

def func(x):
    if x%2 == 0:
        return x//2
    else:
        return 3*x + 1
searched[s] = 1
for i in range(2, 10**6+2):
    s = func(s)
    if searched[s]:
        print(i)
        break
    else:
        searched[s] = i

Measured memory_bytes: 10868
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np

N,M,L,R = map(int,input().split())

MOD = 10 ** 9 + 7

U = 6*10**5 + 100
fact = [1] * (U+1)
for n in range(1,U+1):
    fact[n] = fact[n-1]*n%MOD
fact_inv = [1] * (U+1)
fact_inv[U] = pow(fact[U],MOD-2,MOD)
for n in range(U,0,-1):
    fact_inv[n-1] = fact_inv[n] * n % MOD

fact = np.array(fact,dtype=np.int64)
fact_inv = np.array(fact_inv,dtype=np.int64)


U = N - M
comb = fact[U] * fact_inv[:U+1] % MOD * fact_inv[U::-1] % MOD
comb[1::2] *= (-1)

P = np.zeros(R+1,dtype=np.int64)
for i,x in enumerate(comb,M):
    P[::i] += x


P[M:] -= P.copy()[:-M]
P %= MOD

# (1-x)^{N+1}で割る
Q = fact[N:N+R+1] * fact_inv[:R+1] % MOD * fact_inv[N] % MOD

def f(R):
    total = fact[R+N] * fact_inv[R] % MOD * fact_inv[N] % MOD
    x = (Q[R::-1] * P[:R+1] % MOD).sum() % MOD
    coef = fact[N] * fact_inv[M] % MOD * fact_inv[N-M] % MOD
    return (total - x*coef)%MOD

answer = (f(R) - f(L-1))%MOD
print(answer)


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

using namespace std;

const int N = 1e5+7;

int n, m;
int a[N], b[N], fa[N], num[N];
long long res[N];

int getf(int s) { return fa[s] == s ? s : fa[s] = getf(fa[s]); }

int main()
{
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= m; ++i) {
        scanf("%d %d", a+i, b+i);
    }
    for (int i = 1; i <= n; ++i) {
        fa[i] = i;
        num[i] = 1;
    }
    res[m] = 1ll*n*(n-1)/2;
    for (int i = m; i; --i) {
        int fx = getf(a[i]), fy = getf(b[i]);
        long long dec = 0;
        if (fx != fy) {
            dec = 1ll*num[fx]*num[fy];
            fa[fx] = fy;
            num[fy] += num[fx];
        }
        res[i-1] = res[i]-dec;
    }
    for (int i = 1; i <= m; ++i) {
        printf("%lld\n", res[i]);
    }
    return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&b==c) puts("Yes");
	else puts("No");
    return 0;
}


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

int main() {
    char c;
    char ans;
    cin >> c;
    if('a'<=c && c<='z'){
        cout << 'a' << endl;
    }else{
        cout << 'A' << endl;
    }
}

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

using namespace std;
typedef long long ll;

const ll INF = 1e9;

int main() {
  int H, W, N;
  cin >> H >> W >> N;
  vector<int> color(N);
  for (int i = 0; i < N; i++) {
    cin >> color[i];
  }

  vector<vector<int> > G(H, vector<int>(W));
  int key = 0;
  for (int i = 0; i < H; i++) {
    if (i % 2 == 0) {
      for (int j = 0; j < W; j++) {
        G[i][j] = key;
        color[key]--;
        if (color[key] == 0) {
          key++;
        }
      }
    } else {
      for (int j = W - 1; j >= 0; j--) {
        G[i][j] = key;
        color[key]--;
        if (color[key] == 0) {
          key++;
        }
      }
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << G[i][j] + 1 << " ";
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include "stdio.h"

int n,ptr;
int a[200005];
long long sum,d;
int stV[200005];
int stC[200005];


int main(){
	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		scanf("%d",&a[i]);
		int c = 1;
		while(ptr>0&&stV[ptr-1]>a[i]){
			d -= stV[ptr-1]*(long long)stC[ptr-1];
			c += stC[ptr-1];
			ptr--;
		}

		d += a[i]*(long long)c;
		stC[ptr] = c;
		stV[ptr] = a[i];
		ptr++;

		sum += d;
	}
	printf("%lld\n",sum);
}

Measured memory_bytes: 2560
# E - Bullet

from collections import Counter
from math import gcd

n = int(input())
counter = Counter()  # 各ベクトルの個数
for i in range(n):
    a, b = map(int, input().split())
    if b < 0:
        a, b = -a, -b  # 180度回転して第1〜2象限に
    elif b == 0:
        a = abs(a)
    if not a == b == 0:
        # 既約化
        g = gcd(a, b)
        a //= g
        b //= g
    counter[(a, b)] += 1

modulus = 1000000007

vs = set(counter)
# 第2象限のベクトルと直交するベクトルを追加
vs.update((b, -a) for a, b in counter if a <= 0)
# 第1象限のベクトルのみ抽出
vs = [(a, b) for a, b in vs if a > 0]

ncomb = 1  # イワシの選び方の個数
for a, b in vs:
    # 互いに仲が悪いイワシ群
    n1 = counter[(a, b)]
    n2 = counter[(-b, a)]
    # それぞれの群から好きな数だけイワシを選ぶ (0匹選ぶことも含む)
    m = pow(2, n1, modulus) + pow(2, n2, modulus) - 1
    ncomb = ncomb * m % modulus

ncomb -= 1  # 1匹も選ばない場合を除く

# (0, 0)のイワシを1匹だけ選ぶ
ncomb += counter[(0, 0)]

print(ncomb % modulus)


Measured memory_bytes: 81996
#include <algorithm>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define double long double
#define INF LLONG_MAX
#define P pair<int,int>
#define prique priority_queue
using namespace std;
signed main() {
	int r, d, x;
	cin >> r >> d >> x;
	rep(i, 10) {
		cout << r * x - d << endl;
		x = r * x - d;
	}
	return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline

n = int(input())
xl = []
for i in range(n):
    a, b = map(int, input().split())
    xl.append([a, b])

count = 1
arms = []
for i in range(len(xl)):
    a = xl[i][0] - xl[i][1]
    b = xl[i][0] + xl[i][1]
    arms.append([a, b])
arms.sort(key=lambda x: x[1])
min = arms[0][1]


for i in range(1, n):
    if min <= arms[i][0]:
        count += 1
        min = arms[i][1]

print(count)



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

using namespace std;

using ll = long long;

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<bool> is_prime(N + 1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= N; ++i) {
        if (!is_prime[i]) continue;
        for (int j = 2 * i; j <= N; j += i) is_prime[j] = false;
    }
    ll ans = 1;
    for (int i = 2; i <= N; ++i) {
        if (!is_prime[i]) continue;
        ll cnt = 0;
        for (int j = 1; j <= N; ++j) {
            int n = j;
            while (n % i == 0) n /= i, ++cnt; 
        }
        ++cnt;
        ans = (ans * cnt) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#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);
}

void solve() {
	int a, b; cin >> a >> b;
	cout << ((a*b)%2?"Odd":"Even");
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
 
    int n;
    string w[40];
    int lens[] = {5, 7, 5, 7, 7};
 
    while(cin >> n, n) {
 
        for(int i = 0; i < n; ++i) {
            cin >> w[i];
        }
 
        for(int i = 0; i < n; ++i) {
 
            int len = 0, phrase = 0;
 
            for(int j = i; j < n; ++j) {
 
                len += w[j].size();
 
                if(len == lens[phrase]) {
                    len = 0;
                    ++phrase;
                    if(phrase == 5) {
                        cout << i + 1 << endl;
                        break;
                    }
                }
            }
 
            if(phrase == 5) {
                break;
            }
 
        }
 
    }
 
}

Measured memory_bytes: 3040
n=int(input())
s=list(input())
l=[]
sh=s[0]
s.remove(sh)
c=0
for i in s:
  if i=='E':
    c+=1
l.append(c)
for i in range(len(s)):
  tsu=s[i]
  if sh=='W':
    c+=1
  if tsu=='E':
    c-=1
  l.append(c)
  sh=tsu
print(min(l))

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

int main(){
  string s,t;
  cin >> s >> t;
  int ans=1000;
  for(int i=0,l=s.size()-t.size()+1;i<l;i++){
    int n=0;
    for(int j=0,k=t.size();j<k;j++)
      if(t.at(j)!=s.at(i+j))
        n++;
    ans=min(ans,n);
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
    int n, m, l, **A, **B;
    long **C;

    cin >> n >> m >> l;
    A = new int*[n];
    B = new int*[m];
    C = new long*[n];
    for (int i = 0; i < n; i++) {
        A[i] = new int[m];
        C[i] = new long[l];
        for (int j = 0; j < m; j++)
            cin >> A[i][j];
        for (int k = 0; k < l; k++)
            C[i][k] = 0;
    }
    for (int j = 0; j < m; j++) {
        B[j] = new int[l];
        for (int k = 0; k < l; k++)
            cin >> B[j][k];
    }

    for (int i = 0; i < n; i++) {
        for (int k = 0; k < l; k++) {
            for (int j = 0; j < m; j++)
                C[i][k] += A[i][j] * B[j][k];
            if (k == l - 1)
                cout << C[i][k] << endl;
            else
                cout << C[i][k] << ' ';
        }
    }

    for (int i = 0; i < n; i++) {
        delete[] A[i];
        delete[] C[i];
    }
    for (int j = 0; j < m; j++)
        delete[] B[j];
    delete[] A;
    delete[] B;
    delete[] C;
}


Measured memory_bytes: 3212
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		Set<Integer> l = new HashSet<Integer>();
		l.add(sc.nextInt());
		l.add(sc.nextInt());
		l.add(sc.nextInt());
		System.out.println(l.size());
	}

}

Measured memory_bytes: 19924
#include <bits/stdc++.h>
#define ll         long long int 
#define pb         push_back
#define umap       unordered_map
#define mod        1000000007
#define all(x)     (x).begin(), (x).end()
#define MN(a,b,c)  min(a,min(b,c))
#define pr         pair<ll,ll>
#define F          first
#define S          second
#define mP         make_pair
#define f(i,n)     for(int i=0;i<n;i++)
#define f1(i,x,y)   for(int i=x;i<=y;i++)
#define f2(i,x,y)  for(int i=x;i>=y;i--)
//__builtin_popcount(x)
//__builtin_parity(x)   =(number of set bits)%2
//__builtin_clz(x)      to count the number of leading  zeroes 
//__builtin_ctz(x)      to count the number of trailing zeroes 
//__gcd(a,b)
using namespace std;
int main()
{
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
  int n;cin>>n;
  ll ans=0;
  f1(i,1,n)
  {
    ll k=n/i;
    ll term=(k*((k+1)*i))/2;
    ans+=term;
  }
  cout<<ans;
 }




Measured memory_bytes: 3672
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = Integer.parseInt(sc.next());
			int m = Integer.parseInt(sc.next());
			if (n == 0 && m == 0) break;
			int[] sa = new int[n];
			int[] sb = new int[m];
			int suma = 0;
			int sumb = 0;
			for (int i = 0; i < n; i++) {
				sa[i] = Integer.parseInt(sc.next());
				suma += sa[i];
			}
			for (int i = 0; i < m; i++) {
				sb[i] = Integer.parseInt(sc.next());
				sumb += sb[i];
			}
			boolean e = false;
			loop:for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					if (suma - sa[i] + sb[j] == sumb - sb[j] + sa[i]) {
						System.out.println(sa[i] + " " + sb[j]);
						e = true;
						break loop;
					}
				}
			}
			if (!e)
				System.out.println(-1);
		}
	}
}


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

int main() {
  int N, j, v;
  cin >> N;
  int s[N];

  for (size_t i = 0; i < N; i++) {
    cin >> s[i];
  }

  for (size_t i = 0; i < N; i++) {
    v = s[i];
    j = i-1;
    while (j >= 0 && s[j] > v) {
      s[j+1] = s[j];
      j -= 1;
    }
    s[j+1] = v;
    for (size_t i = 0; i < N; i++) {
      cout << s[i];
      if (i < N-1) {
        cout << " ";
      }
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 3096
integer N,M
integer X,Y
integer EDGE(100000,1000)
integer Nindex(100000)
integer DP(100000)
integer ans
read*,N,M
EDGE(:,:)= 0
Nindex = 0
do i=1,M
  read*,X,Y
  Nindex(X)=Nindex(X)+1
  EDGE(X,Nindex(X))=Y
end do

DP = -1
ans = 0
do i=1,N
  if( DP(i)== -1)DP(i)=DFS(i)
  ans=max(ans,DP(i) )
end do

print"(I0)",ans

contains

recursive function DFS(u)result(res)
integer u,res

if(DP(u) >= 0)then
  res=DP(u)
else
  DP(u)=0
  do j=1,Nindex(u)
    DP(u)=max(DP(u),DFS(EDGE(u,j))+1)
  end do
  res=DP(u)
endif
end function DFS
end


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

struct Query {
  int index;
  int l, r;
};

template <typename T>
class SegmentTree {
 private:
  function<T(T, T)> merge_fn;
  T empty_value;
  vector<T> nodes;
  int num_nodes;

  // Returns the fold of overwrap between [node_l, node_r) and [l, r).
  // nodes[node_index] needs to correspond to [node_l, node_r).
  T GetRangeInternal(int node_index, int node_l, int node_r, int l, int r) {
    if (node_r <= l || r <= node_l) return empty_value;
    if (l <= node_l && node_r <= r) return nodes[node_index];
    int node_m = (node_l + node_r) / 2;
    return merge_fn(
        GetRangeInternal(2 * node_index, node_l, node_m, l, r),
        GetRangeInternal(2 * node_index + 1, node_m, node_r, l, r));
  }

 public:
  // Arguments:
  // in_merge: The function to merge two values. It should be a monoid.
  // in_empty_value: The identity of the monoid.
  // xs: The initial values.
  SegmentTree(
      function<T(T, T)> merge_fn, T empty_value, const vector<T>& xs) :
          merge_fn(merge_fn), empty_value(empty_value) {
    int n = xs.size();
    num_nodes = 1;
    while (num_nodes < n) num_nodes *= 2;
    num_nodes *= 2;
    nodes = vector<T>(num_nodes, empty_value);
    for (int i = 0; i < xs.size(); ++i) {
      nodes[num_nodes / 2 + i] = xs[i];
    }
    for (int i = num_nodes / 2 - 1; i >= 1; i--) {
      nodes[i] = merge_fn(nodes[2 * i], nodes[2 * i + 1]);
    }
  }

  // Updates the i-th element to x.
  void Update(int i, T x) {
    nodes[num_nodes / 2 + i] = x;
    for (int cur = (num_nodes / 2 + i) / 2; cur > 0; cur /= 2) {
      nodes[cur] = merge_fn(nodes[2 * cur], nodes[2 * cur + 1]);
    }
  }

  // Returns the value of the range [l, r) merged by merge_fn.
  T GetRange(int l, int r) {
    return GetRangeInternal(1, 0, num_nodes / 2, l, r);
  }

  T Get(int i) {
    return nodes[num_nodes / 2 + i];
  }
};

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

  int n;
  int q;
  cin >> n >> q;
  vector<int> cs(n);
  for (int i = 0; i < n; i++) {
    cin >> cs[i];
    cs[i]--;
  }
  vector<vector<Query>> r_to_qs(n);
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    r_to_qs[r].push_back({i, l, r});
  }

  vector<int> last_pos_vector(n, -1);
  
  SegmentTree<int64> tree(
      [](int64 x, int64 y) { return x + y; },
      0,
      vector<int64>(n, 0));
  
  vector<int64> ans(q);
  for (int r = 0; r < n; r++) {
    int c = cs[r];
    int p = last_pos_vector[c];
    last_pos_vector[c] = r;
    if (p >= 0) {
      tree.Update(p, tree.Get(p) - 1);
    }
    tree.Update(r, tree.Get(r) + 1);
    for (const auto& q : r_to_qs[r]) {
      int64 v = tree.GetRange(q.l, q.r + 1);
      ans[q.index] = v;
    }
  }
  for (int i = 0; i < q; i++) {
    cout << ans[i] << "\n";
  }
}


Measured memory_bytes: 42420
class SWAG():
    def __init__(self,unit,f,data):
        self.unit=unit
        self.f=f
        self.fold_r=[unit]
        self.fold_l=[unit]
        self.data_r=[]
        self.data_l=[]
        sep=len(data)//2
        for t in data[sep:]:
            self.append(t)
        for t in data[sep-1::-1]:
            self.appendleft(t)
    def append(self,x):
        self.fold_r.append(self.f(self.fold_r[-1],x))
        self.data_r.append(x)
    def appendleft(self,x):
        self.fold_l.append(self.f(self.fold_l[-1],x))
        self.data_l.append(x)
    def pop(self):
        if not self.data_r:
            self.__init__(self.unit,self.f,self.data_l[::-1])
        self.fold_r.pop()
        return self.data_r.pop()
    def popleft(self):
        if not self.data_l:
            self.__init__(self.unit,self.f,self.data_r)
        self.fold_l.pop()
        return self.data_l.pop()
    def fold_all(self):
        return self.f(self.fold_r[-1],self.fold_l[-1])
n,k,*p=map(int,open(0).read().split())
c=[0]
for a,b in zip(p,p[1:]):c+=c[-1]+(a<b),
*c,f=[b-a==k-1for a,b in zip(c,c[k-1:])]
x=not f
s_min=SWAG(10**18,min,p[:k-1])
s_max=SWAG(0,max,p[1:k])
for i,(a,b,c)in enumerate(zip(p,p[k:],c)):
    f|=c
    s_min.append(p[i+k-1])
    s_max.append(b)
    if not c and(a!=s_min.fold_all()or b!=s_max.fold_all()):x+=1
    s_min.popleft()
    s_max.popleft()
print(x+f)

Measured memory_bytes: 25884
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	
	private void run() throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		StringTokenizer st = new StringTokenizer(reader.readLine());
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(st.nextToken());
		}
		int q = Integer.parseInt(reader.readLine());
		st = new StringTokenizer(reader.readLine());
		for (int i = 0; i < q; i++) {
			if (subsetSum(Integer.parseInt(st.nextToken()), a)) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}
		reader.close();
	}

	private boolean subsetSum(int s, int[] a) {
		return subsetSum(0, s, a);
	}

	private boolean subsetSum(int i, int s, int[] a) {
		boolean ret = false;
		if (s == 0) {
			ret = true;
		} else if (i >= a.length) {
			ret = false;
		} else {
			ret = subsetSum(i+1, s-a[i], a) || subsetSum(i+1, s, a);
		}
		return ret;
	}
}



Measured memory_bytes: 25060
#include <bits/stdc++.h>
using namespace std;
int n,x,maxi=INT_MIN,mini=INT_MAX;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x;
        if(x>maxi)maxi=x;
        if(x<mini)mini=x;
    }
    cout<<maxi-mini;
return 0;
}


Measured memory_bytes: 256
n = int(input())
hist = list(map(lambda x: int(x), input().split()))

min_val = 0
ans = True

for h in hist:
    if h-1 >= min_val:
        min_val = h - 1
    elif h >= min_val:
        min_val = h
    else:
        ans = False
        
if ans:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14396
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1e9+10)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))



int main(void){
	int n;
	cin>>n;
	string s;
	vector<string> S;
	rep(i,n){
		cin>>s;
		S.push_back(s);
	}

	vector<int> alphabet;
	rep(i,26){
		alphabet.push_back(INF);
	}

	rep(i,S.size()){
		vector<int> count_alphabet;
		rep(j,26){
			count_alphabet.push_back(0);
		}

		rep(j,S[i].size()){
			count_alphabet[S[i][j] - 'a']++;
		}

		rep(j,26){
			alphabet[j] = min(alphabet[j], count_alphabet[j]);
		}
	}

	string ans = "";
	rep(i,26){
		while(alphabet[i] > 0){
			ans.push_back(i+'a');
			alphabet[i]--;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

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

    bool f = true, c = false;
    for(int i = 0; i < str.size(); i++) {
        if(f && str[i] == 'A') f = false;
        else if(!f && str[i] == 'Z') {
            f = true;
            cout << "AZ";
            c = true;
        }
    }
    cout << (!c ? "-1\n" : "\n");

    return 0;
}

Measured memory_bytes: 1164
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);
    let A = read![[usize]];
    let mut B = vec![0; N];
    for i in 0..N {
        B[A[i] - 1] = i + 1;
    }
    println!(
        "{}",
        B.into_iter()
            .map(|b| b.to_string())
            .collect::<Vec<_>>()
            .join(" ")
    )
}


Measured memory_bytes: 11004
#include <bits/stdc++.h>
#define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ll long long
#define endl '\n'
//pair<int, int> *p=new pair<int, int>[n];
//std::vector<pair<int,int>> vp;
//v.push_back(make_pair(x,y))
//pair<int, int> p[1000001];
//string *s=new string [n];
//int freq[e];
//freq[a[i]-'a']++; freq[a[i]]++;
using namespace std;
ll n, t, m, c1, c2, c, x, y, sum, mn = 999999999, avg, pos, dif, dis,k, mx, xi, yi, q;
const int MXN=1e7;

const int md=1e9+7;
ll dp [MXN];
ll pre[MXN];
bool prime[MXN];
bool vis [MXN];
bool PE ( ll x )
{
    for ( ll i = 2; i * i <= x; i+=1+(i&1))
    if ( x % i == 0 )
    return false;
    return true;
}
void sieve()
{
    memset(prime , 1 , sizeof prime);

    for ( ll i = 2; i * i <= MXN; i+=1+(i&1))
    if (prime[i])
    {
          for (ll j = i * i; j < MXN; j +=i)
         prime[j] = false;
    }
}

bool PR ( string s )
{
    int n = s.length();
    for ( ll i = 0; i < n / 2; i++ )
    if ( s[i] != s[n - i - 1] )
    return false;
    return true;
}


int main (void){
    SpeeD;
  string s ,ss;
  cin >> s >> ss;
  for (int i =  0 ; i  <s.length() ; i++)
  if (s[i] != ss[i] )
  c++;
  cout << c;




}







Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main(){
	int n;
	cin >> n;
	map<ll, ll> mp;
	rep(i,n){
		int a;
		cin >> a;
		mp[a]++;
	}
	ll ans = 0;
	vector<ll> rec;
	vector<ll> sq;
	for(auto e : mp){
		if(e.second>=2) rec.push_back(e.first);
		if(e.second>=4) sq.push_back(e.first); 
	}
	sort(rec.rbegin(), rec.rend());
	sort(sq.rbegin(), sq.rend());
	if(rec.size()>=2)chmax(ans, rec[0]*rec[1]);
	if(sq.size()) chmax(ans, sq[0]*sq[0]);
	cout << ans << endl;

}

Measured memory_bytes: 6528
// Problem : D - Friends
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


#include<bits/stdc++.h>
using namespace std;


#define sc(ar,n) for(int pen=0;pen<n;pen++){ cin>>ar[pen];}
#define pr(ar,n) for(int pen=0;pen<n;pen++){ cout<<ar[pen]<<" ";} cout<<endl;
#define mem(ar,x) memset(ar,x,sizeof(ar))
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define rt return 0;
#define ct continue;
#define pb push_back
#define ll long long int
#define ff first
#define ss second
#define mod 1000000007
#define maxn 1000003
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

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

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...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

vector<ll>adj[maxn];
ll vis[maxn];
ll cc_size;

void dfs(ll node){
	vis[node] = 1;
	cc_size++;
	
	for(ll child:adj[node]){
		if(!vis[child])dfs(child);
	}
}

int main(){
	
	fastio;
	ll n,m,a,b;
	cin>>n>>m;
	ll ans=0;
	

	for(int i=0;i<m;i++){
		cin>>a>>b;
		
		adj[a].pb(b);
		adj[b].pb(a);
		
	}
	for(int i=1;i<=maxn;i++){
		if(!vis[i])
		{
	    ans=max(ans,cc_size);
		cc_size=0;
		dfs(i);
					
		}
	}
	cout<<ans;
	
	}


	
	
	
	



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

int main()
{
	int K, S, d = 0;
		cin >> K >> S;

		if (3 * K == S) {
			cout << 1 << endl;
			return 0;
		}
		if (3 * K < S) {
			cout << 0 << endl;
			return 0;
		}

	for (int i = 0; i <= K; i++) {
		for (int j = 0; j <= K; j++) {

				if (S-(i + j)>=0&&S-(i+j)<=K) {
					d++;
			}
		}
	}
	cout << d << endl;
		return 0;
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int q; cin>>q;
    priority_queue<int64_t,vector<int64_t>> left;
    priority_queue<int64_t,vector<int64_t>,greater<int64_t>> right;
    int64_t lsum=0,rsum=0;
    int64_t bsum=0;
    while(q--){
        int op; cin>>op;
        int ln=left.size();
        int rn=right.size();
        if(op==1){
            int64_t a,b; cin>>a>>b;
            bsum+=b;
            // leftが1個多くなるように
            if(ln>rn){
                left.push(a);
                lsum+=a;
                int64_t ll=left.top(); left.pop();
                lsum-=ll;
                right.push(ll);
                rsum+=ll;
            }else{
                right.push(a);
                rsum+=a;
                int64_t rr=right.top(); right.pop();
                rsum-=rr;
                left.push(rr);
                lsum+=rr;
            }
        }else{
            int64_t mid=left.top();
            int64_t f=0;
            f+=mid*ln-lsum;
            f+=rsum-mid*rn;
            cout<<mid<<" "<<f+bsum<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3828
#include <stdio.h>

int main() {
	int A, B, kei;

	scanf("%d %d", &A, &B);

	if (A > B) {
		kei = 2 * A - 1;
	}
	else if (A < B) {
		kei = 2 * B - 1;
	}
	else {
		kei = A + B;
	}

	printf("%d\n", kei);

	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

import javax.sql.rowset.serial.SerialArray;

public class Main {

		public static void main(String[] args){
			
			Scanner sc = new Scanner(System.in);
			// 整数の入力
			// スペース区切りの整数の入力
			String str = sc.next();
			String[] strArray = str.split("");
			 
			for (int i = 0; i < strArray.length; i++) {
				for (int j = i + 1; j < strArray.length; j++) {
				    // 1文字ずつ表示
			        if (strArray[i].toString().equals(strArray[j].toString())){
					    System.out.println("no");
			    	    return;
			        }
				}
			}
			
			System.out.println("yes");

		}
}


Measured memory_bytes: 20820