akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        int a; cin >> a;
        while(a%2==0){
            a/=2;
            ans++;
        }                
    }
    cout << ans << endl;
        
}

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

int count(int x, int X){
  int sumX=0, sumY=0;
  int y=X-x;
  while(x>0){
    sumX+=x%10;
    x/=10;
  }
  while (y>0){
    sumY+=y%10;
    y/=10;
  }
  return sumX+sumY;
}
  
int main(){
  int N;
  cin >> N;
  int Min=54;
  for (int i=1; i<N; i++){
      Min=min(Min, count(i,N));
  }
  cout << Min << endl;
}

Measured memory_bytes: 256
import sys
def main():
    for line in sys.stdin:
        H, W = map(int, line.split())
        if H == 0 and W == 0:
            break
        else:
            for x in range(H):
                if x % 2 != 0:
                    for y in range(W):
                        if y % 2 != 0:
                            print("#", end = "")
                        else:
                            print(".", end = "")
                    print()
                else:
                    for y in range(W):
                        if y % 2 != 0:
                            print(".", end = "")
                        else:
                            print("#", end = "") 
                    print()
            print()

if __name__ == "__main__":
    main()

Measured memory_bytes: 9112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 10000001
#define mod 1000000007

ll computeTotient(ll n)
{
    ll res=n;
    ll tmp=n;
    for(int i=2;i<=sqrt(tmp);i++)
    {
        if(n%i==0){
            res-=(res/i);
            while(n%i==0)
                n/=i;
        }

    }
    if(n>1)
    {
        res-=(res/n);
    }
    return res;

}
int main()
{
   int l,r,d;cin >> l >> r >> d;
  int c=0;
  for(int i=l;i<=r;i++)
  {
    c+=(i%d==0); 
  }
  cout<<c<<'\n';
} 


Measured memory_bytes: 3496
x, y = map(int, input().split())

group_a = [1, 3, 5, 7, 8, 10, 12]
group_b = [4, 6, 9, 11]
x_y = [x, y]

if all([i in group_a for i in x_y]) or all([i in group_b for i in x_y]) or (x == 2 and y == 2):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
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 (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

ll mod = 1000000007;

signed main()
{
    int n, m;
    cin >> n >> m;
    vi num_of_balls(n, 1);
    vi is_red_possible(n, 0);
    is_red_possible[0] = 1;
    rep(i, m)
    {
        int x, y;
        cin >> x >> y;
        if (is_red_possible[x - 1])
        {
            is_red_possible[y - 1] = 1;
            num_of_balls[x - 1]--;
            num_of_balls[y - 1]++;
            if (num_of_balls[x - 1] == 0)
            {
                is_red_possible[x - 1] = 0;
            }
        }
        else
        {
            num_of_balls[x - 1]--;
            num_of_balls[y - 1]++;
        }
    }
    int ans = 0;
    rep(i, n)
    {
        if(is_red_possible[i]==1){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3908
#include <iostream>
#include <set>
#include <algorithm>

using namespace std;

enum Status {Start, Line, End};

class Event {
public:
    int x;
    Status st;
    int ymin, ymax;
    Event(int _x, Status _st, int _ymin, int _ymax) : x(_x), st(_st), ymin(_ymin), ymax(_ymax) {}
    inline bool operator<(const Event& rhs) const
    {
        return x < rhs.x || (x == rhs.x && st < rhs.st) || (x == rhs.x && st == rhs.st && ymin < rhs.ymin);
    }
};

int main()
{
    set<Event> zSetE;

    int n;
    cin >> n;
    int x1, y1, x2, y2;
    for (int i = 0; i < n; ++i) {
        cin >> x1 >> y1 >> x2 >> y2;
        if (x1 == x2) {
            if (y1 > y2) {
                swap(y1, y2);
            }
            zSetE.insert(Event(x1, Line, y1, y2));
        } else if (y1 == y2) {
            if (x1 > x2) {
                swap(x1, x2);
            }
            zSetE.insert(Event(x1, Start, y1, y2));
            zSetE.insert(Event(x2, End, y1, y2));
        }
    }

    set<int> zCur;
    int Res = 0;

    for (auto it = zSetE.begin(); it != zSetE.end(); ++it) {
        Event E = (*it);
        switch (E.st) {
        case Start:
            zCur.insert(E.ymin);
            break;
        case Line:
            Res += distance(zCur.lower_bound(E.ymin), zCur.upper_bound(E.ymax));
            break;
        case End:
            zCur.erase(E.ymin);
            break;
        }
    }

    cout << Res << endl;

    return 0;
}


Measured memory_bytes: 18104
#include <fstream>
#include <numeric>
#include <unordered_set>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}

#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)

#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define pb push_back
#define pii pair <int, int>
#define print(x) for(auto it : x) cout << it << ' ';
#define endl "\n" // TODO: remove
#define int long long

const int N = (int)(1e6) + 322;
const int inf = (int)(2e18);
const int mod = (int)(1e9) + 7; // check modulo
const double eps = (1e-6);

int cnt[N], a[N];

void solve(int test) {
    int n, k; cin >> n;
    int sum = 0;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
        sum += a[i];
        cnt[a[i]]++;
    }
    int q; cin >> q;
    for(int i = 1; i <= q; ++i) {
        int x, y; cin >> x >> y;
        sum -= cnt[x] * x;
        cnt[y] += cnt[x];
        sum += cnt[x] * y;
        cnt[x] = 0;
        cout << sum << endl;
    }
}

signed main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int test = 1;// cin >> test;
    for(int tt = 1; tt <= test; ++tt) {
        solve(tt);
    }


    return 0;
}

Measured memory_bytes: 5168
from itertools import combinations, count
 
n = int(input())
r = range(n)
a = [(set(), set()) for _ in r]
for i in r:
  for _ in range(int(input())):
    x, y = map(int, input().split())
    a[i][y].add(x - 1)
r = next(i for i in count(n, -1) for x in map(set, combinations(r, i))
         if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x))
print(r)


Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	int H = 0, W = 0, i, j;

	while(1)
	{
		scanf("%d %d", &H, &W);

		if (H == 0 && W == 0) break;

		for (i = 0; i < H; i++)
		{
			for (j = 0; j < W; j++)
			{
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> pii;
int main() {
    int n; cin >> n;
    vector<double> vec(n);
    rep(i, n) cin >> vec.at(i);
    sort(vec.begin(), vec.end());
    double x = (vec.at(0) + vec.at(1)) / 2;
    for(int i = 1; i < n-1;i++) {
        x = (x + vec.at(i+1))/2;
    }
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 3832
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
  int a,b;
   while(1){
  cin>>a>>b;
  if (a == 0 && b == 0)break;
  for (int j=0;j<a;j++){
    for (int i=0;i<b;i++){
      if(j == 0 | j == a-1 |i == 0 |i == b-1){
	cout<<"#";
      }
      else{
	cout<<".";
      }
    }
      cout<<endl;
  }
  cout<<endl;
   }
  return 0;
}



Measured memory_bytes: 3056
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        private static long mod = 1000000007;
        static void Main(string[] args)
        {
            //var n = int.Parse(ReadLine());
            var line = ReadLine().Split(' ').Select(value => long.Parse(value)).ToArray();

            var n = line[0];
            var m = line[1];

            var parents = new int[n];
            for (var i = 0; i < n; i++)
            {
                parents[i] = i;
            }

            for (var i = 0; i < m; i++)
            {
                var edge = ReadLine().Split(' ').Select(value => int.Parse(value) - 1).ToArray();
                var parent = edge.Min();
                var child = edge.Max();

                Unite(parents, child, parent);
            }

            for(var i = 0; i < n; i++)
            {
                Root(parents, i);
            }

            var dic = new Dictionary<int, int>();
            foreach (var parent in parents)
            {
                if (!dic.ContainsKey(parent))
                {
                    dic.Add(parent, 0);
                }
                dic[parent]++;
            }

            WriteLine(dic.Values.Max());
        }

        private static int Root(int[] parents, int x)
        {
            if (parents[x] == x)
            {
                return x;
            }

            return parents[x] = Root(parents, parents[x]);
        }

        private static void Unite(int[] parents, int x, int y)
        {
            var rootX = Root(parents, x);
            var rootY = Root(parents, y);

            if (rootX == rootY)
            {
                return;
            }

            parents[rootX] = rootY;
        }
    }
}


Measured memory_bytes: 44592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int A = in(),B = in(),M = in();
    vector<int> sa(A);
    vector<int> sb(B);
    REP(i,A)sa[i] = in();
    REP(i,B)sb[i] = in();
    int small = mod;
    REP(i,M){
        small = min(small , sa[in()-1] + sb[in()-1] - in());
    }
    sort(ALL(sa));
    sort(ALL(sb));
    small = min(small,sa[0] + sb[0]);
    cout << small << "\n";
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;
const ll mod = 998244353;
const int maxn = 1e6 + 5;


int n, k;
vector<pair<int,int>> ival;

ll dp[maxn];

void add(ll& x, ll y) {
    if (x>=mod) x%=mod;
    if (y>=mod) y%=mod;
    x += y;
    if (x>=mod) x%=mod;
}

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

    cin>>n>>k;
    ival.resize(k);
    for (int i=0; i<k; i++) {
	cin>>ival[i].first>>ival[i].second;
    }

    dp[1]=1;


    auto qry = [&](int l, int r) {
	ll res=dp[r];
	if (l>0) res-=dp[l-1];
	res %= mod;
	res += mod;
	res %= mod;
	return res;
    };

    for (int i=2; i<=n; i++) {
	for (auto p: ival) {
	    int l=p.first;
	    int r=p.second;
	    if (i-l<1) continue;
	    int lo = max(1,i-r);
	    int hi = i-l;
	    //cout<<lo<<" "<<hi<<endl;
	    add(dp[i], qry(lo,hi));
	}
	if (i<n) {
	    add(dp[i],dp[i-1]);
	}
    }

    cout<<dp[n]<<endl;    
    return 0;
}


Measured memory_bytes: 5188
#include "bits/stdc++.h"
using namespace std;

int main() {
	
	int a, b;
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0) cout << "Possible" << endl;
	else cout << "Impossible" << endl;
	
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;


const int mod = 1000000007;

vector<int> check(int p, int len)
{
    vector<int> ret = vector<int>(len, 0);
    int cnt = 0;
    while (p){
        if (p & 1) ret[cnt] = 1;
        else ret[cnt] = 0;
        cnt++;
        p /= 2;
    }
    return ret;
}

int f[105][130][8];
int n, m, K;
int main(){
    f[0][0][0] = 1;
    cin >> n >> m >> K;
    if (m == 1){
        cout << 1 << endl;
        return 0;
    }
    for (int i = 1; i <= n; i++){
        for (int j = 0; j < (1 << (m - 1)); j++){
            auto mask = check(j, m - 1);
            bool valid = true;
            for (int l = 0; l < m - 2; l++) if (mask[l] == 1 && mask[l + 1] == 1) valid = false;
            if (!valid) continue;
            for (int k = 0; k < (1 << (m - 1)); k++)
                for (int l = 0; l < m; l++){
                    int p;
                    if (l != m - 1 && mask[l]) p = l + 1;
                    else if (l && mask[l - 1]) p = l - 1;
                    else p = l;
                    f[i][j][p] = (f[i][j][p] + f[i - 1][k][l]) % mod;
                }
        }
    }
    int ans = 0;
    for (int i = 0; i < (1 << (m - 1)) ; i++){
        ans = (ans + f[n][i][K - 1]) % mod;
    }
    cout << ans << endl;
}

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

using namespace std;

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

  int n;
  cin >> n;
  unordered_set<string> kek;
  while (n--) {
    string s;
    cin >> s;
    kek.insert(s);
  }
  cout << kek.size();

  return 0;
}


Measured memory_bytes: 17692
#include <algorithm> //STLͨ���㷨
#include <cmath> //������ѧ����
#include <cstdio> //��������/�������
#include <iostream> //����������/���
#include <cstring> //�ַ�������
#include <string> //�ַ�����
#include <ctime> //�������ʱ��ĺ���
#define itn int
#define fro for
#define ll long long
#define reg register
#define inf 1234567890
#define rep(i,a,b,c) for (int i=a;i<=b;i+=c)
/*#include <bitset> //STLλ������
#include <cstype> //�ַ�����
#include <cerrno> //���������
#include <complex> //������
#include <clocale> //���屾�ػ�����
#include <cstdlib> //������������ڴ���亯��
#include <deque> //STL˫�˶�������
#include <exception> //�쳣������
#include <fstream> //�ļ�����/���
#include <functional> //STL�������㺯��(���������)
#include <limits> //�����������������ֵ����
#include <list> //STL�����б�����
#include <map> //STLӳ������
#include <iomanip> //����������/���
#include <ios> //��������/���֧��
#include <iosfwd> //����/���ϵͳʹ�õ�ǰ������
#include <istream> //����������
#include <ostream> //���������
#include <queue> //STL��������
#include <set> //STL��������
#include <sstream> //�����ַ�������
#include <stack> //STL��ջ����
#include <stdexcept> //��׼�쳣��
#include <streambuf> //�ײ�����/���֧��
#include <utility> //STLͨ��ģ����
#include <vector> //STL��̬��������
#include <cwchar.h>//���ַ�����������/���
#include <cwctype.h> //���ַ�����*/

using namespace std;

int ans;

int max(int x,int y){return x>y?x:y;}

int min(int x,int y){return x<y?x:y;}

int abs(int x){return x>0?x:-x;}

int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}

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

int quick_power(ll a,int b){ll r=1;for (;b;b>>=1,a=a*a)if (b&1) r=r*a;return r;}

inline char read() {
	static const int IN_LEN = 1000000;
	static char buf[IN_LEN], *s, *t;
	return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++);
}
template<class T>
inline void read(T &x) {
	static bool iosig;
	static char c;
	for (iosig = false, c = read(); !isdigit(c); c = read()) {
		if (c == '-') iosig = true;
		if (c == -1) return;
	}
	for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
	if (iosig) x = -x;
}

char sr[10000000],z[20];int C=-1,Z=0;
void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(int x){
	if (x<0) sr[++C]='-',x=-x;
	while(z[++Z]=x%10+48,x/=10);
	while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
//int find(int x){return fa[x]=fa[x]==x?x:find(fa[x]);}

//void add(int x,int y,int z){to[++cnt]=y;v[cnt]=z;Next[cnt]=head[x];head[x]=cnt;}

int main()
{
	int k,a,b;
	read(k);read(a);read(b);
	if (a>=(b-2)||k<a) printf("%d\n",k+1);
	else
	{
		k-=a-1;
		ans=k/2;
		if (ans==0) printf("%d\n",a+k%2);
		else printf("%lld\n",1ll*b+1ll*(ans-1)*(b-a)+k%2);
	}
	return 0;
}









Measured memory_bytes: 2304
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d", &x)
#define scs(x) scanf("%s", x)
#define scl(x) scanf("%lld", &x)
#define mst(a,x) memset(a, x, sizeof(a))
#define rep(i,s,e) for(int i=s; i<e; ++i)
#define dep(i,e,s) for(int i=e; i>=s; --i)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 3e5 + 5;
const int mod = 1e9 + 7;
char s[4005];
ll c[3][4005];
int solve(){
    int n,cnt(0); sc(n); scs(s+1); rep(i,1,n+1){
        int t=s[i]=='R'?0:s[i]=='G'?1:2;
        c[t][i]++; rep(j,0,3) c[j][i]+=c[j][i-1];
    } rep(i,1,n+1) rep(j,i+1,n+1){
        if(s[i]==s[j]) continue;
        int t1=s[i]=='R'?0:s[i]=='G'?1:2;
        int t2=s[j]=='R'?0:s[j]=='G'?1:2;
        int t3=3-t1-t2,t4; 
        if(j*2-i>n) t4=3;
        else t4=s[j*2-i]=='R'?0:s[j*2-i]=='G'?1:2;
        cnt+=c[t3][n]-c[t3][j-1]-(t3==t4);
    } return pf("%lld\n",cnt);
}
int main(){
    /* int _; sc(_); while(_--) */ solve();
}

Measured memory_bytes: 3856
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication42
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                int a = int.Parse(Console.ReadLine());
                if (a == 0)
                    break;
                int b = 0;
                while (true)
                {
                    if (a == 1)
                        break;
                    if (a % 2 == 1)
                    {
                        a = a * 3 + 1;
                        b++;
                    }
                    if (a % 2 == 0)
                    {
                        a = a / 2;
                        b++;
                    }
                }
                Console.WriteLine(b);
            }
        }
    }
}

Measured memory_bytes: 9112
#include <bits/stdc++.h>
#define MAXN 100010
typedef long long ll;

using namespace std;

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

    int res=0;
    for (auto itr=a.begin();itr!=a.end();itr++){
	if (itr->first < itr->second){
	    res+=(itr->second)-(itr->first);
	} else if (itr->first  > itr->second){
	    res+=itr->second;
	}
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
	int n, i;
	cin >> n;
    vector<pair<int, int> > student(n);

	for (i = 0; i < n; i++) {
		cin >> student[i].first;
		student[i].second = i + 1;
	}

	sort(student.begin(), student.end());

	for (i = 0; i < n; i++)
		cout << student[i].second << endl;
	

	return 0;
}


Measured memory_bytes: 1664
#include <iostream>

using namespace std;

int main()
{
	bool stonepro[30]={false};
	
	int j;
	for(int i=0;i<28;i++)
	{
		cin>>j;
		stonepro[j-1]=true;
	}
	
	for(int i=0;i<30;i++)
	{
		if(stonepro[i]==false)
		{
			cout<<i+1<<"\n";
		}
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
const int N=500005;
int n,q,a[N],l[N],r[N],b[N],c[N],ans[N];
vector<int>v;
vector<pair<int,int>>x[N];
void add(int x,int v)
{
	for(int i=x;i<=n;i+=i&(-i))
		b[i]+=v;
}
int sum(int x)
{
	int v=0;
	for(int i=x;i;i-=i&(-i))
		v+=b[i];
	return v;
}
int main()
{
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		v.push_back(a[i]);
	}
	sort(v.begin(),v.end());
	v.erase(unique(v.begin(),v.end()),v.end());
	for(int i=1;i<=n;i++)
		a[i]=lower_bound(v.begin(),v.end(),a[i])-v.begin()+1;
	for(int i=1;i<=q;i++)
	{
		scanf("%d%d",&l[i],&r[i]);
		x[r[i]].emplace_back(l[i],i);
	}
	for(int i=1;i<=n;i++)
	{
		if(c[a[i]])
			add(c[a[i]],-1);
		c[a[i]]=i;
		add(i,1);
		for(auto zh:x[i])
			ans[zh.second]=sum(i)-sum(zh.first-1);
	}
	for(int i=1;i<=q;i++)
		printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 39028
import Control.Applicative

getInt :: IO Int
getInt = (\a -> read a :: Int) <$> getLine

getInteger :: IO Integer
getInteger = (\a -> read a :: Integer) <$> getLine

{-
ListInt :: IO [Int]
ListInt = (map (\a -> read a :: Int) $ words) <$> getLine

ListInteger :: IO [Integer]
ListInteger = (map (\a -> read a :: Integer) $ words) <$> getLine
-}

count "" = 0
count ('-':res) = (count res) - 1
count ('+':res) = (count res) + 1

main = do
    print =<< count <$> getLine


Measured memory_bytes: 380
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <functional>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll labs(ll x){
	if(x<0)return -x;
	return x;

}

ll a,b;
int n;

int main(void){
	scanf("%lld%lld%d",&a,&b,&n);
	ll res=labs(a-b);
	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=n;j++){
			if(b%j!=0)continue;
			ll mul=b/j;
			res=min(res,labs(a-i*mul));
		}
	}
	printf("%lld\n",res);

	return 0;
}

Measured memory_bytes: 1192
import Control.Monad
import Data.Char
import Control.Applicative

decomp :: String -> [Int]
decomp = map digitToInt

qsort :: [Int] -> [Int]
qsort [] = []
qsort (p:xs) = qsort lt ++ [p] ++ qsort gteq
  where lt   = [x | x <- xs, x <  p]
        gteq = [x | x <- xs, x >= p]

converter :: [Int] -> Int
converter xs = read (concatMap show xs)


diff :: [Int] -> Int
diff xs =
  let qs = qsort xs
  in
      converter (reverse qs) - converter qs

solver :: [String] -> [Int]
solver xs =
  let ys = map decomp xs
  in
      map diff ys


main :: IO()
main = do
  n <- (read :: String -> Int) <$> getLine
  contents <- replicateM n getLine
  mapM_ print $ solver contents

Measured memory_bytes: 3796
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>

using namespace std;

typedef long long ll;

ll Solve(int u, int v, const vector<vector<int>>& g, const vector<int>& degree) {
  int n = g.size();
  vector<int> maxDegree(n);
  for (int i = 0; i < n; ++i) {
    int depth = min(g[i][u], g[i][v]);
    maxDegree[depth] = max(maxDegree[depth], degree[i]);
  }

  ll result = 2;
  if (u == v) {
    result = degree[u];
  }

  for (int depth = 1; depth < n; ++depth) {
    ll cur = maxDegree[depth];
    if (cur <= 1) continue;
    result *= cur - 1;
  }

  if (u != v && maxDegree[0] > 1) {
    result *= maxDegree[0] - 1;
  }
  return result;
}

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

  const int inf = 1000;
  vector<vector<int>> g(n, vector<int>(n, inf));
  for (int i = 0; i < n; ++i) g[i][i] = 0;

  vector<int> degree(n);

  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    degree[a]++;
    degree[b]++;
    g[a][b] = 1;
    g[b][a] = 1;
  }

  for (int t = 0; t < n; ++t) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (g[i][j] > g[i][t] + g[t][j]) {
          g[i][j] = g[i][t] + g[t][j];
        }
      }
    }
  }

  int d = 0;
  int x = -1;
  int y = -1;

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (g[i][j] > d) {
        d = g[i][j];
        x = i;
        y = j;
      }
    }
  }

  int u = -1;
  int v = -1;
  for (int i = 0; i < n; ++i) {
    if (g[x][i] == d / 2 && g[i][y] == d - d / 2) {
      u = i;
    }
    if (g[x][i] == d - d / 2 && g[i][y] == d / 2) {
      v = i;
    }
  }

  ll result = Solve(u, v, g, degree);
  if (u == v) {
    for (int w = 0; w < n; ++w) {
      if (g[u][w] == 1) {
        result = min(result, Solve(u, w, g, degree));
      }
    }
  }

  cout << d / 2 + 1 << " " << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  int64_t N;
  cin >> N;
  int64_t W = 0;
  while (W * (W + 1) < 2 * N) {
    ++W;
  }
  int64_t H = W + 1;
  if (W * H != 2 * N) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  vector<vector<int>> answer(H, vector<int>(W, -1));
  answer[0][0] = 1;
  int val = 1;
  for (int i = 0; i < W; ++i) {
    for (int j = i; j < W; ++j) {
      answer[i][j] = answer[j][i] = val++;
    }
  }
  for (int i = 0; i < W; ++i) {
    answer[H - 1][i] = answer[i][i];
  }

  cout << H << endl;
  rep(i, H) {
    cout << W;
    rep(j, W) { cout << " " << answer[i][j]; }
    cout << endl;
  }
  return 0;
}

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

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	std::vector<int> a(4);
	std::vector<int> b(4);

#if INPUT_FROM_FILE
	//std::ifstream ifs("test.txt");
	FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	while(fscanf(fp, "%d %d %d %d", &a[0], &a[1], &a[2], &a[3]) != EOF){
#else
	while(scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]) != EOF){
#endif
		int hit = 0;
		int blow = 0;
		std::vector<int> aa;
		std::vector<int> bb;
#if INPUT_FROM_FILE
		fscanf(fp, "%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
#else
		scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
#endif
		for(int i = 0; i < 4; i++){
			if(a[i] == b[i]){
				hit++;
			}
			else{
				aa.push_back(a[i]);
				bb.push_back(b[i]);
			}
		}

		for(unsigned int i = 0; i < aa.size(); i++){
			for(unsigned int j = 0; j < bb.size(); j++){
				if(aa[i] == bb[j]){
					blow++;
				}
			}
		}
		std::cout << hit << " " << blow << std::endl;
	}
	
	return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 w, h, n;
  cin >> w >> h >> n;
  vector<i64> x(n), y(n);
  for (i64 i = 0; i < n; i++)
    cin >> x[i] >> y[i];
  vector<i64> m(h);
  for (i64 i = 0; i < n; i++)
    m[y[i]] = max(m[y[i]], x[i]);
  i64 ans = 1e9, mob = 0;
  for (i64 i = h - 1; 0 <= i; i--)
  {
    ans = min(ans, i + mob);
    mob = max(mob, m[i]);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 5212
N = int(input())
A = [0] + list(map(int, input().split()))
B = [0] * (N + 1)

for i in reversed(range(1, N + 1)):
    bl = 0
    for j in range(i, N + 1, i):
        bl += B[j]
    if bl % 2 != A[i]:
        B[i] = 1

print(sum(B))
print(*[i for i, b in enumerate(B) if b == 1], sep=' ')


Measured memory_bytes: 13104
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,m,x;
  cin>>n>>m>>x;
  int a[m];
  int cost=0;
  for(int i=0;i<m;i++) cin>>a[i];
  while(x && x!=n){
    if(n/2>x){
      --x;
      for(int i=0;i<m;i++){
        if(a[i]==x) cost++;
      }
    }else{
      ++x;
      for(int i=0;i<m;++i){
        if(a[i]==x) cost++;
      }
    }
  }
cout<<cost<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lli h,a,cnt=0;
    cin>>h>>a;
    while(h>0)
    {
        h=h-a;
        cnt++;
    }
    cout<<cnt<<"\n";
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ll X, K, D;
    cin >> X >> K >> D;
    X = abs(X);
    ll a = X/D;
    if(K < a) cout << X-D*K << endl;
    else{
        if((K-a)&1) cout << abs(X-D*(a+1)) << endl;
        else cout << X-D*a << endl; 
    }
}

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

int main() {
	int n, i = 0;
	long long a;
	long long Max = -1000000;
	long long Min = 1000000; 
	long long Sum = 0;

	cin >> n;
	while (1) {
		cin >> a ;
		if (Max < a) {
			Max = a;
		}
		if (Min > a) {
			Min = a;
		}
		Sum = Sum + a;
		i = i + 1;
		if (i == n)break;
	}
	cout << Min << " " << Max << " " << Sum << endl;
}


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

int main(){
    vector<int> num(3);
    for(int i = 0; i < 3; i++){
        cin >> num[i];
    }
    sort(num.begin(), num.end());

    int k;
    cin >> k;
    for(int i = 0; i < k; i++){
        num[2] *= 2;
    }

    cout << num[0] + num[1] + num[2] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    long x,k,d;
    cin >> x >> k >> d;
    long a = abs(x)/d;
    if(k<a){
        cout << min(abs(x+k*d),abs(x-k*d)) << endl;
    }
    else if(k==a){
        cout << min(abs(x+a*d),abs(x-a*d)) << endl;
    }
    else{
        if(k%2==a%2){
            cout << min(abs(x+a*d),abs(x-a*d)) << endl;
        }
        else{
            a++;
            cout << min(abs(x+a*d),abs(x-a*d)) << endl;
        }
    }
}

Measured memory_bytes: 3584
#include <stdlib.h>
#include <stdio.h>

int N;
int XYD[100001][3];

double calc_area(double n) {
  const int tbl[][2] = {
    {1, 0}, {-1, 0}, {0, 1}, {0, -1},
  };
  double min_x, min_y, max_x, max_y;
  min_x = min_y = 1e9;
  max_x = max_y = -1e9;
  
  for (int i = 0; i < N; ++i) {
    // printf("%lf %lf %lf %lf\n", max_x, min_x, max_y, min_y);
    // printf("%d %d\n", tbl[XYD[i][2]][0], tbl[XYD[i][2]][1]);
    double x = XYD[i][0];
    double y = XYD[i][1];
    x += n * tbl[XYD[i][2]][0];
    y += n * tbl[XYD[i][2]][1];
    if (x < min_x)
      min_x = x;
    if (x > max_x)
      max_x = x;
    if (y < min_y)
      min_y = y;
    if (y > max_y)
      max_y = y;
  }
  return (max_x - min_x) * (max_y - min_y);
}

int main(void) {
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) {
    int x, y, z;
    char d;
    scanf("%d %d %c", &x, &y, &d);
    XYD[i][0] = x;
    XYD[i][1] = y;
    switch (d) {
    case 'R':
      XYD[i][2] = 0;
      break;
    case 'L':
      XYD[i][2] = 1;
      break;
    case 'U':
      XYD[i][2] = 2;
      break;
    default:
      XYD[i][2] = 3;
      break;
    }
  }

  double l = 0.0;
  double r = 1e9;

  for (int i = 0; i < 200; ++i) {
    if (calc_area((l * 2 + r) / 3) < calc_area((l + r * 2) / 3))
      r = (l + r * 2) / 3;
    else
      l = (l * 2 + r) / 3;
  }
  double c = (l + r) / 2;
  // printf("%lf\n", c);
  printf("%lf\n", calc_area(c));

  return 0;
}


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

using namespace std;

int main() {
	int h, w, n, r, c;
	string s, t;
	cin >> h >> w >> n >> r >> c >> s >> t;
	int r1 = 1, r2 = h, c1 = 1, c2 = w;
	for (int i = n; i--;) {
		if (r1 > r2 || c1 > c2) continue;
		if (t[i] == 'L') c2 = min(c2 + 1, w);
		if (t[i] == 'R') c1 = max(c1 - 1, 1);
		if (t[i] == 'U') r2 = min(r2 + 1, h);
		if (t[i] == 'D') r1 = max(r1 - 1, 1);
		if (s[i] == 'L') c1 = min(c1 + 1, c2 + 1);
		if (s[i] == 'R') c2 = max(c2 - 1, c1 - 1);
		if (s[i] == 'U') r1 = min(r1 + 1, r2 + 1);
		if (s[i] == 'D') r2 = max(r2 - 1, r1 - 1);
	}
	cout << (r1 <= r && r <= r2 && c1 <= c && c <= c2 ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vec;
typedef vector<vec> mat;
/*Gauss_Jordan(2?????°???????????§???)
  O(n^3)
  Ax=b????§£??? A?????£?????????
  ?§£???????????¨??????????????????????????????
  ?§£???????????§????????¨?????????n+1??????????????????
  
  N???????????°??§M??????????¨???????????????´??????init?????????
  mat A(N,vec(M,0));
  vec B(N,0);
  gauss_jordan(A,B)
*/

vec gauss_jordan(const mat& A,const vec& b){
  int n=A.size();
  mat B(n,vec(n+1));
  vector<int> can(n,1);
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)B[i][j]=A[i][j]; //n*(n+1)?????????????????????

  for(int i=0;i<n;i++)B[i][n]=b[i]; //n???????????£??\

  for(int i=0;i<n;i++){
    int pivot=i;//?¬????????????¨??????????????????
    for(int j=0;j<n;j++)if(can[j] && B[j][i])pivot=j;//0??\??????1????????¢???
    swap(B[i],B[pivot]);//i??????????????£????????????
    if(B[i][i]==1)can[i] = 0;

    
    for(int j=0;j<n;j++){ //
      if(i!=j && B[j][i])//i??????-i?????????????????????
        for(int k=i;k<=n;k++)B[j][k]=B[j][k] ^ B[i][k];//i????????????i????????\??????0????????????
    }
  }
  vec x(n);
  for(int i=0;i<n;i++)x[i]=B[i][n];

  int many = 0;
  for(int i=0;i<n;i++){
    if(B[i][i] == 0) many = 1;
    if(B[i][i] == 0 && B[i][n] == 1) return vec();
  }
  if(many) return vec(n+1);
  return x;
}




mat Mult(const mat &A,const mat &B){
  assert(A[0].size() == B.size());
  int n = A.size(),m = B.size(),l = B[0].size();
  mat C(A.size(),vec(B[0].size(),0));

  for(int i=0;i<n;i++)
    for(int j=0;j<l;j++)
      for(int k=0;k<m;k++) C[i][j]^=(A[i][k]*B[k][j]);
 
  return C;
}

mat pow(mat X,int y){
  assert(X.size() == X[0].size());
  mat res(X.size(),vec(X[0].size()));
  for(int i=0;i<(int)res.size();i++) res[i][i] = 1;
  
  while(y){
    if(y%2) res = Mult(res,X);
    y/=2;
    X = Mult(X,X);

  }
  return res;
}



int main(){
  int n;
  cin>>n;
  mat A(n,vec(n));
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)cin>>A[i][j];
  
  vec B(n);
  for(int i=0;i<n;i++) cin>> B[i];
  
  int T;
  cin>>T;

  mat AT = pow(A,T);
  vec ans = gauss_jordan(AT,B);

  if(ans.empty()) cout<<"none"<<endl;
  else if(ans.size()>n) cout<<"ambiguous"<<endl;
  else {
  for(int i=0;i<(int)ans.size();i++){
    if(i)cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 4464
# coding: utf-8
# Your code here!

import sys
from collections import deque, Counter
import bisect
import math
from itertools import accumulate, product, permutations, combinations, groupby
from fractions import gcd 
import heapq
sys.setrecursionlimit(10**6)
#input = sys.stdin.readline #文字列入力のときは注意

R,G,B,n = [int(i) for i in input().split()]

ans = 0
for r in range(n//R+1):
    for g in range(n//G+1):
        c=n-r*R-g*G
        if c >= 0 and c%B == 0:
            ans += 1

print(ans)
    
     



#if ok == 1:
#   print("Yes")
#else:
#   print("No")



Measured memory_bytes: 66408
class UnionFind(object):
    def __init__(self, n):
        self.par = [i for i in range(n + 1)]
        self.rank = [0 for i in range(n + 1)]
        self.member = [1 for i in range(n + 1)]

    def find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def check(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                self.par[x] = y
                self.member[y] += self.member[x]
            elif self.rank[x] > self.rank[y]:
                self.par[y] = x
                self.member[x] += self.member[y]
            else:
                self.par[y] = x
                self.rank[x] += 1
                self.member[x] += self.member[y]

    def size(self, x):
        return self.member[self.find(x)]

n, m, k = map(int, input().split())
U = UnionFind(n)
may_friend = [-1 for _ in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    U.union(a, b)
    may_friend[a] += -1
    may_friend[b] += -1
for i in range(k):
    c, d = map(int, input().split())
    if U.check(c, d):
        may_friend[c] += -1
        may_friend[d] += -1

ans = [max(0, may_friend[i] + U.size(i)) for i in range(1, n + 1)]
print(*ans)


Measured memory_bytes: 16176
#include <iostream>

 

using namespace std;

 

int main()
{
    int a ,b, i;
    for(i=1; i<=3000; i++)
    {
        cin >> a >> b;
        if(a==0 && b==0)
            break;
            
        if(a > b)
        {
            a = a+b;
            b = a-b;
            a = a-b;
        }
        cout << a << " " << b << endl;
    }
}


Measured memory_bytes: 2960
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);	
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int x, y; cin >> x >> y;
	if((y < 2 * x) || ((y - 2 * x) & 1)) cout << "No";
	else if((4 * x < y) || ((4 * x - y) & 1)) cout << "No";
	else cout << "Yes";

	return 0;
}

Measured memory_bytes: 3604
from collections import deque
def resolve():
    H, W = map(int, input().split())
    Ch, Cw = map(lambda x: int(x) - 1, input().split())
    Dh, Dw = map(lambda x: int(x) - 1, input().split())
    maze = [input() for _ in range(H)]

    INF = 10 ** 12
    path = [[INF] * W for _ in range(H)]

    q = deque()
    path[Ch][Cw] = 0
    q.append((Ch, Cw, 0))

    walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
    warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

    while q:
        x, y, s = q.popleft()
        for dx, dy in walk:
            nx = x + dx
            ny = y + dy
            if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and path[nx][ny] > s:
                path[nx][ny] = s
                q.appendleft((nx, ny, s))
        for dx, dy in warp:
            nx = x + dx
            ny = y + dy
            if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and path[nx][ny] > s + 1:
                path[nx][ny] = s + 1
                q.append((nx, ny, s + 1))

    ans = path[Dh][Dw] if path[Dh][Dw] < INF else -1
    print(ans)


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 98364
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){

    LL int a,b,c,ans;

    cin >> a >> b >> c;

    if(((a%2) * (b%2) * (c%2)) % 2 == 0)ans = 0;
    else{
        if(a < b)swap(a,b);
        if(a < c)swap(a,c);
        ans = b * c;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    n,k=map(int,input().split())
    c=[False]*n
    for i in range(k):
        d=int(input())
        A=list(map(int,input().split()))
        for j in A:
            if c[j-1]==False:
                c[j-1]=True
    print(n-sum(c))



resolve()

Measured memory_bytes: 67552
#include<bits/stdc++.h>
using namespace std;
int main(void){
	string s;
	cin>>s;
	if(s=="Sunny")			cout<<"Cloudy"<<endl;
	else if(s=="Cloudy")	cout<<"Rainy"<<endl;
	else					cout<<"Sunny"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int vx[] = { 1,0,-1,0 };
int vy[] = { 0,1,0,-1 };
int main()
{
	int H, W;
	cin >> H >> W;
	string S[51];
	for (int i = 0; i < H; i++) cin >> S[i];
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '#') {
				bool ok = false;
				for (int k = 0; k < 4; k++) {
					int nx = j + vx[k];
					int ny = i + vy[k];
					if (nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
					if (S[ny][nx] == '#') {
						ok = true;
						break;
					}
				}
				if (!ok) {
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
}

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

typedef long long s64;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=1e5+5,D=1e9+7;
int n,m;
s64 c[N];
pii p[N];
int a[N],b[N];
s64 dp[N];

void add(int i,int x)
{
	for(;i<=n;i+=i&-i)c[i]+=x;
}
int qiu(int i)
{
	s64 ans=0;
	for(;i;i-=i&-i)ans+=c[i];
	return ans%D;
}

int main()
{
#ifdef kcz
	freopen("1.in","r",stdin);
#endif
	cin>>n>>m;
	rep(i,1,n)scanf("%d",a+i);
	rep(i,1,m)scanf("%d",b+i);
	int n0=n;n=0;
	rep(i,1,n0)
	{
		if(a[i]<b[1]||a[i]>b[m])continue;
		int j=lower_bound(b+1,b+m+1,a[i])-b;
		p[++n]=pii(a[i]-b[j-1],b[j]-a[i]);
	}
	rep(i,1,n)b[i]=p[i].second;
	sort(b+1,b+n+1);
	int u=unique(b+1,b+n+1)-b-1;
	rep(i,1,n)p[i].second=lower_bound(b+1,b+u+1,p[i].second)-b;
	
	sort(p+1,p+n+1,[&](pii a,pii b){ return a.first!=b.first?a.first<b.first:a.second>b.second; });
	rep(i,1,n)
	{
		if(p[i].first==p[i-1].first&&p[i].second==p[i-1].second)dp[i]=0;
		else dp[i]=qiu(p[i].second-1)+1;
		add(p[i].second,dp[i]);
	}
	s64 ans=1;
	rep(i,1,n)ans+=dp[i];
	cout<<ans%D;
}

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

int main(){
	string S;
	long long K;
	char ans;
	int count = 0;
	cin >> S >> K;
	for (int i = 0; i < S.size(); i++){
		if (S.at(i) != '1'){
			ans = S.at(i);
			break;
		}
		else
			count++;
	}
	if (count >= K)
		cout << 1 << endl;
	else
		cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t;
	t = 1;
	//cin >> t;
	while (t--)
	{
		int x;
		cin>>x;
		cout<<1-x<<"\n";
	}
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    int n;
    cin >> n;
    string grid[n*2];
    for(int i = 0;i < n;i++){
        cin >> grid[i];
        grid[i] = grid[i] + grid[i];
    }
    for(int i = n;i < 2*n;i++){
        grid[i] = grid[i - n];
    }
    int res = 0;
    for(int i = 0;i < n;i++){
        bool ok = 1;
        for(int j = 0;j < n;j++){
            for(int k = 0;k < n;k++){
                if(grid[j][k + i] != grid[k][j + i])ok = 0;
                if(!ok)break;
            }
            if(!ok)break;
        }
        if(ok)res += n;
    }
    cout << res;
}


Measured memory_bytes: 768
N=int(input())
ls=[int(s) for s in input().split()]
i=0
ans=0
while True:
  if ls[i] %2 == 0:
    ls[i] //= 2
  else:
    break
  i += 1
  if i == N :
    i = 0
    ans += 1
print(ans)

Measured memory_bytes: 3060
// you should probably see at the bottom ..
#include<bits/stdc++.h>

#ifdef LOCAL
#include "prabh.hpp"
#endif

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define rrange(v) v.rbegin(), v.rend()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;

void solve() {
	int n; cin >> n;
	vector<int> a(n);
	for (int &i : a) cin >> i;
	int ans = 0;
	int prev = a[0];
	for (int i = 1; i < n; i++) {
		ans += max(0ll, prev - a[i]);
		prev = max(prev, a[i]);
	}

	cout << ans << endl;
}

int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
//	cin >> t_c;
	while (t_c--)
		solve();
}

/*
 * COME ON DUDE .... DONT GET UP UNTIL U GET THE SOLUTION
 * GIVING UP NOT GONNA HELP .. JUST GET YOUR ASS TO WORK ALREADY ..
 * AND FOR FUCKING SAKE ... DONT PANIC !!
*/


Measured memory_bytes: 4748
#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>;

const int di[] = { -1, 0, 1, 0 };
const int dj[] = { 0, -1, 0, 1 };

int main()
{
  int h, w;
  cin >> h >> w;
  int si, sj;
  cin >> si >> sj;
  int ti, tj;
  cin >> ti >> tj;
  --si; --sj; --ti; --tj;
  vector <string> s(h);
  rep(i, h) cin >> s[i];
  const int              INF = 1e9;
  vector <vector <int> > dist(h, vector <int>(w, INF));
  deque <P>              q;
  dist[si][sj] = 0;
  q.emplace_back(si, sj);
  while (!q.empty()) {
    int i = q.front().first;
    int j = q.front().second;
    int d = dist[i][j];
    q.pop_front();
    if (dist[i][j] != d) { continue; }
    rep(v, 4) {
      int ni = i + di[v], nj = j + dj[v];
      if (ni < 0 || ni >= h || nj < 0 || nj >= w) { continue; }
      if (s[ni][nj] == '#') { continue; }
      if (dist[ni][nj] <= d) { continue; }
      dist[ni][nj] = d;
      q.emplace_front(ni, nj);
    }
    for (int ei = -2; ei <= 2; ++ei) {
      for (int ej = -2; ej <= 2; ++ej) {
        int ni = i + ei, nj = j + ej;
        if (ni < 0 || ni >= h || nj < 0 || nj >= w) { continue; }
        if (s[ni][nj] == '#') { continue; }
        if (dist[ni][nj] <= d + 1) { continue; }
        dist[ni][nj] = d + 1;
        q.emplace_back(ni, nj);
      }
    }
  }
  int ans = dist[ti][tj];
  if (ans == INF) { ans = -1; }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9564
program main
 implicit none

 integer A,B,C
 read(*,*) A,B,C
 if(A < C .and. B > C) then
  write(*,*) 'Yes'
 else if(A > C .and. B < C) then
  write(*,*) 'Yes'
 else
  write(*,*) 'No'
 end if
end program main

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to));
#define sort(a) sort(a.begin(), a.end())

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

int main() {
  int a, b;
  cin >> a >> b;
  if (a >= 13) {
    cout << b << endl;
  } else if (a <= 5) {
    cout << 0 << endl;
  } else {
    cout << b / 2 << endl;
  }
}

Measured memory_bytes: 256