akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) FOR(i, 0, n)
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define FINF(a) memset(a, 0x3f, sizeof(a))
#define POW(n) (1LL << (n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i, a, b) ((a) <= (i) && (i) <= (b))
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a > b) { a = b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a < b) { a = b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(begin(a), end(a)); }
template <typename T> inline void REV(T& a) { reverse(begin(a), end(a)); }
template <typename T> inline void UNI(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <typename S, typename T> inline T LB(S& v, T a) { return *lower_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int LBP(S& v, T a) { return lower_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> inline T UB(S& v, T a) { return *upper_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int UBP(S& v, T a) { return upper_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> ostream& operator << (ostream& os, const pair<S, T>& p) { os << p.first << " " << p.second; return os; }
template <typename S, typename T> istream& operator >> (istream& is, pair<S, T>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator << (ostream& os, const vector<T>& v) { for (int i = 0; i < v.size(); ++i) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator >> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e, v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int A, B, P, Q, R;

void _main() {
    cin >> A >> B >> P >> Q >> R;
    double t = 1.0 * (B * P - (B - A) * Q) / (Q + R);
    cout << t + B << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("output.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}


Measured memory_bytes: 3308
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    rep(i, m) cin >> a[i];
    int ans = n - accumulate(all(a), 0);
    cout << (ans < 0 ? -1 : ans) << endl;
}

Measured memory_bytes: 3664
#include "bits/stdc++.h"

#define rep(i,n) for(int i = 0;i<n;i++)
#define vv(Type,Name, n,m,d)vector<vector<Type>> Name(n, vector<Type>(m, d))
#define P pair
using namespace std;
using ll = long long;


int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);

	int d, t, s;
	cin >> d >> t >> s;
	if (d <= t * s) cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}


Measured memory_bytes: 3648
a = []
for _ in range( 3 ):
    a.append( list( map( int, input().split() ) ) )

n = int( input() )
b = []
for _ in range( n ):
    b.append( int( input() ) )

bingo = [ [ False ] * 3 for _ in range( 3 ) ]

for i in range( 3 ):
    for j in range( 3 ):
        if a[ i ][ j ] in b:
            bingo[ i ][ j ] = True

for i in range( 3 ):
    if bingo[ i ][ 0 ] and bingo[ i ][ 1 ] and bingo[ i ][ 2 ]:
        print( "Yes" )
        exit()

for j in range( 3 ):
    if bingo[ 0 ][ j ] and bingo[ 1 ][ j ] and bingo[ 2 ][ j ]:
        print( "Yes" )
        exit()

if bingo[ 0 ][ 0 ] and bingo[ 1 ][ 1 ] and bingo[ 2 ][ 2 ]:
    print( "Yes" )
    exit()

if bingo[ 0 ][ 2 ] and bingo[ 1 ][ 1 ] and bingo[ 2 ][ 0 ]:
    print( "Yes" )
    exit()

print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <set>
#include <vector>

using namespace std;

int main() {
    string str;
    cin >> str;
    set<char> st;
    for(int i=0; i<str.size(); i++) {
        st.insert(str[i]);
    }
    
    if(st.size()<26) {
        cout << str;
        for(int i=0; i<26; i++) {
            if(st.find((char)('a'+i))==st.end()) {
                cout << (char)('a'+i) << endl;
                break;
            }
        }
    } else {
        set<char> vec;
        vec.insert(str[25]);
        int i;
        for(i=25; i>=1; i--) {
            if(str[i-1]<str[i]) {
                break;
            }
            vec.insert(str[i-1]);
        }
        if(vec.size()==26) {
            cout << -1 << endl;
        } else if(vec.upper_bound(str[i-1])!=vec.end()) {
            for(int j=0; j<i-1; j++) {
                cout << str[j];
            }
            cout << (*vec.upper_bound(str[i-1])) << endl;
        }
    }


    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
  vector<int> vec(n);
  for (int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  int a=0;
  int b=0;
  for(int i=0;i<n;i++){
    if(i%2==0) a+=vec.at(i);
    else b+=vec.at(i);
  }
  cout << a-b <<endl;
}

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


int main(void)
{	
	int n,m;
	scanf("%d %d",&n,&m);
	
	printf("%d\n",(n-1)*(m-1));
	return 0;
}

Measured memory_bytes: 128
use std::io;
use std::str::FromStr;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();

    let mut buf = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    let (a, b) = (buf.next().unwrap(), buf.next().unwrap());

    let ans;
    if b % a == 0 {
        ans = a + b;
    } else {
        ans = b - a;
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var w,h,x,y int
    fmt.Scan(&w,&h,&x,&y)
    ans := float64(w)*float64(h)/2
    if w%2==0 && h%2==0 && x==w/2 && y==h/2{
        fmt.Println(ans,1)
    } else {
        fmt.Println(ans,0)
    }
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func makeTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func sortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}

func reverseString(s string) string{
    t := []rune(s)
    for i,j := 0, len(s)-1 ; i < j ; i, j = i+1, j-1 {
        t[i], t[j] = t[j], t[i]
    }
    return string(t)
}

func stringRev(s []byte,l int,r int) []byte{
    for i:=0;i<(r-l+1)/2;i++{
        s[l-1+i], s[r-1-i] = s[r-1-i], s[l-1+i]
    }
    return s
}

func inside(h,w,H,W int) bool{
    if h>=0 && h<H && w>=0 && w<W{
        return true
    }
    return false
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(ll i=0;i<n;++i){
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    vector<ll> b(n);
    for(ll i=0;i<n;++i){
        cin>>b[i];
    }
    sort(b.begin(), b.end());
    vector<ll> c(n);
    for(ll i=0;i<n;++i){
        cin>>c[i];
    }
    sort(c.begin(), c.end());

    ll ans = 0;
    for(ll i=0;i<n;++i){
        ans += (lower_bound(a.begin(), a.end(), b[i]) - a.begin()) * (c.end() - upper_bound(c.begin(), c.end(), b[i]));
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;
class Main
{
	public static void main(String[] args)throws Exception
	{
		Scanner scan=new Scanner(System.in);
		
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		
		if(a<b&&b<c)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26272
import math

def main():
    S = input()
    flag = 1
    for i in range(1, len(S)):
       if S[i] == S[i-1]:
           print("Bad")
           flag=0
           break
       else:
           pass
    if flag:
        print("Good")

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cmath>
#define ll long long
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,r,l)for(int i=r;i>=l;i--)
using namespace std;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int n;
	cin >> n;
	double v[2000];
	rep(i, 1, n) {
		cin >> v[i];
	}
	sort(v+1, v + n+1);
	double ant = (v[1] + v[2]) / 2;
	rep(i, 3, n) {
		ant = (ant + v[i]) / 2;
	}
	cout << ant << endl;
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		String s = fs.next();
		
		int q = fs.nextInt();
		StringBuffer sbFront = new StringBuffer();
		StringBuffer sbBack = new StringBuffer();
		
		// 0そのまま, 1反転
		int nowState = 0;
		for(int i = 0; i < q; i++) {
			int sousa = fs.nextInt();
			
			if(sousa == 1) {
				nowState = (nowState + 1) % 2;
			}else {
				int f = fs.nextInt();
				String str = fs.next();
				
				if(f == 1) {
					if(nowState == 0) {
						sbFront.append(str);
					}else {
						sbBack.append(str);
					}
				}else {
					if(nowState == 0) {
						sbBack.append(str);
					}else {
						sbFront.append(str);
					}
				}
			}
		}
		
		StringBuffer sBuf = new StringBuffer(s);
		StringBuffer ans = new StringBuffer();
		if(nowState == 0) {
			ans.append(sbFront.reverse()).append(s).append(sbBack);
			System.out.println(ans.toString());
		}else {
			ans.append(sbBack.reverse()).append(sBuf.reverse()).append(sbFront);
			System.out.println(ans.toString());
		}
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 45156
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {
	static List<Integer> list = new ArrayList<Integer>();
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		while (scan.hasNext()) {
			int sum = (scan.nextInt() + scan.nextInt());
			System.out.println(String.valueOf(sum).length());
		}
	}
}

Measured memory_bytes: 26200
n,k,q=map(int,input().split(" "))

present=[]
for i in range(n):
	present.append(0)

for i in range(q):
	present[int(input())-1]+=1

for i in range(len(present)):
	present[i]=present[i]-q+k

for i in present:
	if i>0:
		print("Yes")

	else:
		print("No")

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

bool check(int n){
    if(n < 2) return false;
    else if(n==2) return true;
    else if(n%2==0) return false;

    double sqrtn = sqrt(n);
    for(int i=3; i<=sqrtn; i+=2){
        if(n%i==0){
            return false;
        }
    } 

    return true;
}


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

    while(!check(x)){
        x++;
    }

    cout << x << endl;
} 

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

int main()
{
    int n,m,x;
    cin>>n>>m>>x;
    bool z[n][m];
    memset(z,0,sizeof(z));
    for(int i=0; i<x; i++)
    {
        int a,b,c;
        cin>>a>>b>>c;
        if(c==1)
        {
            for(int j=0; j<a; j++)
                for(int k=0; k<m; k++)
                    z[j][k]=1;
        }
        else if(c==2)
        {
            for(int j=a; j<n; j++)
                for(int k=0; k<m; k++)
                    z[j][k]=1;
        }
        else if(c==3)
        {
            for(int j=0; j<n; j++)
                for(int k=0; k<b; k++)
                    z[j][k]=1;
        }
        else if(c==4)
        {
            for(int j=0; j<n; j++)
                for(int k=b; k<m; k++)
                    z[j][k]=1;
        }
    }
    int ans=0;
    for(int i=0; i<n; i++)
        for(int j=0; j<m; j++)
            if(!z[i][j]) ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
a, b = [], []
appear_count = [0] * 4
for _ in range(3):
    _a, _b = map(int, raw_input().split())
    appear_count[_a - 1] += 1
    appear_count[_b - 1] += 1
if max(appear_count) == 3:
    print "NO"
else:
    print "YES"

Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
using ll = long long;
int N;
ll K;
ll s[100000],d[100000];
ll count(ll x){	//<=x
	ll cnt = 0;
	rep(i,N){
		if(x<s[i]) continue;
		cnt += (x-s[i])/d[i]+1;
		if(cnt>=K) return K;
	}
	return cnt;
}
int main(){
	cin>>N>>K;
	rep(i,N) cin>>s[i]>>d[i];
	ll ub = 3e18, lb = 0;
	while(ub-lb>1){
		ll m = (ub+lb)/2;
		if(count(m)>=K) ub = m;
		else lb = m;
	}
	cout<<ub<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>

using namespace std;
typedef long long LL;
const LL INF=1e17L;
const int inf=0x3f3f3f3f;
const int maxn=2e5+5;
const int Mod=1e9+7;
struct E{
    int v,next;
}edge[maxn*30];
int head[maxn],tot,n,x,y,c[maxn],w[maxn];
void init()
{
    memset(head,-1,sizeof(head));
    tot=-1;
}
void addedge(int u,int v)
{
    edge[++tot].v=v;
    edge[tot].next=head[u];
    head[u]=tot;
}
int p[maxn],mp,tp,vis[maxn];
vector<int>g[maxn];
LL quick_pow(LL a,LL b)
{
    LL ans=1;
    while(b)
    {
        if(b&1) ans=ans*a%Mod;
        a=a*a%Mod;
        b>>=1;
    }
    return ans;
}
LL ni(LL a)
{
    return quick_pow(a,Mod-2);
}
LL jc[maxn];
void init2()
{
    jc[1]=1;
    jc[0]=1;
    for(LL i=2;i<=n;i++)
        jc[i]=i*jc[i-1]%Mod;
}
int num[maxn],total;
vector<int>tmp;
void dfs(int u)
{
    vis[u]=1;
    total++;
    num[c[u]]++;
    tmp.push_back(c[u]);
    for(int i=head[u];i!=-1;i=edge[i].next)
    {
        int v=edge[i].v;
        if(vis[v]) continue;
        dfs(v);
    }
}
int main()
{
    cin>>n>>x>>y;
    memset(p,-1,sizeof(p));
    mp=tp=-1;
    for(int i=1;i<=n;i++)
    {
        cin>>c[i]>>w[i];
        g[c[i]].push_back(i);
        if(p[c[i]]==-1 || w[p[c[i]]]>w[i]) p[c[i]]=i;
        if(mp==-1 || w[mp]>w[i]) mp=i;
    }
    for(int i=1;i<=n;i++)
    {
        if(p[i]==-1 || i==c[mp]) continue;
        if(tp==-1 || w[tp]>w[p[i]]) tp=p[i];
    }
    init();
    for(int i=0;i<(int)g[c[mp]].size();i++)
    {
        if(tp!=-1 && w[tp]+w[g[c[mp]][i]]<=y) addedge(tp,g[c[mp]][i]),addedge(g[c[mp]][i],tp);
    }
    for(int i=1;i<=n;i++)
    {
        if(c[i]==c[mp]) continue;
        if(w[i]+w[mp]<=y) addedge(i,mp),addedge(mp,i);
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<(int)g[i].size();j++)
        {
            if(w[p[i]]+w[g[i][j]]<=x ) addedge(p[i],g[i][j]),addedge(g[i][j],p[i]); //同色
        }
    }
    init2();
    memset(vis,0,sizeof(vis));
    memset(num,0,sizeof(num));
    LL ans=1;
    for(int i=1;i<=n;i++)
    {
        if(!vis[i] && p[i]!=-1)
        {
            total=0;
            tmp.clear();
            dfs(i);
            ans=ans*jc[total]%Mod;
            for(int k=0;k<(int)tmp.size();k++)
            {
                int color=tmp[k];
                if(num[color]==0) continue;
                ans=ans*ni(jc[num[color]])%Mod;
                num[color]=0;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 21756
import math

a,b,x = map(int,input().split())
if x / a <= a * b / 2:
    print(math.degrees(math.atan(a * b * b / 2 / x)))
else:
    q = 2 * b - 2 * x / a / a
    print(math.degrees(math.atan(q / a)))

Measured memory_bytes: 38256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std ;

int main(){
	string s,t ;
	cin >> s >> t ;
	vector<int> scnt(26,0) ;
	vector<int> tcnt(26,0) ;
	for(int i=0;i<s.size();i++){
		scnt.at(s.at(i)-'a')++ ;
		tcnt.at(t.at(i)-'a')++ ;
	}
	sort(tcnt.begin(),tcnt.end()) ;
	sort(scnt.begin(),scnt.end()) ;
	if(scnt==tcnt) cout << "Yes" << endl ;
	else cout << "No" << endl ;
}

Measured memory_bytes: 776
#include <iostream>
using namespace std;
struct Card{ char a,value; }; 
Card A[110],B[110];int n;
void bubble(struct Card A[],int n){
	for(int i=0;i<n;i++){
		for(int j=n-1;j>=i+1;j--){
			if(A[j].value<A[j-1].value){
				Card t = A[j];A[j] = A[j-1];A[j-1] = t;
			}
		}
	}
}
void select(struct Card A[],int n){
	for(int i=0;i<n;i++){
		int mini = i;
		for(int j=i;j<n;j++){
			if(A[j].value<A[mini].value)
				mini = j;
		}
		Card t = A[i];A[i] = A[mini];A[mini] = t;
	}
}
void print(struct Card A[],int n){
	for(int i=0;i<n;i++){
		if(i>0) cout<<" ";
		cout<<A[i].a<<A[i].value;
	}
		cout<<endl;
}
void isStable(struct Card A[],struct Card B[],int n){
	for(int i=0;i<n;i++){
		if(A[i].a != B[i].a) {
			cout<<"Not stable"<<endl;
			return;
		}
	}
	cout<<"Stable"<<endl;
	return;
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++) cin>>A[i].a>>A[i].value;
	for(int i=0;i<n;i++) B[i] = A[i];
	bubble(A,n);
	select(B,n);
	
	print(A,n);
	cout<<"Stable"<<endl;
	print(B,n);
	isStable(A,B,n);
	
	return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const double pi = 3.14159265358979323846;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
ll a[100005];
int main()
{
  ull n,q,sum=0,x,y,z,i;

  cin>>n;

  for(i=1;i<=n;i++)
  {
    cin>>z;
    a[z]++;
    sum+=z;
  }

  cin>>q;
  while(q--)
  {
    cin>>x>>y;

    if(a[x])
    {
      sum-=x*a[x];

      sum+=a[x]*y;
      a[y]+=a[x];
      a[x]=0;
    }

    cout<<sum<<"\n";
  }

  return 0;
}


Measured memory_bytes: 4272
#include <stdio.h>

int main(void)
{
	int n[50], m[50];
	int tosi, douro, i, j, k, num;
	
	k = scanf("%d %d", &tosi, &douro);
	for(i = 0; i < douro; i++){
		k = scanf("%d %d", &n[i], &m[i]);
	}
	for(j = 1; j <= tosi; j++){
		num = 0;
		for(i = 0; i < douro; i++){
			if((n[i] == j) || (m[i] == j)){
				num++;
			}
		}
		if (j != tosi){
			printf("%d\n", num);
		}
	}
	printf("%d", num);
	return 0;	
}

Measured memory_bytes: 128
a,b,c,d = map(int,input().split())
mod = 998244353

dp = [[0] *(d+1) for _ in range(c+1)]
dp[a][b] = 1

for i in range(1,c+1):
    for j in range(1,d+1):
        dp[i][j] += dp[i-1][j]*j + dp[i][j-1]*i - dp[i-1][j-1]*(i-1)*(j-1)
        dp[i][j] %= mod

print(dp[-1][-1])

Measured memory_bytes: 136728
import os
import sys

import numpy as np


def solve(inp):
    r, c, k = inp[:3]
    items = np.zeros((r + 1, c + 1), dtype=np.int64)
    rrr = inp[3::3]
    ccc = inp[4::3]
    vvv = inp[5::3]
    for r_, c_, v in zip(rrr, ccc, vvv):
        items[r_][c_] = v

    dp = np.zeros((c + 1, 4), dtype=np.int64)

    for i in range(1, r + 1):
        for j in range(1, c + 1):
            v = items[i][j]
            dp[j] = np.maximum(dp[j - 1], dp[j])
            if v > 0:
                dp[j, 1:] = np.maximum(dp[j, 1:], dp[j, :-1] + v)
        dp[:, 0] = dp[:, 1] = dp[:, 2] = dp[:, 3]

    return dp[-1][3]


if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC

    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()
    exit()

if os.name == 'posix':
    # noinspection PyUnresolvedReferences
    from my_module import solve
else:
    from numba import njit

    solve = njit('(i8[:],)', cache=True)(solve)
    print('compiled', file=sys.stderr)

inp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=' ')
ans = solve(inp)
print(ans)


Measured memory_bytes: 105548
#include <iostream>
using namespace std;
int C[10001]={0};
int n=0, a;
int main() 
{
	int maxa=0;
	int mina=10000;
	cin>>n;
	for(int i=0;i<n;i++) {
		cin>>a; 
		++C[a]; 
		if (a>maxa)maxa=a;
		if (a<mina)mina =a;
	}
	bool first = true;
	for(int j=0;j<C[mina];j++){
		if (first) { first=false;} else {cout<<' ';}
		cout<<mina;
	}
	for(int i=mina+1;i<=maxa;i++){
		for(int j=0;j<C[i];j++){
			cout<<' '<<i;
		}
	}
	cout<<endl;
}

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

int main() {
	string s;
	cin >> s;
	size_t n = s.size() - 2;
	int min_d = 700;
	for (size_t i = 0; i < n; ++i) {
		int tmp_d = abs(753 - stoi(s.substr(i, 3)));
		if (tmp_d < min_d) min_d = tmp_d;
	}
	cout << min_d << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmax(a,b) (a = max(a,b))
using namespace std;
typedef vector<int> vi;

const string dir = "URDL";
const int dy[] = {-1,0,1,0}, dx[] = {0,1,0,-1};

int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int Hini, Hmax;
  while(cin >> Hini >> Hmax, Hini){
    int h,w;
    cin >> h >> w;
    vector<string> g(h);
    rep(i,h)cin >> g[i];

    int cost[26] = {}, t;
    cin >> t;
    rep(i,t){
      char c; int d;
      cin >> c >> d;
      cost[c-'A'] = d;
    }

    vi trap;
    int s, x=0, y=0;
    cin >> s;
    rep(i,s){
      char c; int n;
      cin >> c >> n;
      int d = dir.find(c);
      rep(k,n){
	x += dx[d]; y += dy[d];
	trap.push_back(cost[ g[y][x]-'A' ]);
      }
    }

    int p;
    cin >> p;
    vi potion(p);
    rep(i,p)cin >> potion[i];

    vector<vi> dp(trap.size()+1, vi(1<<p,0));
    dp[0][0] = Hini;

    rep(i,trap.size()){
      rep(bit,1<<p){
	int cur = dp[i][bit];
	if(cur==0)continue;

	chmax(dp[i+1][bit], cur-trap[i]);
	rep(j,p){
	  if( (bit>>j)&1 )continue;
	  int nxt = min(cur+potion[j], Hmax);
	  chmax(dp[i+1][bit | (1<<j)], nxt - trap[i]);
	}
      }
    }
    
    bool f = false;
    rep(bit,1<<p)f |= (dp[trap.size()][bit]>0);
    cout << (f?"YES":"NO") << endl;
  }
}

Measured memory_bytes: 17192
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 			1000000007
#define tc(t) 			int t;cin >> t;while(t--)
#define for0(i , n)		for(int i=0;i<n;i++)
#define loop(i , a, b)	for(int i=a;i<=b;i++)
#define endl 			'\n'
#define inf 			1e18
#define fi 				first
#define se 				second

int XX[8]={+1, +1, +1, 0, 0, -1, -1, -1};
int YY[8]={+1, 0, -1, +1, -1, +1, 0, -1};
int dx[4]={-1,1,0,0};
int dy[4]={0,0,1,-1};


signed main() {

	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif

	int n;
	cin>>n;

	int a[n];

	for0(i,n) cin>>a[i];

	int sum=0;

	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]){
			int d=a[i-1]-a[i];
			a[i]=a[i]+d;
			sum+=d;
		}
	}

	cout<<sum<<endl;

	return 0;
}

Measured memory_bytes: 5200
#include <cstdio>
#include <algorithm>
using namespace std;

int h[6];

int sq(int n){
    return n*n;
}

int find( int n , int s = 0 ){
    int count = 0, m = -1, mm = 0;
    for(int i = s; i < 6; i++){
        if( m == h[i] ){
            count++;
        }else{
            if( count == n ){
                mm = m;
                break;
            }
            m = h[i];
            count = 1;
        }
    }
    return mm;
}

int main(){
    while( scanf("%d,%d,%d,%d,%d",
                 h, h+1, h+2, h+3, h+4) != EOF ){
        sort(h, h+5);
        if( find(4) ) puts("four card");
        else if( find(3)*find(2) && 
                 find(3) != find(2) ) puts("full house");
        else if( (h[1]-h[0])*(h[2]-h[1])*(h[3]-h[2])*(h[4]-h[3]) == 1 ||
                 (h[0] == 1 && h[1] == 10 && h[2] == 11 &&
                  h[3] == 12 && h[4] == 13) ){
            puts("straight");
        }else if( find(3) ){
            puts("three card");
        }else if( find(2)*find(2,2) && find(2) != find(2,2) ){
            puts("two pair");
        }else if( find(2) ){
            puts("one pair");
        }else{
            puts("null");
        }
    }
    return 0;
}

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

#define int long long

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

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

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


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

    int N, X, Y; cin >> N >> X >> Y;
    X--; Y--;
    vvi dp(N, vi(N));
    dp[X][Y] = 1;
    REP(i, N)
    {
        for(int j = i+1; j < N; j++)
        {
            dp[i][j] = j-i;
            chmin(dp[i][j], abs(i-X)+1+abs(j-Y));
            chmin(dp[i][j], abs(i-Y)+1+abs(j-X));
        }
    }
    vi ans(N);
    REP(i, N) for(int j = i+1; j < N; j++) ans[dp[i][j]]++;
    REPS(i, N-1) cout << ans[i] << endl;
    /*
   REP(i, N)
   {
       REP(j, N) cout << dp[i][j] << " ";
       cout << endl;
   }
   */
}

Measured memory_bytes: 31616
import copy

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

apple_count = line[0]
apple_taste = line[1]

apple_list = []
taste_list = []

for i in range(1, apple_count+1):
  apple_list.append(i)
  taste_i = apple_taste+i-1
  taste_list.append(taste_i)

risou = sum(taste_list)
results = []

for a in range(len(taste_list)):
  tastes = copy.copy(taste_list)
  tastes.pop(a)
  hikaku = sum(tastes)
  
  abs_a = abs(risou-hikaku)
  results.append(abs_a)

pop_index = results.index(min(results))
taste_list.pop(pop_index)

print(sum(taste_list))

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a <= c && c <= b && b <= d)
        cout << b - c << endl;
    else if (c <= a && a <= d && d <= b)
        cout << d - a << endl;
    else if (a <= c && c <= d && d <= b)
        cout << d - c << endl;
    else if (c <= a && a <= b && b <= d)
        cout << b - a << endl;
    else if (b < c || d < a)
        cout << 0 << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int x,y;
    while(1){
        cin >> x >> y;
        if(x==0&&y==0)break;
        if(x<y){
            cout << x << " " << y << endl;
        }else{
            cout << y << " " << x << endl;
        }
    }return 0;
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}

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

    int n, k;
    cin >> n >> k;
    vector<ll> a(n);

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.rbegin(), a.rend());

    ll ans = 0LL;
    for (int i = k; i < n; i++) {
        ans += a[i];
    }

    cout << ans;







    return 0;
}


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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

using ll    = long long;
using vll   = vector<ll>;
using pll   = pair<ll,ll>;
using ld    = long double;

const ll mod = (ll)1e9 + 7;

void solve() {
	ll n,s=0;cin>>n;vll A(n);
	vll cnt((ll)1e5+1,0LL);
	for(int i=0;i<n;i++) {
		ll x;cin>>x;cnt[x]++;
		s+=x;
	}
	ll q;cin>>q;
	while(q--) {
		ll b,c;cin>>b>>c;
		s+=cnt[b]*(c-b);
		cnt[c]+=cnt[b],cnt[b]=0;
		cout<<s<<"\n";
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;
//	pre();
//	ll t;cin>>t;while (t--)
		solve();
}


Measured memory_bytes: 4724
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <climits>
#include <queue>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
template<typename T1, typename T2>
inline void chmin(T1& a, T2 b){if (a > b) a = b;}
template<typename T1, typename T2>
inline void chmax(T1& a, T2 b){if (a < b) a = b;}
const long long INF = 1LL << 60;


int dp[100010];
Graph G;

int rec(int v) {
	//到達済みならdp[v]を返す
	if (dp[v] != -1) return dp[v];

	//0で初期化(vから出る辺が無ければ0となる)
	int res = 0;
	//範囲for文
	for (auto nv : G[v]) {
		chmax(res, rec(nv) + 1);
	}
	//dp[v]を更新してそれを返す
	dp[v] = res;
	return dp[v];
}

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


	//N×0の配列で初期化(重要)
	G.assign(N, vector<int>());
	int x, y;
	rep(i, M) {
		cin >> x >> y;
		x--; y--; //0から始まる添字にする
		G[x].push_back(y);
	}

	//未到達(-1)で初期化
	rep(i, N) dp[i] = -1;

	//すべての頂点iについて,iから始まる最長の部分列を調べてその長さを更新
	int ans = 0;
	rep(i, N) {
		chmax(ans, rec(i));
	}
	cout << ans << endl;
}

Measured memory_bytes: 8192
require 'pp'

def gets; ARGF.gets; end

class Solver

  def main
    n = gets.chomp.to_i
    bs = gets.split.map(&:to_i)

    as = Array.new(n) {1000000}
    # puts as

    bs.each.with_index do |b, i|
      as[i] = [as[i], bs[i]].min
      as[i+1] = [as[i+1], bs[i]].min
    end



    puts as.inject(:+)
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 2044
package main

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

func main() {
	s := reads()
	m := len(s) / 2
	yesOrNo(strong(s) && strong(s[:m]) && strong(s[m+1:]))
}

func strong(s string) bool {
	m := len(s) / 2

	for i := 0; i < m; i++ {
		if s[i] != s[len(s)-i-1] {
			return false
		}
	}
	return true
}

// IO---------------------------------------------------

func readi() (n int) {
	fmt.Scan(&n)
	return
}

func readf() (n float64) {
	fmt.Scan(&n)
	return
}

func reads() (n string) {
	fmt.Scan(&n)
	return
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func readSlice() []string {
	return strings.Split(readLine(), " ")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func readSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func readFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func yesOrNo(b bool) {
	if b {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func yesorNO(b bool) {
	if b {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

func yesorno(b bool) {
	if b {
		fmt.Println("yes")
		return
	}
	fmt.Println("no")
}

// calc---------------------------------------------------

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

func ave(a []int) (ave int) {
	for i := 0; i < len(a); i++ {
		ave += a[i]
	}
	ave /= len(a)
	return
}

func eq(a []string, b []string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			return false
		}
	}
	return true
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func max(a ...int) int {
	max := a[0]
	for i := 1; i < len(a); i++ {
		if max < a[i] {
			max = a[i]
		}
	}
	return max
}

func min(a ...int) int {
	min := a[0]
	for i := 1; i < len(a); i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	return min
}

func mid(a []int) int {
	sort.Ints(a)
	return a[len(a)/2]
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値));
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2));  // 初期値を省略

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string ts="test";
	
	int n; cin >> n;
	vector<ll> a(n); rep(i,n) cin >> a[i];
	
	sort(all(a));
	
	rep(i,n-1){
		if(a[i]==a[i+1]){
			cout << "NO" << endl;
			return 0;
		}
	}
	
	cout << "YES" << endl;
	
	
	return 0;
}



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

#define ll long long int
#define ull unsigned long long int
#define db double
#define ld long double
#define MOD 1000000007
#define inf (1LL << 62)
#define pi acos(-1.0)
#define si(a) scanf("%lld",&a)
#define sd(n) scanf("%lf", &n)
#define for1(i, stop) for(ll i = 1; i <= stop; i++)
#define for0(i, stop) for(ll i = 0; i < stop; i++)
#define rep1(i, start) for(ll i = start; i >= 1; i--)
#define rep0(i, start) for(ll i = (start-1); i >= 0; i--)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define pb(v,a) v.push_back(a)
#define pll pair <ll, ll>
#define mp make_pair
#define pbp(v,a,i) v.push_back(make_pair(a,i))
#define srt(v) sort(v.begin(),v.end())
#define rv(v) reverse(v.begin(),v.end())
#define ms(n, i) memset(n, i, sizeof(n))
#define debug printf("Debug\n");
#define en '\n'



#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef tuple<ll,ll,ll>tpl;

int main()
{
    _fastio
    ll n;
    cin>>n;
    map<string,ll>mm;
    string s;
    for1(i,n)
    {
    	cin>>s;
    	mm[s]=mm[s]+1;
    }
    if(mm["AC"])
    	cout<<"AC x "<<mm["AC"]<<en;
    else
    	cout<<"AC x 0"<<en;

    if(mm["WA"])
    	cout<<"WA x "<<mm["WA"]<<en;
    else
    	cout<<"WA x 0"<<en;

    if(mm["TLE"])
    	cout<<"TLE x "<<mm["TLE"]<<en;
    else
    	cout<<"TLE x 0"<<en;

    if(mm["RE"])
    	cout<<"RE x "<<mm["RE"]<<en;
    else
    	cout<<"RE x 0"<<en;
}


Measured memory_bytes: 3664
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

using namespace std;

#define LL long long

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

int n, k;
LL *a;


LL exgcd(LL a,LL b,LL &x,LL &y)
{
    if(b==0)
    {          
        x=1;
        y=0;
        return a;
    }
    LL r=exgcd(b, a%b, x, y);
    LL t=y;
    y=x-(a/b)*y;    
    x=t;
    return r;
}

LL mod = 1000000007;
LL res = 0;

LL ny(LL x) {
	if (x == (LL)(0)) {
		return 1;
	}
	LL xx, yy;
	exgcd(x, mod, xx, yy);
	return xx;
}
int main() {
	cin >> n >> k;
	a = new LL[n + 10];
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a, a + n);
	LL *CC = new LL[n];
	for (int i = 0; i < n; ++i) {
		if (k == 1) {
			CC[i] = 1;
			continue;
		}
		if (i < k - 1) {
			CC[i] = 0;
		}
		if (i == k - 1) {
			CC[i] = 1;
		}
		if (i > k - 1) {
			CC[i] = CC[i - 1] * i;
			CC[i] %= mod;
			CC[i] = CC[i] * ny(i - k + 1);
			//cout << ny(i - k) << endl;
			CC[i] %= mod;
		}
		//printf("CC[%d] = %lld\n", i, CC[i]);
	}
	for (int i = 0; i < n; ++i) {
		int l = i, r = n - i - 1;
		res += (a[i] * CC[l]);
		res -= (a[i] * CC[r]);
		res %= mod;
	}
	if (res < 0) {
		res += mod;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1792
c = [[int(i) for i in input().split()] for _ in range(3)]
 
h1 = c[1][0] - c[0][0] == c[1][1] - c[0][1] == c[1][2] - c[0][2]
h2 = c[2][0] - c[1][0] == c[2][1] - c[1][1] == c[2][2] - c[1][2]
w1 = c[0][1] - c[0][0] == c[1][1] - c[1][0] == c[2][1] - c[2][0]
w2 = c[0][2] - c[0][1] == c[1][2] - c[1][1] == c[2][2] - c[2][1]
#print(h1,h2,w1,w2)
if h1 and h2 and w1 and w2 :
    print('Yes')
else :
    print('No')

Measured memory_bytes: 38384
import java.util.*;
import java.text.*;

class Main {
    public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        for(;;) {
            int a = sc.nextInt();
            char c = sc.next().charAt(0);
            int b = sc.nextInt();
            int r = 0;
            if(c=='?') break;
            else if(c=='+') r = a + b;
            else if(c=='-') r = a - b;
            else if(c=='*') r = a * b;
            else if(c=='/') r = a / b;
            System.out.println(r);
        }
    }
}

Measured memory_bytes: 18056
#include <stdio.h>
#include <math.h>

int combi(int n, int x) {                                                                                                       
    int i, count = 0;                                                                                                           
    if (n > x * 9)                                                                                                              
        return 0;                                                                                                               
    if (x == 2) {                                                                                                               
        if (n < 19)                                                                                                             
            return 10 - abs(n - 9);                                                                                             
        else                                                                                                                    
            return 0;                                                                                                           
    }                                                                                                                           
                                                                                                                                
    for (i = 0; i <= n && i < 10 ; i++) {                                                                                       
        count += combi(n - i, x - 1);                                                                                           
    }                                                                                                                           
                                                                                                                                
    return count;                                                                                                               
}

int main(void) {                                                                                                                
    int n;                                                                                                                      
                                                                                                                                
    while(scanf("%d", &n) != EOF) {                                                                                             
        printf("%d\n", combi(n, 4));                                                                                            
    }                                                                                                                           
                                                                                                                                
    return 0;                                                                                                                   
}

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

using namespace std;

long long n, m, l, a[110][110], b[110][110], c[110][110] = { 0 };

int main(){

	cin >> n >> m >> l;

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

		for (int j = 0; j < m ;j++){

			cin >> a[i][j];
		}
	}
	for (int i = 0; i < m; i++){

		for (int j = 0; j < l; j++){
			cin >> b[i][j];
		}
	}

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

		for (int j = 0; j < l;j++){
			
			for (int k = 0; k < m;k++){

				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}

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

		for (int j = 0; j < l;j++){

			printf("%lld", c[i][j]);
			if (j + 1 != l) cout << " ";
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3400