akhauriyash/Code-Regression huggingface dataset:
#include <cstddef>
#include <cstdint>
#include <vector>

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

template <typename T>
std::vector<T> make_v(usize a) { return std::vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(usize a, Ts... ts) {
  return std::vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename std::enable_if<std::is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename std ::enable_if<std::is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
  for (auto &e : t) fill_v(e, v);
}

template <typename T, typename V>
inline void chmin(T &a, V b) {
  if (a > b) a = b;
}
template <typename T, typename V>
inline void chmax(T &a, V b) {
  if (a < b) a = b;
}

} // namespace null_null

#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <utility>

namespace null_null {

void main_() {
  std::string s;
  std::cin >> s;
  std::map<char, i32> mp;
  for (usize i = 0; i < 4; i++) mp[s[i]]++;

  if (mp[s[0]] == 2 && mp[s[1]] == 2 && mp[s[2]] == 2 && mp[s[3]] == 2) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
}

} // namespace null_null

int main() {
  null_null::main_();
  return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    a,b,c = map(int, input().split())
    print(int(a*b/2))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

vector<ll>relation[20], money(20, 1);
int dp[110][110];

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

bool a[10101][10101];
int s[101][101];

int main() {
	int n, m;
	cin >> n >> m;
	vector<int>k(m), p(m);
	rep(i, m) {
		cin >> k[i];
		rep(j, k[i]) {
			cin >> s[i][j];
			s[i][j]--;
		}
	}
	rep(i, m) {
		cin >> p[i];
	}
	int ans = 0;
	for (int bit = 0;bit < (1 << n);++bit) {
		bool flag = true;
		for (int i = 0;i < m;++i) {
			int res = 0;
			for (int j = 0;j < k[i];++j) {
				if (bit & (1 << s[i][j]))res++;
			}
			if (res % 2 != p[i])flag = false;
		}
		if (flag)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
from sys import stdin
import collections


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    A_arr = list(map(int,_in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = collections.Counter(A_arr)
    for i in range(N):
        print(cnt[i+1])
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Measured memory_bytes: 125896
#include <bits/stdc++.h>
#include<algorithm>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
    int T;
    cin >> T;
    REP(i,T){
        vector<int> n(9);
        string c;
        REP(j,9){
            cin >> n[j];
        }
        REP(j,9){
            cin >> c[j];
        }
        //入力終わり

        REP(j,9){
            if(c[j]=='G'){
                n[j]+=10;
            }
            if(c[j]=='B'){
                n[j]+=20;
            }
        }
        //データの統合（R=0,G=10,B=20）

        VSORT(n);
        
        int t=0;
        int j=2;
        while(j<9){
            if(n[j]==1+n[j-2] && n[j-2]==1+n[j-4] && n[j-1]==1+n[j-3] && n[j-3]==1+n[j-5] && n[j]==n[j-1]){
                t+=2;
            }
            else if(n[j]==n[j-1] && n[j-1]==n[j-2]){
                t+=1;
            }
            else if(n[j]==1+n[j-1] && n[j-1]==1+n[j-2]){
                t+=1;
            }
            else{
            }
            j+=3;
        }
        cout << t/3 << endl;
    }
    return 0;
}


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

class Program
{
    void Run()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int m = sc.NextInt();
        int[] a = new int[m];
        for (int i = 0; i < m; i++) a[i] = sc.NextInt();
        int res = 0;
        int mod = 1000000007;
        long[] c = new long[n + 1];
        c[0] = m > 0 && a[0] == 0 ? 0 : 1;
        c[1] = m > 0 && a[0] == 1 ? 0 : 1;
        for (int i = 2; i <= n; i++)
        {
            if (Array.BinarySearch(a, i) >= 0) continue;
            c[i] = (c[i - 1] + c[i - 2]) % mod;
        }
        Console.WriteLine(c[n]);

    }

    static void Main(string[] args)
    {
        new Program().Run();
    }

    static long Gcd(long a, long b)

    {
        if (a < b) return Gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }

    public long NextLong()
    {
        CheckNext();
        return long.Parse(buf[index++]);
    }

    public double NextDouble()
    {
        CheckNext();
        return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}


Measured memory_bytes: 16336
n=int(raw_input())
a=map(int,raw_input().split())
c=[0]*8
mx=0
for i in xrange(n):
    if 1<=a[i]<400:
        c[0]=1
    elif 400<=a[i]<800:
        c[1]=1
    elif 800<=a[i]<1200:
        c[2]=1
    elif 1200<=a[i]<1600:
        c[3]=1
    elif 1600<=a[i]<2000:
        c[4]=1
    elif 2000<=a[i]<2400:
        c[5]=1
    elif 2400<=a[i]<2800:
        c[6]=1
    elif 2800<=a[i]<3200:
        c[7]=1
    else:
        mx+=1
print max(1,sum(c)),sum(c)+mx

Measured memory_bytes: 2696
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int x,y,a,r,g,b,c,tyu,tei;
    cin>>a>>b>>c;
    if(a>=b&&a>=c){
        tyu=b;
        tei=c;
    }
    else if(b>=a&&b>=c){
        tyu=a;
        tei=c;
    }
    else{
        tyu=b;
        tei=a;
    }
    cout<<tei+tyu<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s;
    cin>>s;
    int n=s.size(),cnt=0;
    rep(i,n/2){
        if(s[i]!=s[n-1-i]) cnt++;
    }
    cout<<cnt;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define LL long long
#define P pair<int, int>
#define Fengexian cout<<"WZY%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl
const LL N = 1e5 + 10;
const LL mod = 998244353;
const LL inf = 0x3f3f3f3f;
const double eps = 1e-9;
using namespace std;
template <typename tp>
inline void read(tp &x)
{
	x = 0; char c = getchar(); bool f = 0;
	for (; c < '0' || c > '9'; f |= (c == '-'), c = getchar()) ;
	for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar()) ;
	if (f) x = -x;
}
string s;
int len,flag,ans;
signed main()
{
	cin>>s;
	len=s.length();
	for(int i=0;i<len;i++)
		if(s[i]=='T') flag++,ans=max(ans,flag);
		else flag--;	
	printf("%d\n",ans*2);
	return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var vi = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var ci = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var sum = 0;
            for (var i = 0; i < n; i++)
            {
                sum += vi[i] > ci[i] ? vi[i] - ci[i] : 0;
            }
            Console.WriteLine(sum);
        }
    }
}


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

int main()
{
    string S, A;
    cin >> S;
    int N = S.size();
    rep(i, 0, N)
    {
        if ((i == 4) || (i == 7))
        {
            continue;
        }
        A += S.at(i);
    }
    N = A.size();
    int num = 0;
    rep(i, 0, N)
    {
        num += ((int)(A.at(i)) - (int)('0')) * pow(10, 7 - i);
    }
    if (num > 20190430)
    {
        cout << "TBD" << endl;
    }
    else
    {
        cout << "Heisei" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;


int main(){
    int n = in();
    cout << 8 - (n-400)/200 << endl;
  return 0;
}


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


int main(void){
    string A,B;
    cin>>A>>B;
    
    if(A.size()==B.size()){
        for(int i=0;i<A.size();i++){
            if(A[i] > B[i]){
                cout<<"GREATER\n";
                return 0;
            } 
            else if(A[i] < B[i]){
                cout<<"LESS\n";
                return 0;
            }
        }
        cout<<"EQUAL\n";
        
    } 
    else if(A.size()>B.size()) cout<<"GREATER\n";
    else if(A.size()<B.size()) cout<<"LESS";
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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; }

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

int extgcd(int a, int b, int &x, int &y) {
  int d = a;
  if (b != 0) {
    d = extgcd(b, a%b, y, x);
    y -= (a/b)*x;
  } else {
    x = 1;
    y = 0;
  }
  return d;
}

// m is a large prime integer. Usually 1000000007 is used.
int mod_inverse(int a, int m) {
  int x, y;
  extgcd(a, m, x, y);
  return (m + x%m)%m;
}

signed main() {
  int b, w; cin >> b >> w;

  vector<ll> black(b+w+1);
  vector<ll> white(b+w+1);

  vector<ll> inv2(b+w+1);
  ll in2 = mod_inverse(2, mod);
  inv2[0] = 1;
  for(int i=1; i<=b+w; i++) {
    inv2[i] = inv2[i-1]*in2%mod;
  }
  
  // (b-1)C(b-1) = 1;
  ll tmp = 1;
  black[b] = inv2[b];
  //debugln(black[b]);
  for(int i=b; i<b+w; i++) {
    tmp *= i;
    tmp %= mod;
    tmp *= mod_inverse(i+1-b, mod);
    tmp %= mod;
    black[i+1] = tmp*inv2[i+1];
    black[i+1] %= mod;
    black[i+1] += black[i];
    black[i+1] %= mod;
    //debug(i+1);debugln(black[i+1]);
  }

  tmp = 1;
  white[w] = inv2[w];
  //debugln(white[w]);
  for(int i=w; i<b+w; i++) {
    tmp *= i;
    tmp %= mod;
    tmp *= mod_inverse(i+1-w, mod);
    tmp %= mod;
    white[i+1] = tmp*inv2[i+1];
    white[i+1] %= mod;
    white[i+1] += white[i];
    white[i+1] %= mod;
    //debug(i+1);debugln(white[i+1]);
  }

  for(int i=0; i<b+w; i++) {
    ll ans = white[i]*in2;
    ans += (1+mod-black[i])*in2;
    ans %= mod;
    cout << ans << '\n';
  }
}


Measured memory_bytes: 6912
N=int(input())
S=input()
count_max=0
for i in range(1,N):
    X=S[:i]
    Y=S[i:]
    count=0
    character_in_X=[]
    for character in X:
        if character not in character_in_X:
            character_in_X.append(character)
    for character in character_in_X:
        if character in Y:
            count+=1
    count_max=max(count, count_max)
print(count_max)

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

void insertionSort(vector<int> &a, int N) {
    for (int i = 0; i < N; i++) {
        int v = a.at(i);
        int j = i - 1;

        while (j >= 0 && a.at(j) > v) {
            a.at(j+1) = a.at(j);
            j--;
        }

        a.at(j+1) = v;

        for(int i = 0; i < N; i++) {
            if (i == N-1) {
                cout << a.at(i) << '\n';
                break;
            }
            cout << a.at(i) << " ";
        }
    }
}

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

    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
    }

    insertionSort(a, N);
    return 0;

}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s1,s2;
   cin>>s1>>s2;
   int m,n,i,j;
   m=s1.length(),n=s2.length();
    int dp[m+1][n+1];
    for(i=0;i<=m;i++)
    {
       
        for(j=0;j<=n;j++)
        {
            if(i==0||j==0)
            dp[i][j]=0;
            else if(s1[i-1]==s2[j-1])
            {
                dp[i][j]=1+dp[i-1][j-1];
                
            }
            else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    if(dp[m][n]==0)
    {
        cout<<"";
        return 0;
        }string lcs="";
    i=m;j=n;
    while(i>0&&j>0)
    {
        if(s1[i-1]==s2[j-1])
        {
            lcs+=s1[i-1];i--;j--;
        }
        else
        {
            if(dp[i-1][j]>dp[i][j-1])
            {
                i--;
            }
            else
            {
                j--;
            }
        }
        
    }reverse(lcs.begin(),lcs.end());cout<<lcs;
}

Measured memory_bytes: 35456
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<functional>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<set>
#include<map>

#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 2e9
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
const double PI = acos(-1);

using namespace std;

int main(void) {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//	freopen("input.txt", "r", stdin);

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


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long long,long long> ii; 	
typedef complex<long double> com;

const ll mod = 1e9+7;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    ll n,k;
    cin >> n >> k;
    vector <ll> dp(k+1);
    vector <ll> arr(n);
    for (int z=0;z<n;z++){
        cin >> arr[z];
    }
    dp[0] = 0;
    for (int z=1;z<=k;z++){
        set <ll> s;
        for (int x=0;x<arr.size();x++){
            if (z-arr[x] >= 0){
                s.insert(dp[z-arr[x]]);
            }
        }
        ll i = 0;
        for (ll ii : s){
            if (ii == i){
                i++;
                continue;
            }
            break;
        }
        dp[z] = i;
    }
    if (dp[k] == 0) cout << "Second" << endl;
    else cout << "First" << endl;
}

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

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

std::vector<int> node_to[10];

int n, m;

int64_t result = 0;

void DFS(int node_now, int visited, int destination) {
  if (node_now == destination) {
    int complete = (1 << n) - 1;
    if (visited == complete) {
      result++;
    }
    return;
  } else {
    for (auto next : node_to[node_now]) {
      int mask = (1 << (next - 1));
      if ((mask & visited) == 0) {
        DFS(next, (visited | mask), destination);
      }
    }
    return;
  }
}

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

  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    node_to[a].push_back(b);
    node_to[b].push_back(a);
  }

  for (int i = 2; i <= n; i++) {
    DFS(1, 1, i);
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
dd = int(input())
c = list(list(map(int, input().split())))
s = [[0]*26]*dd
v = [[0]*26]*dd
vs = [[-10000000]*26]*dd
vs1 = [[-10000000]*26]*dd
vs2 = [[-10000000]*26]*dd
vs3 = [[-10000000]*26]*dd
ans = [0]*dd
ans2 = [0]*dd
fdate = [0]*26
for i in range(dd):
    s[i] = list(list(map(int, input().split())))



for i in range(dd):

    for j in range(26):
        v[i][j] = s[i][j] + c[j] *(i-fdate[j]) *(i-fdate[j])
        if not i+1 == dd:
            vs[i][j] =s[i+1][j] + c[j] *(i-fdate[j]) *(i-fdate[j])- c[j] *(i-fdate[j]+1)
        if i+2 < dd:
            vs1[i][j] =s[i+2][j] + c[j] *(i-fdate[j]) *(i-fdate[j])- c[j] *(2*i-2*fdate[j]+3)
        if i+3 < dd:
            vs2[i][j] =s[i+3][j] + c[j] *(i-fdate[j]) *(i-fdate[j])- c[j] *(3*i-3*fdate[j]+6)



    maxv = -100000000

    for j in range(26):
        if maxv < v[i][j] and vs[i][j]<v[i][j]and vs1[i][j]<v[i][j]and vs2[i][j]<v[i][j]:
            maxv = v[i][j]
            ans[i] = j+1
    if ans[i] == 0:
        if maxv < v[i][j] and vs[i][j]<v[i][j]and vs1[i][j]<v[i][j]:
            maxv = v[i][j]
            ans[i] = j+1
    if ans[i] == 0:
        if maxv < v[i][j] and vs[i][j]<v[i][j]:
            maxv = v[i][j]
            ans[i] = j+1



    fdate[ans[i]-1] =i+1



for a in ans:
    print(a)

Measured memory_bytes: 69272
n, m=tuple(map(int , input().split()))
vo=list(map(int, input().split()))
c=0
su=sum(vo)
k=su/(4*m)
for i in range(n):
    if(vo[i]>=k):
        c+=1
    else:
        continue
if(c>=m):
    print("Yes")
elif(c<m):
    print("No")



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

int main(){
    int n;
    int w[100];
    cin >> n;
    int sum=0;
    for(int i=0;i<n;i++){
        cin >> w[i];
        sum += w[i];
    }
    int ans=1000000;
    int now=0;
    for(int i=0;i<n;i++){
        now += w[i];
        if(abs(sum-2*now)<=ans){
            ans = abs(sum-2*now);
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3592
/******************************************
* AUTHOR : Lokesh goel*
* NICK : InsaneNerd *
* INSTITUTION : NIT Kurukshetra *
******************************************/
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 1000000000
#define N 100005
#define pii pair<int,int>
#define vp vector<pair<int,int > >
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define gsz(x) ((int)(x).size())
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cerr.tie(NULL);
#define endl "\n"
#define ms(x,v) memset(x,v,sizeof(x))

int main()
{
	fastio;
	int n,arr[200001],i,j;
	cin>>n;
	map<ll int,ll int> m1;
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
		m1[arr[i]]++;
	}
	ll maxi=0;
	for(auto it=m1.begin();it!=m1.end();it++)
	{
		maxi+=(((it->S)*(it->S -1))/2);
	}
	
	for(i=0;i<n;i++)
	{
		//cout<<arr[i]<<" "<<m1[arr[i]]<<endl;
		ll temp = maxi-((m1[arr[i]]*(m1[arr[i]]-1))/2);
		temp+=((m1[arr[i]]-1)*(m1[arr[i]]-2))/2;
		cout<<temp<<endl;
	}
	



	return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

const int BLOCK_SIZE = 700;
const int MAXN = 500010;
int f[MAXN], v[MAXN];
int ans;
void remove(int idx){
  f[v[idx]]--;
  if(f[v[idx]] == 0)
    ans--;
}
void add(int idx){
  f[v[idx]]++;
  if(f[v[idx]] == 1)
    ans++;  
}
void clearAnswer(){
  ans = 0;
  for(int i=0; i<MAXN; i++)
    f[i] = 0;
}
int getAnswer(){
  return ans;
}
struct Query{
  int l, r, idx;
  bool operator<(Query other) const{
    if (l / BLOCK_SIZE != other.l / BLOCK_SIZE)
      return l < other.l;
    return (l / BLOCK_SIZE & 1) ? (r < other.r) : (r > other.r);
  }
};
vector<int> mo_s_algorithm(vector<Query> queries){
  vector<int> answers(queries.size());
  sort(queries.begin(), queries.end());
  clearAnswer();
  int L = 0, R = 0;
  add(0);
  for(Query q : queries){
    while(q.l < L) add(--L);
    while(R < q.r) add(++R);
    while(L < q.l) remove(L++);
    while(q.r < R) remove(R--);
    answers[q.idx] = getAnswer();
  }
  return answers;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  int n, q;
  cin >> n >> q;
  for(int i=1; i<=n; i++)
    cin >> v[i];
  vector<Query> vq(q);
  for(int i=0; i<q; i++){
    cin >> vq[i].l >> vq[i].r;
    vq[i].idx = i;
  }
  auto res = mo_s_algorithm(vq);
  for(int x: res)
    cout << x << endl;
  return 0;
}


Measured memory_bytes: 20836
#include <stdio.h>
int main(void){
    int a[4][3][10]={};
    int n,b,f,r,v,i,j,k,u;
    scanf("%d\n",&n);

    for(i=0;i<n;i++){
        scanf("%d %d %d %d\n", &b,&f,&r,&v);
         a[b-1][f-1][r-1]=a[b-1][f-1][r-1]+v;
    }
    
    for(i=0;i<4;i++){
        for(u=0;u<3;u++){
            for(k=0;k<10;k++){
                printf(" %d",a[i][u][k]);
            }
            printf("\n");
        }
        if(i!=3)
            printf("####################\n");
    }
   return 0;
}



Measured memory_bytes: 2040
/*
  Contest 103
  B - String Rotation
  Rakesh Kumar --> 27/09/2020
 */

#include <bits/stdc++.h>

inline void rotate(std::string& s) {
    const char t = s[s.size() - 1];
    for (int i = s.size() - 1; i > 0; --i)
        s[i] = s[i - 1];
    s[0] = t;
}

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

    std::string s;
    std::getline(std::cin, s);
    std::string t;
    std::getline(std::cin, t);
    std::string r = "No";
    if (s.size() == t.size()) {
        if (s == t) {
            r = "Yes";
        } else {
            for (std::size_t i = 1; i < s.size(); ++i) {
                rotate(s);
                if (s == t) {
                    r = "Yes";
                    break;
                }
            }
        }
    }
    std::cout << r << std::endl;


    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

ll dp[102][15][1100];
int n, s;
int main()
{
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    //cout << fixed << setprecision(7);
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    for (int i = 1; i <= 100; ++i)
    {
        for (int j = 0; j < 15; ++j)
        {
            for (int k = 0; k <= 1000; ++k)
            {
                dp[i][j][k] = dp[i - 1][j][k];
                if (k - i < 0)
                    continue;
                if (j != 0)
                    dp[i][j][k] += dp[i - 1][j - 1][k - i];
            }
        }
    }
    while (cin >> n >> s)
    {
        if (n == 0 && s == 0)
            break;

        cout << dp[100][n][s] + dp[100][n - 1][s] << endl;
    }
    return 0;
}


Measured memory_bytes: 16124
a,b = map(int,input().split())
def XOR(start,end):
  xor =  start
  if end-start < 10:
      for i in range(a+1,b+1):
        xor = xor^i
        #print('end={0},xor={1}'.format(i,xor))
      print(xor)
  else:
    if start%2==0:
      new_start = start-1
    else:
      new_start = start
    
    if (end - new_start)%4==0:
      if start%2==0:
        print(0)
      else:
        print(start)
    elif (end - new_start)%4==1:
      if start%2==0:
        print(end)
      else:
        print(start^end)
    elif (end - new_start)%4==2:
      if start%2==0:
        print((end-1)^end)
      else:
        print(start^(end-1)^end)
    else:
      if start%2==0:
        print((end-2)^(end-1)^end)
      else:
        print(start^(end-2)^(end-1)^end)

if __name__ ==  '__main__':
  XOR(a,b)
    


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

using namespace std;

int main()
{
    string x, y="", z="";
    getline(cin, x);
    for (int r = 0; r < x.length(); r++) {
        if (x[r] != ',')
            y += x[r];
        else if (x[r] == ',')
        {
            z = z + y + ' ';
            y = "";
        }
    }
    z += y;
    cout << z;
}

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

int main() {
  int N,W;
  cin >> N >> W;
  int w[N+1],v[N+1];
  for(int i=1;i<=N;i++) cin >> w[i] >> v[i];
  vector<vector<long long>> dp(N+1,vector<long long>(N*1000+1,-1));
  for(int i=0;i<=N;i++) dp[i][0]=0;
  
  for(int i=1;i<=N;i++){
    for(int j=1;j<=N*1000;j++){
      if(dp[i-1][j]!=-1) dp[i][j]=dp[i-1][j];
      if(v[i]<=j){
        if(dp[i-1][j-v[i]]!=-1){
          if(dp[i][j]==-1) dp[i][j]=dp[i-1][j-v[i]]+w[i];
          else dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
        }
      }
    }
  }
  
  for(int j=N*1000;j>=0;j--){
    if(dp[N][j]!=-1 && dp[N][j]<=W){
      cout << j << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 80256
import sys
N,L=map(int,input().split())

py=0
lostpy=0

for i in range(1,N+1):
  py=py+(L+i-1)
tmp=10000000
ans=0
for i in range(1,N+1):
  lostpy=py-(L+i-1)
  if abs(py-lostpy) < tmp:
    ans=lostpy
    tmp=abs(py-lostpy)
print(ans)




Measured memory_bytes: 3060
// ABC047B - 

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

typedef unsigned long long int ull;
typedef long long int ll;

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

	int minX = 0, maxX = W;
	int minY = 0, maxY = H;

	for (int i = 0; i < N; i++) {
		switch(a[i]) {
		case 1:
			minX = max(minX, x[i]);
			break;
		case 2:
			maxX = min(maxX, x[i]);
			break;
		case 3:
			minY = max(minY, y[i]);
			break;
		case 4:
			maxY = min(maxY, y[i]);
			break;
		default:
			break;
		}
	}

	if ((minX >= maxX)||(minY >= maxY)) {
		cout << 0 << endl;
	} else {
		cout << (maxX - minX) * (maxY - minY) << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (int)(n); i++)
#define sum(a) accumulate(a.begin(),a.end(),0LL)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    ll d, t, s; cin >> d >> t >> s;

    if(d / (double)s <= t) put("Yes");
    else put("No");
}

Measured memory_bytes: 3632
import math
x = int(input())
cand = {i: i ** 5 for i in range(-100000, 100000)}
r_cand = {j: i for i, j in cand.items()}
set_a = set(cand)
if r_cand.get(x, 0):
    print(f"{r_cand[x]} 0")
else:
    result = [(r_cand[x + b], r_cand[b]) for b in r_cand if r_cand.get(x + b, 0)][0]
    print(f"{result[0]} {result[1]}")

Measured memory_bytes: 55192
import java.util.Scanner;

/**
 * Station and Bus
 * 
 * https://atcoder.jp/contests/abc158/tasks/abc158_a
 */
public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) throws Exception {
        String S = sc.next();

        if (S.charAt(0) == S.charAt(1) && S.charAt(0) == S.charAt(2)) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }

    }

}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  ll n;cin>>n;

  map<ll,ll>m;
  for(ll i=2; i*i<=n; i++){
    while(n%i==0){
      n/=i;
      m[i]++;
    }
  }
  if(n>1)m[n]++;

  ll result=0;
  for(auto c:m){
    ll count = 1;
    ll remain = c.second;
    while(remain>=count){
      result++;
      remain -= count;
      count++;
    }
  }

  cout<<result<<endl;

//  for(auto c:m)cout<<c.first<<' '<<c.second<<endl;

  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define INF 800000000
#define MAX 1000

int main(){
  int K,T;
  cin>>K>>T;
  vector<int> a(T);
  for(int i=0;i<T;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());

  int b=a.at(T-1);
  if(b<=K/2){
    cout<<0<<endl;
  }else{
    cout<<K-2*(K-b)-1<<endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main (void){
	int n,sum=0;
	while(~scanf("%d",&n)){
		for(int i=0;i<=6;i++){
			if(1<<i <=n) sum=1<<i;
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
#include <numeric>
#include <math.h>
using namespace std;
int main(){
  	string S;
    cin>>S;
    if (S=="Sunny"){
      cout<<"Cloudy"<<endl;
    }else if(S=="Cloudy"){
      cout<<"Rainy"<<endl;
    }else if(S=="Rainy"){
      cout<<"Sunny"<<endl;
    }
    
    
}


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll N;
	cin>>N;
	ld dp[N+2][N+2];
	memset(dp,0,sizeof(dp));
	ld p[N];
	for(ll i=0;i<N;i++)
	{
		cin>>p[i];
	}
	ld q=1;
	ld pre[N];
	for(ll i=N-1;i>=0;i--)
	{
		q*=(1-p[i]);
		dp[0][i]=q;
	}
	pre[0]=1-p[0];
	for(ll i=1;i<N;i++)
		pre[i]=pre[i-1]*(1-p[i]);
	for(ll i=1;i<=N;i++)
	{
		for(ll j=N-i;j>=0;j--)
		{
			if (j<N-1)
			dp[i][j]=dp[i][j+1]*(1-p[j])+p[j]*(dp[i-1][j+1]);
			else
			dp[i][j]=p[j];
		}
	}
	ld ans=0;
	for(ll i=0;i<=N;i++)
	{
		//for(ll j=0;j<N;j++)
		{
			ll j=0;
			//cout<<dp[i][j]<<" ";
			if (i>N-i)
			{
				//cout<<"["<<i<<" "<<j<<" ";
				ld u=dp[i][j];
				if (j>0)
					u*=pre[j-1];
				//cout<<u<<" ]";
				ans+=u;
			}
		}
		//cout<<endl;
	}
	cout<<fixed<<setprecision(12)<<ans;
}

Measured memory_bytes: 141056
<?php
while ($line = fgets(STDIN)) {
 $array[] = trim($line);
}
$a = $array[0];
$b = $array[1];

          if($a == 'Sunny'){
            
              echo "Cloudy";
            
          }else if($a == 'Cloudy'){
              
                echo "Rainy";
              
            }else if($a == 'Rainy'){
                
                  echo "Sunny";
                }
?>


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

#define int long long
#define ld long double
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define vt vector
#define pb push_back
#define u_s unordered_set
#define u_m unordered_map
#define p_q priority_queue

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
// if using oset remove define int long long
//#define oset tree<int32_t, null_type, less<int32_t>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define deb(x...) cout << "[" << #x << "] = ["; _print(x)
int __pow(int x, int y) {int res = 1;while(y>0){if(y&1) res*=x; y>>=1; x*=x;}return res;}
int gcd(int a, int b) {if(b==0) return a; return gcd(b, a % b);}

const int N = 2e5+2, inf = 1e18;

int test, query, n, m;

void test_case()
{
    cin>>n;
    if(n<30)
        cout<<"No\n";
    else
        cout<<"Yes\n";
}
int32_t main()
{
//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
//#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    test = 1;
    //cin>>test;
    while(test--)
        test_case();
#ifndef ONLINE_JUDGE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    int r,c,n;
    vector<pair<int,int>> p;
    vector<int> pl;
    Problem(LL r, LL c, LL n):r(r),c(c),n(n){};
    int conv(int a, int b){
        if(a==0) return b;
        else if(b==c) return c+a;
        else if(a==r) return r+c+(c-b);
        else return r+2*c+(r-a);
    }
    void solve(){
        for(int i=0; i<n; ++i){
            int w,x,y,z,tmp=0;
            cin >> w >> x >> y >> z;
            if(w==0 or w == r or x==0 or x == c)tmp++;
            if(y==0 or y == r or z==0 or z == c)tmp++;
            if(tmp==2){
                p.emplace_back(conv(w,x),i);
                p.emplace_back(conv(y,z),i);
            }
        }
        sort(p.begin(),p.end());
        for(int i=0; i<p.size(); ++i){
            pl.push_back(p[i].second);
        }
        vector<int> s;
        for(int i=0; i<(int)pl.size(); ++i){
            if(!s.empty() and s.back() == pl[i])s.pop_back();
            else s.push_back(pl[i]);
        }
        if(!s.empty()) no();

        cout<<"YES"<<"\n";

    }

    void no(){cout << "NO"<<"\n"; exit(0);}
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long r,c,n=0;
    cin >> r >> c >> n;
    Problem p(r,c,n);
    p.solve();
    return 0;
}



Measured memory_bytes: 3696
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char const *argv[]) {
	int N,W,H;
	std::cin >> H >> W;
	std::cin >> N;
	std::vector<int> v;
	int temp;
	int num = 1;
	for (size_t i = 0; i < N; i++) {
		std::cin >> temp;
		for (size_t j = 0; j < temp; j++) {
			v.push_back(num);
		}
		num++;
	}

	int array[H][W];
	for (size_t i = 0; i < H; i++) {
		// 偶数行
		if (i % 2 == 0) {
			for (size_t j = 0; j < W; j++) {
				array[i][j] = v[i*W+j];
			}
		}
		// 奇数行
		else {
			for (size_t j = 0; j < W; j++) {
				array[i][W-j-1] = v[i*W+j];
			}
		}
	}

	//出力
	for (size_t i = 0; i < H; i++) {
		for (size_t j = 0; j < W-1; j++) {
			std::cout << array[i][j] << " ";
		}
		std::cout << array[i][W-1] << '\n';
	}
	return 0;
}


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

int main() {
    int N, Q;
    cin >> N;
    map<int, int> A;
    int a;
    long long sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> a;
        sum += a;
        A[a]++;
    }
    // cout << sum << endl;

    cin >> Q;
    long long B, C;
    for (int i = 0; i < Q; i++) {
        cin >> B >> C;
        sum -= A[B] * B;
        sum += A[B] * C;
        A[C] += A[B];
        A[B] = 0;
        cout << sum << endl;
    }

}


Measured memory_bytes: 8036
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
	int N, C;
	int imos[30][200002];
	int sm[200002];
	cin >> N >> C;
	for(int i = 0; i < 30; i++){
		for(int j = 0; j < 200002; j++){
			imos[i][j] = 0;
		}
	}
	for(int i = 0; i < N; i++){
		int s, t, c;
		cin >> s >> t >> c;
		c--;
		imos[c][s * 2 - 1]++;
		imos[c][t * 2]--;
	}
	for(int i = 0; i < C; i++){
		for(int j = 1; j < 200002; j++){
			imos[i][j] += imos[i][j - 1];
		}
		for(int j = 0; j < 200002; j++){
			if(imos[i][j] > 0) imos[i][j] = 1;
		}
	}
	for(int i = 0; i < 200002; i++){
		int sum = 0;
		for(int j = 0; j < C; j++){
			sum += imos[j][i];
		}
		sm[i] = sum;
	}
	int ans = 0;
	for(int i = 0; i < 200002; i++){
		if(sm[i] > ans) ans = sm[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 24448
import Foundation

let NMC = readLine()!.components(separatedBy: " ")

let N = Int(NMC[0])!
let M = Int(NMC[1])!
let C = Int(NMC[2])!

let B = readLine()!.components(separatedBy: " ").map { Int($0)! }

func passes(_ A: Array<Int>) -> Bool {
    var sum = 0
    for i in 0..<M {
        sum += A[i]*B[i]
    }
    sum += C
    return sum > 0
}


var ret = 0

for _ in 0..<N {
    let A = readLine()!.components(separatedBy: " ").map { Int($0)! }
    // print(A, B, passes(A))
    if passes(A) {
        ret += 1
    }
}

print(ret)

Measured memory_bytes: 14188
N = int(input())
W = list(input().split())
E = []
for T in range(0,N):
  S1 = 0
  S2 = 0
  for l in range(0,T):
    S1 = S1 + int(W[l])
  for m in range(T,N):
    S2 = S2 + int(W[m])
  E.append(abs(S1-S2))
print(min(E))

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace AtcoderSolve
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var LRd = ReadSplitInt();
            var L = LRd[0];
            var R = LRd[1];
            var d = LRd[2];

            var ans = 0;
            for (int i = L; i <= R; i++)
            {
                if (i % d == 0)
                    ans++;
            }

            Println(ans);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");
        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



Measured memory_bytes: 27896
n,m = map(int,input().split())
price = []
honsu = []
c = []
for i in range(n):
  a,b = map(int,input().split())
  c.append([a,b])
c = sorted(c)
price,honsu=zip(*c)
money = 0
l = 0
while m > 0:
  if(m-honsu[l]>0):
    m -= honsu[l]
    money += honsu[l] * price[l]
  else:
    c = abs(m-honsu[l])
    m -= honsu[l]-c
    money += (honsu[l]-c) * price[l]
  l += 1
print(money)

Measured memory_bytes: 28228
#include <stdio.h>

int main()
{
  int n;
  char s[10001];
  scanf("%d%s",&n,&s);
  int i,o=n;
  for(i=0;s[i];++i)
  {
    if(s[i]+n>90)
    {
      o=n-(90-s[i]+1);
      s[i]='A'+o;
      printf("%c",s[i]);
    }
    
   else
      printf("%c",s[i]+n);
  }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
  if (a % b == 0)
    return b;
  return gcd(b, a % b);
}

int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  sort(A.begin(), A.end());
  int Max = A.back();
  int G = A[0];
  for (int i = 1; i < N; i++)
    G = gcd(G, A[i]);
  fprintf(stderr, "%d\n", G);
  if (K <= Max && K % G == 0)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define nl cout<<'\n';
int main()
{
    /*string s;
    cin>>s;
    if((s[0]==s[1]&&s[1]==s[2])||(s[1]==s[2]&&s[2]==s[3]))
      cout<<"Yes";
    else
      cout<<"No";*/
    string s;
    cin>>s;
    cout<<count(s.begin(),s.end(),'1');
    nl;
    return 0;
}


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

public class Main{

  public static void main(String[] args){

    // scanner, writer
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    
    // variables
    int n, m, a, b;
    int[] ans = new int[200001];
    List<List<Integer>> adjList = new ArrayList<>();
    Queue<Integer> next = new ArrayDeque<>();
    int tmp;

    Arrays.fill(ans, -1);

    // read
    n = Integer.parseInt(sc.next());
    m = Integer.parseInt(sc.next());
    for(int i = 0; i <= n; i++){
      adjList.add(new ArrayList<>());
    }
    for(int i = 0; i < m; i++){
      a = Integer.parseInt(sc.next());
      b = Integer.parseInt(sc.next());
      adjList.get(a).add(b);
      adjList.get(b).add(a);
    }

    // process
    next.add(1);
    while(next.peek() != null){
      tmp = next.poll();
      ArrayList<Integer> next_tmp = new ArrayList<Integer>(adjList.get(tmp));
      Iterator<Integer> it = next_tmp.iterator();
      while(it.hasNext()){
        int next_room = it.next();
        if(ans[next_room] == -1){
          ans[next_room] = tmp;
          next.add(next_room);
        }
      }
    }

    out.println("Yes");
    for(int i = 2; i <= n; i++){
      out.println(ans[i]);
    }

    // write
    out.flush();
  }

}


Measured memory_bytes: 78056