akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

int main() {
    int N, K; cin >> N;
    K = N / 2;
    vector<pii> edges;
    if(N % 2 == 0) {
        // N = 2K
        repp(i, 1, K) {
            repp(j, i + 1, K) {
                edges.push_back({i, j});
                edges.push_back({i, 2 * K + 1 - j});
                edges.push_back({2 * K + 1 - i, j});
                edges.push_back({2 * K + 1 - i, 2 * K + 1 - j});
            }
        }
    } else {
        // N = 2K + 1
        repp(i, 1, K) {
            repp(j, i + 1, K) {
                edges.push_back({i, j});
                edges.push_back({i, 2 * K + 1 - j});
                edges.push_back({2 * K + 1 - i, j});
                edges.push_back({2 * K + 1 - i, 2 * K + 1 - j});
            }
        }
        repp(i, 1, N - 1) {
            edges.push_back({i, N});
        }
    }
    cout << sz(edges) << "\n";
    for(auto &e : edges) cout << e.first << " " << e.second << "\n";
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
int main (){
  int N;
  long long int match=0;
  scanf("%d",&N);
  long int x,y,a[200005],b[200005]={0};
  for(int i=0;i<N;i++){
    scanf("%ld",&a[i]);
    x=a[i]-1;
    b[x]++;
  }
  
  for(int i=0;i<N;i++){
    match=match+( b[i]*(b[i]-1) )/2;
  }
  

  for(int i=0;i<N;i++){
    x=a[i]-1;
    y=b[x]-1;
    printf("%lld\n",match-y);
  }
  return 0;
}


Measured memory_bytes: 5632
// AOJ 1161: Verbal Arithmetic
// 2018.1.9 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int m, sz;
char str[13][11]; int len[13], max;
char tr['Z'+1], assign['Z'+1];
char idx[10], not0[10], used[10];
int ans;

void calc()
{
	int i, a, s;
	char *p;

	// 下一桁の合計で枝刈りしてみる
	s = 0; for (i = 0; i < m; i++) s += assign[str[i][len[i]]];
	a = assign[str[m][len[m]]];
	if (s % 10 != a) return;

	s = 0;
	for (i = 0; i < m; i++) {
		a = 0, p = str[i];
		while (*p >= 0) a = (a<<3) + (a<<1) + assign[*p++];
		s += a;
	}

	a = 0, p = str[m];
	while (*p >= 0) a = (a<<3) + (a<<1) + assign[*p++];
	if (a == s) ans++;
}

void rec(int k)
{
	int i;

	if (k == sz) { calc(); return; }
	if (!used[0]) {
		if (!not0[k]) used[0] = 1, assign[idx[k]] = 0, rec(k+1), used[0] = 0;
	}
	for (i = 1; i < 10; i++) {
		if (used[i]) continue;
		used[i] = 1, assign[idx[k]] = i, rec(k+1), used[i] = 0;
	}
}

int main()
{
	int n, i;
	char buf[10], *p;

	while (fgets(buf, 10, stdin) && *buf != '0') {
		sz = 0, memset(tr, -1, sizeof(tr));
		memset(not0, 0, sizeof(not0));
		n = atoi(buf), m = n - 1, max = 0;
		for (i = 0; i < n; i++) {
			fgets(str[i], 15, stdin);
			for (p = str[i]; *p > ' '; p++) {
				if (tr[*p] < 0) tr[*p] = sz, idx[sz++] = *p;
			}
			*p = -1; len[i] = p-str[i]-1;
			if (len[i] > 0) not0[tr[*str[i]]] = 1;
			if (i < m && len[i] > max) max = len[i];
		}
		ans = 0;
		if (len[m] >= max && len[m] <= max+2) {
			memset(used, 0, sizeof(used));
			rec(0);
		}
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 1752
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int n;
int a[200050],b[200050];
int mid,cnt;

void work()
{
	if(n%2==1)
		mid=(n-1)/2+1;
	if(n%2==0)
		mid=n/2+1;
	b[mid]=a[1];
	for(int i=2;i<=n;i++)
	{
		if(i%2==1)
		{
			b[mid+cnt]=a[i];
		}
		if(i%2==0)
		{
			cnt++;
			b[mid-cnt]=a[i];
		}
	}
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	work();
	if(n%2==0)
		for(int i=1;i<=n;i++)
			printf("%d ",b[i]);
	if(n%2==1)
		for(int i=n;i>=1;i--)
			printf("%d ",b[i]);
	return 0;
}

Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		int n;
		n = sc.nextInt();
		
		int a[][] = new int[2][n];
		
		for (int i = 0; i < n; i++) {
			a[0][i] = sc.nextInt();
			a[1][i] = i + 1;
		}
		
		//ソートする([0]の値でソート)
		//sort(a, n);
		quickSort(a, 0, n - 1);
		
		for (int i = 0; i < n; i++) {
			System.out.print( a[1][i] + " " );
		}
		
		return;
	}
	
	public static void sort(int array[][], int n) {
	
		if (array == null) {
			return;
		}
		
		for (int i = 0; i < n; i++) {
			for (int j = n - 1; j > i; j--) {
				if (array[0][j] < array[0][j-1]) {
					int temp0 = array[0][j];
					int temp1 = array[1][j];
					
					array[0][j] = array[0][j-1];
					array[1][j] = array[1][j-1];
					
					array[0][j-1] = temp0;
					array[1][j-1] = temp1;
				}
			}
		}

		return;
	}
	
	
	public static void quickSort(int array[][], int left, int right) {
	
		
		if ( left > right ) {
			return;
		}
		
		
		int pivotValue = array[0][(left + right) / 2];
		
		int i = left;
		int j = right;
		
		while ( i <= j ) {
			while (array[0][i] < pivotValue) {
				i++;
			}
			
			while (array[0][j] > pivotValue) {
				j--;
			}
			
			if ( i <= j ) {
				quickSortSwap(array, i, j);
				
				i++;
				j--;
			}
		}
		
		quickSort(array, left, j);
		quickSort(array, i, right);
	}
		
	

		
		
	public static void quickSortSwap(int array[][], int i, int j) {
		int temp0 = array[0][i];
		int temp1 = array[1][i];
		
		array[0][i] = array[0][j];
		array[1][i] = array[1][j];
		
		array[0][j] = temp0;
		array[1][j] = temp1;
		
		return;
	}

}

Measured memory_bytes: 64792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		ArrayDeque<String> q = new ArrayDeque<String>();
		
		try {
			int lim = Integer.parseInt(in.readLine());
			
			for (int i = 0; i < lim; i++) {
				String[] str = in.readLine().split(" ");
				
				if (str[0].equals("insert")) {
					q.addFirst(str[1]);
				} else if (str[0].equals("delete")) {
					q.remove(str[1]);
				} else if (str[0].equals("deleteFirst")) {
					q.removeFirst();
				} else {
					q.removeLast();
				}
			}
			
			System.out.print(q.remove());
			while (q.isEmpty() == false) {
				System.out.print(" " + q.remove());
			}
			System.out.println();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}



Measured memory_bytes: 228432
using System;
 
namespace Atcoder1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int t = int.Parse(input[2]);
            int B = t / a;
            int ans = B * b;
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
using namespace std;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a >= b && a >= c){
        cout << b+c << endl;
    }else if(b >= a && b >= c){
        cout << a+c << endl;
    }else{
        cout << a+b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
using ll = long long;
int main()
{
    int n,m;
    cin >> n >> m;
    set<int> se1,se2,se3;
    for(int i = 0;i < m;i++)
    {
        int s,c;
        cin >> s >> c;
        if(s == 1)
        {
            se1.insert(c);
        }
        else if(s == 2)
        {
            se2.insert(c);
        }
        else
        {
            se3.insert(c);
        }
    }
    if(se1.size() > 1 || se2.size() > 1 || se3.size() > 1)
    {
        cout << "-1\n";
        return 0;
    }
    if(n == 1)
    {
        if(se1.empty())
        {
            cout << "0\n";
        }
        else
        {
            cout << *se1.begin() << "\n";
        }
    }
    else if(n == 2)
    {
        if(!se1.empty() && *se1.begin() == 0)
        {
            cout << "-1\n";
        }
        else
        {
            int ans = 0;
            if(!se1.empty())
            {
                ans += *se1.begin() * 10;
            }
            else
            {
                ans += 10;
            }
            if(!se2.empty())
            {
                ans += *se2.begin();
            }
            cout << ans << "\n";
        }
    }
    else
    {
        if(!se1.empty() && *se1.begin() == 0)
        {
            cout << "-1\n";
        }
        else
        {  
            int ans = 0;
            if(!se1.empty())
            {
                ans += * se1.begin() * 100;
            }
            else
            {
                ans += 100;
            }
            if(!se2.empty())
            {
                ans += *se2.begin() * 10;
            }
            if(!se3.empty())
            {
                ans += *se3.begin();
            }
            cout << ans << "\n";
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <time.h>
using namespace std;
typedef long long ll;
int dp[30][30][30];
int main() {
	int a, b;
	cin >> a >> b;
	cout << a * b - a - b + 1 << endl;
	system("PAUSE");
	return 0;
}


Measured memory_bytes: 504
/*		Author : Kaustubh Gangwar
		||S||A||M||R||A||T||
*/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ld long double
#define pb push_back
#define gcd __gcd
#define vii vector<int>
#define vll vector<long long>
#define all(x) x.begin(),x.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
#define nl '\n'
typedef long long  ll;
typedef pair<int,int> pii;

ll bpow(ll a, ll b) {
	a=a; ll res = 1;
    while(b){
        if (b & 1)
        res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int32_t main()
{	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	ll test=1;
	//cin>>test;
	while(test--)
	{
		int n; cin>>n;
		string s[n];
		map<string,int> m;
		f(i,0,n)
		{
			cin>>s[i];
			m[s[i]]++;
			
		}
		cout<<"AC x "<<m["AC"]<<nl;
		cout<<"WA x "<<m["WA"]<<nl;
		cout<<"TLE x "<<m["TLE"]<<nl;
		cout<<"RE x "<<m["RE"]<<nl;
		
		
	}
return 0;
}


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

#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ll long long
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define MAX 1000000


ll  fastpower(ll a, ll n)
{
	ll res = 1;
	while(n > 0)
	{
		if(n % 2 != 0)
		{
			res = (res * a) % MOD;
		}
		n /= 2;
		a=(a * a) % MOD;
	}
	return res;
}

void getprime(vector<bool>&prime)
{
	prime[0] = false;
	prime[1] = false;
	
	for(ll i = 2;i <= MAX; i++)
	{
		if(prime[i])
		{
			for(ll j = i*i; j <= MAX; j += i)
				prime[j] = false;
		}
	}
}

void getfact(vector<ll> &fact, vector<ll> &ifact)
{
	fact[0] = 1;
	ifact[0] = 1;
	
	for(ll i = 1; i <= MAX; i++)
	{
		fact[i] = (fact[i-1] * i)%MOD;
		ifact[i] = (ifact[i-1] * fastpower(i, MOD -2) )%MOD;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll t,n,k,q;
	char c;
  cin>>c;
  char res = char((c-97 + 1)%26+97);
  cout<<res;
	return 0;
}

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

using namespace std;

int solve(int n, vector<double> x) {
    sort(x.begin(), x.end());
    double point = round(accumulate(x.begin(), x.end(), 0.0) / n);
    int ans = 0;
    for (auto& i : x) {
        int tmp = i - point;
        ans += std::pow(tmp, 2);
    }
    return ans;
}

int main() {
    int n;
    cin >> n;
    vector<double> x(n);
    for (int i=0; i<n; ++i)
        cin >> x.at(i);
    cout << solve(n, x);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
int n,a[111111],ans=1;
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	int f=0;
	sort(a,a+n);
	for(int i=n-1;i>=0;i--){
		if(f==2)break;
		if(a[i]==a[i-1]){
			ans*=a[i];
			f++;
			i--;
		}
	}
	if(f<2)puts("0");
	else cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
uint64_t mod = 1e9 + 7;
using namespace std;

void mulmod(uint64_t &x, uint64_t y) { x = (x * y) % mod; }

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

  int n;
  cin >> n;
  string s1, s2;
  cin >> s1 >> s2;
  uint64_t patterns = 1;
  int prev_type = 0;
  int i;
  for (i = 0; i < n - 1; ++i) {
    if (s1[i] == s1[i + 1]) {
      switch (prev_type) {
      case 0:
        mulmod(patterns, 6);
        break;
      case 1:
        mulmod(patterns, 2);
        break;
      case 2:
        mulmod(patterns, 3);
        break;
      }
      prev_type = 2;
      ++i;
    } else {
      switch (prev_type) {
      case 0:
        mulmod(patterns, 3);
        break;
      case 1:
        mulmod(patterns, 2);
        break;
      case 2: // do nothing
        break;
      }
      prev_type = 1;
    }
  }
  if (i == n - 1) {
    switch (prev_type) {
    case 0:
      mulmod(patterns, 3);
      break;
    case 1:
      mulmod(patterns, 2);
      break;
    case 2: // do nothing
      break;
    }
  }
  cout << patterns << "\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>	

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<int>> light;
	vector<int> p(M);
	light.resize(M);
	for (int i = 0; i < M; ++i) {
		int k;
		cin >> k;
		light[i].resize(k);
		for (int j = 0; j < k; ++j) {
			cin >> light[i][j];
		}
	}
	for (int i = 0; i < M; ++i) {
		cin >> p[i];
	}

	vector<int> stateS(N);
	int count = 0;
	for (int i = 0; i <= pow(2, N); ++i) {
		int checkC = 0;
		vector<int> stateL(M, 0);
		for (int j = 0; j < N; ++j) {
			stateS[j] = (i >> j) & (0b0000000001);
			checkC += stateS[j];
		}


		bool check = true;
		for (int j = 0; j < M; ++j) {
			for (int k = 0; k < light[j].size(); ++k) {
				stateL[j] += stateS[light[j][k] - 1];
			}
			if (stateL[j] % 2 != p[j])check = false;
		}
		if (check)++count;
		if (checkC == N)break;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=1000000007,INF=1ll<<60;
int dx[]={0,0,1,-1},dy[]={-1,1,0,0};

int N,X;
int dp[222][100010];

signed main() {
    IOS();
    cin>>N>>X;
    vint s(N);
    rep(i,0,N){
        cin>>s[i];
    }
    sort(all(s));
    reverse(all(s));
    
    dp[0][X]=1;
    rep(i,0,N){
        rep(j,0,X+1){
            (dp[i+1][j%s[i]]+=dp[i][j])%=MOD;
            (dp[i+1][j]+=dp[i][j]*(N-1-i))%=MOD;
        }
    }
    
    int ans=0;
    rep(i,0,100010){
        (ans+=dp[N][i]*i)%=MOD;
    }
    cout<<ans<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 157184
x, y = map(int, raw_input().split())

if x == y:
    print 0
elif x == -y:
    print 1
else:
    if abs(y) > abs(x):
        print (x < 0) + (y < 0) + abs(y) - abs(x)
    else:
        print (x > 0) + (y > 0) + abs(x) - abs(y)


Measured memory_bytes: 2568
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    int a,b; cin >> a >> b;
    cout << ((b%a == 0) ? a+b : b-a) << endl; return 0;
}


Measured memory_bytes: 256
a, b, c, x, y = map(int, input().split())

p2 = 0
for i in range(max(x, y)):
    ai = a * (x - i) if i < x else 0
    bi = b * (y - i) if i < y else 0
    abi = 2 * i * c
    p1 = ai + bi + abi

    ai1 = a * (x - i - 1) if i < x else 0
    bi1 = b * (y - i - 1) if i < y else 0
    abi1 = 2 * (i + 1) * c
    p2 = ai1 + bi1 + abi1
    if p1 < p2:
        print(p1)
        exit()

print(p2)

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

namespace A
{
    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 xab = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(Math.Abs(xab[0] - xab[1]) < Math.Abs(xab[0] - xab[2]) ? "A" : "B");
        }
    }
}


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

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

  int N, C; cin >> N >> C;
  vector<vector<int>> D(C, vector<int>(C));
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) {
      cin >> D[i][j];
    }
  }
  vector<vector<int>> count(3, vector<int>(C));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      int c; cin >> c;
      count[(i + j) % 3][c-1]++;
    }
  }

  int ans = 1 << 30;
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) {
      if (i == j) continue;
      for (int k = 0; k < C; k++) {
        if (i == k || j == k) continue;
        int res = 0;
        for (int c = 0; c < C; c++) {
          res += D[c][i] * count[0][c];
          res += D[c][j] * count[1][c];
          res += D[c][k] * count[2][c];
        }
        ans = min(ans, res);
      }
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

template<typename T>
T euclid(T a, T b){
  if(b == 0) return a;
  else return euclid(b, a % b);
}

/////////////////////////////////////////////////////////

void Main() {
  int N, K; cin >> N >> K;
  vector<int> A(N);
  int ma = 0;
  rep(i, 0, N){
    cin >> A[i];
    chmax(ma, A[i]);
  }
  int GCM = A[0];
  rep(i, 1, N) GCM = euclid(GCM, A[i]);
  string res;
  if(K % GCM == 0 && ma - GCM >= K || A[0] == K) res = "POSSIBLE";
  else res = "IMPOSSIBLE";
  cout << res << endl;
}

/////////////////////////////////////////////////////////

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
    using namespace std;
    typedef long long int ll;
    #define LONGMAX 1e14
    #define dd double
    #define MOD 998244353  
    # define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) 
    #define nl cout<<endl
    #define fill(a,val) memset(a,val,sizeof(a))
    #define rt ll Q[100005]={0}
    #define mp make_pair
    #define endl "\n"
    #define test() ll t;cin>>t;while(t--)
    #define pb push_back
    #define ff first    
    #define ss second
    #define all(v) v.begin(),v.end()
    #define s(ar,n) sort(ar,ar+n)
    #define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
    #define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
    #define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
    #define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
    #define maxa(ar,N) *max_element(ar,ar+N)
    #define mina(ar,N) *min_element(ar,ar+N)
    #define INF 1e15
    #define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
    #define printclock cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
    ll power(ll x, ll y){ll res=1;while(y>0){if(y&1)res = (res*x);y = y>>1;x = (x*x);}return res;}  
    ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
    void ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){if(low>high)return;ll mid=(low+high)/2;if(ar[mid]>=x){y=mid;ceilsearch(ar,low,mid-1,x,y);}else{ceilsearch(ar,mid+1,high,x,y);}}
    signed main()   
    {
        fastio();   
        long double N;
        cin>>N;
        N/=3.0;
        N=(N*N*N);
        cout<<fixed<<setprecision(10)<<N<<endl;
    }   

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

public class Main {
    
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
	    int n = in.readInt();
	    int arr[] = new int[n]; 
	    long sum = 0; 
	    for(int i = 0; i<n; i++) {
	    	arr[i] = in.readInt();
	    	sum += arr[i]; 
	    }
	    Arrays.sort(arr);
	    if(sum % 10 != 0) {
	    	System.out.println(sum); 
	    	return; 
	    }
	    for(int i = 0; i<n; i++) {
	    	if(arr[i] % 10 != 0) {
	    		sum -= arr[i]; 
	    		if(sum % 10 != 0) {
	    			System.out.println(sum); 
	    			return; 
	    		}
	    	}
	    }
	    System.out.println(0); 
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define M 1000000007
#define N 100001
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

int t, n;
ll dp[2001];

ll solve(int rem) {
    if(rem == 0) return 1;

    if(rem < 3) return 0;

    if(dp[rem] != -1) return dp[rem];

    ll ans = 0, temp;
    for(int d=3; d<=rem; d++) {
        ans = (ans +  solve(rem - d)) % M;
    }

    return dp[rem] = ans;
}

int main() {
    //scanf("%d", &t);
    t = 1;
    while(t--) {
        scanf("%d", &n);  
        if(n < 3) {
            printf("0\n");
            return 0;
        }

        for(int i=0; i<=n; i++) dp[i] = -1;
        printf("%lld\n", solve(n));
        //for(int i=0; i<=7; i++) printf("[n:%d, dp:%lld]\n", i, dp[i]);
    }
	return 0;
}


Measured memory_bytes: 3864
#include <stdio.h>
int a[100001],b[100001];
main(n,k,m,i){
	for(;scanf("%d%d",&n,&k),n;printf("%d\n",m)){
		for(i=1;i<=k;i++)
			scanf("%d",a+i),b[i]=b[i-1]+a[i];
		for(m=b[i];i<=n;i++){
			scanf("%d",a+i),b[i]=b[i-1]+a[i]-a[i-k];
			if(m<b[i])m=b[i];
		}
	}
	return 0;
}

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

string s;
int k = 0;

int main() {
    cin >> s;
    
    for(int i = 0; i < s.size(); i++)
        k = (k + (s[i] - '0')) % 9;
    
    if(k == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}



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

int ans;
int p, q, a, n;


void dfs(int pp, int qq, int step, int now){
	if (p * qq == q * pp) {
		ans++;
		return;
	}
	if (step == 0) return;
	if (p * qq < q * pp) return;

	for (int i = now; qq * i <= a; i++) {
		dfs(i * pp + qq, i * qq, step - 1, i);
	}
}

int main(){

	while (cin >> p >> q >> a >> n , !(p == 0 && q == 0 && a == 0 && n == 0)) {
		ans = 0;

		dfs(0, 1, n, 1);

		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<set>
#include<map>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    if(n == 1){
        cout << 1 << endl;
        return 0;
    }
    map<ll,set<ll>> m;
    vector<ll> x(n), y(n);
    for(int i = 0; i < n; i++)  cin >> x[i] >> y[i];
    for(int i = 0; i < n; i++)  m[x[i]].insert(y[i]);
    int ans = 500;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i == j)  continue;
            ll p = x[j]-x[i], q = y[j]-y[i];
            int tmp = n;
            for(int k = 0; k < n; k++){
                if(m[x[k]-p].count(y[k]-q)) tmp--;
            }
            if(tmp == 0)    tmp++;
            ans = min(ans, tmp);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6016
H, W = map(int,input().split())
ans = min(H, W)
h = round(H / 3)
w = W // 2
a = h * W
b = (H-h) * w
c = (H-h) * (W-w)
ans = min(ans, max(a, b, c) - min(a, b, c))

h = H // 2
w = round(W / 3)
a = H * w
b = (W-w) * h
c = (W-w) * (H-h)
ans = min(ans, max(a, b, c) - min(a, b, c))
if(H%3 == 0 or W%3 == 0):
  ans = 0
print(ans)

Measured memory_bytes: 3064
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e3 + 10;
const ll MAXS = 2e4 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n, W[MAXN], S[MAXN], V[MAXN], dp[MAXN][MAXS];
pll P[MAXN];

int main() {
    fast_io;

    cin >> n;
    for (ll i = 1; i <= n; i++) {
        cin >> W[i] >> S[i] >> V[i];
        P[i] = {S[i] + W[i], i};
    }

    sort(P + 1, P + n + 1);

    for (ll i = 1; i <= n; i++) {
        for (ll j = 0; j < MAXS; j++) dp[i][j] = dp[i - 1][j];

        ll ind = P[i].Y;
        for (ll j = W[ind]; j <= W[ind] + S[ind]; j++) {
            dp[i][j] = max(dp[i][j], dp[i - 1][j - W[ind]] + V[ind]);
        }
    }
    cout << *max_element(dp[n], dp[n] + MAXS) << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 157824
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

vector<int> p(1000010,0);

void bunkai(ll x){
   for(int i=2;i<=sqrt(x);++i){
       int cnt=0;
       while(x%i==0){
           x/=i;
           ++cnt;
       }
       p[i]=max(p[i],cnt);
   }
   if(x>1) p[x]=max(p[x],1);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main() {
    int N; cin>>N;
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin>>A[i];
        bunkai(A[i]);
    }

    ll lcd=1ll;
    for(int i=1;i<1000010;++i){
        (lcd*=modpow(i,p[i],MOD))%=MOD;
    }

    ll ans=0ll;
    for (int i = 0; i < N; ++i) {
        ll b=(lcd*modinv(A[i],MOD))%MOD;
        (ans+=b)%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    int N,A,B;
    cin >> N >> A >> B;
    
    cout << min(N*A,B) << endl;
        return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;cin>>a>>b;
  cout << (a+b+1)/2<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n;
	int* arr;
	cin >> n;
	arr = new int[n];
	for (int i = n - 1; i >= 0; --i) {
		int num;
		cin >> num;
		arr[i] = num;
	}

	for (int i = 0; i < n; ++i) {
		cout << arr[i];
		if (i != n - 1) {
			cout << " ";
		}
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 3128
# coding: utf-8

n, max_weight = list(map(int, input().split(" ")))

value = []
weight = []

for _ in range(n):
    v, w = list(map(int, input().split(" ")))
    value.append(v)
    weight.append(w)

dp = []
for _ in range(n+1):
    dp.append([0 for _ in range(max_weight+1)])

for i in range(n):
    for j in range(max_weight+1):
        if j >= weight[i]:
            dp[i+1][j] = max(dp[i][j - weight[i]] + value[i], dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]

print(dp[n][max_weight])


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

int main() {
  int h; cin >> h;
  int n; cin >> n;
  ll sum = 0;
  int tmp;
  rep(i, n) {
    cin >> tmp;
    sum += tmp;
    if (sum >= h) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

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

using namespace std;

int top;
int Stack[1000];

void push(int x)
{
    Stack[++top] = x;
}

int pop()
{
    top--;
    return Stack[top + 1];
}

int main()
{
    string s;
    int a, b;
    while(cin >> s){
        if(s == "+"){
            a = pop();
            b = pop();
            push(a + b);
        }else if(s == "-"){
            a = pop();
            b = pop();
            push(b - a);
        }else if(s == "*"){
            a = pop();
            b = pop();
            push(a * b);
        }else{
            push(atoi(s.c_str()));
        }
    }
    cout << pop() << endl;
    return 0;
}


Measured memory_bytes: 3212
#include <iostream>
#include <string>
#include <algorithm>
#include  <set>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)

int main() {
	ll a, b, c, d, e, f, g,  i, j, n,k, m, l;
	ll v[100],sum=-100000000,h ;
	cin >> a >> b;
	sum = 0;
	if (a >= b) {
		sum = sum + a;
		a--;
	}
	else {
		sum = sum + b;
		b--;
		
	}
	sum = sum + max(a, b);
	

	cout << sum;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int X;
std::pair<int, int> ans;

bool checker(std::pair<int, int> in){
    long long a = in.first;
    long long b = in.second;
    long long tmp = (a - b) * ((a*a*a*a) + (a*a*a*b) + (a*a*b*b) + (a*b*b*b) + (b*b*b*b));
    if(tmp == (long long)X){
        ans = in;
//        std::cout << (a - b) <<  "/" << (a*a*a*a) <<  "/" << (a*a*a*b) <<  "/" << (a*a*b*b) <<  "/" << (a*b*b*b) <<  "/" << (b*b*b*b) << std::endl;
        return true;
    }

    return false;
}


int main(){
    std::cin >> X;

    for(int A = 200; A >= -200; A--){
        for(int B = 200; B >= -200; B--){
            if(checker(std::pair<int, int>(A, B)) == true){
                std::cout << A << " " << B << std::endl;
                return 0;
            }
        }
    }
    return 0;
}


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

typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
const ll integer=1000000000;


int main(){
int n;
   cin >> n;
   double x = n/(1.08);
   int ans=(int)x*1.08;
   //cout << x << endl;
   //cout << ans << endl;
   if (ans==n){
       cout << (int)x << endl;
   }
   else{
       x++;
       int temp=(int)x*1.08;
       //cout << temp << endl;
       if (n==temp){
           cout << (int)x << endl;
       }
       else cout << ":(" << endl;
   }
   return 0;
}

Measured memory_bytes: 256
class UnionFind:
  def __init__(self, n):
    self.n = [-1]*n
    self.r = [0]*n
    self.co = n

  def find_root(self, x):
    if self.n[x] < 0:
      return x
    else:
      self.n[x] = self.find_root(self.n[x])
      return self.n[x]

  def unite(self, x, y):
    x = self.find_root(x)
    y = self.find_root(y)
    if x == y:
      return
    elif self.r[x] > self.r[y]:
      self.n[x] += self.n[y]
      self.n[y] = x
    else:
      self.n[y] += self.n[x]
      self.n[x] = y
      if self.r[x] == self.r[y]:
        self.r[y] += 1
    self.co -= 1

  def same(self, x, y):
    return self.find_root(x) == self.find_root(y)

  def size(self, x):
    return -self.n[self.find_root(x)]

  def set_count(self):
    return self.co

n, m = map(int, input().split())
uf = UnionFind(n)
for _ in range(m):
  a, b = map(int, input().split())
  uf.unite(a-1, b-1)
print(uf.set_count()-1)

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

#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()
#define MAX(a) *max_element(all(a))

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
using ll = long long;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

int main() {
  int N;
  cin >> N;
  vi a(N), b(N), c(N);
  rep(i, N) cin >> a[i];
  rep(i, N) cin >> b[i];
  rep(i, N) cin >> c[i];
  sort(all(a)), sort(all(c));

  ll res = 0;
  rep(i, N) {
    int mid = b[i];
    auto itr = lower_bound(all(a), mid);
    ll cnt_a = distance(a.begin(), itr);
    itr = lower_bound(all(c), mid + 1);
    ll cnt_b = distance(itr, c.end());
    res += cnt_a * cnt_b;
  }

  cout << res << endl;
}

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

int main(){
	int N, d[100],i=0,j=0,X;

	cin >> N;
	for(i=0;i<N;i++) cin >> d[i];

	for(i=0;i<N-1;i++){
		for(j=N-1;j>i;j--){
			if(d[j-1]<d[j]){
				X = d[j];
				d[j] = d[j-1];
				d[j-1] = X;
			}
		}
	}
	X=1;
	i=0;
	while(i<N-1){
		if(d[i]!=d[i+1]) X++;
		i++;
	}
	cout << X;
		
}

Measured memory_bytes: 256
import math

N,D=map(int, input().split())
X=[list(map(int, list(input().split()))) for i in range(0,N)]
sum=0
ans=0

for i in range(0,N-1):
  for j in range(i+1,N):
    sum=0
    for k in range(0,D):
      sum+=(X[j][k]-X[i][k])**2
    M=math.sqrt(sum)
    if M.is_integer():
      ans+=1 
  
print(ans)

Measured memory_bytes: 3064
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

vector<int> num[1500];

void hora(int tc) {
	int n = 1407;
	int k = 38;
	int idx = 0;
	for(int i = 2;i <= n;i++) {
		idx = max(idx, (i - 2) / 37);
		num[(i - 2) / 37].PB(i);
	}
	cout<<n<<" "<<k<<endl;
	int ctr = 0;
	for(int i = 0;i <= idx;i++) {
		cout<<1;
		for(auto x: num[i]) {
			cout<<" "<<x;
		}
		cout<<endl;
		ctr++;
	}
	int offset = 0;
	for(auto x: num[0]) {
		int start = 0;
		for(int i = 0;i < 37;i++) {
			cout<<x;
			int ft = start;
			for(int j = 0;j < 37;j++) {
				cout<<" "<<num[j + 1][ft];
				ft = (ft + offset) % 37;
			}
			start = (start + 1) % 37;
			ctr++;
			cout<<endl;
		}
		offset++;
	}
//	cout<<ctr<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}




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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  string a, b;
  cin >> a >> b;
  int n = a.size();
  for (int i = 0; i < n; i++){
    int ind = i;
    ind = ind % n;
    bool f = true;
    for (int j = 0; j < n; j++){
      if (a[ind % n] != b[j]){
        f = false;
        break;
      }
      ind++;
      ind %= n;
    }
    if (f){
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char ai[105];
char qw[105];
char qe[105];
int main()
{
    int a;
    scanf("%d",&a);
    getchar();
    scanf("%s",ai);
    int l1=0,l2=0;
    int sum = 0;
    int len = strlen(ai);
    for(int i=1;i<len;i++)
    {
        l1=0;l2=0;
        for(int p=0;p<105;p++)
            qw[p] = '\0';
        for(int e=0;e<i;e++)
        {
            char t = ai[e];
            int len1 = strlen(qw);
           // printf("len%d\n",len1);
            int flag = 0;
            for(int w = 0;w<len1;w++)
                if(qw[w]==t)
                    flag =1;
            if(flag ==0){
                qw[l1] = t;
                l1++;
            }
        }
        //printf("%s\n",qw);
        for(int j = 0;j<l1;j++)
        {
          char y = qw[j];
          for(int u=i;u<len;u++)
          {
              if(y==ai[u])
              {
                l2++;
                break;
              }
          }
        }
        if(l2>=sum)
            sum=l2;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<math.h>
#include<algorithm>

using namespace std;



int main(){

    long long n;
    cin >> n;

    long long a[n];
    for(long long i=0;i<n;i++)cin >> a[i];

    long long minus = 0;
    for(long long i=0;i<n;i++){
        if(a[i]<0)minus++;
    }
    long long ans = 0;
    for(long long i=0;i<n;i++){
        if(a[i]<0)a[i] = -a[i];
    }
    sort(a, a+n);
    for(long long i=0;i<n;i++){
        ans += a[i];
    }
    if(minus%2==1)ans -= 2*a[0];

    cout << ans << endl;

}


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) 
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(const T x,const T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),b.begin(),b.end());}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}

typedef long long ll;
typedef pair<ll, ll> P;

const int MOD=1e9+7;
const int MAX=1e5+100;

vector<ll> bellman_ford(int V, int s, vector<vector<P>> &G) {
  vector<ll> d(V,-LLONG_MAX);d[s]=0;
  REP(i,V-1) {
    REP(v,V) {
      if (d[v]==-LLONG_MAX) continue;
      for (P p:G[v]) {
        mmax(d[p.first],d[v]+p.second);
      }
    }
  }
  return d;
}

vector<bool> loop_checker(int V, vector<ll> &d, vector<vector<P>> &G) {
  vector<bool> res(V,false);
  REP(v,V) {
    if (d[v]==-LLONG_MAX) continue;
    for (P p:G[v]) {
      if (d[p.first]<d[v]+p.second) {
        d[p.first] = d[v]+p.second;
        res[v] = true;
        res[p.first] = true;
      }
    }
  }
  return res;
}

int main() {
  // 到着するまでのスコアの最大値。無限はinf
  // 脱出可能な閉路で、一周した結果がプラスならinf
  int N,M;cin>>N>>M;
  // グラフ作る
  vector<vector<P>> G(N);
  REP(i,M) {
    ll a,b,c;cin>>a>>b>>c;
    a--;b--;
    G[a].push_back({b,c});
  }
  vector<ll> d = bellman_ford(N,0,G);
  vector<bool> lc = loop_checker(N,d,G);
  (lc[N-1]) ? OUT("inf") : OUT(d[N-1]);

  return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top,S[1000];

void push(int x){
  S[++top]=x;
}
int pop(){
  top--;
  return S[top+1];
}
 
int main(){
  int a,b;
  top=0;
  char s[100];
  while( scanf("%s", s) != EOF ){
     
    if ( s[0] == '+' ){
      a=pop();
      b=pop();
      push(a+b);
    }
    else if ( s[0] == '-' ){
      b=pop();
      a=pop();
      push(a-b);
    }
    else if ( s[0] == '*' ){
      a=pop();
      b=pop();
      push(a*b);
    }
    else {
      push(atoi(s)); 
    }
  }
  printf("%d\n",pop());
   
  return 0;
}

Measured memory_bytes: 548
n=int(input())
a=[int(i) for i in input().split()]
a.insert(0,0)
f=1
for i in range(1,n+1):
    if a[i]!=i:
        r=a[i]
        t=a[i]
        a[i]=a[r]
        a[r]=t
        break
for i in range(n):
    if a[i]>a[i+1]:
        f=0
if f==0:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
    int a,b,c;
    int res = 1;

    cin >> a >> b >> c;

    if (a == b)
    {
        if (b != c)
            res++;
    }
    else
    {
        if (a != c)
            res++;
        if (b != c)
            res++;
    }

    cout << res;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100005

int table[NUM];
int ruisekiwa[NUM];

int main(){

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

		if(i%2 == 1){

			table[i] = 1; //素数

		}else{

			table[i] = 0;
		}
	}
	table[1] = 0;
	table[2] = 1;//★★バグに注意★★

	for(int i = 3; i < NUM; i += 2){

		if(table[i] == 0)continue;

		for(int k = 2*i; k < NUM; k += i){

			table[k] = 0;
		}
	}

	ruisekiwa[0] = 0;

	for(int i = 1; i < NUM; i++){

		if(i%2 == 0 || table[i]%2 == 0){

			ruisekiwa[i] = 0;

		}else{

			if(table[(i+1)/2] == 1){

				ruisekiwa[i] = 1;

			}else{

				ruisekiwa[i] = 0;
			}
		}
		ruisekiwa[i] += ruisekiwa[i-1];
	}

	int num_query;

	scanf("%d",&num_query);

	int left,right;

	for(int loop = 0; loop < num_query; loop++){

		scanf("%d %d",&left,&right);

		printf("%d\n",ruisekiwa[right]-ruisekiwa[left-1]);

	}

	return 0;
}


Measured memory_bytes: 1408