akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define N 100000
typedef struct{
  int num;
  char mark;
  int check;
}Card;

int Partition(Card [], int, int);
void QuickSort(Card [], int, int);
void Exchange(Card *, Card *);


int main(){
  int i, j, n, flag = 0;
  char kaigyoukunn;
  Card A[N];

  // Input n
  scanf("%d%c", &n, &kaigyoukunn);// c言語改行文字の闇

  // Input A[n]
  for(i = 0; i < n; i++){
    scanf("%c%d%c", &A[i].mark, &A[i].num, &kaigyoukunn);
    A[i].check = i;
  }

  // QuickSort
  QuickSort(A, 0, n - 1);

  // Judge
  for(i = 0; i < n; i++){
    if(A[i].num == A[i + 1].num && A[i].check > A[i + 1].check && flag == 0){
      printf("Not stable\n");
      flag = 1;
      break;
    }
  }
  if(flag == 0) printf("Stable\n");

  // Output
  for(i = 0; i < n; i++) printf("%c %d\n", A[i].mark, A[i].num);

  return 0;
}

// Partition function
int Partition(Card A[], int p, int r){
  int x, i, j;
  // i is <, j is |

  // Set x, i
  x = A[r].num;
  i = p - 1;

  // Partition
  for(j = p; j < r; j++){

    if(A[j].num <= x){
      i++;
      Exchange(&A[i], &A[j]);
    }
  }
  Exchange(&A[i + 1], &A[r]);

  return i + 1;
}

// QuickSort function
void QuickSort(Card A[], int p, int r){
  int q;

  if(p < r){
    q = Partition(A, p, r);
    QuickSort(A, p, q - 1);
    QuickSort(A, q + 1, r);
  }
}

void Exchange(Card *a, Card *b){
    Card t = *a;
    *a = *b;
    *b = t;
}

Measured memory_bytes: 1780
import qualified Data.Set as S                                                                                             
main :: IO ()                                                                                                              
main = do                                                                                                                  
  [a,b,k] <- map read . words <$> getLine :: IO [Int]                                                                      
  putStr . unlines . map show . S.toList . S.fromList $ (take k [a,a+1..b]) ++ (take k [b,b-1..a])

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

class Main{
	public void run(){
		String s = next();
		for(int i=0;i<s.length()-1;i++){
			if(s.charAt(i) == s.charAt(i+1)){
				out.printf("%d %d", i+1, i+1+1);
				return;
			}
		}
		for(int i=0;i<s.length()-2;i++){
			if(s.charAt(i) == s.charAt(i+2)){
				out.printf("%d %d", i+1, i+1+2);
				return;
			}
		}
		out.println("-1 -1");
	}

	int f(int b, int n){
		return n < b ? n : (f(b, n/b) + (n % b));
	}

	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().run();
		out.flush();
	}

	public Main(){
	}

	int ni(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;	}

	long nl(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}

	double nd(){
		return Double.parseDouble(next());
	}

	String next(){
		int c;
		while(!isAlNum(c = read()));
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	String nextLine(){
		int c;
		while(!isAlNumOrSpace(c = read()));
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNumOrSpace(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
	private static boolean isAlNumOrSpace(int c){
		return isAlNum(c) || c == ' ' || c == '\t';
	}
	void debug(Object... os){
		out.println(Arrays.deepToString(os));
	}
}

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

using namespace std;

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef int64_t ll;

ll INF = ll(1e16);

int get_n(int n) {
    int ret = 1; while(ret < n) ret <<= 1;

    return ret;
}

struct SegTree {
    int N;
    vector<ll> dat;

    explicit SegTree(int n): N(get_n(n)), dat(2*N - 1, INF) {}
    explicit SegTree(const vector<ll> & v) {
        N = get_n(v.size());
        dat.resize(2*N - 1, INF);

        REP(i, v.size()) dat[N + i - 1] = v[i];
        for (int i=N-2; i > -1; --i) dat[i] = _op(dat[2*i + 1], dat[2*i + 2]);
    }

    ll _op(ll a, ll b) {
        return min(a, b);
    }

    ll _up(ll& a, ll b) {
        a = b;
    }

    void update(int i, ll v) {
        i += N - 1;
        _up(dat[i], v);

        while(i > 0) {
            i = (i - 1) / 2;
            dat[i] = _op(dat[2*i + 1], dat[2*i + 2]);
        }
    }

    // query for [a, b), k: current node id, [l, r): current range.
    ll query(int a, int b, int k=0, int l=0, int r=-1) {
        if (r < 0) r = N;

        if (b <= l || r <= a) return INF;
        if (a <= l && r <= b) return dat[k];

        int mid = (l + r) / 2;
        ll c1 = query(a, b, 2*k + 1, l, mid);
        ll c2 = query(a, b, 2*k + 2, mid, r);

        return _op(c1, c2);
    }
};

struct LazySegTree {
    int N;
    vector<ll> dat;
    vector<ll> lazy;

    explicit LazySegTree(int n): N(get_n(n)), dat(2*N - 1, INF), lazy(2*N - 1, 0) {}
    explicit LazySegTree(const vector<ll>& v) {
        N = get_n(v.size());
        dat.resize(2*N - 1);
        lazy.resize(2*N - 1, 0);

        REP(i, N) dat[N + i - 1] = v[i];
        for (int i = N-2; i > -1; --i) dat[i] = _op(dat[2*i + 1], dat[2*i + 2]);
    }

    ll _op(ll a, ll b) {
        return a + b;
    }

    void eval(int k, int l, int r) {
        if (lazy[k] == 0) return;

        dat[k] += lazy[k];

        if(r - l > 1) {
            lazy[2*k+1] += k / 2;
            lazy[2*k+2] += k / 2;
        }

        lazy[k] = 0;
    }

    void update(int a, int b, int v, int k=0, int l=0, int r=-1) {
        if(r < 0) r = N;

        if (b <= l || r <= a) return;

        eval(k, l, r);

        if (a <= l && r <= b) {
            lazy[k] += (r - l) * v ;
            return;
        }

        int mid = (l + r) / 2;
        update(a, b, v, 2 * k + 1, l, mid);
        update(a, b, v, 2 * k + 2, mid, r);
        dat[k] = _op(dat[2*k+1], dat[2*k+2]);
    }

    ll query(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = N;

        if (b <= l || r <= a) return 0;

        eval(k, l, r);

        if(a <= l && r <= b) return dat[k];

        int mid = (l + r) / 2;
        ll c1 = query(a, b, k, l, mid);
        ll c2 = query(a, b, k, mid, r);
        return _op(c1, c2);
    }
};


// This main solves http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A&lang=jp
int main() {
    int n, q;
    cin >> n >> q;

    INF = (1 << 31) - 1;

    SegTree st(n);

    REP(_, q) {
        int c, x, y;
        cin >> c >> x >> y;

        if (c == 0) st.update(x, y);
        else cout << st.query(x, y+1) << endl;
    }

}




Measured memory_bytes: 4924
n,w=map(int,input().split())
wv=[]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    wv.append([a,b])
    v.append(b)
v.sort(reverse=True)
ans=0
w0=wv[0][0]
wp=3*n+1
dp=[[-1 for jjj in range(n+1)] for iii in range(3*n+1)]
dp[0][0]=0
for i in range(n):
    for jj in range(n-1,-1,-1):
        for k in range(wp-1,-1,-1):
            if dp[k][jj]>=0 and k+wv[i][0]-w0<=wp-1:
                dp[k+wv[i][0]-w0][jj+1]=max(dp[k][jj]+wv[i][1],dp[k+wv[i][0]-w0][jj+1])
for i in range(1,n+1):
    wp=w-w0*i
    if wp<0:
        continue
    elif wp>=3*i:
        ans=max(ans,sum(v[:i]))
    else:
        for j in range(i+1):
            for k in range(wp+1):
                ans=max(dp[k][j],ans)
print(ans)

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

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    vector<int> A(N), B(M);
    for(auto &e : A) cin >> e;
    for(auto &e : B) cin >> e;
    int ans = 0;
    int64_t a = 0, b = accumulate(B.begin(), B.end(), 0LL);
    for(int i = -1, j = M - 1; i < N; ++i) {
        if(i >= 0) a += A[i];
        while(j >= 0 && a + b > K) {
            b -= B[j];
            j--;
        }
        if(a + b <= K) ans = max(ans, i + j + 2);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

int main()
{
    vector<ll> A(3);
    repi(i, 3, 0)
    {
        cin >> A[i];
    }
    sort(all(A));
    repi(i,3,0){
        cout << A.at(i) << ((i+1)%3 == 0 ?"\n" :" ");
    }
    return 0;
}


Measured memory_bytes: 3128
s = gets

ms = 1..12
a = s[0, 2].to_i
b = s[2, 2].to_i

if ms.include?(a) && ms.include?(b)
  puts 'AMBIGUOUS'
elsif !ms.include?(a) && ms.include?(b)
  puts 'YYMM'
elsif ms.include?(a) && !ms.include?(b)
  puts 'MMYY'
else
  puts 'NA'
end


Measured memory_bytes: 1788
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
const int mod = 1000000007;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(x) x.begin(),x.end();
#define pp pair<ll,ll>
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
using namespace std;
ll v[100010];
int main() {
	for (int i = 1; i <= 100000; ++i) {
		if (i == 1)v[i] = 1;
		else v[i] = (v[i - 1] * i)%mod;
	}
	ll n, m,ans;
	cin >> n >> m;
	if (abs(n - m) >= 2)ans = 0;
	else {
		ans = v[n] * v[m] % mod;
		if (n == m)ans = ans * 2 % mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
from collections import deque

n, m = map(int, input().split())

grid = [[] for _ in range(n + 1)]

ans = [0] * n
visited = [False] * n
visited[0] = True

for _ in range(m):
  s, t = map(int, input().split())
  grid[s].append(t)
  grid[t].append(s)

queue = deque([1])

while queue:
  node = queue.popleft()
  for i in grid[node]:
    if visited[i - 1]:
      continue
    visited[i - 1] = True
    ans[i - 1] = node
    queue.append(i)

print('Yes')
for i in ans[1:]:
  print(i)

Measured memory_bytes: 35540
local N,M=io.read("*n","*n")
local A={}
local sum=0
for i=1,N do
	A[i]=io.read"*n"
	sum=sum+A[i]
end
table.sort(A)
if(A[N-M+1]*4*M<sum)then
	print("No")
else
	print("Yes")
end

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

int main(){
  int n;
  scanf("%d",&n);
  int a[n+1];
  for(int i=1;i<=n;i++)
      scanf("%d",&a[i]);
  vector<int> dp(n+1);
  dp[1]=0;
  for(int i=2;i<=n;i++)
     dp[i]=INT_MAX;
  for(int i=1;i<=n;i++){
    if(i+1<=n)
       dp[i+1]=min(dp[i+1],dp[i]+abs(a[i]-a[i+1]));
    if(i+2<=n)
      dp[i+2]=min(dp[i+2],dp[i]+abs(a[i]-a[i+2]));
  }
  printf("%d\n",dp[n]);
}

  


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int a[N],b[N],c[N],dp[N][3];
int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch&15),ch=getchar();
	return x*f;
}
int main()
{
	int n=read();
	for (register int i=1;i<=n;++i) a[i]=read(),b[i]=read(),c[i]=read();
	dp[0][0]=dp[0][1]=dp[0][2]=0;
	for (register int i=1;i<=n;++i)
	{
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
	}
	int ans=0;
	for (register int i=0;i<3;++i) ans=max(ans,dp[n][i]);
	printf("%d\n",ans);
	return 0;
}

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

class Cube{
public:
  int f[6];
  Cube(){}
  void roll_z(){roll(1, 2, 4, 3);}//
  void roll_y(){roll(0, 2, 5, 3);}// to W
  void roll_x(){roll(0, 1, 5, 4);}// to N
  void roll(int i, int j, int k, int l){
    int t = f[i]; f[i] = f[j];  f[j] = f[k]; f[k] = f[l]; f[l] = t;
  } 
};

  int getRight( Cube c1, int f1, int f2 ){
     for(int i = 0; i < 6; i++ ){
   for ( int j = 0; j < 4; j++ ){
     if ( c1.f[0] == f1 && c1.f[1] == f2 ) return c1.f[2];
    c1.roll_z();
}
   if ( i % 2 == 0 ) c1.roll_y();
   else c1.roll_x();
 }
 return -1;
}

 int main(){
  Cube c;
  int f1, f2;

   for ( int i = 0; i < 6; i++ ) cin >> c.f[i];
   int q; cin >> q;

   for ( int i = 0; i < q; i++ ) {
     cin >> f1 >> f2;
     cout << getRight(c, f1, f2) << endl;
}

return 0;
}



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

int main(){
  int n,m,x;
  int a[101]={};
  cin>>n>>m>>x;
  for(int i=0;i<m;i++) cin>>a[i];
  int z=0,b=0;
  for(int i=0;a[i]<x;i++){
    z++;
  }
  for(int j=m-1;a[j]>x;j--){
    b++;
  }
  if(z>b){
    cout<<b<<endl;
  }else{
    cout<<z<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, countABC;
	char s[51];
	int i;
	
	scanf("%d", &n);
	scanf("%s", s);
	
	/* n文字目にCが入る場合までを調べるので、ループはn-2回 */
	for (i = 0; i < n - 2; i++)
	{
		if ((s[i] == 'A') && (s[i + 1] == 'B') && (s[i + 2] == 'C'))
		{
			countABC++;
		}
	}

	printf("%d", countABC);

	return 0;
}

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

using namespace std;

int main()
{
	int a, b, k;
	cin >> a >> b >> k;
	for (int i = a; i < min(a+k, b+1); i++) cout << i << '\n';
	for (int i = max(b+1-k, a+k); i <= b; i++) cout << i << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;



Int n, m;
Int x[216000];
Int res;
vector<Int> gap;
int main(){
  cin >> n >> m;
  for(int i = 0;i < m;i++)cin >> x[i];
  sort(x, x + m);
  for(int i = 1;i < m;i++){
    gap.push_back(x[i] - x[i-1]);
  }
  sort(gap.begin(), gap.end());
  for(int i = 0;i < max(0, (int)gap.size() - ((int)n-1));i++){
    res += gap[i];
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const long long INF = 1LL << 60;

int h,a;

int main()
{
  cin >> h >> a;
  cout << (h+a-1)/a << endl;
}

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

const ll INF = 1e10;

ll dp[100010][2];

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];

  dp[0][0] = 0;
  dp[0][1] = -INF;

  rep(i,n) {
    dp[i+1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i]);
    dp[i+1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i]);
  }
  cout << dp[n][0] << endl;
  return 0;
} 

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int INF = 1e9;
template<class T> inline void chmax(T &a,T b){if(a<b)a=b;}

ll dp[110][100010]; // 0 : A, 1 : B, 2 : C

int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N,W;
    cin >> N >> W;
    vector<int> w(N),v(N);
    for(int i = 0; i < N; ++i) cin >> w[i] >> v[i];

    for(int i = 0; i < N; ++i){
        for(int j = 0; j <= W; ++j){
            if(j - w[i] >= 0) chmax(dp[i+1][j],dp[i][j-w[i]] + v[i]);
            chmax(dp[i+1][j],dp[i][j]);
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(x, 1000) {
        vector<int> v;
        int nx = x;
        v.push_back(nx % 10);
        nx /= 10;
        while (nx) {
            v.push_back(nx % 10);
            nx /= 10;
        }
        while (v.size() != 3) v.push_back(0);
        reverse(v.begin(), v.end());
        int j = 0;
        rep(i, n) {
            if (s[i] - '0' == v[j]) j++;
            if (j == 3) {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include <string>
#include <vector>
#include <set>

using namespace std;

int main(int argc, char const *argv[])
{
    string s;
    int x, y;
    cin >> s >> x >> y;
    vector<int> forwardCount(1, 0);
    for (auto &&i : s)
    {
        if (i == 'F')
        {
            forwardCount.back()++;
        }
        else
        {
            forwardCount.push_back(0);
        }
    }

    vector<set<int>> DP(2,{0});
    for (size_t i = 0; i < forwardCount.size(); i++)
    {
        set<int> nextDP;
        for (auto &&xx : DP[i % 2])
        {
            nextDP.insert(xx + forwardCount[i]);
            if(i!=0)nextDP.insert(xx - forwardCount[i]);
        }
        DP[i % 2] = nextDP;
    }
    if (DP[0].count(x) && DP[1].count(y))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

template<unsigned long long SIZE> class unionFind{
    protected:
        long long uni[SIZE];
        long long diff_weight[SIZE];
    public:
        unionFind(){
            for(int i=0;i<SIZE;i++){
                uni[i]=-1;
                diff_weight[i]=0;
            }
        }
        unsigned long long root(unsigned long long a){
            if(a>=SIZE) throw std::range_error("与えられたインデックスが木の範囲外です");
            if(uni[a]<0) return a;
            else{
                unsigned long long r=root(uni[a]);
                diff_weight[a]+=diff_weight[uni[a]];
                return uni[a]=r;
            }
        }
        long long weight(unsigned long long a){
            root(a);
            return diff_weight[a];
        }
        long long diff(unsigned long long a, unsigned long long b){
            if(isSame(a,b)) return weight(b)-weight(a);
            else return INT64_MAX;
        }
        unsigned long long count(unsigned long long a){
            return -uni[root(a)];
        }
        bool merge(unsigned long long a, unsigned long long b, long long w=1){
            w+=weight(a);  w-=weight(b);
            a=root(a);  b=root(b);
            if(a==b) return false;
            if(uni[a]>uni[b]){
                swap(a, b);
                w=(-w);
            }
            uni[a]+=uni[b];
            uni[b]=a;
            diff_weight[b]=w;
            return true;
        }
        bool isSame(unsigned long long a,unsigned long long b){
            return root(a)==root(b);
        }
};

int main(){
    string S,T;
    cin >> S >> T;

    unordered_map<char,char> chk;
    unordered_set<char> used;
    for(int i=0;i<S.size();i++){
        if(chk.count(S[i])==0){
            if(used.count(T[i])!=0){
                cout << "No" << endl;
                return 0;
            }
            chk[S[i]]=T[i];
            used.insert(T[i]);
        }else{
            if(chk[S[i]]!=T[i]){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;

    
    return 0;
}

Measured memory_bytes: 776
#include <string>
#include <vector>
#include <map>
#include <iostream>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <climits>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <algorithm>
#include <functional>
using namespace std;
int data[300100];
int ans[1000];
int main(){
	for(int i=1;i<(300000/7);i++){
			if(data[i*7-1]==0){
				for(int j=2;j<300000/(i*7-1)+1;j++){
					data[(i*7-1)*j]=1;
				}
			}
			if(data[i*7+1]==0){
				for(int j=2;j<300000/(i*7+1)/+1;j++){
					data[(i*7+1)*j]=1;
				}
			}
	}
	while(1){
		int N;
		cin>>N;
		if(N==1)return 0;
		int f;
		int cnt=0;
		for(int j=1;j<=N/7+1;j++){
			int x=N;
			f=0;
			int t=0,l=0;
			if(data[j*7-1]==0){
			while(x%(j*7-1)==0){
				x/=(j*7-1);
				f++;
			}
			if(f>0){
					ans[cnt]=j*7-1;
					cnt++;
			}
			}
			if(data[j*7+1]==0){
			f=0;
			x=N;
			while(x%(j*7+1)==0){
				x/=(j*7+1);
				f++;
			}
			if(f>0){
				ans[cnt]=j*7+1;
				cnt++;
			}
			}
		}
		cout<<N<<":";
		for(int i=0;i<cnt;i++){
			cout<<" "<<ans[i];
		}
		cout<<endl;
	}

	return 0;
}

Measured memory_bytes: 2336
n = int(input())
a = list(map(int,input().split()))
l = []
ans = [0 for i in range(n)]
for i in range(n):
    l.append([a[i],i])
l.sort(key=lambda x:x[1],reverse=True)
l.sort(key=lambda x:x[0],reverse=True)
count = 1
count0 = 0
b = l[0][0]
c = l[0][1]
for i in range(1,n):
    if l[i][0] == b:
        count += 1
        c = min(c,l[i][1])
    else:
        ans[c] += (b-l[i][0])*count
        count += 1
        b = l[i][0]
        c = min(l[i][1],c)
ans[c] += b*count
for i in range(n):
    print(ans[i])

Measured memory_bytes: 27160
#include <iostream>

using namespace std;
#include <cmath>
#include <cstring>
#include <algorithm>

int main()
{
    int a,b;
    cin>>a>>b;
    if(a*b%2==0)
        cout <<"Even"<<endl;
    else
        cout<<"Odd"<<endl;
    return 0;
}


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

#define INF 1000000000000
#define MOD 1000000007

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);

    int n,m,c;
    cin>>n>>m>>c;
    int a[m],b[m];
    int ans=0;
    
    for(int j=0; j<m; j++){
        cin>>b[j];
    }
    
    for(int i=0; i<n; i++){
        int sum=c;
        for(int j=0; j<m; j++){
            cin>>a[j];
            sum+=a[j]*b[j];
        }
        
        if(sum>0)   ans++;
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926535
const long long int MOD = 2019;
#define pb push_back
#define mp make_pair
#define fill(a)  memset(a, 0, sizeof (a))
#define SORT(v)  sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define MAX(v) *max_element(v.begin(), v.end())
#define MIN(v) *min_element(v.begin(), v.end())
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define watch(x) cout << (#x) << " is " << (x) << endl;
const long long int MAXX = 200000 + 5;
const long long int MINN = 2e5 + 5;
const long long int inf = 1e6;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector< iii > viii;

ll lcm(ll a, ll b) {
   return a / __gcd(a, b) * b;
}
int XOR(int x, int y){
  return (x | y) & (~x | ~y);
}
bool cmp(const pair<int,int> &a,const pair<int,int> &b) {
    return (a.second < b.second);
}
// bool isl = binary_search(x.begin(), x.end(), 5);
// __builtin_popcount(x)  - Returns the number of set bits in x
const long long int N = 10050;
const int MAXN = 105;
int binsearch(int lo, int hi){
	while(lo<hi){
		int mid=(lo+hi)/2;
		if((mid))   // check(mid)
			hi=mid;
		else
			lo=mid+1;
	}
	return lo;
}
ll power(ll x,ll y){
    ll res=1;
    while(y>0){
      if(y&1) res=((res*x));

      y/=2;
      x=((x*x));
    }
    return res;
}


int main(){
    FAST
    int k,n;
  	string s;
  cin>>k>>s;
  n=s.length();
  if(n<=k) cout<<s;
  else{
    for(int i=0;i<k;i++){ 
      cout<<s[i];
    }
    cout<<"...";
  }
  

    return 0;
}


Measured memory_bytes: 3656
n, k = map(int, input().split())

okashi = set()
for _ in range(k):
  d = int(input())
  lst = [int(i) for i in input().split()]
  for i in range(d):
    if lst[i] not in okashi:
      okashi.add(lst[i])
count = 0
for i in range(n):
  if i + 1 not in okashi:
    count += 1
print(count)

Measured memory_bytes: 9180
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	x := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = nextInt()
	}

	sort.Ints(x)
	lo := x[len(x)-1]
	x = x[:len(x)-1]

	var con int
	for _, nu := range x {
		con += nu
	}

	result := "No"
	if lo < con {
		result = "Yes"
	}
	fmt.Println(result)
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <deque>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define LL long long
#define Pair pair<int,int>
#define LOWBIT(x) x & (-x)
using namespace std;

const int MOD=1e9+7;
const int INF=0x7ffffff;
const int magic=348;

int n,q;
int cnt[200048];
int a[200048];

struct node
{
	int left,right,num,sum;	
}tree[600048];

inline void build(int cur,int left,int right)
{
	tree[cur].left=left;tree[cur].right=right;tree[cur].num=0;
	if (left!=right)
	{
		int mid=(left+right)>>1;
		build(cur*2,left,mid);                                           
		build(cur*2+1,mid+1,right);
	}
}

void update(int cur,int pos,int delta)
{
	if (tree[cur].left==tree[cur].right)
	{
		tree[cur].num+=delta;
		if (delta==1 && tree[cur].num==1) tree[cur].sum=1;
		if (delta==-1 && tree[cur].num==0) tree[cur].sum=0;
		return;
	}
	int mid=(tree[cur].left+tree[cur].right)>>1;
	if (pos<=mid) update(cur*2,pos,delta); else update(cur*2+1,pos,delta);
	tree[cur].sum=tree[cur*2].sum+tree[cur*2+1].sum;
}

int main ()
{
	int i,x,y;
	scanf("%d%d",&n,&q);
	build(1,1,n);
	for (i=1;i<=n;i++)
	{
		scanf("%d",&x);
		cnt[x]++;
		update(1,x-cnt[x]+1,1);
		a[i]=x;
	}
	for (i=1;i<=q;i++)
	{
		scanf("%d%d",&x,&y);
		update(1,a[x]-cnt[a[x]]+1,-1);
		cnt[a[x]]--;
		a[x]=y;
		cnt[a[x]]++;
		update(1,a[x]-cnt[a[x]]+1,1);
		printf("%d\n",n-tree[1].sum);
	}
	return 0;
}

Measured memory_bytes: 12416
S = input()
ans = [0]*len(S)

even = 0
odd = 0
for i, s in enumerate(S):
    if s == 'R':
        if i%2==0:
            even += 1
        else:
            odd += 1
    else:
        if i%2==0:
            ans[i] += even
            ans[i-1] += odd
        else:
            ans[i] += odd
            ans[i-1] += even
        even = 0
        odd = 0

ans = ans[::-1]
for i, s in enumerate(S[::-1]):
    if s == 'L':
        if i%2==0:
            even += 1
        else:
            odd += 1
    else:
        if i%2==0:
            ans[i] += even
            ans[i-1] += odd
        else:
            
            ans[i] += odd
            ans[i-1] += even
        even = 0
        odd = 0

print(*ans[::-1])

Measured memory_bytes: 11444
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)


























int main(){
    ll n;
    cin >> n;
    map<ll, ll> mp;
    for(ll i = 2; i <= sqrt(n); i++){
        while(n % i == 0){
            mp[i]++;
            n /= i;
        }
    }
    if(n != 1) mp[n]++;
    ll ans = 0;
    for(auto [p, cnt] : mp){
        ll x = 0, s = 0;
        while(s <= cnt) s += ++x;
        ans += x - 1;
    }
    cout << ans << endl;
}


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

int main()
{
	int n[10];
	for (int i = 0; i < 10; i++)
	{
		cin >> n[i];
	}
	//???????????????
	for (int i = 0; i < 10; i++)
	{
		for (int j = i + 1; j < 10; j++)
		{
			if (n[i] < n[j]) swap(n[i], n[j]);
		}
	}
	//??§??????3????????????
	cout << n[0] << endl;
	cout << n[1] << endl;
	cout << n[2] << endl;

	return 0;
}

Measured memory_bytes: 1160
//  Copyright © 2020 Diego Garcia Rodriguez del Caviso. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define pii pair < ll , ll > 
#define fi first
#define se second
#define INF 1e18
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
#define forn(i,a,b) for (ll i = a; i <= b; i ++ )
#define mod(n,k) (((n%k)+k)%k)
using namespace std;
typedef long long ll;

ll N, a[MAX];
map < pii , ll > vis;

ll dfs( ll p , ll l ) {
    if( ! l )
        return 0;
    if( p > N )
        return -INF;
    if( p + l * 2 - 2 > N )
        return -INF;
    auto it = vis.find( { p , l} );
    if( it != vis.end() )
        return it->second;
    
    ll ans = -INF;
    ans = max( ans , dfs( p + 2 , l - 1 ) + a[p] );
    ans = max( ans , dfs( p + 3 , l - 1 ) + a[p] );
    ans = max( ans , dfs( p + 4 , l - 1 ) + a[p] );
    return vis[{p , l}] = ans;
    
}

int main()
{
    optimiza_io
    cin >> N;
    forn( i , 1 , N )
        cin >> a[i];
    
    cout << max( dfs( 1 , N/2 ) , max( dfs( 2 , N/2 ) , dfs( 3 , N/2 ) ) ) << "\n";
    return 0;
}

// CHECAR LIMITES 

Measured memory_bytes: 30200
// package com.patra.cp.atcoder.practice.dp;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    private static int solve(int[][] happiness, int[][] dp, int lastActivity, int day) {

        if(day >= happiness.length) {
            return 0;
        }

        if(dp[day][lastActivity] != -1) {
            return dp[day][lastActivity];
        }

        int maxHappiness = 0;
        int activityHappiness;

        for(int activity=1; activity <= 3; activity++) {
            if(activity != lastActivity) {
                activityHappiness = happiness[day][activity] + solve(happiness, dp, activity, day + 1);
                maxHappiness = Math.max(activityHappiness, maxHappiness);
            }
        }

        dp[day][lastActivity] = maxHappiness;

        return dp[day][lastActivity];
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int N = Integer.parseInt(line);
        String[] splits;
        int[][] happiness = new int[N+1][4];
        int[][] dp = new int[N+1][4];
        for(int[] row : dp) {
            Arrays.fill(row, -1);
        }
        for(int i=1; i<=N; i++) {
            line = sc.nextLine();
            splits = line.split(" ");
            for(int j=1; j<=splits.length; j++) {
                happiness[i][j] = Integer.parseInt(splits[j-1]);
            }
        }
        System.out.println(solve(happiness, dp, 0, 1));
    }
}


Measured memory_bytes: 149188
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd>> Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod

vector<P> d[100010];
ll Oya[100010];
void dfs(ll x){
    rep(i,d[x].size()){
        ll A=d[x][i].first;
        if(A!=Oya[x]){
            Oya[A]=x;
            dfs(A);
        }
    }
    return;
}

int main(){
    rep(i,100010) Oya[i]=-1;
    ll N; cin>>N;
    rep(i,N-1){
        ll a,b; cin>>a>>b;
        a--; b--;
        d[a].pb(mp(b,i));
        d[b].pb(mp(a,i));
    }
    ll K=0, Top=-1;
    rep(i,N) {
        if(d[i].size()>K){
            Top=i;
            K=d[i].size();
        }
    }
    //cout<<K<<' '<<Top<<endl;
    vec ans(N-1);
    vec memo(N,K);
    queue<ll> Q;
    Q.push(Top);
    dfs(Top);
    while(!Q.empty()){
        ll a=Q.front();
        Q.pop();
        rep(i,d[a].size()){
            ll X=d[a][i].first, Y=d[a][i].second;
            if(X!=Oya[a]){
                ans[Y]=memo[a]%K;
                memo[a]++;
                memo[X]=memo[a];
                Q.push(X);
            }
        }
    }
    cout<<K<<endl;
    rep(i,N-1) cout<<ans[i]+1<<endl;


}

Measured memory_bytes: 13240
s = input()
n = len(s)
s = s[::-1]
MOD = 10**9 + 7

dp = [[0] * 13 for i in range(n+1)]
dp[0][0] = 1
keta = [1] * n
for i in range(n-1):
    keta[i+1] = keta[i] * 10
    keta[i+1] %= 13

for i in range(n):
    if s[i] == "?":
        tmp = keta[i]
        for j in range(10):
            for k in range(13):
                dp[i + 1][(j*tmp + k) % 13] += dp[i][k]
                dp[i + 1][(j*tmp + k) % 13] %= MOD
    else:
        num = int(s[i])
        tmp = keta[i]
        for k in range(13):
            dp[i + 1][(num*tmp + k) % 13] += dp[i][k]
            dp[i + 1][(num*tmp + k) % 13] %= MOD        
print(dp[n][5])


Measured memory_bytes: 62428
#include <stdio.h>
int main()
{
  int n, A[100];
  int i, j,c;
  int cnt=0;
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }
    for(i = 0; i < n; i++){
        for(j = (n - 1); j >= (i + 1); j--){
            if(A[j] < A[j - 1]){
                c = A[j];
                A[j] = A[j - 1];
                A[j - 1] = c;
                cnt++;
            }
        }
    }
    for(i = 0; i < n; i++){
        if(i == (n - 1)){
            printf("%d\n", A[i]);
        } else {
            printf("%d ", A[i]);
        }
    }
    printf("%d\n", cnt);
    return 0;
}


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


int main() {
    int n,k;
    cin>>n>>k;
    
    int cnt=0;
    while(n!=0){
        n/=k;
        cnt++;
    }
    dunk(cnt);
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

int main(void) {
  for(int N; cin >> N, N > 0;) {
    double x[300], y[300];
    REP(i, 0, N) cin >> x[i] >> y[i];

    int answer = 1;
    REP(i, 0, N) {
      REP(j, i + 1, N) {
        double d = sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
        if(d > 2.) continue;
        double vx = (x[i] - x[j]) / d;
        double vy = (y[i] - y[j]) / d;
        double l = sqrt(1. - d * d / 4.);
        double sx = (x[i] + x[j]) / 2.;
        double sy = (y[i] + y[j]) / 2.;

        double cx1 = sx - vy * l;
        double cy1 = sy + vx * l;
        int cnt1 = 0;
        REP(k, 0, N) if(k == i || k == j || (x[k] - cx1) * (x[k] - cx1) + (y[k] - cy1) * (y[k] - cy1) <= 1.0) cnt1++;
        answer = max(answer, cnt1);

        double cx2 = sx + vy * l;
        double cy2 = sy - vx * l;
        int cnt2 = 0;
        REP(k, 0, N) if(k == i || k == j || (x[k] - cx2) * (x[k] - cx2) + (y[k] - cy2) * (y[k] - cy2) <= 1.0) cnt2++;
        answer = max(answer, cnt2);
      }
    }

    cout << answer << endl;
  }

  return 0;
}

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


using namespace std;
using ll = long long;

#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define trav(a, x) for(auto& a: x)



int main () {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    
    int n; cin>> n;
    vector<int> a(n);
    unordered_map<ll, int> m;
    ll curr = 0;
    for (int i = 0; i < n; ++i) {
        cin>> a[i];
        m[a[i]]++;
        curr += a[i];
    }

    int q; cin>> q;
    
    
    while(q--) {
        ll b, c; cin>> b >> c;
        m[c] += m[b];
        curr = curr - b*m[b] + c*m[b];
        cout << curr << '\n';
        m[b] = 0;
    }

    
    return 0;
}



Measured memory_bytes: 7544
///
// File:  0006.cpp
// Author: ymiyamoto
//
// Created on Wed Nov  8 22:09:01 2017
//

#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

int32_t main()
{
  string str;
  cin >> str;
  for (int32_t i = str.size() - 1; i >= 0; i--) {
    cout << str[i];
  }

  cout << endl;

  return 0;
}

Measured memory_bytes: 3044
// Problem : C - Maximum Volume
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using mapl = map < ll , ll >;
using mapc = map < char , ll >;
using vectorl = vector < ll >;
using vectors = vector < string >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define pb push_back
#define endl "\n"
const ll mod = 1000000007;

ll i=0,j=0,k=0,t=0,n=0;

char x='a',y='a',z='a';
string s="",s1="";

vectorl pr;
void seive(int n){ 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++){ 
        if (prime[p] == true){ 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for (int p=2; p<=n; p++) 
      if (prime[p]) 
          pr.push_back(p);
} 

double log_base(ll x, ll base) {
    return ((log(x)*1.0) / (log(base)*1.0));
}


ll power_without_mod(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1){
            ans=ans*a;
        }
        a = a * a;
        b >>= 1;
    }
    return ans;
}

ll power(ll a,ll b){
	a%=mod;
	ll ans=1;
	while(b>0){
		if(b&1){
			ans=ans*a%mod;
		}
		a = a * a%mod;
		b >>= 1;
	}
	return ans;
}
// if mod is prime: calculate x^(n mod (m-1))
// if  is string   find number calculating with mod of (m-1)

//for ex:
// string b = "100000000000000000000000000"; 
  
//     ll remainderB = 0; 
//     ll MOD = 1000000007; 
  
//     // Reduce the number B to a small number 
//     // using Fermat Little 
//     for (int i = 0; i < b.length(); i++) 
//         remainderB = (remainderB * 10 + b[i] - '0') % (MOD - 1); 
  
//     cout << power(a, remainderB, MOD) << endl; 


void solve(){
	ll l;
	cin>>l;
	ll maxx=-1e18;
	double a=((l*1.0)/3.0);
	double ans=pow(a,3);
	cout << fixed << setprecision(12)<<ans<<endl;
}

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // ll t;
    // cin>>t;
    // while(t--){
    	solve();
    // }
    return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
//#define int long long
#define all(vec) vec.begin(), vec.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl
#define isEven(t) t % 2 == 0

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

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

	int N;
	cin>>N;
	double sum = 0;
	for (int i = 0; i < N; i++) {
		double x;
		string S;
		cin >> x >> S;
		if(S=="JPY"){
			sum += x;
		}else{
			sum += (x * 380000);
		}
	}

	printf("%f\n", sum);

	return 0;
}

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

int main()
{
    char s[5];
    scanf("%s",s);
    int i;
    int a,b;
    a=10*(s[0]-'0')+s[1]-'0';
    b=10*(s[2]-'0')+s[3]-'0';
    if(a>0&&a<=12&&b>0&&b<=12)
        printf("AMBIGUOUS");
    else if(a>0&&a<=12)
        printf("MMYY");
    else if(b>0&&b<=12)
        printf("YYMM");
    else
        printf("NA");
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e5+5;
int n,m,i,fa[N],he[N],lt[N],f[N],ans;
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
void dfs(int x){
	for (int i=he[x];i;i=lt[i])
		dfs(i),f[x]=max(f[x],f[i]);
	if (++f[x]==m&&fa[x]!=1&&x!=1) f[x]=0,ans++;
}
int main(){
	n=read(),m=read();ans=read()!=1;
	for (i=2;i<=n;i++){
		int x=read();fa[i]=x;lt[i]=he[x];he[x]=i;
	}
	dfs(1);printf("%d",ans);
}

Measured memory_bytes: 4864
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True  and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def exgcd(x,y):
    if y == 0:
        return (x,1,0)
    else:
        g,b,a = exgcd(y, x%y)
        return (g, a, b-(x//y)*a)

# return y s.t. x*y mod p == 1
def modinv(x,p):
    g,a,b = exgcd(x,p)  # ax+bp = g, g=1 if mutually prime
    return a%p

# #
n = inn()
x = inl()

modinva = [1]*(n+1)
fact = 1
for i in range(2,n):
    modinva[i] = modinv(i,R)
    fact = (fact*i)%R
ddprint(modinva)
ddprint(fact)

acc = [0]*n
for i in range(n):
    acc[i] = acc[i-1]+x[i]

sm = 0
for i in range(n-2,-1,-1):
    e = (x[n-1]-x[i])*modinva[1+i]
    sm = (sm+e)%R
    #ddprint("i {} e1 {} e2 {} sm {} inv2 {}".format(i,e1,e2,sm,inv2))
print((fact*sm)%R)


Measured memory_bytes: 101528
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int main(void){

	int ans=0;
	int sum;
	int inp;

	for(int i=0;i<2;i++){
		sum=0;
		for(int j=0;j<4;j++){
			cin>>inp;
			sum+=inp;
		}
		ans=max(ans,sum);
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
using namespace std;
int main() {
  int N,M,K,i,j;
  cin>>N>>M>>K;
  vector<int> A(N+1), B(M+1);
  for (i=0;i<N;i++) cin>>A[i];
  for (j=0;j<M;j++) cin>>B[j];
  int k=K;
  for (i=0;i<N && A[i]<=k;i++) {
    k-=A[i];
  }
  for (j=0;j<M && B[j]<=k;j++) {
    k-=B[j];
  }
  int I=i, ANS=i+j, ans=i+j;
  for (i=I-1;i>=0;i--) {
    ans--;
    k+=A[i];
    for (;j<M && B[j]<=k;j++) {
      ans++;
      k-=B[j];
    }
    ANS = max(ANS, ans);
  }
  cout << ANS <<endl;
  return 0;
}


Measured memory_bytes: 4400
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String[] x = sc.next().split("");
        String result = "";
        for (int i = 0; i < a; i++) {
            if (i == (b - 1)) {
                result += x[i].toLowerCase();
            } else {
                result += x[i];
            }
        }
        
        System.out.println(result);
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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 (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s;
cin>>s;
if(s[0]==s[1]&&s[1]==s[2])cout<<"No"<<endl;
else cout<<"Yes"<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
using System;

namespace ITP1_9_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            int p1 = 0, p2 = 0;

            for (int i=0; i<num; i++)
            {
                string[] input = Console.ReadLine().Split(' ');

                int res = input[0].CompareTo(input[1]);
                if (res < 0)
                {
                    p2 += 3;
                }
                else if (res == 0)
                {
                    p1++;
                    p2++;
                }
                else
                {
                    p1 += 3;
                }
            }

            Console.WriteLine("{0} {1}", p1, p2);

        }
    }
}

Measured memory_bytes: 9956
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n;
    cin >> n;
    int a[n];
    rep(i,n){
        cin >> a[i];
        a[i]--;
    }

    int num=0;

    rep(i,n){
        if(a[i]==num){
            num++;
        }
    }

    if(num==0){
        cout << -1 << endl;
        return 0;
    }

    int ans = n-num;
    cout << ans << endl;
    return 0;

}

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

vector<vector<int> > G(1e5, vector<int>());
vector<int> dp(1e5, -1);

inline int rec(int i){
  if(dp[i] != -1) return dp[i];  // 既にdpテーブルが更新されている場合
  int cnt = 0;
  for(int j : G[i]){
    chmax(cnt, rec(j) + 1);
  }
  return dp[i] = cnt;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // Educational DP Contest G -  Longest Path
  // N頂点M辺の有向グラフG、頂点には1, 2, 3, …, N
  // i番目の有向辺は頂点xiからyiへ張られている
  // Gは有向閉路を含まない
  // メモ化再帰で解いていく
  int N, M;
  cin >> N >> M;
  REP(i, M){  // 有向辺の情報を入力
    int x, y; cin >> x >> y; x--; y--;  // 0-indexed
    G[x].push_back(y);
  }

  int ans = 0;  
  REP(i, N){
    chmax(ans, rec(i));
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 7552